/* Ertenü Buchhaltung - the app's one stylesheet.
   Tokens and component metrics follow design/ertenu.css (direction B); the selectors are the
   app's own markup. Do not load ertenu.css next to this file - see design/STAGE1.md. */
:root{
  /* surfaces and text */
  --bg:#0e1116; --panel:#161b22; --panel2:#1c232c; --field:#0f141a;
  --line:#2a323d; --line2:#232a34; --line3:#3a4553;
  /* The edge of a form control. --line on --field is 1.3:1 and WCAG 1.4.11 wants 3:1 for the
     boundary of an input; this is 4.1:1 on --field and 3.8:1 against the panel around it. */
  --ctl:#6b7887;
  --ink:#e7edf5; --dim:#96a3b4; --faint:#8492a3;      /* faint was #6b7887: 3.8:1 on the panel, now 5.4:1 */
  /* status: overdue / attention / fine / information. Never series colours. */
  --red:#ff6b6b;   --redbg:#2a1519;   --redline:#5a2730;   --redtrack:#3b1d22;
  --amber:#ffb454; --amberbg:#2a2114; --amberline:#57431d; --ambertrack:#3b2f18;
  --green:#4ec9a0; --greenbg:#132620; --greenline:#23503f; --greentrack:#16302a;
  --blue:#6aa9ff;  --bluebg:#131f2e;  --blueline:#274469;
  /* the one accent: primary action and selection */
  --accent:#1d3a5f; --accent-line:#2c5486; --accent-ink:#cfe3ff;
  --sel:#6aa9ff; --sel-ink:#0b1421;
  /* what lies over the page: the tab bar's own ground, the dimming behind a sheet, its shadow */
  --bar:rgba(14,17,22,.96); --scrim:rgba(4,6,9,.62); --shadow:0 18px 50px rgba(0,0,0,.5);
  /* type: six steps */
  --sans:-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  --mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace;
  --t-xs:12px; --t-sm:13px; --t-md:15px; --t-lg:17px; --t-xl:22px; --t-hero:40px;
  /* space: 4px base */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:20px; --s6:24px; --s8:32px;
  /* radius: three, plus the pill */
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-pill:999px;
  --tap:44px;                 /* the smallest thing a thumb is asked to hit */
  /* Home Screen web apps run under the status bar (apple-mobile-web-app-status-bar-style
     is black-translucent), so every edge has to respect the safe area. Named here so the
     layout can be tested by overriding them. */
  --sat:env(safe-area-inset-top,0px);
  --sar:env(safe-area-inset-right,0px);
  --sab:env(safe-area-inset-bottom,0px);
  --sal:env(safe-area-inset-left,0px);

  /* Floor for the top, because the inset alone is not enough to rely on:
       - in Safari, safe-area-inset-top is 0 in portrait, so the header landed 8px under the
         URL bar and read as having no margin at all;
       - in a Home Screen app iOS does not always report an inset even though the web view
         really is running under the status bar.
     Whichever is larger wins, so a device that reports a proper 59px inset is unaffected. */
  --top-min:0px;
  /* Extra clearance under a translucent status bar. Sitting exactly at the inset boundary
     puts the logo flush against the clock; this is the gap between them. */
  --top-extra:0px;
  /* Dark only for now: the phone draws white status-bar text over the page, so a light theme
     waits until that is tested on the device. This makes native pickers and checkboxes follow. */
  color-scheme:dark;
}
/* Only narrow viewports need the floor. On a desktop browser there is no status bar to
   clear and no inset to miss, and padding the header there would just make it lopsided. */
@media (max-width:860px){ :root{ --top-min:16px } }
/* Standalone: display-mode covers browsers that report it, .standalone is set from
   navigator.standalone in app.js, which is how iOS actually answers this. */
@media (display-mode:standalone),(display-mode:fullscreen),(display-mode:minimal-ui){
  :root{ --top-min:46px; --top-extra:10px }
}
html.standalone{ --top-min:46px; --top-extra:10px }
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  overscroll-behavior-y:none;
  background:var(--bg); color:var(--ink); font:var(--t-md)/1.5 var(--sans);
  font-variant-numeric:tabular-nums;      /* figures line up in columns without a mono face */
  -webkit-font-smoothing:antialiased;
}
a{color:var(--blue)}
h1,h2,h3{margin:0 0 .4em}
h1{font-size:var(--t-xl);line-height:1.25;font-weight:680;letter-spacing:-.02em}
h2{font-size:var(--t-lg);line-height:1.4;font-weight:650;letter-spacing:-.01em}
h3{font-size:var(--t-sm);font-weight:650;color:var(--dim);text-transform:uppercase;letter-spacing:.07em}
:where(button){font:inherit;color:inherit;margin:0;cursor:pointer}
/* One focus ring for everything a keyboard can reach. :focus-visible, so a tap does not draw it. */
:focus-visible{outline:2px solid var(--blue);outline-offset:2px}

a.logo{display:flex;align-items:center;gap:9px;text-decoration:none;color:var(--ink)}
.word{display:flex;flex-direction:column;line-height:1.15}
.word b{font-weight:700;font-size:var(--t-md);letter-spacing:-.02em}
.word i{font-style:normal;font-size:var(--t-xs);color:var(--dim);letter-spacing:.11em;text-transform:uppercase}
.saveState{font:var(--t-xs) var(--mono);color:var(--faint)}

/* ---------------- the shell ----------------
 * Left column of menu items, like the accounting software he was comparing this to, because
 * nine tabs across the top ran off the edge and a tab nobody can see is a feature nobody has.
 * Below 900px the column is not shown. app.js draws a tab bar and a "More" sheet from the
 * buttons in it - still one set of labels and icons - and moves the Business / Personal switch,
 * the sync state, the language switch and the UID line into the top bar and the sheet.
 */
:root{
  /* The tab bar above its own bottom padding, at its tallest: 1px edge, 8px, and a tab whose
     label takes two lines (28px icon, 3px, two lines of 12px/1.2). */
  --tabbar:69px;
  /* What the end of a screen has to clear. From 900px nothing lies over the content; below it
     the tab bar does, and --foot becomes its height (see "below 900px"). */
  --foot:calc(100px + var(--sab));
}
.shell{display:grid;grid-template-columns:238px minmax(0,1fr);min-height:100dvh}
.side{
  position:sticky;top:0;align-self:start;height:100dvh;display:flex;flex-direction:column;gap:14px;
  background:var(--panel);border-right:1px solid var(--line);overflow:hidden;
  padding:calc(16px + var(--top-extra) + max(var(--sat),var(--top-min))) 12px calc(14px + var(--sab)) calc(12px + var(--sal));
}
.side .logo{padding:2px 6px;gap:10px}
.side .logo .mark{width:32px;height:32px;flex:none}
.side .word i{display:block}
/* The list is what scrolls, not the column: the footer holds the sync state - the one sign that
   the figures are stale - and has to stay on screen. 4px of padding, taken back by the margin,
   keeps the scroll box from clipping a button's focus ring. */
.side nav{display:flex;flex-direction:column;gap:2px;flex:1;min-height:0;overflow-y:auto;margin:-4px;padding:4px}
/* A phone on its side leaves the list about one row between logo and footer. There the whole
   column scrolls instead, as it used to. */
@media (max-height:520px){ .side{overflow-y:auto} .side nav{flex:none;overflow:visible} }
.navgroup{
  font:650 var(--t-xs)/1 var(--sans);letter-spacing:.09em;text-transform:uppercase;
  color:var(--faint);padding:14px 10px 6px;
}
.navgroup:not(.show){display:none}
/* 36px rows: the column is worked with a pointer. With nine entries it needs 800px even so,
   more than a 1280x720 or 1024x768 window has: that is why the list scrolls (above). */
.side nav button{
  display:flex;align-items:center;gap:10px;width:100%;min-height:36px;text-align:left;
  background:none;border:1px solid transparent;color:var(--dim);padding:0 10px;border-radius:var(--r-md);
  font-size:var(--t-md);font-weight:550;
}
.side nav button svg{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;
  stroke-linecap:round;stroke-linejoin:round;opacity:.85}
.side nav button:hover{color:var(--ink);background:var(--panel2)}
.side nav button.on{background:var(--bluebg);color:var(--ink);border-color:var(--blueline)}
.side nav button.on svg{color:var(--blue);opacity:1}
.sidefoot{display:flex;flex-direction:column;gap:var(--s2);border-top:1px solid var(--line);padding-top:var(--s3)}
.uid{color:var(--faint);font:var(--t-xs)/1.4 var(--mono)}
.side .uid{overflow-wrap:anywhere}
.side .saveState{text-align:left;min-width:0}
.side .areasw{width:100%}
.side .areasw button{flex:1}
.sidefoot .seg button{min-height:30px}
/* the link to his Accounting brain (claude.ai): sidebar foot from 900px, the More sheet's foot below */
.brainLink{display:inline-flex;align-items:center;min-height:36px;color:var(--sel);font:600 var(--t-sm)/1.3 var(--sans);text-decoration:none}
.brainLink:hover{text-decoration:underline}

.topbar{
  position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:12px;
  background:rgba(14,17,22,.92);backdrop-filter:blur(8px);border-bottom:1px solid var(--line);
  padding:calc(10px + var(--top-extra) + max(var(--sat),var(--top-min))) calc(20px + var(--sar)) 10px 20px;
}
.topbar b{font-size:var(--t-md);font-weight:650;letter-spacing:-.01em}
/* The two places app.js moves things into. From 900px the left one is empty, and an empty flex
   item would still put its gap in front of the title. */
.topbook{flex:none}
.topbook:empty{display:none}
.topend{margin-left:auto;display:flex;align-items:center;gap:var(--s2);min-width:0}
.tabbar{display:none}

/* overflow-x:clip: the 44px hit areas around "?" marks and C/L/G tags (see "hover explanations")
   are invisible boxes that may reach a pixel past the 12px phone gutter. Clipped here they cannot
   make the page scroll sideways; clip, not hidden, so main does not become a scroll container. */
