/* Paqu design system — the one stylesheet every page of the law firm's interface builds on.
   Guide: docs/design/system.md (what each component is for, and the rules of use).
   Rules behind it: docs/design/principles.md. Style choices by Sebastian, 2026-11-24:
   Paqu's colours and fonts, a light head, serif headings, a status as dot and text,
   medium density (rows of 40 px, corners of 6 and 8 px).

   Order: 1 fonts · 2 tokens · 3 base · 4 frame (bars) · 5 page and head · 6 text ·
   7 buttons and links · 8 status, tags · 9 tabs, segments · 10 tables · 11 forms ·
   12 surfaces and layout · 13 notices, empty view · 14 overlays · 15 chat · 16 documents ·
   17 small parts.

   A page stylesheet holds layout only and uses these tokens: no colour literal, no font
   family and no new button, pill or table style outside this file (tests/test_design_system.py). */

/* 1 Fonts: local files (no font service: no visitor IP leaves Paqu) */
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.260c81a4759b.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.1ad231aac0a8.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Serif Display"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/dm-serif-display-latin-400-normal.d797ca513ac2.woff2") format("woff2"); }
@font-face { font-family: "DM Serif Display"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/dm-serif-display-latin-400-italic.581414e1e577.woff2") format("woff2"); }

/* 2 Tokens */
:root {
  /* surfaces: ground for context, white for what is being worked on, one raised surface */
  --bg: #F3F1EC; --panel: #FCFBF9; --raised: #FFFFFF; --fill: #F6F4EE; --fill-2: #EBE8E0;
  --line-2: #ECE8DF; --line: #E5E1D8; --line-strong: #CFC9BC;
  /* ink */
  --ink: #1E2436; --ink-2: #4B5263; --ink-meta: #636978; --ink-3: #888E9C; --ink-4: #B9BDC6;
  /* the accent: only for what can be operated */
  --accent: #3D4F8A; --accent-hover: #2B3968; --accent-soft: #ECEFF8; --accent-soft-2: #D5DCF0;
  /* the one filled button */
  --primary: #1E2436; --primary-hover: #2C354E; --on-solid: #FCFBF9;
  /* states: green, yellow, red, blue and neutral — never for categories */
  --success: #255342; --success-dot: #2F7A5C; --success-bg: #E7F2EC; --success-line: #CEE4D8;
  --warn: #854D27; --warn-dot: #C2792F; --warn-bg: #F8EFE6; --warn-line: #EBD8C5;
  --danger: #9E2F2F; --danger-dot: #C23B3B; --danger-bg: #FBEBEB; --danger-line: #F2D0D0;
  --info: #2A5F82; --info-dot: #3B82A6; --info-bg: #E8F1F6; --info-line: #CFE1EC;
  --neutral: #4B5263; --neutral-dot: #B9BDC6; --neutral-bg: #EBE8E0; --neutral-line: #DFDBD0;
  --mark: #F6E7B0; /* a marked passage in a text that is read */
  --scrim: rgba(30, 36, 54, .36); --hover: rgba(30, 36, 54, .05); --focus: rgba(61, 79, 138, .28);
  /* type */
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --display: "DM Serif Display", Georgia, serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif; /* the law firm's letter */
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-title: 24px; --fs-h2: 18px; --fs-base: 14px; --fs-mono: 13px; --fs-label: 12px;
  /* space: 8, 16, 24 (4 inside a control) */
  --s-1: 4px; --s-2: 8px; --s-3: 16px; --s-4: 24px;
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-round: 999px;
  --h-control: 32px; --h-control-sm: 28px; --h-row: 40px; --h-bar: 52px; --h-subbar: 40px;
  --shadow-raised: 0 6px 20px rgba(30, 36, 54, .08), 0 1px 2px rgba(30, 36, 54, .04);
  --shadow-overlay: 0 16px 40px rgba(30, 36, 54, .16);
  --page-max: 1600px; --gutter: 24px;
}

/* 3 Base */
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); }
body { color: var(--ink); font-family: var(--sans); font-size: var(--fs-base); line-height: 20px;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding-left: 20px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(61, 79, 138, .35); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--focus); border-radius: var(--r-sm); }
b, strong { font-weight: 600; }
mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-3) 0; }
summary { cursor: pointer; }
svg { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* 4 Frame: at most two bars — the menu and, for a group of several screens, its screens */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: relative; z-index: 30; flex: none; display: flex; align-items: center; gap: var(--s-3); min-height: var(--h-bar);
  padding: 0 max(var(--gutter), calc((100% - var(--page-max)) / 2 + var(--gutter))); background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar form { margin: 0; }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); flex: none; color: var(--ink); text-decoration: none; }
