:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #1b2330;
  --ink-soft: #5b6573;
  --line: #e4e8ee;
  --accent: #0f6f6a;
  --accent-ink: #ffffff;
  --accent-soft: #e6f2f1;
  --ok: #137a4b;
  --ok-bg: #e7f6ee;
  --warn: #9a5b00;
  --warn-bg: #fdf1dd;
  --danger: #b4231f;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* ensure class display rules can't override the hidden attribute */
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #14938c);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.brand-sub { font-weight: 600; font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; padding-left: 2px; }
.badge-private {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .82rem; color: var(--accent);
  background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; font-weight: 600;
}
.badge-private .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,111,106,.18);
}

/* Hero */
.hero { padding: 48px 0 24px; max-width: 720px; }
.hero h1 { font-size: 2.1rem; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 10px; }
.hero .tagline { font-size: 1.15rem; font-weight: 650; color: var(--accent); margin: 0 0 12px; letter-spacing: -.01em; }
.hero .sub { font-size: 1.06rem; color: var(--ink-soft); margin: 0; }

/* Dropzone */
.dropzone {
  background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; transition: border-color .15s, background .15s;
  cursor: pointer; outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: #fbfdfd; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon {
  width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.2rem;
  background: var(--accent-soft); color: var(--accent);
}
.drop-title { font-weight: 650; font-size: 1.1rem; margin: 4px 0; }
.drop-or { margin: 2px 0; color: var(--ink-soft); }
.drop-hint { font-size: .85rem; color: var(--ink-soft); margin: 8px 0 18px; }
.link-btn { background: none; border: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }
.ghost-btn {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; cursor: pointer;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Status */
.status { margin-top: 20px; padding: 14px 18px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-size: .95rem; }
.status.error { background: #fdeceb; color: var(--danger); }
.spinner {
  display: inline-block; width: 15px; height: 15px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results { margin-top: 28px; }
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.export-actions { display: flex; gap: 10px; }
.primary-btn {
  background: var(--accent); color: var(--accent-ink); border: none; font: inherit; font-weight: 650;
  padding: 10px 18px; border-radius: 8px; cursor: pointer; transition: background .15s;
}
.primary-btn:hover { background: #0c5b57; }
.recon { font-size: .92rem; font-weight: 600; padding: 8px 14px; border-radius: 8px; }
.recon.ok { background: var(--ok-bg); color: var(--ok); }
.recon.warn { background: var(--warn-bg); color: var(--warn); }
.recon.none { background: #eef1f5; color: var(--ink-soft); }

/* Column mapping */
.mapping { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.mapping-label { margin: 0 0 8px; font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.mapping-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mapping-row select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* Table */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.txn-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.txn-table th, .txn-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.txn-table th { background: #fafbfc; font-weight: 650; color: var(--ink-soft); position: sticky; top: 0; }
.txn-table th.num, .txn-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.txn-table tbody tr:last-child td { border-bottom: none; }
.txn-table input { width: 100%; border: 1px solid transparent; background: transparent; font: inherit; padding: 4px 6px; border-radius: 5px; color: inherit; }
.txn-table td.num input { text-align: right; }
.txn-table input:focus { border-color: var(--accent); background: #fff; outline: none; }
.neg { color: var(--danger); }
.row-count { font-size: .85rem; color: var(--ink-soft); margin: 10px 2px; }
.locked-note { color: var(--warn); font-weight: 600; }

/* How section */
.how { padding: 48px 0 24px; }
.how h2 { font-size: 1.4rem; letter-spacing: -.01em; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card h3 { margin: 0 0 8px; font-size: 1.02rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { background: var(--surface); border-radius: 14px; max-width: 420px; width: 100%; padding: 28px; position: relative; box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 10px; font-size: 1.3rem; }
.modal-card p { color: var(--ink-soft); font-size: .94rem; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-soft); }
.buy { display: inline-block; text-decoration: none; margin: 8px 0 16px; text-align: center; }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.license-msg { min-height: 1.2em; font-weight: 600; font-size: .88rem; }
.license-msg.ok { color: var(--ok); }
.license-msg.err { color: var(--danger); }
.modal-fine { font-size: .8rem; color: var(--ink-soft); margin-top: 8px; }

/* Legal pages */
.legal { max-width: 680px; padding-top: 40px; padding-bottom: 40px; }
.legal h1 { font-size: 2rem; letter-spacing: -.02em; margin-bottom: 4px; }
.legal-updated { color: var(--ink-soft); font-size: .88rem; margin-top: 0; }
.legal h2 { font-size: 1.15rem; margin-top: 28px; }
.legal p { color: var(--ink); }
.legal .back { margin-top: 32px; }
.site-footer a { color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 28px 0; background: var(--surface); }
.site-footer p { margin: 4px 0; font-size: .88rem; }
.muted { color: var(--ink-soft); }

@media (max-width: 720px) {
  .hero h1 { font-size: 1.6rem; }
  .cards { grid-template-columns: 1fr; }
  .badge-private { display: none; }
}
