:root {
  color-scheme: light;
  --ink: #14221c;
  --ink-soft: #263a31;
  --muted: #68766f;
  --line: #d9e3dd;
  --line-strong: #bccbc2;
  --panel: #ffffff;
  --page: #f1f5f2;
  --green: #126642;
  --green-dark: #0d4d32;
  --green-soft: #e4f3eb;
  --lime: #d9f45d;
  --gold: #9a6918;
  --gold-soft: #fff4d7;
  --red: #9f3737;
  --red-soft: #fff0f0;
  --blue: #315d89;
  --blue-soft: #eaf2fa;
  --shadow: 0 12px 38px rgba(24, 51, 38, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 85% 0, rgba(217, 244, 93, .15), transparent 25rem),
    var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.5;
}

button, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(18, 102, 66, .32);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 12px;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.topbar, main, footer { width: min(1240px, calc(100% - 32px)); margin-inline: auto; }
.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 42px 0 26px;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(32px, 5vw, 54px); line-height: 1.04; letter-spacing: -.04em; }
h2 { margin: 0; font-size: clamp(22px, 3vw, 31px); line-height: 1.15; letter-spacing: -.025em; }
h3, h4 { line-height: 1.3; }
.subtitle, .view-subtitle, .section-note { color: var(--muted); }
.subtitle { max-width: 780px; margin: 13px 0 0; }
.site-nav { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.site-nav a {
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255,255,255,.7);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.site-nav a:hover { border-color: var(--green); background: var(--green-soft); }
.site-nav a[aria-current="page"] { border-color: var(--ink); background: var(--ink); color: #fff; }

.module-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow);
}
.module-tab {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.module-tab span, .module-tab small { display: block; }
.module-tab span { color: var(--ink); font-size: 16px; font-weight: 900; }
.module-tab small { margin-top: 3px; font-size: 12px; }
.module-tab:hover { background: #f5f8f6; }
.module-tab.active {
  border-color: var(--green-dark);
  background: var(--ink);
  color: #bac9c1;
  box-shadow: 0 6px 20px rgba(20, 34, 28, .16);
}
.module-tab.active span { color: #fff; }

.view-head, .section-heading, .panel-head, .match-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}
.view-head { align-items: end; margin-bottom: 22px; }
.view-subtitle { max-width: 760px; margin: 9px 0 0; }
.section-heading { align-items: end; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 14px; }
.section-note { max-width: 760px; margin: 7px 0 0; font-size: 13px; }
.actions { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: 9px; }
button {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}
button:hover:not(:disabled) { border-color: var(--green); }
button.primary { border-color: var(--green); background: var(--green); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--green-dark); }
button.secondary { background: rgba(255,255,255,.82); }

.status-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  overflow: hidden;
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}
.status-strip div {
  min-width: 0;
  padding: 17px 18px;
  border-right: 1px solid rgba(255,255,255,.11);
}
.status-strip div:last-child { border-right: 0; }
.status-strip span { display: block; margin-bottom: 5px; color: #aebcb5; font-size: 11px; }
.status-strip strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v421-shadow-panel, .model-contract, .account-section, .matches-section, .orders-section,
.curve-panel, .run-panel, .pending-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow);
}
.v421-shadow-panel, .model-contract, .account-section, .matches-section, .orders-section { margin-bottom: 20px; padding: 22px; }
.v421-shadow-panel { border-top: 4px solid var(--green); }
.v421-shadow-panel.waiting { border-top-color: var(--gold); }
.v421-shadow-panel.unavailable { border-color: #e3abab; border-top-width: 4px; background: var(--red-soft); }
.v421-state-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.v421-metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.v421-metrics article { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #f8faf9; }
.v421-metrics span { display: block; color: var(--muted); font-size: 11px; }
.v421-metrics strong { display: block; overflow-wrap: anywhere; margin-top: 6px; font-size: clamp(15px, 2vw, 20px); line-height: 1.2; }
.v421-recommendations { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.v421-recommendations-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v421-recommendations-heading h3 { margin: 0; font-size: 15px; }
.v421-recommendations-heading span { color: var(--muted); font-size: 12px; }
.v421-recommendation-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.v421-recommendation-card { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.v421-recommendation-card.blocked { border-color: #e5c8be; background: #fffaf8; }
.v421-recommendation-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.v421-recommendation-card h4 { margin: 0; font-size: 14px; }
.v421-recommendation-card .ticket-meta { color: var(--muted); font-size: 11px; }
.v421-recommendation-note { margin: 6px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.v421-recommendation-audit { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f4f7f4; font-size: 12px; line-height: 1.5; }
.v421-recommendation-card.blocked .v421-recommendation-audit { background: #fbeee9; color: #7a3523; }
.v421-recommendation-card ul { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.v421-recommendation-card li { padding: 10px 0 2px; border-top: 1px dashed var(--line); font-size: 12px; line-height: 1.55; }
.recommendation-leg-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.recommendation-leg-head strong { color: var(--ink); font-size: 13px; }
.recommendation-leg-head time { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.recommendation-leg-league { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; }
.recommendation-bet { display: block; margin-top: 6px; color: var(--green-dark); font-size: 13px; font-weight: 950; }
.recommendation-leg-metrics { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 5px; color: var(--muted); }
.recommendation-result { display: block; margin-top: 5px; font-weight: 800; }
.recommendation-settlement { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; padding: 9px 10px; border-radius: 8px; background: var(--green-soft); font-size: 11px; }
.recommendation-settlement span { color: var(--muted); }
.recommendation-settlement strong { margin-left: 4px; color: var(--ink); }
.recommendation-settlement strong.money-positive { color: var(--green); }
.recommendation-settlement strong.money-negative { color: var(--red); }
.recommendation-technical { margin-top: 10px; font-size: 11px; }
.recommendation-technical summary { padding-top: 10px; }
.recommendation-technical dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 10px; margin: 9px 0 0; }
.recommendation-technical dt { color: var(--muted); }
.recommendation-technical dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.v421-as-of { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.model-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; }
.model-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
}
.model-card.formal { border-top-color: var(--green); }
.model-card.paper { border-top-color: var(--blue); }
.model-card.locked { border-top-color: var(--gold); }
.model-card.mismatch { border-color: #d8a34c; background: var(--gold-soft); }
.model-card h3 { overflow-wrap: anywhere; margin: 14px 0 8px; font-size: 15px; }
.model-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.card-kicker { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-kicker span { font-size: 22px; font-weight: 950; letter-spacing: -.04em; }
.card-kicker b { padding: 4px 7px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 10px; }
.paper .card-kicker b { background: var(--blue-soft); color: var(--blue); }
.locked .card-kicker b { background: var(--gold-soft); color: var(--gold); }
.audit-list { margin: 12px 0 0; }
.audit-list div { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.2fr); gap: 8px; padding: 5px 0; border-top: 1px solid #edf1ee; }
.audit-list dt { color: var(--muted); font-size: 11px; }
.audit-list dd { overflow-wrap: anywhere; margin: 0; font-size: 11px; font-weight: 800; text-align: right; }

.notice {
  margin-bottom: 20px;
  padding: 13px 16px;
  border: 1px solid #edcd8a;
  border-radius: 11px;
  background: #fff8e8;
  color: #70501b;
}
.notice.error { border-color: #e3abab; background: var(--red-soft); color: #842b2b; }
.notice.success { border-color: #9fcbb2; background: var(--green-soft); color: var(--green-dark); }
.hidden { display: none !important; }

.updated { margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.account-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.metric-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f8faf9; }
.metric-card span, .metric-card small { display: block; color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; overflow-wrap: anywhere; margin: 7px 0 4px; font-size: clamp(18px, 2.4vw, 26px); line-height: 1; }
.metric-card.positive strong { color: var(--green); }
.metric-card.negative strong { color: var(--red); }
.metric-card.alert { border-color: #d8a34c; background: var(--gold-soft); }
.integrity-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 12px; }

.simulation-grid { display: grid; grid-template-columns: 1.6fr .8fr; gap: 20px; margin-bottom: 20px; }
.curve-panel, .run-panel { min-width: 0; padding: 21px; }
.panel-head { align-items: center; }
.panel-meta { color: var(--muted); font-size: 12px; }
.equity-chart { min-height: 220px; margin-top: 14px; }
.equity-chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.equity-grid-line { stroke: #e1e9e4; stroke-width: 1; }
.equity-baseline { stroke: #9daf9f; stroke-width: 1; stroke-dasharray: 5 5; }
.equity-area { fill: rgba(18, 102, 66, .09); }
.equity-line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.equity-point { fill: var(--panel); stroke: var(--green); stroke-width: 2; }
.equity-label { fill: var(--muted); font-size: 10px; }
.chart-empty { display: grid; min-height: 210px; place-items: center; border: 1px dashed var(--line-strong); border-radius: 11px; color: var(--muted); text-align: center; }
.status-badge, .count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 900;
}
.status-badge.neutral, .count-badge { background: #edf2ef; color: var(--muted); }
.status-badge.good { background: var(--green-soft); color: var(--green); }
.status-badge.warn { background: var(--gold-soft); color: var(--gold); }
.status-badge.bad { background: var(--red-soft); color: var(--red); }
.run-state-list { margin: 18px 0 0; }
.run-state-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.run-state-list dt { color: var(--muted); font-size: 12px; }
.run-state-list dd { margin: 0; font-size: 12px; font-weight: 800; text-align: right; }
.panel-note { margin: 15px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filter { min-height: 36px; padding: 6px 12px; color: var(--muted); }
.filter.active { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.match-list { display: grid; gap: 14px; }
.match-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.match-pager span { color: var(--muted); font-size: 12px; font-weight: 800; }
.match-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.match-meta { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.match-title { margin: 0; font-size: clamp(19px, 2.6vw, 26px); }
.tier { min-width: 42px; padding: 6px 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-weight: 950; text-align: center; }
.tier.low { background: #f3eee5; color: var(--gold); }
.v421-ticket-decision {
  display: grid;
  grid-template-columns: auto max-content minmax(0, 1fr);
  align-items: center;
  gap: 9px 13px;
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf9;
}
.v421-ticket-decision > span { color: var(--muted); font-size: 11px; font-weight: 900; }
.v421-ticket-status { font-size: 13px; }
.v421-ticket-reason { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.v421-ticket-decision.positive-blocked { border-color: #d8a34c; background: var(--gold-soft); }
.v421-ticket-decision.positive-blocked .v421-ticket-status { color: var(--gold); }
.v421-ticket-decision.negative, .v421-ticket-decision.blocked { border-color: #e3abab; background: var(--red-soft); }
.v421-ticket-decision.negative .v421-ticket-status, .v421-ticket-decision.blocked .v421-ticket-status { color: var(--red); }
.v421-ticket-decision.accepted { border-color: #aad1bc; background: var(--green-soft); }
.v421-ticket-decision.accepted .v421-ticket-status { color: var(--green); }
.headline-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 18px; }
.headline-item { padding: 14px; border-radius: 11px; background: #f5f8f6; }
.headline-item span, .headline-item small { display: block; color: var(--muted); font-size: 11px; }
.headline-item strong { display: block; margin: 5px 0 3px; font-size: 19px; }
.headline-item strong.positive { color: var(--green); }
.headline-item strong.negative { color: var(--red); }
.probability-section { margin-top: 17px; }
.section-label { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.section-label span { font-weight: 900; }
.section-label small { color: var(--muted); }
.probabilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.probabilities div { display: grid; grid-template-columns: auto auto; gap: 5px 9px; align-items: center; }
.probabilities b { justify-self: end; }
.bar { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 99px; background: #e6ece8; }
.bar em { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); }
details { margin-top: 17px; border-top: 1px solid var(--line); }
summary { padding-top: 14px; color: var(--green); font-weight: 900; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-top: 13px; }
.detail-grid section { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.detail-grid h4 { margin: 0 0 9px; font-size: 13px; }
.compact-probs, .goal-distribution, .scorelines, .platform-odds, .expected-return-details, .quality, .recommendation {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.pill { padding: 4px 7px; border-radius: 7px; background: #edf3ef; color: var(--ink); }
.pill.missing { background: var(--gold-soft); color: var(--gold); }
.recommendation .danger { color: var(--red); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.orders-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.orders-table th, .orders-table td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.orders-table th { position: sticky; top: 0; z-index: 1; background: #f2f6f3; color: var(--muted); font-size: 11px; white-space: nowrap; }
.orders-table td { font-size: 12px; }
.orders-table tbody tr:last-child td { border-bottom: 0; }
.order-title { display: block; min-width: 170px; font-weight: 900; }
.order-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.money-positive { color: var(--green); font-weight: 900; }
.money-negative { color: var(--red); font-weight: 900; }
.platform-label { display: inline-flex; padding: 4px 8px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 900; white-space: nowrap; }
.platform-label.macau { background: var(--gold-soft); color: var(--gold); }
.empty { padding: 36px 18px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); text-align: center; }
.orders-section > .empty { margin-top: 12px; }
.statistics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.statistics-grid .metric-card strong { font-size: clamp(16px, 2vw, 22px); }
.ticket-warehouse {
  display: grid;
  gap: 18px;
}
.ticket-day {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf9;
}
.ticket-day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  padding: 14px 16px 14px 44px;
  border-bottom: 1px solid var(--line);
  background: #eef4f0;
  cursor: pointer;
  list-style: none;
}
.ticket-day-heading::-webkit-details-marker { display: none; }
.ticket-day-heading::before {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--green);
  content: "−";
  font-size: 15px;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
  transform: translateY(-50%);
}
.ticket-day:not([open]) .ticket-day-heading { border-bottom: 0; }
.ticket-day:not([open]) .ticket-day-heading::before { content: "+"; }
.ticket-day-date { color: var(--ink); font-size: 16px; }
.ticket-day-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px 14px; color: var(--muted); font-size: 11px; }
.ticket-day-summary b { color: var(--ink); }
.ticket-day-cards { display: grid; gap: 12px; padding: 14px; }
.paper-ticket {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 12px;
  background: #fff;
}
.paper-ticket.is-pending { border-left-color: var(--gold); }
.paper-ticket.is-lost { border-left-color: var(--red); }
.paper-ticket-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.paper-ticket-type { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 5px; color: var(--green-dark); font-size: 15px; font-weight: 950; }
.paper-ticket-placed { display: block; color: var(--muted); font-size: 11px; }
.paper-ticket-head .status-badge { flex: 0 0 auto; }
.ticket-leg-list { display: grid; gap: 10px; margin-top: 13px; }
.ticket-leg {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(210px, 1fr) minmax(150px, .7fr);
  gap: 13px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}
.ticket-leg > div { min-width: 0; }
.ticket-leg-league { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; }
.ticket-leg-teams { display: block; font-size: 13px; font-weight: 950; }
.ticket-leg-kickoff { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.ticket-leg-bet { display: block; color: var(--green-dark); font-size: 13px; font-weight: 950; }
.ticket-leg-numbers,
.ticket-leg-result { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.ticket-leg-result { color: var(--ink); font-weight: 800; }
.ticket-finance {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.ticket-finance div { min-width: 0; padding: 9px 10px; border-radius: 9px; background: #f2f6f3; }
.ticket-finance span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.ticket-finance strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.ticket-technical { margin-top: 10px; font-size: 11px; }
.ticket-technical summary { padding-top: 10px; }
.ticket-technical dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 10px; margin: 9px 0 0; }
.ticket-technical dt { color: var(--muted); }
.ticket-technical dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.history-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf9;
}
.history-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.history-filters input, .history-filters select {
  min-height: 40px;
  min-width: 150px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.history-actions { display: flex; gap: 8px; }
.history-notice { min-height: 20px; margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.history-notice.error { color: var(--red); }
.history-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.history-pager span { color: var(--muted); font-size: 12px; font-weight: 800; }
.pending-summary { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; margin-bottom: 20px; border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.pending-summary div { min-width: 0; padding: 18px 20px; border-right: 1px solid rgba(255,255,255,.11); }
.pending-summary div:last-child { border-right: 0; }
.pending-summary span { display: block; margin-bottom: 6px; color: #aebcb5; font-size: 11px; }
.pending-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-table-wrap { padding: 0; }
#pendingView > .empty { margin-top: 14px; }

footer { display: flex; justify-content: space-between; padding: 30px 0 40px; color: var(--muted); font-size: 12px; }
footer a { color: var(--green); font-weight: 800; }

@media (max-width: 1100px) {
  .status-strip { grid-template-columns: repeat(3, 1fr); }
  .status-strip div:nth-child(3n) { border-right: 0; }
  .status-strip div:nth-child(-n+3) { border-bottom: 1px solid rgba(255,255,255,.11); }
  .account-grid { grid-template-columns: repeat(3, 1fr); }
  .statistics-grid { grid-template-columns: repeat(3, 1fr); }
  .v421-metrics { grid-template-columns: repeat(3, 1fr); }
  .v421-recommendation-list { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr 1fr; }
  .model-card.formal { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .topbar, .view-head, .section-heading { align-items: start; flex-direction: column; }
  .topbar { padding-top: 28px; }
  .module-tabs { grid-template-columns: 1fr; }
  .module-tab { text-align: center; }
  .actions { width: 100%; }
  .v421-state-badges { justify-content: flex-start; }
  .actions button { flex: 1 1 150px; }
  .simulation-grid { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr; }
  .model-card.formal { grid-column: auto; }
  .headline-grid, .probabilities, .detail-grid { grid-template-columns: 1fr; }
  .v421-ticket-decision { grid-template-columns: 1fr; gap: 4px; }
  .section-label { align-items: start; flex-direction: column; gap: 4px; }
  .updated { text-align: left; }
  .pending-summary { grid-template-columns: repeat(2, 1fr); }
  .pending-summary div:nth-child(2) { border-right: 0; }
  .pending-summary div:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,.11); }
  .ticket-leg { grid-template-columns: 1fr 1fr; }
  .ticket-leg > div:last-child { grid-column: 1 / -1; }
  .ticket-finance { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar, main, footer { width: min(100% - 20px, 1240px); }
  .site-nav { width: 100%; justify-content: stretch; }
  .site-nav a { flex: 1 1 140px; text-align: center; }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .status-strip div:nth-child(3n) { border-right: 1px solid rgba(255,255,255,.11); }
  .status-strip div:nth-child(2n) { border-right: 0; }
  .status-strip div:nth-child(-n+4) { border-bottom: 1px solid rgba(255,255,255,.11); }
  .account-grid { grid-template-columns: repeat(2, 1fr); }
  .statistics-grid { grid-template-columns: repeat(2, 1fr); }
  .v421-metrics { grid-template-columns: repeat(2, 1fr); }
  .history-filters label, .history-filters input, .history-filters select { width: 100%; }
  .history-actions { width: 100%; }
  .history-actions button { flex: 1; }
  .ticket-day-heading, .paper-ticket-head { align-items: flex-start; flex-direction: column; }
  .ticket-day-summary { justify-content: flex-start; }
  .ticket-leg { grid-template-columns: 1fr; }
  .ticket-leg > div:last-child { grid-column: auto; }
  .ticket-finance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v421-shadow-panel, .model-contract, .account-section, .matches-section, .orders-section, .curve-panel, .run-panel { padding: 16px; }
  .match-card { padding: 15px; }
  .match-head { gap: 12px; }
  .filters { width: 100%; }
  .filter { flex: 1; }
  footer { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