.brand img { display: block; height: 28px; width: auto; }
.brand:hover { color: var(--ink); }
.brand-party { color: var(--ink-2); font-weight: 500; }
.mainnav { display: flex; gap: 2px; min-width: 0; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; height: var(--h-control); padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav-link:hover { background: var(--hover); color: var(--ink); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-count { font-family: var(--mono); font-size: var(--fs-label); font-weight: 400; color: var(--ink-meta); }
.is-active > .nav-count { color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.search-form { position: relative; }
.search { display: inline-flex; align-items: center; gap: var(--s-2); height: var(--h-control); width: 280px; max-width: 100%; padding: 0 6px 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--raised); color: var(--ink-meta); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.search-preview { position: absolute; right: 0; top: 38px; width: 440px; max-width: calc(100vw - 32px); max-height: min(70vh, 560px); overflow-y: auto;
  padding: 6px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-overlay); z-index: 45; }
.search-preview .sp-group { display: flex; justify-content: space-between; padding: 8px 10px 4px; font-size: var(--fs-label); font-weight: 500; color: var(--ink-meta); }
.search-preview .sp-option { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.search-preview .sp-option[aria-selected="true"] { background: var(--hover); }
.search-preview .sp-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-preview .sp-state, .search-preview .sp-sub { font-size: var(--fs-label); color: var(--ink-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.search-preview .sp-sub { grid-column: 1 / -1; }
.search-preview .sp-all { grid-template-columns: 1fr; margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); font-weight: 600; color: var(--accent); }
.search-preview .sp-empty { padding: 10px; color: var(--ink-meta); }
.subnav { flex: none; display: flex; gap: var(--s-4); min-height: var(--h-subbar); overflow-x: auto;
  padding: 0 max(var(--gutter), calc((100% - var(--page-max)) / 2 + var(--gutter))); border-bottom: 1px solid var(--line); }
.subnav-link { display: inline-flex; align-items: center; gap: 6px; height: var(--h-subbar); border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.subnav-link:hover { color: var(--ink); }
.subnav-link.is-active { color: var(--ink); border-bottom-color: var(--accent); }

/* 5 Page and head */
.page { flex: 1 1 auto; width: 100%; max-width: var(--page-max); margin: 0 auto; padding: var(--s-4) var(--gutter) 48px; }
.page-narrow { max-width: 960px; }
/* A work page fills the window below the bars and scrolls inside its columns. */
.app:has(> .page-full) { height: 100vh; min-height: 560px; overflow: hidden; }
/* A work page fills the window's height, and the same width as the bars above it: on a window
   wider than --page-max its sides stand where the bars' content starts (less the gutter, which
   the page's head and columns bring themselves), not at the window's edge. */
.page-full { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: var(--page-max); margin: 0 auto; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-3); min-height: var(--h-control); }
.pagehead-lead { flex: 1 1 320px; min-width: 0; }
.pagehead-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-3); margin-top: var(--s-1); color: var(--ink-2); }
.pagehead-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); margin-left: auto; min-height: var(--h-control); }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: var(--s-1); color: var(--ink-meta); text-decoration: none; font-size: var(--fs-label); }
.back:hover { color: var(--accent); }
.foot { margin-top: 32px; font-size: var(--fs-label); color: var(--ink-3); }

