/* Markahtech Partner Portal */
:root {
  /* light (default) */
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #faf9f6; --field: #ffffff;
  --ink: #17202a; --ink-2: #3a4652; --muted: #6b7682;
  --line: #e2e0d9; --line-2: #d4d1c7;
  --brand: #0e3b43; --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 11%, var(--surface));
  --brand-text: var(--brand);
  --accent: #d9961a;
  --ok: #1d7448; --ok-soft: #e2f2e8; --ok-line: #bfe0cb; --ok-ink: #14512f;
  --warn: #9a5b00; --warn-soft: #fbefd8; --warn-line: #f0d8a8; --warn-ink: #6e4100;
  --bad: #b02a1f; --bad-soft: #f9e3e0; --bad-line: #efc1bb; --bad-ink: #7c1d15;
  --info: #23539e; --info-soft: #e3ebf8; --info-line: #c6d6f0; --info-ink: #1b3f78;
  --hot: #a2410f; --hot-soft: #fde4d6;
  --toast-bg: #17202a; --toast-ink: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23,32,42,.05), 0 4px 16px rgba(23,32,42,.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
/* brand colour choices (set by the owner in Settings) */
:root[data-brand="navy"] { --brand: #1f3a68; }
:root[data-brand="green"] { --brand: #1f5a3a; }
:root[data-brand="plum"] { --brand: #4a2a5c; }
:root[data-brand="charcoal"] { --brand: #2a2f35; }
:root[data-brand="maroon"] { --brand: #6b1f2a; }

/* dark theme: follows the device unless the member picked light or dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171c; --surface: #1a2128; --surface-2: #20282f; --field: #141a20;
    --ink: #e8e6e0; --ink-2: #c3c7cb; --muted: #8f99a3;
    --line: #2b343c; --line-2: #3a454f;
    --brand-soft: color-mix(in srgb, var(--brand) 35%, var(--surface));
    --brand-text: color-mix(in srgb, var(--brand) 35%, #ffffff);
    --ok: #57c48d; --ok-soft: #173326; --ok-line: #24513b; --ok-ink: #9fe0bd;
    --warn: #e5a94a; --warn-soft: #34280f; --warn-line: #5a4419; --warn-ink: #f2cf8f;
    --bad: #ef7a6e; --bad-soft: #3a1c19; --bad-line: #5e2a25; --bad-ink: #f6b3ab;
    --info: #7fa8ec; --info-soft: #182a45; --info-line: #2a4370; --info-ink: #b8cdf3;
    --hot: #f3a072; --hot-soft: #3d2416;
    --toast-bg: #e8e6e0; --toast-ink: #12171c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12171c; --surface: #1a2128; --surface-2: #20282f; --field: #141a20;
  --ink: #e8e6e0; --ink-2: #c3c7cb; --muted: #8f99a3;
  --line: #2b343c; --line-2: #3a454f;
  --brand-soft: color-mix(in srgb, var(--brand) 35%, var(--surface));
  --brand-text: color-mix(in srgb, var(--brand) 35%, #ffffff);
  --ok: #57c48d; --ok-soft: #173326; --ok-line: #24513b; --ok-ink: #9fe0bd;
  --warn: #e5a94a; --warn-soft: #34280f; --warn-line: #5a4419; --warn-ink: #f2cf8f;
  --bad: #ef7a6e; --bad-soft: #3a1c19; --bad-line: #5e2a25; --bad-ink: #f6b3ab;
  --info: #7fa8ec; --info-soft: #182a45; --info-line: #2a4370; --info-ink: #b8cdf3;
  --hot: #f3a072; --hot-soft: #3d2416;
  --toast-bg: #e8e6e0; --toast-ink: #12171c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
a { color: var(--info); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .88em; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }
.grow { flex: 1; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0 20px; height: 58px;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; white-space: nowrap; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: .95rem;
}
.brand small { display: block; font-weight: 500; opacity: .7; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: rgba(255,255,255,.75); text-decoration: none; padding: .45rem .8rem; border-radius: 8px;
  white-space: nowrap; font-weight: 500; font-size: .93rem;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.on { color: #fff; background: rgba(255,255,255,.14); }
.nav .count { background: var(--accent); color: var(--brand); border-radius: 99px; padding: 0 .45rem; font-size: .75rem; font-weight: 700; margin-left: .3rem; }
.top-right { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.chip-balance {
  background: rgba(255,255,255,.12); border-radius: 99px; padding: .3rem .8rem; font-weight: 600; font-size: .9rem;
  color: #fff; text-decoration: none;
}
.top-right .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.top-right .btn.ghost:hover { background: rgba(255,255,255,.1); }

/* ---------- layout ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.narrow { max-width: 620px; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: .92rem; padding: .55rem 1rem; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { filter: brightness(.88); }
.btn.accent { background: var(--accent); color: var(--brand); border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: .32rem .65rem; font-size: .83rem; }
.btn.block { width: 100%; justify-content: center; }
.link-btn { background: none; border: 0; color: var(--info); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label, .label { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line-2); border-radius: 8px;
  padding: .55rem .7rem; width: 100%; min-width: 0;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; border-color: var(--info); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.checks label { display: flex; align-items: center; gap: .35rem; font-weight: 500; font-size: .9rem; }
.checks input { width: auto; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.error-msg { color: var(--bad); font-size: .88rem; min-height: 1.2em; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { width: auto; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 600; color: var(--ink-2); padding: .35rem .75rem; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer; transition: transform .12s, box-shadow .12s; text-align: left;
  font: inherit; color: inherit; padding: 0;
}
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pcard .img { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.pcard .img img { width: 100%; height: 100%; object-fit: contain; }
.pcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.pcard .title { font-weight: 600; font-size: .95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .prices { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: .4rem; }
.pcard .price { font-weight: 700; font-size: 1.05rem; }
.noimg { color: var(--muted); font-size: .8rem; }

.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; letter-spacing: .03em;
  padding: .12rem .5rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand-text); text-transform: uppercase; }
.chip.stock-low { background: var(--warn-soft); color: var(--warn); }
.chip.stock-out { background: var(--bad-soft); color: var(--bad); }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: .76rem; font-weight: 700; padding: .14rem .55rem; border-radius: 99px; white-space: nowrap; }
.b-pending { background: var(--warn-soft); color: var(--warn); }
.b-awaiting_payment { background: var(--info-soft); color: var(--info); }
.fx { font-size: .8rem; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.pay-choice { display: grid; gap: 8px; margin: 12px 0; }
.pay-choice label { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; cursor: pointer; }
.pay-choice label:has(input:checked) { border-color: var(--brand-text); box-shadow: 0 0 0 2px var(--brand-soft); }
.pay-choice input { width: auto; margin-top: .25rem; }
.rates-table input { padding: .4rem .5rem; }
.b-processing { background: var(--info-soft); color: var(--info); }
.b-shipped, .b-approved, .b-active { background: var(--ok-soft); color: var(--ok); }
.b-cancelled, .b-rejected, .b-suspended, .b-expired { background: var(--bad-soft); color: var(--bad); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }
.thumb { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); display: block; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.stat .k { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 1.7rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat.alert .v { color: var(--warn); }
a.stat:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

.balance-big { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.list-item:last-child { border-bottom: 0; }
.amount-pos { color: var(--ok); font-weight: 700; }
.amount-neg { color: var(--ink); font-weight: 700; }

/* ---------- notices ---------- */
.notice { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.notice.info { background: var(--info-soft); border-color: var(--info-line); color: var(--info-ink); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad-ink); }
.notice.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.instructions { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; font-size: .92rem; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,22,30,.5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; padding: 24px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 980px; }
.modal-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.7rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.modal-x:hover { color: var(--ink); }
.modal h2 { padding-right: 2rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }

.gallery .main { aspect-ratio: 1 / 1; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; overflow: hidden; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.gallery .thumbs button { padding: 0; border: 2px solid transparent; border-radius: 7px; background: none; cursor: pointer; }
.gallery .thumbs button.on { border-color: var(--brand-text); }
.gallery .thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 5px; display: block; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.copybox { position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .9rem; max-height: 180px; overflow: auto; white-space: pre-wrap; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0 .4rem; }
.section-title .label { margin: 0; }
.total-line { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.05rem; padding-top: .6rem; border-top: 1px solid var(--line); margin-top: .8rem; }

.img-list { display: flex; flex-wrap: wrap; gap: 8px; }
.img-list .it { position: relative; }
.img-list img { width: 74px; height: 74px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); display: block; }
.img-list .rm { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 99px; border: 0; background: var(--bad); color: #fff; cursor: pointer; font-size: .85rem; line-height: 1; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--toast-bg); color: var(--toast-ink); padding: .65rem 1.1rem; border-radius: 9px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .3s, transform .3s; max-width: 90vw; }
.toast.t-bad { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- auth page ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: var(--brand); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 2.2rem; margin-top: 2rem; max-width: 18ch; }
.auth-side ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .8rem; max-width: 40ch; }
.auth-side li { display: flex; gap: .7rem; opacity: .9; }
.auth-side li::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--accent); margin-top: .55rem; flex: none; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 420px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand-text); }

.loading { display: grid; place-items: center; min-height: 50vh; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--brand-text); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 20px; }
  .auth-side h1 { font-size: 1.5rem; margin-top: 1rem; }
  .auth-side ul { display: none; }
  .split { grid-template-columns: 1fr; }
  .topbar { gap: .6rem; padding: 8px 12px 6px; height: auto; flex-wrap: wrap; row-gap: 6px; justify-content: space-between; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -4px; }
  .brand small { display: none; }
  .top-right .hide-sm { display: none; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 20px 16px; }
  .page { padding: 18px 14px 56px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard .body { padding: 10px; }
}

/* ---------- categories ---------- */
.chip.hot { background: var(--hot-soft); color: var(--hot); }
.chip.cat { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.catbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.catbar button { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: inherit; font-size: .86rem; font-weight: 600;
  padding: .32rem .8rem; border-radius: 99px; cursor: pointer; }
.catbar button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- guides / policies ---------- */
.prose { max-width: 70ch; }
.prose h3 { margin: 1.2rem 0 .4rem; font-size: 1rem; }
.prose h3:first-child { margin-top: 0; }
.prose ul { margin: 0 0 .8rem; padding-left: 1.2rem; }
.prose li { margin: .2rem 0; }
.doc-nav { display: flex; flex-direction: column; gap: 4px; }
.doc-nav button { text-align: left; border: 1px solid transparent; background: none; font: inherit; padding: .55rem .75rem; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.doc-nav button:hover { background: var(--surface); }
.doc-nav button.on { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow); }
.docs { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.notice.danger-strip { border-left: 5px solid currentColor; }

/* ---------- calculator ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.calc fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.calc legend { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; padding: 0; }
.calc .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.result { position: sticky; top: 76px; }
.result .big { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.result .big > div { border-radius: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); }
.result .big .k { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.result .big .v { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.result .pos { color: var(--ok); } .result .neg { color: var(--bad); }
.breakdown { width: 100%; font-size: .9rem; }
.breakdown td { padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.breakdown td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown tr.sum td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line-2); }
.breakdown tr.sub td:first-child { padding-left: .9rem; color: var(--muted); }

@media (max-width: 820px) {
  .docs, .calc { grid-template-columns: 1fr; }
  .result { position: static; }
  .calc .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- appearance picker ---------- */
.theme-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-pick button { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; padding: .5rem .9rem; border-radius: 8px; cursor: pointer; }
.theme-pick button.on { border-color: var(--brand-text); box-shadow: 0 0 0 2px var(--brand-soft); }
.swatch { width: 18px; height: 18px; border-radius: 99px; display: inline-block; vertical-align: -4px; margin-right: 6px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.switch { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: .92rem; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }
.test-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; padding: .55rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.test-row .res { font-weight: 800; font-size: .8rem; }
.res.pass { color: var(--ok); } .res.fail { color: var(--bad); } .res.run { color: var(--muted); } .res.skip { color: var(--warn); }

/* ---------- My ledger ---------- */
.ld-sec { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-top: 1px solid var(--line); padding-top: .7rem; margin-top: .2rem; }
.ld-preview { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: .9rem; line-height: 1.6; }
.ld-preview h4 { margin: 0 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pos { color: var(--ok); } .neg { color: var(--bad); }
#ld-root select { width: auto; max-width: 100%; }
#ld-root .stat .v { font-size: 1.4rem; }
/* Member area has many tabs: on medium screens put them on their own row so none are hidden. */
@media (min-width: 821px) and (max-width: 1500px) {
  .topbar.many { height: auto; flex-wrap: wrap; padding: 8px 20px 4px; row-gap: 4px; justify-content: space-between; }
  .topbar.many .nav { order: 3; flex-basis: 100%; margin: 0 -8px; }
}
