/*
 * THE SYSTEM (rule 0: set it first, build every page from it)
 *
 * Look
 *   Classic monochrome: near-black ink on off-white paper, a scale of greys, light and dark by
 *   prefers-color-scheme, no shadows, no web fonts. Serif headings, system sans for the rest.
 *   No accent colour: the primary action, links and the current section are ink (inverted fill,
 *   underline, weight). Colour appears in three places only: notes (warm tint), cost categories (ten hues) and
 *   the state of money (green, orange, red); never alone, always beside a word, sign or shape.
 *   Weights 400 and 600 only. Colours and sizes come from the :root block below and nowhere else.
 *   Status is a shape plus a short caps caption (OVERDUE, SENT, PAID): solid disc done, half disc
 *   neutral, diamond attention, square wrong (red, underlined), ring nothing to do.
 *
 * Grid
 *   Baseline 4 px: every line height, padding, margin, gap and height is a multiple of 4.
 *   Columns: 4 below 700 px, 12 from 700 px; gutter 8 px between columns.
 *   One page gutter, 16 px (24 px from 1000 px); text, forms and rows start on it, nothing else
 *   indents. Boxes run edge to edge and are told apart by hairlines.
 *   Type scale, size / line height: 11/16 (caps captions), 13/16 (unused here), 15/20 (body),
 *   17/24 (headings, inputs), 24/32, 30/36 (readout; 38/48 from 1000 px).
 *   Each screen uses 11, 15 and 17 plus the one readout size.
 *   Blocks span whole columns: 1 to 4 of 4 below 700 px; 3, 4, 6, 8, 12 of 12 above (cells
 *   inside a list row also use 1, 2, 5 so the row fills 12). Long text is capped at 34em.
 *
 * Boxes, tables, rows
 *   Square, edge to edge, hairline above and below; a table is such a box. The label column
 *   sits on the gutter, numbers are right-aligned on shared column lines in tabular numerals,
 *   and every row of a list ends on the same right edge. Two-line rows are 56 px, one-line 44.
 *
 * Vertical spacing, in baseline units
 *   24 above and 8 below a heading, 24 between groups, 8 inside a group; captions (11 px caps)
 *   sit 4 px above their value. The totals on the overview are the readout size, the largest
 *   thing on the page.
 *
 * Controls
 *   Every control is at least 44 x 44. One primary (inverted ink) action per screen. Focus ring is a
 *   2 px outline on :focus-visible. Hover styles only inside (hover: hover). Reduced motion is
 *   honoured. Header 44 px: name left, section links, sign-out right, hairline under; the current
 *   section is marked as a selection: 3 px accent bar, accent tint, weight 600.
 *   Five sections (Overview, Quotes, Invoices, Received, Clients) and More, which is a plain link to a page
 *   that lists the rest. Below 960 px they sit in a 56 px bar at the bottom, one row.
 *
 * Where things sit
 *   What a person came to do is in the first screen or one obvious jump away: a page's actions in the
 *   head row on the right, a long form's actions in a bar that sticks to the bottom edge (.bar), the
 *   form that records something right under the facts it changes.
 *   A form post redirects to the page with a #fragment naming the part just changed; those parts carry
 *   an id, and :target keeps them clear of the header and the message under it.
 */
:root {
    color-scheme: light dark;

    /* Monochrome palette: one neutral family, ink on paper. Colour tokens follow below. */
    --bg: #f8f8f6;
    --surface: #efefed;
    --surface-2: #ffffff;
    --hair: #cfcfcc;
    --line-strong: #6b6b69;

    --text: #111111;
    --text-dim: #4a4a48;
    --text-faint: #595957;

    --accent: #111111;
    --accent-ink: #ffffff;
    --accent-hover: #3a3a38;
    --accent-soft: rgb(17 17 17 / 0.08);
    --focus: #111111;
    --link: #111111;

    /* Colour (rule of 2026-11-29): three places with a fixed meaning, always a second signal beside a word, sign or shape.
       Notes: a hand-written note sits on the warm tint with its rule. Finances: ok = settled or received, warn = due soon
       or partly paid, bad = overdue or missing. Categories: ten fixed hues, each with an ink (dot, text) and a tint. */
    --ok: #157635;
    --warn: #a34f00;
    --bad: #8a2020;
    --ok-tint: #daebdf;
    --warn-tint: #f5e5d6;
    --bad-tint: #ecdbdb;
    --note-bg: #faecc4;
    --note-rule: #a87a1e;
    --cat-c1-ink: #1f5fa8; --cat-c1-tint: #dbe5f1;
    --cat-c2-ink: #0e716a; --cat-c2-tint: #d9e9e8;
    --cat-c3-ink: #5b6b12; --cat-c3-tint: #e5e7d9;
    --cat-c4-ink: #6b3fa0; --cat-c4-tint: #e7e0f0;
    --cat-c5-ink: #a3246b; --cat-c5-tint: #f0dce7;
    --cat-c6-ink: #7a4a1e; --cat-c6-tint: #eae2db;
    --cat-c7-ink: #4a5a78; --cat-c7-tint: #e2e5e9;
    --cat-c8-ink: #7c6200; --cat-c8-tint: #ece8d6;
    --cat-c9-ink: #0a6b9a; --cat-c9-tint: #d8e8f0;
    --cat-c10-ink: #5a5f66; --cat-c10-tint: #e5e5e7;
    --info: #4a4a48;

    --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fs-caption: 11px;
    --fs-body: 15px;
    --fs-headline: 17px;
    --fs-readout: 30px;
    --fs-title: 24px;
    --lh-title: 32px;
    --fs-sub: 13px;
    --lh-sub: 20px;
    --sect-above: 32px;
    --sect-first: 8px;
    --sect-gap: 12px;
    --sect-below: 8px;
    --sub-above: 24px;
    --sub-below: 8px;
    --mark-w: 24px;
    --mark-h: 3px;
    --lh-caption: 16px;
    --lh-body: 20px;
    --lh-headline: 24px;
    --lh-readout: 36px;
    --w-regular: 400;
    --w-bold: 600;
    --track-caps: 0.06em;

    --gutter: 8px;
    --group-gap: 24px;
    --margin: 16px;
    --measure: 34em;

    --radius: 2px;
    --touch: 44px;
    /* Form controls (rule of 2026-11-29): one height for input, select and ordinary button.
       40 px on touch, 36 px with a mouse; text 15/20 at 400; padding 8/12. */
    --ctl-h: 40px;
    --ctl-pad-y: 8px;
    --ctl-pad-x: 12px;
    --ctl-fs: var(--fs-body);
    --ctl-lh: var(--lh-body);
    --row-h: 44px;
    --header-h: 44px;
    --tabbar-h: 56px;

    --dur: 120ms;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --surface: #1c1c1b;
        --surface-2: #0b0b0b;
        --hair: #383836;
        --line-strong: #8f8f8c;

        --text: #ededeb;
        --text-dim: #b4b4b1;
        --text-faint: #a0a09d;

        --accent: #ededeb;
        --accent-ink: #111111;
        --accent-hover: #ffffff;
        --accent-soft: rgb(237 237 235 / 0.1);
        --focus: #ededeb;
        --link: #ededeb;

        --ok: #6fb085;
        --warn: #d99b61;
        --bad: #e59a9a;
        --ok-tint: #2a3b30;
        --warn-tint: #463627;
        --bad-tint: #342828;
        --note-bg: #33291a;
        --note-rule: #c9a04a;
        --cat-c1-ink: #7ca2cc; --cat-c1-tint: #2b3642;
        --cat-c2-ink: #6daca7; --cat-c2-tint: #293a38;
        --cat-c3-ink: #9da772; --cat-c3-tint: #353829;
        --cat-c4-ink: #ac94ca; --cat-c4-tint: #383140;
        --cat-c5-ink: #cd87ae; --cat-c5-tint: #412c38;
        --cat-c6-ink: #b4987f; --cat-c6-tint: #3a322b;
        --cat-c7-ink: #969fb0; --cat-c7-tint: #32353a;
        --cat-c8-ink: #b6a461; --cat-c8-tint: #3d3827;
        --cat-c9-ink: #6aa8c5; --cat-c9-tint: #283840;
        --cat-c10-ink: #9da0a4; --cat-c10-tint: #353637;
        --info: #b4b4b1;
    }
}

/* The larger readout needs a three-column block wide enough for an amount like 13.513,55. */
@media (min-width: 1000px) {
    :root { --margin: 24px; --fs-readout: 38px; --lh-readout: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    .btn:active { transform: none !important; }
}

* { box-sizing: border-box; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: var(--w-regular) var(--fs-body)/var(--lh-body) var(--font);
    font-variant-numeric: tabular-nums lining-nums;
    min-height: 100vh;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}

@media (min-width: 700px) {
    body { padding-bottom: 48px; }
}

a { color: var(--link); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
a.row, .nav a, .brand, .btn { text-decoration: none; }
h1, h2, h3, p, ul { padding: 0; }
p, ul { margin: 0; }
ul { list-style: none; }
strong { font-weight: var(--w-bold); }

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

/* ---- header and navigation ------------------------------------------------ */
.hdr {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: var(--gutter);
    height: calc(var(--header-h) + var(--safe-top));
    padding: var(--safe-top) calc(var(--margin) + var(--safe-right)) 0 calc(var(--margin) + var(--safe-left));
    background: var(--bg);
    border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; min-height: var(--touch); font-weight: var(--w-bold); margin-right: 16px; }
.brand img { display: block; height: 22px; width: auto; image-rendering: pixelated; outline: 1px solid var(--hair); }
.nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    /* Each word takes the room it needs, never less than a touch target, and the words share
       the spare width between them: seven sections fit on a 393 px phone at the 13 px footnote size. */
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(var(--touch), auto);
    justify-content: space-between;
    font-size: 13px; line-height: 16px;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
    background: var(--surface); border-top: 1px solid var(--hair);
}
.nav a {
    position: relative; display: flex; align-items: center; justify-content: center;
    min-width: var(--touch); padding: 0 8px; color: var(--text-dim);
}
.nav a[aria-current="page"] { color: var(--text); font-weight: var(--w-bold); background: var(--accent-soft); }
.nav a[aria-current="page"]::after {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent);
}
.signout { margin: 0 0 0 auto; }

/* Five sections and More fit beside the logo and "Sign out" from 960 px; below that the bar stays at the bottom. */
@media (min-width: 960px) {
    .nav {
        position: static; display: flex; align-self: stretch; margin-right: auto;
        height: auto; padding: 0; background: transparent; border-top: 0;
        font-size: var(--fs-body); line-height: var(--lh-body);
    }
    .nav a { padding: 0 16px; }
    .nav a[aria-current="page"]::after { top: auto; bottom: 0; }
    .nav + .signout { margin-left: 0; }
}

@media (hover: hover) {
    .nav a:hover { color: var(--text); }
    .nav a[aria-current="page"]:hover { color: var(--text); }
}

