:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0e1b2c;
  --panel-2: #12243a;
  --line: #20354d;
  --ink: #eef5ff;
  --muted: #9bb0c7;
  --soft: #6f879f;
  --green: #39d98a;
  --green-dim: #143d34;
  --yellow: #ffc857;
  --yellow-dim: #4f3e1f;
  --red: #ff6b7a;
  --red-dim: #4b202b;
  --blue: #7db6ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, .26);
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100%; background: radial-gradient(circle at top right, #142b47 0, var(--bg) 38rem); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.app-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(14px, env(safe-area-inset-top)) 20px 12px; background: rgba(7, 17, 31, .92); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(125, 182, 255, .1); }
.brand { display: flex; align-items: center; gap: 9px; color: #cfe1f8; font-size: 14px; font-weight: 750; letter-spacing: .01em; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--green); border-radius: 8px; color: var(--green); font-size: 18px; }
.tabs { display: flex; gap: 3px; padding: 3px; background: #0b1829; border-radius: 11px; }
.tab { border: 0; border-radius: 8px; padding: 8px 13px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.tab.selected { color: var(--ink); background: var(--panel-2); box-shadow: inset 0 0 0 1px rgba(125, 182, 255, .14); }
.screen { width: min(100% - 28px, 820px); margin: 0 auto; padding: 24px 0 56px; }
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 18px 0 22px; }
.eyebrow, .section-label { margin: 0 0 7px; color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 7vw, 48px); line-height: .98; letter-spacing: -.05em; }
h2 { margin-bottom: 14px; font-size: 20px; letter-spacing: -.025em; }
h3 { margin: 22px 0 10px; color: #d4e3f6; font-size: 13px; }
.subhead { max-width: 570px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.status-pill, .data-count { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--green); box-shadow: 0 0 14px var(--green); }
.data-count { flex-direction: column; align-items: flex-end; gap: 1px; }
.data-count strong { color: var(--ink); font-size: 25px; line-height: 1; }

.card, .decision, .active-order { margin: 14px 0; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, rgba(18, 36, 58, .93), rgba(10, 25, 42, .95)); box-shadow: var(--shadow); }
.section-heading, .decision-top, .active-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.helper, .fineprint, .safety-note, .muted { color: var(--muted); font-size: 12px; line-height: 1.45; }
.fineprint { margin: 14px 0 0; color: var(--soft); }
.kbd { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--soft); font-size: 10px; white-space: nowrap; }
.platform-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 16px 0; }
.platform { min-height: 40px; border: 1px solid var(--line); border-radius: 11px; background: rgba(7, 17, 31, .45); color: var(--muted); font-size: 12px; font-weight: 800; }
.platform.selected { border-color: var(--blue); background: #163253; color: var(--ink); }
.quick-grid, .compact-grid, .metric-grid, .kpi-grid, .insight-columns { display: grid; gap: 10px; }
.quick-grid { grid-template-columns: repeat(3, 1fr); }
.compact-grid { grid-template-columns: repeat(2, 1fr); }
.metric-grid { grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.metric-grid > div { padding: 11px; border-radius: 11px; background: rgba(7, 17, 31, .45); }
.metric-grid span, .metric-grid b, .kpi span, .kpi strong, .kpi small { display: block; }
.metric-grid span, .kpi span, .kpi small { color: var(--muted); font-size: 10px; }
.metric-grid b { margin-top: 5px; color: var(--ink); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 10px 0; }
.field > span, .ocr-label > span { color: var(--muted); font-size: 11px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #2b4562; border-radius: 10px; padding: 11px 12px; outline: none; background: #091727; color: var(--ink); }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(125, 182, 255, .12); }
input { min-height: 43px; }
textarea { min-height: 76px; resize: vertical; }
.ocr-label { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.more-signals { margin-top: 15px; border-top: 1px solid rgba(155, 176, 199, .12); padding-top: 12px; }
.more-signals summary { color: var(--blue); font-size: 12px; font-weight: 750; cursor: pointer; }
.more-signals[open] summary { margin-bottom: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 7px; min-height: 32px; color: var(--muted); font-size: 11px; }
.check input { width: 17px; min-height: 17px; accent-color: var(--green); }
.primary, .secondary { min-height: 43px; border-radius: 11px; padding: 10px 15px; font-size: 12px; font-weight: 850; }
.primary { border: 1px solid var(--green); background: var(--green); color: #062016; }
.secondary { border: 1px solid #385673; background: #132941; color: #d9e8f9; }
.small { min-height: 35px; padding: 7px 10px; font-size: 11px; }
.full { width: 100%; }
.analyze { width: 100%; margin-top: 17px; min-height: 51px; font-size: 14px; }
.shift-start { width: 100%; margin: 4px 0 13px; padding: 10px; border: 1px dashed #385673; border-radius: 11px; background: transparent; color: var(--blue); font-size: 11px; font-weight: 750; }
.shift-strip { display: flex; align-items: center; gap: 14px; margin: 5px 0 13px; padding: 10px 12px; border: 1px solid rgba(57, 217, 138, .24); border-radius: 11px; background: rgba(20, 61, 52, .42); color: #a5ebc7; font-size: 11px; }
.shift-strip span:first-child { flex: 1; }
.shift-strip button { border: 0; background: transparent; color: var(--yellow); font-size: 11px; font-weight: 800; }

.decision { position: relative; overflow: hidden; }
.decision::before { position: absolute; inset: 0 auto 0 0; width: 5px; content: ""; background: var(--yellow); }
.decision.take { border-color: rgba(57, 217, 138, .5); background: linear-gradient(145deg, rgba(20, 61, 52, .95), rgba(10, 31, 36, .96)); }
.decision.take::before { background: var(--green); }
.decision.decline { border-color: rgba(255, 107, 122, .45); background: linear-gradient(145deg, rgba(75, 32, 43, .8), rgba(31, 20, 34, .96)); }
.decision.decline::before { background: var(--red); }
.decision-word { font-size: clamp(42px, 13vw, 74px); font-weight: 900; line-height: .88; letter-spacing: -.08em; }
.decision.take .decision-word { color: var(--green); }
.decision.decline .decision-word { color: var(--red); }
.decision.maybe .decision-word { color: var(--yellow); }
.score { display: flex; flex-direction: column; align-items: flex-end; }
.score strong { font-size: 38px; line-height: .9; }
.score span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.decision-line { margin-top: 17px; color: #dce9f7; font-size: 13px; font-weight: 700; }
.decision-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.decision-reasons span { padding: 6px 8px; border-radius: 7px; background: rgba(7, 17, 31, .44); color: var(--muted); font-size: 10px; }
.why { border-top: 1px solid rgba(155, 176, 199, .14); padding-top: 11px; }
.why summary { color: var(--blue); font-size: 11px; font-weight: 750; cursor: pointer; }
.input-warning { color: var(--yellow); font-size: 12px; }
.decision-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.active-order { border-color: rgba(57, 217, 138, .24); background: #0c2525; }
.active-main { align-items: center; margin-bottom: 16px; }
.active-main strong, .active-main span { display: block; }
.active-main span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.timer { color: var(--green); font-size: 28px; font-weight: 850; text-align: right; }
.timer small { display: block; color: var(--muted); font-size: 9px; font-weight: 600; }
.safety-note { margin: 18px 3px 0; color: var(--soft); }

.kpi-grid { grid-template-columns: repeat(4, 1fr); margin: 14px 0; }
.kpi { min-height: 106px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.kpi strong { margin: 12px 0 5px; color: var(--ink); font-size: 24px; letter-spacing: -.05em; }
.gap-list { display: grid; gap: 7px; padding: 11px 13px; border-radius: 10px; background: rgba(255, 200, 87, .08); color: #ffd985; font-size: 11px; line-height: 1.4; }
.good-note { padding: 11px 13px; border-radius: 10px; background: rgba(57, 217, 138, .08); color: #a5ebc7; font-size: 12px; }
.insight-columns { grid-template-columns: repeat(2, 1fr); gap: 26px; }
.insight-row, .history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(155, 176, 199, .1); }
.insight-row span, .insight-row b, .history-row strong, .history-row b { display: block; font-size: 12px; }
.insight-row small, .history-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; }
.insight-row b { color: var(--ink); text-align: right; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
.signal-table .table-wrap + .table-wrap { margin-top: 18px; }
th, td { padding: 10px 8px; border-top: 1px solid rgba(155, 176, 199, .11); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 10px; font-weight: 700; }
td { color: #dce9f7; }
.export-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.file-button { display: inline-flex; align-items: center; }
.file-button input { display: none; }
.empty-state { padding: 22px 0 5px; color: var(--muted); font-size: 12px; }
em { display: inline-block; margin-left: 4px; padding: 2px 5px; border-radius: 5px; background: #1d3550; color: var(--blue); font-size: 10px; font-style: normal; }

.settings-card { box-shadow: none; }
.settings-grid { grid-template-columns: repeat(2, 1fr); }
.settings-checks { margin-top: 12px; }
.privacy-card { border-color: rgba(125, 182, 255, .24); box-shadow: none; }
.privacy-card p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.target-grid { grid-template-columns: 1.6fr 1fr 1fr; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: end center; padding: 15px; background: rgba(0, 0, 0, .62); }
.modal { width: min(100%, 620px); max-height: calc(100vh - 28px); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #0d1b2d; box-shadow: var(--shadow); }
.modal-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 15px; }
.toast { position: fixed; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 50; max-width: min(90vw, 390px); transform: translateY(20px); padding: 11px 13px; border: 1px solid #385673; border-radius: 10px; background: #132941; color: var(--ink); font-size: 12px; opacity: 0; pointer-events: none; transition: .18s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.warn { border-color: rgba(255, 200, 87, .55); color: #ffe09a; }

@media (max-width: 620px) {
  .app-header { padding-left: 13px; padding-right: 13px; }
  .brand { font-size: 12px; }
  .brand-mark { width: 22px; height: 22px; }
  .tab { padding: 8px 9px; }
  .screen { width: min(100% - 20px, 820px); padding-top: 13px; }
  .hero { margin-top: 12px; }
  .hero .status-pill { margin-top: 7px; }
  .card, .decision, .active-order { padding: 16px; border-radius: 16px; }
  .quick-grid { gap: 7px; }
  .quick-grid .field span { font-size: 10px; }
  .quick-grid input { padding: 10px 8px; }
  .metric-grid, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid > div:last-child { grid-column: span 2; }
  .check-grid { grid-template-columns: repeat(2, 1fr); }
  .insight-columns, .compact-grid, .settings-grid, .target-grid { grid-template-columns: 1fr 1fr; }
  .target-grid .field:first-child { grid-column: span 2; }
}

@media (max-width: 390px) {
  .brand { display: none; }
  .app-header { justify-content: flex-end; }
  .decision-word { font-size: 48px; }
  .kpi strong { font-size: 20px; }
}
