/* Unit1's look (Stück 11, stage 7, G31). One set of design values for all pages and for A2UI: A2UI renders into the page (light DOM),
   so these rules style its layout parts (a2ui-basic-row, -column) and Unit1's tiles (ivy-number, ivy-table, ivy-bar-chart) alike.
   Layout: one column of cards on a quiet ground, at most 1040 px wide; numbers side by side, wrapping on a phone; tables become lists
   of cards when their tile is narrow. Light and dark follow the system setting. Colours are tokens; contrast is measured
   (tools/stufe11-optik.ts): text at least 4.5:1, bars and control borders at least 3:1. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --fg: #17202b; --muted: #536071; --line: #dfe4eb; --control: #75839a;
  --accent: #1c5daf; --accent-weak: #e8f0fb; --on-accent: #ffffff; --bar: #3a77c8;
  --warn: #85560a; --warn-bg: #fbf1dc; --bad: #b0261d; --bad-bg: #fcebe9;
  --radius: 12px; --gap: 16px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* A2UI's own design values, from ours */
  --a2ui-color-primary: var(--accent); --a2ui-color-surface: var(--surface); --a2ui-color-on-surface: var(--fg); --a2ui-color-border: var(--line);
  --a2ui-text-color-text: var(--fg); --a2ui-text-caption-color: var(--muted); --a2ui-color-on-background: var(--fg);
  --a2ui-spacing-xs: 4px; --a2ui-spacing-s: 8px; --a2ui-spacing-m: var(--gap); --a2ui-spacing-l: 24px; --a2ui-border-radius: var(--radius);
  --a2ui-font-size-s: 14px; --a2ui-font-size-m: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418; --surface: #1a2027; --fg: #e5e9ee; --muted: #9ea9b7; --line: #2c343e; --control: #74839a;
    --accent: #8cb6f2; --accent-weak: #1c2a3c; --on-accent: #0d1520; --bar: #6b9fe8;
    --warn: #e7be66; --warn-bg: #3a2e14; --bad: #f3a39b; --bad-bg: #3d1e1b;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--fg); background: var(--bg); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }   /* focus is set here after each page change (for screen readers), not shown */

/* ---------- frame ---------- */
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand .mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); display: inline-block; box-shadow: inset -6px -6px 0 rgba(255, 255, 255, .22); }
header nav { display: flex; gap: 4px; flex: 1; }
header nav a, .logout { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
header nav a:hover, .logout:hover { color: var(--fg); background: var(--accent-weak); }
header nav a[aria-current="page"] { color: var(--accent); background: var(--accent-weak); font-weight: 600; }
@media (max-width: 400px) {
  .top-in { flex-wrap: nowrap; gap: 12px; padding-left: 12px; padding-right: 12px; }
  header nav a, .logout { padding: 6px 7px; font-size: 14px; }
  header nav { gap: 0; }
}
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: var(--gap); }
main > * { margin-top: 0; margin-bottom: 0; min-width: 0; }

/* ---------- type ---------- */
h1 { font-size: 26px; line-height: 1.25; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 17px; line-height: 1.3; margin: 0 0 10px; text-wrap: balance; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.error { color: var(--bad); }

/* ---------- cards ---------- */
.card, .tile, .turn { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--gap); align-items: start; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 9px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

/* ---------- forms ---------- */
textarea, input, select, button { font: inherit; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
textarea, input:not([type="checkbox"]):not([type="radio"]), select { width: 100%; max-width: 100%; padding: 9px 11px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); color: var(--fg); }
textarea { min-height: 88px; resize: vertical; }
input[type="month"] { width: auto; }
button { margin-top: 10px; padding: 8px 18px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .6; cursor: wait; }
form > * + * { margin-top: 6px; }
form.inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
form.inline input, form.inline select { width: auto; padding: 4px 8px; }
form.inline button, td button { margin-top: 0; padding: 3px 10px; font-size: 13px; }
.ask { display: flex; flex-direction: column; gap: 6px; }
.ask label { font-size: 18px; }

/* ---------- alerts on the start page (Stück 12) ---------- */
details.morning { margin-top: 0; }
details.morning > summary { list-style: none; color: var(--fg); font-size: 17px; font-weight: 600; margin-bottom: 8px; }
details.morning > summary::-webkit-details-marker { display: none; }
details.morning > summary::after { content: " ▾"; color: var(--muted); font-weight: 400; }
details.morning:not([open]) > summary::after { content: " ▸"; }
details.morning > * + * { margin-top: 8px; }
p.lead { font-size: 17px; }
h3 { font-size: 14px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
ul.compact li { padding: 5px 0; font-size: 15px; }
h2 .count { display: inline-block; min-width: 22px; margin-left: 8px; padding: 0 7px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); font-size: 13px; text-align: center; vertical-align: 2px; }
ul.alerts li > p + p { margin-top: 4px; }
p.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; }
p.meta .badge { margin-left: 0; }
button.small { margin-top: 0; padding: 2px 10px; font-size: 13px; font-weight: 500; background: transparent; color: var(--accent); }
button.small:hover { background: var(--accent-weak); filter: none; }
.badge { color: var(--muted); background: var(--accent-weak); }