/* ---- two-level menu: groups in the bar, the pages of the current group in a quieter row under it ---- */
.nav a[aria-current="true"] { color: var(--text); font-weight: var(--w-bold); background: var(--accent-soft); }
.nav a[aria-current="true"]::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); }
@media (min-width: 960px) {
    .nav a[aria-current="true"]::after { top: auto; bottom: 0; }
    .nav a { padding: 0 12px; }
}
@media (min-width: 1200px) { .nav a { padding: 0 16px; } }
@media (hover: hover) { .nav a[aria-current="true"]:hover { color: var(--text); } }
@media (min-width: 700px) { .nav .g-more { display: none; } }
@media (max-width: 699.98px) {
    .nav .g-rest { display: none; }
    .nav .g-more.here { color: var(--text); font-weight: var(--w-bold); background: var(--accent-soft); }
    .nav .g-more.here::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); }
}
.pagenav {
    display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    padding: 0 calc(var(--margin) + var(--safe-right)) 0 calc(var(--margin) + var(--safe-left));
    border-bottom: 1px solid var(--hair); background: var(--bg);
    font-size: 13px; line-height: 18px; white-space: nowrap;
}
.pagenav::-webkit-scrollbar { display: none; }
.pagenav a {
    position: relative; flex: none; display: flex; align-items: center; gap: 6px;
    min-height: 36px; padding: 0 12px; color: var(--text-dim); text-decoration: none;
}
.pagenav a:first-child { padding-left: 0; }
@media (pointer: coarse) { .pagenav a { min-height: var(--touch); } }
.pagenav a[aria-current="page"] { color: var(--text); }
.pagenav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); }
.pagenav a:first-child[aria-current="page"]::after { left: 0; }
@media (hover: hover) { .pagenav a:hover { color: var(--text); } }
.more-cap { margin-top: 24px; }
.pagehead + .more-cap { margin-top: 8px; }
.more-cap .cnt { margin-left: 8px; }

/* ---- headings and captions ------------------------------------------------ */
/* Title over a label: a title never sits directly on a small caps label. With the 8 px here,
   a table head (8 px of its own) and a form (8 px, below) start 16 px under a page title,
   readouts and facts 24 px. */
.pagehead { padding: 24px var(--margin) 8px; }
/* The four text levels (rule of 2026-11-29). Each differs from the next by at least two of size, weight, case,
   colour and a rule line. 1 page title h1; 2 section title h2 (also details.part > summary); 3 sub title h3
   (also details.grp > summary, .subt); 4 text 15/20; field and column labels stay the 11 px caps caption (.cap).
   Section: a strong rule across the type area with a 24 x 3 accent mark at its left end, 32 above the rule,
   12 to the title, 8 below. The rule and mark are drawn by ::before and ::after of the heading (of details.part
   for a fold), so the heading itself stays one block. Sub title: 13/20 caps, tracked, 600, no line, 24 above, 8 below. */
h1, h2, h3 { margin: 0; }
h1, h2 { font-family: var(--font-serif); }
h1 { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--w-bold); }
@media (max-width: 699px) { h1 { font-size: 22px; line-height: 28px; } }
h2 {
    position: relative; margin: var(--sect-above) 0 var(--sect-below); padding: var(--sect-gap) var(--margin) 0;
    font-size: var(--fs-headline); line-height: var(--lh-headline); font-weight: var(--w-bold); color: var(--text);
}
h2::before, details.part::before, .sp-fold::before {
    content: ""; position: absolute; top: 0; left: var(--margin); right: var(--margin);
    border-top: 1px solid var(--line-strong);
}
h2::after, details.part::after, .sp-fold::after {
    content: ""; position: absolute; top: 0; left: var(--margin); width: var(--mark-w); height: var(--mark-h);
    background: var(--accent);
}
h2 .cnt, h2 .tcnt, h2 .dim, h2 .st { font-family: var(--font); }
h3, .subt {
    margin: var(--sub-above) 0 var(--sub-below); padding: 0 var(--margin);
    font-family: var(--font); font-size: var(--fs-sub); line-height: var(--lh-sub); font-weight: var(--w-bold);
    letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text);
}
/* a section title straight under the page head, or a title with a button on its line */
.sec:first-child > h2:first-child { margin-top: 16px; }
.pagehead + h2, .pagehead + .sec > h2:first-child, .flash + .sec > h2:first-child { margin-top: var(--sect-first); }
.sec { margin-top: 0; }
/* inside a card, a side panel or a list row the box already gives the space above */
.card h2, .tl-panel h2, .tl-legend h2, .sp-side h2, .tl-panel h3 { margin-top: 0; }
.sub { color: var(--text-dim); max-width: var(--measure); text-wrap: pretty; }
.cap {
    display: block; margin-bottom: 4px;
    font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--w-bold);
    letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-dim);
}
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.struck { text-decoration: line-through; }
.measure { max-width: var(--measure); text-wrap: pretty; }
.none { padding: 0 var(--margin); color: var(--text-dim); }
.unit { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--w-regular); color: var(--text-dim); }

/* ---- the grid: 4 columns, 12 from 700 px --------------------------------- */
.grid, .row {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gutter);
}
.grid { padding: 0 var(--margin); row-gap: 16px; }
.m1 { grid-column: span 1; } .m2 { grid-column: span 2; } .m3 { grid-column: span 3; } .m4 { grid-column: span 4; }
.o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; } .o5 { order: 5; }
.r { text-align: right; justify-self: end; }
.c { min-width: 0; }
.dh { display: none; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw { white-space: nowrap; }  /* a date or an amount never breaks across lines */

@media (min-width: 700px) {
    .grid, .row { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .d1 { grid-column: span 1; } .d2 { grid-column: span 2; } .d3 { grid-column: span 3; }
    .d4 { grid-column: span 4; } .d5 { grid-column: span 5; } .d6 { grid-column: span 6; }
    .d8 { grid-column: span 8; } .d9 { grid-column: span 9; } .d12 { grid-column: span 12; }
    .o1, .o2, .o3, .o4, .o5 { order: 0; }
    .dh { display: block; }
    .dr { text-align: right; justify-self: end; }
}

/* ---- lists: boxes edge to edge, hairlines between ------------------------ */
.list { border-top: 1px solid var(--hair); }
.row {
    align-items: center; align-content: center; row-gap: 4px;
    min-height: var(--row-h); padding: 8px var(--margin);
    border-bottom: 1px solid var(--hair);
    color: inherit;
}
.row.head {
    display: none; min-height: 32px; padding-top: 8px; padding-bottom: 8px; border-bottom: 0;
    font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--w-bold);
    letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-dim);
}
@media (min-width: 700px) {
    .row.head { display: grid; }
}
.row.strong { font-weight: var(--w-bold); }
a.row:active { background: var(--surface); }
@media (hover: hover) {
    a.row:hover { background: var(--surface); }
}

/* ---- the readout: four totals, the largest thing on the overview --------- */
.totals { padding-top: 16px; row-gap: 24px; }
.total { border-top: 1px solid var(--hair); padding-top: 8px; min-width: 0; }
.readout {
    font-size: var(--fs-readout); line-height: var(--lh-readout); font-weight: var(--w-bold);
    letter-spacing: -0.01em; white-space: nowrap;
}

/* ---- facts: caption above value ------------------------------------------ */
.facts { padding-top: 16px; row-gap: 16px; }
.fact { min-width: 0; }
.fact > div:last-child { max-width: var(--measure); }

/* ---- status: dot plus caps caption --------------------------------------- */
.st {
    --dot: var(--text-dim);
    display: inline-flex; align-items: center; gap: 8px; min-height: 24px; vertical-align: middle;
    font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--w-bold);
    letter-spacing: var(--track-caps); white-space: nowrap;
}
.st::before { content: ""; flex: none; width: 10px; height: 10px; background: var(--dot); border-radius: 50%; }
/* Status is told apart by shape and weight, not colour: done = solid disc, neutral = half disc,
   attention = solid diamond, wrong = solid square (muted red, with the caption in the same tone), nothing to do = ring. */
.st.cancelled { color: var(--text-dim); text-decoration: line-through; }
.st.off::before { background: transparent; border: 2px solid var(--text-faint); }
.st.ok { --dot: var(--ok); color: var(--ok); background: var(--ok-tint); padding: 0 8px; border-radius: var(--radius); }
.st.info { --dot: var(--info); }
.st.info::before { background: linear-gradient(90deg, var(--info) 50%, transparent 50%); border: 2px solid var(--info); }
.st.warn { --dot: var(--warn); color: var(--warn); background: var(--warn-tint); padding: 0 8px; border-radius: var(--radius); }
.st.warn::before { border-radius: 0; transform: rotate(45deg) scale(0.8); }
.st.bad { --dot: var(--bad); color: var(--bad); background: var(--bad-tint); padding: 0 8px; border-radius: var(--radius); text-decoration: underline; text-underline-offset: 3px; }
.st.bad::before { border-radius: 0; }

/* ---- messages: the one-line result of a change, and the notes a page carries -------------------------- */
/* The result of a change is the first thing in main. It sticks under the header, so a redirect that lands
   on a part of the page (#lines, #decide) still shows it. A message of success lets go after eight seconds
   and then scrolls away; a refusal stays. Notes inside a page (a check before sending) do not stick. */
.flash {
    display: flex; align-items: center; gap: 8px; min-height: var(--row-h);
    padding: 8px var(--margin); background: var(--surface); border-bottom: 1px solid var(--hair);
}
main > .flash:first-child {
    --flash-top: calc(var(--header-h) + var(--safe-top));
    position: sticky; top: var(--flash-top); z-index: 25;
}
main > .flash.ok:first-child { animation: flash-release 0.4s linear 8s forwards; }
@keyframes flash-release { from { top: var(--flash-top); } to { top: -120px; } }
.flash .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.flash.warn .dot { background: var(--warn); border-radius: 0; transform: rotate(45deg) scale(0.8); }

/* Anything a link or a redirect can land on clears the header and the message under it. */
:target { scroll-margin-top: calc(var(--header-h) + var(--safe-top) + 56px); }

/* ---- forms and controls --------------------------------------------------- */
.form { padding-top: 0; row-gap: 16px; }
/* The first label: 16 px under a page title, 12 px under a section title (its own 8 px plus 4),
   16 px under a status line. A button under a stacked form: 24 px below the last field. */
