/* Paperwork layout and parts. Colours, corners, shadows and sizes come from tokens.css; HeroUI (vendor/) draws the
   components themselves (buttons, fields, chips, tabs, tables, dialogs) with their states (hover, pressed, focus,
   disabled — app.js sets data-hovered / data-pressed / data-focus-visible for them). This file only places them and adds
   the parts HeroUI has no class for. One rule per thing; sections in page order:
   1 fonts · 2 shell (sidebar, header) · 3 page · 4 lists (tabs, search, tables, empty state) · 5 Pārskats ·
   6 tooltips · 7 editor (form + preview) · 8 document sheet · 9 print · 10 narrow screens */

/* ===== 1. fonts ===== */
/* GeistSans, the lideks.lv font: the site's own variable woff2, so the PDF embeds it and it works offline */
@font-face{font-family:GeistSans;src:url(fonts/GeistSans-Variable.woff2) format("woff2");font-weight:100 900;font-display:block}

/* ===== 2. shell: sidebar + header (HeroUI Pro sidebar, Studio colours) ===== */
#app{display:grid;grid-template-columns:var(--side-w) minmax(0,1fr);height:100vh;transition:grid-template-columns var(--d-slow) var(--ease)}
#app.side-hidden{grid-template-columns:0 minmax(0,1fr)}
.sidebar{display:flex;flex-direction:column;min-height:0;overflow:hidden;background:var(--side-bg);border-right:1px solid var(--line)}
.side-brand{display:flex;align-items:center;justify-content:flex-start;gap:10px;height:var(--top-h);padding:0 20px;flex:none}
.side-brand .side-toggle{margin-left:auto}
.side-logo{width:24px;height:24px;border-radius:var(--radius);display:grid;place-items:center;background:var(--accent);color:var(--accent-foreground);font-weight:700;font-size:12px}
.side-name{font-size:14px;font-weight:600;white-space:nowrap}
#nav{flex:1;display:flex;flex-direction:column;gap:2px;padding:4px 12px 14px;overflow-y:auto}
.side-group{min-height:38px;box-sizing:border-box;padding:16px 8px 6px;color:var(--muted);font-size:12px;font-weight:500;line-height:var(--lh-12);white-space:nowrap}
.side-space{flex:1}
.side-item{display:flex;align-items:center;gap:12px;height:36px;padding:6px 8px;border-radius:var(--r-seg);color:var(--foreground);font-size:14px;white-space:nowrap;
  transition:background-color var(--d-fast) var(--ease),transform var(--d-fast) var(--ease)}
.side-item .ic{color:var(--muted);flex:none}
.side-item:hover{background:var(--well)}
.side-item:active{transform:scale(.98)}
.side-item:focus-visible{outline:2px solid var(--focus);outline-offset:-2px}
/* the active row on the accent at 15 % with its icon in accent-on-text (Studio --onBg / --on) */
.side-item.on{background:color-mix(in oklab,var(--accent) 15%,transparent);font-weight:600}
.side-item.on .ic{color:color-mix(in oklab,var(--accent) 70%,var(--foreground) 30%)}
.side-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
/* count chips: the one grey chip (on hover / active it turns white, see section 4) */
.side-item .chip{margin-left:auto}
/* the save line shows only when saving failed (the Figma sidebar has none) */
.side-foot{flex:none;padding:0 20px 14px;color:var(--danger);font-size:12px;white-space:nowrap}
.side-foot:empty,.side-foot:has(#saveState:empty){display:none}

/* the shell scrolls (header + page share one width); an editor scrolls inside its own panels */
#shell{display:flex;flex-direction:column;min-width:0;min-height:0;overflow-y:auto;scrollbar-gutter:stable}
#shell:has(.page--split){overflow:hidden}
#shell:has(.page--split) #main{flex:1 1 0}
#main{flex:1 0 auto;min-width:0;min-height:0;outline:none}
/* header: in the same centred column as the page; on top-level pages it holds the title + actions, else the crumbs */
#top{display:flex;align-items:center;gap:8px;flex:none;box-sizing:border-box;width:100%;max-width:var(--page-max);height:var(--top-h);margin:0 auto;padding:0 var(--page-pad)}
#top #sideToggle{display:none}
#app.side-hidden #top #sideToggle{display:inline-flex}
#topHead{flex:1;min-width:0;display:flex}
#topHead:empty{display:none}
#top .page-head{flex:1;min-height:0;flex-wrap:nowrap}
#top .page-title{min-width:0;overflow:hidden;white-space:nowrap}
#top .head-actions{flex:none;flex-wrap:nowrap}
.crumbs{display:flex;align-items:center;gap:6px;min-width:0;font-size:14px;color:var(--muted)}
.crumb{display:inline-flex;align-items:center;gap:6px;color:var(--muted);white-space:nowrap}
a.crumb:hover{color:var(--foreground)}
.crumb.now{color:var(--foreground);font-weight:500;overflow:hidden;text-overflow:ellipsis}
.crumb-sep{width:14px;height:14px;color:var(--muted)}

/* ===== 3. page: one centred column, 1110 px of content (Hostinger-like) ===== */
.page{display:flex;flex-direction:column;gap:20px;box-sizing:border-box;width:100%;max-width:var(--page-max);margin:0 auto;animation:fade-in var(--d) var(--ease)}
.page:not(.page--split){gap:16px;padding:0 var(--page-pad) 40px}
.page.page--narrow > *{max-width:820px;width:100%}   /* forms (Mani rekvizīti, a client) */
.page-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-height:40px}
.page-head .page-title{flex:1;min-width:200px}
.head-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
/* the count next to a title = HeroUI Chip sm, 8 px from the title (HeroUI Pro "All Employees 32") */
.page-title:has(> .chip){align-items:center;gap:8px}
.page-title > .chip{flex:none}
/* every grey chip (counts, Xolo, report dates, statuses without colour) is the same: --chip on --foreground */
.chip.chip--soft.chip--default{--chip-bg:var(--chip);--chip-fg:var(--foreground);letter-spacing:0}
/* a chip must stay visible on whatever row it sits on: white on the sidebar's hovered (#ebebec) and active (blue) rows,
   one step darker on a hovered table row (Aivis 2026-12-02 "chip pazūd") */
