/* app/css/app.css — Phase 4 shell rules on top of the synced tokens.css and components.css (never edited).
   Tokens only, no raw colour values. This file starts with the base block the mockups get from
   design/mockups/_shell.css, which the app never imports (04-UI-SPEC "Phase 4 additions", row base);
   the other Phase 4 additions land in 04-21. */

@import './calendar.css';
@import './electricity-outcome.css';

/* ---------- base ---------- */
*,*::before,*::after{box-sizing:border-box}
html{overflow-y:auto;scrollbar-gutter:stable}
body{margin:0;background:var(--paper);color:var(--label-1);font-size:var(--t-body);line-height:var(--lh-body);letter-spacing:var(--tracking-body);-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-rendering:optimizeLegibility;min-height:100dvh}
button{font:inherit;color:inherit}
/* the hidden attribute always wins: component display rules (.hint{display:flex}, ...) must never reveal an element
   the app hid, e.g. the error line of ui.feld() or the S3 inline error */
[hidden]{display:none !important}

/* ---------- Phase 4 additions (04-UI-SPEC "Phase 4 additions"; 04-21) ---------- */

/* D-50: the accessible Large Title scrolls in the content; navbar.js mirrors its inline form. */
:where(html.has-navbar #screen > main) h1{
  font-size:var(--type-task-phone);font-weight:var(--w-title);line-height:1.18;letter-spacing:-.0125em;margin:0 0 var(--page-title-gap);text-align:left;overflow-wrap:anywhere}
@media (min-width:768px){:where(html.has-navbar #screen > main) h1{
  font-size:var(--type-task);letter-spacing:-.0175em}}
.page-heading{margin:0 0 var(--page-title-gap);min-width:0}
.page-heading > h1{margin:0}
.page-heading > [data-page-context]{margin:var(--gap-related) 0 0}
.page-heading > [data-page-subtitle]{margin:var(--gap-content) 0 0}
.page-heading > [data-page-status]{margin:var(--gap-content) 0 0}

/* back or cancel above a screen title (S2 while reading, S3, S4, S5, S6); holds one .btn--plain (D-01, D-02) */
.topbar{display:flex;align-items:center;min-height:var(--target-min);margin-top:var(--sp-2)}

/* calm (non-warning) lines: S3, the S5 tie, #sitz; .is-ok gives the icon --success (10-02) */
.calm-hint{display:flex;align-items:flex-start;gap:var(--sp-2);margin:var(--sp-1) 0 0;color:var(--label-2);font-size:var(--t-subhead);line-height:var(--line-control)}
.calm-hint .icon{flex:none;width:18px;height:18px;margin-top:1px;color:var(--label-2)}
.calm-hint.is-ok .icon{color:var(--success)}
/* input quality (Roux 18 October 2026): one line under a typed field, after its label; a suggestion's one action
   leads under the text, aligned with it (D-39) */
.field-hint{grid-column:1 / -1;display:flex;flex-direction:column;align-items:flex-start;min-width:0;margin-top:var(--sp-2)}
.field-hint > :is(.hint,.calm-hint){margin:0}
.field-hint > .field-hint__action{margin-inline-start:calc(18px + var(--sp-2))}

/* #sitz (D-16): the Gemeinde choice is one column; each item shows the name and the Kreis as a second line */
.choice__sub{color:var(--label-2);font-size:var(--t-subhead);font-weight:var(--weight-body)}
.sitz-detail{display:flex;flex-direction:column;gap:var(--sp-2)}
.sitz-detail > .q-sub{margin:0}

/* per-file remove on S1 (D-03): a 44 x 44 round icon button, close icon 20 px */
.file-row:has(> .file-row__remove){grid-template-columns:auto minmax(0,1fr) auto auto}
.file-row__remove{flex:none;display:inline-flex;align-items:center;justify-content:center;width:var(--target-min);height:var(--target-min);margin-right:calc(var(--sp-3) * -1);padding:0;border:0;border-radius:50%;background:none;color:var(--label-2);cursor:pointer}
.file-row__remove .icon{width:20px;height:20px;color:var(--label-2)}

