/* invoices.net — landing page / invoice editor */

:root {
    --accent: #0f766e;
    --accent-hover: #115e59;
    --accent-soft: #ccfbf1;
    --accent-tint: #f0fdfa;

    --ink: #111827;
    --ink-2: #374151;
    --muted: #6b7280;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --bg: #f3f4f6;
    --paper: #ffffff;

    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(0 0 0 / .08);
    --ring: 0 0 0 3px rgb(15 118 110 / .25);

    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    --s7: 48px;
    --s8: 64px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}

img { max-width: 100%; display: block; }

[hidden] { display: none !important; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.skip-link {
    position: absolute; left: var(--s4); top: -100px;
    padding: var(--s2) var(--s3);
    background: var(--ink); color: #fff;
    border-radius: var(--radius-sm);
    z-index: 100;
}
.skip-link:focus { top: var(--s2); }

.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--s5);
}
.container-narrow { max-width: 860px; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
    padding: 10px 18px;
    font: inherit; font-weight: 600;
    border: 1px solid transparent; border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: var(--accent-tint); }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-block { width: 100%; padding-block: 14px; font-size: 16px; }

.link-btn {
    padding: 0;
    font: inherit; font-weight: 600; font-size: 14px;
    color: var(--accent);
    background: none; border: 0;
    cursor: pointer;
}
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- Header ---------- */

.site-header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    min-height: 60px;
}
.brand {
    display: inline-flex; align-items: center; gap: var(--s2);
    font-size: 20px; font-weight: 800; letter-spacing: -.02em;
    color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-tld { color: var(--accent); }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.site-nav { display: flex; align-items: center; gap: var(--s5); align-self: stretch; }
.site-nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.site-nav a:not(.btn):hover { color: var(--accent); }
/* Each word is clickable across the full height of the header and up to halfway to its neighbours; looks the same */
.site-nav > a:not(.btn) { align-self: stretch; display: flex; align-items: center; padding-inline: calc(var(--s5) / 2); margin-inline: calc(var(--s5) / -2); }

/* ---------- Hero ---------- */

.hero {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding-block: var(--s7);
}
.hero h1 { font-size: 40px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 var(--s3); }
.hero .lead { max-width: 760px; margin: 0; color: var(--ink-2); }
.hero .lead + .lead { margin-top: var(--s3); }
.hero-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); }
.hero-sub { margin: 0 0 var(--s4); font-size: 24px; color: var(--ink-2); }
.hero-close {
    flex: none; width: 40px; height: 40px;
    font-size: 28px; line-height: 1; color: var(--muted);
    background: none; border: 0; border-radius: var(--radius); cursor: pointer;
}
.hero-close:hover { background: var(--bg); color: var(--ink); }
.hide-hero .hero { display: none; }

/* ---------- Editor layout ---------- */

.editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: var(--s5);
    align-items: start;
    padding-block: var(--s6) var(--s7);
}

.paper {
    background: var(--paper);
    border-radius: var(--radius);
    /* A 1px edge, then two sheets peeking out on the right and bottom, like a stack of paper (a -1px spread
       sheet in the page color over a full-size one in the line color draws the same 1px edge) */
    box-shadow:
        0 0 0 1px var(--line-strong),
        5px 5px 0 -1px var(--paper), 5px 5px 0 0 var(--line-strong),
        10px 10px 0 -1px var(--paper), 10px 10px 0 0 var(--line-strong),
        var(--shadow);
    margin: 0 10px 10px 0;
    padding: var(--s7);
    display: flex; flex-direction: column; gap: var(--s6);
}

/* Editable fields: look like text until hovered/focused */
.field {
    width: 100%;
    padding: 6px 10px;
    font: inherit; color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea.field { resize: vertical; min-height: 38px; line-height: 1.45; }
.field::placeholder { color: #9ca3af; }
.field:hover { border-color: var(--line-strong); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--paper); }
.field-label { color: var(--muted); font-weight: 500; }
.paper textarea.field,
.paper .party .field:not(.field-label),
.paper .meta-row .field:not(.field-label) { border-color: var(--line); }

input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Top: logo + title */
.paper-top {
    display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s5);
}
.logo-drop {
    display: grid; place-items: center;
    width: 220px; height: 120px;
    border: 2px dashed var(--line-strong);
    border-radius: var(--radius);
    background: #fafafa;
    color: var(--muted); font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}
.logo-drop:hover, .logo-drop:focus-within, .logo-drop.is-dragging {
    border-color: var(--accent); background: var(--accent-tint); color: var(--accent);
}
.logo-box { position: relative; }
.logo-drop.has-logo {
    width: auto; height: auto;
    border: 0; background: none;
    border-radius: var(--radius-sm);
}
.logo-drop.has-logo:hover, .logo-drop.has-logo:focus-within { box-shadow: var(--ring); }
.logo-img { display: block; max-width: 280px; max-height: 160px; object-fit: contain; border-radius: var(--radius-sm); }
.logo-remove {
    position: absolute; top: 8px; left: 8px;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border: 0; border-radius: var(--radius-sm);
    background: rgba(17, 24, 39, .8); color: #fff;
    font-size: 20px; line-height: 1; cursor: pointer;
    opacity: 0; transition: opacity .15s;
}
.logo-box:hover .logo-remove, .logo-remove:focus-visible { opacity: 1; }
.logo-error { margin: var(--s2) 0 0; max-width: 280px; color: #b91c1c; font-size: 13px; }
.doc-heading { text-align: right; flex: 0 1 520px; min-width: 0; }
.field-title {
    font-size: 40px; font-weight: 300; letter-spacing: .02em;
    text-align: right; padding-block: 0;
}
.doc-number {
    display: flex; align-items: center; justify-content: flex-end;
    margin-top: var(--s2);
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding-left: var(--s3);
    color: var(--muted);
}
.doc-number:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.doc-number .field { border: 0; width: 140px; max-width: 100%; min-width: 0; box-shadow: none; }

/* Parties + meta */
.paper-parties {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: var(--s6);
}
.parties {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4);
}
.party-from { grid-column: 1 / -1; max-width: 380px; }
.party .field-label { padding-inline: 0; margin-bottom: var(--s1); font-size: 14px; }

.meta { display: flex; flex-direction: column; gap: var(--s2); }
.meta-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); align-items: center;
}
.meta-row .field-label { text-align: right; }

/* Line items */
.items { display: flex; flex-direction: column; gap: var(--s2); }
.items-head, .item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px 130px 120px 56px;
    gap: var(--s2);
    align-items: center;
}
.items-head {
    background: var(--ink);
    border-radius: var(--radius-sm);
    padding: var(--s1);
}
.items-head .field {
    color: #fff; font-weight: 600; font-size: 14px;
}
.items-head .field:hover { border-color: rgb(255 255 255 / .3); }
.items-head .field:focus { background: var(--ink-2); }
.items-body { display: flex; flex-direction: column; gap: var(--s2); padding-inline: var(--s1); }
.item-row .field { border-color: var(--line); }
.amount { padding-right: 10px; color: var(--ink-2); }

.money-input {
    display: flex; align-items: center;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding-inline: 10px 0;
    color: var(--muted);
    background: var(--paper);
}
.money-input:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.money-input .field { border: 0; box-shadow: none; padding-left: var(--s1); text-align: right; }
.money-input .suffix { padding-right: 10px; }

/* Row actions: ↑ ↓ stacked, × beside them */
.row-actions {
    display: grid;
    grid-template-columns: 24px 28px;
    grid-template-rows: 22px 22px;
    align-items: center; justify-items: center;
    column-gap: var(--s1);
}
.row-btn {
    display: grid; place-items: center;
    padding: 0;
    color: var(--muted);
    background: none; border: 0; border-radius: var(--radius-sm);
    cursor: pointer;
}
.row-up, .row-down { width: 24px; height: 22px; }
.row-up { grid-area: 1 / 1; }
.row-down { grid-area: 2 / 1; }
.row-up:hover, .row-down:hover { color: var(--accent); background: var(--accent-tint); }
.remove-row {
    grid-area: 1 / 2 / 3 / 3;
    width: 28px; height: 28px;
    font-size: 22px; line-height: 1;
    border-radius: 50%;
}
.remove-row:hover { color: #b91c1c; background: #fee2e2; }

/* Only show the moves that make sense; a lone row can't be removed */
.items-body .item-row:first-child .row-up,
.items-body .item-row:last-child .row-down,
.items-body .item-row:only-child .remove-row { visibility: hidden; }

/* Actions appear only on the row being hovered or edited */
.row-actions { opacity: 0; transition: opacity .15s; }
.item-row:hover .row-actions,
.item-row:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

.add-row {
    width: 100%;
    margin-top: var(--s1);
    padding: 12px;
    font-size: 15px;
}
.add-row svg { flex-shrink: 0; }

/* Bottom: notes + totals */
.paper-bottom {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: var(--s6);
}
.notes { display: flex; flex-direction: column; gap: var(--s4); }
.note .field-label { padding-inline: 0; margin-bottom: var(--s1); font-size: 14px; }

.totals { display: flex; flex-direction: column; gap: var(--s2); }
.total-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 150px 28px; gap: var(--s2); align-items: center;
}
.total-row > output { grid-column: 2; text-align: right; padding-right: 2px; }
.total-row-strong {
    border-top: 2px solid var(--line-strong);
    margin-top: var(--s2); padding-top: var(--s4);
}
.total-row-strong .field-label,
.total-row-strong output { color: var(--ink); font-size: 17px; font-weight: 700; }
.total-row-balance .field-label { color: var(--ink); font-weight: 700; }
.total-row-balance output { font-size: 18px; font-weight: 700; }