/* 6 Text: four roles — page title, section title, label, data — and a monospaced face */
.title { font-family: var(--display); font-size: var(--fs-title); font-weight: 400; line-height: 30px; overflow-wrap: anywhere; }
.title .k { color: var(--ink-meta); }
.h2 { font-family: var(--display); font-size: var(--fs-h2); font-weight: 400; line-height: 24px; }
.h3 { font-size: var(--fs-base); font-weight: 600; line-height: 20px; }
.label { font-size: var(--fs-label); font-weight: 500; line-height: 16px; color: var(--ink-meta); }
.muted { color: var(--ink-meta); }
.tiny { font-size: var(--fs-label); line-height: 16px; }
.strong { font-weight: 600; }
.mono, .num { font-family: var(--mono); font-size: var(--fs-mono); font-weight: 400; font-variant-numeric: tabular-nums; }
.num { white-space: nowrap; }
.tiny .mono, .tiny .num, .mono.tiny, .num.tiny, .label .mono { font-size: var(--fs-label); }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.dash { color: var(--ink-4); } /* an empty cell: a fine short dash */
.bad-text { color: var(--danger); }
.ok-text { color: var(--success); }
.warn-text { color: var(--warn); }
.prose { line-height: 22px; overflow-wrap: anywhere; max-width: 76ch; }
.prose > * + * { margin-top: var(--s-2); }
.prose h2, .prose h3, .prose h4 { font-size: var(--fs-base); font-weight: 600; margin-top: var(--s-3); }
.prose table { border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* 7 Buttons and links: one filled button per page, every other action is quiet */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h-control); padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--raised); color: var(--ink); font-size: var(--fs-base); font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { background: var(--fill); color: var(--ink); border-color: var(--ink-3); }
.btn-primary { height: 36px; padding: 0 16px; background: var(--primary); border-color: var(--primary); color: var(--on-solid); font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-solid); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); padding: 0 8px; }
.btn-quiet:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent-hover); }
.btn-confirm { font-weight: 600; } /* of two quiet actions the confirming one: an icon and bold type */
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.btn-sm { height: var(--h-control-sm); padding: 0 10px; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--fill-2); border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }
.btn-quiet:disabled { background: transparent; border-color: transparent; }
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: var(--h-control-sm); height: var(--h-control-sm); padding: 0; border: 1px solid transparent;
  border-radius: var(--r-sm); background: transparent; color: var(--ink-2); cursor: pointer; }
.ibtn:hover { background: var(--hover); color: var(--ink); }
.ibtn:disabled { opacity: .45; cursor: not-allowed; }
.link { padding: 0; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-decoration-color: rgba(61, 79, 138, .35);
  text-underline-offset: 3px; cursor: pointer; } /* a button that reads as a link */
.link:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
.plain { color: inherit; text-decoration: none; } /* a link that reads as data until hovered (a name in a row) */
.plain:hover { color: var(--accent); text-decoration: underline; }

/* 8 Status and tags. A status is a dot and a text; done is a check mark and a text. */
.status { display: inline-flex; align-items: baseline; gap: 7px; color: var(--ink); white-space: nowrap; }
.status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-dot); transform: translateY(-1px); }
.status-ok::before { background: var(--success-dot); }
.status-warn::before { background: var(--warn-dot); }
.status-bad::before { background: var(--danger-dot); }
.status-info::before { background: var(--info-dot); }
.status-bad { color: var(--danger); }
.status-wrap { white-space: normal; }
.done { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 500; }
/* A tag marks a source or a reference inside running text (M1, L2, "Annahme"): small, square, monospaced. */
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--panel);
  color: var(--ink-2); font-family: var(--mono); font-size: var(--fs-label); font-weight: 400; line-height: 1; white-space: nowrap; text-decoration: none; vertical-align: 1px; }
button.tag, a.tag { cursor: pointer; color: var(--accent); }
button.tag:hover, a.tag:hover { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent-hover); }
.tag.is-on, .tag[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-solid); }
.tag-bad { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.count { font-family: var(--mono); font-size: var(--fs-label); font-weight: 400; color: var(--ink-meta); } /* a count is a number, not a pill */

/* 9 Tabs (saved views, parts of one object) and segments (ways of seeing the same thing) */
.tabs { display: flex; flex-wrap: wrap; gap: 0 var(--s-4); margin-bottom: var(--s-2); }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--ink-2); font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.is-active, .tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count { font-weight: 400; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--fill-2); }
.seg > a, .seg > button { display: inline-flex; align-items: center; gap: 6px; height: var(--h-control-sm); padding: 0 10px; border: 0; border-radius: var(--r-xs); background: transparent;
  color: var(--ink-2); font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.seg > a:hover, .seg > button:hover { color: var(--ink); }
.seg > [aria-pressed="true"], .seg > [aria-current="page"], .seg > .is-active { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(30, 36, 54, .12); }

/* 10 Tables: one look for every list. Filter and sort sit in the column head (table.js). */
.table-wrap { overflow-x: auto; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; }
.table th { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink-meta); font-size: var(--fs-label); font-weight: 500;
  line-height: 16px; text-align: left; white-space: nowrap; vertical-align: middle; }
