:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #14213d;
  --muted: #5b6475;
  --border: #dfe3ea;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4f2;
  --pos: #0f7a3d;
  --neg: #b42318;
  --warn-bg: #fff7e0;
  --warn: #8a5a00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c;
    --surface: #161d28;
    --text: #e7ebf2;
    --muted: #9aa4b5;
    --border: #2a3342;
    --accent: #2bb3a3;
    --accent-ink: #062b27;
    --accent-soft: #12302d;
    --pos: #4ccb7f;
    --neg: #ff7b72;
    --warn-bg: #3a2e10;
    --warn: #f2c260;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1100px; margin: 0 auto; padding: 14px 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.site-header nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
.site-header nav a.btn, .site-header nav a.btn:hover { color: var(--accent-ink); }
.badge { background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  padding: 11px 18px; border-radius: 10px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-wide { width: 100%; }
.btn-large { padding: 14px 26px; font-size: 1.05rem; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
button.link.small { font-size: 0.75rem; margin-left: 4px; }
button.icon {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; font-size: 0.95rem;
}
button.icon:hover { color: var(--text); border-color: var(--muted); }

/* Landing */
.hero { padding: 48px 0 32px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 22px 0 10px; }
.hero-proof { color: var(--muted); font-size: 0.92rem; }
.hero-art { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; overflow: hidden; }
.hero-art table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.hero-art td { padding: 6px 4px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.hero-art td:nth-child(2) { white-space: normal; }
.hero-art .arrow { text-align: center; color: var(--muted); margin: 8px 0; font-size: 0.85rem; }
.pdfmock { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 10px; line-height: 1.5; white-space: pre; overflow: hidden; }

.section { padding: 48px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.section-alt .card { background: var(--bg); }
.card h3 { margin-bottom: 0.4em; }
.card p { color: var(--muted); margin: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.formats { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; list-style: none; }
.formats li { border: 1px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-weight: 600; }

.pricing { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 20px; justify-content: center; }
.price-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; }
.price-card.featured { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.price { font-size: 2.4rem; font-weight: 800; margin: 6px 0; }
.price small { font-size: 1rem; font-weight: 500; color: var(--muted); }
.price-card ul { padding-left: 1.1em; color: var(--muted); flex: 1; }
.compare { width: 100%; border-collapse: collapse; margin-top: 28px; background: var(--surface); border-radius: var(--radius); overflow: hidden; font-size: 0.95rem; }
.compare th, .compare td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }

.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

.site-footer { border-top: 1px solid var(--border); padding: 28px 16px; color: var(--muted); font-size: 0.9rem; }
.site-footer .container { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* Converter */
.app main { padding-bottom: 120px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 40px 16px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.dz-title { font-size: 1.3rem; font-weight: 700; }
.dz-sub { color: var(--muted); font-size: 0.92rem; }
.privacy-note { color: var(--muted); font-size: 0.92rem; margin: 12px 0; }
.options { margin: 8px 0 24px; }
.options summary { cursor: pointer; color: var(--muted); }
.grid-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 40px;
}
textarea { resize: vertical; font-family: ui-monospace, monospace; font-size: 0.8rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

.file-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.file strong { overflow-wrap: anywhere; }
.file .link { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.file-meta { color: var(--muted); font-size: 0.88rem; }
.file-meta.good { color: var(--pos); }
.file-meta.warn, .file-meta.bad { color: var(--neg); }
.warnings { grid-column: 1 / -1; margin: 6px 0 0; padding-left: 1.1em; color: var(--warn); font-size: 0.86rem; }

.review-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.totals div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.totals dt { font-size: 0.8rem; color: var(--muted); }
.totals dd { margin: 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.review-warning { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-height: 70vh; overflow-y: auto; }
table.txn { width: 100%; border-collapse: collapse; min-width: 640px; }
table.txn th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 0.8rem; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--border); z-index: 1; }
table.txn td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.txn td:nth-child(1) { width: 150px; }
table.txn td:nth-child(3) { width: 130px; }
table.txn td:nth-child(4) { width: 110px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; font-size: 0.9rem; }
table.txn td:nth-child(5) { width: 84px; }
table.txn input { width: 100%; border-color: transparent; background: transparent; min-height: 34px; padding: 4px 6px; }
table.txn input:hover { border-color: var(--border); }
table.txn input.pos, table.txn input.neg { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
table.txn tr.needs-review { background: var(--warn-bg); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.hint { color: var(--muted); font-size: 0.85rem; }

.export-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 10px 14px;
  background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px;
  box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.08);
}
.export-bar label { min-width: 240px; }
.export-note { width: 100%; text-align: center; margin: 0; font-size: 0.85rem; color: var(--muted); }

/* Dialogs */
.dialog { border: 1px solid var(--border); border-radius: 16px; padding: 24px; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(10, 15, 25, 0.5); }
.dialog-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dialog input[type=password] { width: 100%; }
.checks { list-style: none; padding: 0; margin: 0 0 16px; }
.checks li { padding-left: 1.6em; position: relative; margin: 4px 0; }
.checks li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.stack { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fine { font-size: 0.8rem; color: var(--muted); margin: 0; }
.error { color: var(--neg); font-size: 0.9rem; margin: 0; }
.ok { color: var(--pos); font-size: 0.9rem; margin: 0; }
.activate { margin-top: 14px; }
.activate summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
#free-download { margin-top: 10px; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; transition: all 0.2s; max-width: calc(100vw - 32px); z-index: 20; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--neg); color: #fff; }

/* Articles */
.article { padding: 24px 0 64px; }
.article h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.article h2 { margin-top: 1.6em; }
.article li { margin: 0.3em 0; }
.article code, .article kbd { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 0.9em; }
.article pre { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 0.85rem; }
.article table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.95rem; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.cta-box { background: var(--accent-soft); border-radius: var(--radius); padding: 20px; margin: 2em 0; }
.cta-box p { margin-bottom: 12px; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.guide-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.guide-list a { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--text); }
.guide-list a span { display: block; color: var(--muted); font-size: 0.92rem; margin-top: 4px; }
.license-box { width: 100%; font-family: ui-monospace, monospace; font-size: 0.8rem; word-break: break-all; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .cards, .steps { grid-template-columns: 1fr; }
  .pricing { grid-template-columns: 1fr; }
  .totals { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .site-header nav a:not(.btn) { display: none; }
  .row { grid-template-columns: 1fr; }
  .export-bar { position: static; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; }
  .app main { padding-bottom: 32px; }
  .export-bar label { min-width: 0; flex: 1 1 100%; }
  .export-bar .btn { flex: 1 1 100%; }
  .toast { bottom: 24px; }
  /* Transactions become cards */
  table.txn { min-width: 0; }
  table.txn thead { display: none; }
  table.txn tbody, table.txn tr, table.txn td { display: block; }
  table.txn tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
  table.txn td { border: 0; padding: 0; width: auto !important; }
  table.txn td:nth-child(1) { grid-column: 1; grid-row: 1; }
  table.txn td:nth-child(3) { grid-column: 2; grid-row: 1; }
  table.txn td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  table.txn td:nth-child(4) { grid-column: 1; grid-row: 3; text-align: left; padding-left: 6px; }
  table.txn td:nth-child(4):empty, table.txn td:nth-child(4) span:empty { display: none; }
  table.txn td:nth-child(5) { grid-column: 2; grid-row: 3; }
  .table-wrap { max-height: none; }
  .compare { font-size: 0.82rem; }
}