.pagehead + .form { padding-top: 8px; }
h2 + .form, h3 + .form { padding-top: 4px; }
.flash + .form, .sec + .form, .list + .form { padding-top: 16px; }
.form.stack > .f:last-child { margin-top: 8px; }
/* A second way to sign in under the first form's button: 16 px below it. */
.form + .form.more { padding-top: 8px; }
.f { display: block; min-width: 0; }
.f > .hint { display: block; margin-top: 4px; font-size: 13px; line-height: 18px; color: var(--text-dim); }
.f.end { align-self: end; }
/* A short form read top to bottom: one field per row, on the first four columns. */
@media (min-width: 700px) {
    .form.stack > .f { grid-column: 1 / span 4; }
}
@media (pointer: fine) { :root { --ctl-h: 36px; } }
input, select, textarea, .btn {
    font: var(--w-regular) var(--ctl-fs)/var(--ctl-lh) var(--font);
    color: var(--text); min-height: var(--ctl-h);
    border-radius: var(--radius);
}
input, select, textarea {
    display: block; width: 100%; padding: 0 var(--ctl-pad-x);
    background: var(--surface-2); border: 1px solid var(--line-strong);
    font-variant-numeric: tabular-nums;
}
/* a text area starts at three lines and grows with its content where the browser can (field-sizing) */
textarea { padding: var(--ctl-pad-y) var(--ctl-pad-x); resize: vertical; min-height: calc(3 * var(--ctl-lh) + 2 * var(--ctl-pad-y) + 2px); field-sizing: content; }
/* Field widths on a desktop screen: a field is as wide as its content needs (never above its grid cell). */
@media (min-width: 700px) {
    :where(input[type="text"], input:not([type]), input[type="search"], input[type="password"]) { max-width: 34em; }
    input[type="date"], input[type="month"] { max-width: 11em; }
    input.num, input[inputmode="decimal"] { max-width: 10em; }
    input[name*="iban" i], input[name*="trr" i] { max-width: 22em; }
    input[name*="mail" i] { max-width: 26em; }
    input[name="kljuc"], input[name="koda"], input[name="stevilo"], input[name="n"], input[name="number"],
    input[name="partner_no"], input[name="customer_no"], input[name="vat_id"], input[name="validity"], input[name="cost_period"], input[name="ref"], input[name="reference"], input[name="vat"] { max-width: 12em; }
    select { max-width: 24em; }
    textarea { max-width: 44em; }
    input[type="file"] { max-width: 34em; }
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input.num { text-align: right; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; position: relative;
    background: var(--surface-2); border: 1px solid var(--line-strong); cursor: pointer;
    white-space: nowrap;
    transition: transform var(--dur);
}
.btn:active { transform: scale(0.96); }
/* the hit area is 44 px high on touch screens although the button is drawn 40 */
@media (pointer: coarse) { .btn::before { content: ""; position: absolute; left: 0; right: 0; top: calc((var(--ctl-h) - var(--touch)) / 2); bottom: calc((var(--ctl-h) - var(--touch)) / 2); } }
.btn.wide { width: 100%; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:active { background: var(--accent-hover); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-dim); }
@media (hover: hover) {
    .btn:hover { background: var(--surface); }
    .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
    .btn.quiet:hover { background: transparent; color: var(--text); }
}

/* pages with a title and an action beside it: the action sits on the right gutter */
.pagehead.split { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.pagehead.split > :first-child:not(.acts) { flex: 1 1 14em; min-width: 0; }
.pagehead.split > .acts, .pagehead.split > form { margin-left: auto; }
/* Phone: the page's actions get their own row under the title and share its width; from 700 px they sit on the right. */
.pagehead.split > .acts, .pagehead.split > form { flex: 1 1 100%; margin-left: 0; }
.acts > * { flex: 1 1 auto; }
.acts > form > .btn { width: 100%; }
@media (min-width: 700px) {
    .pagehead.split > .acts, .pagehead.split > form { flex: none; margin-left: auto; }
    .acts > * { flex: none; }
    .acts > form > .btn { width: auto; }
}
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; flex: none; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.icon { padding: 0; min-width: var(--ctl-h); font-size: var(--fs-headline); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; border: 0; }
.form .gap { margin-top: 8px; }

/* the editor: sections inside the form run edge to edge across the grid */
.form .bleed { grid-column: 1 / -1; margin: 8px calc(var(--margin) * -1) 0; }
.form .bleed.sec { margin-top: 16px; }
.form .bleed > .none { padding: 0 var(--margin); }
.drafts { padding-top: 8px; }
.row.line { align-items: end; align-content: start; row-gap: 8px; }
.row.line .amt { align-self: center; justify-self: start; text-align: left; }
.row.line .ops { display: flex; gap: 8px; align-self: center; }
.row.line label { display: block; flex: 1; min-width: 0; }
.dn { display: flex; align-items: flex-end; gap: 8px; }
.dn .lno { flex: none; width: 24px; line-height: var(--ctl-h); }
.dnh { padding-left: 32px; }
.cap.mo { display: block; }
@media (min-width: 700px) {
    .cap.mo { display: none; }
    .row.line { align-items: center; }
    .row.line .amt { justify-self: end; text-align: right; }
    .dn { align-items: center; }
    .dn .lno { line-height: inherit; }
}

/* The undo control of a result line: the line stays a quiet sentence, "Razveljavi" is a text button at its end. */
.undo { display: inline-flex; align-items: center; margin: 0; vertical-align: baseline; }
.undo .btn { position: relative; min-height: 0; height: auto; padding: 0 2px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: var(--w-bold); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.undo .btn::before { content: ""; position: absolute; inset: -12px -8px; }
.undo .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.undo .btn:disabled { opacity: 0.6; cursor: default; text-decoration: none; }
@media (hover: hover) { .undo .btn:hover { background: none; color: var(--text); } }
.flash + .undo { margin: -4px var(--margin) 8px; }

/* The question that appears in place before a press that cannot be taken back: safe answer first, destructive second. */
.ask { margin: 8px 0 0; padding: 12px; border: 1px solid var(--line-strong); border-left: 3px solid var(--bad); border-radius: var(--radius, 4px); background: var(--surface-2); flex-basis: 100%; max-width: var(--measure); }
.ask p { margin: 0 0 8px; font-size: var(--ctl-fs); line-height: var(--ctl-lh); color: var(--text); }
.ask .rowform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ask .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ask .btn:last-child { border-color: var(--bad); color: var(--bad); }

/* ---- small phones in landscape: header stays 44 ----------------------------- */
@media (orientation: landscape) and (max-height: 540px) {
    .pagehead { padding-top: 16px; }
}

/* ---- the assistant's summaries: prose from files, one column --------------- */
.pad { padding: 0 var(--margin); }
.prose { padding: 0 var(--margin); max-width: calc(var(--measure) + 2 * var(--margin)); text-wrap: pretty; }
.prose h3, .prose h4 { padding: 0; }
.prose h2 { padding-left: 0; padding-right: 0; }
.prose h2::before { left: 0; right: 0; } .prose h2::after { left: 0; }
.prose > :first-child { margin-top: 16px; }
.prose p, .prose ul, .prose pre { margin: 0 0 20px; }
.prose ul { padding-left: 20px; list-style: disc; }
.prose li { margin: 0; }
.prose pre {
    padding: 12px; background: var(--surface); border: 1px solid var(--hair);
    font: var(--fs-body)/var(--lh-body) ui-monospace, "SF Mono", Menlo, monospace;
    white-space: pre-wrap; overflow-wrap: anywhere;
}
form.notes { padding-top: 24px; }
form.notes .f { grid-column: 1 / -1; max-width: var(--measure); }
form.notes textarea { min-height: 132px; }
.sec .prose + .notes, .sec .list + .notes { padding-top: 24px; }

/* ---- the viewer tab: a two-way switch under the title, and the phone's summary line ---- */
.seg { display: flex; gap: 0; padding: 0 var(--margin); margin: 8px 0 16px; border-bottom: 1px solid var(--hair); }
.seg a {
    position: relative; display: flex; align-items: center; min-height: var(--touch);
    padding: 0 16px 0 0; margin-right: 8px; color: var(--text-dim); text-decoration: none;
}
.seg a[aria-current="true"] { color: var(--text); font-weight: var(--w-bold); }
.seg a[aria-current="true"]::after {
    content: ""; position: absolute; left: 0; right: 16px; bottom: -1px; height: 3px; background: var(--accent);
}
.mobo { display: block; }
@media (min-width: 700px) {
    .mobo { display: none; }
    .vq { padding-left: 8px; }
}

/* ---- map, calendar, More, and the client's position (unit D) ---------------- */
/* The bar and the header hold the same six entries: Overview, Quotes, Invoices, Received, Clients, More. */
.row.more { min-height: var(--touch); }
.tl { display: inline-flex; align-items: center; min-height: var(--touch); padding-right: 16px; }
.plinks { display: flex; flex-wrap: wrap; align-items: center; column-gap: 0; }
.plinks.end { justify-content: flex-start; }
@media (min-width: 700px) {
    .plinks.end { justify-content: flex-end; }
    .plinks.end .tl { padding-right: 0; }
}
.err { display: block; margin-top: 4px; color: var(--bad); }
.calframe {
    display: block; width: 100%; height: 70dvh; min-height: 420px; border: 0;
    border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: var(--surface-2);
}
@media (min-width: 700px) { .calframe { height: calc(100dvh - 260px); min-height: 520px; } }
.kind { display: inline-block; width: 12px; height: 12px; margin-right: 8px; background: var(--text); border-radius: 50% 50% 50% 0; transform: rotate(-45deg) scale(0.8); flex: none; }
.kind.client { border-radius: 0; background: var(--accent); border: 2px solid var(--text); transform: none; }
.pin-client { background: var(--accent); border: 2px solid var(--text); box-sizing: border-box; }
.pin-name { display: block; padding-right: 32px; }
.pin-sub { color: var(--text-dim); }
.pin-docs { margin-top: 4px; }
.pin-box .plinks { margin-top: 4px; }

/* ---- the overview: foldable parts and groups (plain details/summary) -------------------------------
   Three parts, Where we are, What to do and What was done, then the Assistant. Each part starts with its
   title on the gutter and the key figure on the right; inside, groups fold the same way. Closed shows a
   chevron down, open a chevron up, and an open group's header row takes the surface tone. */
details.part { position: relative; margin-top: var(--sect-above); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details.part > summary, details.grp > summary {
    display: flex; align-items: center; gap: 16px; padding: 0 var(--margin);
}
/* a fold is a section title (summary of details.part) or a sub title (summary of details.grp) */
details.part > summary {
    min-height: var(--touch); padding-top: var(--sect-gap); padding-bottom: 8px;
    font-family: var(--font-serif); font-size: var(--fs-headline); line-height: var(--lh-headline); font-weight: var(--w-bold);
}
details.part > summary .fig { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--w-regular); color: var(--text-dim); }
details.grp { border-top: 1px solid var(--hair); }
details.grp:last-of-type { border-bottom: 1px solid var(--hair); }
details.grp > summary {
    min-height: var(--touch); font-size: var(--fs-sub); line-height: var(--lh-sub); font-weight: var(--w-bold);
    letter-spacing: var(--track-caps); text-transform: uppercase;
}
details.grp[open] > summary { background: var(--surface); }
details.grp > summary .fig { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--w-regular); letter-spacing: 0; text-transform: none; color: var(--text-dim); }
details.grp.empty > summary .t { color: var(--text-dim); font-weight: var(--w-regular); }
details > summary .t { flex: 1; min-width: 0; }
details > summary .fig { flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
details > summary::after {
    content: ""; flex: none; width: 8px; height: 8px; margin: -4px 4px 0 0;
    border-right: 2px solid var(--text); border-bottom: 2px solid var(--text); transform: rotate(45deg);
}
details[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
@media (hover: hover) { details > summary:hover { background: var(--surface); } }
/* a part keeps the section title it already carries (the Assistant block) out of sight but readable by screen readers */
details.part > section > h2:first-child {
    margin: 0; border: 0;
    position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0);
}
details.part > section:first-of-type { margin-top: 0; }
details.part > :last-child { margin-bottom: 8px; }

/* the plain sentences that say what to do first */
.said { padding: 8px var(--margin) 0; max-width: calc(var(--measure) + 2 * var(--margin)); text-wrap: pretty; }
.said li { font-size: var(--fs-headline); line-height: var(--lh-headline); margin-bottom: 8px; }
.said li:first-child { font-weight: var(--w-bold); }
.said + .totals { padding-top: 24px; }
.total .note { margin-top: 0; }
.waiting { padding: 16px var(--margin) 0; max-width: calc(var(--measure) + 2 * var(--margin)); }
details.grp .nothing { padding-top: 16px; padding-bottom: 8px; }
details.grp > .list:first-of-type, details.grp > summary + .list { border-top: 0; }

/* the period chooser: two rows of links, no script */
.seg.wrapping { flex-wrap: wrap; border-bottom: 0; margin: 0; }
.seg.wrapping + .seg.wrapping { margin-bottom: 0; }
.seglabel {
    display: flex; align-items: center; min-height: var(--touch); width: 72px; flex: none;
    font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--w-bold);
    letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-dim);
}
.seg.wrapping a { margin-right: 0; padding: 0 12px; }
.seg.wrapping a[aria-current="true"]::after { left: 12px; right: 12px; bottom: 4px; }
details.part > .seg:first-of-type { padding-top: 8px; }

/* ---- received invoices and suppliers --------------------------------------- */
a.row[aria-current="true"] {
    background: linear-gradient(var(--accent), var(--accent)) left / 3px 100% no-repeat, var(--accent-soft);
    font-weight: var(--w-bold);
}

/* A tick box with its sentence (the send page's "I checked this address"). */
.tick { display: flex; align-items: center; gap: 12px; min-height: var(--ctl-h); }
.tick input[type="checkbox"] { flex: none; }

/* ---- controls drawn the house way: select, file, tick box ------------------------------------------- */
select {
    -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 16px) 50%;
    background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
input[type="file"] { padding: 0 12px 0 0; line-height: calc(var(--ctl-h) - 2px); cursor: pointer; overflow: hidden; }
input[type="file"]::file-selector-button {
    height: calc(var(--ctl-h) - 2px); margin: 0 12px 0 0; padding: 0 16px;
    border: 0; border-right: 1px solid var(--line-strong); border-radius: 0;
    background: var(--surface); color: var(--text); cursor: pointer;
    font: var(--w-regular) var(--ctl-fs)/var(--ctl-lh) var(--font);
}
input[type="checkbox"] {
    -webkit-appearance: none; appearance: none; position: relative;
    display: inline-block; width: 24px; height: 24px; min-height: 0; padding: 0; margin: 0;
    border: 1px solid var(--line-strong); border-radius: 2px; background: var(--surface-2); cursor: pointer;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--text); }