.table td { height: var(--h-row); padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--fill); }
.table tr.is-selected { background: var(--accent-soft); }
.table td.top, .table.top td { vertical-align: top; }
.table th.r, .table td.r { text-align: right; }
.table .num, .table .mono, .table .status { white-space: nowrap; }
.table .sub { display: block; font-size: var(--fs-label); line-height: 16px; color: var(--ink-meta); }
.table-flat { background: transparent; border: 0; border-radius: 0; } /* a table inside a surface or on the ground: lines only */
.table-flat .table th { background: transparent; padding-left: 0; border-bottom-color: var(--line-strong); }
.table-flat .table td { padding-left: 0; }
.table-flat .table tbody tr:hover { background: transparent; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--ink); }
.table th[data-sort]::after { content: "↑"; margin-left: 4px; color: transparent; }
.table th[data-sort]:hover::after { color: var(--ink-4); }
.table th[aria-sort="ascending"]::after { content: "↑"; color: var(--accent); }
.table th[aria-sort="descending"]::after { content: "↓"; color: var(--accent); }
.th-filter { position: relative; display: inline-block; margin-left: 4px; }
.th-filter > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: var(--r-xs); color: var(--ink-3); }
.th-filter > summary::-webkit-details-marker { display: none; }
.th-filter > summary:hover, .th-filter[open] > summary, .th-filter.is-set > summary { background: var(--accent-soft); color: var(--accent); }
.th-filter-pop { position: absolute; left: 0; top: 24px; z-index: 20; min-width: 200px; max-height: 320px; overflow: auto; padding: var(--s-2); background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-overlay); display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-base); font-weight: 400; color: var(--ink); white-space: normal; }
.table-none td { height: 96px; text-align: center; color: var(--ink-meta); }
/* The same look for a grid of rows that is no <table> (cells that are operated one by one). */
.grid-head, .grid-row { display: grid; grid-template-columns: var(--cols); gap: 0 12px; align-items: center; padding: 0 12px; }
.grid-head { min-height: 36px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink-meta); font-size: var(--fs-label); font-weight: 500; }
.grid-row { min-height: var(--h-row); border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.grid-row:last-child { border-bottom: 0; }
a.grid-row:hover, .grid-row.is-link:hover { background: var(--fill); color: var(--ink); }
.grid-row.is-selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
/* A part of a grid table with a meaning of its own (the sample of an approval, "Erledigt"): one line
   across every column, between the rows. Not for grouping rows by the value of a column. A <button>
   folds the rows after it (the page's script). */
.grid-section { display: flex; align-items: center; flex-wrap: wrap; gap: 4px var(--s-3); width: 100%; min-height: 36px; padding: 8px 12px;
  border: 0; border-bottom: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); font-family: inherit; font-size: var(--fs-label); text-align: left; }
button.grid-section { cursor: pointer; }
button.grid-section:hover { color: var(--ink); }
button.grid-section[aria-expanded="false"] > svg:first-child { transform: rotate(-90deg); }
.grid-section > .grid-section-h { color: var(--ink); font-size: var(--fs-base); font-weight: 600; }
.grid-section > .end { margin-left: auto; }
.grid-section-warn { background: var(--warn-bg); border-bottom-color: var(--warn-line); }
.grid-section-ok { background: var(--success-bg); border-bottom-color: var(--success-line); }
.grid-section-warn, .grid-section-ok { font-size: var(--fs-base); }