/* ---------- conversation ---------- */
.question { font-weight: 600; font-size: 17px; }
.answer { white-space: pre-wrap; margin-top: 10px; }
.turn > * + * { margin-top: 8px; }
.badge { display: inline-block; font-size: 13px; padding: 1px 9px; border-radius: 999px; margin-left: 6px; }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
p.badge { margin: 8px 0 0; }

/* ---------- tables (entry, sources, and inside tiles) ---------- */
.scroll { overflow-x: auto; max-width: 100%; position: relative; }   /* relative: text only for screen readers stays inside the box */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-weight: 600; color: var(--muted); font-size: 13px; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.short { white-space: nowrap; }
td.long { overflow-wrap: anywhere; }
pre.source { white-space: pre-wrap; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13px; background: var(--surface); overflow-wrap: anywhere; }
details { margin-top: 4px; }
summary { cursor: pointer; color: var(--accent); font-size: 14px; }

/* ---------- A2UI layout parts and Unit1's tiles ---------- */
a2ui-surface, a2ui-basic-column { display: block; min-width: 0; }
a2ui-basic-column { display: flex; flex-direction: column; gap: var(--gap); }
a2ui-basic-row { display: flex; flex-wrap: wrap; gap: var(--gap); }
a2ui-basic-row > * { flex: 1 1 220px; min-width: 0; }
a2ui-basic-row > * > .tile { height: 100%; display: flex; flex-direction: column; }
a2ui-basic-row > * > .tile > .tile-number { margin-top: auto; }   /* numbers of one row on one line, also under a longer title */
a2ui-basic-text { color: var(--muted); }
ivy-number, ivy-number-v2, ivy-table, ivy-bar-chart { display: block; min-width: 0; }
.tile-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.tile-number { font-size: 30px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile td.open { width: 1%; white-space: nowrap; }
ivy-table, ivy-bar-chart, .cq { container-type: inline-size; }

/* bar chart: a table with a bar in each row */
table.bars th { font-weight: 500; width: 38%; padding: 6px 10px 6px 0; border: 0; overflow-wrap: break-word; }
table.bars td { padding: 6px 0; border: 0; }
.barline { display: flex; align-items: center; gap: 8px; }
/* the bar's length is its share of the track, the track is what the value leaves free: one scale for every row */
table.bars .track { flex: 1 1 auto; min-width: 0; display: block; }
table.bars .bar { display: block; height: 14px; border-radius: 4px; background: var(--bar); }
table.bars .bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 14px; }
@container (max-width: 460px) {
  table.bars, table.bars tbody, table.bars tr, table.bars th, table.bars td { display: block; width: auto; }
  table.bars tr { padding: 4px 0; }
  table.bars th { padding: 0; }
}

/* a table in a narrow tile becomes a list of cards, each value with its column name; tables with more columns switch earlier
   (5 or 6 columns: below 780 px, 7 or more: below 1000 px); an empty value says nothing in a card. Very narrow: name above value. */