input[type="checkbox"]:checked::after {
    content: ""; position: absolute; left: 25%; top: 20%; width: 12px; height: 8px;
    border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: rotate(-45deg);
}

/* ---- the action bar at the foot of a long form ------------------------------------------------------
   Flat, a hairline on top, the one primary action first and the quiet ones after it. It sits in the flow
   after the last field and sticks to the bottom edge while the form is longer than the screen, above the
   phone's bar. It never covers a field: it takes its own room at the end of the form. */
.bar {
    grid-column: 1 / -1; position: sticky; z-index: 20;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 24px calc(var(--margin) * -1) 0; padding: 8px var(--margin);
    background: var(--bg); border-top: 1px solid var(--hair);
}
.bar .btn { flex: none; }
.bar .grow { flex: 1 1 auto; }
.bar .docs { display: flex; align-items: center; gap: 12px; min-height: var(--ctl-h); padding: 0 8px; }
@media (min-width: 960px) {
    .bar { bottom: 0; padding-bottom: calc(8px + var(--safe-bottom)); }
}
@media (max-width: 480px) {
    .bar .btn.primary { flex: 1 1 auto; }
}
.bar.page { margin: 24px 0 0; }
details.grp > .form { padding-top: 16px; padding-bottom: 16px; }
/* A button in a narrow table cell wraps its words instead of leaving the cell. */
.btn.fit { white-space: normal; max-width: 100%; padding: 0 8px; text-align: center; line-height: 16px; }

/* The editor's line rows: three 44 px buttons need more than two columns until the header grid is wider (996 px). */
@media (min-width: 700px) and (max-width: 996px) {
    .row.line > .dn, .row.head.ed > .dnh { grid-column: span 3; }
    .row.line > .ops, .row.head.ed > :last-child { grid-column: span 3; }
}

/* ---- installed app (PWA) -------------------------------------------------- */
.offline { padding: calc(var(--group-gap) * 2) var(--margin); }
.offline-text { font-size: var(--fs-headline); line-height: var(--lh-headline); margin: 0 0 var(--group-gap); }
@media (display-mode: standalone) {
    html { background: var(--bg); }
    .hdr {
        height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0px);
        padding-left: calc(var(--margin) + env(safe-area-inset-left, 0px));
        padding-right: calc(var(--margin) + env(safe-area-inset-right, 0px));
    }
    .nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* ---- a client proposal from the assistant ----------------------------------------- */
.card.proposal { list-style: none; background: var(--surface); margin: 0 0 16px; padding: 12px 0; }
.card.proposal > .card-head { display: flex; justify-content: space-between; gap: 12px; padding: 0 var(--margin) 8px; }
.card.proposal .card-title { font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--w-bold); }
.card.proposal > .acts, .card.proposal > .flash { margin: 12px var(--margin) 0; }

/* ---- overview: month calendar, figures that open their list, filter line, anchors ------------------- */
.monthcal { margin-top: 8px; }
.calhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-right: var(--margin); }
.calhead .tl { padding-right: 0; }
.calframe.month { height: 360px; min-height: 0; }
@media (min-width: 700px) { .calframe.month { height: 420px; min-height: 0; } }
#report-quarter, #report-year, #tasks, #done, #todo, #where { scroll-margin-top: calc(var(--header-h) + var(--safe-top) + 56px); }
a.row.go { position: relative; min-height: var(--touch); padding-right: calc(var(--margin) + 24px); }
a.row.go::after {
    content: ""; position: absolute; top: 50%; right: var(--margin); width: 8px; height: 8px; margin-top: -4px;
    border-top: 2px solid var(--text-faint); border-right: 2px solid var(--text-faint); transform: rotate(45deg);
}
a.row.go:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) { a.row.go:hover::after { border-color: var(--text); } }
.filterline {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    min-height: var(--touch); padding: 8px 0 8px var(--margin); margin: 8px 0;
    background: var(--surface); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
}
.filterline .t { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.filterline .what { font-weight: var(--w-bold); }
.filterline .btn { flex: none; }

/* ---- the assistant's progress while it works on a request --------------------------------------- */
.job-status { display: flex; align-items: center; gap: 12px; padding: 0 var(--margin); margin: 16px 0 8px; }
.job-state { text-transform: uppercase; }
.job-state.info::before { animation: job-pulse 1.2s ease-in-out infinite; }
@keyframes job-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .job-state.info::before { animation: none; } }
.job-steps { list-style: none; margin: 0; padding: 0; }
.job-steps li { padding: 8px var(--margin) 8px calc(var(--margin) - 3px); border-left: 3px solid transparent; color: var(--text-dim); }
.job-steps li.now { border-left-color: var(--accent); color: var(--text); font-weight: var(--w-bold); }