main{max-width:1180px;margin:0 auto;overflow-x:clip;
  padding:22px calc(20px + var(--sar)) var(--foot) 20px;}
section{display:none} section.on{display:block}

/* ---- below 900px: a tab bar and a More sheet instead of the sidebar ----
   "not all and (min-width:900px)" is exactly the other half of the matchMedia in app.js that
   moves the elements. max-width:899px would leave a zoomed window of 899.5px to neither. */
@media not all and (min-width:900px){
  :root{ --foot:calc(var(--tabbar) + max(var(--s2),var(--sab)) + var(--s4)) }
  /* a control reached with the keyboard is scrolled clear of the bar, not under it */
  html{scroll-padding-bottom:var(--foot)}
  .shell{grid-template-columns:minmax(0,1fr)}
  .side{display:none}
  #pageTitle{display:none}                      /* every screen has its own h1 */
  /* 12px a side instead of 16: "Business | Personal" and a sync word share 296px on the smallest phone */
  .topbar .areasw button{padding:4px var(--s3)}
  /* ...and 10px on the narrowest: at 320px "up to date" was 1px short of its line. */
  @media (max-width:340px){ .topbar .areasw button{padding:4px 10px} }
  /* Sync word and, under it, the save state: one column, and all of it is the sync button's
     target (see "Sync"), so the word needs no 44px box of its own. */
  .topend{position:relative;flex-direction:column;align-items:flex-end;justify-content:center;gap:2px;min-height:var(--tap)}

  /* The bar sits on the home indicator's inset, not under it. Tabs size to their labels: four
     equal columns would cut "Rechnungen" at 320px. */
  .tabbar{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;align-items:center;gap:var(--s2);
    padding:var(--s2) calc(var(--s2) + var(--sar)) max(var(--s2),var(--sab)) calc(var(--s1) + var(--sal));
    background:var(--bar);border-top:1px solid var(--line);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
  .tabs{flex:1;display:flex;min-width:0}
  /* Icons stand on one line (content from the top, not centred), whichever label wraps. A label
     of several words takes a second line ("Wohin es geht") before any tab gives up width; a
     word is never broken - no min-width:0 and no overflow-wrap here, either of which lets the
     row shrink "Haushalt" to "Hausha / lt" instead. 2px a side: at 320px the four German
     words of the business bar have 9px to spare, and none at 4px. */
  .tab{flex:1 1 auto;min-height:52px;display:flex;flex-direction:column;align-items:center;gap:3px;
    padding:0 2px;background:none;border:0;border-radius:var(--r-md);color:var(--dim);
    font:600 var(--t-xs)/1.2 var(--sans);text-align:center}
  .tab .ic{width:46px;height:28px;flex:none;display:flex;align-items:center;justify-content:center;
    border:1px solid transparent;border-radius:14px}
  /* The current tab: heavier, and a pill behind its icon - not the colour alone. The pill's edge
     is what weak eyes and sunlight get: --blue is 7.8:1 on the bar, where the fill (1.1:1) and
     --blueline (1.9:1) are not a shape at all. 700, because 650 is under 1% wider at 12px. */
  .tab[aria-current="page"]{color:var(--ink);font-weight:700}
  .tab[aria-current="page"] .ic{background:var(--bluebg);border-color:var(--blue);color:var(--blue)}
  .tab:focus-visible{outline-offset:-2px}       /* inside: outside it would leave the screen at the bottom edge */
  @media (hover:hover){ .tab:hover{color:var(--ink)} }
}

/* ---------------- sheet ----------------
   Design §12 and §16. More, the explanation of a term and every form are a <dialog class="sheet">
   opened with showModal(): the focus trap, Esc and the backdrop are the browser's. Here it is
   the bottom sheet of the phone; "from 900px" below makes it a centred dialog or a side panel.
   --vvh and --vvb come from app.js: the height of what the keyboard leaves of the window, and
   how far that ends above the window's lower edge. iOS lays its keyboard over the page without
   resizing it, so a sheet measured against the window keeps its footer under the keys. Where
   there is no visualViewport to ask, the window it is.
   The body is what scrolls. The sheet itself only does when head and footer leave the body
   less than a field's height - a phone on its side with the keyboard up (.squeezed, below). */
dialog.sheet{position:fixed;inset:auto 0 var(--vvb,0px) 0;width:auto;max-width:none;max-height:calc(var(--vvh,100dvh) * .92);margin:0;
  padding:0 var(--sar) 0 var(--sal);flex-direction:column;overflow:hidden auto;overscroll-behavior:contain;background:var(--panel);color:var(--ink);
  border:0;border-top:1px solid var(--line3);border-radius:var(--r-lg) var(--r-lg) 0 0;box-shadow:var(--shadow)}
dialog.sheet[open]{display:flex}                /* only when open: set on the element, a closed dialog would show */
/* A long form takes the whole height at once, so the footer does not move while he fills it in. */
dialog.sheet.full{height:calc(var(--vvh,100dvh) * .92)}
/* On the phone the sheet itself takes the focus when it opens (app.js). It is a place, not a
   control: no ring around the whole of it. */
dialog.sheet:focus-visible{outline:none}
/* Nor around a screen's heading, where the focus goes when the row a sheet was opened from is
   gone (app.js). */
h1:focus-visible{outline:none}
/* The page behind stays where it is. The list holds its own scroll (overscroll-behavior), but a
   swipe on the dimmed page, the grab handle or the footer moved the screen he had been reading. */
html:has(dialog.sheet[open]){overflow:hidden}
dialog.sheet::backdrop{background:var(--scrim)}
.sheet-grab{flex:none;width:36px;height:5px;margin:var(--s2) auto 0;border-radius:3px;background:var(--line3)}
.sheet-head{flex:none;display:flex;align-items:center;justify-content:space-between;gap:var(--s2);
  padding:var(--s1) var(--s2) var(--s1) var(--s4)}
.sheet-head h2{margin:0;min-width:0;overflow-wrap:anywhere}
.sheet-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;
  gap:var(--s5);padding:var(--s2) var(--s4) var(--s5)}
.sheet-body.flush{gap:0;padding:0 0 var(--s2)}  /* a list: the rows bring their own padding */
/* A form, or a paragraph: laid out top to bottom with its own margins, as it was in the dialog. */
.sheet-body.flow{display:block}
.sheet-body.flow>:first-child{margin-top:0}
.sheet-body.flow>:last-child{margin-bottom:0}
/* With no footer under it the body clears the home indicator itself. */
.sheet-body:last-child{padding-bottom:calc(var(--s5) + var(--sab))}
/* The home indicator's inset is not needed while the keyboard covers it. */
.sheet-foot{flex:none;display:flex;align-items:center;justify-content:space-between;gap:var(--s3);
  padding:var(--s3) var(--s4) calc(var(--s3) + max(0px,var(--sab) - var(--vvb,0px)));border-top:1px solid var(--line);background:var(--panel)}
.sheet-foot .uid{min-width:0;overflow-wrap:anywhere}
.sheet-foot .seg button{min-width:var(--tap);min-height:var(--tap)}      /* worked with a thumb */
/* A form's footer: what he decides on (the generator's totals, its status line), then the buttons. */
.sheet-foot.stack{flex-direction:column;align-items:stretch;gap:var(--s2)}
.sheet-foot .note{margin:0}
/* An empty line takes no room - but it stays in the page: it is the generator's status region
   (role="status"), and one that appears together with its first words is not read out. The
   margin takes back the gap it would otherwise leave. */
.sheet-foot .note:empty{height:0;margin-top:calc(-1*var(--s2));overflow:hidden}
/* The buttons: what else can be done with the entry (Delete, Preview, Print), then the way out
   and the way on. On a phone the two groups share a row while they fit and take one each when
   they do not; a long label wraps inside its button before it pushes the sheet wide. */
.btns{display:flex;flex-wrap:wrap;gap:var(--s2)}
.btns-more,.btns-main{display:flex;gap:var(--s2)}
.btns-more{flex:1 1 auto;flex-wrap:wrap}
.btns-main{flex:2 1 auto}
.btns-more .act,.btns-main .act{flex:1 1 auto}
/* With little of the window left - the keyboard on a small phone, a phone on its side - app.js
   marks the sheet .tight and moves that first group to the end of the form, where it scrolls
   with it: the footer keeps what he decides on, and the field he is in stays in view. */
.sheet-body>.btns-more{margin-top:var(--s4)}
.sheet.tight .sheet-grab{display:none}
/* A status of four lines (the sync messages, a PDF error) left the form 28px at 320px: two
   lines show, the rest scrolls. */
.sheet.tight .sheet-foot .note{max-height:3.1em;overflow-y:auto}
/* What is left, in one row there: in German the generator's three things wrap onto a second
   line, over totals and buttons, and with the keyboard up on a small phone that line was the
   room of the field he typed in. The whole of it stays the button's description, and a press
   on the button marks each of them at its field. */
.sheet.tight #dlgLeft{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* With less than a field's height left for the body, .squeezed (app.js): the body stops
   scrolling on its own and the sheet scrolls as one column - the field he types in is whole,
   and head and footer are reached by scrolling on. */
.sheet.squeezed .sheet-body{flex:none;overflow:visible}
/* the More list: the screen he is on carries a tick and heavier type as well as the tint */
.sheet .li{min-height:48px;flex:none}
.sheet .li .tick{visibility:hidden;color:var(--blue)}
.sheet .li[aria-current="page"]{background:var(--bluebg)}
.sheet .li[aria-current="page"] .li-title{font-weight:700}
.sheet .li[aria-current="page"]>svg.i{color:var(--blue)}
.sheet .li[aria-current="page"] .tick{visibility:visible}