@container (max-width: 560px) {
  table.rows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.rows, table.rows tbody, table.rows tr, table.rows td, table.rows tbody th { display: block; width: auto; }
  table.rows tbody th { border: 0; padding: 2px 0 4px; }
  table.rows tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; }
  table.rows tbody tr:last-child > * { border-bottom: 0; }
  table.rows td { border: 0; padding: 3px 0; display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; text-align: left; white-space: normal; overflow-wrap: break-word; }
  table.rows td.long { overflow-wrap: anywhere; }
  table.rows td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  table.rows td.open { display: block; width: auto; padding-top: 6px; }
  table.rows td.open::before { content: none; }
  table.rows td.empty { display: none; }
  table.rows td > details, table.rows td > form { grid-column: 1 / -1; }
}
@container (max-width: 780px) {
  table.rows.wide thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.rows.wide, table.rows.wide tbody, table.rows.wide tr, table.rows.wide td, table.rows.wide tbody th { display: block; width: auto; }
  table.rows.wide tbody th { border: 0; padding: 2px 0 4px; }
  table.rows.wide tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; }
  table.rows.wide tbody tr:last-child > * { border-bottom: 0; }
  table.rows.wide td { border: 0; padding: 3px 0; display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; text-align: left; white-space: normal; overflow-wrap: break-word; }
  table.rows.wide td.long { overflow-wrap: anywhere; }
  table.rows.wide td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  table.rows.wide td.open { display: block; width: auto; padding-top: 6px; }
  table.rows.wide td.open::before { content: none; }
  table.rows.wide td.empty { display: none; }
  table.rows.wide td > details, table.rows.wide td > form { grid-column: 1 / -1; }
}
@container (max-width: 1000px) {
  table.rows.wider thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.rows.wider, table.rows.wider tbody, table.rows.wider tr, table.rows.wider td, table.rows.wider tbody th { display: block; width: auto; }
  table.rows.wider tbody th { border: 0; padding: 2px 0 4px; }
  table.rows.wider tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; }
  table.rows.wider tbody tr:last-child > * { border-bottom: 0; }
  table.rows.wider td { border: 0; padding: 3px 0; display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; text-align: left; white-space: normal; overflow-wrap: break-word; }
  table.rows.wider td.long { overflow-wrap: anywhere; }
  table.rows.wider td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  table.rows.wider td.open { display: block; width: auto; padding-top: 6px; }
  table.rows.wider td.open::before { content: none; }
  table.rows.wider td.empty { display: none; }
  table.rows.wider td > details, table.rows.wider td > form { grid-column: 1 / -1; }
}
@container (max-width: 380px) {
  table.rows td, table.rows.wide td, table.rows.wider td { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- print: the content, without navigation and forms ---------- */
@media print {
  header.top, form, button, summary { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .tile, .turn { border-color: #999; break-inside: avoid; }
  details > *:not(summary) { display: block; }
}

/* Stück 13: prepared actions with their preview, exactly as they would go out */
dl.preview { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0; font-size: 14px; }
dl.preview dt { color: var(--muted); }
dl.preview dd { margin: 0; overflow-wrap: anywhere; }
pre.preview-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface); margin: 6px 0; }
button.small.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.small.primary:hover { background: var(--accent); filter: brightness(1.08); }

/* ---------- start page (Stück 15): figures on top, what waits for a decision first, rows with a fixed structure ---------- */
main { max-width: 1120px; }
.top-in { max-width: 1120px; }
.card { box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06); }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.page-head .lead { color: var(--muted); font-size: 15px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--fg); text-decoration: none; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); border-top: 3px solid var(--line); }
.kpi:hover { border-color: var(--control); }
.kpi.accent { border-top-color: var(--accent); }
.kpi.warn { border-top-color: var(--warn); }
.kpi-n { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-weight: 600; font-size: 14px; }
.kpi-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.main-col, .side-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
@media (max-width: 860px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }
.card.compact ul.plain li { padding: 6px 0; }
.approvals { border-left: 4px solid var(--accent); }
h2 .count { display: inline-block; margin-left: 8px; font-size: 13px; font-weight: 600; padding: 0 8px; border-radius: 999px; background: var(--accent-weak); color: var(--fg); vertical-align: 2px; }

ul.rows { list-style: none; padding: 0; margin: 0; }
li.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
li.row:first-child { padding-top: 2px; }
li.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-title .badge { margin: 0 6px 0 0; }
.row-detail { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 4px; }
.row-tags .badge { margin-left: 0; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.figure { font-weight: 700; font-size: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row-actions > span { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row-status { grid-column: 1 / -1; }
.row-status:empty { display: none; }
@media (max-width: 520px) {
  li.row { grid-template-columns: minmax(0, 1fr); }
  .row-side { flex-direction: column; align-items: flex-start; }   /* the figure, then the buttons: the same in every row */
  .row-actions, .row-actions > span { justify-content: flex-start; }
}

details.menu { position: relative; display: flex; align-items: center; }
details.menu > summary { list-style: none; cursor: pointer; display: inline-block; line-height: 1.5; padding: 2px 10px; font-size: 13px; font-weight: 500; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: " ▾"; }
details.menu[open] > summary { background: var(--accent-weak); }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 220px; display: flex; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16); }
.menu-list > a, .menu-list > button { display: block; width: 100%; text-align: left; margin: 0; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--fg); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; }
.menu-list > a:hover, .menu-list > button:hover { background: var(--accent-weak); filter: none; }