/* ---- Plats CRM additions: pager, notes, readout captions ------------------------------------------ */
.listfoot { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 16px var(--margin) 0; color: var(--text-dim); }
.listfoot .shown { margin-right: auto; }
.listfoot.loading .shown::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--text-dim); }
.listfoot .err { color: var(--bad); }
.listfoot .err a { color: inherit; }
.grouphead { list-style: none; padding: 0; }
.bulkform { list-style: none; }
.pickall { display: flex; align-items: center; gap: 8px; padding: 12px var(--margin) 0; min-height: 44px; }
ul.list > li[aria-current="true"] { background: var(--surface-2); border-left: 3px solid var(--accent); }
@media (prefers-reduced-motion: no-preference) { ul.list > li[aria-current="true"] { transition: background 120ms; } }
.row .sub2 { color: var(--text-dim); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.ocr { margin: 0 var(--margin); padding: 12px; background: var(--surface); border: 1px solid var(--hair);
       white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; font-size: 13px; line-height: 16px; }
.inline-form { display: contents; }
.rowform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.total .cap { margin-bottom: 4px; }
.notes-line { padding: 8px var(--margin) 0; }

/* ---- bill chips, the desk grid, the assistant's chat -------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 0 16px; }
.rowform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rowform input { flex: 1 1 14em; min-width: 0; }
@media (min-width: 700px) { .rowform input { max-width: 34em; } }
.grid-desk { width: 100%; border-collapse: collapse; }
.grid-desk th, .grid-desk td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair); }
.grid-desk th { font-size: var(--fs-caption); line-height: var(--lh-caption); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-dim); font-weight: var(--w-bold); }
.grid-desk td:first-child, .grid-desk th:first-child { padding-left: var(--margin); }
.scrollx { overflow-x: auto; }
.msg { padding: 12px var(--margin); border-bottom: 1px solid var(--hair); }
.msg.me { background: var(--surface); }
.msg .who { font-size: var(--fs-caption); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-dim); font-weight: var(--w-bold); }
.msg .said { white-space: pre-wrap; max-width: var(--measure); margin-top: 4px; }
.mailtext { white-space: pre-wrap; max-width: var(--measure); }
textarea.draft { width: 100%; min-height: 8em; }

/* ---- picking bills for a payment file ------------------------------------ */
li.sel { display: flex; align-items: stretch; }
li.sel:has(> details.rowdet) { display: grid; grid-template-columns: auto minmax(0, 1fr); }
li.sel > details.rowdet { grid-column: 1 / -1; padding-left: calc(var(--margin) + var(--touch)); border-bottom: 1px solid var(--hair); }
li.sel > a.row { flex: 1 1 auto; min-width: 0; padding-left: 0; }
.pick {
    display: flex; flex: none; align-items: center; justify-content: center;
    width: calc(var(--margin) + var(--touch)); min-height: var(--touch); padding-left: var(--margin);
    border-bottom: 1px solid var(--hair);
}
.row.head.pickhead { padding-left: calc(var(--margin) + var(--touch)); }
.pay-code { width: 7em; text-transform: uppercase; }
.paytotal { font-weight: var(--w-bold); }
.again { display: flex; align-items: center; gap: 8px; min-height: var(--touch); }

/* ---- phone bottom bar: the groups in one row (four and "Več" below 700 px); it scrolls sideways if they ever do not fit ------- */
@media (max-width: 959px) {
    .nav {
        display: flex; justify-content: space-between; overflow-x: auto; overflow-y: hidden;
        scrollbar-width: none; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav a[aria-current="page"] { scroll-initial-target: nearest; }
    .nav a { flex: none; min-height: var(--touch); padding: 0 10px; white-space: nowrap; scroll-snap-align: center; }
}

/* ---- bills found in the mailbox ------------------------------------------- */
.cnt {
    display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px;
    border: 1px solid currentColor; border-radius: 10px;
    font-size: var(--fs-caption); line-height: 18px; font-weight: var(--w-bold); text-align: center; vertical-align: middle;
}
.queue { margin-top: 0; padding-top: 16px; border-bottom: 1px solid var(--line-strong); padding-bottom: 8px; background: var(--surface); }
.notes-line.dim { color: var(--text-dim); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 0 var(--margin); }
@media (min-width: 900px) { .pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.pair > * { min-width: 0; }
.pair .grid, .pair .form { padding-left: 0; padding-right: 0; }
.viewer { display: block; width: 100%; height: 72vh; min-height: 420px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.mailbox { padding: 12px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface); overflow-wrap: anywhere; }
.mailbox pre { margin: 8px 0 0; white-space: pre-wrap; font: inherit; color: var(--text-dim); max-height: 14em; overflow: auto; }
.stackbtns { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 0; }
.stackbtns form { margin: 0; }
input.inl { display: inline; width: auto; min-height: 0; }
form.inline { display: inline; }
.mailbox.top { margin-top: 16px; }
.mailbox .gap { margin-top: 8px; }

/* ---- Tloris: the floor plan ------------------------------------------------------------------------
   Tenants are told apart by grey and pattern, never by hue. Fills are url(#ptN) presentation attributes on the
   shapes (the patterns live in _tloris_defs.html and take their ink from the classes below); the rest is classes. */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.tp-l { fill: var(--text); fill-opacity: 0.2; }
.tp-m { fill: var(--text); fill-opacity: 0.32; }
.tp-d { fill: var(--text); fill-opacity: 0.62; }
.tp-f { fill: var(--text); }
.tp-s { fill: none; stroke: var(--text); stroke-width: 1.1; }
.tp-s.tp-w { stroke-width: 2.4; }

.tl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; }
.tl > * { min-width: 0; }
.tl-plan { padding: 0 var(--margin); }
.tl-panel, .tl-legend { padding: 0; }
.tl-panel { border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: var(--surface); padding-top: 16px; padding-bottom: 16px; }
.tl-panel h2, .tl-legend h2 { padding-top: var(--sect-gap); }
.tl-panel .acts, .tl-panel .tl-form, .tl-panel .none, .tl-panel .kv { margin-left: var(--margin); margin-right: var(--margin); }
.tl-panel .acts { margin-top: 16px; }
.tl-form { display: grid; gap: 8px; margin-top: 16px; justify-items: start; }
.tl-form .f { width: 100%; }
.kv { display: grid; grid-template-columns: minmax(8em, auto) minmax(0, 1fr); column-gap: 16px; row-gap: 4px; margin-top: 0; margin-bottom: 0; }
.kv dt { color: var(--text-dim); font-size: var(--fs-caption); line-height: var(--lh-body); font-weight: var(--w-bold); letter-spacing: var(--track-caps); text-transform: uppercase; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tl-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tl-tabs[hidden] { display: none; }
.tl-tabs .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tl-tabs .btn[aria-pressed="true"]::before { content: "\2713\00a0"; }
.floor { margin-bottom: 24px; }
.js .floor { display: none; margin-bottom: 0; }
.js .floor.cur { display: block; }
.js .floor > h3 { display: none; }
.tl-scroll { overflow-x: auto; border: 1px solid var(--hair); background: var(--surface-2); }
.plan { display: block; width: 100%; min-width: 600px; height: auto; max-width: 820px; margin: 0 auto; }
.plan .sp { stroke: var(--text); stroke-width: 0.9; stroke-linejoin: round; }
.plan .sp.un { fill: var(--surface); stroke: var(--line-strong); stroke-width: 0.6; }
.plan .sp.vac { fill: var(--surface-2); stroke-dasharray: 3 2; }
.plan .spa { cursor: pointer; outline: none; }
.plan .spa:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.plan .spa:focus-visible .sp, .plan .spa.sel .sp { stroke-width: 3; }
.plan .spa.dim { opacity: 0.22; }
.plan .lb { font: var(--w-bold) 6.4px/1 var(--font); fill: var(--text); stroke: var(--bg); stroke-width: 2.4px; paint-order: stroke; stroke-linejoin: round; pointer-events: none; }
.plan .lb.sm { font-weight: var(--w-regular); font-size: 5px; }
@media (hover: hover) { .plan .spa:hover .sp { stroke-width: 2.2; } }
.plan.thumb { min-width: 0; max-width: 100%; margin: 0; }
.plan.thumb .sp { stroke-width: 1.4; }
.plan.thumb .sp.mine { fill: var(--text); fill-opacity: 0.78; stroke-width: 1.6; }
.plan.thumb .sp.un { fill: none; stroke: var(--line-strong); }
.tl-thumb { padding: 16px var(--margin) 0; }
.tl-thumb a { display: inline-flex; flex-direction: column; gap: 8px; max-width: 200px; }
.tl-thumb .plan { width: 200px; border: 1px solid var(--hair); background: var(--surface-2); }
.tl-legend .list { border-top: 1px solid var(--hair); }
.tl-clear { padding: 0 var(--margin) 8px; }
.lg { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px var(--margin); border-bottom: 1px solid var(--hair); color: inherit; text-decoration: none; position: relative; }
a.lg.cur { background: var(--accent-soft); font-weight: var(--w-bold); }
a.lg.cur::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.lgn { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.lgn .dim { font-size: var(--fs-caption); line-height: var(--lh-caption); }
.lgv { flex: none; text-align: right; }
.sw { flex: none; display: block; }
.swb { stroke: var(--text); stroke-width: 1; }
.swb.vac { fill: var(--surface-2); stroke-dasharray: 3 2; }
@media (hover: hover) { a.lg:hover { background: var(--surface); } }
.tl-ids { display: flex; flex-wrap: wrap; gap: 0 16px; padding: 0 var(--margin); }
.tl-ids a { display: inline-flex; align-items: center; min-height: var(--touch); }
.tl-free { border: 0; }
.tl-free p { margin-top: 8px; overflow-wrap: anywhere; color: var(--text-dim); }
.tl-free summary { min-height: 32px; font-size: var(--fs-sub); line-height: var(--lh-sub); font-weight: var(--w-bold); letter-spacing: var(--track-caps); text-transform: uppercase; }
.tl-tip { position: fixed; z-index: 40; max-width: 260px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); pointer-events: none; font-size: var(--fs-body); line-height: var(--lh-body); }
.tl-tip[hidden] { display: none; }
.tl-tip div:first-child { font-weight: var(--w-bold); }
@media (min-width: 1000px) {
    .tl { grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "plan panel" "plan legend"; grid-template-rows: auto 1fr; align-items: start; padding-left: 0; }
    .tl-plan { grid-area: plan; }
    .tl-panel { grid-area: panel; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); border-left: 1px solid var(--hair); }
    .tl-legend { grid-area: legend; }
}

/* ---- Prostori: the plan beside the table ------------------------------------------------------------ */
.sp { display: grid; grid-template-columns: minmax(0, 1fr); }
.sp > * { min-width: 0; }
.sp-side { padding: 0 var(--margin) 16px; }
.sp-fold { position: relative; margin-top: 16px; }
.sp-fold::before { left: 0; right: 0; } .sp-fold::after { left: 0; }
.sp-fold > summary { display: flex; align-items: center; min-height: var(--touch); padding-top: var(--sect-gap); cursor: pointer; font-family: var(--font-serif); font-size: var(--fs-headline); line-height: var(--lh-headline); font-weight: var(--w-bold); }
.sp-fold > summary::after { content: "\25BE"; margin-left: 8px; font-family: var(--font); font-size: var(--fs-body); }
.sp-fold:not([open]) > summary::after { content: "\25B8"; }
.sp .plan { min-width: 520px; }
.sp .floor { margin-bottom: 8px; }
.sp .floor > h3 { padding: 0; margin: 0 0 8px; }
.sp-cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 0 4px; }
.sp-leg { margin-top: 8px; }
.sp-leg > summary { min-height: 32px; cursor: pointer; font-size: var(--fs-sub); line-height: var(--lh-sub); font-weight: var(--w-bold); letter-spacing: var(--track-caps); text-transform: uppercase; }
.sp-leg ul { display: grid; gap: 4px; padding-top: 8px; }
.sp-leg li { display: flex; align-items: center; gap: 12px; }
.sprow .show { display: block; margin-left: 0; font-size: var(--fs-caption); line-height: var(--lh-caption); }
.sprow.rsel { background: var(--accent-soft); position: relative; }
.sprow.rsel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.sprow.hl { background: var(--surface); }
.plan.has-hl .spa:not(.hl) { opacity: 0.3; }
.plan .spa.hl .sp { stroke-width: 3.2; }
@media (min-width: 1100px) {
    .sp { grid-template-columns: minmax(0, 1fr) minmax(0, 43%); align-items: start; }
    .sp-main { grid-column: 1; grid-row: 1; }
    .sp-side { grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--header-h) + var(--safe-top) + 8px); max-height: calc(100vh - var(--header-h) - 24px); overflow: auto; padding-left: 16px; border-left: 1px solid var(--hair); }
    .sp-fold > summary { pointer-events: none; }
    .sp-fold > summary::after { content: none; }
}
.tcell { min-width: 0; overflow-wrap: anywhere; }
.chg > summary { display: flex; align-items: center; min-height: 32px; cursor: pointer; color: var(--text-dim); font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: var(--w-bold); letter-spacing: var(--track-caps); text-transform: uppercase; }
.chg form { display: grid; gap: 8px; padding: 4px 0 8px; justify-items: start; }
.chg select { width: 100%; }
.sp-tform { display: grid; gap: 8px; margin-top: 12px; justify-items: start; }
.sp-tform .f { width: 100%; }
.sp-note { flex-basis: 100%; }
.sp-same { margin-top: 8px; }
.sp-same[hidden], .sp-tform[hidden] { display: none; }

/* ---- the assistant's pending actions: a card per action under its answer ------------------------------- */
.act-cards { padding: 12px 0 4px; border-bottom: 1px solid var(--hair); }
.card.proposal.action { margin-bottom: 12px; }
.act-line { margin: 0; padding: 4px var(--margin) 0; max-width: calc(var(--measure) + 2 * var(--margin)); text-wrap: pretty; overflow-wrap: anywhere; }
.act-line.caution { padding-top: 8px; padding-bottom: 4px; border-left: 3px solid var(--line-strong); margin-left: var(--margin); padding-left: 12px; }
.act-list { margin: 8px 0 0; padding: 0 var(--margin) 0 calc(var(--margin) + 18px); overflow-wrap: anywhere; }
.act-list li { padding: 2px 0; font-variant-numeric: tabular-nums; }
.act-diff { margin-top: 8px; font-variant-numeric: tabular-nums; }
.act-diff td { overflow-wrap: anywhere; }
.act-form { margin: 12px var(--margin) 0; }
.act-form .tick { margin-bottom: 8px; }
.act-form .act-count { display: flex; flex-direction: column; gap: 4px; max-width: 20em; margin-bottom: 8px; }
.act-form > .act-line { padding-left: 0; }
.msg.note { background: var(--surface-2); }
.msg.note .said { color: var(--text-dim); }
.act-line .st { white-space: normal; text-wrap: pretty; }
.filterline.act-filter { padding-right: var(--margin); }

