:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --ink: #10151c;
  --ink-2: #46505c;
  --ink-3: #5f6b78;         /* AA-compliant on light bg (>=4.5:1) */
  --border: #e4e8ec;
  --accent: #0f9d6b;        /* emerald — the "verified" brand color */
  --accent-ink: #0b7a53;
  --accent-soft: #e7f6ef;
  --amber: #b6791f;
  --amber-soft: #fbf1de;
  --danger: #c8482f;
  --danger-soft: #fbecea;
  --primary: #16202b;       /* deep ink for primary actions */
  --shadow: 0 1px 2px rgba(16,21,28,.04), 0 8px 24px rgba(16,21,28,.06);
  --radius: 14px;
  --font: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f13; --surface: #14181e; --surface-2: #1b2027; --ink: #eef2f6;
    --ink-2: #aeb8c4; --ink-3: #78828e; --border: #262c34; --accent: #2bd396;
    --accent-ink: #43dca4; --accent-soft: #10251d; --amber: #e0a446; --amber-soft: #261d10;
    --danger: #f0846b; --danger-soft: #271512; --primary: #eef2f6; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
/* [hidden] must win over class `display` rules (.login-view/.header-auth set display) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  /* subtle emerald glow at the top — texture without the sloppy full gradient */
  background: radial-gradient(76% 38% at 50% -6%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg);
  background-attachment: fixed;
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 20px; }
a { color: inherit; }

