/* Shared workspace UI: the "?" help bubble and the layout pieces every upgraded page reuses.
   Tokens come from coolhanx.css (this file only composes them). A page-specific rule goes in
   static/page-<name>.css, not here. */

/* ---- "?" help bubble (ui.js) ---- */
.qh{flex:none;display:inline-grid;place-items:center;width:17px;height:17px;margin-left:6px;padding:0;border:1px solid var(--line-2);border-radius:50%;background:var(--surface-2);color:var(--muted);font:700 .7rem/1 var(--sans);vertical-align:middle;cursor:help}
.qh:hover,.qh:focus-visible,.qh[aria-expanded=true]{border-color:var(--accent);color:var(--accent-strong);background:var(--accent-soft)}
.qh-host{display:inline-block}
.qh-host[hidden]{display:none}
.qh-pop{position:fixed;z-index:1000;max-width:320px;padding:9px 12px;border-radius:8px;background:var(--ink);color:var(--ground);box-shadow:var(--sh-2);font-size:.8rem;line-height:1.45;font-weight:500;text-align:left;text-transform:none;letter-spacing:0}
.qh-pop[hidden]{display:none}

/* ---- sticky work bar: the page's own actions and status, always in reach ---- */
.content.sticky-bar{overflow:visible}
.work-bar{position:sticky;top:0;z-index:6;display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 -26px 12px;padding:8px 26px;background:var(--ground);border-bottom:1px solid var(--line)}
.work-bar .grow{flex:1 1 auto}
.work-bar .status{font-size:.82rem;color:var(--muted)}
.work-bar .status.ok{color:var(--good)} .work-bar .status.err{color:var(--crit)}
.work-bar .tot{font-size:.82rem;color:var(--muted)} .work-bar .tot b{color:var(--ink);font-size:1rem}

/* ---- two columns instead of a stack of full-width rows ---- */
.cols-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
.cols-main-side{display:grid;grid-template-columns:minmax(0,2fr) minmax(300px,1fr);gap:14px;align-items:start}
.cols-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:start}
.stack-14{display:flex;flex-direction:column;gap:14px}
@media(max-width:1100px){.cols-2,.cols-main-side,.cols-3{grid-template-columns:minmax(0,1fr)}}
.card-pad{padding:14px 18px 16px}