/* ---- the contracts register: annexes nested one step under their contract ------------------------------ */
.ct-annexes > summary { display: flex; align-items: center; min-height: var(--touch); padding: 0 var(--margin) 0 calc(var(--margin) + 24px); cursor: pointer; color: var(--text-dim); }
.ct-annexes .row.ct-annex { padding-left: calc(var(--margin) + 24px); border-left: 1px solid var(--hair); margin-left: var(--margin); padding-left: 24px; }
.ct-annexes[open] > summary { color: var(--text); font-weight: var(--w-bold); }
.ct-item > .row { border-bottom: 0; }
.ct-item { border-bottom: 1px solid var(--hair); }
.ct-annexes .row { border-bottom: 0; }
.row.ct-annex { padding-left: calc(var(--margin) + 24px); }
.notes-line + .form { padding-top: 16px; }
.seg.ct-tabs { flex-wrap: wrap; row-gap: 0; }

/* ---- pages that update by themselves: the status line of background work, and the parts it replaces ---- */
.live-part { display: contents; }
.live-wrap[hidden] { display: none; }
.live-line .live-text { flex: 1 1 auto; min-width: 0; }
.live-line .live-bar { flex: none; width: 120px; height: 6px; accent-color: var(--accent); }
.live-line .live-time { flex: none; font-variant-numeric: tabular-nums; }
.live-line.working .dot { animation: job-pulse 1.2s ease-in-out infinite; }
.live-line[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .live-line.working .dot { animation: none; } }

/* ---- sortable lists: every value head is a control; the arrow is quiet until the column is sorted ---------- */
.row.head [data-sort-key] { display: block; }
.row.head.dr [data-sort-key], .row.head .dr [data-sort-key] { display: flex; justify-content: flex-end; }
.sortbtn { font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; display: inline-flex; gap: 4px; align-items: baseline; position: relative; text-decoration: none; text-align: inherit; white-space: nowrap; }
.sortbtn::before { content: ""; position: absolute; inset: -12px -4px; }
@media (hover: hover) { .sortbtn:hover { text-decoration: underline; color: var(--text); } }
.sortbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sortglyph { color: var(--text-faint); font-size: 0.8em; }
[aria-sort="ascending"] .sortbtn, [aria-sort="descending"] .sortbtn { color: var(--text); }
[aria-sort="ascending"] .sortglyph, [aria-sort="descending"] .sortglyph { color: var(--text); }
ul.list[aria-busy="true"] { opacity: 0.6; }
/* phones: the head row is hidden, one "Razvrsti po" control stands above the list instead */
.sortbar { display: flex; gap: 12px; align-items: flex-end; padding: 12px var(--margin) 8px; }
.sortbar label { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.sortbar select { width: 100%; }
@media (min-width: 700px) { .sortbar { display: none; } }

/* ---- expense report and categories ---------------------------------------------------------------------- */
.subnav { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px var(--margin); }
.subnav a { min-height: var(--touch); display: inline-flex; align-items: center; color: var(--text-dim); }
.subnav a[aria-current="page"] { color: var(--text); font-weight: var(--w-bold); text-decoration: underline; text-underline-offset: 6px; }
progress.share { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border: 0; background: var(--hair); color: var(--text); display: block; margin-bottom: 4px; }
progress.share::-webkit-progress-bar { background: var(--hair); }
progress.share::-webkit-progress-value { background: var(--cat-ink, var(--text)); }
progress.share::-moz-progress-bar { background: var(--cat-ink, var(--text)); }
.scrollx { overflow-x: auto; padding: 0 var(--margin); }
table.mx { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.mx th, table.mx td { padding: 8px 8px; border-bottom: 1px solid var(--hair); text-align: left; white-space: nowrap; font-weight: var(--w-regular); }
table.mx thead th { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--text-dim); font-weight: var(--w-bold); }
table.mx th.num, table.mx td.num { text-align: right; }
table.mx tbody th[scope="row"], table.mx tfoot th { position: sticky; left: 0; background: var(--bg); }
table.mx tfoot td, table.mx tfoot th { font-weight: var(--w-bold); border-top: 1px solid var(--line-strong); }
.catrow { align-items: end; padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--hair); }
.catrow .chk { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
details.rowdet { padding: 0 var(--margin) 8px; }
details.rowdet > summary { min-height: 32px; color: var(--text-dim); display: inline-flex; align-items: center; }
details.rowdet form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.chipcat { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Category label: a dot in the category's hue before the name in text colour; the chip form tints the surface too. */
.cat { --cat-ink: var(--text-dim); --cat-tint: transparent; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; }
.cat::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--cat-ink); }
.cat > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat.chip { padding: 0 8px; min-height: 24px; border-radius: var(--radius); background: var(--cat-tint); color: var(--text); }
.cat.cat-none { color: var(--text-dim); }
.cat.cat-none::before { display: none; }
.cat-c1 { --cat-ink: var(--cat-c1-ink); --cat-tint: var(--cat-c1-tint); }
.cat-c2 { --cat-ink: var(--cat-c2-ink); --cat-tint: var(--cat-c2-tint); }
.cat-c3 { --cat-ink: var(--cat-c3-ink); --cat-tint: var(--cat-c3-tint); }
.cat-c4 { --cat-ink: var(--cat-c4-ink); --cat-tint: var(--cat-c4-tint); }
.cat-c5 { --cat-ink: var(--cat-c5-ink); --cat-tint: var(--cat-c5-tint); }
.cat-c6 { --cat-ink: var(--cat-c6-ink); --cat-tint: var(--cat-c6-tint); }
.cat-c7 { --cat-ink: var(--cat-c7-ink); --cat-tint: var(--cat-c7-tint); }
.cat-c8 { --cat-ink: var(--cat-c8-ink); --cat-tint: var(--cat-c8-tint); }
.cat-c9 { --cat-ink: var(--cat-c9-ink); --cat-tint: var(--cat-c9-tint); }
.cat-c10 { --cat-ink: var(--cat-c10-ink); --cat-tint: var(--cat-c10-tint); }
.catpick { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.catpick label { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; }
/* The state of money: ok = settled or received, warn = due soon or partly paid, bad = overdue or missing, cancelled = dim and struck. */
.fin-ok { color: var(--ok); }
.fin-warn { color: var(--warn); }
.fin-bad { color: var(--bad); }
.fin-cancelled { color: var(--text-dim); text-decoration: line-through; }
.fin-in { color: var(--ok); }

.sec > form.rowform { padding: 8px var(--margin); }

/* ---- the daily list "Kaj je treba narediti" -------------------------------- */
.tasks .tcnt { font-size: var(--fs-caption); font-weight: var(--w-bold); color: var(--text-dim); margin-left: 8px; font-variant-numeric: tabular-nums; }
.tasks-head { padding: 0 var(--margin); max-width: var(--measure); text-wrap: pretty; }
.tasks-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px var(--margin) 0; }
.tasklist > li.task { display: grid; gap: 12px 16px; padding: 12px var(--margin); border-top: 1px solid var(--hair); }
/* Row hierarchy (rule of 2026-11-29): 1 the task sentence 15/20 600; 2 the facts 13/18 dim; 3 the person's note 15/20 400 on a left rule with a 12 px dim caption;
   4 the conversation 14/20 in an indented block, speaker as the 11 px caps caption; 5 the proposed-action card on its surface with a caps caption. */
.tk-say { margin: 0; font-weight: var(--w-bold); text-wrap: pretty; }
.tk-say .src { font-weight: var(--w-bold); }
.tk-group { margin: 4px 0 0; font-size: var(--fs-caption); }
.tk-facts { display: flex; flex-wrap: wrap; gap: 0 16px; margin: 4px 0 0; font-size: 13px; line-height: 18px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tk-facts .num { color: var(--text); }
.tk-facts .num, .tk-facts .st { white-space: nowrap; }
.tk-ev { margin-top: 8px; }
.tk-ev ul { margin: 0; padding: 0 0 8px 24px; }
.tk-acts { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.tk-ctl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: flex-start; }
.tk-acts form { margin: 0; }
.later { position: relative; }
.later-opts { position: absolute; top: 100%; right: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; padding: 12px; width: min(22em, calc(100vw - 2 * var(--margin))); background: var(--surface); border: 1px solid var(--line-strong); }
@media (max-width: 699px) { .later-opts { right: auto; left: 0; } }
.later-opts .cap { margin: 0; }
.src { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; font-size: var(--fs-caption); font-weight: var(--w-bold); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.src .shape { width: 10px; height: 10px; background: currentColor; flex: none; }
.src .shape { background: var(--src-ink, currentColor); }
.src-a { --src-ink: var(--cat-c1-ink); }
.src-b { --src-ink: var(--cat-c4-ink); }
.src-c { --src-ink: var(--cat-c8-ink); }
.src-a .shape { border-radius: 0; }
.src-b .shape { transform: rotate(45deg) scale(0.8); }
.src-c .shape { border-radius: 50%; background: transparent; border: 2px solid var(--src-ink); }
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; padding: 16px var(--margin) 0; }
.filters label { min-width: 9em; }
@media (min-width: 700px) {
    .tasklist > li.task { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
}
@media (max-width: 699px) {
    .tk-acts { align-items: stretch; }
    .tk-acts > .btn.primary, .tk-acts > form > .btn.primary { width: 100%; }
    .tk-ctl { justify-content: flex-start; }
}

/* Every press answers at once: the progress line, the sentence at the row, the reason beside a disabled button. */
.pressbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50; overflow: hidden; background: transparent; pointer-events: none; }
.pressbar[hidden] { display: none; }
.pressbar span { display: block; height: 100%; width: 40%; background: var(--accent); transform: translateX(-100%); }
.pressbar span.go { animation: press-run 1.1s ease-in-out infinite; }
@keyframes press-run { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .pressbar span.go { animation: none; transform: none; width: 100%; opacity: 0.6; } }
.inline-msg { margin: 6px 0 0; font-size: 0.875rem; color: var(--text-dim); flex-basis: 100%; }
.inline-msg.warn { color: var(--bad); }
.row-note { list-style: none; padding: 8px 0; }
.row-note .inline-msg { margin: 0; }
.reason { font-size: 0.8125rem; color: var(--text-faint); margin-left: 8px; }
button[aria-busy="true"] { cursor: progress; }

/* ---- "Povej Pomočniku" on a task row ---------------------------------------- */
.talk { margin-top: 8px; }
.talk-form { display: flex; gap: 8px; align-items: center; margin: 8px 0 0; }
.talk-form input[type=text] { flex: 1 1 auto; min-width: 0; }
.talk-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; pointer-events: none; }
.talk-open { display: none; min-height: var(--touch); padding-left: 0; }
.tk-notes { list-style: none; margin: 12px 0 0; padding: 0; }
/* A note is anything a person wrote down by hand on a record: one warm tint and one rule, the same everywhere. */
.tk-notes > li, .note-block { margin: 0 0 8px; padding: 6px 12px; border-left: 2px solid var(--note-rule); background: var(--note-bg); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text); }
.note-block .dim, .tk-notes .tk-note-cap { color: var(--text-dim); }
.note-block > p { margin: 0; overflow-wrap: anywhere; text-wrap: pretty; }
.note-inline { display: inline-block; max-width: var(--measure); padding: 2px 8px; border-left: 2px solid var(--note-rule); background: var(--note-bg); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text); overflow-wrap: anywhere; vertical-align: top; }
.note-inline .dim { color: var(--text-dim); }
.tk-note-text { margin: 0; font-size: 14px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; text-wrap: pretty; }
.tk-note-cap { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-dim); }
.tk-thread { margin: 12px 0 0; padding-left: 12px; font-size: 14px; line-height: 20px; }
.turn { display: block; margin: 8px 0 0; }
.tk-thread > :first-child, .talk-more > summary + .turn { margin-top: 0; }
.turn .cap { display: block; margin: 0 0 2px; }
.turn p { margin: 0; overflow-wrap: anywhere; text-wrap: pretty; }
.talk-user { background: var(--surface); padding: 4px 8px 6px; width: fit-content; max-width: 100%; border-radius: var(--radius); }
.talk-assistant { padding-left: 8px; border-left: 2px solid var(--accent); }
.talk-fallback p { color: var(--text-dim); }
.talk-note { padding-left: 8px; }
.convo-earlier { margin: 0 0 12px; }
.convo-earlier > summary { cursor: pointer; padding: 8px var(--margin); font-size: 13px; line-height: 18px; color: var(--text-dim); }
.convo-old { border-bottom: 1px solid var(--line-strong); }
.talk-note p { color: var(--text-dim); font-size: 13px; line-height: 18px; }
.talk .card.proposal .act-line.dim, .talk .card.proposal .act-list { font-size: 13px; line-height: 18px; }
/* the same kinds of text on the assistant page and the accountant thread: the person's turn on the surface, the other side's with a rule at its start edge, the app's own notice dim and small */
.msg { font-size: 14px; line-height: 20px; }
.msg .who { display: block; margin-bottom: 2px; font-size: var(--fs-caption); line-height: var(--lh-caption); }
.msg:not(.me):not(.note) { border-left: 2px solid var(--accent); padding-left: calc(var(--margin) - 2px); }
.msg.note { font-size: 13px; line-height: 18px; }
.msg.note .said { color: var(--text-dim); }
.talk-clear { margin: 0; }
.talk-more { margin: 0; }
.talk-more > summary.ibtn { width: auto; padding: 0 8px 0 0; gap: 4px; margin-left: -4px; font-size: 13px; line-height: 18px; }
.talk-more > summary.ibtn::before { inset: calc((var(--touch) - var(--ctl-h)) / -2) 0; }
.talk-more[open] > summary.ibtn, .talk-more > summary.ibtn:active { background: transparent; border-color: transparent; color: var(--text-dim); }
.talk-more[open] > summary { margin-bottom: 4px; }
.talk-more[open] > summary .ico-chevron { transform: rotate(180deg); }
.talk .card.proposal { margin: 12px 0 0; padding: 12px; border: 1px solid var(--hair); }
.talk .card.proposal > .card-head, .talk .card.proposal .act-line, .talk .card.proposal .act-form, .talk .card.proposal > .acts, .talk .card.proposal > .flash { padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }
.talk .card.proposal .act-line.caution { padding-left: 12px; }
.talk .card.proposal > .card-head { padding-bottom: 4px; }
.talk .card.proposal .act-list { padding-right: 0; }
.card-cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.card-cap .cap { margin: 0; }
.card-cap .st { min-height: 16px; }
.talk .card.proposal .act-form .acts { margin-top: 0; }
@media (max-width: 699px) {
    .talk-open { display: inline-flex; align-items: center; }
    .talk-toggle:not(:checked) ~ .talk-form { display: none; }
    .talk-toggle:checked ~ .talk-open { display: none; }
}

