/* Base Wallet Guard & Tax CSV Studio — light interface */

:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef5;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 16px -4px rgba(15, 23, 42, .10), 0 1px 3px rgba(15, 23, 42, .04);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
code, .mono { font-family: var(--mono); font-variant-ligatures: none; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- header ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.015em; }
.brand svg { display: block; }
.brand .sep { color: var(--text-3); font-weight: 400; }
.brand .sub { color: var(--text-2); font-weight: 500; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text-2); font-size: 14px; font-weight: 500;
  padding: 6px 10px; border-radius: 6px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: #fff; color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface); border-color: #b6c2d2; }
.btn:active { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn-primary:hover { background: #1e293b; border-color: #1e293b; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #fca5a5; }

/* ---------- hero ---------- */

.hero { padding: 64px 0 40px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  padding: 4px 10px 4px 8px; border-radius: 999px; margin-bottom: 20px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

h1 { font-size: 42px; max-width: 760px; }
.hero p.lede {
  margin-top: 16px; font-size: 17px; color: var(--text-2);
  max-width: 640px; line-height: 1.6;
}

.scanbar {
  margin-top: 32px; display: flex; gap: 8px;
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 8px;
  box-shadow: var(--shadow-sm); max-width: 720px;
}
.scanbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.scanbar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-family: var(--mono); font-size: 14px; padding: 0 10px; color: var(--text);
}
.scanbar input::placeholder { color: var(--text-3); }
.hint { margin-top: 12px; font-size: 13px; color: var(--text-3); display: flex; gap: 16px; flex-wrap: wrap; }
.hint button {
  background: none; border: 0; padding: 0; color: var(--accent);
  font-size: 13px; cursor: pointer; font-family: var(--mono);
}
.hint button:hover { text-decoration: underline; }

/* ---------- results ---------- */

#results { display: none; padding-bottom: 24px; }
#results.on { display: block; }

.statusline {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-2);
  padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.statusline .spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.statusline .ok-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.statusline .err-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); flex: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat .k { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--text-3); margin-top: 2px; font-family: var(--mono); }
.stat.alert { background: var(--danger-soft); border-color: #fecaca; }
.stat.alert .v { color: var(--danger); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; margin-bottom: -1px; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text-2);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.tab .count {
  font-size: 11.5px; font-family: var(--mono); color: var(--text-3);
  background: var(--surface-2); border-radius: 999px; padding: 1px 6px; margin-left: 6px;
}

.panel { display: none; padding-top: 20px; }
.panel.on { display: block; }

/* table */
.tablewrap {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: #fff;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 500; font-size: 12px; letter-spacing: .02em;
  text-transform: uppercase; color: var(--text-3);
  background: var(--surface); padding: 9px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface); }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.right, th.right { text-align: right; }