/* header */
.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 80%, transparent); position: sticky; top: 0; backdrop-filter: saturate(1.4) blur(8px); z-index: 10; }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; text-decoration: none; }
.logo-mark { flex: none; border-radius: 7px; }
.forgot-link { margin: 12px 0 0; font-size: 13px; text-align: center; }
.forgot-link a { color: var(--ink-3); text-decoration: none; }
.forgot-link a:hover { color: var(--accent-ink); text-decoration: underline; }
.auth-toggle { margin: 18px 0 0; font-size: 13.5px; color: var(--ink-2); text-align: center; }
.auth-toggle a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.auth-toggle a:hover { text-decoration: underline; }
.hint-inline { color: var(--ink-3); font-weight: 400; font-size: 12px; }
.login-note { margin: 0 0 16px; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.login-note.ok { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-ink); }
.login-note.bad { background: #fdecec; color: #b3261e; }
.verify-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: var(--radius); }
.verify-banner .vb-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; font-size: 13.5px; color: var(--ink-2); }
.verify-banner .vb-text strong { color: var(--ink); font-size: 14.5px; }
.vb-done { color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.logo-dim { color: var(--ink-3); font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 20px; }
.header-nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.header-nav a { color: var(--ink-2); text-decoration: none; }
.header-nav a:hover { color: var(--ink); }

/* auth */
.header-auth { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-2); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.login-view { display: grid; place-items: center; min-height: 62vh; padding: 40px 0; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 28px; }
.login-title { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
.login-sub { margin: 0 0 20px; color: var(--ink-2); font-size: 14px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
.login-card input { width: 100%; padding: 10px 12px; font: inherit; font-size: 15px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--ink); }
.login-submit { width: 100%; margin-top: 20px; padding: 11px; }
.login-error { color: var(--danger); font-size: 13px; margin: 12px 0 0; }

/* hero */
.hero { text-align: center; padding: 64px 0 40px; }
.hero-title { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 720; }
.hero-title .accent { color: var(--accent); }
.hero-sub { max-width: 560px; margin: 0 auto 34px; color: var(--ink-2); font-size: 17px; }

/* dropzone */
.dropzone {
  display: block; border: 1.5px dashed var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 44px 24px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s; text-align: center;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { color: var(--accent); margin-bottom: 10px; }
.dz-primary { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.dz-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.dz-hint { margin: 0; color: var(--ink-3); font-size: 13px; }

.trust-row { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; padding: 0; margin: 26px 0 0; font-size: 14px; color: var(--ink-2); }
.trust-row li { display: flex; align-items: center; gap: 8px; }
.trust-row .ti { color: var(--accent); }

/* dashboard */
.header-link { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.header-link:hover { color: var(--ink); }
.dashboard-view { max-width: 640px; margin: 0 auto; padding: 40px 0 60px; text-align: left; }
.dash-title { font-size: 28px; letter-spacing: -.02em; margin: 0 0 22px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.dash-empty { color: var(--ink-3); font-size: 14px; margin: 8px 0 0; }
.pw-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.pw-form input { padding: 10px 12px; font: inherit; font-size: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--ink); }
.pw-form .btn { align-self: flex-start; }
.pw-done { color: var(--accent-ink); font-size: 13px; font-weight: 600; margin: 0; }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* account panel: usage meter + history */
.account-panel { max-width: 520px; margin: 34px auto 0; text-align: left; }
.usage-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; }
.usage-label { color: var(--ink-2); }
.usage-count { font-family: var(--mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.usage-bar { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 7px 0 0; }
.usage-fill { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .3s; }
.usage-fill.full { background: var(--amber); }
.history-block { margin-top: 22px; }
.history-list { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.hist-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.hist-item:last-child { border-bottom: none; }
.hist-badge { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.hist-badge.ok { background: var(--accent); }
.hist-badge.warn { background: var(--amber); }
.hist-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.hist-note { color: var(--ink-3); font-weight: 400; font-size: 12px; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.processing { text-align: center; padding: 56px 24px; margin-top: 40px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 18px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.proc-title { font-weight: 640; margin: 0 0 4px; }
.proc-step { margin: 0; color: var(--ink-3); font-size: 14px; }

/* result */
#result-view { padding: 40px 0 60px; }
.hero-cta-row { margin: 30px 0 4px; }
.hero-cta { padding: 12px 28px; font-size: 16px; }
.verdict { display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-radius: var(--radius); margin-bottom: 20px; border: 1px solid var(--border); background: var(--surface); }
.verdict.ok { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.verdict.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 34%, transparent); }
.verdict.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 34%, transparent); }
.verdict-badge { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 700; }
.verdict.ok .verdict-badge { background: var(--accent); }
.verdict.warn .verdict-badge { background: var(--amber); }
.verdict.bad .verdict-badge { background: var(--danger); }
.verdict-text h2 { margin: 0 0 2px; font-size: 18px; letter-spacing: -.01em; }
.verdict-text p { margin: 0; color: var(--ink-2); font-size: 14px; }

.consent { background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; }
.consent p { margin: 0 0 12px; font-size: 14px; color: var(--ink); }
.consent-actions { display: flex; align-items: center; gap: 14px; }
.consent-done { color: var(--accent-ink); font-size: 14px; font-weight: 600; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.summary-card .k { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.summary-card .v { font-size: 19px; font-weight: 680; font-variant-numeric: tabular-nums; margin: 0; letter-spacing: -.01em; }

.result-panel { padding: 20px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.result-head h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.count-pill { background: var(--surface-2); color: var(--ink-2); border-radius: 20px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.result-actions { display: flex; gap: 10px; }
.dl-menu { position: relative; }
.dl-options { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.dl-options button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; background: none; border: none; border-radius: 7px; padding: 9px 12px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.dl-options button span { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.dl-options button:hover { background: var(--surface-2); }

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.txn-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.txn-table th, .txn-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.txn-table th { background: var(--surface-2); color: var(--ink-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; }
.txn-table tbody tr:last-child td { border-bottom: none; }
.txn-table td.desc { white-space: normal; min-width: 220px; color: var(--ink-2); }
.txn-table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.txn-table .neg { color: var(--danger); }
.txn-table .pos { color: var(--accent-ink); }
.txn-table.no-balance th.bal, .txn-table.no-balance td.bal { display: none; }

/* buttons */
.btn { font: inherit; font-size: 14px; font-weight: 600; border-radius: 9px; padding: 9px 16px; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; }
.btn-primary { background: var(--primary); color: var(--bg); }
.btn-primary:hover { opacity: .9; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-3); }

/* error */
.error-panel { text-align: center; padding: 48px 24px; margin-top: 40px; }
.error-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); font-weight: 800; font-size: 24px; display: grid; place-items: center; margin: 0 auto 14px; }
.error-panel h2 { margin: 0 0 6px; font-size: 19px; }
.error-panel p { margin: 0 auto 20px; color: var(--ink-2); max-width: 420px; }

/* info sections */
.info { padding: 56px 0; border-top: 1px solid var(--border); margin-top: 56px; }
.info:first-of-type { }
.info-title { font-size: 22px; letter-spacing: -.02em; margin: 0 0 24px; text-align: center; }
.info-body { max-width: 620px; margin: 0 auto; text-align: center; color: var(--ink-2); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px; }
.step-n { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; margin-bottom: 12px; }
.step h4 { margin: 0 0 6px; font-size: 16px; }
.step p { margin: 0; color: var(--ink-2); font-size: 14px; }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--ink-3); font-size: 13px; }
.footer-links { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-links nav a { color: var(--ink-3); margin-left: 14px; text-decoration: none; }
.footer-links nav a:hover { color: var(--ink); }

/* legal pages */
.legal { max-width: 720px; padding: 40px 20px 64px; }
.legal h1 { font-size: 30px; margin: 0 0 4px; letter-spacing: -.02em; }
.legal-date { color: var(--ink-3); font-size: 13px; margin: 0 0 28px; }
.legal h2 { font-size: 18px; margin: 30px 0 8px; letter-spacing: -.01em; }
.legal p, .legal li { color: var(--ink-2); font-size: 15px; }
.legal a { color: var(--accent-ink); }
.legal ul { padding-left: 20px; }
.legal-links { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 14px; }

/* signup terms checkbox */
.agree-row { display: flex; align-items: center; gap: 9px; font-weight: 400 !important; font-size: 13px; color: var(--ink-2); margin: 16px 0 0; line-height: 1.4; }
.agree-row input[type="checkbox"] { width: 15px; height: 15px; min-width: 15px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); position: relative; top: -1px; }
.agree-row a { color: var(--accent-ink); }

@media (max-width: 640px) {
  .header-nav { display: none; }
  .hero { padding: 44px 0 30px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1; }
}
