/* ScreenBros OS – Oberfläche
   Vorbild: ein nüchterner Behörden-Arbeitsplatz. Klare Fensterrahmen, dichte Tabellen, Farbe nur mit Bedeutung. */

@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; }
@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; }
@font-face { font-family: 'PlexMono'; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; }
@font-face { font-family: 'PlexMono'; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; }
@font-face { font-family: 'Narrow'; src: url('../fonts/archivo-narrow-latin-600-normal.woff2') format('woff2'); font-weight: 600; }
@font-face { font-family: 'Narrow'; src: url('../fonts/archivo-narrow-latin-700-normal.woff2') format('woff2'); font-weight: 700; }

:root {
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --accent-soft: #dfe8f2;
  --text: #1b1f24;
  --muted: #5b6470;
  --faint: #8a929c;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-3: #e9ecef;
  --line: #d9dde2;
  --line-strong: #a9b0b8;
  --chrome: #e4e7eb;
  --chrome-inactive: #f0f2f4;
  --frame: #7d858e;
  --sel: #cfe0f5;
  --sel-line: #6f9fd6;
  --danger: #b42318;
  --danger-soft: #fbe9e7;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --ok: #2d6a32;
  --ok-soft: #e6f2e7;
  --taskbar: #1c2025;
  --taskbar-2: #2a3037;
  --taskbar-text: #e6e8eb;
  --mono: 'PlexMono', ui-monospace, Consolas, monospace;
  --sans: 'Plex', 'Segoe UI', Tahoma, sans-serif;
  --narrow: 'Narrow', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 13px/1.4 var(--sans);
  color: var(--text);
  background: #0e1013;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--sel); }

/* ============================================================== Geräte (ingame) */
.device { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.device-body { position: relative; }
.device-brand, .device-leds, .device-power, .device-stand { display: none; }
body.mode-web .device-body { width: 100vw; height: 100vh; }
body.mode-web .screen { width: 100%; height: 100%; }

body.mode-nui { background: transparent; }
body.mode-nui .device { pointer-events: none; }
body.mode-nui .device-body { pointer-events: auto; }
body.mode-nui .screen { position: absolute; transform-origin: 0 0; }

/* Toughbook im Fahrzeug */
body.dev-laptop .device-body {
  background: linear-gradient(#3a3f45, #2b2f34);
  border-radius: 22px;
  border: 1px solid #15181b;
  outline: 7px solid #1b1d20; outline-offset: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
}
body.dev-laptop .device-brand { display: block; position: absolute; left: 34px; top: 12px; font: 600 11px var(--narrow); letter-spacing: .16em; color: #9aa1a8; }
body.dev-laptop .device-brand b { color: #c7ccd1; font-weight: 700; }
body.dev-laptop .device-leds { display: flex; position: absolute; right: 34px; top: 14px; gap: 10px; }
.led { width: 7px; height: 7px; border-radius: 50%; background: #3d4248; display: block; box-shadow: inset 0 1px 1px rgba(0,0,0,.5); }
.led.on { background: #6fd36f; }
.led.net { background: #e6b23a; }
.led.blink { animation: led 0.25s steps(2) infinite; }
@keyframes led { 50% { background: #3d4248; } }
body.dev-laptop .device-power { display: block; position: absolute; right: 36px; bottom: 9px; width: 34px; height: 12px; border-radius: 3px; border: 1px solid #111; background: #22262a; cursor: pointer; }
body.dev-laptop .device-power:hover { background: #8b1d14; }

/* Tablet mit Gummirahmen */
body.dev-tablet .device-body {
  background: #1d2023;
  border-radius: 34px;
  border: 10px solid #2d3136;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 2px #111 inset;
}
body.dev-tablet .device-brand { display: block; position: absolute; left: 50%; transform: translateX(-50%); bottom: 6px; font: 600 10px var(--narrow); letter-spacing: .2em; color: #6f767d; }
body.dev-tablet .device-brand b { display: none; }
body.dev-tablet .device-power { display: block; position: absolute; top: -14px; right: 90px; width: 60px; height: 6px; border-radius: 3px 3px 0 0; background: #2d3136; border: 0; cursor: pointer; }

/* Wachen-PC mit Monitor */
body.dev-pc .device-body { background: #151719; border-radius: 6px; border: 1px solid #000; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
body.dev-pc .device-stand { display: block; width: 220px; height: 70px; background: linear-gradient(#2a2d31, #1b1d20); clip-path: polygon(38% 0, 62% 0, 70% 80%, 100% 86%, 100% 100%, 0 100%, 0 86%, 30% 80%); }
body.dev-pc .device-brand { display: block; position: absolute; left: 50%; transform: translateX(-50%); bottom: 5px; font: 600 10px var(--narrow); letter-spacing: .24em; color: #5b6168; }
body.dev-pc .device-brand b { display: none; }
body.dev-pc .device-leds { display: flex; position: absolute; right: 22px; bottom: 7px; }
body.dev-pc .device-power { display: block; position: absolute; right: 40px; bottom: 5px; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #000; background: #2a2d31; cursor: pointer; }

/* ============================================================== Bildschirm */
.screen { position: relative; overflow: hidden; background: #000; }
.boot, .lock, .desktop { position: absolute; inset: 0; }

/* Start (wie ein BIOS-Bildschirm, kurz) */
.boot { background: #000; color: #c9ced3; font: 14px/1.55 var(--mono); padding: 36px 44px; }
.boot .boot-logo { font: 700 30px var(--narrow); letter-spacing: .06em; color: #fff; margin-bottom: 4px; }
.boot .boot-logo span { color: var(--accent); }
.boot .boot-sub { color: #7d858e; margin-bottom: 26px; }
.boot .ok { color: #79c37a; }
.boot .bar { margin-top: 22px; width: 320px; height: 10px; border: 1px solid #5b6168; padding: 1px; }
.boot .bar i { display: block; height: 100%; width: 0; background: #c9ced3; transition: width .25s linear; }

/* Sperrbildschirm / Anmeldung */
.lock { display: flex; flex-direction: column; color: #fff; }
.lock .lock-bg { position: absolute; inset: 0; }
.lock .lock-top { position: relative; padding: 40px 48px; }
.lock .lock-time { font: 600 72px/1 var(--narrow); letter-spacing: .01em; }
.lock .lock-date { font-size: 18px; margin-top: 6px; opacity: .9; }
.lock .lock-center { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; }
.lock .lock-card {
  width: 380px; background: #f2f3f5; color: var(--text); border: 1px solid #5d646c;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.lock .lock-card-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; background: var(--taskbar); color: #fff; }
.lock .lock-card-head .crest { width: 40px; height: 40px; flex: none; }
.lock .lock-card-head b { display: block; font: 600 16px var(--narrow); letter-spacing: .04em; }
.lock .lock-card-head small { color: #aab1b9; }
.lock .lock-card-body { padding: 16px; }
.lock .lock-card-body label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 3px; }
.lock .lock-card-body .field { width: 100%; }
.lock .lock-user { display: flex; gap: 12px; align-items: center; padding: 6px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.lock .lock-user .avatar { width: 46px; height: 46px; }
.lock .lock-user b { display: block; font-size: 15px; }
.lock .lock-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.lock .lock-err { color: var(--danger); font-size: 12px; min-height: 17px; margin-top: 8px; }
.lock .lock-foot { position: relative; display: flex; justify-content: space-between; padding: 14px 20px; font-size: 12px; color: rgba(255, 255, 255, .8); }
.lock .lock-foot span { display: inline-flex; gap: 6px; align-items: center; }
.lock .lock-foot svg { width: 16px; height: 16px; }
.lock .linklike { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }

/* ============================================================== Hintergründe */
.wallpaper { position: absolute; inset: 0; background-size: cover; background-position: center; }
.wp-werk { background-color: #27333f; background-image: url('../img/wp-werk.svg'); }
.wp-nacht { background-color: #0f1622; background-image: url('../img/wp-nacht.svg'); }
.wp-karte { background-color: #4d5a50; background-image: url('../img/wp-karte.svg'); }
.wp-grau { background: #5a6068; }
.wp-wache { background-color: var(--accent); background-image: url('../img/wp-wache.svg'); background-blend-mode: multiply; }
.wallpaper .wp-mark { position: absolute; right: 36px; bottom: 64px; text-align: right; color: rgba(255, 255, 255, .55); }
.wallpaper .wp-mark b { display: block; font: 700 26px var(--narrow); letter-spacing: .08em; color: rgba(255, 255, 255, .72); }
.wallpaper .wp-mark span { font-size: 12px; letter-spacing: .04em; }

/* ============================================================== Desktop-Symbole */
.icons { position: absolute; left: 0; top: 0; right: 0; bottom: 40px; }
.dicon {
  position: absolute; width: 90px; padding: 6px 2px 4px; text-align: center; color: #fff;
  border: 1px solid transparent; cursor: default;
}
.dicon svg { width: 40px; height: 40px; display: block; margin: 0 auto 4px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.dicon span { display: block; font-size: 12px; line-height: 1.25; text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 1px #000; overflow-wrap: normal; hyphens: auto; }
.dicon:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); }
.dicon.sel { background: rgba(120, 165, 220, .38); border-color: rgba(170, 205, 245, .7); }
.dicon .badge { position: absolute; top: 2px; right: 14px; }

/* ============================================================== Taskleiste */
.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40px; display: flex; align-items: stretch;
  background: var(--taskbar); border-top: 1px solid #3a4048; color: var(--taskbar-text); z-index: 9000;
}
.tb-start {
  display: flex; align-items: center; gap: 8px; padding: 0 14px 0 10px; border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 700 14px var(--narrow); letter-spacing: .06em;
}
.tb-start .mark { width: 22px; height: 22px; background: var(--accent); display: grid; place-items: center; font: 700 11px var(--narrow); letter-spacing: 0; border: 1px solid rgba(255,255,255,.25); }
.tb-start:hover, .tb-start.open { background: var(--taskbar-2); }
.tb-search { display: flex; align-items: center; margin: 6px 6px 6px 2px; width: 230px; background: #f3f4f6; border: 1px solid #000; }
.tb-search svg { width: 16px; height: 16px; margin: 0 6px; color: #5b6470; flex: none; }
.tb-search input { border: 0; outline: 0; background: transparent; width: 100%; height: 100%; font-size: 12.5px; color: #1b1f24; }
.tb-apps { flex: 1; display: flex; gap: 2px; padding: 3px 4px; overflow: hidden; }
.tb-app {
  display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 200px; flex: 0 1 200px; padding: 0 10px;
  background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--taskbar-text); cursor: pointer; font-size: 12.5px; text-align: left;
}
.tb-app svg { width: 18px; height: 18px; flex: none; }
.tb-app span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-app:hover { background: var(--taskbar-2); }
.tb-app.active { background: #353c45; border-bottom-color: var(--accent); }
.tb-app.min { opacity: .72; }
.tb-tray { display: flex; align-items: stretch; border-left: 1px solid #343a42; }
.tb-tray button { background: transparent; border: 0; color: var(--taskbar-text); padding: 0 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 12px; position: relative; }
.tb-tray button:hover { background: var(--taskbar-2); }
.tb-tray svg { width: 17px; height: 17px; }
.tb-tray .tb-user { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; line-height: 1.15; }
.tb-tray .tb-user small { color: #9aa2ab; font-size: 11px; }
.tb-clock { flex-direction: column; justify-content: center; gap: 0 !important; line-height: 1.15; min-width: 76px; }
.tb-clock b { font-weight: 500; font-size: 13px; }
.tb-clock small { color: #b9c0c7; font-size: 11px; }
.tb-dot { position: absolute; top: 7px; right: 5px; min-width: 15px; height: 15px; padding: 0 3px; background: var(--danger); color: #fff; font: 600 10px/15px var(--sans); text-align: center; }
.net-ok { color: #8fd18f; }
.net-bad { color: #e3a23a; }

/* ============================================================== Startmenü */
.startmenu {
  position: absolute; left: 0; bottom: 40px; width: 560px; height: 560px; z-index: 9500; display: flex;
  background: #f1f2f4; border: 1px solid #1c2025; border-bottom: 0; box-shadow: 6px -6px 30px rgba(0, 0, 0, .4);
}
.sm-side { width: 52px; background: var(--taskbar); display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 0; }
.sm-side button { height: 44px; background: transparent; border: 0; color: #cdd2d7; cursor: pointer; display: grid; place-items: center; }
.sm-side button:hover { background: var(--taskbar-2); color: #fff; }
.sm-side svg { width: 20px; height: 20px; }
.sm-side .sm-brand { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 13px var(--narrow); letter-spacing: .3em; color: #5d656e; margin: 0 auto auto; padding-top: 10px; }
.sm-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sm-user { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.sm-user .avatar { width: 42px; height: 42px; }
.sm-user b { display: block; font-size: 14px; }
.sm-user small { color: var(--muted); }
.sm-list { flex: 1; overflow-y: auto; padding: 6px 0 10px; display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
.sm-group { grid-column: 1 / -1; font: 600 11.5px var(--narrow); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 16px 4px; }
.sm-item { display: flex; align-items: center; gap: 10px; padding: 6px 16px; background: transparent; border: 0; text-align: left; cursor: pointer; font-size: 13px; }
.sm-item svg { width: 26px; height: 26px; flex: none; }
.sm-item:hover { background: var(--sel); }
.sm-foot { border-top: 1px solid var(--line); padding: 8px 16px; font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }

/* ============================================================== Fenster */
.windows { position: absolute; left: 0; top: 0; right: 0; bottom: 40px; }
.win {
  position: absolute; display: flex; flex-direction: column; min-width: 320px; min-height: 180px;
  background: var(--surface); border: 1px solid var(--frame); box-shadow: 0 10px 28px rgba(0, 0, 0, .38);
}
.win.inactive { box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.win.max { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-width: 0; box-shadow: none; }
.win.min { display: none; }
.win-title {
  height: 32px; flex: none; display: flex; align-items: center; background: var(--chrome); border-bottom: 1px solid #b9c0c7;
  border-top: 3px solid var(--accent); padding-left: 9px; gap: 8px; cursor: default;
}
.win.inactive .win-title { background: var(--chrome-inactive); border-top-color: #b4bac1; color: var(--muted); }
.win-title svg.app-ico { width: 18px; height: 18px; flex: none; }
.win-title .t { flex: 1; font-weight: 600; font-size: 12.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.win-btns { display: flex; height: 100%; }
.win-btns button { width: 44px; height: 100%; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: #30363d; }
.win-btns button svg { width: 12px; height: 12px; }
.win-btns button:hover { background: #d3d8dd; }
.win-btns button.close:hover { background: #c42b1c; color: #fff; }
.win-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--surface); user-select: text; }
.win-rz { position: absolute; z-index: 2; }
.win-rz.n { top: -4px; left: 6px; right: 6px; height: 8px; cursor: ns-resize; }
.win-rz.s { bottom: -4px; left: 6px; right: 6px; height: 8px; cursor: ns-resize; }
.win-rz.e { right: -4px; top: 6px; bottom: 6px; width: 8px; cursor: ew-resize; }
.win-rz.w { left: -4px; top: 6px; bottom: 6px; width: 8px; cursor: ew-resize; }
.win-rz.ne { right: -5px; top: -5px; width: 12px; height: 12px; cursor: nesw-resize; }
.win-rz.nw { left: -5px; top: -5px; width: 12px; height: 12px; cursor: nwse-resize; }
.win-rz.se { right: -5px; bottom: -5px; width: 14px; height: 14px; cursor: nwse-resize; }
.win-rz.sw { left: -5px; bottom: -5px; width: 12px; height: 12px; cursor: nesw-resize; }
.win.max .win-rz { display: none; }
.snap-preview { position: absolute; background: rgba(111, 159, 214, .22); border: 2px solid rgba(111, 159, 214, .8); z-index: 8999; pointer-events: none; }

/* Menüleiste, Werkzeugleiste, Statusleiste */
.menubar { display: flex; height: 24px; background: #f6f7f8; border-bottom: 1px solid var(--line); padding: 0 4px; flex: none; }
.menubar button { border: 0; background: transparent; padding: 0 9px; font-size: 12.5px; cursor: pointer; }
.menubar button:hover, .menubar button.open { background: var(--sel); }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 5px 8px; background: #f6f7f8; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.toolbar .grow { flex: 1; }
.statusbar { flex: none; display: flex; gap: 0; height: 24px; align-items: stretch; background: #f2f3f5; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.statusbar span { padding: 0 10px; display: flex; align-items: center; border-right: 1px solid var(--line); white-space: nowrap; }
.statusbar span.grow { flex: 1; }

/* ============================================================== Bedienelemente */
.btn {
  height: 26px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: #f4f5f7; border: 1px solid #969ea7; border-radius: 2px; cursor: pointer; font-size: 12.5px; color: var(--text);
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { background: #e7eaee; border-color: #6f7780; }
.btn:active { background: #dbe0e5; }
.btn:focus-visible { outline: 2px solid var(--sel-line); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: rgba(0, 0, 0, .35); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: #7d1810; }
.btn.flat { background: transparent; border-color: transparent; }
.btn.flat:hover { background: var(--sel); border-color: var(--sel-line); }
.btn[disabled] { opacity: .5; cursor: default; pointer-events: none; }
.field, select.field, textarea.field {
  height: 26px; padding: 0 7px; background: #fff; border: 1px solid #969ea7; border-radius: 2px; outline: 0; font-size: 13px; min-width: 0;
}
textarea.field { height: auto; padding: 6px 7px; resize: vertical; line-height: 1.45; font-family: var(--sans); }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field.mono { font-family: var(--mono); }
.field.search { padding-left: 26px; background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%235b6470" stroke-width="2"><circle cx="10.5" cy="10.5" r="6.5"/><path d="M15.5 15.5 21 21"/></svg>') no-repeat 7px 50% / 13px; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.mono { font-family: var(--mono); }
.plate {
  display: inline-block; font: 500 12.5px var(--mono); letter-spacing: .04em; padding: 0 6px 0 12px; border: 1px solid #222; border-radius: 2px;
  background: linear-gradient(90deg, #1f4aa8 0 8px, #fff 8px); color: #111; line-height: 19px; white-space: nowrap;
}
.tag { display: inline-block; padding: 0 6px; font-size: 11.5px; line-height: 18px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.red { border-color: #d9a29c; background: var(--danger-soft); color: var(--danger); }
.tag.amber { border-color: #e2c48f; background: var(--warn-soft); color: var(--warn); }
.tag.green { border-color: #a9cfab; background: var(--ok-soft); color: var(--ok); }
.tag.blue { border-color: #a9c1dc; background: var(--accent-soft); color: var(--accent); }
.tag.dark { border-color: #2a3037; background: #2a3037; color: #fff; }
.badge { display: inline-block; min-width: 17px; height: 17px; padding: 0 4px; font: 600 10.5px/17px var(--sans); background: var(--danger); color: #fff; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.err-text { color: var(--danger); }

/* Tabellen */
.tablewrap { flex: 1; overflow: auto; min-height: 0; background: #fff; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 600; font-size: 12px; color: #3b434c;
  background: #eef0f3; border-bottom: 1px solid var(--line-strong); border-right: 1px solid var(--line); padding: 5px 8px; white-space: nowrap;
}
table.grid td { padding: 4px 8px; border-bottom: 1px solid #eceef1; vertical-align: top; }
table.grid tbody tr:nth-child(even) td { background: #fafbfc; }
table.grid tbody tr.click { cursor: default; }
table.grid tbody tr.click:hover td { background: #eef4fb; }
table.grid tbody tr.sel td { background: var(--sel) !important; }
table.grid tbody tr.hit td { background: #fdf0ee; }
table.grid .empty td { color: var(--muted); text-align: center; padding: 24px; background: #fff !important; }

/* Formulare */
.form { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: center; }
.form > label { color: var(--muted); font-size: 12.5px; text-align: right; }
.form > .full { grid-column: 1 / -1; }
.form .field, .form select, .form textarea { width: 100%; }
.form .hint { grid-column: 2; font-size: 11.5px; color: var(--muted); margin-top: -4px; }
.pad { padding: 14px 16px; }
.scroll { overflow: auto; min-height: 0; flex: 1; }

/* Registerkarten */
.tabs { display: flex; gap: 0; padding: 6px 8px 0; background: #f2f3f5; border-bottom: 1px solid var(--line-strong); flex: none; overflow-x: auto; }
.tabs button {
  border: 1px solid transparent; border-bottom: 0; background: transparent; padding: 5px 13px; margin-bottom: -1px; cursor: pointer; font-size: 12.5px; color: var(--muted); white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { background: #fff; border-color: var(--line-strong); color: var(--text); font-weight: 500; }
.tabs button .badge { margin-left: 5px; background: #8a929c; }
.tabs button.on .badge { background: var(--accent); }
.tabpanel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }

/* Aktenkopf */
.dossier-head { display: flex; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fbfbfc; flex: none; }
.dossier-head .photo { width: 78px; height: 96px; flex: none; border: 1px solid var(--line-strong); background: #e8ebee; display: grid; place-items: center; }
.dossier-head .photo svg { width: 56px; height: 56px; color: #9aa2ab; }
.dossier-head h2 { margin: 0 0 2px; font: 600 21px/1.15 var(--narrow); letter-spacing: .01em; }
.dossier-head .sub { color: var(--muted); font-size: 12.5px; }
.dossier-head .facts { display: grid; grid-template-columns: repeat(3, minmax(120px, auto)); gap: 4px 22px; margin-top: 9px; font-size: 12.5px; }
.dossier-head .facts dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.dossier-head .facts dd { margin: 0; }
.dossier-head .flags { margin-left: auto; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid; font-size: 12.5px; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.red { background: var(--danger-soft); border-color: #e2aaa3; color: #7d1810; }
.alert.amber { background: var(--warn-soft); border-color: #e7cb93; color: #6a3f00; }
.alert.blue { background: var(--accent-soft); border-color: #b5c9df; color: #1e3f60; }
.alert b { font-weight: 600; }
.section { padding: 12px 16px; }
.section + .section { border-top: 1px solid var(--line); }
.section h3 { margin: 0 0 8px; font: 600 14px var(--narrow); letter-spacing: .04em; text-transform: uppercase; color: #3b434c; display: flex; align-items: center; gap: 8px; }
.section h3 .grow { flex: 1; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 3px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; }
.cols > .section + .section { border-top: 0; border-left: 1px solid var(--line); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 118px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font: 11.5px var(--mono); color: var(--muted); }
.timeline .who { font-size: 11.5px; color: var(--muted); }
.timeline .txt { white-space: pre-wrap; }
.timeline .kind { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

/* Split: Liste links, Inhalt rechts */
.split { flex: 1; display: flex; min-height: 0; }
.split .pane-l { width: 300px; flex: none; border-right: 1px solid var(--line-strong); display: flex; flex-direction: column; min-height: 0; background: #fff; }
.split .pane-r { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.listbox { flex: 1; overflow: auto; }
.listbox .li { padding: 7px 12px; border-bottom: 1px solid #eceef1; cursor: default; }
.listbox .li:hover { background: #f1f5fa; }
.listbox .li.sel { background: var(--sel); }
.listbox .li b { display: block; font-weight: 600; font-size: 12.5px; }
.listbox .li.unread b { color: var(--accent); }
.listbox .li small { color: var(--muted); display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--faint); text-align: center; padding: 30px; }
.placeholder svg { width: 54px; height: 54px; display: block; margin: 0 auto 10px; opacity: .55; }

/* Papier-Dokumente (Bescheid, Bericht) */
.paper-wrap { flex: 1; overflow: auto; background: #8f969e; padding: 24px; }
.paper { width: 640px; margin: 0 auto; background: #fff; padding: 44px 52px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); font-size: 13px; color: #111; }
.paper .ph { display: flex; justify-content: space-between; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 18px; }
.paper .ph b { font: 700 18px var(--narrow); letter-spacing: .04em; }
.paper h1 { font: 700 22px var(--narrow); margin: 18px 0 6px; }
.paper table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.paper td, .paper th { border-bottom: 1px solid #ccc; padding: 4px 4px; text-align: left; font-size: 12.5px; }
.paper .sum td { font-weight: 600; border-top: 2px solid #111; }
.paper .sig { margin-top: 36px; display: flex; justify-content: space-between; }
.paper .sig div { border-top: 1px solid #111; width: 220px; padding-top: 4px; font-size: 11.5px; }
.paper .stamp { color: #a33; border: 2px solid #a33; padding: 4px 10px; font: 700 14px var(--narrow); letter-spacing: .1em; transform: rotate(-6deg); display: inline-block; }

/* Gesetzbuch-Text */
.doc { max-width: 760px; margin: 0 auto; padding: 18px 26px 40px; font-size: 13.5px; line-height: 1.55; }
.doc h1 { font: 700 26px/1.2 var(--narrow); margin: 0 0 4px; }
.doc h2 { font: 700 18px var(--narrow); margin: 26px 0 8px; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.doc h3 { font: 600 15px var(--sans); margin: 18px 0 6px; }
.doc table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12.5px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 4px 7px; text-align: left; vertical-align: top; }
.doc th { background: #f2f3f5; }
.doc mark { background: #ffe58a; }

/* Kontextmenüs und Dropdowns */
.menus { position: absolute; inset: 0; pointer-events: none; z-index: 9800; }
.ctxmenu { position: absolute; pointer-events: auto; min-width: 200px; background: #f7f8f9; border: 1px solid #6f7780; box-shadow: 3px 4px 14px rgba(0, 0, 0, .3); padding: 3px 0; }
.ctxmenu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 5px 24px 5px 10px; background: transparent; border: 0; text-align: left; cursor: pointer; font-size: 12.5px; }
.ctxmenu button svg { width: 15px; height: 15px; color: var(--muted); }
.ctxmenu button:hover { background: var(--sel); }
.ctxmenu hr { border: 0; border-top: 1px solid var(--line); margin: 3px 0; }

/* Dialoge */
.modal-layer { position: absolute; inset: 0; background: rgba(15, 18, 22, .35); z-index: 9900; display: grid; place-items: center; }
.dialog { min-width: 360px; max-width: 560px; background: #fff; border: 1px solid var(--frame); box-shadow: 0 16px 44px rgba(0, 0, 0, .45); }
.dialog .win-title { cursor: default; }
.dialog .d-body { display: flex; gap: 14px; padding: 18px 18px 8px; }
.dialog .d-body > svg { width: 34px; height: 34px; flex: none; }
.dialog .d-text { white-space: pre-wrap; padding-top: 4px; }
.dialog .d-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; background: #f2f3f5; border-top: 1px solid var(--line); }

/* Meldungen unten rechts */
.toasts { position: absolute; right: 12px; bottom: 52px; display: flex; flex-direction: column-reverse; gap: 8px; z-index: 9600; pointer-events: none; }
.toast { width: 330px; background: #22272d; color: #eceef0; border: 1px solid #3c434b; border-left: 4px solid var(--accent); box-shadow: 0 8px 22px rgba(0, 0, 0, .4); padding: 10px 12px; pointer-events: auto; cursor: default; animation: toast-in .18s ease-out; }
.toast.red { border-left-color: #e5533f; }
.toast.amber { border-left-color: #e3a23a; }
.toast.green { border-left-color: #59a85d; }
.toast b { display: block; font-size: 13px; margin-bottom: 2px; }
.toast small { color: #aab1b8; display: block; }
.toast .t-head { display: flex; justify-content: space-between; font-size: 11px; color: #8d959e; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .06em; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Kleinkram */
.avatar { background: #c9d2dc; border: 1px solid rgba(0,0,0,.2); display: grid; place-items: center; color: #4a5561; overflow: hidden; }
.avatar svg { width: 72%; height: 72%; }
.crest svg { width: 100%; height: 100%; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); flex: none; }
.kpis div { padding: 10px 14px; border-right: 1px solid var(--line); }
.kpis div:last-child { border-right: 0; }
.kpis b { display: block; font: 600 22px var(--narrow); }
.kpis small { color: var(--muted); }
.calc-total { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line-strong); background: #fafbfc; }
.calc-total div { padding: 8px 12px; border-right: 1px solid var(--line); }
.calc-total div:last-child { border-right: 0; }
.calc-total b { display: block; font: 600 20px var(--narrow); }
.calc-total small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.calculator { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px; background: #e9ecef; flex: 1; }
.calculator .disp { grid-column: 1 / -1; background: #f7faf5; border: 1px solid #8d949c; font: 500 26px var(--mono); text-align: right; padding: 10px 10px 6px; overflow: hidden; }
.calculator .disp small { display: block; font-size: 12px; color: var(--muted); min-height: 16px; }
.calculator button { height: 38px; font-size: 15px; }
.notes-area { flex: 1; border: 0; outline: 0; resize: none; padding: 10px 12px; font: 13.5px/1.5 var(--mono); background: #fffef6; user-select: text; }
.wp-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.wp-pick button { height: 70px; border: 2px solid transparent; cursor: pointer; padding: 0; position: relative; }
.wp-pick button.on { border-color: var(--accent); outline: 1px solid #fff; outline-offset: -3px; }
.wp-pick button span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 1px 4px; text-align: left; }
.rights-table td select { width: 150px; }
.vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.vitals label { display: block; font-size: 11px; color: var(--muted); }
.vitals .field { width: 100%; }


/* Querverweise, Kleinsymbole, freie Dialoge */
a.xref, .section a, .tabpanel a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted currentColor; }
a.xref:hover { border-bottom-style: solid; }
svg.tiny { width: 13px; height: 13px; vertical-align: -2px; }
.dialog .m-body { display: flex; flex-direction: column; max-height: 82vh; }
.dialog .m-body > .d-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; background: #f2f3f5; border-top: 1px solid var(--line); }
.dialog .m-body .pick-list { border-top: 1px solid var(--line); }
.paper h3 { font: 700 13px var(--narrow); letter-spacing: .06em; text-transform: uppercase; margin: 18px 0 4px; }
.paper .right { text-align: right; }
input[type=color].field { padding: 1px 2px; width: 60px; }
.win-body > .tabpanel > .split { flex: 1; }

/* Schmale Fenster (Telefon im Browser) */
@media (max-width: 760px) {
  .startmenu { width: 100%; height: calc(100% - 40px); }
  .tb-search { display: none; }
  .form { grid-template-columns: 1fr; }
  .form > label { text-align: left; }
  .cols { grid-template-columns: 1fr; }
  .split .pane-l { width: 42%; }
}
.win:focus { outline: none; }
.calculator button { justify-content: center; }