/* 11 Forms */
.field { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.field > label, .field > .label { font-size: var(--fs-label); font-weight: 500; line-height: 16px; color: var(--ink-meta); }
fieldset.field { margin: 0; padding: 0; border: 0; }
fieldset.field > legend { padding: 0; margin-bottom: var(--s-1); font-size: var(--fs-label); font-weight: 500; line-height: 16px; color: var(--ink-meta); }
.input { height: var(--h-control); width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--raised); color: var(--ink); }
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input:disabled { background: var(--fill-2); color: var(--ink-3); cursor: not-allowed; }
textarea.input { height: auto; min-height: 72px; padding: 8px 10px; line-height: 20px; resize: vertical; }
select.input { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-meta) 50%), linear-gradient(135deg, var(--ink-meta) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-sm { height: var(--h-control-sm); }
/* A text edited in place (2026-11-25): reads as text, a line on hover, the field on focus; saved as it changes. */
.input-inline { display: block; width: 100%; margin: -3px -5px; padding: 2px 4px; border: 1px solid transparent; border-radius: var(--r-xs);
  background: transparent; color: inherit; font: inherit; line-height: inherit; resize: none; overflow: hidden; }
.input-inline:hover { border-color: var(--line); }
.input-inline:focus { border-color: var(--accent); background: var(--raised); outline: none; box-shadow: 0 0 0 3px var(--focus); }
select.input-inline { display: inline-block; width: auto; appearance: none; cursor: pointer; }
.input-auto { width: auto; }
.input.is-invalid { border-color: var(--danger-dot); }
.field-error { font-size: var(--fs-label); color: var(--danger); }
.check, .radio, .field > label.check, .field > label.radio { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-base); font-weight: 400; line-height: 20px; color: var(--ink); cursor: pointer; }
.check input, .radio input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
/* A switch: a checkbox that turns a setting on or off at once (no save button). */
input.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 28px; height: 16px; margin: 0; border-radius: var(--r-round); background: var(--line-strong);
  cursor: pointer; transition: background-color .15s ease-out; }
input.switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--raised); transition: transform .15s ease-out; }
input.switch:checked { background: var(--accent); }
input.switch:checked::before { transform: translateX(12px); }
input.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2) var(--s-3); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); }
form.inline { display: inline-flex; align-items: center; gap: var(--s-2); margin: 0; }

/* 12 Surfaces and layout: space instead of boxes, never a box inside a box */
.surface { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); }
.surface-pad { padding: var(--s-3); }
.sec { margin-top: var(--s-4); }
.sec:first-child { margin-top: 0; }
.sec-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-2); margin-bottom: var(--s-2); }
.sec-h > .muted, .sec-h > .status, .sec-h > .seg { margin-left: var(--s-2); }
.sec-h > .btn:last-child, .sec-h > form:last-child, .sec-h > .row:last-child { margin-left: auto; }
/* A section folds by the sign before its title (paqu.js adds it on padded pages and keeps the
   state per screen; `data-fold="off"` on a section leaves it out). The sign hangs in the gutter,
   so the left text edge stays. */
.sec.is-foldable > .sec-h { position: relative; }
.fold-toggle { position: absolute; left: -20px; top: 0; width: 18px; height: 24px; padding: 0; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--ink-4); cursor: pointer; }
.fold-toggle::before { content: ""; position: absolute; left: 5px; top: 7px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .12s ease; }
.fold-toggle:hover, .sec-h:hover > .fold-toggle { color: var(--accent); }
.sec.is-folded > .sec-h > .fold-toggle::before { top: 9px; transform: rotate(-45deg); }
.sec.is-folded > :not(.sec-h) { display: none !important; }
.sec.is-folded > .sec-h { margin-bottom: 0; }
.sec.is-folded { padding-bottom: var(--s-3); border-bottom: 1px solid var(--line); }
.right { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.row-baseline { align-items: baseline; }
.grow { flex: 1 1 auto; min-width: 0; }
.cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-4); }
.cols > .main { flex: 999 1 640px; min-width: 0; }
.cols > .side { flex: 1 1 300px; max-width: 440px; min-width: 280px; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3) var(--s-4); }
/* The work page: context left (ground), the object in the middle (white), the check right. */
/* The columns' box ends where the bars' content ends: its left edge stands under the logo, its right
   edge under the bar's last element (Sebastian, 2026-11-24: "abschließend mit dem Logo links"). A line
   on each side closes it, without moving a column. On a phone the box takes the whole width. */
.work { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: var(--work-cols, 360px minmax(0, 1fr) 352px); border-top: 1px solid var(--line);
  margin: 0 var(--gutter); box-shadow: -1px 0 0 var(--line), 1px 0 0 var(--line); }