/* assistant answers: claims the data does not support, and source links */
mark.unverified { background: transparent; color: inherit; text-decoration: underline wavy var(--bad); text-underline-offset: 3px; }
a.src { font-size: var(--fs-caption, 0.8em); margin-left: 4px; color: var(--text-dim); }

/* ---- Back on detail pages (macro "back" in _m.html, back.js) ------------------------------------------ */
.back {
    position: relative; display: inline-flex; align-items: center; gap: 4px;
    height: var(--ctl-h); margin: 0 0 4px; padding: 0 12px 0 0;
    font-size: var(--ctl-fs); line-height: var(--ctl-lh); color: var(--text-dim); text-decoration: none;
}
/* the hit area is 44 px high however compact the control is drawn */
.back::before { content: ""; position: absolute; left: 0; right: 0; top: calc((var(--ctl-h) - var(--touch)) / 2); bottom: calc((var(--ctl-h) - var(--touch)) / 2); }
.back svg { width: 20px; height: 20px; flex: none; margin-left: -4px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.back:active { color: var(--text); }
@media (hover: hover) { .back:hover { color: var(--text); text-decoration: underline; } }

/* ---- installed app: the offline page ------------------------------------------------------------------ */
.offline { padding: calc(var(--group-gap) * 2) var(--margin); }
.offline-text { font-size: var(--fs-headline); line-height: var(--lh-headline); margin: 0 0 var(--group-gap); }

/* ---- small actions: icon buttons from one set (rule of 2026-11-29) ------------------------------------------------ */
/* Icons: 24 x 24 path data, stroke set here once, colour from the button. Drawn at the control height (36 px with a mouse,
   40 on touch); the hit area is 44 px either way (::before). A button inside a text line never moves it. */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur); }
