/* Host Daftar: a quiet ledger. White sheets on a tinted page, one accent colour, few boxes.
   The viewer picks mode, accent and font (Appearance menu); they are set as data-* on <html>. */
:root {
  --bg: #f4f3ef; --card: #ffffff; --ink: #24231f; --muted: #77756e; --line: #ebe9e4; --field: #ffffff;
  --brand: #1f6fd0; --brand-soft: #e6f0fb; --brand-ink: #ffffff; --danger: #b8473f;
  --warn-bg: #fdecea; --warn-line: #f1c7c2; --note-bg: #fbf4dc; --note-line: #eadca8;
  --ok: #dff0e2; --ok-ink: #1f4a2e; --wait: #fbecc9; --wait-ink: #5a4310; --bad: #fde3de; --bad-ink: #7a221b;
  --radius: 14px;
  --font: "Figtree";
  color-scheme: light;
}
[data-theme=violet] { --bg: #f4f3fb; --ink: #272238; --muted: #74718a; --line: #e7e5f2; --brand: #5b3bd6; --brand-soft: #ebe6fd; }
[data-theme=sage] { --bg: #f3f2ec; --ink: #25302b; --muted: #6d7872; --line: #e5e3da; --brand: #2c6a59; --brand-soft: #e0eee8; }
[data-mode=dark] {
  --bg: #121418; --card: #1a1d23; --ink: #e4e6e9; --muted: #8b9099; --line: #282c35; --field: #121418;
  --brand: #72aef0; --brand-soft: #1b2a3d; --brand-ink: #0f1115; --danger: #ec8c85;
  --warn-bg: #3a2224; --warn-line: #6b3a3c; --note-bg: #332e1b; --note-line: #5c5227;
  --ok: #1f3a2c; --ok-ink: #a8dcbf; --wait: #3d3419; --wait-ink: #f0d58c; --bad: #45262a; --bad-ink: #f3b1ab;
  color-scheme: dark;
}
[data-mode=dark][data-theme=violet] { --bg: #14121f; --card: #1c1930; --ink: #e7e4f5; --muted: #9a96b5; --line: #2b2743; --field: #14121f; --brand: #a892f6; --brand-soft: #2a2350; --brand-ink: #14121f; }
[data-mode=dark][data-theme=sage] { --bg: #191f1d; --card: #212926; --ink: #e4e9e6; --muted: #96a19c; --line: #303a36; --field: #191f1d; --brand: #74bda7; --brand-soft: #29393400; --brand-soft: #293934; --brand-ink: #10201b; }
[data-font=inter] { --font: "Inter"; }
[data-font=plex] { --font: "IBM Plex Sans"; }
[data-font=system] { --font: "Segoe UI"; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.55 var(--font), "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 30px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; color: var(--muted); }
.sub { margin: 4px 0 0; color: var(--muted); }
.muted, small { color: var(--muted); }
small { display: block; font-size: 13px; font-weight: 400; margin-top: 5px; }
.ico { flex: none; }

/* Shell */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 14px 16px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; color: var(--ink); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a, .side-btn, .look summary { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 15px; }
.side nav a:hover, .side-btn:hover, .look summary:hover { color: var(--ink); text-decoration: none; }
.side nav a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.side nav a.on .ico { color: var(--brand); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-btn { border: 0; background: none; cursor: pointer; font-family: inherit; width: 100%; text-align: left; }
.side-btn .to-light, [data-mode=dark] .side-btn .to-dark { display: none; }
[data-mode=dark] .side-btn .to-light { display: inline; }
.who { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0 10px; margin-top: 8px; border-top: 1px solid var(--line); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.who .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--ink); }
.content { min-width: 0; }
.mobile-bar { display: none; align-items: center; gap: 6px; padding: 8px 12px; background: var(--bg); position: sticky; top: 0; z-index: 10; }
main { max-width: 1040px; margin: 0 auto; padding: 44px 40px 96px; }
.guest main { max-width: none; padding: 24px 16px; }
.focus { max-width: 680px; margin: 0 auto; }
.scrim { display: none; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.bar.foot { margin-top: 16px; }

/* Surfaces */
.sheet, .card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
[data-mode=dark] .sheet, [data-mode=dark] .card { box-shadow: none; border: 1px solid var(--line); }
.card { padding: 24px; margin: 20px 0; }
.narrow { max-width: 420px; margin: 9vh auto 0; padding: 32px; }
.narrow h1 { font-size: 24px; margin-bottom: 4px; }
.narrow > .muted { margin: 0 0 20px; }

.flash { padding: 11px 16px; border-radius: 10px; margin: 0 0 20px; background: var(--ok); color: var(--ok-ink); font-weight: 500; }
.flash.err { background: var(--warn-bg); color: var(--bad-ink); }
.flash.note { background: var(--note-bg); color: var(--wait-ink); }
button.link { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* Forms */
label, .field { display: block; font-weight: 600; font-size: 14px; margin-bottom: 18px; }
.lbl { display: block; font-weight: 600; font-size: 14px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-weight: 400; background: var(--field); color: var(--ink); }
input::placeholder { color: var(--muted); opacity: .8; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; margin: 0 6px 0 0; }
label.check { font-weight: 400; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--warn-bg); }
.btn.ok { background: var(--ok); border-color: transparent; color: var(--ok-ink); }
.btn.small { min-height: 32px; padding: 3px 12px; font-size: 13.5px; border-radius: 8px; }
.btn.has { border-color: var(--brand); color: var(--brand); }
.btn b { background: var(--brand); color: var(--brand-ink); border-radius: 99px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 12px; }

.pw { position: relative; display: block; flex: 1; }
.pw input { padding-right: 46px; }
.eye { position: absolute; right: 4px; bottom: 3px; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; }
.eye:hover { color: var(--ink); }
.eye.shown { color: var(--brand); }
.eye.shown .slash { display: none; }
form.inline .pw { flex: 0 1 auto; }
form.inline .eye { width: 28px; height: 28px; bottom: 2px; }

/* Dashboard */
.stats { display: flex; flex-wrap: wrap; gap: 14px 56px; margin: 30px 0 34px; }
.stats a { display: flex; flex-direction: column; color: var(--ink); }
.stats a:hover { text-decoration: none; }
.stats a:hover b { color: var(--brand); }
.stats b { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); margin-top: 4px; }
.delta { font-size: 13.5px; }
.stats .delta.up { color: var(--ok-ink); }
.stats .delta.down { color: var(--danger); }
.nudge { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; padding: 14px 18px; margin-bottom: 34px; border-radius: 12px; background: var(--note-bg); color: var(--wait-ink); }
.nudge:hover { text-decoration: none; filter: brightness(.98); }
.nudge span { opacity: .85; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 34px; margin-bottom: 38px; }
.split.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.month-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.month-nav h1 { min-width: 9.5ch; }
.month-nav .step { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--card); color: var(--ink); font-size: 22px; line-height: 1; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.month-nav .step:hover { text-decoration: none; color: var(--brand); }
.month-nav form { margin: 0; }
.rows { list-style: none; margin: 0; padding: 6px 18px; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .main { flex: 1; min-width: 0; color: var(--ink); display: flex; flex-direction: column; }
.rows .main:hover { text-decoration: none; }
.rows .main:hover b { color: var(--brand); }
.rows .main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .main span { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-note { color: var(--muted); margin: 0; }
.more { display: inline-block; margin-top: 12px; font-weight: 600; font-size: 14.5px; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding: 20px 20px 14px; }
.chart .col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.chart .col:hover { text-decoration: none; color: var(--ink); }
.chart .val { font-weight: 600; color: var(--ink); }
.chart .bar-fill { width: 100%; max-width: 44px; border-radius: 6px 6px 2px 2px; background: var(--line); }
.chart .col.now .bar-fill, .chart .col:hover .bar-fill { background: var(--brand); }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.plain li:first-child { border-top: 0; padding-top: 0; }
.plain a { color: var(--ink); }
.plain span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Orders */
.tabs { display: flex; gap: 26px; margin: 26px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 10px 0 12px; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); font-weight: 600; border-color: var(--ink); }
.tabs span { margin-left: 7px; font-size: 13px; color: var(--muted); font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 20px 0 0; }
.toolbar > input, .toolbar > select { width: auto; margin: 0; flex: 0 1 170px; }
.toolbar > .grow { flex: 1 1 240px; }
.adv { flex-basis: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 16px; padding: 22px; margin-top: 4px; background: var(--card); border-radius: var(--radius); }
.adv label, .adv .range { margin: 0; }
.adv .range { grid-column: span 2; }
.range div { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.range input { margin: 0; }
.range div span { color: var(--muted); font-size: 14px; }
.adv-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px 4px 12px; border-radius: 999px; background: var(--card); color: var(--ink); font-size: 14px; font-weight: 500; }
.pill span { color: var(--muted); font-size: 16px; line-height: 1; }
.pill:hover { text-decoration: none; }
.pill:hover span { color: var(--danger); }
.clear { font-size: 14px; color: var(--muted); }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 26px 2px 10px; color: var(--muted); }
.list-head p { margin: 0; }
.list-head b { color: var(--ink); font-weight: 600; }
select.quiet { width: auto; min-height: 34px; margin: 0; padding: 4px 8px; border-color: transparent; background-color: transparent; color: var(--muted); font-weight: 500; cursor: pointer; }
select.quiet:hover { color: var(--ink); }

/* Tables */
.table-wrap { padding: 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 14px 16px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
thead th { border-top: 0; font-size: 13px; color: var(--muted); font-weight: 500; padding-top: 14px; padding-bottom: 10px; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* The orders ledger uses the full width of the screen and groups its columns:
   who and what | status | money. A slightly stronger rule marks each group. */
main:has(.ledger) { max-width: 1800px; padding-left: 20px; padding-right: 20px; }
.ledger th, .ledger td { padding-left: 9px; padding-right: 9px; }
.ledger thead th { background: var(--ink); color: var(--card); font-size: 15px; font-weight: 700; letter-spacing: .01em; padding-top: 15px; padding-bottom: 15px; border-top: 0; position: sticky; top: 0; z-index: 1; }
.ledger thead th:first-child { border-top-left-radius: var(--radius); }
.ledger thead th:last-child { border-top-right-radius: var(--radius); }
.ledger tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 35%, transparent); }
.ledger th.sep, .ledger td.sep { border-left: 1px solid var(--line); padding-left: 12px; }
.ledger td.soft { color: var(--muted); font-size: 14.5px; }
.ledger td.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ledger td { padding-top: 10px; padding-bottom: 10px; }
.totals { display: flex; flex-wrap: wrap; gap: 6px 0; }
.totals span + span { margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--line); }
@media (max-width: 1750px) { .ledger .c3 { display: none; } }
@media (max-width: 1450px) { .ledger .c2 { display: none; } }
/* Grid lines between every piece of information, and colour that carries meaning:
   one colour per client and per hosting company, one per order type, and a tinted money block. */
.ledger th + th, .ledger td + td { border-left: 1px solid var(--line); }
.ledger th.sep, .ledger td.sep { border-left: 2px solid color-mix(in srgb, var(--muted) 35%, var(--line)); }
.ledger th, .ledger td { border-top-color: color-mix(in srgb, var(--muted) 18%, var(--line)); }
.who-dot, .host-mark { display: inline-block; width: 9px; height: 9px; margin-right: 8px; background: hsl(var(--h) 58% 50%); vertical-align: 1px; }
.who-dot { border-radius: 50%; }
.host-mark { border-radius: 2px; width: 4px; height: 14px; vertical-align: -2px; }
.tag.t-new { background: hsl(210 80% 93%); color: hsl(212 62% 32%); }
.tag.t-transfer { background: hsl(272 70% 94%); color: hsl(272 45% 36%); }
.tag.t-renew { background: hsl(168 50% 89%); color: hsl(170 60% 22%); }
[data-mode=dark] .tag.t-new { background: hsl(212 40% 22%); color: hsl(210 80% 82%); }
[data-mode=dark] .tag.t-transfer { background: hsl(272 30% 24%); color: hsl(272 70% 84%); }
[data-mode=dark] .tag.t-renew { background: hsl(170 35% 18%); color: hsl(168 50% 76%); }
.ledger td.money { background: color-mix(in srgb, var(--ok) 28%, transparent); }
.ledger thead th + th { border-left-color: color-mix(in srgb, var(--card) 22%, transparent); }
.ledger thead th.sep { border-left-color: color-mix(in srgb, var(--card) 55%, transparent); }
.ledger tbody td { font-size: 14.5px; }
.ledger tbody td .title { font-size: 15px; }
.ledger td.paid { font-weight: 600; }
.ledger td.comm { color: var(--ok-ink); font-weight: 600; }
.ledger .unset { color: var(--wait-ink); background: var(--wait); padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; }
/* Copy buttons: a quiet icon that wakes up on hover and flashes green once the text is copied. */
.cp { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; }
.cp .clip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp a.clip { max-width: 150px; display: inline-block; vertical-align: bottom; }
.copy-ico { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: color-mix(in srgb, var(--muted) 70%, transparent); cursor: pointer; }
.copy-ico .ico { width: 15px; height: 15px; }
.copy-ico:hover { background: var(--brand-soft); color: var(--brand); }
.copy-ico.done, .copy.done { background: var(--ok); color: var(--ok-ink); border-color: transparent; }
.copy { display: grid; place-items: center; min-width: 44px; padding: 0 12px; }
.pw-mask { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; letter-spacing: .08em; }
.pw-mask.shown { letter-spacing: 0; color: var(--ink); font-family: Consolas, "Courier New", monospace; font-size: 13.5px; }
.secret.plain input { font-family: inherit; font-size: inherit; }
/* Status changed in place: the select wears the same colours as the status tags. */
.status-form { margin: 0; }
select.status-pick { width: auto; min-height: 30px; margin: 0; padding: 2px 22px 2px 10px; border: 1px solid transparent; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; background-color: var(--line); color: var(--ink); }
select.status-pick:hover { border-color: color-mix(in srgb, currentColor 35%, transparent); }
select.status-pick.s-delivered { background-color: var(--ok); color: var(--ok-ink); }
select.status-pick.s-purchased { background-color: var(--brand-soft); color: var(--brand); }
select.status-pick.s-pending, select.status-pick.s-none { background-color: var(--wait); color: var(--wait-ink); }
select.status-pick.s-not_delivered, select.status-pick.s-canceled, select.status-pick.s-refunded { background-color: var(--bad); color: var(--bad-ink); }
select.status-pick.saved { box-shadow: 0 0 0 3px var(--ok); }
select.status-pick option { background: var(--card); color: var(--ink); }
/* What was bought: hosting, a domain, or both. */
.tag.p-hosting { background: hsl(200 60% 91%); color: hsl(200 70% 24%); }
.tag.p-domain { background: hsl(38 85% 88%); color: hsl(30 70% 26%); }
.tag.p-both { background: hsl(320 50% 92%); color: hsl(320 45% 30%); }
[data-mode=dark] .tag.p-hosting { background: hsl(200 35% 20%); color: hsl(200 65% 80%); }
[data-mode=dark] .tag.p-domain { background: hsl(36 40% 20%); color: hsl(40 80% 78%); }
[data-mode=dark] .tag.p-both { background: hsl(320 28% 22%); color: hsl(320 60% 84%); }
h2.gap { margin-top: 26px; }
/* Hosting companies: one colour each, shown as a tag. */
.tag.host { background: hsl(var(--h) 68% 91%); color: hsl(var(--h) 62% 26%); }
[data-mode=dark] .tag.host { background: hsl(var(--h) 32% 22%); color: hsl(var(--h) 65% 82%); }
/* Header cells that open a filter menu. */
.ledger th.has-menu { padding: 0; }
.th-btn { display: flex; align-items: center; gap: 5px; width: 100%; padding: 15px 9px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.ledger th.num .th-btn { justify-content: flex-end; }
.ledger th.sep .th-btn { padding-left: 12px; }
.ledger th:first-child .th-btn { padding-left: 16px; }
.th-btn svg { opacity: .6; flex: none; }
.ledger th.has-menu:hover { background: color-mix(in srgb, var(--ink) 82%, var(--brand)); }
.ledger th.filtered { box-shadow: inset 0 -4px 0 var(--brand); }
.ledger th.filtered .th-btn svg { opacity: 1; }
.th-menu { position: fixed; z-index: 40; min-width: 190px; max-width: 280px; max-height: min(60vh, 380px); overflow-y: auto; padding: 6px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, .18); font-size: 14px; font-weight: 500; letter-spacing: 0; text-align: left; white-space: normal; }
.th-menu p { margin: 6px 10px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.th-menu p + a { margin-top: 0; }
.th-menu a + p { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.th-menu a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--ink); }
.th-menu a:hover { background: var(--bg); text-decoration: none; }
.th-menu a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ledger tbody tr[data-href] { cursor: pointer; }
.ledger tbody tr[data-href]:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.ledger td.date { color: var(--muted); font-variant-numeric: tabular-nums; width: 1%; }
.ledger .title { color: var(--ink); font-weight: 600; }
.ledger tr:hover .title { color: var(--brand); text-decoration: none; }
td .under { display: block; font-size: 13.5px; color: var(--muted); margin-top: 1px; }
.unset { color: var(--muted); font-size: 14px; }
td.empty { text-align: center; color: var(--muted); padding: 56px 20px; white-space: normal; }
td.row-actions { text-align: right; width: 1%; }
form.inline { display: flex; gap: 6px; align-items: center; }
form.inline input { margin: 0; min-width: 150px; min-height: 34px; padding: 5px 10px; }
.row-actions form.inline { display: inline-flex; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.filters { padding: 14px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-row input, .filter-row select { width: auto; margin: 0; min-width: 150px; flex: 0 1 auto; }
.filter-row .grow { flex: 1 1 240px; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--line); color: var(--ink); white-space: nowrap; }
.s-delivered { background: var(--ok); color: var(--ok-ink); }
.s-purchased { background: var(--brand-soft); color: var(--brand); }
.s-pending { background: var(--wait); color: var(--wait-ink); }
.s-not_delivered, .s-canceled, .s-refunded { background: var(--bad); color: var(--bad-ink); }
.s-none { background: none; color: var(--muted); font-weight: 400; padding: 0; }

/* Order form */
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 22px 0 0; counter-reset: step; }
.stepper li { flex: 1; counter-increment: step; }
.stepper button { width: 100%; border: 0; border-top: 3px solid var(--line); background: none; padding: 9px 2px; font: inherit; font-size: 13.5px; color: var(--muted); cursor: pointer; text-align: left; }
.stepper button::before { content: counter(step) ". "; }
.stepper .done button { border-color: var(--brand); color: var(--ink); }
.stepper .on button { border-color: var(--brand); color: var(--ink); font-weight: 700; }
.form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form legend { font-weight: 700; font-size: 18px; padding: 0; margin-bottom: 18px; }
.form.all fieldset + fieldset, .form:not([data-wizard]) fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 24px; margin-top: 8px; }
.sub-box { background: var(--bg); border-radius: 12px; padding: 16px 16px 2px; margin-bottom: 18px; }
.choices { display: flex; gap: 8px; margin-top: 6px; }
.choices label { flex: 1; margin: 0; cursor: pointer; }
.choices input { position: absolute; opacity: 0; }
.choices span { display: block; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); font-weight: 600; }
.choices input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.choices input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.secret { display: flex; gap: 8px; margin-top: 6px; }
.secret input { margin: 0; font-family: Consolas, "Courier New", monospace; font-size: 14.5px; }
.copy { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 10px; cursor: pointer; }
.copy:hover { color: var(--ink); border-color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.actions.plain { border-top: 0; padding-top: 0; margin-top: 4px; }
.danger-zone { margin-top: 4px; text-align: right; }
.steps { padding-left: 20px; margin-top: 0; }

/* Appearance picker */
.look { position: relative; font-size: 14px; }
.look summary { list-style: none; cursor: pointer; }
.look summary::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); flex: none; box-shadow: inset 0 0 0 4px var(--bg); border: 1px solid var(--brand); }
.look summary::-webkit-details-marker { display: none; }
.look .panel { position: absolute; bottom: 44px; left: 0; width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, .14); z-index: 30; }
.guest .look { position: fixed; bottom: 14px; left: 14px; }
.guest .look summary { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 6px 10px; }
.look p { margin: 0 0 8px; font-weight: 600; color: var(--muted); font-size: 13px; }
.look .row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.look .row:last-child { margin-bottom: 0; }
.look .row button { border: 1px solid var(--line); background: var(--field); color: var(--ink); border-radius: 8px; padding: 7px 8px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 8px; font-family: inherit; }
.look .row button.on { border-color: var(--ink); font-weight: 600; }
.look i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .4); flex: none; }