/* ---- a row of figures above a list ---- */
.stat-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:14px}
.stat{padding:11px 14px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);min-width:0}
.stat .lab{font-size:.74rem;font-weight:700;color:var(--muted)}
.stat .val{font-size:1.25rem;font-weight:800;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat .sub{font-size:.74rem;color:var(--muted)}
.stat.crit .val{color:var(--crit)} .stat.warn .val{color:var(--warn)} .stat.good .val{color:var(--good)}

/* ---- a tab bar that only hides panels, so what was typed in another tab stays ---- */
/* Tabs read as tabs: each one is a raised tab on a shared rule; the selected one is paper-white, joined to the
   panel below it, with an accent bar on top. The others sit back on the page colour. */
.tabs{display:flex;gap:4px;align-items:flex-end;border-bottom:1px solid var(--line-2);margin-bottom:14px;overflow-x:auto;padding:0 2px}
.tabs [role=tab]{margin-bottom:-1px;padding:10px 16px;background:var(--surface-2);border:1px solid var(--line);border-bottom-color:var(--line-2);border-radius:10px 10px 0 0;color:var(--ink-2);font:inherit;font-size:.9rem;font-weight:650;white-space:nowrap;cursor:pointer;transition:background .12s,color .12s}
.tabs [role=tab]:hover{background:var(--surface);color:var(--ink)}
.tabs [role=tab][aria-selected=true]{background:var(--surface);color:var(--accent-strong);border-color:var(--line-2);border-bottom-color:var(--surface);box-shadow:inset 0 3px 0 var(--accent);font-weight:800}
.tabs [role=tab]:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.tabs [role=tab] .badge{margin-left:6px}

/* ---- Belegliste (Rechnungen, Eingang): ticking rows, the toolbar above a list of documents, the sort order,
   the "Details" switch, the drop zone and the empty panel. Page-specific rules stay in page-<name>.css. ---- */
.bl-bar{display:flex;align-items:center;gap:6px 14px;flex-wrap:wrap;min-height:44px;padding:6px 12px 6px 14px;border-bottom:1px solid var(--line)}
.bl-bar .grow{flex:1 1 auto}
.bl-all{display:inline-flex;align-items:center;gap:8px;font-size:.84rem;font-weight:650;cursor:pointer}
.bl-all input,.bl-ck input{width:16px;height:16px;margin:0;accent-color:var(--accent);cursor:pointer}
.bl-ck{width:36px;padding-left:12px;padding-right:0;text-align:left}
.bl-sel{display:inline-flex;align-items:center;gap:6px;flex-wrap:nowrap}
.bl-sel[hidden]{display:none}
.bl-sel .n{font-size:.82rem;font-weight:800;margin-right:2px}
.bl-sel .btn{width:auto;padding:4px 10px;font-size:.78rem}
.bl-sort{display:inline-flex;align-items:center;gap:7px;font-size:.78rem;font-weight:650;color:var(--muted)}
.bl-sort select{width:auto;padding:5px 8px;font:inherit;font-size:.8rem;font-weight:600;background:var(--surface-2);border:1px solid var(--line-2);border-radius:7px;color:var(--ink)}
.bl-switch{display:inline-flex;align-items:center;gap:7px;padding:3px 2px;background:none;border:0;color:var(--ink);font:inherit;font-size:.8rem;font-weight:650;cursor:pointer}
.bl-switch .trk{position:relative;flex:none;width:30px;height:17px;border-radius:999px;background:var(--line-2);transition:background .15s}
.bl-switch .trk::after{content:"";position:absolute;left:2px;top:2px;width:13px;height:13px;border-radius:50%;background:var(--surface);box-shadow:0 1px 2px rgba(0,0,0,.3);transition:transform .15s}
.bl-switch[aria-checked=true] .trk{background:var(--accent)}
.bl-switch[aria-checked=true] .trk::after{transform:translateX(13px)}
.bl-seg{display:inline-flex;flex:none;padding:2px;gap:2px;background:var(--surface-2);border:1px solid var(--line-2);border-radius:9px}
.bl-seg button{width:auto;padding:5px 13px;white-space:nowrap;border:0;border-radius:7px;background:none;color:var(--muted);font:inherit;font-size:.84rem;font-weight:700;cursor:pointer}
.bl-seg button[aria-checked=true]{background:var(--surface);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.18)}
.bl-dir{display:inline-block;margin-right:6px;padding:0 6px;border-radius:5px;font-size:.66rem;font-weight:800;letter-spacing:.02em;vertical-align:baseline}
.bl-dir.out{background:var(--accent-soft);color:var(--accent-strong)}
.bl-dir.in{background:var(--surface-2);color:var(--ink);border:1px solid var(--line-2);padding-top:0;padding-bottom:0}
.bl-drop{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin:0 0 10px;padding:9px 14px;border:1.5px dashed var(--line-2);border-radius:10px;background:var(--surface-2);color:var(--muted);font:inherit;font-size:.84rem;font-weight:650;cursor:pointer;box-sizing:border-box}
.bl-drop:hover,.bl-drop.over{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-strong)}
.bl-empty{display:grid;place-items:center;text-align:center;min-height:150px;padding:24px 20px;color:var(--muted);font-size:.86rem;line-height:1.45}
.bl-empty b{display:block;margin-bottom:4px;color:var(--ink);font-size:.92rem}
/* Master-detail pages: until a row is selected the detail panel has nothing to show, so it takes no room and the
   list uses the whole width; selecting a row brings the panel (and the second column) back. */
.bl-empty-host:has(.bl-empty){display:none}
:has(>.bl-empty-host .bl-empty){grid-template-columns:minmax(0,1fr)!important}