.work > * { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.work-ctx { background: var(--bg); border-right: 1px solid var(--line); }
.work-obj { background: var(--raised); border-right: 1px solid var(--line); }
.work-chk { background: var(--panel); }
.work-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* The handle on the context column's right edge: drag it (or use the arrow keys) to change the
   column's width; a double click takes the page's own width back. paqu.js sets --work-ctx and
   .is-sized on .work and remembers the width per page. data-min: the column's smallest width,
   data-rest: what the other columns need (both in px). */
.work.is-sized { --work-cols: var(--work-ctx) minmax(0, 1fr) 352px; }
.work > :has(> .work-split) { position: relative; z-index: 2; }
.work-split { position: absolute; z-index: 5; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; touch-action: none; }
.work-split::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background-color .12s; }
.work-split:hover::after, .work-split:focus-visible::after, .work-split.is-dragging::after { background: var(--accent); }
.work-split:focus-visible { outline: 0; }
.is-resizing, .is-resizing * { cursor: col-resize; user-select: none; }
.work-pad { padding: var(--s-3) var(--gutter); } /* the gutter, as the bars above: one left edge */
.work-head { flex: none; padding: 12px var(--gutter); }
.work-head .pagehead { margin-bottom: 0; align-items: center; }
.work-head .title { display: flex; align-items: baseline; gap: var(--s-2); }
.work-head .tabs { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: minmax(88px, max-content) minmax(0, 1fr); gap: var(--s-1) var(--s-3); }
.kv > dt, .kv > .k { font-size: var(--fs-label); line-height: 20px; color: var(--ink-meta); }
.kv > dd, .kv > .v { min-width: 0; overflow-wrap: anywhere; }
.list { list-style: none; padding: 0; }
.list > li, .list > .list-item { padding: var(--s-2) 0; border-bottom: 1px solid var(--line-2); }
.list > li:last-child, .list > .list-item:last-child { border-bottom: 0; }
.stats { display: flex; flex-wrap: wrap; gap: var(--s-3) 40px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat > b, .stat > .v { font-family: var(--mono); font-size: var(--fs-h2); font-weight: 400; line-height: 24px; }
.stat > .label { order: -1; }
.stat > .dash, .stat > b > .dash { font-family: var(--mono); font-size: var(--fs-h2); line-height: 24px; }
.matter-name > summary { list-style: none; }
.matter-name > summary::-webkit-details-marker { display: none; }
.matter-name[open] > summary { margin-bottom: var(--s-2); }
.matter-name > form { max-width: 560px; }
details.fold > summary { color: var(--accent); font-weight: 500; list-style-position: inside; }
details.fold[open] > summary { margin-bottom: var(--s-2); }

/* 13 Notices and the empty view */
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: 10px var(--s-3); border: 1px solid var(--neutral-line); border-radius: var(--r-sm);
  background: var(--fill); color: var(--ink-2); }
.notice-ok { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.notice-bad { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.notice-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.flash { list-style: none; margin: 0 0 var(--s-3); padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.flash li { padding: 10px var(--s-3); border: 1px solid var(--success-line); border-radius: var(--r-sm); background: var(--success-bg); color: var(--success); font-weight: 500; }
.flash li.error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.flash li.warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.flash li.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.page-full > .flash { position: fixed; top: calc(var(--h-bar) + var(--s-2)); left: 50%; transform: translateX(-50%); z-index: 50; min-width: 360px; max-width: 720px; box-shadow: var(--shadow-overlay); border-radius: var(--r-sm); }
/* Empty view and error view: centred, one sign, one short line, at most two actions. */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); padding: 48px var(--s-3); color: var(--ink-meta); text-align: center; }
.empty-sign { color: var(--ink-4); line-height: 1; }
.empty .row { justify-content: center; margin-top: var(--s-2); }

/* 14 Overlays: dialog, menu, toast */
dialog.dialog { width: 520px; max-width: calc(100vw - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised); color: var(--ink); box-shadow: var(--shadow-overlay); }
dialog.dialog::backdrop { background: var(--scrim); }
.dialog-wide { width: 720px !important; }
.dialog-h { padding: var(--s-3) var(--s-4) 0; }
.dialog-b { padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.dialog-f { display: flex; justify-content: flex-end; gap: var(--s-2); padding: 12px var(--s-4); border-top: 1px solid var(--line); background: var(--panel); border-radius: 0 0 var(--r-md) var(--r-md); }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: 38px; z-index: 40; min-width: 220px; padding: 6px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-overlay); }
.menu-list.left { right: auto; left: 0; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: var(--s-2); width: 100%; padding: 7px 10px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink); font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--hover); }
.menu-list .menu-who { padding: 6px 10px; font-size: var(--fs-label); color: var(--ink-meta); }
.menu-list hr { margin: 4px 0; }
.toast { position: fixed; left: 50%; bottom: var(--s-4); transform: translateX(-50%); z-index: 60; max-width: 90vw; padding: 10px var(--s-3); border-radius: var(--r-sm);
  background: var(--ink); color: var(--on-solid); font-weight: 500; box-shadow: var(--shadow-overlay); }