/* From 900px a sheet is a dialog in the middle of the window, as wide as a form needs; .wide
   is the invoice generator with its preview, .side-panel a Beleg - on the right, the full height,
   so the list beside it stays readable while he types. Centred by auto margins between the four
   edges, not by a transform: the tooltip of a term inside an open form is position:fixed, and a
   transform would make the dialog what it is fixed to. */
@media (min-width:900px){
  dialog.sheet{inset:0 0 var(--vvb,0px) 0;margin:auto;width:min(620px,92vw);height:fit-content;
    max-height:min(88%,calc(var(--vvh,100dvh) * .92));padding:0;border:1px solid var(--line3);border-radius:var(--r-lg)}
  dialog.sheet.full{height:fit-content}
  dialog.sheet.wide{width:min(1120px,94vw)}
  dialog.sheet.side-panel{inset:0 0 var(--vvb,0px) auto;margin:0;width:min(460px,92vw);height:auto;max-height:none;
    padding-right:var(--sar);border-width:0 0 0 1px;border-radius:0}
  /* Not dimmed: the list is what the panel is filled in from. */
  dialog.sheet.side-panel::backdrop{background:none}
  /* The page behind scrolls, as it did behind the dialogs - beside the panel that is the point,
     and locking it would shift the whole page by a scrollbar's width where scrollbars take room. */
  html:has(dialog.sheet[open]){overflow:visible}
  .sheet-grab{display:none}
  .sheet-head{padding:var(--s3) var(--s3) var(--s2) var(--s5)}
  .sheet-body{padding:var(--s2) var(--s5) var(--s5)}
  .sheet-foot{padding:var(--s3) var(--s5)}
  /* The panel runs to the lower edge - an iPad, a large phone on its side - so its footer
     clears the home indicator, as below 900px. The centred dialogs float above it. */
  dialog.sheet.side-panel .sheet-foot{padding-bottom:calc(var(--s3) + max(0px,var(--sab) - var(--vvb,0px)))}
  .btns{flex-wrap:nowrap;align-items:center;justify-content:space-between}
  .btns-more,.btns-main{flex:none}
  .btns-main{margin-left:auto}
  .btns-more .act,.btns-main .act{flex:none}
}

/* The border stays the full status colour: the alert has no icon yet, so the edge is what tells
   red from amber at a glance. */
.alert{
  border:1px solid var(--red);background:var(--redbg);border-radius:var(--r-md);padding:var(--s3) var(--s4);margin-bottom:var(--s4);
}
.alert.amber{border-color:var(--amber);background:var(--amberbg)}
.alert.green{border-color:var(--green);background:var(--greenbg)}
.alert b{display:block;margin-bottom:3px}
.alert p{margin:.3em 0 0;color:var(--dim);font-size:var(--t-sm)}
.alert p b{display:inline;margin:0;color:var(--ink)}
.alert .act{margin-top:var(--s1)}

/* No row gap on the grid: the space under a card is the card's own margin, because a row gap
   would also open up between label, value and note once they sit on shared rows (below). */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(215px,1fr));gap:0 var(--s3);margin-bottom:var(--s2)}
.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--r-lg);padding:var(--s4);margin-bottom:var(--s3)}
.card .lbl{display:flex;gap:6px;align-items:center;font-size:var(--t-xs);font-weight:650;
  text-transform:uppercase;letter-spacing:.07em;color:var(--dim)}
.card .val{margin-top:6px;font:600 var(--t-xl)/1.2 var(--mono);letter-spacing:-.02em}
.card .sub{margin-top:6px;font-size:var(--t-sm);color:var(--dim);line-height:1.45}
.card.bad .val{color:var(--red)} .card.warn .val{color:var(--amber)} .card.good .val{color:var(--green)}
/* Label, value and note share their rows with the neighbouring cards, so when one label wraps
   to two lines the figures still stand on one line across the row. */
@supports (grid-template-rows:subgrid){
  .card{display:grid;grid-row:span 3;grid-template-rows:subgrid}
  .card .lbl{align-self:end}          /* a one-line label sits on its figure, not above a gap */
}

.tag{display:inline-block;padding:4px 6px;border-radius:var(--r-sm);font:600 var(--t-xs)/1 var(--mono);
  letter-spacing:.04em;vertical-align:1px}
.tag.C{background:var(--greenbg);color:var(--green);border:1px solid var(--greenline)}
.tag.L{background:var(--bluebg);color:var(--blue);border:1px solid var(--blueline)}
.tag.G{background:var(--amberbg);color:var(--amber);border:1px solid var(--amberline)}

table{width:100%;border-collapse:collapse;font-size:var(--t-sm)}
th{text-align:left;font-size:var(--t-xs);text-transform:uppercase;letter-spacing:.06em;color:var(--dim);
   font-weight:650;padding:10px;border-bottom:1px solid var(--line);white-space:nowrap}
td{padding:10px;border-bottom:1px solid var(--line2);vertical-align:middle}
td small{display:block;color:var(--dim);font-size:var(--t-xs)}
/* The two widest tables - Invoices with nine columns, Belege with ten - keep 5px either side
   of a cell. At 10px the German Belege table is 86px wider than a 1280px window has room for,
   and at 6px still 6px: its three amounts each carry a "€ " now. */
table:has(th:nth-child(9)) :is(th,td){padding-left:5px;padding-right:5px}
@media (hover:hover){ tr:hover td{background:var(--panel2)} }   /* a tap leaves :hover stuck on a phone */
td.num,th.num{text-align:right;font-family:var(--mono);white-space:nowrap}
tr.sum td{border-top:2px solid var(--line);font-weight:700}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--r-lg);padding:var(--s4);margin-bottom:var(--s4);overflow-x:auto}
.panel>h2{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}

.pill{display:inline-flex;align-items:center;gap:5px;padding:5px 8px;border-radius:var(--r-pill);
  border:1px solid var(--line);color:var(--dim);font:600 var(--t-xs)/1 var(--mono);white-space:nowrap}
.pill.bad{color:var(--red);border-color:var(--redline);background:var(--redbg)}
.pill.warn{color:var(--amber);border-color:var(--amberline);background:var(--amberbg)}
.pill.good{color:var(--green);border-color:var(--greenline);background:var(--greenbg)}
.pill.note2{color:var(--blue);border-color:var(--blueline);background:var(--bluebg)}
.pill.count{color:var(--ink);background:var(--panel2)}

/* ---- buttons ---- */
.act{display:inline-flex;align-items:center;justify-content:center;gap:var(--s2);min-height:var(--tap);min-width:var(--tap);
  padding:6px var(--s4);background:var(--panel2);border:1px solid var(--line);border-radius:var(--r-md);
  color:var(--ink);font:600 var(--t-md)/1.2 var(--sans);white-space:nowrap;text-decoration:none;cursor:pointer}
.act:hover{border-color:var(--line3)}
.act.primary{background:var(--accent);border-color:var(--accent-line);color:var(--accent-ink)}
.act.danger{color:var(--red)}
.act.quiet{background:none;border-color:transparent;color:var(--dim)}
.act.block{display:flex;width:100%}
.act[disabled],.act.is-busy{opacity:.55;cursor:default}
/* Something still stands in the way of saving (aria-disabled, not disabled: it can be reached
   and pressed, and the press says what). Set back by losing the accent, not by fading - it is a
   live control, and its label keeps 6:1. */
.act[aria-disabled="true"]{background:var(--panel2);border-color:var(--line);color:var(--dim)}
/* The compact form, 36px, for places a 44px button would break: a table row is as tall as its
   tallest cell, and the Ask panel's header and pick bar are one line each. .sm is the class;
   the other selectors cover markup that does not carry it. */
.act.sm,td .act,.ask-head .act,.ask-pickbar .act{min-height:36px;padding:4px var(--s3);font-size:var(--t-sm)}
td .act{white-space:nowrap}             /* a table squeezes a cell to its narrowest word; the label must not break */
/* a control that is only an icon: the box is the target, the glyph inside keeps its size */
.iconbtn{width:var(--tap);height:var(--tap);flex:none;display:inline-flex;align-items:center;justify-content:center;
  padding:0;background:none;border:0;border-radius:var(--r-md);color:var(--dim)}
.row{display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap}
.spread{justify-content:space-between}
/* A heading that shares its line with buttons is centred on them, so its own bottom margin would
   lift it off the middle; the row carries the space below instead. */
.row>h1,.row>h2{margin:0}
.panel>.row.spread:first-child{margin-bottom:var(--s3)}

/* ---- forms ---- */
input,select,textarea{
  background:var(--field);border:1px solid var(--ctl);color:var(--ink);border-radius:var(--r-md);
  min-height:var(--tap);padding:10px var(--s3);width:100%;
  font:16px/1.4 var(--sans);            /* 16px at every width: below that iOS zooms the page on focus */
}
input[inputmode=decimal],input[inputmode=numeric],input.num{font-family:var(--mono);text-align:right}
/* The filter is a search field for the keyboard it brings up, not for the look a browser gives one. */
input[type=search]{-webkit-appearance:none;appearance:none}
input[type=checkbox],input[type=radio]{width:22px;height:22px;min-height:0;padding:0;margin:0;flex:none;
  vertical-align:middle;accent-color:var(--blue)}
input[type=range]{padding:0;border:0;background:none;accent-color:var(--blue)}
input:focus-visible,select:focus-visible,textarea:focus-visible{outline-offset:1px;border-color:var(--blue)}
label.f{display:block;margin-bottom:var(--s3)}
/* the caption. Only the first span: the ± wrapper and the error line are spans of the label too */
label.f>span:first-child{display:block;font-size:var(--t-sm);font-weight:600;color:var(--dim);margin-bottom:6px}
label.f>span:first-child .tag{margin:-2px 0}        /* the tag's box is taller than the caption's line: the field beside it sat 2.5px higher */
/* A group of fields (design §11). The legend names it - for a screen reader too, which says it
   with the first field of the group; the fields keep their captions. No box: the legend and
   the room above it are the group. */
