/* DueKindly — single stylesheet for the landing, app and tool pages. */
:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --text: #1d1f23;
  --muted: #555b66;
  --border: #d9d8d0;
  --brand: #0f6b5c;
  --brand-strong: #0a5246;
  --brand-contrast: #ffffff;
  --brand-soft: #e2f2ee;
  --accent: #b4540a;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn-soft: #fff4dc;
  --warn-text: #6b4500;
  --ok-soft: #e4f4e8;
  --ok-text: #1d5e2f;
  --focus: #1a5fd0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --surface: #1b1e21;
    --surface-2: #24282c;
    --text: #eceae4;
    --muted: #a9adb4;
    --border: #363b41;
    --brand: #4cc2a9;
    --brand-strong: #6fd4bf;
    --brand-contrast: #06231d;
    --brand-soft: #173a33;
    --accent: #f0a35c;
    --danger: #ff8a80;
    --danger-soft: #3b1f1d;
    --warn-soft: #3a2f14;
    --warn-text: #ffd889;
    --ok-soft: #173321;
    --ok-text: #9be0ad;
    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
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);
}
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); letter-spacing: -.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code, kbd { font-family: var(--mono); font-size: .9em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); padding: .5rem 1rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 760px; }

/* ---------- header / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: .75rem; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.nav { margin-left: auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; padding: .4rem .5rem; }
.nav a:not(.btn):hover { color: var(--text); }

.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 3rem; color: var(--muted); font-size: .92rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; }
.site-footer a { color: var(--muted); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem;
  font: inherit; font-weight: 600; line-height: 1.2;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--brand-contrast); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { min-height: 36px; padding: .35rem .7rem; font-size: .92rem; }
.btn-lg { min-height: 52px; padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field-hint { font-size: .88rem; color: var(--muted); margin-top: .25rem; font-weight: 400; }
.field-error { font-size: .88rem; color: var(--danger); margin-top: .25rem; }
input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="date"],
input[type="search"], input[type="password"], select, textarea {
  width: 100%; min-height: 44px;
  padding: .55rem .7rem;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: .15rem; flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 560px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 2fr 1fr 1fr; }
}
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .3rem; }
details > summary { cursor: pointer; font-weight: 600; padding: .4rem 0; }

/* ---------- cards & badges ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.badge {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-pro { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.badge-overdue { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-ok { background: var(--ok-soft); color: var(--ok-text); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }

.banner {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  padding: .75rem 1rem; border-radius: var(--radius-sm); margin: 1rem 0;
  background: var(--warn-soft); color: var(--warn-text);
}
.banner.info { background: var(--brand-soft); color: var(--text); }
.banner.error { background: var(--danger-soft); color: var(--danger); }
.banner p { margin: 0; flex: 1 1 240px; }

/* ---------- landing ---------- */
.hero { padding: 3.5rem 0 2.5rem; }
.hero .container { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 900px) { .hero .container { grid-template-columns: 1.1fr 1fr; } }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 40em; }
.trust { font-size: .92rem; color: var(--muted); margin-top: .75rem; }
.email-sample { font-size: .95rem; white-space: pre-wrap; font-family: var(--font); }
.email-sample .var { background: var(--brand-soft); color: var(--brand-strong); padding: 0 .2rem; border-radius: 4px; font-weight: 600; }
.email-head { border-bottom: 1px solid var(--border); padding-bottom: .5rem; margin-bottom: .75rem; font-size: .9rem; color: var(--muted); }
.section { padding: 3rem 0; }
.section-alt { background: var(--surface-2); }
.features { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .features { grid-template-columns: repeat(3, 1fr); } }
.steps-list { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 800px) { .steps-list { grid-template-columns: repeat(3, 1fr); } }
.steps-list li { counter-increment: s; }
.steps-list li::before {
  content: counter(s); display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--brand); color: var(--brand-contrast); font-weight: 700; margin-bottom: .5rem;
}
.pricing { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .pricing { grid-template-columns: 1fr 1fr; } }
.price { font-size: 2rem; font-weight: 800; }
.price small { font-size: 1rem; font-weight: 500; }
.plan ul { padding-left: 1.2rem; }
.plan-pro { border: 2px solid var(--brand); }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem 1rem; margin-bottom: .5rem; }
.faq details p { margin-top: .5rem; }
.tools-links { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .tools-links { grid-template-columns: 1fr 1fr; } }