.toast.is-error { background: var(--danger); }
/* A toast with one action that runs out ("Gesendet · Rückgängig"): the bar shrinks in --d. */
.toast .link { color: var(--accent-soft-2); font-weight: 600; }
.toast-act { display: flex; align-items: center; gap: var(--s-3); overflow: hidden; }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent-soft-2); transform-origin: left; animation: paqu-drain var(--d, 3s) linear forwards; }
@keyframes paqu-drain { to { transform: scaleX(0); } }
.pop:not([hidden]) { animation: paqu-pop .14s ease-out both; transform-origin: top right; }
.pop { position: absolute; z-index: 40; max-width: 420px; padding: 12px 14px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-overlay); }

/* 15 Chat: the WhatsApp history as a real chat, the same on every page that shows one */
.chat { display: flex; flex-direction: column; gap: var(--s-2); }
.bub { max-width: 78%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); overflow-wrap: anywhere; }
.bub-in { align-self: flex-start; border-bottom-left-radius: var(--r-xs); background: var(--panel); }
.bub-out { align-self: flex-end; border-bottom-right-radius: var(--r-xs); background: var(--accent-soft); border-color: var(--accent-soft-2); } /* Mimi */
.bub-law { align-self: flex-end; border-bottom-right-radius: var(--r-xs); background: var(--fill-2); border-color: var(--neutral-line); } /* a person of the team */
.bub-sys { align-self: center; max-width: 92%; border-style: dashed; background: transparent; color: var(--ink-2); } /* a system event */
.bub-note { align-self: stretch; max-width: none; background: var(--warn-bg); border-color: var(--warn-line); } /* a note for the team only */
.bub-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 2px; font-size: var(--fs-label); font-weight: 600; line-height: 16px; color: var(--ink-2); }
.bub-who > span + span::before { content: "· "; font-weight: 400; }
.bub-who > .muted { font-weight: 400; }
.bub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: var(--fs-label); line-height: 16px; color: var(--ink-meta); }
.bub-opts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.opt { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--r-xs); background: var(--raised); font-size: var(--fs-label); font-weight: 500; }
button.opt { cursor: pointer; color: var(--accent); } /* an option that can be tapped (the test chat) */
button.opt:hover { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent-hover); }
.opt-sel { background: var(--ink); border-color: var(--ink); color: var(--on-solid); }
.bub.is-marked, .bub:target { box-shadow: 0 0 0 2px var(--accent); }
.bub-menu > summary { list-style: none; }
.bub-menu > summary::-webkit-details-marker { display: none; }
.bub-menu[open] { flex: 1 0 100%; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); margin-top: var(--s-1); }
/* "Antworten" at a message of the person: a round ↩ beside it when the pointer is on the message (always on a touch screen). */
.bub { position: relative; }
.bub-reply { position: absolute; top: 50%; right: -38px; width: 28px; height: 28px; margin-top: -14px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--raised); color: var(--accent); cursor: pointer; opacity: 0; transition: opacity .12s ease-out; }
.bub-reply:hover { background: var(--accent-soft); border-color: var(--accent-soft-2); }
.bub:hover .bub-reply, .bub-reply:focus-visible { opacity: 1; }
@media (hover: none) { .bub-reply { opacity: 1; } }
/* A message outside the chosen case: greyed, readable on hover. Hidden messages: one fine line that opens them. */
.bub.is-dim { opacity: .5; transition: opacity .15s ease-out; }
.bub.is-dim:hover { opacity: 1; }
.chat-run { align-self: center; display: inline-flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: var(--ink-meta); font-size: var(--fs-label); cursor: pointer; }
.chat-run { max-width: 100%; }
.chat-run > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-run::before, .chat-run::after { content: ""; flex: none; width: 48px; height: 1px; background: var(--line); }
.chat-run:hover { color: var(--accent); }
.bub.is-flash { animation: paqu-flash 1.4s ease-out .1s both; }
@keyframes paqu-flash { from { box-shadow: 0 0 0 2px var(--accent), 0 0 0 10px var(--focus); } to { box-shadow: 0 0 0 2px var(--accent), 0 0 0 0 transparent; } }
/* "Warum?" at a message of Mimi: her reasons and the team's comments, below the message. */
.bub-reasons { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--accent-soft-2); }
.bub-rank { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bub-rank > li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: var(--s-2); }
.bub-comment { display: flex; flex-direction: column; gap: 2px; }
.bub-comment-form { flex-wrap: wrap; }
.bub-comment-form > input[type=text] { flex: 1 1 100%; }
.bub.is-dim.is-open { opacity: 1; } /* its reasons are being read */
.chat-day { align-self: center; font-size: var(--fs-label); color: var(--ink-meta); }
.composer.is-note { background: var(--warn-bg); border-color: var(--warn-line); } /* writing a note for the team */
.composer { display: flex; flex-direction: column; gap: var(--s-2); margin: 0; padding: var(--s-3); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-raised); }