.fs{min-width:0;margin:0 0 var(--s2);padding:0;border:0}
.fs>legend{padding:0;margin-bottom:var(--s2);font-size:var(--t-xs);font-weight:650;letter-spacing:.07em;text-transform:uppercase;color:var(--dim)}
.fs:last-child{margin-bottom:0}
.fs>.note,.fs>.act{margin:0 0 var(--s3)}
/* What is wrong, under the field it is wrong in: the edge says where, the line says what. Red is
   a status here. .hint is the same line when it only has something to say. */
.err,.hint{display:block;margin-top:6px;font-size:var(--t-sm);line-height:1.4}
.err{font-weight:600;color:var(--red)}
.hint{color:var(--dim)}
:is(.err,.hint):empty{margin:0}         /* a live region is in the page before it speaks, and takes no room until then */
label.f.is-error :is(input,select,textarea),:is(input,select,textarea)[aria-invalid="true"]{border-color:var(--red)}
.fs.is-error>legend{color:var(--red)}
.fs>.err{margin:0 0 var(--s2)}
/* The sign of an amount (app.js): only where the pointer is coarse - the decimal keypad of a
   phone has no minus; a typed one works everywhere. Inside the label, beside its field. */
.pm{display:flex;gap:var(--s2)}
.pm>input{flex:1;min-width:0}
.pm>.act{display:none;flex:none;padding:0;font:600 var(--t-lg)/1 var(--mono)}
@media (pointer:coarse){ .pm>.act{display:inline-flex} }
.grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:0 var(--s3)}
.toggle{display:flex;gap:var(--s3);align-items:flex-start;padding:var(--s3) 0;border-bottom:1px solid var(--line2)}
.toggle:last-child{border-bottom:none}
.toggle input{margin-top:1px}
.toggle .d{font-size:var(--t-sm);color:var(--dim);margin-top:3px;line-height:1.45}

.dl{display:flex;gap:var(--s3);padding:var(--s3) 0;border-bottom:1px solid var(--line2);align-items:baseline}
.dl:last-child{border-bottom:none}
.dl .when{font:var(--t-xs) var(--mono);color:var(--dim);min-width:150px;flex:none}
.dl.overdue .when{color:var(--red);font-weight:700}
.dl.soon .when{color:var(--amber)}
.dl .what{flex:1} .dl .what small{display:block;color:var(--dim);font-size:var(--t-sm);margin-top:2px}

.drop{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;width:100%;min-height:88px;
  border:1.5px dashed var(--ctl);border-radius:var(--r-md);padding:var(--s4);background:none;text-align:center;color:var(--dim);
  cursor:pointer;font:var(--t-sm)/1.5 var(--sans);overflow-wrap:anywhere;transition:.15s}
.drop:hover,.drop.over{border-color:var(--blue);color:var(--ink);background:var(--panel2)}
.drop.is-error{border-color:var(--red)}
/* One button, two faces: the drop zone for a mouse, "Take a photo or choose a file" for a thumb. */
.drop-coarse{display:none;flex-direction:column;align-items:center;gap:var(--s1)}
.drop-coarse b{color:var(--ink);font-size:var(--t-md)}
@media (pointer:coarse){
  .drop-fine{display:none}
  .drop-coarse{display:flex}
}

.kz{font-family:var(--mono);font-size:var(--t-sm)}
.kz td:first-child{color:var(--blue);font-weight:600}
.note{font-size:var(--t-sm);color:var(--dim);line-height:1.55}
.warnrow td{background:var(--amberbg)!important}
.holdrow td{opacity:.55}
.muted{color:var(--faint)}
code{font-family:var(--mono);font-size:var(--t-xs);background:var(--field);padding:2px 5px;border-radius:4px;border:1px solid var(--line)}

/* ---- hover explanations ----
   Three things open one: an underlined term, a C/L/G tag, a "?" mark. The glyph keeps its size
   so running text and table rows keep theirs; an invisible ::after carries the 44px a thumb
   needs. It reaches 13px past the glyph at most, which the 16px padding of a panel, a card, an
   alert or a dialog absorbs, so no scroll container grows a scrollbar from it. */
.term{position:relative;border-bottom:1px dotted var(--faint);cursor:help;text-underline-offset:3px}
.term:hover{border-bottom-color:var(--blue);color:var(--blue)}
/* taller only, never wider: a term can wrap, and a box hung on a wrapped inline has no useful width */
.term::after{content:"";position:absolute;left:0;right:0;top:50%;height:var(--tap);transform:translateY(-50%)}
.tag[data-g]{position:relative;cursor:help}
/* .info is a <button>; the browser's own button look is reset, so only the glyph is left */
.info{position:relative;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;
  padding:0;background:none;border:1px solid var(--line3);border-radius:50%;color:var(--dim);
  font:600 var(--t-xs)/1 var(--mono);text-transform:none;letter-spacing:0;
  cursor:help;vertical-align:middle;margin:0 0 0 5px;flex:none;user-select:none;-webkit-appearance:none;appearance:none}
.info:hover{border-color:var(--blue);color:var(--blue)}
.tag[data-g]::after,.info::after{content:"";position:absolute;left:50%;top:50%;width:var(--tap);height:var(--tap);
  transform:translate(-50%,-50%)}
/* the one-line summaries that open a chart's table view or the entries behind a UVA figure */
.ch-table summary,details>summary.note{position:relative}
.ch-table summary::after,details>summary.note::after{content:"";position:absolute;left:0;right:0;top:50%;height:var(--tap);
  transform:translateY(-50%)}
/* Only where a thumb is used. A mouse needs no 44px and the boxes cost it precision: the one on a
   card's label reached into the figure below it. Point-at mode (ask.js) takes whatever lies under
   the pointer, so it wants the glyphs alone as well. */
@media (hover:hover) and (pointer:fine){
  .term::after,.tag[data-g]::after,.info::after,.ch-table summary::after,details>summary.note::after{content:none}
}
body.ask-picking :is(.term,.tag[data-g],.info)::after{content:none}
/* ...and a real control beside one always wins: the invisible box must not take the tap meant
   for the field under a label or the button next to a "?". */
.act,.seg button,input,select,textarea,.drop,.dlink{position:relative;z-index:1}
/* standing alone, the "?" sits in the 44px icon box instead: <button class="iconbtn info"><span class="q">?</span></button> */
.iconbtn.info{width:var(--tap);height:var(--tap);margin:0;border:0;border-radius:var(--r-md)}
.iconbtn.info::after{content:none}
.q{width:22px;height:22px;display:flex;align-items:center;justify-content:center;border:1px solid var(--line3);
  border-radius:50%;color:var(--dim);font:600 var(--t-xs)/1 var(--mono)}
.iconbtn.info:hover .q{border-color:var(--blue);color:var(--blue)}
#tip{position:fixed;z-index:200;max-width:330px;background:var(--panel2);color:var(--ink);
  border:1px solid var(--line3);border-radius:var(--r-md);padding:11px 13px;font-size:var(--t-sm);line-height:1.5;
  box-shadow:0 12px 34px rgba(0,0,0,.55);opacity:0;pointer-events:none;transform:translateY(3px);
  transition:opacity .12s,transform .12s}