.side-item:is(:hover,.on) .chip.chip--soft.chip--default{--chip-bg:var(--surface)}
.table__row:is(:hover,[data-hovered=true]) .chip.chip--soft.chip--default{--chip-bg:var(--chip-strong)}
/* cards on the page: the Figma's 20 px corners and 1 px edge instead of HeroUI's shadow */
#main > .page:not(.page--split) .card{border-radius:var(--r-card);box-shadow:var(--edge)}
.form{display:flex;flex-direction:column;gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 4) calc(var(--spacing) * 5) calc(var(--spacing) * 5)}   /* a form card (Mani rekvizīti) */
.form .section-title{margin-top:calc(var(--spacing) * 2)}
.notice{display:flex;align-items:center;gap:12px;justify-content:space-between;flex-wrap:wrap}
/* "Jauns rēķins ▾": a HeroUI ButtonGroup and its small menu */
.create{position:relative;display:flex;gap:1px}
.create-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:180px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ===== 4. lists: filter tabs, search, tables, empty state ===== */
.list-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
/* year / filter tabs = the Studio segmented choice: grey track, the chosen one on a white pill */
.year-tabs{width:auto!important;align-self:flex-start}
.list-tools .year-tabs{max-width:100%}
.year-tabs .tabs__list-container{background:transparent;border-radius:0}   /* HeroUI's own grey pill (20 px) would show round our track */
.year-tabs .tabs__list{padding:4px;gap:2px;border-radius:var(--r-seg);background:var(--well)}
.year-tabs .tabs__tab{flex:none;width:auto;height:30px;padding:0 16px;border-radius:var(--r-pill);font-size:14px;font-weight:500;line-height:var(--lh-14);color:var(--muted)}
.year-tabs .tabs__tab:hover{color:var(--foreground)}
.year-tabs .tabs__tab[data-selected=true]{color:#fff}
.year-tabs .tabs__indicator{background:var(--foreground);border-radius:var(--r-pill);box-shadow:none}   /* the chosen one on black (Aivis 2026-12-02): a white pill on the grey track was 1.19:1 */
/* search = HeroUI SearchField, on the right of the tabs (left when a list has no tabs) */
.list-search{margin-left:auto;width:260px;max-width:100%}
.list-tools:not(:has(.tabs)) .list-search{margin-left:0}
.list-search .search-field__group{width:100%;background:var(--surface)}   /* edge = the field edge (tokens) */
.list-search .search-field__search-icon{width:16px;height:16px;margin-left:12px;color:var(--muted);flex:none}
.list-search .search-field__clear-button{width:24px;height:24px;min-width:24px;padding:0;margin-right:8px;border-radius:var(--r-full);background:transparent;color:var(--muted)}
.list-search .search-field__clear-button:hover,.list-search .search-field__clear-button[data-hovered=true]{background:var(--default);color:var(--foreground)}
.list-search .search-field__clear-button .ic{width:14px;height:14px}
/* tables (HeroUI Table): row hover lighter than the grey frame so the row does not melt into it */
.table-root--primary .table__body .table__row:hover > .table__cell,
.table-root--primary .table__body .table__row[data-hovered=true] > .table__cell,
.tax-table .q-row[aria-expanded]:hover > .table__cell{background:color-mix(in oklab,var(--default) 35%,var(--surface))}
.table__row .table__cell,.table__header{border-color:var(--line)}   /* one line colour (HeroUI: separator at 50 %) */
.table__cell.nowrap{white-space:nowrap}
.table__cell.muted.hide-sm:nth-child(3){white-space:normal;max-width:340px;overflow:hidden;text-overflow:ellipsis}
.cell-main{font-weight:500}
/* HeroUI Pro Empty State (outline, md) */
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:32px 24px;text-align:center;color:var(--muted);font-size:14px;line-height:var(--lh-14)}
.empty-state--outline{border:1px dashed var(--line);border-radius:var(--r-box)}
.empty-state__header{display:flex;flex-direction:column;align-items:center;gap:8px}
.empty-state__media[data-variant=icon]{width:48px;height:48px;border-radius:var(--r-full);background:var(--default);color:var(--foreground);display:grid;place-items:center}
.empty-state__media .ic{width:20px;height:20px}
.empty-state__title{margin:0;font-size:16px;font-weight:500;line-height:var(--lh-16);color:var(--foreground)}   /* = card titles */
.empty-state__description{margin:0;max-width:370px}
.empty-state__content{display:flex;gap:8px;justify-content:center}