/* 16 Documents: a shadow only for the document being written; a document that is read is flat */
.sheet { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-raised); }
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.letter { font-family: var(--serif); font-size: 16px; line-height: 26px; }
del.del { padding: 0 2px; border-radius: 2px; background: var(--danger-bg); color: var(--danger); text-decoration: line-through; } /* a compared text: removed */
ins.ins { padding: 0 2px; border-radius: 2px; background: var(--success-bg); color: var(--success); text-decoration: underline; text-underline-offset: 2px; } /* … and added */
.quote { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); overflow-wrap: anywhere; }

/* 17 Small parts */
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: var(--r-xs); background: var(--raised); color: var(--ink-2); font-family: var(--mono); font-size: var(--fs-label); font-weight: 400; line-height: 1; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--ink); color: var(--on-solid);
  font-size: var(--fs-label); font-weight: 600; }
.avatar-sm { width: 22px; height: 22px; }
.keygrid { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: var(--s-2) 12px; align-items: center; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: paqu-spin .8s linear infinite; }
@keyframes paqu-spin { to { transform: rotate(360deg); } }
.skeleton { border-radius: var(--r-xs); background: linear-gradient(90deg, var(--fill-2), var(--fill), var(--fill-2)); background-size: 200% 100%; animation: paqu-shimmer 1.4s linear infinite; }
@keyframes paqu-shimmer { to { background-position: -200% 0; } }
/* "Mimi schreibt …": three dots that come and go. */
.dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.dots > span { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: paqu-dot 1.2s ease-in-out infinite; }
.dots > span:nth-child(2) { animation-delay: .15s; }
.dots > span:nth-child(3) { animation-delay: .3s; }
@keyframes paqu-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes paqu-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes paqu-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); }
.steps > li { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-meta); }
.steps > li.is-done { color: var(--ink); }
.steps > li.is-current { color: var(--ink); font-weight: 600; }
.bar-track { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.bar-fill { display: block; width: var(--w, 0); height: 100%; background: var(--ink-3); } /* style="--w: 40%" */

@media (max-width: 900px) {
  .work-split { display: none; }
  .topbar { flex-wrap: wrap; padding-top: var(--s-2); padding-bottom: var(--s-2); }
  .mainnav { order: 3; flex: 1 0 100%; overflow-x: auto; }
  .search { width: 180px; }
  .cols > .side { max-width: none; }
  .twocol { grid-template-columns: 1fr; }
  .work { grid-template-columns: 1fr; overflow: auto; margin: 0; box-shadow: none; }
  .app:has(> .page-full) { height: auto; overflow: visible; }
  .bub { max-width: 92%; }
}
@media (max-width: 600px) {
  .search-preview { position: fixed; left: 16px; right: 16px; width: auto; max-width: none; }
  .menu-list { position: fixed; top: auto; left: 16px; right: 16px; min-width: 0; margin-top: 4px; }
}
/* Whoever asked their computer for less motion gets none. */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .topbar, .subnav, .toast { display: none; } .app { height: auto !important; overflow: visible !important; } }