.ibtn {
    display: inline-flex; align-items: center; justify-content: center; position: relative; flex: none;
    box-sizing: border-box; width: var(--ctl-h); height: var(--ctl-h); min-height: 0; padding: 0; margin: 0;
    background: transparent; border: 1px solid transparent; border-radius: var(--radius);
    color: var(--text-dim); font: inherit; line-height: 1; text-decoration: none; cursor: pointer; list-style: none;
    transition: transform var(--dur);
}
.ibtn::-webkit-details-marker { display: none; }
.ibtn::before { content: ""; position: absolute; inset: calc((var(--touch) - var(--ctl-h)) / -2); }
.ibtn:active { transform: scale(0.96); background: var(--surface-2); color: var(--text); }
.ibtn:disabled { opacity: 0.4; cursor: default; }
@media (hover: hover) { .ibtn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); } }
details > summary.ibtn {
    display: inline-flex; align-items: center; justify-content: center; width: var(--ctl-h); height: var(--ctl-h); min-height: 0; padding: 0;
    gap: 0; color: var(--text-dim); font: inherit; text-transform: none; letter-spacing: 0;
}
details > summary.ibtn::after { content: none; }
@media (hover: hover) { details > summary.ibtn:hover { background: var(--surface-2); color: var(--text); } }
details[open] > summary.ibtn { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
details[open] > summary .ico-chevron { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .ibtn, .ico { transition: none; } }
/* A section title with actions: the title on the left, its icon actions at the right end of the same line. The buttons are
   taller than the line, so they overlap its padding instead of making it taller. */
h2.titleline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h2.titleline > .tacts { display: flex; align-items: center; gap: 8px; flex: none; font: var(--w-regular) var(--ctl-fs)/var(--ctl-lh) var(--font);
    margin: calc((var(--lh-headline) - var(--ctl-h)) / 2) calc((20px - var(--ctl-h)) / 2) calc((var(--lh-headline) - var(--ctl-h)) / 2) 0; }
.tacts-line { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* ---- the one date field -------------------------------------------------------------------------------------------- */
.datebox { position: relative; display: block; width: 100%; max-width: 12em; }
.datebox > input[type="text"] { max-width: none; }
.js-date .datebox > input[type="text"] { padding-right: var(--ctl-h); }
.datebtn { position: absolute; right: 0; top: 0; display: none; }
.js-date .datebtn { display: inline-flex; }
.datepick { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; overflow: hidden; }
.later-opts .datebox { flex: 1 1 9em; }

/* a task's fold of evidence: its chevron sits at the right end of the task's first line and takes no line of its own */
.tk-body { position: relative; }
.tk-ev { margin-top: 0; }
.tk-ev > summary.ibtn { position: absolute; right: 0; top: calc((var(--lh-body) - var(--ctl-h)) / 2); }
.tk-body:has(.tk-ev) .tk-say { padding-right: calc(var(--ctl-h) + 4px); }
.tk-ev ul { padding-top: 8px; }
.later-opts .later-date { flex: 1 1 9em; min-width: 0; }
.later-opts .later-date .cap { margin-bottom: 4px; }

/* a row's own fold (edit the category): the pencil sits at the right edge of the row and takes no line; the form opens under the row */
li.sel { position: relative; }
li.sel > a.row, .row.head.pickhead { padding-right: calc(var(--margin) + var(--ctl-h)); }
li.sel > details.rowdet > summary.ibtn { position: absolute; right: calc(var(--margin) - 8px); top: 8px; }
li.sel > details.rowdet:not([open]) { padding: 0; border-bottom: 0; }
li.sel > details.rowdet[open] { padding-top: 4px; }
/* a fact's or a cell's fold: the icon at the cell's top right */
.fact:has(> div > .rowdet), .tcell:has(> .chg) { position: relative; }
.fact > div > .rowdet { padding: 0; }
.fact > div > .rowdet > summary.ibtn, .tcell > .chg > summary.ibtn { position: absolute; right: 0; top: -6px; }
.tcell:has(> .chg) { padding-right: calc(var(--ctl-h) + 4px); }
.tcell > .chg { margin-top: 0; }

/* ---- skip link, search box, connection notices (rule of 2026-11-29) ------------------------------------------ */
.skip {
    position: absolute; left: 8px; top: -100px; z-index: 60; padding: 8px 16px; min-height: var(--ctl-h);
    display: inline-flex; align-items: center; background: var(--surface); color: var(--text);
    border: 1px solid var(--line-strong); border-radius: var(--radius); text-decoration: none;
}
.skip:focus, .skip:focus-visible { top: 8px; }
main:focus { outline: none; }
.hsearch { position: relative; flex: 1 1 8em; min-width: 0; max-width: 22em; margin: 0; }
.hsearch input[type="search"] { width: 100%; max-width: none; min-height: var(--ctl-h); }
@media (min-width: 960px) {
    .hsearch { flex: 1 1 7em; min-width: 7em; max-width: 18em; }
    .nav a { padding: 0 10px; }
}
@media (min-width: 1360px) { .nav a { padding: 0 16px; } }
.hs-res {
    position: absolute; left: 0; top: calc(100% + 4px); z-index: 50; width: min(32em, calc(100vw - 2 * var(--margin)));
    max-height: min(70vh, 32em); overflow: auto; padding: 4px 0;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.hs-res[hidden] { display: none; }
.sq-title { margin: 0; padding: 8px 12px 4px; font-size: var(--fs-caption); font-weight: var(--w-bold); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-dim); }
.sq-group ul { margin: 0; padding: 0; }
.sq-hit { display: flex; flex-wrap: wrap; gap: 0 12px; padding: 6px 12px; min-height: var(--ctl-h); align-items: baseline; color: var(--text); text-decoration: none; }
.sq-hit.on { background: var(--accent-soft); outline: 2px solid var(--focus); outline-offset: -2px; }
.sq-main { font-weight: var(--w-bold); }
.sq-facts { font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.sq-none { margin: 0; padding: 8px 12px; }
.sq-all { display: block; padding: 8px 12px; border-top: 1px solid var(--hair); color: var(--text); }
@media (hover: hover) { .sq-hit:hover { background: var(--accent-soft); } }
.netnote-wrap:empty { display: none; }
.netnote {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0; padding: 6px calc(var(--margin) + var(--safe-left));
    border-bottom: 1px solid var(--hair); background: var(--surface-2); color: var(--text-dim); font-size: var(--fs-caption);
}
.netnote[hidden] { display: none; }
.netnote .btn { min-height: 28px; padding-top: 2px; padding-bottom: 2px; }
.listfilter { padding-bottom: 0; }
.listfilter [data-filter-count] { padding-bottom: 8px; }
[hidden] { display: none !important; }
.printonly { display: none; }

/* ---- paper (rule of 2026-11-29): no menu, no buttons, black on white; lists keep heads and whole rows --------- */
/* Group report (/porocilo/<key>): one compact list, a line per page of the group. Title 15/20 weight 600, facts 13/18 dim,
   figures 15/20 full colour with tabular numerals (colour only for the state of money). */
.rep { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hair); }
.rep-line { display: grid; grid-template-columns: 1fr; gap: 4px 16px; padding: 8px var(--margin); border-bottom: 1px solid var(--hair); }
@media (min-width: 700px) { .rep-line { grid-template-columns: 12rem 1fr; } }
.rep-t { font-weight: var(--w-bold); color: var(--text); text-decoration: none; font-size: 15px; line-height: 20px; padding: 6px 0; align-self: start; }
.rep-t:hover { text-decoration: underline; }
.rep-b p { margin: 0; }
.rep-f { display: flex; flex-wrap: wrap; gap: 0 20px; }
.rep-fig { display: inline-flex; gap: 6px; align-items: baseline; min-height: var(--ctl-h); padding: 6px 0; color: var(--text); text-decoration: none; font-size: 15px; line-height: 20px; }
.rep-fig:hover .rep-n { text-decoration: underline; }
.rep-w { font-size: 13px; line-height: 18px; }
.rep-n { font-variant-numeric: tabular-nums; }
.rep-d { font-size: 13px; line-height: 18px; padding: 2px 0; }
.rep-none { font-size: 13px; line-height: 18px; padding: 8px 0; }
.rep-rows { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.rep-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0 16px; align-items: baseline; min-height: var(--ctl-h); padding: 6px 0; color: var(--text); text-decoration: none; font-size: 15px; line-height: 20px; }
.rep-row:hover .rep-rt { text-decoration: underline; }
.rep-rt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-rd { font-size: 13px; line-height: 18px; white-space: nowrap; }
.rep-rn { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; min-width: 5em; }
.rep-in { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 8px var(--margin) 8px; }
.rep-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.rep-form input[type="file"] { max-width: 16rem; font-size: 13px; }
@media (max-width: 699px) { .rep-print { display: none; } .rep-form, .rep-form input[type="file"] { width: 100%; max-width: none; } .rep-in { gap: 12px; } }
@media print {
  @page { margin: 14mm; }
  .hdr, .nav, .skip, .netnote-wrap, .noprint, .subnav, .pagenav, .signout, .live-wrap, .flash,
  .back, .btn, button, .ibtn, .acts, .tacts, .filters, .listfilter, form.signout, summary .chev, .sortglyph, .listfoot,
  input[type="search"], .list input[type="checkbox"], .datebtn, .hs-res, .asst-fab, .asst { display: none !important; }
  form.form:not(.keepprint), form[role="search"] { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  body { padding: 0 !important; font-size: 11pt; }
  * { color: #000 !important; background: transparent !important; box-shadow: none !important; text-shadow: none !important; }
  a, a.row { color: #000 !important; text-decoration: none !important; }
  main { padding: 0 !important; }
  .printonly { display: block !important; padding: 0 var(--margin) 8px; font-size: 10pt; }
  .row, tr, li, .fact, .total, .sec > h2 { break-inside: avoid; page-break-inside: avoid; }
  .rep-line { grid-template-columns: 12rem 1fr; padding: 4px 0; }
  .rep-fig, .rep-row { min-height: 0; padding: 2px 0; }
  h1, h2, h3, .sub-title { break-after: avoid; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
  .row.head { break-after: avoid; border-bottom: 1px solid #000; }
  .st { border: 1px solid #000; }
  /* print keeps colour only where it carries state */
  .fin-ok, .fin-in, .st.ok { color: #0b5a24 !important; }
  .fin-warn, .st.warn { color: #8a4300 !important; }
  .fin-bad, .st.bad { color: #8a1010 !important; }
  .st::before { background: var(--dot) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .st.cancelled { color: var(--text-dim); text-decoration: line-through; }
.st.off::before { background: transparent !important; }
  .cat::before { background: #000 !important; }
  .note-block, .tk-notes > li, .note-inline { border-left: 2px solid #000 !important; }
  .cnt { display: none; }
  input:placeholder-shown, textarea:placeholder-shown { border-color: transparent !important; }
  ::placeholder { color: transparent !important; }
  .scrollx { overflow: visible !important; }
  details > summary { list-style: none; }
  .sec { break-inside: auto; }
  .sec > h2 { border-top: 1px solid #000; }
  .sec > h2::before { display: none; }
}

/* Web lookup of one record's billing data (tenant and supplier pages): the start line, the proposal card, the queries. */
.lk-start { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; }
.lk-start .act-line { padding: 0 0 0 var(--margin); }
.lk-start .acts { margin: 0; }
.lk .card.lookup { margin-top: 8px; }
.card.lookup > .card-cap { padding: 0 var(--margin); }
.lk-sys { color: var(--text-dim); font-size: 13px; line-height: 18px; }   /* the search's own summary: machine text */
.lk-diff .lk-quote td { padding-top: 0; border-top: 0; font-size: 13px; line-height: 18px; }
.lk-queries > summary { cursor: pointer; list-style: none; }
.lk-queries > summary::-webkit-details-marker { display: none; }
.lk-queries ol { margin-top: 4px; }
.lk-more, .acts > .lk-more { display: inline-block; flex: none; }

/* documents that are not bills */
.nbpanel { padding: 8px var(--margin) 0; }
.nbpanel .nb-banner { margin: 0 0 8px; color: var(--text-dim); }
.nbpanel .nb-banner a { color: var(--text); }
details.nbfold > summary { display: inline-flex; list-style: none; cursor: pointer; padding-right: 36px; }
.nbbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px var(--margin) 0; }
details.nbfold > summary::-webkit-details-marker { display: none; }
details.nbfold[open] > summary { margin-bottom: 8px; }
.nblist .nbrow { padding: 12px var(--margin); border-bottom: 1px solid var(--hair); }
.nbrow p { margin: 0; }
.nbrow .nb-title { font-weight: 600; }
.nbrow .nb-facts { margin-top: 4px; font-size: 13px; line-height: 18px; color: var(--text-dim); }
.nbrow .nb-reason { margin-top: 4px; font-size: 13px; line-height: 18px; color: var(--text-dim); }
.nbrow .nb-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 12px; }
.nbrow .nb-form label { display: grid; gap: 4px; min-width: 0; }
.nbrow .nb-form .nb-parent select { max-width: min(100%, 360px); }
li.sel.dim > a.row { opacity: .7; }

/* ---- the small assistant: a floating icon bottom left and its panel (rule of 2026-11-29) ------------------------------
   Square, a hairline, no shadow, non-modal: the page behind stays usable. The icon and the panel ride above whatever sticks to
   the bottom (the form's action bar, the phone's tab bar): panel.js measures it into --asst-lift. The page gets room at its
   end so the last row and "Naloži več" are never under the icon. Below 700 px the panel is a bottom sheet. */
:root { --asst-lift: 0px; }
/* The side of the screen the icon and panel sit on: swap these two values to move them. */
.has-asst { --asst-left: auto; --asst-right: calc(var(--margin) + var(--safe-right)); }
.has-asst { --asst-base: calc(var(--safe-bottom) + 16px); padding-bottom: 108px; }
.asst-fab {
    position: fixed; z-index: 35; left: var(--asst-left); right: var(--asst-right); bottom: calc(var(--asst-base) + var(--asst-lift));
    display: grid; place-items: center; width: 44px; height: 44px; padding: 0; margin: 0; border-radius: 50%;
    background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); cursor: pointer;
    transition: transform var(--dur);
}
.asst-fab:active { transform: scale(0.96); }
.asst-fab .ico { width: 22px; height: 22px; }
@media (hover: hover) { .asst-fab:hover { background: var(--surface-2); } }
.asst-dot { position: absolute; top: 5px; right: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--text); border: 2px solid var(--surface); }
.asst-dot[hidden] { display: none; }
.asst-dot.working { animation: job-pulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .asst-dot.working { animation: none; } .asst-fab { transition: none; } }
.asst {
    position: fixed; z-index: 35; left: var(--asst-left); right: var(--asst-right); bottom: calc(var(--asst-base) + var(--asst-lift) + 52px);
    display: flex; flex-direction: column; width: min(380px, calc(100vw - 2 * var(--margin) - var(--safe-left) - var(--safe-right)));
    max-height: min(70vh, calc(100dvh - var(--header-h) - 96px)); background: var(--bg); border: 1px solid var(--line-strong);
}
.asst[hidden] { display: none; }
.asst-in { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.asst-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--hair); }
.asst-cap { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 13px; line-height: 18px; font-weight: var(--w-bold); overflow-wrap: anywhere; }
.asst-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.asst-empty { padding: 12px; font-size: 13px; line-height: 18px; }
.asst .msg { padding: 8px 12px; }
.asst .msg:not(.me):not(.note) { padding-left: 10px; }
.asst .msg .said { max-width: none; }
.asst .talk-more > summary { padding: 8px 12px; font-size: 13px; line-height: 18px; color: var(--text-dim); cursor: pointer; }
.asst .card { margin: 0; border-left: 0; border-right: 0; }
.asst .live-wrap { margin: 0; }
.asst .flash { position: static; min-height: 0; margin: 0; padding: 8px 12px; animation: none; font-size: 13px; line-height: 18px; }
.asst .live-line .live-bar { width: 80px; }
.asst-retry { padding: 8px 12px; }
.asst-form { display: flex; flex-direction: column; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--hair); }
.asst-form textarea { width: 100%; resize: none; }
.asst-acts { display: flex; justify-content: flex-end; }
.asst-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 8px 8px; }
.asst-foot form { margin: 0; }
.asst-foot .btn { padding-left: 4px; padding-right: 4px; }
.asst-changed { display: flex; align-items: center; gap: 8px; padding: 8px var(--margin); font-size: 13px; line-height: 18px; color: var(--text-dim); border-bottom: 1px solid var(--hair); }
body.asst-open .live-wrap[data-live="busy"] { display: none; }
@media (min-width: 700px) { .has-asst { padding-bottom: 108px; } }
@media (max-width: 699px) {
    .has-asst { --asst-base: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px + 64px); }
    .asst { left: 0 !important; right: 0 !important; bottom: 0; width: auto; max-height: 70dvh; border-width: 1px 0 0; padding-bottom: var(--safe-bottom); }
    body.asst-open .asst-fab { visibility: hidden; }
}