/* Adjustment input: [$] value [%] [⇄] */
.adj-input {
    display: flex; align-items: stretch;
    height: 42px;
    background: var(--paper);
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    color: var(--muted);
}
.adj-input:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.adj-input .field {
    flex: 1; min-width: 0;
    border: 0; box-shadow: none; background: transparent;
    text-align: right;
}
.adj-prefix { display: flex; align-items: center; padding-left: 12px; }
.adj-suffix { display: flex; align-items: center; padding: 0 12px 0 4px; }
[data-mode="percent"] .adj-prefix,
[data-mode="flat"] .adj-suffix { display: none; }
.adj-swap {
    display: grid; place-items: center;
    width: 40px; flex-shrink: 0;
    color: var(--ink-2);
    background: none;
    border: 0; border-left: 1px solid var(--line-strong);
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
}
.adj-swap:hover { color: var(--accent); background: var(--accent-tint); }

.adj-remove {
    grid-column: 3;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    font-size: 24px; line-height: 1;
    color: #dc2626;
    background: none; border: 0; border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, background-color .15s;
}
.total-row:hover .adj-remove,
.adj-remove:focus-visible { opacity: 1; }
.adj-remove:hover { background: #fee2e2; }
@media (hover: none) { .adj-remove { opacity: 1; } }

.adjust-links { display: flex; flex-wrap: wrap; gap: var(--s5); padding: var(--s1) 10px; }
.adjust-links .link-btn { font-size: 15px; font-weight: 500; }

/* Sidebar */
.sidebar {
    position: sticky; top: 84px;
    display: flex; flex-direction: column; gap: var(--s5);
    padding: var(--s5);
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.sidebar-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.sidebar-label {
    display: block; margin-bottom: var(--s2); padding: 0;
    font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted);
}
.select {
    width: 100%;
    padding: 9px 36px 9px 12px;
    font: inherit; color: var(--ink);
    /* Our own arrow, 14px in from the edge (the browser's sits right against the border) */
    background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
    appearance: none; -webkit-appearance: none;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    text-overflow: ellipsis; cursor: pointer;
}
.select:hover { border-color: var(--accent); }
.select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }


.sidebar-links {
    display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3);
    padding-top: var(--s4); border-top: 1px solid var(--line);
}
.sidebar-note { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Info / SEO section ---------- */

.info {
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding-block: var(--s8);
}
.info h2 { font-size: 24px; letter-spacing: -.01em; margin: var(--s7) 0 var(--s4); }
.info h2.info-first { margin-top: 0; }
.info h3 { font-size: 16px; margin: 0 0 var(--s1); }
.info p { margin: 0; color: var(--ink-2); }
.lead { font-size: 18px; }

.steps {
    list-style: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5);
    counter-reset: step;
}
.steps li { counter-increment: step; }
.steps li::before {
    content: counter(step);
    display: grid; place-items: center;
    width: 36px; height: 36px; margin-bottom: var(--s3);
    border-radius: 50%;
    background: var(--accent-soft); color: var(--accent-hover);
    font-weight: 700;
}

.features {
    list-style: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4);
}
.features li {
    padding: var(--s5);
    border: 1px solid var(--line); border-radius: var(--radius);
    background: #fafafa;
}

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
    display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
    padding: var(--s4) 0;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    font-size: 22px; font-weight: 400; line-height: 1;
    color: var(--accent);
    transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: var(--s4); }

/* ---------- Footer ---------- */

.site-footer { background: var(--bg); border-top: 1px solid var(--line); }
.footer-cols {
    display: grid; grid-template-columns: 2fr 1fr; gap: var(--s6);
    padding-block: var(--s6) var(--s5); border-bottom: 1px solid var(--line);
}
.footer-heading { margin: 0 0 var(--s3); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.footer-cols ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2) var(--s5); }
.footer-docs ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.footer-cols a { color: var(--ink-2); text-decoration: none; }
.footer-cols a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 640px) {
    .footer-cols { grid-template-columns: 1fr; }
}
.footer-inner {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s3);
    padding-block: var(--s5);
    font-size: 14px; color: var(--muted);
}
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: var(--s5); }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }
.footer-inner .footer-social { gap: 4px; margin-inline: auto; }
.footer-social a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; }
.footer-social a:hover { background: var(--accent-tint); }
.footer-social svg { display: block; }
@media (max-width: 640px) { .footer-inner .footer-social { order: -1; width: 100%; margin-inline: -8px; } }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .editor { grid-template-columns: 1fr; }
    .sidebar { position: static; gap: var(--s4); }
    .sidebar .save-status { text-align: center; }
    .sidebar-links { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: var(--s5); }
    .sidebar-note { text-align: center; }
    .paper { padding: var(--s6); }
    .paper-parties, .paper-bottom { grid-template-columns: 1fr; }
    .meta, .totals { max-width: 420px; margin-left: auto; width: 100%; }
}