/* ---------- app ---------- */
.app-main { padding: 1rem 0 3rem; }
.summary { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1rem 0; }
@media (min-width: 700px) { .summary { grid-template-columns: repeat(3, 1fr); } }
.stat-label { font-size: .85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-sub { font-size: .9rem; color: var(--muted); }
.nudges { margin: 1.5rem 0; }
.nudge-list, .inv-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.nudge {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: .75rem 1rem;
}
.nudge .grow { flex: 1 1 220px; }
.board { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.5rem; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(3, 1fr); } }
.col h2 { font-size: 1.05rem; display: flex; gap: .5rem; align-items: center; }
.inv-card {
  width: 100%; text-align: left; display: block;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .75rem 1rem; font: inherit; color: inherit; cursor: pointer;
}
.inv-card:hover { border-color: var(--muted); }
.inv-card .row { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.inv-card .client { font-weight: 700; overflow-wrap: anywhere; }
.inv-card .amt { font-weight: 700; white-space: nowrap; }
.inv-card .meta { font-size: .88rem; color: var(--muted); }
.empty { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 1rem; color: var(--muted); text-align: center; font-size: .95rem; }
.quick-add { margin: 1rem 0; }

dialog {
  width: min(760px, calc(100vw - 1rem)); max-height: calc(100vh - 1rem);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-head { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlg-head h2 { margin: 0; font-size: 1.2rem; flex: 1; overflow-wrap: anywhere; }
.dlg-body { padding: 1rem 1.25rem 1.25rem; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

.timeline { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.timeline button {
  width: 100%; display: flex; gap: .75rem; align-items: center; text-align: left;
  padding: .55rem .75rem; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.timeline button[aria-pressed="true"] { border: 2px solid var(--brand); background: var(--brand-soft); }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border); flex: none; }
.timeline .st-sent .dot { background: var(--ok-text); }
.timeline .st-today .dot { background: var(--accent); }
.timeline .st-skipped .dot { background: transparent; border: 2px solid var(--muted); }
.timeline .when { margin-left: auto; font-size: .88rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 480px) { .timeline .when { white-space: normal; text-align: right; max-width: 45%; } }
.composer { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; background: var(--surface-2); }
.composer textarea { min-height: 260px; background: var(--surface); }
.locked { text-align: center; padding: 1.25rem; }
.fee-box { margin-top: 1rem; }
.fee-table { width: 100%; border-collapse: collapse; margin: .5rem 0; }
.fee-table td { padding: .3rem 0; border-bottom: 1px solid var(--border); }
.fee-table td:last-child { text-align: right; font-weight: 600; }
.fee-table tr.total td { border-bottom: 0; font-weight: 800; }
.history { font-size: .9rem; color: var(--muted); padding-left: 1.2rem; }

.toast-region { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 1000; display: grid; gap: .5rem; width: min(480px, calc(100vw - 2rem)); }
.toast { background: var(--text); color: var(--bg); padding: .75rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); }

.tpl-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem 1rem; margin-bottom: .5rem; }

/* ---------- tool pages ---------- */
.tool-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .tool-grid { grid-template-columns: 1fr 1fr; } }
.result-big { font-size: 2rem; font-weight: 800; }
.embed-mode .site-header, .embed-mode .site-footer, .embed-mode .no-embed { display: none !important; }
.embed-mode { background: var(--surface); }
.powered { font-size: .85rem; text-align: right; margin-top: .5rem; }

.test-pass { color: var(--ok-text); }
.test-fail { color: var(--danger); font-weight: 700; }

@media print {
  .site-header, .site-footer, .btn { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