ul.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
ul.timeline > li { position: relative; padding: 0 0 12px 4px; font-size: 14px; overflow-wrap: anywhere; }
ul.timeline > li:last-child { padding-bottom: 0; }
ul.timeline > li::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.figure-line .big { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-actions > * { margin: 0; align-self: center; }
.badge.ok { color: var(--ok, #1d6b3a); background: var(--ok-bg, #e3f4e8); }
@media (prefers-color-scheme: dark) { .badge.ok { color: #8fd6a6; background: #183324; } }
p.ops { margin-bottom: 8px; }

/* ---------- start page, Stück 18: one list "Zu tun" with filters, compact rows, asking on top ---------- */
.page-head .lead { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.dot { display: inline-flex; align-items: center; gap: 6px; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot.ok { color: var(--ok, #1d6b3a); }
.dot.bad { color: var(--bad); }
@media (prefers-color-scheme: dark) { .dot.ok { color: #8fd6a6; } }
form.askbar { display: block; }
form.askbar > * + * { margin-top: 6px; }
.askbar-in { display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--control); border-radius: 12px; padding: 6px 6px 6px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.askbar-in input { border: 0 !important; padding: 6px 0 !important; background: transparent !important; min-width: 0; }
.askbar-in input:focus-visible { outline-offset: 4px; }
.askbar-in button { margin: 0; padding: 6px 18px; flex: none; }
.todo { padding: 0; }
.todo-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.todo-head h2 { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
button.chip { margin: 0; padding: 3px 10px 3px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; }
button.chip:hover { border-color: var(--control); filter: none; }
button.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-n { font-variant-numeric: tabular-nums; font-size: 13px; opacity: .85; }
.todo-list { padding: 4px 16px 8px; }
.todo > details.notes { padding: 0 16px 12px; }
h3.group-h { margin: 14px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p.empty { padding: 14px 0; }
ul.items { list-style: none; margin: 0; padding: 0; }
li.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; padding: 10px 0 10px 12px; border-bottom: 1px solid var(--line);
  position: relative; }
li.item:last-child { border-bottom: 0; }
li.item::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--line); }
li.item.k-deadline::before { background: var(--warn); }
li.item.k-noticed::before { background: var(--bad); }
li.item.k-waiting::before { background: var(--accent); }
.item-main { min-width: 0; }
.item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-title a { color: var(--fg); text-decoration: none; }
.item-title a:hover { color: var(--accent); text-decoration: underline; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 14px; color: var(--muted); margin-top: 1px; }
.item-meta > span:not(.badge) { overflow-wrap: anywhere; }
.item-meta .kind { font-weight: 600; font-size: 13px; }
.item-meta .badge { margin: 0; font-size: 12px; padding: 0 8px; }
.badge.accent { color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.item-side { display: flex; align-items: center; gap: 12px; }
.item-side .figure { font-size: 15px; min-width: 88px; text-align: right; }
.item-side .row-actions { flex-wrap: nowrap; }
details.menu > summary.dots { border-color: var(--line); color: var(--fg); font-size: 16px; line-height: 1.2; padding: 3px 9px; }
details.menu > summary.dots::after { content: none; }
.menu-list > p.menu-h { margin: 6px 10px 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.menu-list > hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-list > hr:last-child { display: none; }
.side-link { margin-top: 8px; }
.lines li { margin-bottom: 10px; }
.line-file { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.line-file button { margin-top: 0; }
.myview + .myview { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.myview h3 { margin: 0 0 6px; font-size: 1rem; }
@media (max-width: 640px) {
  li.item { grid-template-columns: minmax(0, 1fr); }
  .item-title { white-space: normal; }
  .item-side { justify-content: space-between; }
  .item-side .figure { min-width: 0; text-align: left; }
  .todo-head { padding: 12px; } .todo-list { padding: 0 12px 6px; }
}
/* the menu bar never widens the page: on a phone it scrolls inside itself */
header nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
@media (max-width: 640px) {
  .top-in { flex-wrap: nowrap; gap: 8px; }
  .brand-name { display: none; }
  header nav a, .logout { padding: 6px 7px; font-size: 14px; white-space: nowrap; }
  .item-side { flex-wrap: wrap; }
  .row-actions button { white-space: nowrap; }
}
/* the company in the header and the switch (Stück 18) */
.company { display: flex; align-items: center; min-width: 0; }
.company-name { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; padding-left: 10px; border-left: 1px solid var(--line); }
details.company-switch > summary { border-color: var(--line); color: var(--fg); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.company-switch .menu-list { left: 0; right: auto; }
.menu-list > span.menu-current { display: block; padding: 7px 10px; font-size: 14px; font-weight: 600; color: var(--fg); }
@media (max-width: 640px) { .company-name, details.company-switch > summary { max-width: 110px; } }
/* "Alle Firmen" (G34): one card per company, the company on each row */
.kpis.companies { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.company-card .kpi-label { font-size: 15px; }
.company-card .dot { font-size: 13px; margin-top: 4px; }
.company-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--fg); background: var(--surface); margin-left: 6px; }
.item-meta .company-tag { margin-left: 0; }
header nav[hidden] { display: none; }
/* "Zugänge" (Stück 19) */
.card.notice { border-left: 4px solid var(--warn); }
form.access-form { max-width: 420px; margin-top: 10px; }
.card h2 .badge { vertical-align: 2px; }
input:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; background: var(--bg); }
