:root {
    color-scheme: dark;
    --ink: #e6ebf1;
    --muted: #9aa6b4;
    --line: #2b3542;
    --bg: #0e1319;
    --card: #161d26;
    --link: #7fadff;
    --primary: #2f6fe0;
    --primary-dark: #2559b8;
    --danger: #ff8a82;
    --danger-line: #7a3a36;
    --ok-bg: #12301d;
    --ok-line: #25593a;
    --err-bg: #3a1815;
    --err-line: #7a3a36;
    --input-bg: #0f151c;
    --input-line: #425063;
    --th-bg: #1d2631;
    --hover: #202b38;
    --sum-bg: #1a222c;
    --top-bg: #0a0e13;
    --focus: #8ab4f8;
    --warn-bg: #2e1a18;
    --warn-line: #7a3a36;
    --b-bg: #263140; --b-ink: #c8d2de;
    --b-paid-bg: #123a22; --b-paid-ink: #7fd89b;
    --b-sent-bg: #14315e; --b-sent-ink: #9cc1ff;
    --b-draft-bg: #4a3a0c; --b-draft-ink: #f3d27a;
    --b-over-bg: #4a1a16; --b-over-ink: #ffaaa3;
    --b-void-bg: #2c2f33; --b-void-ink: #aab1b9;
    --radius: 10px;
}
:root[data-theme="light"] {
    color-scheme: light;
    --ink: #1c2430;
    --muted: #5d6877;
    --line: #dde2e8;
    --bg: #f4f6f8;
    --card: #ffffff;
    --link: #1f6feb;
    --primary: #1f6feb;
    --primary-dark: #1859c0;
    --danger: #b3261e;
    --danger-line: #e0a8a4;
    --ok-bg: #e6f4ea;
    --ok-line: #a6d4b1;
    --err-bg: #fdecea;
    --err-line: #efb4ae;
    --input-bg: #ffffff;
    --input-line: #b9c2cd;
    --th-bg: #eef2f6;
    --hover: #eef2f6;
    --sum-bg: #f7f9fb;
    --top-bg: #17202b;
    --focus: #8ab4f8;
    --warn-bg: #fff7f6;
    --warn-line: #e7a09b;
    --b-bg: #e8edf2; --b-ink: #38424f;
    --b-paid-bg: #d9f0df; --b-paid-ink: #1d6b34;
    --b-sent-bg: #dfeafd; --b-sent-ink: #1d4fa3;
    --b-draft-bg: #fff1cf; --b-draft-ink: #7a5a00;
    --b-over-bg: #fbd9d6; --b-over-ink: #8f1d15;
    --b-void-bg: #e5e5e5; --b-void-ink: #555;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--link); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
.muted { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.narrow { max-width: 460px; margin: 2rem auto; }
.narrow-form { max-width: 560px; }
body.plain { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
body.plain .narrow { width: 100%; }

/* top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding: .7rem 1rem; background: var(--top-bg); color: #fff; }
.top a { color: #fff; text-decoration: none; padding: .25rem .1rem; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; flex: 1; }
.top nav a:hover, .top .brand:hover { text-decoration: underline; }
.top .brand { font-weight: 700; font-size: 1.05rem; }
.top .signout { margin: 0; display: flex; gap: .6rem; align-items: center; }
.top .muted { color: #b8c2cf; }
.top-spacer { flex: 1; }
.top .link { color: #fff; }
.portal-foot { text-align: center; padding: 1.5rem 1rem 2.5rem; font-size: .9rem; }

/* layout bits */
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .5rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form { display: inline; margin: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .75rem 1rem; margin-bottom: .75rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .85rem; margin: 1rem 0 1.25rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1rem; }
.card h2:first-child { margin-top: 0; }
.stat .big { font-size: 1.6rem; font-weight: 700; }
.stat.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.stack > * { display: block; margin-bottom: .6rem; }
.stack .btn { display: inline-block; }

/* forms */
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .75rem; }
label.inline { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; margin: 0 1rem .6rem 0; }
input[type=text], input[type=email], input[type=search], input[type=date], input[type=password], input[type=file], select, textarea {
    display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit; font-weight: 400;
    border: 1px solid var(--input-line); border-radius: 8px; background: var(--input-bg); color: var(--ink);
}
label.inline input[type=text], label.inline input[type=date], label.inline select { width: auto; margin-top: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .35rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.filters input[type=search], .filters select { width: auto; min-width: 180px; margin-top: 0; }

/* buttons */
.btn { display: inline-block; padding: .6rem 1rem; border-radius: 8px; border: 1px solid var(--input-line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
button.link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; }

/* messages */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.flash.err { background: var(--err-bg); border: 1px solid var(--err-line); }

/* tables */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { background: var(--th-bg); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.list th.num, table.list td.num { text-align: right; }
table.list.compact td { padding: .45rem .5rem; }
table.list .sumrow td { font-weight: 700; background: var(--sum-bg); }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--b-bg); color: var(--b-ink); }
.badge.paid { background: var(--b-paid-bg); color: var(--b-paid-ink); }
.badge.sent { background: var(--b-sent-bg); color: var(--b-sent-ink); }
.badge.draft { background: var(--b-draft-bg); color: var(--b-draft-ink); }
.badge.overdue { background: var(--b-over-bg); color: var(--b-over-ink); }
.badge.cancelled { background: var(--b-void-bg); color: var(--b-void-ink); }
.badge.void { background: var(--b-void-bg); color: var(--b-void-ink); }
.dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: .45em; background: #999; }
.history { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.history li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.logo-preview { max-height: 56px; border: 1px solid var(--line); padding: 4px; background: #fff; border-radius: 4px; }

/* invoice editor */
.items-edit th { text-align: left; font-size: .85rem; color: var(--muted); padding: .4rem; }
.items-edit td { padding: .4rem; vertical-align: top; border-top: 1px solid var(--line); }
.items-edit td:nth-child(2), .items-edit td:nth-child(3), .items-edit td:nth-child(4) { width: 110px; }
.items-edit .svc-pick { margin: 0 0 .4rem; font-size: .9rem; }
.items-edit textarea { margin-bottom: .4rem; }
.doc-totals.live { margin: 1rem 0 0 auto; width: 280px; }

/* invoice document (on screen) */
.doc { --danger: #b3261e; --accent: #2b6cb0; --ink: #1c2430; --muted: #5d6877; --line: #dde2e8; --link: var(--accent); background: #fff; color: #1c2430; border: 1px solid #dde2e8; border-radius: var(--radius); padding: 1.75rem; }
.doc a { color: var(--accent); }
.doc-head, .doc-mid, .doc-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.25rem; }
.doc-logo img { max-height: 56px; max-width: 240px; }
.logo-main { font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1.15; }
.logo-sub { color: #555; margin-top: .15rem; }
.doc-org { text-align: right; font-size: .92rem; color: #444; }
.doc-mid { margin: 1.75rem 0 1.25rem; }
.doc-title { margin: 0 0 .75rem; font-size: 1.9rem; letter-spacing: .02em; color: var(--accent); text-transform: uppercase; }
.stamp { display: inline-block; border: 2px solid var(--danger); color: var(--danger); padding: 0 .5rem; margin-left: .6rem; font-size: .9rem; vertical-align: middle; border-radius: 4px; }
.stamp.paid { border-color: #1d6b34; color: #1d6b34; }
.h { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7480; margin-bottom: .2rem; }
.bill-name { font-weight: 700; font-size: 1.05rem; }
.gap-top { margin-top: .4rem; }
.doc-meta { width: auto; min-width: 280px; border: 1px solid var(--accent); }
.doc-meta td { padding: .4rem .75rem; }
.doc-meta td:last-child { text-align: right; }
.doc-meta .due td { background: var(--accent); color: #fff; font-weight: 700; }
.doc-items { margin-top: .5rem; }
.doc-items th { background: var(--accent); color: #fff; text-align: left; padding: .55rem .65rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.doc-items td { padding: .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-items th.num, .doc-items td.num { text-align: right; }
.desc ul { margin: .25rem 0 .25rem 1.1rem; padding: 0; }
.desc .gap { height: .4rem; }
.support { margin-top: .3rem; font-size: .88rem; color: #555; }
.doc-bottom { margin-top: 1rem; }
.doc-notes { flex: 1; min-width: 220px; }
.doc-totals { width: 300px; }
.doc-totals td { padding: .3rem .6rem; }
.doc-totals td:last-child { text-align: right; }
.doc-totals .grand td { background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem; padding: .5rem .6rem; }
.doc-bank { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; margin-top: 1.25rem; }
.doc-bank dl { display: flex; flex-wrap: wrap; gap: .6rem 2rem; margin: 0; }
.doc-bank dt { color: #6b7480; font-size: .82rem; }
.doc-bank dd { margin: 0; font-weight: 600; }
.doc-terms { margin-top: 1.25rem; font-size: .9rem; color: #444; }
.doc-terms p { margin: .3rem 0; }
.doc-footer { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid var(--line); text-align: center; font-size: .9rem; color: #555; }
.doc-footer p { margin: .2rem 0; }

@media (max-width: 860px) {
    .two-col { grid-template-columns: 1fr; }
    .doc { padding: 1rem; }
    .doc-org { text-align: left; }
    .doc-totals, .doc-totals.live { width: 100%; }
    .top .signout { width: 100%; }
}
@media print {
    .top, .actions, .filters, .portal-foot, .flash, .head-row a, aside { display: none !important; }
    body { background: #fff; }
    .wrap { max-width: none; padding: 0; }
    .two-col { display: block; }
    .doc, .card { border: 0; padding: 0; }
    table.list { border: 0; }
}

.theme-toggle { position: fixed; right: 14px; bottom: 14px; z-index: 50; min-height: 44px; padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--input-line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.theme-toggle:hover { background: var(--hover); }
@media print {
    .theme-toggle { display: none !important; }
    :root { color-scheme: light; --ink: #1c2430; --muted: #5d6877; --line: #dde2e8; --bg: #fff; --card: #fff; }
}

/* ---- admin shell: sidebar layout ---- */
body.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1rem .75rem; background: var(--top-bg); border-right: 1px solid var(--line); color: #e6ebf1; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: .65rem; padding: .35rem .5rem 1rem; color: #fff; text-decoration: none; }
.side-brand strong { display: block; line-height: 1.15; }
.side-brand small { display: block; color: #9aa6b4; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.side-logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 800; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { margin: 1rem .6rem .3rem; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: #7d8996; }
.side-nav a { display: block; padding: .5rem .7rem; border-radius: 8px; color: #c8d2de; text-decoration: none; border-left: 3px solid transparent; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: rgba(47,111,224,.22); color: #fff; font-weight: 600; border-left-color: var(--focus); }
.side-user { display: flex; align-items: center; gap: .65rem; margin: 0; padding: .75rem .5rem 0; border-top: 1px solid rgba(255,255,255,.1); }
.side-user .avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #2b3542; color: #fff; font-weight: 700; flex: none; }
.side-user .who { display: flex; flex-direction: column; font-size: .9rem; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.side-user button.link { color: #9cc1ff; text-align: left; font-size: .85rem; }
.app-main { min-width: 0; }
body.app .wrap { max-width: 1240px; padding: 1.75rem 2rem 4rem; }
body.app h1 { font-size: 1.55rem; letter-spacing: -.01em; }
body.app .card { box-shadow: 0 1px 2px rgba(0,0,0,.18); }
body.app .stat .big { font-size: 1.75rem; letter-spacing: -.01em; }
body.app .stat .muted:first-child { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
body.app table.list tbody tr:hover td { background: var(--hover); }
body.app table.list tr:last-child td { border-bottom: 0; }
@media (max-width: 860px) {
    body.app { display: block; }
    .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem .75rem; }
    .side-brand { padding: .2rem .25rem; }
    .side-nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; order: 3; gap: .25rem; }
    .side-group { display: none; }
    .side-nav a { border-left: 0; padding: .4rem .6rem; }
    .side-user { border: 0; padding: 0; margin-left: auto; }
    body.app .wrap { padding: 1rem 1rem 4rem; }
}
@media print { .side { display: none !important; } body.app { display: block; } }

.side-search { margin: 0 0 .25rem; padding: 0 .25rem; }
.side-search input[type=search] { margin-top: 0; padding: .5rem .7rem; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.side-search input[type=search]::placeholder { color: #9aa6b4; }
@media (max-width: 860px) { .side-search { order: 2; flex: 1 1 100%; } }

.who-name { color: #fff; text-decoration: none; font-weight: 600; }
.who-name:hover { text-decoration: underline; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line); margin: 0 0 1.25rem; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--primary); }
.hint { margin: -.4rem 0 .9rem; font-size: .88rem; }

/* dashboard chart */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.chart .bar.inv { fill: var(--muted); opacity: .55; }
.chart .bar.rec { fill: var(--primary); }
.legend { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.legend .key { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; }
.legend .key.inv { background: var(--muted); opacity: .55; }
.legend .key.rec { background: var(--primary); margin-left: .6rem; }
.chart-card h2 { margin: 0; }
.quarters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; align-items: center; }

.qr-box { background: #fff; padding: 12px; border-radius: 10px; width: 220px; height: 220px; margin: .75rem 0; }
.qr-box svg { width: 100%; height: 100%; display: block; }
pre.codes { background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; font-size: 1.05rem; line-height: 1.7; columns: 2; }
code { background: var(--hover); padding: .1rem .35rem; border-radius: 4px; }

/* live search dropdown */
.side-search { position: relative; }
.live-results { position: absolute; left: .25rem; right: .25rem; top: calc(100% + 4px); z-index: 50; min-width: 300px; max-height: 70vh; overflow: auto;
    background: var(--card, #1b222c); color: var(--ink, #e8edf3); border: 1px solid rgba(255,255,255,.18); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); padding: .3rem; }
.live-results[hidden] { display: none; }
.live-results a { display: grid; grid-template-columns: 4.2rem 1fr; gap: .1rem .5rem; padding: .45rem .55rem; border-radius: 7px; color: inherit; text-decoration: none; font-size: .9rem; }
.live-results a:hover, .live-results a.on { background: rgba(127,127,127,.2); }
.live-results .lr-type { grid-row: span 2; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; opacity: .65; padding-top: .15rem; }
.live-results .lr-sub { opacity: .65; font-size: .8rem; }
.live-results a.lr-all { display: block; text-align: center; opacity: .8; border-top: 1px solid rgba(127,127,127,.25); border-radius: 0 0 7px 7px; margin-top: .2rem; }
#new-client-fields[hidden] { display: none; }

/* type-to-search client picker */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; max-height: 18rem; overflow: auto;
    background: var(--card); color: var(--ink); border: 1px solid var(--line, rgba(127,127,127,.35)); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.3); padding: .3rem; }
.combo-list[hidden] { display: none; }
.combo-opt { padding: .5rem .65rem; border-radius: 7px; cursor: pointer; }
.combo-opt:hover, .combo-opt.on { background: rgba(127,127,127,.22); }
.combo-new { border-bottom: 1px solid rgba(127,127,127,.25); margin-bottom: .25rem; border-radius: 7px 7px 0 0; font-weight: 600; }
.combo-none { padding: .5rem .65rem; opacity: .65; }

/* Admin: denser, full-width layout (compact like a back-office tool) */
body.app { font-size: 14px; grid-template-columns: 200px minmax(0, 1fr); }
body.app .wrap { max-width: none; padding: 1rem 1.5rem 3rem; }
body.app h1 { font-size: 1.3rem; margin-bottom: .5rem; }
body.app h2 { font-size: 1.05rem; margin: 1.1rem 0 .5rem; }
body.app .side { padding: .75rem .5rem; }
body.app .side-nav a { padding: .35rem .6rem; font-size: .93rem; }
body.app .side-group { margin: .75rem .6rem .2rem; }
body.app .side-brand { padding: .25rem .4rem .7rem; }
body.app .head-row { margin-bottom: .6rem; align-items: center; }
body.app .btn { padding: .35rem .8rem; min-height: 34px; font-size: .93rem; border-radius: 6px; }
body.app input, body.app select, body.app textarea { padding: .4rem .6rem; font-size: .93rem; }
body.app .filters { gap: .5rem; margin-bottom: .75rem; }
body.app .filters input[type=search] { min-width: 300px; }
body.app .filters select { min-width: 150px; max-width: 260px; }
body.app label { font-size: .9rem; margin-bottom: .55rem; }
body.app .card { padding: .8rem 1rem; margin-bottom: .75rem; }
body.app table.list th, body.app table.list td { padding: .35rem .7rem; vertical-align: middle; white-space: nowrap; }
body.app table.list td:nth-child(2) { white-space: normal; }
body.app table.list th { font-size: .75rem; }
body.app .badge { font-size: .72rem; padding: .05rem .5rem; }
body.app .stat .big { font-size: 1.45rem; }
body.app .theme-toggle { min-height: 34px; padding: .3rem .75rem; font-size: .85rem; }

/* Comfortable row spacing (between the compact and the original look) */
body.app { font-size: 15px; }
body.app table.list th, body.app table.list td { padding: .78rem .9rem; line-height: 1.35; }
body.app table.list th { padding-top: .65rem; padding-bottom: .65rem; }
body.app .side-nav a { padding: .45rem .7rem; }
body.app .card { padding: 1rem 1.15rem; }

/* Phone layout: bigger tap targets, no zoom on inputs, lists and item lines stacked as cards */
@media (max-width: 860px) {
    body.app, body { font-size: 16px; }
    body.app .wrap { padding: .9rem .85rem 5rem; }
    body.app input, body.app select, body.app textarea { font-size: 16px; padding: .6rem .7rem; }
    body.app .btn { min-height: 44px; padding: .6rem 1rem; font-size: 1rem; }
    body.app .side-nav a { padding: .55rem .75rem; }
    body.app .filters input[type=search], body.app .filters select { min-width: 0; max-width: none; flex: 1 1 100%; }
    body.app .head-row { gap: .5rem; }
    body.app .actions .btn { flex: 1 1 auto; text-align: center; }
    .theme-toggle { bottom: 10px; right: 10px; }

    table.list.inv, table.list.inv tbody, table.list.inv tr, table.list.inv td { display: block; }
    table.list.inv thead { display: none; }
    table.list.inv { border: 0; background: transparent; }
    table.list.inv tr { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .85rem; margin-bottom: .6rem; }
    body.app table.list.inv td { display: flex; justify-content: space-between; gap: .75rem; padding: .18rem 0; border: 0; white-space: normal; text-align: right; }
    table.list.inv td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; flex: none; }
    table.list.inv td:first-child { font-size: 1.1rem; }
    table.list.inv td:first-child::before { content: ""; }

    .items-edit, .items-edit tbody, .items-edit tr, .items-edit td { display: block; }
    .items-edit thead { display: none; }
    .items-edit tr { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; margin-bottom: .7rem; }
    .items-edit td { border: 0; padding: .2rem 0; }
    .items-edit td:nth-child(2), .items-edit td:nth-child(3), .items-edit td:nth-child(4) { display: inline-block; width: 31%; vertical-align: top; }
    .items-edit td:nth-child(2)::before { content: "Unit cost ($)"; }
    .items-edit td:nth-child(3)::before { content: "Qty"; }
    .items-edit td:nth-child(4)::before { content: "GST %"; }
    .items-edit td:nth-child(2)::before, .items-edit td:nth-child(3)::before, .items-edit td:nth-child(4)::before { display: block; font-size: .8rem; color: var(--muted); }
    .items-edit td:nth-child(5)::before { content: "Amount "; color: var(--muted); font-size: .85rem; }
    .items-edit td.num { text-align: left; }
}