/* ===== 5. Pārskats (Aivis's Figma 26:159): year tabs, KPI cards, bar chart, Nodokļu aprēķins ===== */
.dash-body{display:flex;flex-direction:column;gap:16px}
.dash-card{padding:16px;gap:32px;border-radius:var(--r-card);box-shadow:var(--edge)}
.dash-h{margin:0;font-size:16px;font-weight:500;line-height:var(--lh-16)}   /* card title = .section-title */
/* KPI cards */
.dash-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.dash-kpi{display:flex;flex-direction:column;gap:6px;min-width:0;padding:16px;border-radius:var(--r-card);background:var(--surface);box-shadow:var(--edge)}
.dash-kpi .k{font-size:14px;font-weight:500;line-height:var(--lh-14);color:var(--muted)}
.dash-kpi-row{display:flex;align-items:center;justify-content:space-between;gap:20px;min-width:0}
.dash-kpi .v{font-size:24px;font-weight:600;line-height:var(--lh-24);letter-spacing:var(--ls-num);font-variant-numeric:tabular-nums;white-space:nowrap}
.dash-kpi .v small{font-size:14px;font-weight:500}
.dash-kpi--sm{border-radius:var(--r-box)}
.dash-kpi--sm .k{font-size:12px;line-height:var(--lh-12)}
.dash-kpi--sm .v{font-size:20px;line-height:var(--lh-20)}
/* trend chip: change against last year */
.trend{display:inline-flex;align-items:center;gap:2px;height:20px;padding:0 4px;border-radius:var(--r-box);font-size:12px;font-weight:500;line-height:var(--lh-12);white-space:nowrap;flex:none}
.trend > span{padding:0 2px}
.trend .ic{width:12px;height:12px}
.trend--up{background:var(--good-soft);color:var(--good-soft-fg)}
.trend--down{background:var(--bad-soft);color:var(--bad-soft-fg)}
/* bar chart (Figma 29:187): y axis 40 px | plot (bars 293 px, months under them); hover = HeroUI Pro cursor band */
.bc{display:flex;gap:8px}
.bc-y{width:40px;flex:none;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end;padding-bottom:24px;font-size:12px;line-height:var(--lh-12);color:var(--muted);font-variant-numeric:tabular-nums}
.bc-plot{flex:1;min-width:0;display:flex;flex-direction:column;gap:12px;padding-top:8px}   /* half a 16 px axis label: each label centres on its line */
.bc-bars{position:relative;height:293px;display:flex}
.bc-grid{position:absolute;left:0;right:0;height:1px;background:var(--line)}
.bc-col{position:relative;flex:1;min-width:0;display:flex;justify-content:center;outline:none}
.ch-bar{cursor:default}
.bc-col::before{content:"";position:absolute;inset:0 6px;background:var(--foreground);opacity:0;pointer-events:none}
.bc-col.ch-bar:hover::before,.bc-col.ch-bar:focus-visible::before{opacity:.05}
.bc-stack{display:flex;flex-direction:column;justify-content:flex-end;width:min(36px,70%);height:100%;transition:opacity var(--d-fast) var(--ease)}
.bc-n,.bc-p{display:block;border-radius:var(--r-seg);flex:none}
.bc-n{background:var(--chart-bar)}
.bc-p{background:var(--chart-pending);box-shadow:inset 0 0 0 1.5px var(--chart-bar)}   /* light fill + the bar blue edge: 3.7:1 against the card (WCAG 1.4.11) */
.bc-x{display:flex}
.bc-x span{flex:1;min-width:0;text-align:center;font-size:14px;line-height:var(--lh-14);color:var(--muted)}
/* Nodokļu aprēķins (Figma 31:469): a card with the title, five KPI cards, the quarter table and one alert */
.dash-card.dash-tax{gap:16px}
.dash-tax-head{display:flex;flex-direction:column;gap:12px}
/* (the chevron column first, so the header rule below keeps its title left as before) */
.tax-table .chev-cell{width:48px;padding-left:0;text-align:right}
.dash-tax .table__column{text-align:left;font-size:12px;font-weight:500;line-height:var(--lh-12);color:var(--muted)}
.dash-tax .tax-table .q-row .table__cell{font-weight:400;font-size:14px;line-height:var(--lh-14)}
.dash-tax .tax-table .cell-main,
.dash-tax .tax-table .q-row .table__cell.cell-main{font-weight:500;color:var(--foreground)}
.tax-table .q-row .chip .ic{width:12px;height:12px}
.tax-table .muted,.tax-table .m-row .table__cell{color:var(--muted)}
/* quarters fold open (HeroUI Table "Expandable Rows"); fixed columns so opening one does not move them */
.tax-table{border-top:0}
.tax-table .q-row[aria-expanded]{cursor:pointer}
.tax-table .tax-grid{table-layout:fixed;width:100%}
.tax-table .tax-grid .table__cell,.tax-table .tax-grid .table__column{overflow:hidden;text-overflow:ellipsis}
.tree-cell{display:flex;align-items:center;gap:4px}
.tree-chev{width:16px;height:16px;color:var(--muted);transition:transform 150ms cubic-bezier(.4,0,.2,1)}
.table__row[data-expanded="true"] .tree-chev{transform:rotate(180deg)}
/* the hidden month rows sit after the last quarter, so HeroUI's tr:last-child corners miss it: round the last visible row */
.tax-table .table__body tr.q-row:not(:has(~ .q-row)):not([aria-expanded="true"]){border-bottom-width:0}
.tax-table .table__body tr.q-row:not(:has(~ .q-row)):not([aria-expanded="true"]) td:first-child{border-end-start-radius:var(--r-box)}
.tax-table .table__body tr.q-row:not(:has(~ .q-row)):not([aria-expanded="true"]) td:last-child{border-end-end-radius:var(--r-box)}
.dash-alert{display:flex;align-items:center;gap:8px;padding:12px 16px;border-radius:var(--r-box);background:var(--info-soft);color:var(--info-soft-fg);font-size:14px;font-weight:500;line-height:var(--lh-14)}
.dash-alert .ic{width:16px;height:16px;margin:4px;flex:none}