#tip.on{opacity:1;transform:translateY(0)}
#tip b{display:block;margin-bottom:4px;font-size:var(--t-sm);color:var(--blue)}
@media (max-width:700px){ #tip{max-width:min(330px,calc(100vw - 24px))} }
.copy{cursor:pointer}
/* ---- phone ---- */
@media (max-width:700px){
  .topbar{padding:calc(8px + var(--top-extra) + max(var(--sat),var(--top-min))) calc(12px + var(--sar)) 8px calc(12px + var(--sal));gap:10px}
  main{padding:14px calc(12px + var(--sar)) var(--foot) calc(12px + var(--sal))}
  .cards{grid-template-columns:1fr}
  /* A column that does not earn its width on a phone. Only the export picker still has one:
     the record tables of Invoices, Belege, Bank and Cashflow are lists below 900px. */
  .opt{display:none}
  .dl{flex-direction:column;gap:2px}
  .dl .when{min-width:0}
  .act{white-space:normal}                            /* a long label wraps inside its button instead of pushing the page wide */
  td,th{white-space:normal}
  /* Sideways, cells keep the 6px they had: at 10px a five-column table needs 40px more than a
     phone has, and it already scrolls inside its panel. */
  th,td{padding-left:6px;padding-right:6px}
  /* At 12px the four Kennzahl columns fit a phone in English. German needs the field name to
     break as well: "Bemessungsgrundlage" in mono is wider than the column a phone has left. */
  .kz{font-size:var(--t-xs)}
  .kz td:nth-child(2){-webkit-hyphens:auto;hyphens:auto;overflow-wrap:anywhere}
  td .act{padding:4px var(--s2)}
}

/* Sync: the header button and its state. The page holds the ledger in memory, so on a
   phone - where a Home Screen app is resumed rather than reloaded - it can sit on data
   from hours ago without any sign. This button, and the .fresh/.stale/.off states, are
   that sign. */
.syncBtn{
  background:var(--panel); border:1px solid var(--line); color:var(--dim);
  border-radius:var(--r-md); padding:6px 11px; font:600 var(--t-xs)/1 var(--mono);
  flex:none; letter-spacing:.03em; min-height:36px;
}
.syncBtn:hover{color:var(--ink);border-color:var(--line3)}
.syncBtn:disabled{opacity:.55;cursor:default}
.syncBtn.stale{border-color:var(--amber);color:var(--amber);background:var(--amberbg)}
.syncBtn.off{border-color:var(--red);color:var(--red);background:var(--redbg)}
.syncBtn.fresh{border-color:var(--greenline);color:var(--green)}
/* In the phone's top bar: a dot and a word (design §13), no box. The word says the state as
   well as the colour does. The button's target is the whole corner - .topend, with the save
   state under the word - so "SAVE FAILED" has its line and the bar stays as tall as it was.
   Three lines are what fits beside the switch: "SPEICHERN FEHLGESCHLAGEN" takes two at 320px,
   which is why the German words for the failing states are one-liners (i18n.js). */
@media not all and (min-width:900px){
  .syncBtn{display:inline-flex;align-items:center;gap:7px;min-height:0;max-width:100%;padding:0 2px;
    background:none;border:0;border-radius:var(--r-sm);font:500 var(--t-sm)/1.15 var(--mono);letter-spacing:0;text-align:right}
  .syncBtn:is(.stale,.off){background:none}
  .syncBtn::after{content:"";position:absolute;inset:0}
  .syncBtn .dot{width:8px;height:8px;flex:none;border-radius:50%;background:var(--green)}
  .syncBtn.stale .dot{background:var(--amber)}
  .syncBtn.off .dot{background:var(--red)}
  .syncBtn.busy .dot{background:var(--blue)}
  .saveState{max-width:100%;padding:0 2px;line-height:1.2;text-align:right;overflow-wrap:anywhere;pointer-events:none}
  .saveState:empty{display:none}
}

/* Export picker */
.exp-sel{max-height:min(46vh,460px);overflow-y:auto;border:1px solid var(--line);border-radius:var(--r-md)}
.exp-sel table{margin:0}
.exp-sel tr.pick{cursor:pointer}
.exp-sel tr.pick:hover{background:var(--panel2)}
.exp-sel td.cb{width:42px;text-align:center}
.exp-opts{display:flex;flex-direction:column;margin:0 0 var(--s3)}
.exp-opts label{display:flex;align-items:center;gap:var(--s3);min-height:var(--tap);color:var(--dim);cursor:pointer}
.exp-count{font:var(--t-xs) var(--mono);color:var(--faint)}
/* The download link of a finished export. It used to be a second `.dl`, which restyled every
   deadline row on the dashboard as a green box. */
.dlink{display:inline-flex;flex-direction:row;align-items:center;min-height:var(--tap);margin-top:10px;padding:0 var(--s4);
  border-radius:var(--r-md);border:1px solid var(--greenline);background:var(--greenbg);color:var(--green);
  font-weight:650;text-decoration:none}
.dlink:hover{background:var(--greentrack)}

/* ---- segmented control ----
   One look for every either/or switch: Business / Personal (.areasw), DE / EN (.langsw),
   Projected / Actual and the essential / not-essential pair (.mk). The pressed button is
   button[aria-pressed="true"], so a screen reader hears the state as well. app.js keeps the
   .on class beside it, because its own handlers read that. */
.seg{display:inline-flex;gap:3px;padding:3px;max-width:100%;background:var(--panel);border:1px solid var(--line);
  border-radius:var(--r-md);flex:none}
.seg button{min-height:38px;min-width:0;padding:4px var(--s3);border:1px solid transparent;
  border-radius:calc(var(--r-md) - 3px);background:none;color:var(--dim);
  font:600 var(--t-sm)/1.2 var(--sans);white-space:nowrap}
.seg button:hover{color:var(--ink)}
/* The edge is what says "pressed" to weak eyes: --ctl is 3.8:1 on the panel, where the fill
   (1.09:1) and --line3 (1.78:1) are not. */
.seg button:is([aria-pressed="true"],.on){background:var(--panel2);border-color:var(--ctl);color:var(--ink)}
.seg.block{display:flex} .seg.block button{flex:1}
/* Business / Personal. Made to look like a real switch rather than another tab, because it
   changes which set of tabs exists - and mixing the two books is the mistake to prevent. */
.areasw button{padding:4px var(--s4);font-size:var(--t-md)}
.areasw button:is([aria-pressed="true"],.on){background:var(--sel);border-color:var(--sel);color:var(--sel-ink)}
/* the essential / not-essential control: one segmented pair per household line. Two states
   only, and the active one carries a colour AND the label, never colour alone. */
.mk button:is([data-mark=need],[data-mark=keep]):is([aria-pressed="true"],.on){background:var(--greenbg);border-color:var(--green);color:var(--green)}
.mk button:is([data-mark=want],[data-mark=go]):is([aria-pressed="true"],.on){background:var(--amberbg);border-color:var(--amber);color:var(--amber)}
.pl td .mk+small{margin-top:5px}
@media (max-width:700px){
  /* "Tatsächlich bis heute" beside "Prognose Gesamtjahr" is wider than a phone: the labels wrap */
  .seg button{white-space:normal}
}
/* On a phone the three columns of the marking table do not fit side by side. Rather than let
   the one interactive control in the app scroll out of sight, the row becomes two lines: name
   and amount, then the control under them at full width. */
@media (max-width:620px){
  :is(#pplan,#rec) table.pl tr{display:grid;grid-template-columns:1fr auto;gap:0 10px;
    padding:9px 0;border-bottom:1px solid var(--line)}
  :is(#pplan,#rec) table.pl tr:last-child{border-bottom:none}
  :is(#pplan,#rec) table.pl td{border:none;padding:1px 0}
  :is(#pplan,#rec) table.pl td+td{padding-left:0}
  :is(#pplan,#rec) table.pl td:nth-child(3){grid-column:1/-1;text-align:left;margin-top:7px}
  :is(#pplan,#rec) table.pl td:nth-child(3) small{margin-top:4px}
}
.side nav button[data-area]:not(.show){display:none}

/* Personal: a plain two-column figure list, for reading rather than editing. */
.pl{width:100%;border-collapse:collapse}
.pl td{padding:10px 0;border-bottom:1px solid var(--line2);vertical-align:top}
.pl td+td{text-align:right;font:var(--t-sm) var(--mono);white-space:nowrap;padding-left:14px}
.pl th{padding-left:0;padding-right:0}
.pl th+th{padding-left:14px}
.pl tr:last-child td{border-bottom:none}
.pl tr.sum td+td{font-weight:700}
.pl small{margin-top:2px}
/* One hue: the bar says how much, the row's own label says what. Fixed / essential / choice
   used to be blue / green / amber here - status colours standing in for categories. */
.bar{height:6px;border-radius:3px;background:var(--panel2);overflow:hidden;margin-top:6px}
.bar i{display:block;height:100%;border-radius:3px;background:var(--q3)}
.neg{color:var(--red)} .pos{color:var(--green)}

/* ================= charts =================
   A sequential ramp for the dark surface: on a dark background "more" reads as LIGHTER, so the
   steps run dim -> bright. One hue, monotonic lightness, used wherever the job is magnitude or
   an ordered share. The theme's red/amber/green stay reserved for status and never stand in as
   series colours - they fail as a categorical set (red vs green is ΔE 7.3 under deuteranopia,
   measured, not guessed), so no chart here asks hue alone to carry identity. */
:root{
  /* Validated with the dataviz palette script against this surface: monotone lightness,
     adjacent ΔL ≥ 0.06, single hue (4° spread), and the dim end clears the 2:1 contrast
     floor at 2.64:1. The first attempt failed that last check at 1.66:1 - the faintest
     segment of a stacked bar was all but invisible on the panel. */
  --q1:#33608f; --q2:#3f74aa; --q3:#4d8bc9; --q4:#63a0e6; --q5:#8fbdf4; --q6:#bcd8fb;
  --ch-grid:var(--line2);      /* one step off the panel surface, hairline, solid */
  --ch-surface:var(--panel);   /* the gap colour between touching marks */
}

.ch{margin:0 0 4px}
.ch-cap{display:flex;justify-content:space-between;align-items:baseline;gap:12px;
  font-size:var(--t-sm);color:var(--dim);margin-bottom:10px}
.ch-cap b{font:600 var(--t-sm)/1 var(--mono);color:var(--ink)}
.ch-note{margin:10px 0 0;font-size:var(--t-sm);line-height:1.55;color:var(--dim)}

/* meter: fill carries severity, track is a dimmer step of the same ramp */
/* The track is a DIM STEP OF THE SAME HUE as the fill, so state reads across the whole bar.
   A red fill on a blue track would be two colours meaning two different things. */
.ch-meter{height:10px;border-radius:5px;background:var(--q1);overflow:hidden}
.ch-meter i{display:block;height:100%;border-radius:5px;background:var(--q4)}
.ch-meter.warn{background:var(--ambertrack)} .ch-meter.warn i{background:var(--amber)}
.ch-meter.bad{background:var(--redtrack)}    .ch-meter.bad  i{background:var(--red)}
.ch-meter.good{background:var(--greentrack)} .ch-meter.good i{background:var(--green)}
.ch-ends{display:flex;justify-content:space-between;gap:var(--s3);margin-top:var(--s2);
  font:600 var(--t-sm)/1.4 var(--mono)}
.ch-ends small{display:block;font:400 var(--t-sm)/1.4 var(--sans);color:var(--dim)}
.ch-ends .r{text-align:right}

/* stacked share: 2px surface gaps do the separating, never borders */
.ch-stack{display:flex;height:14px;border-radius:5px;overflow:hidden;gap:2px;background:var(--ch-surface)}
.ch-stack i{display:block;min-width:3px;transition:filter .12s}
.ch-stack i:hover,.ch-stack i:focus{filter:brightness(1.18)}
/* Drawn inside the segment, because the bar clips what lies outside it, and in two tones: ink
   alone is no ring on the light half of the ramp (1.2:1 on --q6), dark alone none on the dim half.
   The dark ring sits INSIDE the light one - outside, it merges with the 2px gaps between segments. */
.ch-stack i:focus-visible{outline:2px solid var(--ink);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--bg)}
.ch-stack i:first-child{border-radius:5px 0 0 5px} .ch-stack i:last-child{border-radius:0 5px 5px 0}
.s1{background:var(--q1)} .s2{background:var(--q2)} .s3{background:var(--q3)}
.s4{background:var(--q4)} .s5{background:var(--q5)} .s6{background:var(--q6)}
.ch-legend{list-style:none;margin:12px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:6px 18px}
.ch-legend li{display:flex;align-items:center;gap:7px;font-size:var(--t-sm);color:var(--dim)}
.ch-legend i{width:9px;height:9px;border-radius:3px;flex:none}
.ch-legend b{font:600 var(--t-sm)/1 var(--mono);color:var(--ink)}

/* waterfall + columns share the plot frame. The frame includes the label band, so the axis
   text is never cut off by a fixed height. */
/* padding-top reserves a band for the value labels, so a bar that reaches the top of the plot
   still has somewhere to put its own label; padding-bottom does the same for the axis text, so
   a fixed height never clips it. */
.ch-wf,.ch-cols{display:flex;align-items:flex-end;gap:10px;position:relative;
  height:var(--plot);padding:22px 0 26px;border-bottom:1px solid var(--ch-grid)}
.ch-cols .ch-zero{position:absolute;left:0;right:0;top:var(--zero);height:1px;
  background:var(--ch-grid);pointer-events:none}
.ch-cols .ch-zero em{position:absolute;right:0;top:-16px;font-style:normal;font-size:10.5px;
  color:var(--faint);letter-spacing:.04em}
.ch-col{position:relative;flex:1 1 0;min-width:0;height:calc(100% - 0px);cursor:default}
.ch-col i{position:absolute;left:50%;transform:translateX(-50%);width:min(24px,72%);
  border-radius:4px 4px 0 0;background:var(--q3)}
.ch-col i.dn{background:var(--red);border-radius:0 0 4px 4px}
.ch-col i.up{background:var(--green)}
.ch-col i.tot{background:var(--q4)}
.ch-col i.bad{background:var(--red)} .ch-col i.warn{background:var(--amber)}
.ch-col i.good{background:var(--green)} .ch-col i.mute{background:var(--line3)}
.ch-col:hover i,.ch-col:focus i{filter:brightness(1.18)}
.ch-col:focus-visible{border-radius:var(--r-sm)}
/* Values ride their own mark's cap, and wear text tokens - never the data colour. A light
   hue is illegible as text, and the coloured bar beside the number already carries identity. */
.ch-col .v{position:absolute;top:var(--top);left:0;right:0;text-align:center;
  transform:translateY(-100%);padding-bottom:5px;white-space:nowrap;
  font:600 11.5px/1.2 var(--mono);color:var(--ink)}
.ch-col.neg .v{top:var(--bot);transform:none;padding:5px 0 0}
.ch-col .k{position:absolute;bottom:-22px;left:0;right:0;text-align:center;font-size:11px;
  color:var(--faint);line-height:1.25;overflow-wrap:anywhere}

.ch-table{margin-top:14px}
.ch-table summary{cursor:pointer;font-size:var(--t-xs);color:var(--faint);letter-spacing:.02em}
.ch-table summary:hover{color:var(--dim)}
.ch-table table{margin-top:8px}

#ctip{position:fixed;z-index:60;max-width:min(300px,calc(100vw - 24px));pointer-events:none;
  background:var(--field);border:1px solid var(--line3);border-radius:var(--r-md);padding:8px 11px;
  font-size:var(--t-sm);line-height:1.5;color:var(--ink);box-shadow:0 10px 26px rgba(0,0,0,.5);
  opacity:0;transition:opacity .1s}
#ctip.on{opacity:1}

@media (max-width:700px){
  .ch-col .k{font-size:10px;bottom:-20px}
  .ch-wf .ch-col .v,.ch-cols .ch-col .v{font-size:10.5px}
  .ch-legend{gap:6px 12px}
}

/* ================= dashboard: lead figure, breakdown, attention list =================
   Merged from design/ertenu.css §2, §6, §7 and §8 (stage 2), on the Dashboard only for now.
   The .li-meta / .li-end / .li-amt / .warnrow / .holdrow rows are the same block and come along
   for the lists of the later stages. */
.eyebrow{margin:0;font-size:var(--t-xs);font-weight:650;letter-spacing:.07em;text-transform:uppercase;color:var(--dim)}   /* margin: it is an h2 on the Dashboard */
.nw{white-space:nowrap}
/* read out, not shown: the words behind an abbreviating pill ("49d late") or a bare count */
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
svg.i{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
svg.i.fill{fill:currentColor;stroke:none}
svg.i.chev{width:18px;height:18px;color:var(--faint);transition:transform .15s}

.panel.flush{padding:0;overflow:hidden}
.panel-head{display:flex;align-items:center;justify-content:space-between;gap:var(--s3);margin-bottom:var(--s3)}
.panel.flush .panel-head{margin:0;padding:var(--s3) var(--s4)}
/* Not a flex row, as the design has it: the tag or the count is then a box of its own and drops
   under a heading that wraps, alone on its line. In the text's own flow it follows the last word. */
.panel-head h2{margin:0}
.panel-head h2 .pill{margin-left:var(--s1);vertical-align:2px}

/* The one figure the screen is about. It never wraps: on a phone the type gives way instead,
   so € 999.999,99 still stands on one line at 320px. Ink, whatever the amount - a status is
   said by the pill under it. */
.lead-val{margin-top:var(--s1);font:600 clamp(26px,10.5vw,var(--t-hero))/1.1 var(--mono);letter-spacing:-.03em;white-space:nowrap}
.lead .ch-meter{margin-top:var(--s3)}
.lead .ch-ends>span:first-child{flex:1 1 0;min-width:0}
.lead .ch-ends small b{color:var(--ink);font-weight:600}
.lead .ch-ends .r{flex:0 0 auto;max-width:46%;display:flex;flex-direction:column;align-items:flex-end}
.lead .ch-ends .r .pill{margin-top:6px}
.ch-pct{margin-left:var(--s1);font-weight:400;color:var(--dim)}
.lead .ch-note:first-of-type b{color:var(--ink)}

/* breakdown: swatch, label, amount - and under them the line that explains the amount */
.panel.build{padding-bottom:var(--s1)}
.build .ch-stack{margin-bottom:6px}
.bd{display:grid;grid-template-columns:10px minmax(0,1fr) auto;column-gap:10px;align-items:baseline;
  padding:13px 0;border-top:1px solid var(--line2)}
.bd.first{border-top:0}
.bd.plain{grid-template-columns:minmax(0,1fr) auto}
.bd .sw{width:10px;height:10px;border-radius:3px}
.bd .sw.none{box-shadow:inset 0 0 0 1px var(--line3)}     /* a part that is zero has no segment to match */
.bd .k{font-weight:600}                                   /* in flow, for the same reason as the heading above */
/* no left margin: the gap is a space in the markup, which collapses when the pill wraps under its label */
.bd .k .pill{vertical-align:1px}
.bd .v{font:600 var(--t-md)/1.4 var(--mono);white-space:nowrap}
.bd .d{grid-column:2/4;margin:3px 0 0;font-size:var(--t-sm);line-height:1.5;color:var(--dim)}
.bd .d b{color:var(--ink)}
.bd.plain .d{grid-column:1/3}
.bd.sum{border-top:2px solid var(--line)} .bd.sum .k,.bd.sum .v{font-weight:700}
/* "Show all n lines": a <summary>, so it opens without script and says so to a screen reader */
.more{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:var(--tap);padding:0;
  background:none;border:0;border-top:1px solid var(--line2);font-size:var(--t-sm);font-weight:600;text-align:left;color:var(--ink)}
summary.more{cursor:pointer;list-style:none}
summary.more::-webkit-details-marker{display:none}
details[open]>summary.more .chev{transform:rotate(180deg)}
.more-d>table{margin-bottom:var(--s3)}

/* list rows */
.li{display:flex;align-items:center;gap:var(--s3);width:100%;min-height:56px;padding:10px var(--s4);
  background:none;border:0;border-top:1px solid var(--line2);color:inherit;text-align:left;text-decoration:none}
.li.first{border-top:0}
.li>svg.i{color:var(--dim)} .li>svg.i.chev{color:var(--faint)}
.li-main{flex:1;min-width:0}
.li-title{display:block;font-weight:600;line-height:1.35}
.li-meta{display:block;margin-top:2px;font-size:var(--t-sm);color:var(--dim)}
.li-end{flex:none;display:flex;flex-direction:column;align-items:flex-end;gap:5px;text-align:right}
.li-amt{font:600 var(--t-md)/1.35 var(--mono);white-space:nowrap}
.li.warnrow{background:var(--amberbg)} .li.holdrow{opacity:.55}
/* A held row of a record list is set back by colour, not by fading it whole: at .55 its meta
   line - date, description, 13px - came out at 2.96:1 on the panel. Dim is 6.9:1, faint 5.4:1. */
li.li.holdrow{opacity:1}
li.li.holdrow :is(.li-title,.li-amt){color:var(--dim)}
li.li.holdrow .li-meta{color:var(--faint)}
.li-detail{padding:0 var(--s4) var(--s4) 50px;font-size:var(--t-sm);line-height:1.55;color:var(--dim)}
.li-detail p{margin:0 0 var(--s2)}
.li-detail p b{color:var(--ink)}
.li-detail .row{margin-top:var(--s3)}
.li-detail table{margin-bottom:var(--s3)}
.li-detail tbody th{text-transform:none;letter-spacing:0;font-size:var(--t-sm);font-weight:400;color:var(--ink);white-space:normal}
.li-detail :is(th,td){padding-left:6px;padding-right:6px}
/* The row's 50px indent would push the last column off a phone: the figures must all be readable. */
@media (max-width:560px){.li-detail table{margin-left:-38px;width:calc(100% + 38px)}.li-detail td.num{font-size:var(--t-xs)}.li-detail :is(th,td){padding-left:4px;padding-right:4px}}
/* The panel clips what leaves it, a ring drawn outside the row included: it goes inside. */
.li:focus-visible{outline-offset:-2px}
.li[aria-expanded="true"]>.chev{transform:rotate(90deg)}
/* Only a row that does something when pressed answers the pointer: a button, a row with a record
   behind it (.tap), a bank proposal that ticks (.pick). A reminder or a cashflow event is text. */
@media (hover:hover){ :is(button,a).li:hover,.li:is(.tap,.pick):not(.warnrow):hover{background:var(--panel2)} }
/* The attention list: title and pill side by side while there is room, the pill under the
   title on a phone - beside it, "141T überfällig" left the German title 115px to wrap in. */
.attn .li-main{display:flex;align-items:center;justify-content:space-between;gap:6px var(--s3)}
.attn .li-title{flex:1;min-width:0}
.attn .li-main .pill{flex:none}
@media (max-width:700px){ .attn .li-main{flex-direction:column;align-items:flex-start} .attn .li-title{flex:none} }
.attn-none{margin:0;padding:var(--s3) var(--s4) var(--s4);border-top:1px solid var(--line2);font-size:var(--t-sm);color:var(--dim)}
/* what is settled sits one step back from what is open */
.attn-sub{background:var(--field)}
.group{margin:0;padding:var(--s3) var(--s4) 6px;border-top:1px solid var(--line2);font-size:var(--t-xs);font-weight:650;
  letter-spacing:.07em;text-transform:uppercase;color:var(--dim)}
.group.first{border-top:0} .group.bad{color:var(--red)} .group.warn{color:var(--amber)}
/* a deadline row under a group header: the header carries the line above, the rows the ones between */
.panel.flush .dl{padding-left:var(--s4);padding-right:var(--s4);border-bottom:0;border-top:1px solid var(--line2)}
.panel.flush .group+.dl{border-top:0}
/* status mark: the shape says it as well as the colour */
.st{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.st .dot{fill:currentColor;stroke:none}
.st.bad{color:var(--red)} .st.bad .bg{fill:var(--redbg)}
.st.warn{color:var(--amber)} .st.warn .bg{fill:var(--amberbg)}
.st.good{color:var(--green)} .st.good .bg{fill:var(--greenbg)}

/* ================= lists below 900px, tables from 900px =================
   Invoices, Belege, Bank and Cashflow draw the same rows twice (rows.js, app.js): as .li rows in
   a .panel.flush on the phone, as the table they always were from 900px. Design §8 and §9. */
.rows{list-style:none;margin:0;padding:0}
/* A row here is a container, not a button: it holds ONE control - its title - whose hit area
   is stretched over the whole row, so the row opens the record without a button, a link or a
   term nested inside a button. A second action, a select, a C/L/G tag lie above that area. */
li.li{position:relative;flex-wrap:wrap;gap:var(--s2) var(--s3)}
/* Title, meta and amount are one block that never breaks apart. 280px is what it wants before a
   second action may stand beside it: with less - "Issue" at 375px - the action takes a line of
   its own under the text instead of squeezing the title into a column of single words. */
.li-body{flex:1 1 280px;min-width:0;display:flex;align-items:flex-start;gap:var(--s3)}
li.li :is(.li-title,.li-meta){overflow-wrap:anywhere}      /* a file name, an IBAN in a booking text */
li.li .num{font-family:var(--mono);white-space:nowrap}
/* One line and no more: a Beleg's description, as much of it as fits. The whole is in the sheet. */
.li-meta.cut{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.li-meta .pill{vertical-align:1px}
.li-meta b{color:var(--ink);font-weight:600}
.li-end{max-width:60%}
/* what stands under an amount without being a state: "none needed", "3 invoices", the balance */
.li-note{font-size:var(--t-xs);line-height:1.35;color:var(--dim)}
/* Lines that take the row's full width under title and amount: a booking text, a reason. The
   row's 8px between its lines is too much between two lines of the same text. */
.li-under{flex:0 0 100%;min-width:0;margin-top:-6px}
/* May shrink, so that on a line of its own two long buttons wrap inside the row ("Rechnung
   erstellen", "Erledigt" at 320px) instead of running past its edge. */
.li-acts{flex:0 1 auto;min-width:0;max-width:100%;display:flex;flex-wrap:wrap;align-items:center;gap:var(--s2);position:relative;z-index:1}
.li-acts.full{flex:0 0 100%}
.li .tag[data-g]{z-index:1}
.li-open{width:100%;padding:0;background:none;border:0;border-radius:0;text-align:left;-webkit-tap-highlight-color:transparent}
.li-open::after{content:"";position:absolute;inset:0}
/* The ring goes round the row - that is what the control is - and inside it, as on every .li. */
.li-open:focus-visible{outline:none}
.li-open:focus-visible::after{outline:2px solid var(--blue);outline-offset:-2px}
.li.tap:has(.li-open:active){background:var(--panel2)}
/* Pointing at something for Claude takes the element under the pointer (ask.js): without the
   stretched area that is the amount or the date he means, not the row's title. */
body.ask-picking .li-open::after{content:none}
/* A bank proposal is the label of its checkbox: a tap anywhere on the row ticks it. */
.li.pick{padding:0}
.li.pick>label{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--s2) var(--s3);
  min-height:56px;padding:10px var(--s4);cursor:pointer}
.li.pick .li-body{flex:1 1 0}
.li.pick .li-under{padding-left:calc(22px + var(--s3))}   /* under the text, not under the box */
/* The line over a run of rows. Where it names a group (Open, Paid, a month) its label is a
   heading, and the caption of the amount column stays outside it; the heading keeps the look
   of the line. */
.group.row{gap:var(--s3);flex-wrap:nowrap;line-height:1.5}
.group.row>span:last-child:not(:first-child){flex:none}
.group>h3{margin:0;font:inherit;color:inherit;letter-spacing:inherit;text-transform:inherit}
/* Inside a flush panel: no line above what comes first - a heading only a screen reader gets
   does not count - and none between a group line and its first row. A note or a message under
   the rows is set in from the edge as the rows' text is. */
.panel.flush>.group:first-child,.panel.flush>.sr-only:first-child+.group,
.panel.flush>.rows:first-child>.li:first-child,.group+.rows>.li:first-child{border-top:0}
.panel.flush>.note{margin:0;padding:var(--s3) var(--s4);border-top:1px solid var(--line2)}
.panel.flush>.alert{margin:0 var(--s4) var(--s4)}
/* A list between the paragraphs of an ordinary panel reaches the panel's edges all the same. */
.rows.bleed{margin:var(--s2) calc(-1*var(--s4));border-bottom:1px solid var(--line2)}

/* From 900px the row of a table is the control: its first text cell is a button that reads as
   the text it replaced, and a click anywhere else on the row presses it (app.js). */
tr.tap{cursor:pointer}
tr.tap [data-own]{cursor:text}      /* the digits of an invoice number: marked, not pressed */
.rowbtn{padding:0;background:none;border:0;border-radius:var(--r-sm);text-align:left}
tr.tap:has(.rowbtn:focus-visible) td{background:var(--panel2)}
/* "attach" in the File column: a button that keeps the look of the dotted word it was */
.linkbtn{padding:0;background:none;border:0;border-radius:var(--r-sm);color:var(--faint);text-decoration:underline dotted;text-underline-offset:3px}
.linkbtn:hover{color:var(--ink)}
/* The document field of a Beleg or a recorded invoice: its caption, the drop zone with the way
   to the file beside it, and under both the line that says why an upload failed. Where the
   pointer is coarse the file's name stands above the button, with the link beside the name. */
.docf{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 var(--s2);align-items:center;margin-bottom:var(--s3)}
.docf>.cap{grid-area:1/1/2/-1;font-size:var(--t-sm);font-weight:600;color:var(--dim);margin-bottom:6px}
.docf>.docname{display:none}
.docf>.drop{grid-area:2/1}
.docf>.act{grid-area:2/2;align-self:end}
.docf>:is(.err,.hint){grid-area:4/1/5/-1}
@media (pointer:coarse){
  .docf>.docname:not([hidden]){display:block;grid-area:2/1;font-size:var(--t-sm);overflow-wrap:anywhere}
  .docf>.act{align-self:center;margin-bottom:var(--s2)}
  .docf>.drop{grid-area:3/1/4/-1}
}
/* "Copy as a new invoice" at the end of an invoice's sheet: set apart from the form by a line,
   because it leaves the form. What it copies stands beside the button while both fit, and
   under it on the phone. */
.copyas{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s2) var(--s3);margin-top:var(--s4);padding-top:var(--s4);
  border-top:1px solid var(--line2)}
.copyas>.note{flex:1 1 220px;min-width:0;margin:0}

/* invoice generator */
[hidden]{display:none!important}
label.chk{display:flex;align-items:center;gap:var(--s3);min-height:var(--tap);margin-bottom:var(--s2);font-weight:600;cursor:pointer}
/* In a table row it is a whole sentence, not a short label, and the row is already padded: the
   label takes the cell's padding over, so its 44px reach into it instead of adding to it. */
td label.chk{font-weight:400;margin:-10px 0;padding:10px 0}
/* One position: number, title + detail, quantity, price, line total, remove. The row is as tall
   as an input, so the number and the total sit on the same 44px line. */
.gi{display:grid;grid-template-columns:22px minmax(0,1fr) 76px 116px 110px var(--tap);gap:var(--s2);align-items:start;
  padding:10px 0;border-bottom:1px solid var(--line)}
.gi:first-child{border-top:1px solid var(--line)}
.gi-n{color:var(--dim);font:600 var(--t-xs)/var(--tap) var(--mono)}
.gi-main{display:flex;flex-direction:column;gap:6px;min-width:0}
/* two lines tall: at 16px the placeholder no longer fits on one in a phone-width column */
.gi-main textarea{resize:vertical;min-height:68px}
.gi label>span:not(.pm){display:none}
.gi-sum{font-family:var(--mono);font-size:var(--t-sm);line-height:var(--tap);text-align:right}
.gi-x{padding:0;font-size:var(--t-lg)}
/* The totals stand in the sheet's footer, over the button that issues the invoice: net and VAT
   small, the amount of the invoice in ink. One line where there is room, two on a phone. */
.gen-tot{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:baseline;gap:0 var(--s4);font-size:var(--t-sm);color:var(--dim)}
.gen-tot div{display:flex;align-items:baseline;gap:6px;white-space:nowrap}
.gen-tot div:last-child{font-size:var(--t-md);color:var(--ink)}
.gen-form .grid2>label:only-child{max-width:340px}      /* the VAT treatment, alone in its row since the totals moved to the footer */
#g_addr{margin:-4px 0 var(--s3)}
#g_addr:empty{display:none}
/* a position's error stands under the whole position: its columns are too narrow for a sentence */
.gi>.err{grid-column:2/-1;margin-top:0}
.gi-main>.err{margin-top:0}
/* With a thumb the price has its ± beside it: the column makes room for both. */
@media (pointer:coarse) and (min-width:701px){ .gi{grid-template-columns:22px minmax(0,1fr) 76px 168px 110px var(--tap)} }
/* Under the form it is a page to check, not a poster: no wider than 560px, in the middle. */
.gen-prev{position:relative;width:100%;max-width:560px;aspect-ratio:210/297;overflow:hidden;border-radius:var(--r-sm);margin:14px auto 0;
  background:#fff;box-shadow:0 6px 24px rgba(0,0,0,.4)}
.gen-prev iframe{position:absolute;left:0;top:0;width:794px;height:1123px;border:0;
  transform-origin:0 0;transform:scale(var(--s,.7))}
/* No invoice to show yet: the reason, on the sheet of paper - so in ink on white, whatever the theme. */
.gen-prev>.note{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;margin:0;padding:var(--s5);
  text-align:center;color:#3a3d44}
/* With room for both, the preview stands beside the form and stays there while the form
   scrolls. 1100px, not 900: narrower, the form's column would squeeze a position's title to
   a few letters. */
@media (min-width:1100px){
  .sheet.wide .gen:has(.gen-prev:not([hidden])){display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:var(--s6);align-items:start}
  .sheet.wide .gen-prev{position:sticky;top:0;margin-top:0}
}
@media (max-width:700px){
  .gi{grid-template-columns:22px 1fr 1fr var(--tap);grid-template-areas:"n main main x" ". q p p" ". sum sum sum"}
  .gi-n{grid-area:n}.gi-main{grid-area:main}.gi-x{grid-area:x}.gi-ql{grid-area:q}.gi-pl{grid-area:p}
  .gi-sum{grid-area:sum;line-height:1.4}
  .gi label>span:not(.pm){display:block;font-size:var(--t-xs);color:var(--dim)}
}

/* ask Claude */
/* One button, two homes (app.js moves it). From 900px it ends the top bar, star and words. The
   bar keeps the height its title gives it: the button is 32px, a pointer's size, and reaches
   5px into the bar's padding above and below. Below 900px it is the last element of the tab
   bar: a 52px circle with the star alone, the words clipped but still its name. It no longer
   floats over the content, so the end of a screen needs no extra room for it. */
.ask-fab{flex:none;display:inline-flex;align-items:center;justify-content:center;gap:var(--s2);min-height:32px;margin:-5px 0;
  padding:0 var(--s3);background:var(--accent);border:1px solid var(--accent-line);border-radius:var(--r-md);
  color:var(--accent-ink);font:600 var(--t-sm)/1.2 var(--sans);white-space:nowrap}
.ask-fab:hover{border-color:var(--sel)}
.ask-fab svg.i{width:16px;height:16px}
.tabbar .ask-fab{position:relative;width:52px;height:52px;margin:0;padding:0;border-radius:26px}
.tabbar .ask-fab svg.i{width:20px;height:20px}
.tabbar .ask-fab span{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%)}
/* Hidden, not removed: its place stays, so the tabs do not jump when he starts pointing at something. */
body.ask-open .ask-fab,body.ask-picking .ask-fab{visibility:hidden}
.ask-panel{position:fixed;top:0;right:0;bottom:0;z-index:160;width:min(440px,100vw);display:flex;flex-direction:column;
  background:var(--panel);border-left:1px solid var(--line);box-shadow:-18px 0 50px rgba(0,0,0,.45);
  padding-top:var(--sat);padding-bottom:var(--sab)}
/* It takes the focus when it opens (ask.js), so the next Tab lands inside it. No ring: it is a
   place, not a control, and whether a scripted focus counts as the keyboard's is the browser's
   guess - after a tap on the phone a ring would frame the whole screen. */
.ask-panel:focus-visible{outline:none}
.ask-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:10px 12px 10px 14px;border-bottom:1px solid var(--line)}
.ask-body{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:12px}
.ask-msg{line-height:1.55;overflow-wrap:anywhere}
.ask-msg.me{align-self:flex-end;max-width:88%;background:var(--panel2);border:1px solid var(--line);
  border-radius:var(--r-lg) var(--r-lg) 4px var(--r-lg);padding:var(--s2) var(--s3);white-space:pre-wrap}
.ask-msg.ai p{margin:0 0 .6em}.ask-msg.ai ul,.ask-msg.ai ol{margin:0 0 .6em;padding-left:1.3em}
.ask-msg.ai h4{margin:.6em 0 .3em;font-size:var(--t-md)}
.ask-msg.ai table{border-collapse:collapse;margin:0 0 .6em;font-size:var(--t-sm);display:block;overflow-x:auto}
.ask-msg.ai th,.ask-msg.ai td{border:1px solid var(--line);padding:3px 7px;text-align:left}
.ask-msg.err{color:var(--amber);font-size:var(--t-sm)}
.ask-about{font-size:var(--t-xs);color:var(--dim);margin-bottom:4px;white-space:normal}
.ask-meta{font:var(--t-xs) var(--mono);color:var(--faint);margin-top:4px}
.ask-think{color:var(--dim);font-style:italic;animation:askPulse 1.4s ease-in-out infinite}
@keyframes askPulse{50%{opacity:.4}}
.ask-empty{color:var(--dim);font-size:var(--t-sm);margin:auto 0}
.ask-setup p{margin:0 0 10px}
.ask-cmd{font:var(--t-sm) var(--mono);background:var(--field);border:1px solid var(--line);border-radius:var(--r-sm);padding:7px 10px;margin:0 0 10px;user-select:all}
.ask-form{border-top:1px solid var(--line);padding:10px 12px 12px}
.ask-row{display:flex;gap:8px;align-items:flex-end}
.ask-row textarea{flex:1;resize:none;max-height:160px}
.ask-chip{display:flex;align-items:center;gap:6px;min-height:36px;font-size:var(--t-sm);color:var(--dim);background:var(--panel2);
  border:1px solid var(--line);border-radius:var(--r-md);padding:0 2px 0 10px;margin-bottom:8px}
.ask-chip span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ask-chip button{width:36px;height:34px;flex:none;background:none;border:0;border-radius:var(--r-sm);color:var(--dim);font-size:16px;padding:0}
/* Centred by auto margins between left and right, not by left:50% + translate: that form caps
   the bar at half the viewport, which on a phone wrapped one sentence onto four lines. */
.ask-pickbar{position:fixed;left:12px;right:12px;width:fit-content;margin:0 auto;top:calc(10px + var(--sat));z-index:170;display:flex;gap:10px;
  align-items:center;background:var(--accent);border:1px solid var(--accent-line);color:var(--accent-ink);border-radius:var(--r-md);padding:6px 6px 6px 14px;
  font-size:var(--t-sm);box-shadow:0 10px 30px rgba(0,0,0,.5)}
body.ask-picking{cursor:crosshair}
body.ask-picking *{cursor:crosshair!important}
.ask-hover{outline:2px solid var(--blue)!important;outline-offset:2px;border-radius:3px}
@media (max-width:700px){
  .ask-panel{width:100vw;border-left:0}
  /* full-screen here, so the header buttons are worked with a thumb and × is the only way out;
     the three fit one row at 44px */
  .ask-head .act{min-height:var(--tap)}
  #askClose{min-width:var(--tap)}
}
@media not all and (min-width:900px){
  @media (min-width:701px){
    /* A column beside the screen here, not full screen: it ends on the tab bar, so every tab
       stays in reach while it is open, as the drawer's menu did. 1px edge + 8px + a 52px tab -
       labels are on one line at these widths. After the rules above, which say bottom:0. */
    .ask-panel{bottom:calc(61px + max(var(--s2),var(--sab)));padding-bottom:0}
  }
}

/* closed tax year tab */
.ty-grp { border-top: 1px solid var(--line); padding: 8px 0; }
.ty-grp summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: var(--tap); }
.ty-grp summary label { display: inline-flex; gap: 8px; align-items: center; width: auto; flex-wrap: nowrap; white-space: nowrap; }
.ty-grp table { width: 100%; margin-top: 6px; font-size: var(--t-sm); }
.ty-grp td { padding: 3px 4px; word-break: break-word; }
.ty-list { margin: 0; padding-left: 20px; }
.ty-list li { margin: 6px 0; line-height: 1.45; }

.seedout{font:var(--t-xs)/1.5 var(--mono);background:var(--field);border:1px solid var(--line);border-radius:var(--r-md);
  padding:10px 12px;margin-top:12px;max-height:280px;overflow:auto;white-space:pre-wrap;color:var(--dim)}

/* Tax year 2026: print the sheet without the app chrome */
@media print { nav, header, .tabbar, .no-print { display: none !important; } }
/* The 2026 sheet on a phone: the field on its own line, the two bases side by side under it. */
#ptax .e1a .pill{white-space:normal}
#ptax .e1a details td+td{white-space:normal}
@media (max-width:620px){
  #ptax .e1a tr{display:grid;grid-template-columns:1fr 1fr;gap:0 10px;padding:9px 0;border-bottom:1px solid var(--line)}
  #ptax .e1a tr:last-child{border-bottom:none}
  #ptax .e1a > tbody > tr > td{border:none;padding:1px 0}
  #ptax .e1a > tbody > tr > td:first-child{grid-column:1/-1}
  #ptax .e1a > tbody > tr > td+td,#ptax .e1a > tbody > tr > th+th{text-align:left;padding-left:0}
}
