@font-face { font-family: 'Noto'; src: url('/fonts/noto-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noto'; src: url('/fonts/noto-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Noto'; src: url('/fonts/noto-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Noto'; src: url('/fonts/noto-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* VRNZ Connect – Gestaltung
   Idee: Leuchtkasten. Kühles, helles Papier wie ein Befundmonitor, tiefes Petrol als Hauptfarbe,
   Bernstein nur für Dinge, die Aufmerksamkeit brauchen (Zähler, offene Aufgaben). */

:root {
  --paper: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #1a2233;
  --ink-2: #4a5568;
  --muted: #6e7889;
  --line: #dde2ea;
  --petrol: #164194;
  --petrol-2: #1d52b8;
  --petrol-soft: #e4ebf8;
  --amber: #ee7203;
  --amber-ink: #8a3d00;
  --amber-soft: #fdeedf;
  --ok: #2f7d5b;
  --danger: #b4372f;
  --danger-soft: #f8e2e0;
  --film: #102b63;
  --radius-s: 3px;
  --radius-m: 6px;
  --radius-l: 10px;
  --shadow: 0 1px 2px rgba(22, 65, 148, .06), 0 4px 16px rgba(22, 65, 148, .05);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1424; --surface: #141d31; --surface-2: #1a2540; --ink: #e8ecf4; --ink-2: #b6c0d2; --muted: #8792a6;
    --line: #26324c; --petrol: #86a6ee; --petrol-2: #a3bcf2; --petrol-soft: #1b2b52; --amber: #f28a2e; --amber-ink: #ffb877;
    --amber-soft: #3a2512; --danger: #ef7d73; --danger-soft: #3b1d1a; --film: #0a1a3d; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1424; --surface: #141d31; --surface-2: #1a2540; --ink: #e8ecf4; --ink-2: #b6c0d2; --muted: #8792a6;
    --line: #26324c; --petrol: #86a6ee; --petrol-2: #a3bcf2; --petrol-soft: #1b2b52; --amber: #f28a2e; --amber-ink: #ffb877;
    --amber-soft: #3a2512; --danger: #ef7d73; --danger-soft: #3b1d1a; --film: #0a1a3d; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 'Noto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--petrol); }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Grundgerüst ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.side { display: none; }
main.content { padding: 20px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 980px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 600; font-size: 1.05rem; flex: 1; display: flex; align-items: center; gap: 10px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 500; position: relative; }
.tabbar a[aria-current="page"] { color: var(--petrol); }
.tabbar svg, .side svg { width: 24px; height: 24px; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 248px 1fr; }
  .topbar, .tabbar { display: none; }
  .side { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100dvh; padding: 20px 12px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
  .side .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.1rem; padding: 4px 10px 22px; }
  .side .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .side a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-weight: 500; }
  .side a:hover { background: var(--surface-2); }
  .side a[aria-current="page"] { background: var(--petrol-soft); color: var(--petrol); }
  .side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
  .side .who { margin-top: auto; padding: 12px 10px 0; font-size: .85rem; color: var(--muted); }
  main.content { padding: 32px 40px 48px; }
}

.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: var(--amber-ink); font-size: .72rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.tabbar .count { position: absolute; top: 6px; left: 50%; margin-left: 6px; }
.side .count { margin-left: auto; }

/* ---------- Bausteine ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel, .stack > * + * { margin-top: 14px; }
.panel h2 { font-size: 1.05rem; }
.grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; color: inherit; text-decoration: none; width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
a.item:hover, button.item:hover { background: var(--surface-2); }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 500; }
.item .sub { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--radius-m);
  border: 1px solid transparent; background: var(--petrol); color: #fff; font: 500 .95rem/1 'Noto', system-ui, sans-serif; cursor: pointer; text-decoration: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost):not(.soft):not(.danger) { color: #0b1630; } }
:root[data-theme="dark"] .btn:not(.ghost):not(.soft):not(.danger) { color: #0b1630; }
.btn:hover { background: var(--petrol-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--petrol); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--petrol-soft); color: var(--petrol); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn.block { width: 100%; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn .count { position: absolute; top: 2px; right: 0; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 7px; font: 500 .88rem 'Noto', sans-serif; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--petrol); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; font: 500 .95rem 'Noto', sans-serif; color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--petrol); border-bottom-color: var(--petrol); }

/* Formulare */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .88rem; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
label.field > small { display: block; color: var(--muted); margin-top: 4px; }
input, select, textarea { width: 100%; font: 400 1rem 'Noto', system-ui, sans-serif; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); padding: 10px 12px; min-height: 44px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--petrol); box-shadow: 0 0 0 3px var(--petrol-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--petrol); flex: none; }
.form-grid { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .wide { grid-column: 1 / -1; } }
.code-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-weight: 600; }

.error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-m); padding: 10px 12px; margin-bottom: 14px; font-size: .93rem; }
.note { background: var(--petrol-soft); color: var(--ink); border-radius: var(--radius-m); padding: 12px 14px; font-size: .93rem; }
.note.warn { background: var(--amber-soft); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.empty .btn { margin-top: 12px; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.petrol { background: var(--petrol-soft); color: var(--petrol); border-color: transparent; }
.tag.amber { background: var(--amber-soft); color: var(--amber-ink); border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.amber { color: var(--amber); } }
:root[data-theme="dark"] .tag.amber { color: var(--amber); }
.tag.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--petrol-soft); color: var(--petrol); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .9rem; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.3rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .75rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: .82rem; padding: 8px 8px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }

/* Dialog */
.overlay { position: fixed; inset: 0; background: rgba(8, 16, 20, .5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.dialog { background: var(--surface); width: 100%; max-width: 620px; max-height: 92dvh; overflow-y: auto; border-radius: var(--radius-l) var(--radius-l) 0 0;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); animation: rise .2s ease-out; }
@media (min-width: 700px) { .overlay { align-items: center; } .dialog { border-radius: var(--radius-l); padding: 26px; } }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* Popup auf dem Startbildschirm */
.announce { border-left: 5px solid var(--amber); }
.announce h2 { font-size: 1.35rem; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--radius-m); z-index: 200; font-size: .93rem; max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; }
.auth .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth .logo img { width: 52px; height: 52px; border-radius: 14px; }
.auth .logo b { font-size: 1.3rem; display: block; }
.auth .legal { margin-top: 22px; font-size: .85rem; color: var(--muted); display: flex; gap: 16px; }
.qr { display: block; margin: 8px auto 12px; width: 200px; height: 200px; border-radius: var(--radius-m); background: #fff; padding: 8px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font: 600 1rem 'Noto', monospace; background: var(--surface-2); padding: 14px; border-radius: var(--radius-m); letter-spacing: .04em; }

/* ---------- Start ---------- */
.hello { margin-bottom: 18px; }
.hello h1 { font-size: 1.6rem; }
.todo { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin-bottom: 18px; }
@media (min-width: 700px) { .todo { grid-template-columns: repeat(4, 1fr); } }
.todo a { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.todo a b { display: block; font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.todo a.hot { border-color: var(--amber); background: var(--amber-soft); }
.todo a span { font-size: .88rem; color: var(--ink-2); }

.date-chip { width: 54px; flex: none; text-align: center; border-radius: var(--radius-m); background: var(--petrol-soft); color: var(--petrol); padding: 6px 0; line-height: 1.1; }
.date-chip b { display: block; font-size: 1.25rem; }
.date-chip span { font-size: .72rem; font-weight: 500; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 150px - var(--nav-h)); min-height: 360px; }
@media (min-width: 900px) { .chat { height: calc(100dvh - 120px); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.msgs { flex: 1; overflow-y: auto; padding: 14px 2px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 82%; align-self: flex-start; }
.msg.me { align-self: flex-end; }
.bubble { background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--petrol); color: #fff; border-color: transparent; border-radius: 14px 14px 4px 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.me .bubble { color: #0b1630; } }
:root[data-theme="dark"] .msg.me .bubble { color: #0b1630; }
.msg .meta { font-size: .74rem; color: var(--muted); margin: 2px 6px; }
.msg.me .meta { text-align: right; }
.msg .deleted { font-style: italic; color: var(--muted); }
.msg a.file { color: inherit; display: inline-flex; gap: 6px; align-items: center; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 44px; max-height: 160px; height: 44px; }
.day-sep { text-align: center; font-size: .78rem; color: var(--muted); margin: 10px 0 4px; }

/* ---------- Themen-Bubbles (das Herzstück) ---------- */
.bubbles { position: relative; background: var(--film); border-radius: var(--radius-l); min-height: 440px; overflow: hidden;
  background-image: radial-gradient(circle at 30% 20%, rgba(238, 114, 3, .14), transparent 55%); }
.bubbles canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.bubbles .legend { position: absolute; left: 14px; bottom: 12px; color: #a9bcc5; font-size: .8rem; pointer-events: none; }
.bubble-list { margin-top: 14px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.kpi b { display: block; font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.kpi span { color: var(--ink-2); font-size: .86rem; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 340px; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.bar-row .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--petrol); border-radius: 5px; }
.bar-row .fill.amber { background: var(--amber); }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vis-note { font-size: .82rem; color: var(--muted); margin-top: 10px; }

/* Abstimmung */
.opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 8px; cursor: pointer; position: relative; overflow: hidden; }
.opt input { width: 20px; height: 20px; min-height: 0; accent-color: var(--petrol); flex: none; z-index: 1; }
.opt .res { position: absolute; inset: 0 auto 0 0; background: var(--petrol-soft); z-index: 0; }
.opt .lab { z-index: 1; flex: 1; }
.opt .num { z-index: 1; font-weight: 600; font-size: .9rem; }

.vote { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 56px; padding: 6px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: 600 1rem 'Noto', sans-serif; color: var(--ink-2); }
.vote[aria-pressed="true"] { border-color: var(--petrol); color: var(--petrol); background: var(--petrol-soft); }
.vote svg { width: 18px; height: 18px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.small svg { width: 16px; height: 16px; }
.shell > div { min-width: 0; }
.item .check { min-width: 0; }
.btn { white-space: nowrap; }
.grid > *, .stack > * { min-width: 0; }

/* VRNZ-Akzente */
.count { color: #fff; font-weight: 700; }
h1, h2 { font-weight: 700; }
.btn { font-weight: 600; letter-spacing: .01em; }
.topbar { border-bottom: 3px solid var(--amber); }
@media (min-width: 900px) { .side { border-right: 0; box-shadow: inset -1px 0 0 var(--line); } .side .brand img { width: 44px; height: 44px; border-radius: 0; } }
.brand img, .auth .logo img { border-radius: 0 !important; background: transparent; }
.side a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--amber); }
.tabbar a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--amber); }
.hello h1 { color: var(--petrol); }
.brand img, .side .brand img, .auth .logo img { width: auto !important; object-fit: contain; }
.topbar .brand img { height: 26px; }
.side .brand img { height: 36px !important; }
.auth .logo img { height: 52px; }