/* ===== 6. tooltips ===== */
/* text tooltip ([data-tip]) = Studio .tip: inverse of the page, under the element */
.tip{position:fixed;z-index:70;display:flex;gap:6px;align-items:center;padding:4px 10px;border-radius:var(--r-pill);background:var(--foreground);color:var(--background);
  font-size:12px;font-weight:500;line-height:var(--lh-12);white-space:nowrap;pointer-events:none;box-shadow:var(--shadow-pop);
  opacity:0;transform:scale(.96);transition:opacity var(--d-fast) var(--ease),transform var(--d-fast) var(--ease)}
.tip.show{opacity:1;transform:none}
.tip[hidden]{display:none}
/* bar chart tooltip = HeroUI Pro chart tooltip: a card that follows the pointer */
.chart-tooltip{position:fixed;left:0;top:0;z-index:70;pointer-events:none;display:flex;flex-direction:column;gap:6px;min-width:140px;padding:8px 12px;border-radius:var(--r-pill);
  background:var(--surface);color:var(--foreground);box-shadow:var(--shadow-pop);transition:transform 400ms var(--ease)}
.chart-tooltip[hidden]{display:none}
.chart-tooltip__header{font-size:12px;font-weight:500;line-height:var(--lh-12);color:var(--muted)}
.chart-tooltip__item{display:flex;align-items:center;gap:8px;font-size:12px;line-height:var(--lh-12)}
.chart-tooltip__indicator{width:8px;height:8px;border-radius:var(--r-full);background:var(--chart-bar);flex:none}
.chart-tooltip__indicator.soft{background:var(--chart-pending);box-shadow:inset 0 0 0 1.5px var(--chart-bar)}
.chart-tooltip__label{color:var(--muted)}
.chart-tooltip__value{margin-left:auto;padding-left:12px;font-weight:600;font-variant-numeric:tabular-nums}

/* ===== 7. editor: form on the left, the document on the right, in one card (Aivis's Figma 34:3283) ===== */
.page.page--split{height:100%;padding:0 var(--page-pad) 32px}
.split.card{flex:1;min-height:0;padding:0;gap:0;display:grid;grid-template-columns:minmax(460px,600px) minmax(0,1fr);overflow:hidden}
.page--split .split.card{border-radius:var(--r-card);box-shadow:none;border:1px solid var(--line)}
.split-form{min-height:0;overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:column;gap:24px;padding:14px 24px 32px;border-right:1px solid var(--line)}
.split-form > *{flex:none}
.split-form > hr.separator{margin-bottom:8px}   /* 32 px between sections */
.split-head{display:flex;align-items:center;gap:12px;justify-content:space-between;margin-bottom:8px}
.split-head .page-title{align-items:center}
/* section titles in every form (editor, Mani rekvizīti): 20 / 500 */
.fieldset__legend{font-size:20px;font-weight:500;line-height:var(--lh-20)}
.split-form .fieldset__legend{margin-bottom:20px}
.split-form .fgrid{row-gap:16px}
.split-form .tax-row{grid-template-columns:1fr 1fr}
.split-preview{position:relative;min-height:0;min-width:0;display:flex;flex-direction:column;background:var(--default)}
.split-bar{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;min-height:64px;box-sizing:border-box;padding:14px 20px;background:var(--surface);border-bottom:0}
.split-bar .section-title{margin-right:8px}
/* the document area: an A4 sheet zoomed to the column; PDF | DOCX float at the bottom */
.sheet-wrap{overflow-x:hidden;overflow-y:auto;scrollbar-gutter:stable;max-height:calc(100vh - 140px);border-radius:var(--r-card);background:var(--default);padding:calc(var(--spacing) * 4)}
.split-preview .sheet-wrap{flex:1;min-height:0;max-height:none;border-radius:0;background:transparent;padding:24px 24px 84px}
.doc-dl{position:absolute;left:50%;bottom:24px;transform:translateX(-50%);background:var(--surface);border-radius:var(--r-full);box-shadow:var(--shadow-float)}
.links{display:flex;flex-wrap:wrap;gap:calc(var(--spacing) * 2)}
.links a{display:inline-flex;align-items:center;gap:6px;height:24px;padding:0 10px;border-radius:var(--r-full);font-size:12px;font-weight:500;line-height:var(--lh-12);
  background:var(--accent-soft);color:var(--accent-soft-foreground)}   /* = a soft accent chip, clickable */