@media (max-width: 640px) {
    .container { padding-inline: var(--s4); }
    .site-nav a:not(.btn) { display: none; }
    .site-nav { gap: var(--s3); }
    .editor { padding-top: var(--s4); }
    .paper { padding: var(--s5) var(--s4); gap: var(--s5); }
    .paper-top { flex-direction: column-reverse; align-items: stretch; }
    .doc-heading { flex: none; max-width: none; }
    .logo-drop { width: 100%; height: 96px; }
    .parties { grid-template-columns: 1fr; }
    .party-from { max-width: none; }

    .items-head { display: none; }
    .items-body { padding: 0; gap: var(--s3); }
    .item-row {
        grid-template-columns: 1fr 1fr 56px;
        grid-template-areas:
            "desc desc remove"
            "qty  rate remove"
            "amt  amt  remove";
        padding: var(--s3);
        border: 1px solid var(--line); border-radius: var(--radius);
        background: #fafafa;
    }
    .item-row > .item-desc { grid-area: desc; }
    .item-row > .item-qty { grid-area: qty; }
    .item-row > .item-rate { grid-area: rate; }
    .item-row > .item-amt { grid-area: amt; font-weight: 600; }
    .item-row > .row-actions { grid-area: remove; align-self: start; }
    .item-row > .item-date { grid-area: date; min-width: 0; width: 100%; }
    .item-row > .item-ref { grid-area: ref; }
    .item-row > .item-pay { grid-area: pay; }
    .paper[data-layout="statement"] .item-row {
        grid-template-areas:
            "date ref  remove"
            "desc desc remove"
            "rate pay  remove"
            "amt  amt  remove";
    }
    .paper[data-layout="packing"] .item-row {
        grid-template-areas:
            "desc desc remove"
            "qty  qty  remove";
    }
    .paper[data-layout="timesheet"] .item-row {
        grid-template-areas:
            "date date remove"
            "desc desc remove"
            "qty  rate remove"
            "amt  amt  remove";
    }
    .item-row .field, .item-row .money-input { background: var(--paper); }

    .total-row { grid-template-columns: minmax(0, 1fr) 150px 28px; gap: var(--s1); }
    .info { padding-block: var(--s7); }
    .hero { padding-block: var(--s5); }
    .hero h1 { font-size: 28px; }
    .hero .lead { font-size: 16px; }
    .steps, .features { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Print: just the invoice ---------- */

@media print {
    @page { margin: 12mm; }
    body { background: #fff; font-size: 12pt; }
    .site-header, .hero, .sidebar, .info, .site-footer, .skip-link,
    .add-row, .row-actions, .adjust-links, .adj-swap, .adj-remove { display: none !important; }
    .adj-input { border-color: transparent; }
    .container { max-width: none; padding: 0; }
    .editor { display: block; padding: 0; }
    .paper { box-shadow: none; padding: 0; border-radius: 0; margin: 0; }
    .field, .money-input, .doc-number, .item-row .field,
    .paper textarea.field { border-color: transparent !important; box-shadow: none !important; resize: none; }
    .field::placeholder { color: transparent; }
    .logo-drop:not(.has-logo) { visibility: hidden; }
    .logo-remove, .logo-error { display: none !important; }
    .items-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .item-row { break-inside: avoid; }
}

/* ---------- Auth pages (login / signup) ---------- */

.auth-page { min-height: 100vh; }
.auth {
    display: flex; flex-direction: column; align-items: center;
    padding: var(--s7) var(--s4);
}
.auth-brand { margin-bottom: var(--s5); }
.auth-card {
    width: 100%; max-width: 420px;
    padding: var(--s6);
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.auth-sub { margin: var(--s1) 0 var(--s5); color: var(--muted); }
.auth-notice {
    margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
    background: var(--accent-tint); border: 1px solid var(--accent-soft); border-radius: var(--radius-sm);
    color: var(--accent-hover); font-size: 14px;
}
.auth-form { display: flex; flex-direction: column; gap: var(--s4); }
.auth-field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.auth-label-row a { font-size: 13px; font-weight: 500; text-decoration: none; }
.auth-label-row a:hover { text-decoration: underline; }
.input {
    width: 100%;
    padding: 10px 12px;
    font: inherit; color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.auth-check { display: flex; align-items: center; gap: var(--s2); font-size: 14px; color: var(--ink-2); cursor: pointer; }
.auth-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.auth-divider {
    display: flex; align-items: center; gap: var(--s3);
    margin: var(--s5) 0;
    font-size: 13px; color: var(--muted);
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-alt { display: flex; flex-direction: column; gap: var(--s3); }
.btn-outline { background: var(--paper); color: var(--ink-2); border-color: var(--line-strong); font-weight: 500; }
.btn-outline:hover { background: var(--bg); color: var(--ink); }
.auth-alt .btn-block { padding-block: 11px; font-size: 15px; }
.auth-foot { margin: var(--s5) 0 0; font-size: 14px; color: var(--muted); }
.auth-foot a { font-weight: 600; }

@media (max-width: 640px) {
    .auth { padding-top: var(--s6); }
    .auth-card { padding: var(--s5); }
}
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
select.input { appearance: auto; cursor: pointer; }
@media (max-width: 400px) { .auth-row { grid-template-columns: 1fr; } }

/* ---------- Legal pages ---------- */

.legal { background: var(--paper); padding-block: var(--s7) var(--s8); }
.legal-doc { line-height: 1.7; color: var(--ink-2); }
.legal-doc h1 { margin: 0; font-size: 36px; line-height: 1.2; letter-spacing: -.02em; color: var(--ink); }
.legal-updated { margin: var(--s2) 0 var(--s6); color: var(--muted); font-size: 14px; }
.legal-doc h2 { margin: var(--s6) 0 var(--s3); font-size: 20px; color: var(--ink); }
.legal-doc p { margin: 0 0 var(--s3); }
.legal-doc ol, .legal-doc ul { margin: 0 0 var(--s3); padding-left: var(--s5); }
.legal-doc li { margin-bottom: var(--s2); }
.legal-doc strong { color: var(--ink); }

@media (max-width: 640px) {
    .legal { padding-block: var(--s6); }
    .legal-doc h1 { font-size: 28px; }
}
.legal-doc h3 { margin: var(--s4) 0 var(--s2); font-size: 16px; color: var(--ink); }
.legal-callout {
    padding: var(--s4) var(--s5);
    background: var(--accent-tint); border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
}

/* ---------- Guides (/guides, /how-to-make-an-invoice, …) ---------- */

.guide { background: var(--paper); padding-block: var(--s6) var(--s8); }
.guide-article { max-width: 760px; line-height: 1.7; color: var(--ink-2); font-size: 17px; }
.guide-article h1 { margin: 0; font-size: 40px; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); text-wrap: balance; }
.guide-article h2 { margin: var(--s7) 0 var(--s3); font-size: 26px; line-height: 1.25; letter-spacing: -.01em; color: var(--ink); scroll-margin-top: 80px; }
.guide-article h3 { margin: 0 0 var(--s2); font-size: 19px; line-height: 1.35; color: var(--ink); }
.guide-article p { margin: 0 0 var(--s4); }
.guide-article ul, .guide-article ol { margin: 0 0 var(--s4); padding-left: var(--s5); }
.guide-article li { margin-bottom: var(--s2); }
.guide-article strong { color: var(--ink); }
.guide-article code { padding: 1px 6px; font-size: .9em; background: var(--bg); border-radius: var(--radius-sm); color: var(--ink); }
.guide-article .faq { margin-bottom: var(--s5); }
.guide-article .faq summary { color: var(--ink); }
.guide-crumbs { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); font-size: 14px; color: var(--muted); }
.guide-crumbs a { color: var(--accent); font-weight: 600; text-decoration: none; }
.guide-crumbs a:hover { text-decoration: underline; }
.guide-updated { margin: var(--s2) 0 var(--s5) !important; font-size: 14px; color: var(--muted); }
.guide-lead { font-size: 19px; color: var(--ink-2); }

.guide-answer {
    margin: var(--s5) 0; padding: var(--s5);
    background: var(--accent-tint); border: 1px solid var(--accent-soft); border-radius: 12px;
}
.guide-answer-title, .guide-toc-title, .guide-cta-title { margin: 0 0 var(--s2) !important; font-weight: 700; color: var(--ink); }
.guide-answer ol { margin-bottom: var(--s3); }
.guide-answer li { margin-bottom: var(--s1); }
.guide-answer p:last-child { margin-bottom: 0; }

.guide-toc { margin: var(--s5) 0; padding: var(--s4) var(--s5); border: 1px solid var(--line); border-radius: 12px; }
.guide-toc ol { margin: 0; }
.guide-toc li { margin-bottom: var(--s1); }
.guide-toc a { color: var(--accent); text-decoration: none; }
.guide-toc a:hover { text-decoration: underline; }

.guide-cta {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s5);
    margin: var(--s6) 0; padding: var(--s5);
    background: var(--ink); color: #d1d5db; border-radius: 14px;
}
.guide-cta p { margin: 0; font-size: 15px; line-height: 1.5; }
.guide-cta .guide-cta-title { color: #fff; font-size: 18px; }
.guide-cta .btn { flex-shrink: 0; padding: 12px 20px; }

.guide-steps { list-style: none; padding: 0 !important; counter-reset: gstep; }
.guide-steps > li {
    counter-increment: gstep;
    position: relative; margin: 0 0 var(--s6); padding-left: 56px;
}
.guide-steps > li::before {
    content: counter(gstep);
    position: absolute; left: 0; top: 0;
    display: grid; place-items: center; width: 38px; height: 38px;
    border-radius: 50%; background: var(--accent-soft); color: var(--accent-hover);
    font-weight: 700; font-size: 16px;
}
.guide-steps > li h3 { padding-top: 6px; }

.guide-checks, .guide-mistakes { list-style: none; padding: 0 !important; }
.guide-checks li, .guide-mistakes li { position: relative; padding-left: 30px; }
.guide-checks li::before, .guide-mistakes li::before {
    position: absolute; left: 0; top: .3em;
    content: ""; width: 20px; height: 20px;
    border-radius: 50%; background: center / 12px no-repeat;
}
.guide-checks li::before { background-color: var(--accent-soft); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23115e59' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.guide-mistakes li::before { background-color: #fee2e2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b91c1c' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7L7 17'/%3E%3C/svg%3E"); }

.guide-list { list-style: none; padding: 0 !important; display: grid; gap: var(--s3); }
.guide-list li { margin: 0; }
.guide-list a {
    display: block; padding: var(--s4) var(--s5);
    border: 1px solid var(--line); border-radius: 12px;
    color: var(--ink-2); text-decoration: none;
    transition: border-color .15s, background-color .15s;
}
.guide-list a:hover { border-color: var(--accent); background: var(--accent-tint); }
.guide-list strong { display: block; color: var(--accent); font-size: 18px; }
.guide-list span { font-size: 15px; }

.guide-table-wrap { overflow-x: auto; }
.guide-table { width: 100%; min-width: 560px; margin: 0 0 var(--s4); border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.guide-table th { padding: var(--s2) var(--s3); text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--line); }
.guide-table td { padding: var(--s3); vertical-align: top; border-bottom: 1px solid var(--line); }
.guide-table td:first-child { white-space: nowrap; }
@media (max-width: 640px) {
    .guide-table { min-width: 0; }
    .guide-table thead { display: none; }
    .guide-table tr { display: block; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
    .guide-table td, .guide-table td:first-child { display: block; padding: 2px 0; border: 0; white-space: normal; }
    .guide-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--muted); }
}

/* Example invoice drawn in HTML, looks like the editor's paper */
.guide-sample { margin: var(--s5) 0; }
.guide-article h3.guide-sample-title { margin: var(--s5) 0 0; }
.guide-sample figcaption { margin-top: var(--s3); font-size: 14px; color: var(--muted); text-align: center; }
.sample-paper {
    padding: var(--s6);
    background: var(--paper); border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--line-strong), var(--shadow);
    font-size: 13px; line-height: 1.5; color: #333;
}
.sample-paper p { margin: 0; }
.sample-top, .sample-mid, .sample-bottom { display: flex; justify-content: space-between; gap: var(--s5); }
.sample-mid { margin: var(--s5) 0; }
.sample-bottom { margin-top: var(--s5); }
.sample-logo {
    display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: var(--s3);
    border-radius: 12px; background: #7c3aed; color: #fff; font-weight: 800; font-size: 18px;
}
.sample-title { text-align: right; }
.sample-h { font-size: 30px; line-height: 1.1; letter-spacing: .02em; color: #333; }
.sample-title p + p { color: var(--muted); }
.sample-label { color: var(--muted); }
.sample-meta, .sample-totals { display: grid; grid-template-columns: auto auto; gap: 2px var(--s4); margin: 0; align-content: start; }
.sample-meta dt, .sample-totals dt { color: var(--muted); text-align: right; }
.sample-meta dd, .sample-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sample-totals .sample-due { margin-top: var(--s1); padding-top: var(--s1); font-weight: 700; color: #333; border-top: 1px solid var(--line); }
.sample-scroll { overflow-x: auto; }
.sample-items { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 13px; }
.sample-items th { padding: 8px 10px; background: #333; color: #fff; font-weight: 600; text-align: left; }
.sample-items th:first-child { border-radius: 4px 0 0 4px; }
.sample-items th:last-child { border-radius: 0 4px 4px 0; }
.sample-items td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.sample-items .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sample-bottom > div { max-width: 52%; }

.sample-blank .sample-paper, .sample-blank { color: var(--muted); }
.sample-blank strong { color: var(--ink-2); }
.sample-logo-blank { width: 96px; background: var(--bg); border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13px; font-weight: 600; }
.sample-parties { display: flex; gap: var(--s6); }
.sample-optional { font-size: 11px; }
.sample-gap { margin-top: var(--s3) !important; }
.guide-templates { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2) var(--s4); }
.guide-templates li { margin: 0; }
.guide-templates a {
    display: block; padding: var(--s3) var(--s4);
    border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--accent); font-weight: 600; text-decoration: none;
}
.guide-templates a:hover { border-color: var(--accent); background: var(--accent-tint); }

@media (max-width: 640px) {
    .guide { padding-block: var(--s5) var(--s7); }
    .guide-article { font-size: 16px; }
    .guide-article h1 { font-size: 30px; }
    .guide-article h2 { font-size: 22px; }
    .guide-cta { flex-direction: column; align-items: stretch; }
    .guide-steps > li { padding-left: 48px; }
    .sample-paper { padding: var(--s4); font-size: 12px; }
    .sample-top, .sample-mid, .sample-bottom { flex-direction: column; gap: var(--s3); }
    .sample-title { text-align: left; }
    .sample-meta, .sample-totals { justify-content: start; }
    .sample-meta dt, .sample-totals dt { text-align: left; }
    .sample-bottom > div { max-width: none; }
    .sample-parties { flex-direction: column; gap: var(--s3); }
    .guide-templates { grid-template-columns: 1fr; }
    .sample-items { min-width: 0; font-size: 11.5px; }
    .sample-items th, .sample-items td { padding: 7px 5px; }
}

/* ---------- Contact ---------- */

.contact {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: var(--s7);
    align-items: start;
}
.contact-intro h1 { margin: 0 0 var(--s3); font-size: 36px; line-height: 1.2; letter-spacing: -.02em; }
.contact-intro .lead { margin: 0; color: var(--ink-2); }
.contact-info { margin-top: var(--s6); }
.contact-info h2 { margin: var(--s5) 0 var(--s1); font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.contact-info p { margin: 0; color: var(--ink-2); }
.contact-card { max-width: none; border: 1px solid var(--line); }
textarea.input { resize: vertical; min-height: 140px; line-height: 1.5; }
.input[aria-invalid="true"] { border-color: #dc2626; }
.field-error { margin: 6px 0 0; font-size: 13px; color: #b91c1c; }
.form-error-banner {
    margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
    background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-sm);
    color: #b91c1c; font-size: 14px;
}
.contact-sent h2 { margin: 0 0 var(--s2); font-size: 20px; }
.contact-sent p { margin: 0 0 var(--s5); color: var(--ink-2); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 860px) {
    .contact { grid-template-columns: 1fr; gap: var(--s5); }
    .contact-intro h1 { font-size: 28px; }
    .contact-info { margin-top: var(--s4); }
}
.char-count { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.char-count-near { color: #b45309; }
.nav-form { margin: 0; display: contents; }
.nav-link-btn {
    padding: 0; font: inherit; font-weight: 500; font-size: 14px;
    color: var(--ink-2); background: none; border: 0; cursor: pointer;
}
.nav-link-btn:hover { color: var(--accent); }
@media (max-width: 640px) { .nav-link-btn { display: none; } }

/* ---------- App pages (invoices, clients) ---------- */

.app-page { padding-block: var(--s6) var(--s8); min-height: 60vh; }
.app-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.app-head h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.app-count { color: var(--muted); font-size: 14px; }
.app-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s6); align-items: start; }
.app-side { max-width: none; position: sticky; top: 84px; }
.app-side h2 { margin: 0 0 var(--s4); font-size: 18px; }
.optional { font-weight: 400; color: var(--muted); }
.app-signout { margin-top: var(--s6); font-size: 14px; color: var(--muted); }

.empty-state {
    padding: var(--s7) var(--s5);
    text-align: center;
    background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty-state h2 { margin: 0 0 var(--s2); font-size: 18px; }
.empty-state p { margin: 0 auto var(--s4); max-width: 420px; color: var(--muted); }

.record-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.record {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s4); align-items: center;
    padding: var(--s4) var(--s5);
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.record-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.record-sub { color: var(--accent); font-size: 14px; }
.record-details { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: var(--s1); }
.record-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.record-actions, .row-tools { display: flex; gap: var(--s2); align-items: center; justify-content: flex-end; }
.record-actions form, .row-tools form { margin: 0; }

.btn-danger-ghost { background: none; color: #b91c1c; border-color: transparent; font-weight: 500; }
.btn-danger-ghost:hover { background: #fee2e2; }

.table-wrap {
    position: relative; /* keeps absolutely positioned children (visually-hidden labels) inside the scroll box */
    overflow-x: auto;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: var(--s3) var(--s4); text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafafa; }
.data-table th.num, .data-table td.num { text-align: right; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--accent-tint); }
.data-table a { text-decoration: none; }
.data-table a:not([role="menuitem"]):hover, .data-table a:not([role="menuitem"]):focus-visible { text-decoration: underline; }

@media (max-width: 860px) {
    .app-layout { grid-template-columns: 1fr; }
    .app-side { position: static; order: -1; }
    .record { grid-template-columns: 1fr; gap: var(--s2); }
    .record-actions { justify-content: flex-start; }
}

/* Editor: saving + client picker */
.save-status { margin: var(--s2) 0 0; min-height: 1.2em; font-size: 13px; color: var(--muted); text-align: center; }
.save-status.is-error { color: #b91c1c; }
.save-status.is-ok { color: var(--accent); }
.party-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s1); }
.party-head .field-label { margin-bottom: 0; flex: 1; min-width: 0; }
.client-picker {
    flex: none; max-width: 60%;
    padding: 3px 6px;
    font: inherit; font-size: 13px; color: var(--accent);
    background: var(--accent-tint); border: 1px solid var(--accent-soft); border-radius: var(--radius-sm);
    cursor: pointer;
}
@media print { .client-picker, .save-status { display: none !important; } }

/* ---------- Saved invoice page (invoice.php) + public link (d.php) ---------- */

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px;
    font-size: 13px; font-weight: 500; letter-spacing: 0; vertical-align: middle;
    border-radius: 999px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-unpaid  { background: #f3f4f6; color: #4b5563; }
.badge-viewed  { background: #e0f2fe; color: #0369a1; }
.badge-sent    { background: #ede9fe; color: #6d28d9; }
.badge-paid    { background: #dcfce7; color: #15803d; }
.badge-overdue { background: #fee2e2; color: #b91c1c; }

.inv-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); flex-wrap: wrap;
    padding-bottom: var(--s5); margin-bottom: var(--s5);
    border-bottom: 1px solid var(--line);
}
.inv-head h1 { margin: 0; font-size: 30px; letter-spacing: -.02em; display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.inv-sub { margin: var(--s2) 0 0; display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--muted); font-size: 15px; }
.inv-sub span + span::before { content: "·"; margin: 0 10px; color: var(--line-strong); }
.inv-sub span:last-child { color: var(--ink); font-weight: 500; }
.inv-actions { display: flex; gap: var(--s2); align-items: center; }
.btn-icon { padding-inline: 12px; }

.menu { position: relative; }
.menu-list {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 9; /* below the sticky header (10) when the page scrolls */
    min-width: 220px; padding: 6px 0;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgb(0 0 0 / .12);
}
.menu-list form { margin: 0; }
.menu-list hr { margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.menu-list [role="menuitem"] {
    display: flex; align-items: center; gap: var(--s3); width: 100%;
    padding: 10px 18px;
    font: inherit; font-size: 15px; color: var(--ink-2); text-align: left; text-decoration: none;
    background: none; border: 0; cursor: pointer;
}
.menu-list [role="menuitem"]:hover, .menu-list [role="menuitem"]:focus-visible { background: var(--bg); color: var(--ink); outline: none; }
.menu-list svg { width: 18px; height: 18px; flex: none; color: #9ca3af; }
.menu-list .menu-danger, .menu-list .menu-danger svg { color: #b91c1c; }
.menu-list .menu-danger:hover { background: #fef2f2; color: #b91c1c; }

.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s6); align-items: start; }
.inv-layout-single { grid-template-columns: minmax(0, 860px); justify-content: center; }
.inv-side { display: flex; flex-direction: column; gap: var(--s4); position: sticky; top: 84px; }
.inv-card { padding: var(--s5); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.inv-card p { margin: 0; }
.inv-card-label { font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.inv-card-label:not(:first-child) { margin-top: var(--s4) !important; }
.inv-card-amount { margin-top: var(--s1) !important; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-card-row { display: flex; justify-content: space-between; margin-top: var(--s4) !important; padding-top: var(--s4); border-top: 1px solid var(--line); color: var(--muted); }
.inv-card-row span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
.inv-card-share { background: var(--accent-tint); border-color: var(--accent-soft); }
.inv-card-share h2 { margin: 0 0 var(--s2); font-size: 18px; }
.inv-card-share p { color: var(--ink-2); font-size: 14px; }
.share-row { display: flex; gap: var(--s2); margin-top: var(--s4); }
.share-row .input { min-width: 0; font-size: 13px; color: var(--muted); }
.share-row .btn { flex: none; }
.inv-made-with { margin: var(--s5) 0 0; text-align: center; font-size: 13px; color: var(--muted); }

/* The invoice itself, read-only */
.doc {
    padding: var(--s7) var(--s7) var(--s6);
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink);
}
.doc p { margin: 0; }
.doc-top { display: flex; justify-content: space-between; gap: var(--s5); }
.doc-logo { max-width: 200px; max-height: 120px; object-fit: contain; margin-bottom: var(--s4); }
.doc-strong { font-weight: 500; }
.doc-title { text-align: right; }
.doc-title h2 { margin: 0; font-size: 44px; line-height: 1.1; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.doc-title p { margin-top: var(--s2); font-size: 20px; color: var(--muted); }
.doc-parties {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 300px); gap: var(--s5);
    margin-top: var(--s7);
}
.doc-party:only-of-type { grid-column: span 2; }
.doc h3 { margin: 0 0 var(--s1); font-size: 15px; font-weight: 400; color: var(--muted); }
.doc-party p { font-size: 17px; }
.doc-meta { grid-column: 3; margin: 0; }
.doc-meta div { display: flex; justify-content: space-between; gap: var(--s4); padding: 6px 0; }
.doc-meta dt { color: var(--muted); }
.doc-meta dd { margin: 0; text-align: right; font-size: 17px; }
.doc-meta .doc-meta-balance { margin-top: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }
.doc-meta-balance dd { font-weight: 700; }

.doc-table-wrap { margin: var(--s6) calc(-1 * var(--s7)) 0; overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.doc-table th, .doc-table td { padding: var(--s4) var(--s3); text-align: left; vertical-align: top; }
.doc-table th:first-child, .doc-table td:first-child { padding-left: var(--s7); }
.doc-table th:last-child, .doc-table td:last-child { padding-right: var(--s7); }
.doc-table th { font-weight: 600; color: var(--ink-2); background: #fafafa; border-block: 1px solid var(--line); white-space: nowrap; }
.doc-table td { font-size: 17px; border-bottom: 1px solid var(--line); }
.doc-table td:first-child { width: 50%; }
.doc-table .num { text-align: right; white-space: nowrap; }

.doc-totals { width: min(100%, 420px); margin: var(--s4) 0 0 auto; font-variant-numeric: tabular-nums; }
.doc-totals div { display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s2) 0; }
.doc-totals dt { color: var(--muted); }
.doc-totals dd { margin: 0; font-size: 17px; }
.doc-totals .doc-totals-total { margin-top: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line-strong); }
.doc-totals-total dt { color: var(--ink); font-weight: 700; }
.doc-totals .doc-totals-balance { padding-top: var(--s3); border-top: 1px solid var(--line); }
.doc-totals-balance dt { color: var(--ink); font-weight: 700; }
.doc-totals-balance dd { font-size: 20px; font-weight: 700; }
.doc-note { margin-top: var(--s5); }
.doc-note p { font-size: 16px; }

@media (max-width: 960px) {
    .inv-layout { grid-template-columns: 1fr; }
    .inv-side { position: static; order: -1; }
}
@media (max-width: 640px) {
    .inv-head h1 { font-size: 24px; }
    .inv-actions { width: 100%; }
    .inv-actions > .btn { flex: 1; }
    .doc { padding: var(--s5) var(--s4); }
    .doc-top { flex-direction: column-reverse; }
    .doc-title { text-align: left; }
    .doc-title h2 { font-size: 32px; }
    .doc-parties { grid-template-columns: 1fr; margin-top: var(--s5); }
    .doc-party:only-of-type { grid-column: auto; }
    .doc-meta { grid-column: auto; }
    .doc-table-wrap { margin-inline: calc(-1 * var(--s4)); }
    .doc-table th:first-child, .doc-table td:first-child { padding-left: var(--s4); }
    .doc-table th:last-child, .doc-table td:last-child { padding-right: var(--s4); }
    .doc-table td { font-size: 15px; }
}
@media print {
    .inv-head, .inv-side, .inv-made-with, .auth-notice { display: none !important; }
    .inv-layout { display: block; }
    .doc { border: 0; padding: 0; }
}
.save-status:empty { margin: 0; min-height: 0; }
.inv-actions .btn { min-height: 44px; }

/* Soft delete: Voided badge, list notices, active/deleted switch */
.badge-voided { background: #fee2e2; color: #b91c1c; }
.flash {
    display: flex; align-items: center; gap: var(--s3);
    margin-bottom: var(--s5); padding: var(--s3) var(--s4);
    background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--radius);
    color: #065f46;
}
.flash > svg { flex: none; color: #059669; }
.flash p { margin: 0; flex: 1; }
.flash form { margin: 0; }
.flash .link-btn { font-weight: 600; }
.flash-close {
    flex: none; width: 28px; height: 28px;
    font-size: 22px; line-height: 1; color: #059669;
    background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.flash-close:hover { background: #d1fae5; }
.app-subtitle { margin: var(--s1) 0 0; color: var(--muted); }
.list-filter { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3); margin: calc(-1 * var(--s2)) 0 var(--s4); }
.list-filter label { font-size: 14px; font-weight: 600; color: #374151; }
.list-filter .select { width: auto; min-width: 220px; max-width: 100%; }
.list-filter-clear { font-size: 14px; font-weight: 500; }
.combo { position: relative; }
.combo-btn { min-width: 240px; max-width: 360px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: var(--ring); }
.combo-pop {
    position: absolute; left: 0; top: calc(100% + 6px); z-index: 9;
    width: max(100%, 300px); max-width: calc(100vw - 32px); box-sizing: border-box;
    padding: var(--s2); display: flex; flex-direction: column; gap: var(--s2);
    background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 12px 32px rgb(17 24 39 / .16);
}
.combo-search { padding: 9px 12px; }
.combo-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; outline: none; }
.combo-list [role="option"] {
    display: flex; align-items: center; gap: var(--s3);
    padding: 9px 12px; border-radius: var(--radius-sm);
    font-size: 15px; color: var(--ink-2); cursor: pointer;
}
.combo-list [role="option"].is-active { background: var(--bg); color: var(--ink); }
.combo-list [role="option"][aria-selected="true"] { color: var(--accent); font-weight: 600; }
.combo-list [role="option"][aria-selected="true"]::after {
    content: ""; flex: none; width: 16px; height: 16px; order: 3;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
}
.combo-list [role="option"]:first-child:not([hidden]) { border-bottom: 1px solid var(--line); border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin-bottom: 4px; }
.combo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-count {
    flex: none; min-width: 24px; padding: 1px 8px; border-radius: 999px; text-align: center;
    background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.combo-list [role="option"].is-active .combo-count { background: var(--paper); }
.combo-empty { margin: 0; padding: 6px 12px 10px; color: var(--muted); font-size: 14px; }
@media (max-width: 600px) { .combo, .list-filter .combo-btn { width: 100%; max-width: none; } .list-filter label { width: 100%; } }
.data-table tr[hidden] { display: none; }
.data-table .search-empty td { padding: var(--s5); text-align: center; color: var(--muted); }
.table-foot { margin: var(--s3) 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.list-switch { margin: var(--s5) 0 0; padding-top: var(--s4); border-top: 1px solid var(--line); }
.list-switch a { font-weight: 500; text-decoration: none; }
.list-switch a:hover { text-decoration: underline; }
.voided-notice {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
    margin-bottom: var(--s5); padding: var(--s3) var(--s4);
    background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius);
    color: #991b1b;
}
.voided-notice p { margin: 0; }
.voided-notice form { margin: 0; }
.data-table .menu-list { text-align: left; white-space: nowrap; }

/* ---------- Customers: form, page, cards ---------- */

.muted { color: var(--muted); }
.panel { padding: var(--s6); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-title { margin: 0 0 var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); font-size: 28px; letter-spacing: -.02em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.form-field label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--ink-2); }
.form-field textarea.input { min-height: 160px; }
.form-field-wide { grid-column: 1 / -1; }
.form-field textarea.input[name="description"] { min-height: 96px; }
.panel-actions { display: flex; gap: var(--s2); margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid var(--line); }

.client-title { display: flex; align-items: center; gap: var(--s4); }
.avatar {
    display: grid; place-items: center; flex: none;
    width: 52px; height: 52px; border-radius: var(--radius);
    background: var(--accent-soft); color: var(--accent);
    font-weight: 700; font-size: 18px;
}
.stats {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4);
    margin: 0 0 var(--s5); padding-bottom: var(--s5); border-bottom: 1px solid var(--line);
}
.stats dt { font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: var(--s1) 0 0; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.client-layout { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.client-cards { display: flex; flex-direction: column; gap: var(--s4); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
    margin: 0; padding: var(--s4) var(--s5);
    border-bottom: 1px solid var(--line);
    font-size: 17px;
}
.card-head h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: var(--s2); }
h2.card-head { justify-content: flex-start; gap: var(--s2); }
.card-head svg { color: #9ca3af; flex: none; }
.card-body { margin: 0; padding: var(--s4) var(--s5); }
.detail-list div { display: grid; grid-template-columns: 90px 1fr; gap: var(--s3); padding: 4px 0; }
.detail-list dt { color: var(--muted); font-size: 14px; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.card-link { font-weight: 600; text-decoration: none; font-size: 15px; }
.count-pill { padding: 0 8px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 500; }
.card-empty { margin: 0; padding: var(--s6) var(--s5); text-align: center; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.card .data-table th { background: none; }

@media (max-width: 860px) {
    .client-layout { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .panel { padding: var(--s5) var(--s4); }
    .form-grid { grid-template-columns: 1fr; }
}

/* My Invoices header: Import / Export / New Invoice ▾ */
.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.btn-split { display: inline-flex; }
.btn-split > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-split > [data-menu-toggle] { padding-inline: 12px; border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgb(255 255 255 / .35); }
.btn-split .menu-list { min-width: 240px; }
@media (max-width: 640px) {
    .app-head:has(.app-actions) { flex-direction: column; align-items: flex-start; }
}

/* Import form */
.panel-title h1 { margin: 0; font-size: inherit; letter-spacing: inherit; }
.input-file { padding: 8px; cursor: pointer; }
.input-file::file-selector-button {
    margin-right: var(--s3); padding: 8px 16px;
    font: inherit; font-weight: 500; color: var(--accent-hover);
    background: var(--accent-soft); border: 0; border-radius: calc(var(--radius) - 2px); cursor: pointer;
}
.field-hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.panel-title .app-subtitle { font-size: 15px; letter-spacing: 0; }

/* Saved items: list page and the editor's suggestion list (item-picker.js) */
.items-table .item-cell { max-width: 520px; white-space: normal; overflow-wrap: anywhere; }
.items-table .item-cell a { font-weight: 600; }
.sort-toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; }
.sort-toggle a { padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.sort-toggle a:hover { color: var(--accent); }
.sort-toggle a[aria-current] { background: var(--accent); color: #fff; }
@media (max-width: 640px) {
    .items-table th:nth-child(3), .items-table td:nth-child(3) { display: none; }
}
.item-pop {
    position: absolute; z-index: 9; box-sizing: border-box; padding: var(--s2);
    background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 12px 32px rgb(17 24 39 / .16);
}
.item-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.item-opt {
    display: flex; align-items: baseline; gap: var(--s3);
    padding: 9px 12px; border-radius: var(--radius-sm);
    font-size: 15px; color: var(--ink-2); cursor: pointer;
}
.item-opt.is-active { background: var(--bg); color: var(--ink); }
.item-opt-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-opt-price { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-save { color: var(--accent); font-weight: 600; }
.item-save + .item-foot, .item-opt + .item-save { border-top: 1px solid var(--line); }
.item-opt + .item-save { margin-top: 4px; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.item-save.is-busy { opacity: .7; cursor: progress; }
.item-save.is-done { color: var(--ink-2); cursor: default; }
.item-foot { position: sticky; bottom: 0; padding: 8px 12px 4px; background: var(--paper); font-size: 13px; } /* stays visible while the list scrolls */
.item-foot a { color: var(--muted); }
.item-foot a:hover { color: var(--accent); }

/* History (documents kept in this browser) */
.promo {
    display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
    margin-bottom: var(--s5); padding: var(--s4) var(--s5);
    background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--radius);
}
.promo > svg { flex: none; color: var(--accent); }
.promo p { flex: 1 1 320px; margin: 0; color: var(--ink-2); }
.history-tools { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.history-search { flex: 0 1 420px; }
.history-actions { display: flex; justify-content: flex-end; gap: var(--s2); }
.warning-note {
    display: flex; gap: var(--s3); align-items: flex-start;
    margin-top: var(--s5); padding: var(--s4) var(--s5);
    background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); color: #92400e;
}
.warning-note svg { flex: none; margin-top: 2px; }
.warning-note a { color: inherit; font-weight: 600; }
@media (max-width: 640px) {
    .history-table th:nth-child(3), .history-table td:nth-child(3) { display: none; }
}

/* Header account menu (signed in) */
.account-menu { position: relative; }
.account-toggle {
    display: flex; align-items: center; gap: var(--s2);
    padding: 4px 6px; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink-2);
    background: none; border: 0; border-radius: var(--radius); cursor: pointer;
}
.account-toggle:hover { background: var(--bg); color: var(--ink); }
.account-avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 32px; height: 32px; border-radius: 50%;
    font-size: 13px; font-weight: 700; color: var(--accent-hover); background: var(--accent-soft);
}
.account-avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.account-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
    width: 300px; max-width: calc(100vw - 32px); padding: 6px 0;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgb(0 0 0 / .12);
}
.account-who { display: flex; align-items: center; gap: var(--s3); padding: 12px 18px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-who > div { min-width: 0; }
.account-who strong, .account-who span:not(.account-avatar) { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-who span:not(.account-avatar) { font-size: 13px; color: var(--muted); }
.account-panel form { margin: 0; padding-top: 6px; margin-top: 6px; border-top: 1px solid var(--line); }
.site-nav .account-panel [role="menuitem"] {
    display: block; width: 100%; padding: 10px 18px;
    font: inherit; font-size: 15px; font-weight: 400; color: var(--ink-2); text-align: left; text-decoration: none;
    background: none; border: 0; cursor: pointer;
}
.site-nav .account-panel [role="menuitem"]:hover, .site-nav .account-panel [role="menuitem"]:focus-visible { background: var(--bg); color: var(--ink); outline: none; }
.site-nav .account-panel .account-signout, .site-nav .account-panel .account-signout:hover { color: #b91c1c; }
.site-nav .account-panel .account-mobile-only { display: none; }
@media (max-width: 640px) {
    .account-name { display: none; }
    .site-nav .account-panel .account-mobile-only { display: block; }
}

/* My Account / Delete Account */
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.account-page .auth-notice { margin-bottom: var(--s5); }
.account-email { display: flex; gap: var(--s5); margin: 0 0 var(--s5); padding: var(--s4) var(--s5); border: 1px solid var(--line); border-radius: var(--radius); }
.account-email dt { color: var(--muted); }
.account-email dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.account-email .inline-form { display: inline; }
.account-email .link-btn { font-size: 14px; }
.badge-unverified { background: #fef3c7; color: #92400e; }
.account-section { padding-top: var(--s5); }
.account-section + .account-section { margin-top: var(--s5); border-top: 1px solid var(--line); }
.account-section h2 { margin: 0 0 var(--s4); font-size: 18px; }
.account-narrow { display: grid; gap: var(--s4); max-width: 520px; }
.account-narrow .field-hint { margin-top: calc(var(--s2) * -1); }
.delete-panel { max-width: 720px; margin-inline: auto; text-align: center; }
.delete-panel h1 { margin: 0 0 var(--s2); font-size: 28px; }
.delete-fields { display: grid; gap: var(--s4); margin-top: var(--s5); text-align: left; }
.check { display: flex; gap: var(--s3); align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.delete-actions { justify-content: flex-end; }

/* Password show/hide (assets/js/password-toggle.js) */
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 44px; }
.password-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    display: grid; place-items: center; width: 34px; height: 34px;
    border: 0; border-radius: 6px; background: transparent; color: #6b7280; cursor: pointer;
}
.password-toggle:hover { color: var(--accent); background: rgba(15, 118, 110, .08); }
.password-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.password-wrap .input::-ms-reveal { display: none; }

/* Account statement layout (doc type 'statement'): Date / Reference / Description / Charges / Payments / Balance */
.paper:not([data-layout="statement"]) .st-only,
.paper[data-layout="statement"] .st-hide,
.paper:not([data-layout="timesheet"]) .ts-only,
.paper[data-layout="timesheet"] .ts-hide,
.paper[data-layout="standard"] .dated-only,
.paper[data-layout="packing"] .dated-only,
.paper[data-layout="packing"] .pk-hide { display: none !important; }
@media (min-width: 641px) {
    .paper[data-layout="statement"] .items-head,
    .paper[data-layout="statement"] .item-row {
        grid-template-columns: 128px 90px minmax(0, 1fr) 104px 104px 92px 56px;
    }
    /* Packing slip: Item / Quantity */
    .paper[data-layout="packing"] .items-head,
    .paper[data-layout="packing"] .item-row { grid-template-columns: minmax(0, 1fr) 120px 56px; }
    /* Timesheet: Date / Description / Hours / Rate / Amount */
    .paper[data-layout="timesheet"] .items-head,
    .paper[data-layout="timesheet"] .item-row {
        grid-template-columns: 136px minmax(0, 1fr) 90px 130px 110px 56px;
    }
}
.paper[data-layout="statement"] .total-row-balance {
    border-top: 2px solid var(--line-strong);
    margin-top: var(--s2); padding-top: var(--s4);
}
.paper[data-layout="statement"] .total-row-balance .field-label,
.paper[data-layout="statement"] .total-row-balance output { font-size: 18px; }
.doc-table-statement th:nth-child(3) { width: 40%; }
.doc-table-statement td:first-child { white-space: nowrap; }
.doc-table-timesheet td:first-child { white-space: nowrap; }
.doc-table-timesheet th:nth-child(2) { width: 50%; }

/* Cookie consent banner (assets/js/analytics.js) */
.consent {
    position: fixed; z-index: 50; left: 16px; right: 16px; bottom: 16px;
    max-width: 640px; margin-inline: auto;
    display: flex; align-items: center; gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 8px 28px rgb(0 0 0 / .14);
    font-size: 14px; color: var(--ink-2);
}
.consent[hidden] { display: none; }
.consent p { margin: 0; flex: 1; }
.consent-actions { display: flex; gap: var(--s2); flex-shrink: 0; }
@media (max-width: 640px) {
    .consent { flex-direction: column; align-items: stretch; }
    .consent-actions > * { flex: 1; }
}
@media print { .consent { display: none !important; } }

/* Send invoice (invoice-send.php) */
.send-panel { max-width: 720px; margin-inline: auto; }
.send-panel .panel-title { margin-bottom: var(--s2); }
.send-panel .app-subtitle { margin: 0 0 var(--s5); }
.send-fields { display: grid; gap: var(--s4); }
.send-fields .form-field textarea.input { min-height: 200px; }
.send-summary { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0 0 var(--s5); padding: var(--s4) var(--s5); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg, #f9fafb); }
.send-summary div { display: grid; gap: 2px; }
.send-summary dt { font-size: 13px; color: var(--muted); }
.send-summary dd { margin: 0; font-weight: 600; }
.send-panel .auth-check { margin-top: var(--s1); }
.send-verify { display: grid; gap: var(--s3); justify-items: start; }
.inv-sent-note { margin: var(--s2) 0 0; font-size: 13px; color: var(--muted); }
.send-quota { margin: 0 0 0 auto; align-self: center; font-size: 13px; color: var(--muted); }
.send-panel .share-row { margin-bottom: var(--s2); }

/* Save & Send dialog (signed-out editor) */
.modal { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: var(--s6); border: 0; border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal::backdrop { background: rgba(17, 24, 39, .5); }
.modal h2 { margin: 0 0 var(--s2); padding-right: var(--s6); font-size: 22px; letter-spacing: -.01em; }
.modal-sub { margin: 0 0 var(--s4); color: var(--ink-2); line-height: 1.5; }
.modal-list { margin: 0 0 var(--s5); padding: 0; list-style: none; display: grid; gap: var(--s2); font-size: 14px; color: var(--ink-2); }
.modal-list li { position: relative; padding-left: 26px; }
.modal-list li::before { content: ""; position: absolute; left: 4px; top: 3px; width: 6px; height: 11px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.modal-fine { margin: var(--s4) 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.modal-close { position: absolute; top: var(--s3); right: var(--s3); width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.auth-fine { margin-top: var(--s4); font-size: 13px; }
@media (max-width: 480px) { .modal { padding: var(--s5); } }

/* Date picker (assets/js/datepicker.js): the native date input stays hidden in the form, .dp-input shows the date */
.dp-native { display: none !important; }
.dp-input { cursor: pointer; }
.dp-pop {
    position: absolute; z-index: 9; width: min(320px, calc(100vw - 16px)); box-sizing: border-box;
    padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3);
    background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 12px 32px rgb(17 24 39 / .16); color: var(--ink); font-size: 15px;
}
.dp-pop button { font: inherit; cursor: pointer; }
.dp-pop button:focus-visible { outline: none; box-shadow: var(--ring); }
.dp-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.dp-chip {
    padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px;
    background: var(--paper); color: #374151; font-size: 13px !important; font-weight: 600;
}
.dp-chip:hover { border-color: var(--accent); color: var(--accent); }
.dp-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.dp-head { display: flex; align-items: center; justify-content: space-between; }
.dp-jump { display: flex; gap: 6px; }
.dp-jump select {
    height: 36px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none; -webkit-appearance: none; font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer;
}
.dp-jump select:hover { border-color: var(--accent); }
.dp-jump select:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.dp-nav {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: var(--radius); background: var(--accent-tint); color: var(--accent);
}
.dp-nav:hover { background: var(--accent-soft); }
.dp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.dp-wd { padding: 4px 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.dp-day {
    height: 40px; border: 0; border-radius: 999px; background: none; color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.dp-day:hover { background: var(--accent-tint); color: var(--accent); }
.dp-day.is-outside { color: #9ca3af; }
.dp-day.is-today { box-shadow: inset 0 0 0 2px var(--accent-soft); font-weight: 700; }
.dp-day[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 700; }
.dp-foot { display: flex; justify-content: space-between; align-items: center; padding-top: var(--s3); border-top: 1px solid var(--line); }
.dp-link { border: 0; background: none; padding: 6px 4px; color: var(--muted); font-size: 14px !important; }
.dp-link:hover { color: var(--ink); }
.dp-today { border: 0; border-radius: var(--radius); background: var(--accent-tint); color: var(--accent); padding: 6px 14px; font-size: 14px !important; font-weight: 600; }
.dp-today:hover { background: var(--accent-soft); }
@media print { .dp-pop { display: none !important; } }

/* Admin area (/admin, includes/admin/) */
.admin-tabs { display: flex; gap: var(--s5); margin-bottom: var(--s6); border-bottom: 1px solid var(--line-strong); overflow-x: auto; scrollbar-width: none; }
.admin-tabs a { flex: none; padding: 12px 2px; color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: none; box-shadow: inset 0 -2px 0 transparent; }
.admin-tabs a:hover { color: var(--ink); box-shadow: inset 0 -2px 0 var(--line-strong); }
.admin-tabs a[aria-current] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.admin-h2 { margin: var(--s6) 0 var(--s3); font-size: 18px; }
.panel > .admin-h2:first-child, .panel > h3:first-child { margin-top: 0; }
.admin .panel h3 { margin: 0 0 var(--s2); font-size: 16px; }
.admin .panel p { margin: 0 0 var(--s3); color: var(--muted); font-size: 14px; line-height: 1.5; }
.admin-muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.admin-note { margin: var(--s3) 0 0; color: var(--muted); font-size: 13px; }
.admin-back { margin: 0 0 var(--s3); font-size: 14px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s3); }
.admin-stat {
    display: flex; flex-direction: column; gap: 4px; padding: var(--s4);
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none;
}
a.admin-stat:hover { border-color: var(--accent); }
.admin-stat span { font-size: 13px; color: var(--muted); }
.admin-stat strong { font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.admin-stat small { font-size: 12px; color: var(--muted); }
.admin-alerts { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s4); }
.admin-alert { padding: var(--s3) var(--s4); background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius); color: #991b1b; text-decoration: none; }
.admin-alert:hover { border-color: #b91c1c; }
.admin-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s3); }
.admin-chart { margin: 0; padding: var(--s4); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-chart figcaption { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s3); font-size: 14px; color: var(--muted); }
.admin-chart figcaption strong { font-size: 20px; color: var(--ink); }
.admin-bars { display: flex; align-items: stretch; height: 90px; }
.admin-bar { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; min-width: 0; border-radius: 3px; cursor: default; }
.admin-bar:hover { background: var(--accent-tint); }
.admin-bar i { position: relative; display: block; width: 70%; max-width: 40px; background: var(--accent); border-radius: 2px 2px 0 0; }
.admin-bar:hover i { background: var(--accent-hover); }
.admin-bar i::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 5; transform: translateX(-50%);
    padding: 5px 9px; background: #111827; color: #fff; border-radius: 6px; font: 600 12px/1.3 system-ui, sans-serif; font-style: normal; white-space: nowrap;
    box-shadow: 0 4px 12px rgb(0 0 0 / .18); opacity: 0; pointer-events: none; transition: opacity .1s;
}
.admin-bar-l i::after { left: 0; transform: none; }
.admin-bar-r i::after { left: auto; right: 0; transform: none; }
.admin-bar:hover i::after { opacity: 1; }
.admin-chart-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.admin-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); margin-top: var(--s5); }
.admin-columns-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.admin-mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-mini th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.admin-mini td, .admin-mini th { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.admin-mini tr:last-child td { border-bottom: 0; }
.admin-mini .num { text-align: right; padding-right: 0; font-variant-numeric: tabular-nums; }
.admin-search { display: flex; gap: var(--s2); margin-bottom: var(--s3); max-width: 640px; }
.admin-columns + .admin-search { margin-top: var(--s5); }
.admin-search .input { flex: 1; }
.admin-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s4); }
.admin-filters a { padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; font-weight: 600; color: #374151; text-decoration: none; background: var(--paper); }
.admin-filters a:hover { border-color: var(--accent); color: var(--accent); }
.admin-filters a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.admin-user { display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; min-width: 0; }
.admin-user span { font-size: 13px; color: var(--muted); }
a.admin-user:hover strong { color: var(--accent); }
.admin-badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.data-table td.admin-badges { white-space: normal; }
.admin-pager { display: flex; align-items: center; justify-content: center; gap: var(--s3); margin-top: var(--s4); font-size: 14px; color: var(--muted); }
.admin-dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px var(--s3); margin: 0; font-size: 14px; }
.admin-dl dt { color: var(--muted); }
.admin-dl dd { margin: 0; overflow-wrap: anywhere; }
.admin-flags { list-style: none; margin: 0 0 var(--s3); padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.admin-flags li { display: flex; gap: var(--s2); align-items: baseline; }
.admin-points { flex: 0 0 auto; min-width: 26px; padding: 1px 6px; border-radius: 999px; background: #fee2e2; color: #b91c1c; font-size: 12px; font-weight: 700; text-align: center; }
.admin-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s3); }
.admin-actions .panel { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); margin: 0; }
.admin-actions .input { width: 100%; }
.admin-actions .inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); width: 100%; }
.admin-actions .inline-form .input { flex: 1; width: auto; min-width: 120px; }
.admin-note-form textarea { resize: vertical; }
.admin-risk-list, .admin-messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.admin-risk-list .panel { margin: 0; }
.admin-risk-head { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.admin-messages li { padding: var(--s3) var(--s4); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-messages p, .admin-message { margin: 6px 0 var(--s3); white-space: normal; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.admin-help { margin-top: var(--s3); font-size: 14px; color: #374151; }
.admin-help summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.admin-help li { margin: 6px 0; line-height: 1.5; }
.admin-danger-title { color: #b91c1c; }
.admin-delete { border-color: #fecaca; }
.admin-delete label { display: block; margin-bottom: var(--s2); font-size: 14px; }
.admin-delete .inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); max-width: 560px; }
.admin-delete .input { flex: 1; min-width: 200px; }
@media (max-width: 600px) {
    .admin-dl { grid-template-columns: 1fr; gap: 2px; }
    .admin-dl dd { margin-bottom: var(--s2); }
    .admin-search { flex-wrap: wrap; }
}

/* Language button in the header + Change Language popup (assets/js/lang-menu.js) */
.lang-switch {
    position: relative; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 10px;
    border: 0; border-radius: var(--radius); background: none; color: var(--ink-2);
    font: inherit; font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer;
    transition: background-color .15s, color .15s;
}
.lang-switch:hover { background: var(--bg); color: var(--accent); }
.lang-switch:focus-visible { outline: none; box-shadow: var(--ring); }
@media (hover: hover) {
    .lang-switch::after {
        content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
        padding: 6px 12px; border-radius: var(--radius); background: var(--ink); color: #fff;
        font-size: 13px; font-weight: 500; letter-spacing: 0; white-space: nowrap;
        opacity: 0; visibility: hidden; pointer-events: none; z-index: 20; transition: opacity .15s;
    }
    .lang-switch:hover::after, .lang-switch:focus-visible::after { opacity: 1; visibility: visible; }
}
.auth-lang { position: absolute; top: var(--s3); right: var(--s3); }
.auth-lang .lang-switch::after { left: auto; right: 0; transform: none; }
.lang-modal h2 { padding-bottom: var(--s4); margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.lang-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); }
.lang-list form { margin: 0; }
.lang-list button { display: block; width: 100%; padding: 10px 14px; border: 0; border-radius: var(--radius); background: none; color: var(--ink); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.lang-list button:hover { background: var(--bg); }
.lang-list button:focus-visible { outline: none; box-shadow: var(--ring); }
.lang-list a { display: block; padding: 10px 14px; border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 500; }
.lang-list a:hover { background: var(--bg); color: var(--ink); }
.lang-list a:focus-visible { outline: none; box-shadow: var(--ring); }
.lang-list a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Admin: flags, search in the tabs bar, comparisons, funnel */
.admin-flag { display: inline-block; width: 20px; height: 15px; margin-right: 6px; border-radius: 2px; vertical-align: -2px; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.admin-global-search { display: flex; gap: var(--s2); max-width: 720px; margin-bottom: var(--s3); }
.admin-global-field { position: relative; flex: 1; min-width: 0; }
.admin-global-search .input { width: 100%; height: 48px; padding: 0 44px 0 46px; font-size: 16px; border-radius: var(--radius); box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.admin-global-search .input:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.admin-global-search .btn { height: 48px; padding-inline: var(--s5); }
.admin-global-icon { position: absolute; left: 15px; top: 14px; color: var(--muted); pointer-events: none; }
.admin-global-key { position: absolute; top: 13px; right: 14px; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg); color: var(--muted); font: 600 12px/18px inherit; pointer-events: none; }
.admin-global-search .input:focus ~ .admin-global-key, .admin-global-search .input:not(:placeholder-shown) ~ .admin-global-key { display: none; }
.admin-stat small.admin-up { color: #047857; font-weight: 600; }
.admin-stat small.admin-down { color: #b91c1c; font-weight: 600; }
.admin-charts-gap { margin-top: var(--s3); }
.admin-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--s4); }
.admin-chips a { padding: 4px 10px; background: var(--accent-tint); border-radius: 999px; color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.admin-funnel { display: grid; gap: var(--s2); }
.admin-funnel-row { display: grid; grid-template-columns: 150px 1fr 40px 44px; align-items: center; gap: var(--s3); font-size: 14px; }
.admin-funnel-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.admin-funnel-row small { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.admin-funnel-track { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.admin-funnel-track div { height: 100%; background: var(--accent); border-radius: 999px; }
@media (max-width: 640px) { .admin-global-key { display: none; } .admin-global-search .btn { padding-inline: var(--s4); } .admin-funnel-row { grid-template-columns: 110px 1fr 32px 40px; gap: var(--s2); } }
.admin-period { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.admin-period .admin-filters { margin-bottom: 0; }
.admin-range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.admin-range .input { width: auto; padding: 5px 8px; font-size: 14px; }

/* Admin: Documents list, one per row, small picture of the page on the left */
.admin-docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.admin-doc { display: flex; gap: var(--s5); align-items: flex-start; padding: var(--s4); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-doc-thumb {
    flex: none; position: relative; display: block; width: 170px; height: 220px; overflow: hidden;
    border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .08);
}
.admin-doc-thumb:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.admin-doc-page { position: absolute; top: 0; left: 0; width: 860px; transform: scale(calc(170 / 860)); transform-origin: 0 0; pointer-events: none; }
.admin-doc-page .doc { border: 0; border-radius: 0; min-height: 1113px; }
.admin-doc-info { flex: 1; min-width: 0; }
.admin-doc-type { margin: 0; color: var(--accent); font-weight: 600; font-size: 14px; }
.admin-doc-info h2 { margin: 2px 0 var(--s2); font-size: 22px; overflow-wrap: anywhere; }
.admin-doc-info h2 a { color: var(--ink); text-decoration: none; }
.admin-doc-info h2 a:hover { color: var(--accent); }
.admin-doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s3); margin: 0 0 var(--s3); font-size: 15px; }
.admin-doc-meta span:not(.badge) { color: var(--muted); overflow-wrap: anywhere; }
.admin-doc-dl { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 4px var(--s3); margin: 0 0 var(--s3); font-size: 14px; }
.admin-doc-dl dt { color: var(--muted); }
.admin-doc-dl dd { margin: 0; overflow-wrap: anywhere; }
.admin-doc-actions { display: flex; flex-wrap: wrap; gap: var(--s4); margin: 0; font-size: 14px; font-weight: 600; }
@media (max-width: 640px) {
    .admin-doc { gap: var(--s3); padding: var(--s3); }
    .admin-doc-thumb { width: 100px; height: 130px; }
    .admin-doc-page { transform: scale(calc(100 / 860)); }
    .admin-doc-info h2 { font-size: 18px; }
    .admin-doc-dl { grid-template-columns: 1fr; gap: 0; }
    .admin-doc-dl dt { margin-top: 4px; }
}

/* Admin Overview: title row with the period control, compact period cards */
.admin-overview-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s5); }
.admin-overview-head h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.admin-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.admin-seg { position: relative; display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: #e5e7eb; border-radius: 10px; }
.admin-seg > a, .admin-custom summary { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 7px; color: #4b5563; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.admin-seg > a:hover, .admin-custom summary:hover { color: var(--ink); }
.admin-seg > a[aria-current], .admin-custom[data-current] summary { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.admin-custom summary { list-style: none; }
.admin-custom summary::-webkit-details-marker { display: none; }
.admin-custom[open] summary svg { transform: rotate(180deg); }
.admin-custom-pop {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--s2) var(--s3);
    width: 280px; padding: var(--s4); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgb(0 0 0 / .12);
    font-size: 14px; color: var(--muted);
}
.admin-custom-pop .input { padding: 7px 10px; font-size: 14px; }
.admin-custom-pop .btn { grid-column: 1 / -1; }
.admin-stats-period { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.admin-stats-period .admin-stat { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 6px 10px; padding: var(--s3) var(--s4); }
.admin-stats-period .admin-stat span { grid-column: 1 / -1; }
.admin-stats-period .admin-stat strong { font-size: 24px; }
.admin-stats-period .admin-stat small { white-space: nowrap; }
@media (max-width: 1100px) { .admin-stats-period { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
    .admin-stats-period { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-seg { width: 100%; }
    .admin-seg > a, .admin-custom { flex: 1; }
    .admin-seg > a, .admin-custom summary { justify-content: center; padding-inline: 8px; }
}
.admin-filters a[aria-current] .admin-muted { color: rgb(255 255 255 / .8); }

/* Admin: Social tab */
.admin-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-social-icon { width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; fill: currentColor; flex: none; }
.admin-table-wrap { overflow-x: auto; }
.admin-social-table td, .admin-social-table th { white-space: nowrap; }
.admin-social-table td a { color: var(--ink); font-weight: 600; text-decoration: none; }
.admin-social-table code, .admin-mini code { font-size: 13px; color: var(--muted); }
.admin-social-h3 { margin: var(--s5) 0 var(--s2); font-size: 15px; }
.admin-social-cols { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; margin-top: 0; }
.admin-post-list { list-style: none; margin: 0; padding: 0; }
.admin-post-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s4); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.admin-post-list li:first-child { border-top: 0; padding-top: 0; }
.admin-post-main { display: grid; gap: 2px; min-width: 0; }
.admin-post-main strong { font-size: 15px; overflow-wrap: anywhere; }
.admin-post-main strong a { color: var(--ink); }
.admin-post-main .admin-muted { font-size: 13px; }
.admin-post-platform { display: flex; align-items: center; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.admin-post-platform .admin-social-icon { width: 13px; height: 13px; margin-right: 6px; }
.admin-post-stats { display: grid; grid-template-columns: auto auto; gap: 0 var(--s3); font-size: 13px; color: var(--muted); text-align: right; }
.admin-post-stats strong { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.admin-post-stats small { grid-column: 1 / -1; font-size: 11px; }
.admin-post-actions { display: flex; gap: var(--s2); }
.admin-post-actions form { margin: 0; }
.admin-post-form { display: grid; gap: 6px; }
.admin-post-form h3 { margin: 0 0 var(--s2); }
.admin-post-form label { font-size: 13px; font-weight: 600; margin-top: var(--s2); }
.admin-post-form .inline-form { margin-top: var(--s3); }
@media (max-width: 900px) {
    .admin-social-cols { grid-template-columns: 1fr; }
    .admin-post-list li { grid-template-columns: 1fr; gap: var(--s2); }
    .admin-post-stats { text-align: left; justify-content: start; }
    .admin-stats-3 { grid-template-columns: 1fr; }
}
