:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f6f8fb; --line: #e2e6ee; --ink: #121a2b; --ink-2: #4a5468; --ink-3: #6b7489;
  --accent: #1f5eff; --accent-ink: #ffffff; --accent-soft: #e8efff; --orange: #f2994a; --navy: #0b1530; --navy-2: #16234a;
  --good: #137a4b; --good-soft: #e3f4ea; --bad: #b8402b; --bad-soft: #fbe7e2; --warn: #8a5a00; --warn-soft: #fff4dc;
  --r: 12px; --shadow: 0 1px 2px rgba(15, 25, 50, .05), 0 8px 24px rgba(15, 25, 50, .06);
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; } h2 { font-size: 1.15rem; font-weight: 750; } h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .9em; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: #fff; padding: 8px 12px; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); } .dim { color: var(--ink-3); } .small { font-size: .86rem; } .tiny { font-size: .78rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #c8d1e6; padding: 16px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; font-size: 1.1rem; text-decoration: none; padding: 4px 8px 12px; }
.side .brand img { width: 28px; height: 28px; }
.ws-switch { width: 100%; background: var(--navy-2); color: #fff; border: 1px solid #263763; border-radius: 10px; padding: 8px 10px; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ws-switch small { display: block; color: #8c9bc2; font-size: .74rem; }
.side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.side nav a { color: #c8d1e6; text-decoration: none; padding: 8px 10px; border-radius: 8px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.side nav a svg { width: 18px; height: 18px; opacity: .85; }
.side nav a:hover { background: var(--navy-2); color: #fff; }
.side nav a[aria-current="page"] { background: #24356b; color: #fff; }
.side .spacer { flex: 1; }
.side .me { border-top: 1px solid #22305a; padding-top: 10px; font-size: .85rem; display: flex; align-items: center; gap: 8px; }
.side .me a { color: #c8d1e6; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex-shrink: 0; text-transform: uppercase; }
.mobile-top { display: none; }
.content { min-width: 0; }
.page { padding: 24px 28px 64px; max-width: 1180px; margin: 0 auto; }
.page.wide { max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .side.open { transform: none; }
  .mobile-top { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 40; }
  .mobile-top .brand { color: #fff; font-weight: 800; text-decoration: none; display: flex; gap: 8px; align-items: center; }
  .mobile-top .brand img { width: 24px; }
  .mobile-top button { background: none; border: 0; color: #fff; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; }
  .scrim { position: fixed; inset: 0; background: rgba(5, 10, 25, .45); z-index: 45; }
  .page { padding: 16px 16px 64px; }
}

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap; font-size: .92rem; }
.btn:hover:not(:disabled) { border-color: #b9c2d4; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { color: var(--bad); border-color: #efc6bd; }
.btn.sm { padding: 5px 10px; font-size: .84rem; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 1rem; }
.field { margin-bottom: 14px; min-width: 0; }
.field > label, .label { display: block; font-weight: 650; font-size: .88rem; margin-bottom: 5px; }
.input { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: #fff; }
textarea.input { resize: vertical; min-height: 80px; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }
.err { font-size: .8rem; color: var(--bad); margin-top: 4px; }
.err:empty { display: none; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 9px; margin-bottom: 14px; font-weight: 600; }
.notice { background: var(--accent-soft); color: var(--ink); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notice.warn { background: var(--warn-soft); color: #5a3d00; }
.notice.good { background: var(--good-soft); color: #0e4b2e; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); }
.seg { display: inline-flex; background: #e9edf4; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-weight: 650; color: var(--ink-2); cursor: pointer; font-size: .88rem; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card h2 { margin-bottom: 4px; }
.card > .sub { color: var(--ink-3); font-size: .88rem; margin-bottom: 14px; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-3); padding: 20px 0; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.blue { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.green { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.red { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.orange { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.list th, table.list td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; }
table.list td.n, table.list th.n { text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: #e9edf4; border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.full span { background: var(--bad); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.err { background: var(--bad); }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 10% -10%, #dfe8ff, transparent), var(--bg); }
.auth { width: 100%; max-width: 430px; }
.auth .brand { display: flex; gap: 9px; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; margin-bottom: 18px; }
.auth .brand img { width: 30px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: .82rem; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google { width: 100%; }

/* reports list */
.reports { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.rcard { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); min-width: 0; transition: border-color .15s, transform .15s; }
.rcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.rcard h3 { margin: 0; font-size: 1.02rem; }
.rcard .kp { display: flex; gap: 14px; flex-wrap: wrap; }
.rcard .kp div { min-width: 0; }
.rcard .kp small { display: block; color: var(--ink-3); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.rcard .kp b { font-size: 1.1rem; }
.rcard .foot { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--ink-3); }

/* upload */
.drop { border: 2px dashed #b8c4dd; border-radius: 16px; background: #fff; padding: 46px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 44px; height: 44px; color: var(--accent); }
.drop h2 { margin: 10px 0 4px; }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.sample-btn { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.sample-btn:hover { border-color: var(--accent); }
.sample-btn b { display: block; }
.progress { height: 10px; background: #e9edf4; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #5b8cff); border-radius: 99px; transition: width .4s; }

/* data prep */
.prep { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .prep { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 16px; }
@media (max-width: 1000px) { .sticky { position: static; } }
.coltable td { padding: 7px 8px; }
.coltable .input { padding: 6px 8px; font-size: .88rem; }
.coltable select.input { width: auto; min-width: 120px; }
.coltable tr.excluded td:not(:first-child) { opacity: .45; }
.preview { font-size: .82rem; }
.preview td, .preview th { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* report screen */
.rbar { position: sticky; top: 0; z-index: 30; background: rgba(243, 245, 249, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 28px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rbar .title { font-weight: 750; margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.saved { font-size: .8rem; color: var(--ink-3); }
@media (max-width: 860px) { .rbar { top: 58px; padding: 8px 16px; backdrop-filter: none; background: var(--bg); } .rbar .title { max-width: 100%; flex-basis: 100%; } }
.report-area { padding: 22px 28px 80px; }
@media (max-width: 860px) { .report-area { padding: 14px 12px 80px; } }
.add-sec { max-width: 900px; margin: 14px auto 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 25, 50, .16); min-width: 230px; padding: 6px; z-index: 60; }
.menu-list button, .menu-list a { display: flex; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--ink); text-decoration: none; gap: 8px; align-items: center; font-size: .9rem; }
.menu-list button:hover:not(:disabled), .menu-list a:hover { background: var(--surface-2); }
.menu-list button:disabled { color: var(--ink-3); cursor: not-allowed; }
.menu-list .lock { margin-left: auto; font-size: .72rem; color: var(--ink-3); }
.building { max-width: 620px; margin: 60px auto; text-align: center; }
.building h2 { margin-top: 16px; }

/* drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(5, 10, 25, .35); z-index: 70; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(460px, 100vw); background: #fff; z-index: 71; box-shadow: -12px 0 40px rgba(15, 25, 50, .2); display: flex; flex-direction: column; }
.drawer header { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer header h2 { margin: 0; }
.drawer .body { padding: 18px; overflow-y: auto; flex: 1; }
.close { background: none; border: 0; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--ink-2); }
.close:hover { background: var(--surface-2); }
.qa { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.qa .rp-report { box-shadow: none; border: 0; padding: 0; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.suggest button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 4px 10px; font-size: .82rem; cursor: pointer; text-align: left; }
.suggest button:hover { border-color: var(--accent); }
.alert-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 90px 36px; gap: 6px; margin-bottom: 8px; align-items: center; }
@media (max-width: 480px) { .alert-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 24px 64px rgba(15, 25, 50, .3); }
dialog.modal::backdrop { background: rgba(5, 10, 25, .45); }
dialog.modal .mbody { padding: 20px; }
dialog.modal .mfoot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
dialog.modal.big { width: min(1000px, calc(100vw - 24px)); }

/* billing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.plan { border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; display: flex; flex-direction: column; gap: 6px; position: relative; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan .price { font-size: 1.6rem; font-weight: 800; }
.plan ul { padding-left: 18px; margin: 4px 0 10px; font-size: .88rem; color: var(--ink-2); }
.plan .btn { margin-top: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stats b { font-size: 1.45rem; }
.brand-preview { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.swatch { width: 44px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }

/* print: only the report */
@media print {
  body { background: #fff; }
  .side, .mobile-top, .rbar, .add-sec, .toast, .notice, .drawer, .drawer-scrim, .no-print { display: none !important; }
  .shell { display: block; }
  .report-area { padding: 0; }
}
.share-page { background: var(--bg); }
.share-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 28px; background: #fff; border-bottom: 1px solid var(--line); }
.share-brand { display: flex; gap: 8px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 800; }
.share-brand img { width: 24px; }
@media (max-width: 640px) { .share-bar { padding: 10px 14px; } }
@media print { .share-top { display: none; } }
