/* Expatkit. Layout idea: a quiet ledger-paper frame; one teal accent, amber only for "best" or "result" highlights. */
:root {
  --bg: #f2f5f7;
  --surface: #ffffff;
  --ink: #0e1b26;
  --muted: #566877;
  --line: #d6dfe5;
  --accent: #0a6b68;
  --accent-ink: #ffffff;
  --accent-soft: #e0f1ef;
  --signal: #b9770e;
  --signal-soft: #fdf1da;
  --good: #17703f;
  --good-soft: #e3f4ea;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1318; --surface: #111d25; --ink: #e5eef3; --muted: #92a6b4; --line: #243642;
    --accent: #43c6b9; --accent-ink: #04201d; --accent-soft: #11302f;
    --signal: #f0b44c; --signal-soft: #34280f; --good: #5ad08c; --good-soft: #12301f;
    --bad: #ff8a80; --bad-soft: #3a1714; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1318; --surface: #111d25; --ink: #e5eef3; --muted: #92a6b4; --line: #243642;
  --accent: #43c6b9; --accent-ink: #04201d; --accent-soft: #11302f;
  --signal: #f0b44c; --signal-soft: #34280f; --good: #5ad08c; --good-soft: #12301f;
  --bad: #ff8a80; --bad-soft: #3a1714; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--body); }
img, svg, canvas { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.num, .mono, td.n, th.n { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 58px; flex-wrap: wrap; padding-block: 8px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; font-weight: 800; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 0.92rem; }
.nav a:hover { background: var(--accent-soft); color: var(--ink); }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 0.85rem; cursor: pointer; }

/* home */
.hero { padding: 40px 0 20px; display: grid; gap: 14px; max-width: 760px; }
.hero p { color: var(--muted); font-size: 1.08rem; }
.search { width: 100%; max-width: 520px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); font: inherit; }
.cat { margin: 34px 0 10px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cat p { color: var(--muted); font-size: 0.95rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; align-content: start; text-decoration: none; color: var(--ink); }
a.card:hover { border-color: var(--accent); }
.card h3 { font-size: 1rem; }
.card p { color: var(--muted); font-size: 0.9rem; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 0.72rem; font-family: var(--mono); padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); letter-spacing: 0.02em; }
.hidden { display: none !important; }

/* tool page */
.crumbs { font-size: 0.85rem; color: var(--muted); padding: 18px 0 8px; }
.crumbs a { color: var(--muted); }
.page-head { display: grid; gap: 10px; margin-bottom: 18px; max-width: 760px; }
.page-head p { color: var(--muted); }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 20px; }
.tool-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .tool-cols { grid-template-columns: 1fr; } }
.form { display: grid; gap: 14px; align-content: start; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
label, .lbl { font-size: 0.85rem; font-weight: 600; display: grid; gap: 5px; color: var(--ink); }
.hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-height: 42px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type="range"] { padding: 0; min-height: 28px; }
input[type="file"] { padding: 8px; background: var(--surface); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.btn { font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; min-height: 42px; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: 0.85rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* results */
.out { display: grid; gap: 12px; align-content: start; }
.big { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; }
.big .k { font-size: 0.82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.big .v { font-family: var(--mono); font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big .s { color: var(--muted); font-size: 0.88rem; }
.big.warn { background: var(--signal-soft); border-color: var(--signal); }
.big.bad { background: var(--bad-soft); border-color: var(--bad); }
.big.good { background: var(--good-soft); border-color: var(--good); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr.best td { background: var(--signal-soft); font-weight: 600; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--signal); color: #fff; }
.note { font-size: 0.85rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }
.note.warn { border-color: var(--signal); }
.err { color: var(--bad); font-weight: 600; }
.status { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }

/* content below tool */
.below { display: grid; gap: 28px; margin: 36px 0; max-width: 760px; }
.below section { display: grid; gap: 10px; }
.below ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
summary { cursor: pointer; font-weight: 600; }
details p { margin-top: 8px; color: var(--muted); }
.related { max-width: none; }
.disclaimer { font-size: 0.85rem; color: var(--muted); background: var(--signal-soft); border: 1px solid var(--signal); border-radius: var(--radius); padding: 10px 12px; margin-top: 4px; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: 0.88rem; background: var(--surface); }
.site-footer .wrap { display: grid; gap: 10px; }
.foot-links { display: flex; gap: 14px; flex-wrap: wrap; }

/* photo tool */
.preview { background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; padding: 10px; min-height: 160px; }
.preview canvas, .preview img { max-height: 340px; width: auto; height: auto; }

/* invoice */
.inv-items { display: grid; gap: 8px; }
.inv-item { display: grid; grid-template-columns: 3fr 1fr 1.2fr auto; gap: 8px; align-items: center; }
@media (max-width: 600px) { .inv-item { grid-template-columns: 1fr 1fr; } .inv-item .desc { grid-column: 1 / -1; } }
.invoice { background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; font-size: 0.92rem; display: grid; gap: 18px; }
.invoice h2 { font-size: 1.6rem; color: #111; }
.invoice table th { background: #f2f2f2; color: #444; }
.invoice td, .invoice th { border-color: #ddd; }
.invoice .two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.invoice .right { text-align: right; }
.invoice[dir="rtl"] .right { text-align: left; }
.invoice pre { margin: 0; font: inherit; white-space: pre-wrap; }
@media print {
  body { background: #fff; }
  .site-header, .site-footer, .crumbs, .page-head, .form, .below, .btn-row, .disclaimer, .no-print { display: none !important; }
  .tool { border: 0; padding: 0; }
  .tool-cols { display: block; }
  .invoice { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.contact-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