@media (prefers-reduced-motion: no-preference) {
  .btn, input, select, .side nav a, .tabs a { transition: border-color .15s, background-color .15s, color .15s; }
  .side { transition: transform .2s; }
}
@media (max-width: 1000px) {
  .split, .split.even, .split.three { grid-template-columns: minmax(0, 1fr); }
  .adv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; width: 250px; background: var(--card); transform: translateX(-100%); }
  .side nav a.on { background: var(--bg); box-shadow: none; }
  .nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 15; }
  .mobile-bar { display: flex; }
  main { padding: 16px 16px 72px; }
  h1 { font-size: 26px; }
  .card { padding: 18px; }
  .stats { gap: 18px 36px; margin: 22px 0 26px; }
  .stats b { font-size: 32px; }
  .stepper button { font-size: 0; }
  .stepper button::before { font-size: 13px; content: counter(step); }
}
@media (max-width: 520px) {
  .rows li { flex-wrap: wrap; row-gap: 8px; }
  .rows .main { flex-basis: 100%; }
  .adv { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .adv .range { grid-column: auto; }
  .toolbar > select { flex: 1 1 130px; }
}

.ledger th:first-child, .ledger td:first-child { padding-left: 16px; }
.ledger th:last-child, .ledger td:last-child { padding-right: 16px; }
.ledger .tag { padding: 2px 8px; font-size: 12.5px; }

/* Phones: each order becomes a card that lists every field under its own label, instead of a wide table. */
@media (max-width: 760px) {
  main:has(.ledger) { padding-left: 14px; padding-right: 14px; }
  .table-wrap:has(.ledger) { background: none; box-shadow: none; border: 0; overflow: visible; }
  .ledger, .ledger tbody { display: block; }
  .ledger thead { display: none; }
  .ledger tbody tr { display: flex; flex-direction: column; background: var(--card) !important; border-radius: 14px; padding: 14px 16px 8px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
  .ledger tbody td, .ledger tbody td.sep, .ledger tbody td.c2, .ledger tbody td.c3 { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 40px; padding: 6px 0 !important; border: 0; border-top: 1px solid var(--line); background: none; white-space: normal; width: auto; text-align: right; font-size: 15px; }
  .ledger tbody td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 13.5px; font-weight: 500; }
  .ledger tbody td:empty { display: none; }
  .ledger tbody td.date, .ledger tbody td.row-actions { width: auto; color: var(--ink); }
  .ledger tbody td.who { order: -1; justify-content: flex-start; border-top: 0; min-height: 0; padding: 0 0 8px !important; font-size: 18px; font-weight: 700; }
  .ledger tbody td.who::before { display: none; }
  .ledger tbody tr.none { padding: 0; }
  .ledger tbody tr.none td { display: block; text-align: center; border: 0; padding: 36px 16px !important; }
  .ledger tbody tr.none td::before { display: none; }
  .ledger .cp .clip, .ledger .cp a.clip { max-width: 52vw; }
  .ledger .copy-ico { width: 34px; height: 34px; }
  .ledger .copy-ico .ico { width: 17px; height: 17px; }
  .ledger .tag { font-size: 13.5px; padding: 3px 11px; }
  select.status-pick { min-height: 34px; font-size: 13.5px; }
  .totals span + span { margin-left: 10px; padding-left: 10px; }
  .list-head { margin-top: 18px; }
}

/* Dashboard: figures up top, then panels that each answer one question about the month. */
main:has(.kpis) { max-width: 1240px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 26px 0 16px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; color: var(--ink); min-width: 0; }
a.kpi:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--brand-soft), 0 1px 2px rgba(0, 0, 0, .04); }
.kpi .label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.kpi > b { font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi > b small { display: inline; margin-left: 6px; font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.kpi .delta { font-size: 13.5px; color: var(--muted); }
.kpi .delta.up { color: var(--ok-ink); }
.kpi .delta.down { color: var(--danger); }
.kpi .foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.panel { padding: 20px 22px; margin-bottom: 16px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 16px; color: var(--ink); font-weight: 700; }
.panel-head span, .panel-head a { font-size: 13.5px; color: var(--muted); }
.panel-head a { color: var(--brand); font-weight: 600; }
.panel-head b { color: var(--ink); }
.panel h3 { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.meter { display: flex; gap: 3px; height: 14px; border-radius: 99px; overflow: hidden; background: var(--bg); }
.meter .seg { min-width: 6px; }
.meter .seg:hover { filter: brightness(.93); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; padding: 0; font-size: 14px; }
.legend a { color: var(--ink); display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend b { font-variant-numeric: tabular-nums; }
.meter .s-delivered, .legend .s-delivered { background: hsl(140 45% 46%); }
.meter .s-purchased, .legend .s-purchased { background: var(--brand); }
.meter .s-pending, .legend .s-pending { background: hsl(40 90% 55%); }
.meter .s-not_delivered, .legend .s-not_delivered { background: hsl(8 70% 56%); }
.meter .s-canceled, .legend .s-canceled { background: hsl(350 35% 62%); }
.meter .s-refunded, .legend .s-refunded { background: hsl(280 30% 60%); }
.meter .s-empty, .legend .s-empty { background: hsl(210 10% 62%); }
.meter .s-unset, .legend .s-unset { background: color-mix(in srgb, var(--muted) 35%, var(--line)); }
.rows.flush { padding: 0; }
.rows.flush li:first-child { padding-top: 0; }
.rows.flush li:last-child { padding-bottom: 0; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.hbars li { display: grid; grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 30px; align-items: center; gap: 12px; font-size: 14.5px; }
.hbars a { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars b { text-align: right; font-variant-numeric: tabular-nums; }
.track { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.track .fill { display: block; height: 100%; min-width: 4px; border-radius: 99px; background: var(--brand); }
.track .fill.warn { background: hsl(40 90% 55%); }
table.mini th, table.mini td { padding: 9px 10px; border-top: 1px solid var(--line); font-size: 14.5px; }
table.mini thead th { border-top: 0; padding-top: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
table.mini th:first-child, table.mini td:first-child { padding-left: 0; }
table.mini th:last-child, table.mini td:last-child { padding-right: 0; }
table.mini td a { color: var(--ink); font-weight: 600; }
table.mini td a:hover { color: var(--brand); }
.panel .chart { height: 190px; padding: 6px 0 0; }
.days { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-bottom: 20px; }
.day { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.day i { width: 100%; border-radius: 3px 3px 0 0; background: var(--brand); }
.day em { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11.5px; color: var(--muted); }
.panel .plain li:first-child { padding-top: 0; }
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 520px) {
  .kpis { gap: 10px; margin-top: 18px; }
  .kpi { padding: 14px; }
  .kpi > b { font-size: 24px; }
  .kpi > b small { display: block; margin: 0; }
  .panel { padding: 16px; }
  .panel-head { flex-wrap: wrap; }
  table.mini { display: block; overflow-x: auto; }
  .hbars li { grid-template-columns: minmax(80px, 120px) minmax(0, 1fr) 26px; }
}

.focus.wide { max-width: 860px; }
.note-text { margin: 0 0 14px; color: var(--muted); max-width: 68ch; }
.row-actions form.inline + form.inline { margin-left: 4px; }