/* ---- Zeitraum-Picker (ui.js, CHXPeriod): year / quarter / month with step buttons ---- */
.per{display:inline-flex;align-items:center;gap:4px}
.per select,.per .per-nav{height:32px;border:1px solid var(--line-2);border-radius:7px;background:var(--surface-2);color:var(--ink);font:inherit;font-size:.84rem;font-weight:600}
.per select{padding:0 8px;width:auto;cursor:pointer}
.per select[hidden]{display:none}
.per .per-nav{display:inline-grid;place-items:center;width:30px;padding:0;color:var(--muted);font-size:1.1rem;line-height:1;cursor:pointer}
.per .per-nav:hover,.per select:hover{border-color:var(--accent);color:var(--accent-strong)}

/* ---- Konto ohne Mandant (appnav.js, CHXNoTenant): one card in place of a page that cannot work ---- */
.content.nt-on > :not(.nt-card){display:none!important}
.nt-card{max-width:560px;margin:64px auto;padding:26px 30px}
.nt-card h2{margin:0 0 8px;font-size:1.15rem}
.nt-card p{margin:0 0 18px;color:var(--muted);line-height:1.5}
.nt-acts{display:flex;gap:10px;flex-wrap:wrap}
.nt-acts .btn{width:auto}
aside.side a.nav.nt-dim{opacity:.42}
aside.side a.nav.nt-hi{background:var(--accent-soft);color:var(--accent-strong);font-weight:700}

/* ---- Belegliste: lists that are still loading, the Brutto | Netto switch ---- */
.sk{display:inline-block;height:.85em;min-width:3em;border-radius:5px;vertical-align:middle;background:linear-gradient(90deg,var(--line) 25%,var(--surface-2) 45%,var(--line) 65%);background-size:220% 100%;animation:sk-pulse 1.3s ease-in-out infinite}
.sk-row td{padding:11px 14px!important;border-bottom:1px solid var(--line)}
.sk-row .sk{display:block;height:15px}
.rn-fig b:empty::before,.eg-fig b:empty::before{content:"";display:inline-block;width:5.2em;height:.8em;border-radius:5px;background:linear-gradient(90deg,var(--line) 25%,var(--surface-2) 45%,var(--line) 65%);background-size:220% 100%;animation:sk-pulse 1.3s ease-in-out infinite}
@keyframes sk-pulse{from{background-position:130% 0}to{background-position:-90% 0}}
@media(prefers-reduced-motion:reduce){.sk,.rn-fig b:empty::before,.eg-fig b:empty::before{animation:none}}
.bl-seg-s button{padding:3px 10px;font-size:.78rem}
.eg-lnk{font-size:.78rem;font-weight:650;color:var(--accent-strong);text-decoration:none;white-space:nowrap}
.eg-lnk:hover,.eg-lnk:focus-visible{text-decoration:underline}

/* Narrow window or zoomed to 300-400 % (WCAG 1.4.10: 320 CSS px, no sideways page scroll). The pages set the tab row to
   overflow:visible so a "?" bubble can leave it, and an overflow:visible flex item never shrinks below its content - a
   row of tabs then pushed the page 100-480 px wider than the screen on every tabbed page (measured 2026-11-21 at 375 px).
   Wrapping keeps every tab visible and nothing hides behind a scroll strip. */
@media(max-width:720px){
  .tabs{flex-wrap:wrap;min-width:0;max-width:100%}
  .work-bar{margin-left:-14px;margin-right:-14px;padding-left:14px;padding-right:14px}
  /* the other rows that held their content on one line: page-head actions, the setup bar, the reminder list head,
     the evaluation controls, the empty-state sentence of the receipts list */
  .content .ph-actions,.content .ob-slim .ob-head,.content .mw-listhead,.content .au-ctl{flex-wrap:wrap;max-width:100%}
  .content .bl-empty .bl-sub{white-space:normal}
}