.addr { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.pill-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0; }
.pill-mute { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: #bfdbfe; }

.empty {
  padding: 40px 20px; text-align: center; color: var(--text-2); font-size: 14px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-weight: 600; }

/* toolbar */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar + .tablewrap { border-radius: 0 0 var(--radius) var(--radius); }
.toolbar .spacer { flex: 1; }
.toolbar label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
select {
  font-family: inherit; font-size: 13px; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 5px 8px; background: #fff; cursor: pointer;
}
select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.note {
  margin-top: 14px; font-size: 12.5px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.note strong { color: var(--text); }

/* ---------- pricing ---------- */

.pricing { padding: 72px 0; border-top: 1px solid var(--border); margin-top: 56px; }
.pricing h2 { font-size: 30px; }
.pricing .lede { margin-top: 10px; color: var(--text-2); max-width: 620px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
.plan {
  border: 1px solid var(--border); border-radius: 16px; padding: 26px;
  background: #fff; display: flex; flex-direction: column;
}
.plan.pro { border-color: var(--text); box-shadow: var(--shadow-md); }
.plan .tier { font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.plan .price { font-size: 34px; font-weight: 600; letter-spacing: -.03em; margin-top: 8px; }
.plan .price span { font-size: 14px; font-weight: 400; color: var(--text-2); letter-spacing: 0; }
.plan .desc { font-size: 13.5px; color: var(--text-2); margin-top: 6px; min-height: 40px; }
.plan ul { list-style: none; padding: 0; margin: 20px 0 24px; font-size: 13.5px; }
.plan li { display: flex; gap: 9px; padding: 5px 0; color: var(--text-2); }
.plan li svg { flex: none; margin-top: 3px; }
.plan li b { color: var(--text); font-weight: 500; }
.plan .cta { margin-top: auto; }

/* ---------- modal ---------- */

.modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 23, 42, .32); backdrop-filter: blur(3px);
}
.modal.on { display: flex; }
.modal-card {
  background: #fff; border-radius: 16px; width: 100%; max-width: 440px;
  padding: 26px; box-shadow: 0 24px 60px -12px rgba(15,23,42,.35);
  border: 1px solid var(--border);
}
.modal-card h3 { font-size: 18px; }
.modal-card p { margin-top: 8px; font-size: 13.5px; color: var(--text-2); }
.modal-actions { display: flex; gap: 8px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }
.kv { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.kv div:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--text-2); }
.kv span:last-child { font-family: var(--mono); text-align: right; word-break: break-all; }

.field { margin-top: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field input {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 13px; outline: 0;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--border); margin-top: 40px;
  padding: 28px 0 48px; font-size: 13px; color: var(--text-3);
}
footer .wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
footer .spacer { flex: 1; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 999px; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow-md);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite;
  border-radius: 4px; height: 12px; display: inline-block;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  h1 { font-size: 32px; }
  .hero { padding: 44px 0 28px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .plans { grid-template-columns: 1fr; }
  .nav a:not(.nav-cta) { display: none; }
}

@media (max-width: 620px) {
  .wrap, .topbar-in { padding: 0 16px; }
  h1 { font-size: 27px; letter-spacing: -.025em; }
  .hero p.lede { font-size: 15.5px; }
  .scanbar { flex-direction: column; padding: 10px; }
  .scanbar input { height: 36px; padding: 0 4px; font-size: 13px; }
  .scanbar .btn { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 19px; }
  .stat .s { font-size: 11px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 10px 11px; font-size: 13px; }
  .tablewrap { overflow-x: auto; }
  table { min-width: 560px; }
  /* On a phone the approvals table has to earn every column: drop "Kind",
     which repeats what the spender name already says. */
  #tbl-approvals th:nth-child(3), #tbl-approvals td:nth-child(3) { display: none; }
  #tbl-approvals { min-width: 460px; }
  /* Seven numeric columns do not fit a phone, and sideways-scrolling a tax ledger is unusable.
     Below 620px each row becomes a labelled card instead of a table row. */
  #tbl-tax { min-width: 0; }
  #tbl-tax thead { display: none; }
  #tbl-tax, #tbl-tax tbody, #tbl-tax tr, #tbl-tax td { display: block; width: 100%; }
  #tbl-tax tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  #tbl-tax tr:last-child { border-bottom: 0; }
  #tbl-tax td {
    display: flex; gap: 10px; align-items: baseline;
    padding: 2px 0; border: 0; text-align: left; white-space: normal;
  }
  #tbl-tax td.right { text-align: left; }
  #tbl-tax td::before {
    content: attr(data-label);
    flex: 0 0 74px; color: var(--text-3);
    font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  }
  #tbl-tax td.num { white-space: normal; overflow-wrap: anywhere; }
  .toolbar { padding: 10px; gap: 8px; }
  .toolbar .spacer { display: none; }
  .brand .sub { display: none; }
  .pricing { padding: 48px 0; }
  .pricing h2 { font-size: 24px; }
  .plan { padding: 20px; }
  footer .wrap { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ---------- payment sheet ---------- */
/* The buy button is the whole funnel, so the sheet has to state what the wallet can do
   before the buyer signs anything: address, USDC balance, and whether gas is missing. */
.btn-lg { height: 42px; font-size: 15px; font-weight: 600; }
.walletline {
  margin-top: 14px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2, #f8fafc); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
  word-break: break-word;
}
.nosupport {
  margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--warn-soft); border: 1px solid #fde68a; color: var(--warn);
  font-size: 13px; line-height: 1.5;
}
.nosupport a { color: var(--warn); text-decoration: underline; }
.manualpay { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.manualpay summary {
  cursor: pointer; font-size: 13px; color: var(--text-2); list-style: none;
}
.manualpay summary::-webkit-details-marker { display: none; }
.manualpay summary::before { content: '＋ '; color: var(--text-3); }
.manualpay[open] summary::before { content: '－ '; }
.manualpay p { margin-top: 10px; font-size: 12.5px; color: var(--text-3); line-height: 1.55; }
.manualpay .modal-actions { margin-top: 12px; }