.links a:hover{background:color-mix(in oklab,var(--accent-soft) 80%,var(--accent) 20%)}
/* fields: HeroUI TextField and HeroUI Select (app.js heroSelect — no native select); no number spinners */
.switch{--switch-control-bg:var(--field-edge);--switch-control-bg-hover:color-mix(in oklab,var(--field-edge) 85%,var(--foreground))}   /* off switch 3.66:1 (was 1.19:1); white thumb on it 3.66:1 */
.f{display:flex;flex-direction:column;gap:var(--spacing);min-width:0}
.select__trigger{text-align:left}
.select__value[data-placeholder=true]{color:var(--field-placeholder,var(--muted))}
.select__popover{position:fixed;z-index:90;overflow-y:auto;box-sizing:border-box}   /* placed under (or over) its trigger by app.js */
.select__popover[hidden]{display:none}
input[type=number]{-moz-appearance:textfield;appearance:textfield}
input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.fgrid{display:grid;grid-template-columns:1fr 1fr;gap:14px 12px}
.fgrid .wide{grid-column:1 / -1}
.sw-row{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;min-height:36px}
.sw-row .switch{width:auto;margin:0}
.tax-row{display:grid;grid-template-columns:1fr 160px;gap:12px;align-items:start}
.tax-row > .sw-row{align-self:end;min-height:40px}
/* rows: views (name | hours | delete) and lines (name | qty | unit | price | total | delete) */
.vw-list{display:flex;flex-direction:column;gap:12px}
.vw-grid{display:grid;grid-template-columns:minmax(0,1fr) 96px 36px;gap:8px;align-items:center}
.vw-foot{display:flex;align-items:center;justify-content:flex-start;margin-top:12px}
.vw-list:empty + .vw-foot{margin-top:0}
.it-list{display:flex;flex-direction:column;gap:6px}
.it-grid{display:grid;grid-template-columns:minmax(0,1fr) 64px 72px 104px 88px 32px;gap:8px;align-items:start}
.it-grid > .tot{align-self:center;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.it-grid > .button{align-self:center}
.it-head .label{color:var(--muted);font-size:12px}
.it-head .num{text-align:right}
.it-name{display:flex;flex-direction:column;gap:6px;min-width:0}
.vw-hours .input-group__input,.it-price .input-group__input{width:0;min-width:0}
/* totals */
.items-foot{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;margin-top:12px}
.sums{display:flex;flex-direction:column;gap:6px;min-width:240px;margin-left:auto}
.sum-row{display:flex;justify-content:space-between;gap:24px;color:var(--muted);font-variant-numeric:tabular-nums}
.sum-row.total{color:var(--foreground);font-size:16px;font-weight:600}
.sum-row.sub{font-size:12px;padding-left:12px}
.est-totals{border-radius:var(--r-box);gap:16px;box-shadow:none}   /* flat, no drop shadow (Aivis 2026-12-02) */
.est-totals .sum-row{height:20px}   /* rows 36 px apart (Figma SumRow); the bold "Kopā" overflows its 20 px row as in the design */
.est-totals .sum-row:not(.total){font-size:14px}
.est-totals .sum-row:not(.sub):not(.total){color:var(--foreground);font-weight:500}
/* HeroUI AlertDialog outside React */
.alert-dialog__backdrop{z-index:80}
.alert-dialog__dialog{pointer-events:auto;animation:dialog-in var(--d) var(--ease)}
.alert-dialog__container{justify-content:center}
/* HeroUI Modal outside React: "Nosūtīt" e-mail (Aivis 2026-12-02) */
.modal__backdrop{z-index:80;animation:fade-in var(--d) var(--ease)}
.modal__container{justify-content:center;max-height:100%;overflow-y:auto}
.modal__dialog{pointer-events:auto;animation:dialog-in var(--d) var(--ease)}
.send-body{display:flex;flex-direction:column;gap:16px}
.send-body #sdNote:empty{display:none}
.send-body .textarea{min-height:180px;resize:vertical}
.send-file{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 12px;border-radius:var(--r-seg);background:var(--info-soft);color:var(--info-soft-fg);font-weight:500}   /* light blue (Aivis 2026-12-02) */
.send-file__name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.send-file__size{color:var(--info-soft-fg);font-size:12px;line-height:var(--lh-12);font-variant-numeric:tabular-nums}
.send-from{margin:0;color:var(--muted);font-size:12px;line-height:var(--lh-12)}
.send-from:empty{display:none}
.modal__footer .send-mark{margin-right:auto}
@media (max-width:560px){ .modal__footer{flex-wrap:wrap} .modal__footer .send-mark{width:100%;order:3} }

/* ===== 8. the document: an A4 sheet at 96 dpi (794 × 1123). Print colours are the document's own, not app tokens ===== */
.sheet{width:794px;min-height:1123px;margin:0 auto;background:#fff;color:#111;box-shadow:var(--shadow-pop);padding:72px 76px;transform-origin:top left}
.paper{font:11pt/1.5 Arial,Helvetica,sans-serif;color:#111}
.paper .d-title{font-size:14pt;text-align:center;margin:0 0 4px;font-weight:700}
.paper .d-sub{text-align:center;margin:0 0 18px}
.paper .d-meta{display:flex;justify-content:space-between;margin:0 0 14px}
.paper .d-h{font-size:10.5pt;margin:14px 0 6px;font-weight:700;break-after:avoid}
.paper .d-p{margin:0 0 8px}
.paper .d-p.j{text-align:justify}
.paper .d-note{font-size:8.5pt;color:#71717a;margin:0 0 8px}
.paper .d-space{height:14px}
.paper .d-break{break-after:page}
.paper .d-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:9pt;margin:0 0 12px}
.paper .d-table th,.paper .d-table td{border:1px solid #d4d4d8;padding:5px 7px;vertical-align:top;text-align:left;overflow-wrap:anywhere}
.paper .d-table th{background:#f4f4f5;font-weight:700}
.paper .d-table tfoot td{font-weight:700}
.paper .d-table .right{text-align:right}
.paper .d-parties{display:grid;grid-template-columns:1fr 1fr;gap:28px;margin:12px 0;font-size:9.5pt;break-inside:avoid}
.paper .d-ptitle{font-weight:700;margin-bottom:4px;font-size:10pt}
.paper .d-sign{margin-top:36px;border-bottom:1px solid #111;width:70%}
.paper .d-signname{color:#71717a;font-size:8.5pt;margin-top:2px}
/* Aivis's estimate / invoice (Lideks): measured from the 920 px sample, scaled to the 794 px sheet — 40 px margins, left
   column 31 %, right block from 34.6 %, the € column at 67 % of it, the foot pinned to the bottom. GeistSans. */
.sheet.lx-sheet{padding:36px 40px 40px;display:flex;flex-direction:column}
.lx{flex:1;display:flex;flex-direction:column;position:relative;font:400 10.5px/1.45 GeistSans,"Helvetica Neue",Arial,sans-serif;color:#000;letter-spacing:0}
.lx p{margin:0 0 15px}
.lx a{color:#1d5fd1;text-decoration:underline}
.lx-brand{position:absolute;top:-15px;right:0;font-weight:500;font-size:54px;letter-spacing:-.02em;line-height:1}
.lx-top,.lx-mid,.lx-foot{display:grid;grid-template-columns:31% 1fr;column-gap:3.8%}
.lx-top{min-height:211px}
.lx-mid > *,.lx-foot > *{border-top:1px solid #000}
.lx-date{font-size:32px;font-weight:400;line-height:1.22;letter-spacing:-.01em;padding-top:4px;height:108px;border-bottom:1px solid #000;align-self:start}
.lx-head{display:grid;grid-template-columns:1fr 33%;font-size:32px;font-weight:400;line-height:1.22;padding-top:4px;height:108px;border-bottom:1px solid #000}
.lx-row{display:grid;grid-template-columns:1fr 33%;gap:12px}
.lx-row small{display:block;font-size:9px;color:#555;margin-top:2px}
.lx-rows{padding:8px 0 20px;display:flex;flex-direction:column;gap:6px}
.lx-sums{border-top:1px solid #000;padding-top:8px}
.lx-notes{margin-top:28px;font-size:9.5px;color:#333;max-width:85%}
.lx-foot{margin-top:auto;padding-top:24px}
.lx-legal{display:grid;grid-template-columns:31% 1fr;column-gap:3.8%;margin-top:auto;padding-top:24px;font-size:9px;line-height:1.45;color:#333}
.lx-legal p{margin:0;max-width:85%}
.lx-legal + .lx-foot{margin-top:0;padding-top:16px}
.lx-foot > div:first-child{padding-top:12px}
.lx-tag{display:block;max-width:190px}
.lx-total{display:grid;grid-template-columns:1fr 33%;font-size:32px;font-weight:400;line-height:1.1;padding-top:12px}
.lx-total span:last-child{white-space:nowrap}
/* the contract on the Lideks grid: the estimate's head, then headings left / clauses right */
.paper.lxd-sheet{display:grid;grid-template-columns:31% 1fr;column-gap:3.8%;align-content:start;font:400 10.5px/1.5 GeistSans,"Helvetica Neue",Arial,sans-serif;color:#000;letter-spacing:0}
.lxd-sheet > *{grid-column:2;min-width:0}
.lxd-sheet > .lxd-head{grid-column:1 / -1;position:relative;margin-bottom:28px}
.lxd-head p{margin:0 0 15px}
.lxd-head .lx-top{min-height:150px}
.lxd-head .lx-brand{top:-15px}
.lxd-title{border-top:1px solid #000;border-bottom:1px solid #000;padding-top:4px;height:108px;font-size:32px;line-height:1.22;letter-spacing:-.01em}
.lxd-title small{display:block;font-size:10.5px;letter-spacing:0;line-height:1.45;margin-top:6px}
.lxd-sheet > .d-h{grid-column:1;font-size:10.5px;font-weight:500;margin:0;padding-top:8px;border-top:1px solid #000;break-after:auto}
.lxd-sheet > .d-h + *{border-top:1px solid #000;padding-top:8px}
.lxd-sheet > .d-p{margin:0 0 8px;text-align:left}
.lxd-sheet > .d-h ~ .d-h{margin-top:24px}
.lxd-sheet > .d-h ~ .d-h + *{margin-top:24px}
.lxd-sheet .d-table{font-size:9.5px}
.lxd-sheet .d-table th,.lxd-sheet .d-table td{border:0;border-bottom:1px solid #000;background:none;padding:4px 0}
.lxd-sheet .d-parties{font-size:10.5px;gap:24px}
.lxd-sheet .d-ptitle{font-weight:500}
/* the PDF stage for PHP hosting (app.js clientPdf): the sheet as it prints, off screen */
.pdf-stage{position:fixed;left:-10000px;top:0;width:794px;background:#fff}
.pdf-stage .sheet{box-shadow:none;margin:0;width:794px;min-height:0;transform:none}
.pdf-stage .sheet.lx-sheet{height:1123px;padding:40px;overflow:hidden}
.pdf-stage .sheet.lxd-sheet{padding:0 40px}

/* ===== 9. print / PDF: only the sheet ===== */
#print{display:none}
@media print{
  @page{size:A4;margin:0}
  html,body{height:auto;overflow:visible;background:#fff}
  #app,.toast{display:none!important}
  #print{display:block}
  #print .sheet{box-shadow:none;margin:0;width:auto;min-height:0;padding:20mm 20mm}
  #print .sheet.lx-sheet{width:210mm;height:297mm;padding:10.6mm;overflow:hidden;zoom:1}
  #print .sheet.lxd-sheet{padding:12mm 10.6mm 14mm;-webkit-box-decoration-break:clone;box-decoration-break:clone}   /* several pages: each page gets the margins */
}

/* ===== 10. narrow screens ===== */
/* the editor stacks (form, then the document) and the shell scrolls again */
@media (max-width:1180px){
  .dash-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  #shell:has(.page--split){overflow-y:auto}
  #shell:has(.page--split) #main{flex:1 0 auto}
  .page.page--split{height:auto}
  .split.card{grid-template-columns:1fr;overflow:visible}
  .split-form{border-right:0;border-bottom:1px solid var(--line);overflow:visible}
  .split-preview .sheet-wrap{max-height:none}
}
/* with the sidebar open and a narrow window the title column goes first, so Statuss is never cut off */
@media (min-width:981px) and (max-width:1180px){ #app:not(.side-hidden) :is(.table__column,.table__cell).hide-sm:nth-child(3){display:none} }
/* the sidebar becomes a sheet over the page (HeroUI Pro sidebar on mobile) */
@media (max-width:980px){
  #app,#app.side-hidden{grid-template-columns:minmax(0,1fr)}
  .sidebar{position:fixed;z-index:40;inset:0 auto 0 0;width:260px;transform:translateX(-105%);transition:transform var(--d-slow) var(--ease)}
  #app.side-open .sidebar{transform:none}
  #app.side-open::after{content:"";position:fixed;inset:0;z-index:39;background:var(--scrim);animation:fade-in var(--d) var(--ease)}
  #top{padding:0 16px}
  #top #sideToggle{display:inline-flex}
  .side-brand .side-toggle{display:none}
  .page:not(.page--split){padding:0 16px 32px}
  .page.page--split{padding:0 16px 16px}
  .table__column.hide-sm,.table__cell.hide-sm{display:none}
}
@media (max-width:700px){
  .fgrid,.tax-row{grid-template-columns:1fr}
  .form{padding:16px}
  .dash-kpis{grid-template-columns:minmax(0,1fr)}
  .bc-x span{font-size:11px}
  .list-search{margin-left:0;width:100%}
}
/* WCAG 1.4.10 reflow at 320 px: the header buttons keep only their icon (the label stays as the accessible name) */
@media (max-width:480px){
  #top .head-actions .button:not(.button--icon-only){font-size:0;gap:0;padding:0 10px;min-width:36px}
  #top .head-actions .button .ic{width:16px;height:16px}
}
/* the client's invoice page /r/<token> (r.html, 2026-12-03) */
/* the app scrolls inside #shell (html, body: overflow hidden); the client's page scrolls as a normal page */
.pub-html,.pub-html body{height:auto;overflow:visible;overflow-x:hidden}
.pub-body{background:var(--background,#f4f4f5);min-height:100vh;margin:0}
.pub{max-width:860px;margin:0 auto;padding:24px 16px 48px;display:flex;flex-direction:column;gap:16px}
.pub-card{padding:20px 24px}
.pub-top{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
.pub-from{margin:0;color:var(--muted);font-size:14px}
.pub-title{margin:2px 0 0;font-size:24px;font-weight:600;letter-spacing:-.01em}
.pub-sum{display:flex;flex-direction:column;margin-top:16px}
.pub-k{color:var(--muted);font-size:13px}
.pub-amount{font-size:32px;font-weight:600;font-variant-numeric:tabular-nums;letter-spacing:-.02em}
.pub-h{font-size:14px;font-weight:600;margin:20px 0 6px}
.pub-row{display:grid;grid-template-columns:140px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:36px;border-top:1px solid var(--separator,#0000000f)}
.pub-v{font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.pub-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}
.pub-sheet{overflow:hidden}
.pub-sheet .sheet{margin:0}
.pub-missing{text-align:center;padding:40px 24px}
@media (max-width:560px){.pub-row{grid-template-columns:minmax(0,1fr) auto}.pub-row .pub-k{grid-column:1/-1;padding-top:6px}}
/* the invoice's client link in the form (2026-12-03) */
.share{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:var(--r-card,12px);background:var(--default,#f4f4f5);margin:4px 0 8px}
.share > .ic{flex:none;color:var(--muted)}
.share-text{flex:1;font-size:13px;color:var(--muted)}
.share-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.share-url{font-size:13px;height:32px}
.pub-lines{display:flex;flex-direction:column}
.pub-lines .pub-h{margin-top:0}
.pub-line{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-top:1px solid var(--separator,#0000000f);font-variant-numeric:tabular-nums}
.pub-line > span:last-child{white-space:nowrap}
.pub-sub{color:var(--muted);font-size:13px;padding:4px 0}
.pub-total{font-weight:600;font-size:16px}
.pub-toggle{align-self:center}
/* the QR to the client's invoice link, bottom left of the invoice (2026-12-04) */
.lx-qr{display:flex;align-items:flex-end;gap:8px;padding-top:4px}
.lx-qr svg{width:58px;height:58px;flex:none;display:block}
.lx-qr small{font-size:7.5px;line-height:1.3;max-width:90px;color:#111}
/* client page: "Atvērt telefonā" QR next to the sum, computers only (2026-12-04) */
.pub-sum-row{display:flex;justify-content:space-between;align-items:flex-end;gap:16px}
.pub-qr{display:none;flex-direction:column;align-items:center;gap:6px;color:var(--muted);font-size:12px}
.pub-qr svg{width:88px;height:88px;display:block}
@media (min-width:700px) and (hover:hover){.pub-qr{display:flex}}
/* client page as a ticket card (2026-12-04, after the "Invoice & Payment Summary" widget on Dribbble) */
.pub-body{background:#eceef2}
.tk{--tk-bg:#fff;--tk-page:#eceef2;--tk-line:#c9ccd4;width:100%;max-width:440px;margin:24px auto 0;background:var(--tk-bg);border-radius:20px;
  box-shadow:0 1px 2px #0000000a,0 12px 32px -12px #0000001f;color:#111}
.tk-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:18px 20px 14px;border-bottom:1px dashed var(--tk-line)}
.tk-label{margin:0;font:500 12px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.08em;text-transform:uppercase;color:#6b7280}
.tk-body{padding:20px}
.tk-amount{margin:0;font-size:34px;font-weight:600;letter-spacing:-.02em;font-variant-numeric:tabular-nums;line-height:1.1}
.tk-amount span{font-size:18px;font-weight:500;color:#6b7280;letter-spacing:0}
.tk-by{margin:4px 0 0;color:#6b7280;font-size:14px}
.tk-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px 12px;margin:22px 0 0}
.tk-cell{min-width:0}
.tk-cell.tk-wide{grid-column:1/-1}
.tk-cell dt{font-size:12px;color:#6b7280;margin-bottom:3px}
.tk-cell dd{margin:0;font-size:14px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.tk-copy{margin-left:6px;padding:0;border:0;background:none;color:var(--accent,#2563eb);font:inherit;font-size:12px;font-weight:500;cursor:pointer}
.tk-copy:hover{text-decoration:underline}
.tk-lines{margin-top:22px;border-top:1px solid #eef0f3}
.tk-line{display:flex;justify-content:space-between;gap:12px;padding:9px 0;font-size:14px;font-variant-numeric:tabular-nums;border-bottom:1px solid #eef0f3}
.tk-line > span:last-child{white-space:nowrap}
.tk-line small{color:#6b7280}
.tk-sub{color:#6b7280;font-size:13px;padding:6px 0}
.tk-total{border-bottom:0;font-weight:600;font-size:15px;padding-top:12px}
/* the perforation: a dashed line with a round notch on each side, cut in the page colour */
.tk-cut{position:relative;height:0;border-top:1.5px dashed var(--tk-line);margin:4px 18px}
.tk-cut::before,.tk-cut::after{content:"";position:absolute;top:-12px;width:24px;height:24px;border-radius:50%;background:var(--tk-page);box-shadow:inset 0 1px 2px #0000000d}
.tk-cut::before{left:-30px}
.tk-cut::after{right:-30px}
.tk-foot{display:flex;align-items:center;gap:14px;padding:18px 20px 20px}
.tk-qr{display:none;flex-direction:column;align-items:center;gap:4px;font-size:10px;color:#6b7280;flex:none}
.tk-qr svg{width:64px;height:64px;display:block}
@media (min-width:700px) and (hover:hover){.tk-qr{display:flex}}
.tk-actions{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px}
.tk-btn{display:flex;align-items:center;justify-content:center;gap:8px;height:48px;border:0;border-radius:12px;background:var(--accent,#2563eb);color:#fff;
  font:500 15px/1 var(--font-sans);cursor:pointer;transition:filter .15s}
.tk-btn:hover{filter:brightness(1.08)}
.tk-btn:disabled{opacity:.7;cursor:progress}
.tk-btn .ic{width:16px;height:16px}
.tk-links{display:flex;justify-content:center;gap:16px}
.tk-link{border:0;background:none;padding:2px 0;color:#4b5563;font:500 13px/1.2 var(--font-sans);cursor:pointer}
.tk-link:hover{color:#111;text-decoration:underline}
.pub-body .pub-sheet{margin-top:8px}
@media (max-width:480px){.tk{margin-top:8px;border-radius:16px}.tk-amount{font-size:30px}.tk-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.tk-grid .tk-cell:nth-child(3){grid-column:1/-1}}