/* S5 criterion: the DOM wrapper preserves the existing three-track row; the updown glyph follows its value. */
.row__select-wrap{display:contents}
.row__select{appearance:none;-webkit-appearance:none;min-width:0;min-height:var(--target-min);margin:0;padding:0 var(--sp-1);border:0;border-radius:var(--r-control);background:transparent;color:var(--label-2);font:inherit;font-size:var(--t-body);font-weight:var(--weight-body);text-align:right;text-align-last:right;cursor:pointer}
.row__select option{background:var(--surface);color:var(--label-1)}
.row__select + .icon{width:16px;height:16px;--icon-stroke:2.25px;color:var(--label-3);pointer-events:none}

/* Shared quantity bars and their noneditable units are defined in components.css. */

/* K3: the read words inside a source snippet. Weight 600 is the non-colour cue (ink vs label-2 is only 2.4-2.63:1) */
.row__source mark{background:none;color:var(--label-1);font-weight:var(--weight-strong)}

/* the one destructive action (trust.sheet.delete, trust.sheet.delete_yes): plain buttons only, underlined, error on
   --surface is 6.54:1 (10-UI-SPEC §8.1). Never on .btn--secondary or any fill. */
.btn--plain.btn--destructive{color:var(--error)}
.btn--plain.btn--destructive:disabled,.btn--plain.btn--destructive[aria-disabled="true"]{color:var(--label-4)}

/* data-source and connect-src lines: label-2 is 6.12:1 on --surface. T2 (10-02): Figtree with tabular figures, not the UA monospace */
.sheet__code{margin:var(--sp-1) 0 0;color:var(--label-2);font-family:inherit;font-size:var(--t-footnote);font-weight:var(--weight-body);font-variant-numeric:tabular-nums;font-feature-settings:"tnum";overflow-wrap:anywhere}

/* one polite live region per open sheet: #ansage is outside the modal <dialog> and inert while it is open */
.sheet__ansage{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* sheets are native <dialog> elements opened with showModal() (D-13): focus trap, Escape, top layer.
   The reset undoes the UA dialog box; position, padding, radius and colours stay as components.css draws .sheet. */
dialog.sheet{margin:0;border:0;max-width:none}
dialog.sheet{scrollbar-gutter:stable}
/* components.css gives .sheet:has(> .sheet__footer) display:flex, which would show a closed dialog */
dialog.sheet:not([open]){display:none}
@media (max-width:767px){
  /* Mobile text enlargement can widen the layout viewport beyond the visible one. */
  dialog.sheet{top:auto;min-width:0;width:calc(var(--vv-w,100vw) - var(--sheet-inset) * 2);max-width:calc(var(--vv-w,100vw) - var(--sheet-inset) * 2)}
}
/* tokens.css declares --scrim on :root, ::backdrop, so the backdrop needs no literal fallback (10-02) */
dialog.sheet::backdrop{background:var(--scrim)}
/* a modal sheet: the page behind it does not scroll (03-review apportion and meter states) */
html:has(dialog.sheet[open]){overflow:hidden}

/* browsers that cannot run the app: hidden while main.js boots; if html never gets data-ready, the text
   appears after 5 s. A visibility switch, not motion, so it runs under every motion preference and needs no script. */
.boot-fail{display:none;margin:var(--sp-12) 0 0;color:var(--label-1);font-size:var(--t-body);line-height:var(--line-copy)}
html:not([data-ready]) .boot-fail{display:block;visibility:hidden;animation:boot-fail-zeigen 0s linear 5s forwards}
@keyframes boot-fail-zeigen{to{visibility:visible}}
/* Roux 19 Oct 2026 audit (261019-aud B2-04): the boot failure has the start screen's logo, the text in the browser's
   language (German first without scripts) and one way forward, „Link kopieren“, where the browser can copy. The logo
   is the header's own lockup: it appears with the text, while the rest of the pre-script header stays hidden. */
.boot-fail > p{margin:0;text-align:start}
.boot-fail > p + p{margin-top:var(--gap-group)}
.boot-fail > .boot-fail__copy{margin-top:var(--sp-8)}
@media (max-width:767px){.boot-fail > .boot-fail__copy{width:100%}}
html:not([data-ready]):not(.has-navbar) #navbar .navbar__brand{visibility:hidden;animation:boot-fail-zeigen 0s linear 5s forwards}

/* ---------- large text (WCAG 1.4.4; 04-19 gate: 200 % root font size on S1, S3, S5, S6) ---------- */
/* nothing clips or overlaps when the owner enlarges the text: the header wraps, long German words break,
   the numeral stays inside a phone screen, and narrow columns (in em, so only at large text or on very small
   screens) stack the row label above its value; a narrow month row shows every second label */
.navbar__row{overflow-wrap:break-word}
.navbar .pill{white-space:normal}
#screen :where(h1,h2,h3,p,label,summary,li,.row__label,.row__source,.file-row__meta){overflow-wrap:break-word}
html.text-enlarged :is(#screen,dialog.sheet) :where(h1,h2:not(.q-section-title)){overflow-wrap:anywhere;hyphens:auto}
/* Roux 19 Oct 2026 audit (261019-aud A2-25, B2-23, 200 % summary): at large text every long word breaks at a syllable
   with a hyphen in the page language („Datenschutz-erklärung“), never mid-syllable without one; headings keep theirs.
   The filing guide keeps its plain breaks: its anchored step selection (261019-aud F6) holds a tapped step's header
   still from the layout it measured, and a late hyphenated reflow there let the header pass under the navbar
   (ausfuellen.e2e, phone 200 %). */
html.text-enlarged :is(#screen > main:not(.s-einreichen),dialog.sheet,.start-menu,#banners){hyphens:auto}
/* a search placeholder longer than the field ends in an ellipsis, so the owner sees there is more („z. B…“) */
html.text-enlarged .search__input{text-overflow:ellipsis}
/* Roux 19 Oct 2026 audit (261019-aud A2-25, B2-13): at large text a phone sheet is docked to the bottom edge, so no
   strip of the page behind shows below it. */
@media (max-width:767.98px){
  html.text-enlarged :is(dialog.sheet,dialog.sheet[data-detent]){left:0;right:0;bottom:var(--vv-bottom,0px);width:var(--vv-w,100vw);max-width:var(--vv-w,100vw);
    border:0;border-radius:var(--r-sheet) var(--r-sheet) 0 0}
}
.numeral{font-size:min(var(--t-display),22vw)}
#screen > main{container-type:inline-size}
@container (width < 20em){
  .row > .row__label,.row > .row__value{grid-column:1 / -1}
  /* a trailing icon keeps its own column, centred against the stacked label and value */
  .row:has(> .icon:not(:first-child)) > :is(.row__label,.row__value){grid-column:1 / -2}
  .row > .row__value{text-align:left;white-space:normal;overflow-wrap:anywhere}
}
/* the month labels measure their own list, in caption em: twelve labels need about 24 of them */
.cov__months{container-type:inline-size;font-size:var(--t-caption)}
@container (width < 24em){
  .cov__months li:nth-child(even) .cov__m{visibility:hidden}
  .cov__months li:nth-child(odd) .cov__m{width:calc(200% + 2px)}
}
/* 10-05 (310 % backstop): at very large text every third label, each over three cells */
@container (width < 12em){
  .cov__months li .cov__m{visibility:hidden}
  .cov__months li:nth-child(3n+1) .cov__m{visibility:visible;width:calc(300% + 4px)}
}

/* Phase 5 additions (05-11): the one-time licence status line in #banners and the plain sentence of a
   message sheet (S1 import of last year's case) */
/* 10-04: a white banner card under the header capsule keeps the card gap */
#banners{container-type:inline-size}
#banners > .banner{margin-top:var(--sp-3)}
.banner--status{align-items:flex-start;padding-top:var(--sp-2);padding-bottom:var(--sp-2);line-height:var(--line-control)}
.banner--status .banner__text{flex:1;min-width:0;padding:var(--sp-2) 0;overflow-wrap:anywhere}
@container(width < 20em){
  .banner--status .banner__text{flex-basis:100%}
  .banner--status > .btn{margin-inline-start:auto}
}
.sheet__text{margin:0 0 var(--sp-4);color:var(--label-1);font-size:var(--t-callout);line-height:var(--line-copy)}

/* Phase 7 (07-17): the photo-reader sheet opens on #aufnahme and #lesen alike; its facts list and small notes are
   the 02-reading.html photo-state rules (lesen.css scopes them to main.s-lesen), here for every sheet, at zero
   specificity so S2's own rules still win there */
:where(dialog.sheet) .facts{margin:var(--sp-5) 0 var(--sp-6);padding:0;list-style:none;display:flex;flex-direction:column;gap:var(--sp-3)}
:where(dialog.sheet) .facts li{display:flex;align-items:flex-start;gap:var(--sp-3);color:var(--label-2);font-size:var(--t-subhead);line-height:var(--line-control)}
:where(dialog.sheet) .facts .icon{flex:none;width:20px;height:20px;margin-top:1px;color:var(--label-2)}
:where(dialog.sheet) .facts .is-ok .icon{color:var(--tint)}
:where(dialog.sheet) .footnote{margin:var(--sp-3) 0 0;color:var(--label-2);font-size:var(--t-subhead);line-height:var(--line-body);font-feature-settings:"tnum"}
:where(dialog.sheet) .foto-sheet .progress{margin-top:var(--sp-4)}
:where(dialog.sheet) .foto-sheet .progress__bar{background:var(--accent)}
:where(dialog.sheet) .foto-sheet .hint{margin-top:var(--sp-4)}

/* ---------- UI polish (04-UI-REVIEW, 04-22; selectors as 10-UI-SPEC §8) ---------- */
/* V1: an element the app focuses by script (tabindex="-1": every screen h1, the S6 .hero-label, sheet titles, the
   delete confirm block) draws no ring; focus still moves there, so screen readers announce it. It beats the global
   :focus-visible of tokens.css. Interactive elements are excluded, so a roving radio (tabindex -1 until chosen)
   and every button reached with Tab keep their --focus-ring-width ring. */
:is(#screen, dialog.sheet) [tabindex="-1"]:not(button, a[href], input, select, textarea, summary, [role="radio"], [role="button"]):focus{outline:none}
/* The final reference uses natural text flow. Component-specific measures still win. */
:where(#screen :is(h1, h2, .q-title), dialog.sheet .sheet__title){text-wrap:wrap;overflow-wrap:anywhere}
:where(#screen p, dialog.sheet p){text-wrap:wrap}
/* V5 (04-23, as 10-UI-SPEC §8.4): the reader's cell gap in a source snippet is space, not a „|“ glyph */
.row__gap{margin-inline:.5em}
/* S5/X2 (04-24, as 10-UI-SPEC §8.5): a block scrolled into view with block 'nearest' stops above the sticky footer */
dialog.sheet{scroll-padding-bottom:calc(var(--button-h) + var(--sp-12))}

/* Native navbar proxies preserve the original control and its handlers in the DOM. */
html.has-navbar #screen [data-navbar="trailing"]{display:none}

/* Approved task rhythm: the native bar owns navigation, then one content inset.
   Entry has its own composition; material screens keep their original field/state DOM. */
html.has-navbar #screen > main{padding-top:var(--page-top-gap)}
dialog.sheet .sheet__head{position:sticky;top:0;z-index:2;background:var(--surface)}
/* The header already supplies the opening inset; only the first content edge loses its extra margin. */
dialog.sheet > .sheet__head + :not(.sheet__footer,.sheet__ansage),dialog.sheet > .sheet__head + .sheet-body > :first-child{margin-block-start:0}
@media (max-width:767.98px){dialog.sheet{max-height:calc(var(--vv-h,100dvh) - env(safe-area-inset-top,0px) - var(--sp-6))}}
/* An unfinished input retains its original grammar across UI-language changes. */
.input-format-hint:empty{display:none}

/* Content-group movement never creates a containing block for the fixed action bar. */
html[data-nav]{overflow-x:clip}
html[data-nav] body{overflow-x:clip}
.motion-presentation{pointer-events:none;user-select:none}
.motion-presentation,.motion-presentation *{pointer-events:none!important;animation:none!important;transition:none!important;caret-color:transparent!important;outline:none!important}
.local-motion-ghost{pointer-events:none;will-change:height,opacity,clip-path}
[data-local-flow]{isolation:isolate}

/* Hidden spoken unit names use ordinary text flow without changing the visible unit column. */
.field__unit-description{text-align:start}
