/* BEGAT Zeitmanagement – ein Stylesheet für Verwaltung, Mitarbeiter-App und Anmeldung.
   Farben stehen als Variablen oben; das helle Design überschreibt nur diese Variablen. */

/* Keine Google-Fonts-Einbindung (DSGVO): Inter wird genutzt, wenn auf dem Gerät vorhanden, sonst die Systemschrift. */

:root {
  color-scheme: dark;
  --bg: #031d32;
  --bg-deep: #021627;
  --surface: #0b263c;
  --surface-2: #10304a;
  --surface-3: #19364d;
  --border: rgba(120, 184, 154, .18);
  --border-strong: rgba(120, 184, 154, .38);
  --text: #eef5f8;
  --text-soft: #b8c7d3;
  --muted: #8ea3b4;
  --accent: #35c596;
  --accent-soft: #78b89a;
  --accent-bg: rgba(53, 197, 150, .14);
  --primary: #1f8fd0;
  --primary-2: #156ba3;
  --info: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, .14);
  --warning-bg: rgba(245, 158, 11, .14);
  --info-bg: rgba(59, 130, 246, .14);
  --shadow: 0 18px 40px rgba(0, 0, 0, .28);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-width: 220px;
  --topbar-height: 64px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #eef3f6;
  --bg-deep: #e3ebf0;
  --surface: #ffffff;
  --surface-2: #f5f8fa;
  --surface-3: #e8eff3;
  --border: rgba(3, 29, 50, .12);
  --border-strong: rgba(3, 29, 50, .24);
  --text: #0d2233;
  --text-soft: #3a5163;
  --muted: #64788a;
  --accent: #14936c;
  --accent-soft: #2f8a66;
  --accent-bg: rgba(20, 147, 108, .1);
  --shadow: 0 14px 30px rgba(3, 29, 50, .1);
}

/* Die Seitenleiste bleibt auch im hellen Design dunkel (Logo und Symbole sind dafür gestaltet). */
:root[data-theme='light'] .sidebar {
  --bg-deep: #031d32; --surface-2: #10304a; --surface-3: #19364d;
  --border: rgba(120, 184, 154, .18); --border-strong: rgba(120, 184, 154, .38);
  --text: #eef5f8; --text-soft: #b8c7d3; --accent: #35c596;
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(circle at 0 0, var(--surface-3), transparent 45%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
small { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- Hilfsklassen ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.big { font-size: 22px; font-weight: 800; }
.center { text-align: center; }
.wrap { white-space: normal !important; }
.pre-line { white-space: pre-line; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: grid; gap: 12px; }
.empty { padding: 22px 12px; color: var(--muted); text-align: center; }
.result-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.mobile-only { display: none !important; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #2a9ee0, var(--primary)); border-color: transparent; }
.btn-success { background: var(--accent); border-color: transparent; color: #052a1e; }
.btn-success:hover:not(:disabled) { background: #46d6a6; border-color: transparent; }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #f05858; border-color: transparent; }
.btn-info { background: var(--info); border-color: transparent; color: #fff; }
.btn-light { background: #fff; color: #0d2233; border-color: transparent; }
.btn-light:hover:not(:disabled) { background: #e9f1f5; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn-lg { min-height: 48px; font-size: 16px; }
.btn-block { width: 100%; }
.btn.is-active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid; place-items: center; position: relative;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 16px;
}
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn.small { width: 28px; height: 28px; font-size: 13px; }
.icon-btn-primary { background: var(--accent); color: #052a1e; border-color: transparent; }
.icon-btn-primary:hover:not(:disabled) { color: #052a1e; background: #46d6a6; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer;
}
.pill-btn:hover { border-color: var(--accent); }
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 700; color: var(--text-soft); }
input, select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-deep); color: var(--text);
}
:root[data-theme='light'] input, :root[data-theme='light'] select, :root[data-theme='light'] textarea { background: #fff; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input[type='checkbox'], input[type='radio'] { width: auto; min-height: 0; accent-color: var(--accent); }
.input-sm { min-height: 30px; padding: 4px 8px; font-size: 13px; }
.target-input { width: 96px; }
.row-gap + .tag { margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .wide, .field.wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.form-grid > .form-actions { grid-column: 1 / -1; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--border); }
.form-error { margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--danger-bg); color: #fca5a5; font-weight: 600; }
:root[data-theme='light'] .form-error { color: #b91c1c; }
.form-error.is-success { background: var(--accent-bg); color: var(--accent); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters, .toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field, .toolbar .field { min-width: 150px; }
.field.grow, .grow { flex: 1 1 220px; }
.toolbar { margin-bottom: 16px; }
.toolbar > input, .toolbar > select, .filters > input, .filters > select { width: auto; min-width: 150px; }
.page-actions .toolbar { margin-bottom: 0; justify-content: flex-end; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- Anmeldung ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 20px; padding: 24px; }
.login-card {
  display: grid; grid-template-columns: 1fr 1fr; width: min(1200px, 100%);
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  background: linear-gradient(135deg, var(--surface), var(--bg-deep)); box-shadow: var(--shadow);
}
.login-brand { padding: 40px 56px; text-align: center; background: linear-gradient(160deg, rgba(25, 54, 77, .7), rgba(53, 197, 150, .06)); }
.login-logo { width: 320px; margin-bottom: 48px; }
.login-brand h1 { font-size: 32px; }
.accent-line { width: 44px; height: 3px; margin: 22px auto; border-radius: 3px; background: var(--accent-soft); }
.login-brand > p { color: var(--text-soft); font-size: 15px; }
.login-features { list-style: none; margin: 30px auto 0; padding: 0; display: grid; gap: 22px; max-width: 300px; text-align: left; }
.login-features li { display: flex; gap: 18px; align-items: center; }
.login-features li > span { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--surface-3); font-size: 20px; }
.login-features strong { display: block; font-size: 15px; }
.login-features small { color: var(--text-soft); font-size: 13px; }
.login-form { padding: 64px 100px; display: grid; align-content: center; gap: 14px; text-align: center; }
.login-form form, .login-form .stack { text-align: left; }
.login-form h2 { font-size: 30px; font-weight: 800; }
.login-logo-mobile { display: none; width: 220px; margin: 0 auto; }
.login-badge {
  display: grid; place-items: center; width: 74px; height: 74px; margin: 0 auto;
  border-radius: 50%; border: 1px solid var(--border-strong); background: var(--accent-bg); color: var(--accent-soft); font-size: 26px;
  box-shadow: 0 0 0 10px rgba(53, 197, 150, .05);
}
.login-intro { color: var(--text-soft); font-size: 13px; }
.login-form input { min-height: 48px; }
.login-secure { color: var(--muted); font-size: 12px; margin-top: 10px; }
.login-footer { color: var(--muted); font-size: 12px; }

/* ---------- Rahmen der Verwaltung ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width);
  display: flex; flex-direction: column; gap: 4px; padding: 14px 12px;
  background: var(--bg-deep); border-right: 1px solid var(--border); overflow-y: auto;
  transition: width .2s, transform .2s;
}
.sidebar-brand { display: block; padding: 6px 4px 16px; margin-bottom: 10px; border: 0; border-bottom: 1px solid var(--border); background: none; cursor: pointer; }
.brand-full { width: 180px; display: block; }
.brand-symbol { display: none; width: 40px; margin: 0 auto; }
.sidebar-section { padding: 10px 8px 6px; color: var(--text-soft); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 6px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: transparent; color: var(--text);
  font-size: 16px; font-weight: 500; text-align: left; cursor: pointer;
}
.nav-item img { width: 24px; height: 24px; flex: none; object-fit: contain; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: linear-gradient(90deg, #1f8a6d, #2a6d61); border-color: var(--accent); color: #fff; }
.nav-accent { color: var(--accent); border-color: var(--accent); }
.nav-symbol { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 6px; background: var(--surface-3); font-size: 14px; font-weight: 700; }
.sidebar-system { margin-top: auto; padding-top: 10px; }
.sidebar-system-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0 4px; border: 0; background: none; cursor: pointer; color: var(--text-soft); }
.chevron { font-size: 18px; transition: transform .2s; }
.sidebar-system.open .chevron { transform: rotate(180deg); }
.sidebar-system-nav { display: none; }
.sidebar-system.open .sidebar-system-nav { display: grid; }
.sidebar-backdrop { display: none; }

.workspace { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-height);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-logo { height: 34px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { flex: 1; padding: 22px 24px 32px; min-width: 0; }
.footer { padding: 16px; text-align: center; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.offline-banner { padding: 8px 24px; background: var(--danger); color: #fff; font-weight: 700; text-align: center; }

/* eingeklappte Seitenleiste */
.sidebar-collapsed { --sidebar-width: 78px; }
.sidebar-collapsed .brand-full,
.sidebar-collapsed .nav-item > span:not(.nav-symbol),
.sidebar-collapsed .sidebar-section { display: none; }
.sidebar-collapsed .brand-symbol { display: block; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 6px; }
.sidebar-collapsed .sidebar-system-toggle { justify-content: center; }

/* Ausklappmenüs in der Kopfzeile */
.dropdown { position: relative; }
.dropdown-panel {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: min(360px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.dropdown.open .dropdown-panel { display: block; }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dropdown-head small { display: block; }
.dropdown-list { display: grid; padding: 6px; }
.notice {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); text-align: left; cursor: pointer;
}
.notice:hover { background: var(--surface-2); }
.notice { border-left: 3px solid var(--info); }
.notice-warning { border-left-color: var(--warning); }
.notice-danger, .notice-critical, .notice-error { border-left-color: var(--danger); }
.notice-mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--info-bg); color: #7cb6ff; font-size: 12px; font-weight: 800; }
.notice-warning .notice-mark { background: var(--warning-bg); color: var(--warning); }
.notice-danger .notice-mark, .notice-critical .notice-mark, .notice-error .notice-mark { background: var(--danger-bg); color: var(--danger); }
.notice-text { display: grid; gap: 2px; flex: 1; }
.notice-text small { color: var(--muted); }
.notice-text time { font-size: 11px; color: var(--muted); }
.presence-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); }
.presence-row small { margin-left: auto; }
.presence-row.is-me { background: var(--accent-bg); }

/* ---------- Seitenaufbau ---------- */
.page { display: grid; gap: 18px; min-width: 0; }
.page > .toolbar { margin-bottom: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title h1 { overflow-wrap: anywhere; }
.page-title img { width: 40px; height: 40px; object-fit: contain; }
.page-title small { display: block; margin-top: 3px; font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }

.panel { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 70%, var(--bg))); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.panel-head small { display: block; margin-top: 2px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 7px; background: #1f8a6d; color: #fff; font-size: 14px; font-weight: 800; vertical-align: middle; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 12px; text-align: left; font-size: 13px; font-weight: 700; color: var(--text-soft); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table td.empty { text-align: center; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-sub { display: block; color: var(--muted); font-size: 12px; }
.sticky-head { max-height: calc(100vh - 220px); overflow: auto; }
.sticky-head thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag-normal, .tag-muted { color: var(--text-soft); }
.tag-important { color: var(--warning); border-color: var(--warning); background: var(--warning-bg); }
.tag-urgent, .tag-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.tag-success, .tag-live { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }
.tag-info { color: #7cb6ff; border-color: rgba(59, 130, 246, .5); background: var(--info-bg); }
:root[data-theme='light'] .tag-info { color: #1d5fbf; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.status-dot.off { background: var(--muted); box-shadow: none; }
.ok-mark { color: var(--accent); font-weight: 800; }

.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.metric { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.metric > span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-soft); }
.metric > strong { font-size: 28px; font-weight: 800; line-height: 1.1; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); }

.info-box { margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--accent-bg); }
.info-box.danger { background: var(--danger-bg); border-color: rgba(239, 68, 68, .4); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 14px; }
.info-grid > div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.info-grid dt { font-size: 12px; color: var(--muted); }
.info-grid dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
.map-frame { width: 100%; height: 280px; border: 0; border-radius: var(--radius-sm); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-title span { display: block; color: var(--muted); font-size: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.patient-section + .patient-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.tab { padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: transparent; cursor: pointer; font-weight: 600; }
.tab.is-active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.tab:disabled { opacity: .45; cursor: not-allowed; }
.diagnosis-list { display: grid; gap: 10px; }
.diagnosis-card { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.diagnosis-card.inactive { opacity: .6; }
.diagnosis-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }

/* ---------- Dialoge ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(1, 10, 18, .66); backdrop-filter: blur(3px); }
.modal-card { width: 100%; max-height: calc(100vh - 36px); display: flex; flex-direction: column; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); box-shadow: 0 30px 60px rgba(0, 0, 0, .45); }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1200px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head small { display: block; margin-top: 3px; }
.modal-body { padding: 18px; overflow-y: auto; }
.message-text { padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); white-space: pre-line; }
.confirm-text { margin-bottom: 16px; white-space: pre-line; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200; max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px; border-radius: 12px; background: #0f2a40; color: #fff; border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-weight: 600; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Index ---------- */
.dashboard-top { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(150px, .7fr) minmax(0, 1.3fr) minmax(0, 1.6fr); gap: 16px; align-items: stretch; }
.dashboard-top > .metric { align-content: start; }
.live-summary-body { display: grid; gap: 6px; }
.live-progress { display: grid; gap: 6px; margin-top: 6px; }
.event-list { display: grid; gap: 4px; max-height: 210px; overflow-y: auto; }
.event-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 54px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.event-row em { font-style: normal; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-row .start { color: var(--accent); }
.event-row .stop { color: var(--danger); }

/* ---------- Dienstplan ---------- */
.roster-table th, .roster-table td { padding: 6px; text-align: center; }
.roster-table th:first-child, .roster-table td:first-child { text-align: left; }
.roster-worker strong, .roster-worker small { display: block; }
.roster-table td.roster-worker, .roster-table th.roster-worker { position: sticky; left: 0; z-index: 1; min-width: 170px; background: var(--surface); }
.roster-cell {
  display: grid; gap: 2px; place-content: center; width: 100%; min-width: 100px; min-height: 52px; padding: 6px;
  border: 1px dashed var(--border-strong); border-radius: 9px; background: transparent; cursor: pointer; font-size: 12px;
}
.roster-cell strong { font-size: 13px; }
.roster-cell:hover { border-color: var(--accent); }
.roster-cell.conflict { box-shadow: inset 0 0 0 2px var(--danger); }
.shift-early { background: rgba(250, 204, 21, .16); border: 1px solid rgba(250, 204, 21, .5); }
.shift-late { background: rgba(249, 115, 22, .16); border: 1px solid rgba(249, 115, 22, .5); }
.shift-night { background: rgba(99, 102, 241, .2); border: 1px solid rgba(129, 140, 248, .55); }
.shift-custom { background: rgba(14, 165, 233, .16); border: 1px solid rgba(56, 189, 248, .5); }
.shift-free { background: var(--surface-3); border: 1px solid var(--border-strong); }
.shift-vacation { background: rgba(53, 197, 150, .16); border: 1px solid rgba(53, 197, 150, .5); }
.shift-sick { background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, .5); }
.shift-substitute { background: rgba(168, 85, 247, .16); border: 1px solid rgba(168, 85, 247, .5); }

/* ---------- Tourenplan ---------- */
.tour-section { display: grid; gap: 12px; }
.tour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tour-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.tour-card:hover { border-color: var(--accent); }
.tour-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tour-card-head small { display: block; }
.tour-stops { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tour-stops li { display: flex; align-items: center; gap: 10px; }
.tour-stops strong, .tour-stops small, .tour-stops em { display: block; }
.tour-stops em { font-style: normal; font-size: 12px; }
.tour-legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--text-soft); font-size: 13px; }
.tour-legend .status-active::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: var(--warning); }
.plan-no { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #052a1e; font-weight: 800; font-size: 13px; }
.plan-no.status-done { background: var(--accent); }
.plan-no.status-active { background: var(--warning); color: #2b1a00; }
.plan-no.status-open { background: var(--surface-3); color: var(--text); }

/* ---------- Tagesplan ---------- */
.daily-plan { display: grid; gap: 14px; }
.plan-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.plan-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-column { display: grid; align-content: start; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.plan-column-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.plan-column-head small { display: block; }
.plan-list { display: grid; gap: 6px; max-height: 52vh; overflow-y: auto; }
.plan-pick, .plan-order-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: left;
}
.plan-pick { cursor: pointer; }
.plan-pick:hover { border-color: var(--accent); }
.plan-pick.selected { border-color: var(--accent); background: var(--accent-bg); }
.plan-pick strong, .plan-pick small, .plan-info strong, .plan-info small { display: block; }
.plan-pick-icon { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); font-weight: 800; }
.plan-pick.selected .plan-pick-icon { background: var(--accent); color: #052a1e; }
.plan-info { flex: 1; min-width: 0; }
.plan-order-row { cursor: grab; }
.plan-order-row.dragging { opacity: .5; }
.plan-order-row.drag-over { border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent); }
.drag-handle { color: var(--muted); cursor: grab; }
.distribution-list { display: grid; gap: 8px; }
.distribution-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }

/* ---------- Hilfe ---------- */
.help-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.help-nav { position: sticky; top: calc(var(--topbar-height) + 16px); max-height: calc(100vh - 120px); overflow-y: auto; padding: 12px; }
.help-nav-item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; cursor: pointer; }
.help-nav-item span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.help-nav-item:hover, .help-nav-item.is-active { background: var(--accent-bg); }
.help-content { display: grid; gap: 14px; }
.help-section { scroll-margin-top: calc(var(--topbar-height) + 16px); }
.help-section-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.help-section h2 { margin-bottom: 10px; }
.help-copy { color: var(--text-soft); }
.help-copy li { margin: 4px 0; }
.help-copy strong { color: var(--text); }
.help-copy .info-box { margin-top: 10px; }
.help-role { display: grid; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.help-role span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.help-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.help-roles .help-role { gap: 4px; padding: 14px; }
.help-roles .help-role p { margin: 0; font-size: 13px; }
.help-trouble { display: grid; gap: 8px; }
.help-trouble > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }

/* ---------- Mitarbeiter-App ---------- */
.worker-app { width: min(460px, 100%); margin: 0 auto; padding: 16px 14px 28px; display: grid; gap: 14px; }
.worker-head { display: grid; justify-items: center; gap: 10px; }
.worker-logo { width: 270px; }
.worker-head-actions { display: flex; gap: 8px; }
.worker-head-actions .btn { border-color: var(--accent); }
.worker-welcome { text-align: center; }
.worker-welcome span { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); }
.worker-welcome strong { font-size: 17px; }
.worker-hero { display: grid; justify-items: center; gap: 12px; padding: 22px 18px; text-align: center; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); }
.worker-hero h1 { font-size: 26px; }
.worker-hero p { color: var(--text-soft); }
.state-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.state-pill span { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.nfc-icon { display: grid; place-items: center; width: 82px; height: 82px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5ee0b3, #1f9e75); color: #052a1e; font-size: 22px; font-weight: 800; box-shadow: 0 0 40px rgba(53, 197, 150, .35); }
.btn-nfc { width: 100%; min-height: 56px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #ef4f4f, #c93030); color: #fff; font-size: 17px; font-weight: 800; }
.btn-nfc:hover:not(:disabled) { background: linear-gradient(180deg, #f46262, #d53a3a); }
.btn-nfc.is-active { background: linear-gradient(180deg, #f59e0b, #d97706); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, .2); } }
.scan-status { font-size: 13px; color: var(--muted); }
.scan-status.scanning { color: var(--warning); font-weight: 700; }
.scan-status.ok { color: var(--accent); font-weight: 700; }
.scan-status.error { color: var(--danger); font-weight: 700; }
.scan-status.hint { color: #facc15; font-weight: 700; }
.nfc-support { width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 12px; text-align: left; }
.worker-section { display: grid; gap: 10px; }
.worker-section-title { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.worker-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); }
.worker-card-head { display: flex; justify-content: space-between; gap: 10px; }
.worker-card-actions { display: flex; justify-content: flex-end; }
.worker-plan { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); }
.worker-plan-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.worker-plan-head span { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.worker-plan-head strong { font-size: 20px; }
.worker-plan h3 { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.plan-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.plan-row:last-of-type { border-bottom: 0; }
.plan-row.done .plan-no { background: var(--surface-3); color: var(--accent); }
.worker-patient { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); }
.worker-patient span { display: block; font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .08em; }
.worker-patient strong { display: block; font-size: 20px; }
.worker-patient-icon { display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-size: 26px; }
.worker-timer { font-size: 42px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.visit-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.visit-meta > div { display: grid; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.visit-meta b { font-size: 12px; color: var(--muted); font-weight: 600; }
.worker-footer { text-align: center; color: var(--muted); font-size: 12px; }

/* Mitarbeiter-App im Stil „NFC-Ring“: dunkles Grün, Ringe um das NFC-Zeichen. */
body.worker-ring-body { background: #062a22; }
.worker-ring {
  --bg: #062a22; --surface: #0b3b31; --surface-2: #0e4a3d; --surface-3: #125646;
  --border: #145c4c; --border-strong: #1b6f5d; --text: #ecfdf5; --text-soft: #a7f3d0; --muted: #7fcdb4;
  --accent: #34d399; --accent-bg: rgba(52, 211, 153, .14);
  color: var(--text);
}
.worker-ring .worker-hero { gap: 14px; padding: 18px 16px 20px; border: 0; background: transparent; }
.worker-ring .worker-hero h1 { font-size: 28px; line-height: 1.15; }
.ring-top { display: flex; justify-content: space-between; width: 100%; color: var(--text-soft); font-size: 14px; font-weight: 600; }
.nfc-ring { display: grid; place-items: center; width: 260px; height: 260px; max-width: 78vw; max-height: 78vw; border: 2px solid #0f766e; border-radius: 50%; margin: 6px 0; }
.nfc-ring-2 { display: grid; place-items: center; width: 80%; height: 80%; border: 2px solid #14b8a6; border-radius: 50%; }
.nfc-ring-core { display: grid; place-items: center; align-content: center; gap: 4px; width: 76%; height: 76%; border-radius: 50%; background: #34d399; color: #022c22; }
.nfc-ring-core strong { font-size: 18px; font-weight: 800; }
.nfc-ring.is-active { animation: nfc-ring-pulse 1.8s ease-out infinite; }
.nfc-ring.is-active .nfc-ring-2 { animation: nfc-ring-pulse 1.8s .3s ease-out infinite; }
@keyframes nfc-ring-pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .35); } 100% { box-shadow: 0 0 0 18px rgba(52, 211, 153, 0); } }
.ring-next { margin: 0; color: var(--text-soft); font-size: 16px; }
.ring-next strong { color: var(--text); }
.worker-ring .btn-nfc { background: #34d399; color: #022c22; }
.worker-ring .btn-nfc:hover:not(:disabled) { background: #6ee7b7; }
.worker-ring .btn-nfc.is-active { background: transparent; color: #34d399; border: 2px solid #34d399; animation: none; }
.ring-counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.ring-counters > div { display: grid; gap: 2px; padding: 12px 6px; border-radius: 14px; background: var(--surface); }
.ring-counters strong { font-size: 26px; line-height: 1; }
.ring-counters span { color: var(--text-soft); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.ring-plan-link { background: transparent; border: 2px solid #14b8a6; color: var(--text); }
.nfc-details { width: 100%; color: var(--muted); font-size: 13px; text-align: left; }
.nfc-details summary { cursor: pointer; text-align: center; }
.nfc-details .nfc-support { margin-top: 8px; }
.worker-ring .worker-plan, .worker-ring .worker-patient { border-color: transparent; }
.worker-ring .scan-status.hint { color: #fde68a; }

/* BEGAT MED: Boxen und Schlüssel in der Mitarbeiter-App */
.med-count { font-size: 15px; color: var(--text-soft); }
.med-count strong { font-size: 22px; color: var(--warning); }
.med-count.done strong { color: var(--accent); }
.med-list { width: 100%; margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; text-align: left; }
.med-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.med-list li strong { flex: 1; font-size: 16px; letter-spacing: .02em; }
.med-list li small { color: var(--muted); font-size: 11px; }
.med-list li.done { border-color: var(--accent); background: var(--accent-bg); }
.med-list li.waived { border-color: var(--warning); background: var(--warning-bg); }
.med-check { width: 22px; font-size: 18px; font-weight: 800; text-align: center; color: var(--muted); }
.med-list li.done .med-check { color: var(--accent); }
.med-locked { color: var(--danger); font-weight: 800; }
.med-banner { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--warning); border-radius: 12px; background: var(--warning-bg); }
.med-banner strong { color: var(--warning); }
.med-banner.subtle { border-color: var(--border-strong); background: var(--surface); color: var(--text-soft); font-size: 13px; }
.med-banner .btn { justify-self: start; }
.med-box-number { padding: 10px 22px; border: 2px solid var(--warning); border-radius: 14px; font-size: 34px; font-weight: 900; letter-spacing: .04em; color: var(--warning); }
.med-required.mismatch { border-color: var(--danger); }
.med-mismatch { display: grid; gap: 4px; width: 100%; padding: 12px; border-radius: 12px; background: var(--danger-bg); color: var(--text); }
.med-mismatch strong { color: var(--danger); font-size: 18px; text-transform: uppercase; }
.med-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.med-status { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); font-size: 14px; cursor: pointer; }
.med-status:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); font-weight: 700; }
.med-history-time { white-space: nowrap; }

/* NFC-Demo: Mitarbeiter-App im Smartphone-Rahmen */
.phone-stage { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 10px 0 30px; }
.phone { position: relative; width: 400px; max-width: 100%; padding: 46px 14px 24px; border-radius: 46px; background: #050c14; border: 2px solid #22384a; box-shadow: var(--shadow), inset 0 0 0 6px #0b1824; }
.phone-speaker { position: absolute; top: 18px; left: 50%; width: 90px; height: 8px; border-radius: 8px; background: #22384a; transform: translateX(-50%); }
.phone-screen { height: 760px; overflow-y: auto; border-radius: 28px; background: var(--bg); }
.phone-screen .worker-app { padding-top: 18px; }
.phone-screen .worker-logo { width: 220px; }

/* ---------- Bildschirmgrößen ---------- */
@media (max-width: 1280px) {
  .dashboard-top { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1100px) {
  .login-form { padding: 48px; }
  .login-brand { padding: 40px 32px; }
}

@media (max-width: 899px) {
  .mobile-only { display: inline-grid !important; }
  img.mobile-only { display: block !important; }
  .sidebar { transform: translateX(-100%); width: 260px; box-shadow: var(--shadow); }
  .sidebar-collapsed { --sidebar-width: 220px; }
  .sidebar-collapsed .brand-full, .sidebar-collapsed .nav-item > span:not(.nav-symbol), .sidebar-collapsed .sidebar-section { display: revert; }
  .sidebar-collapsed .brand-symbol { display: none; }
  .sidebar-collapsed .nav-item { justify-content: flex-start; padding: 6px 12px; }
  .menu-open .sidebar { transform: none; }
  .menu-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-actions { gap: 6px; }
  .pill-btn span:not(.live-dot) { display: none; }
  .pill-btn [data-count] { display: inline !important; }
  .content { padding: 16px 12px 24px; }
  .dashboard-top > .panel { grid-column: 1 / -1; }
  .plan-columns, .help-layout { grid-template-columns: 1fr; }
  .help-nav { position: static; max-height: none; }
  .login-card { grid-template-columns: 1fr; max-width: 520px; }
  .login-brand { display: none; }
  .login-logo-mobile { display: block; }
  .login-form { padding: 32px 24px; }
}

@media (max-width: 600px) {
  h1 { font-size: 21px; }
  .form-grid { grid-template-columns: 1fr; }
  .filters .field, .toolbar .field { min-width: 0; flex: 1 1 140px; }
  .panel { padding: 14px; }
  .modal { padding: 0; align-items: end; }
  .modal-card { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .topbar-logo { height: 28px; }
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 12px 14px; }
  .metric > strong { font-size: 22px; }
  .distribution-row { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }

  /* Tabellen als Karten: jede Zeile ein Block, jede Zelle „Überschrift: Wert“. */
  .table:not(.roster-table), .table:not(.roster-table) tbody,
  .table:not(.roster-table) tr, .table:not(.roster-table) td { display: block; width: 100%; }
  .table:not(.roster-table) thead { display: none; }
  .table:not(.roster-table) tr {
    margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
    background: color-mix(in srgb, var(--surface-2) 45%, transparent);
  }
  .table:not(.roster-table) tbody tr:hover td { background: none; }
  .table:not(.roster-table) td {
    position: relative; min-height: 28px; padding: 5px 0 5px 38%; border: 0; text-align: left; overflow-wrap: anywhere;
  }
  .table:not(.roster-table) td::before {
    content: attr(data-label); position: absolute; left: 0; top: 7px; width: calc(38% - 10px);
    color: var(--text-soft); font-size: 12px; font-weight: 600; line-height: 1.3; overflow-wrap: normal; hyphens: auto;
  }
  .table:not(.roster-table) td:first-child, .table:not(.roster-table) td[data-label=''] { padding-left: 0; }
  .table:not(.roster-table) td:first-child { padding-top: 0; font-size: 15px; }
  .table:not(.roster-table) td:first-child::before, .table:not(.roster-table) td[data-label='']::before { display: none; }
  .table:not(.roster-table) td > * + * { margin-left: 6px; }
  .table:not(.roster-table) td > .cell-sub { margin-left: 0; }
  .table:not(.roster-table) td.empty { display: block; border: 0; }
  .table:not(.roster-table) .num { text-align: left; }
  .table-wrap { overflow-x: visible; }
  .table-wrap:has(.roster-table) { overflow-x: auto; }

  .roster-table td.roster-worker, .roster-table th.roster-worker { min-width: 112px; max-width: 112px; }
  .roster-cell { min-width: 78px; min-height: 46px; padding: 4px; font-size: 11px; }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .toolbar { justify-content: flex-start; }
  .phone { padding: 30px 8px 14px; border-radius: 32px; }
  .phone-speaker { top: 11px; }
  .phone-screen { height: 680px; border-radius: 22px; }
}

@media (max-width: 380px) {
  .topbar { padding: 0 8px; gap: 6px; }
  .topbar-actions { gap: 4px; }
  .topbar .icon-btn { width: 33px; height: 33px; }
  .topbar .pill-btn { height: 33px; padding: 0 8px; gap: 5px; }
  .topbar-logo { height: 24px; }
}

@media print {
  .sidebar, .topbar, .footer, .no-print { display: none !important; }
  .workspace { margin: 0; }
}

/* Tourenplan-Import (PDF) */
.tag-warning { color: var(--warning); border-color: var(--warning); background: var(--warning-bg); }
.info-box.warning { background: var(--warning-bg); border-color: rgba(245, 158, 11, .45); display: grid; gap: 8px; }
.plan-time { color: var(--warning); font-weight: 600; }
.import-new-patient { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: center; }
.import-new-patient small { grid-column: 1 / -1; }
.import-new-patient .check { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.import-tour { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.import-tour summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.import-tour .field { margin-top: 10px; }
.import-stops { margin: 10px 0 4px; padding-left: 22px; display: grid; gap: 2px; font-size: 14px; }
.import-stops span { color: var(--text-soft); font-variant-numeric: tabular-nums; margin-right: 6px; }
.import-stops .missing em { color: var(--warning); }
@media (max-width: 600px) { .import-new-patient { grid-template-columns: 1fr 1fr; } .import-new-patient .check { grid-column: 1 / -1; } }
/* Tourenplan wie im PDF: eine Spalte je Mitarbeiter */
.pdf-tour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.pdf-tour { padding: 0; gap: 0; overflow: hidden; }
.pdf-tour-worker { background: #000; color: #fff; font-weight: 800; text-align: center; padding: 10px 8px; font-size: 16px; }
.pdf-tour-head { padding: 5px 10px; font-weight: 800; border-top: 1px solid var(--border); }
.pdf-tour-head.kind-f { background: rgba(134, 239, 172, .22); color: #86efac; }
.pdf-tour-head.kind-s { background: rgba(253, 224, 71, .2); color: #fde047; }
.pdf-tour-head.kind-n { background: rgba(147, 197, 253, .2); color: #93c5fd; }
.pdf-tour-stop { display: grid; grid-template-columns: 1fr auto; padding: 4px 10px; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.3; }
.pdf-tour-stop span { grid-column: 1; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.pdf-tour-stop strong { grid-column: 1; font-weight: 600; }
.pdf-tour-stop em { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--accent); font-style: normal; font-weight: 800; }
.pdf-tour-stop.done strong, .pdf-tour-stop.done span { opacity: .55; }
.pdf-tour .btn { margin: 8px 10px 10px; width: auto; }
:root[data-theme="light"] .pdf-tour-head.kind-f { background: #ccffcc; color: #14532d; }
:root[data-theme="light"] .pdf-tour-head.kind-s { background: #ffff99; color: #713f12; }
.tag-button { cursor: pointer; background: transparent; font-family: inherit; margin: 2px; }
.tag-button:hover { border-color: var(--accent); }
.item-info-name { font-size: 20px; font-weight: 800; }
.find-box { display: grid; gap: 10px; }
.find-box input[type=search] { font-size: 18px; padding: 12px 14px; }
.find-results { display: grid; gap: 6px; }
.find-hit { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.find-hit small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.find-hit.out { border-color: var(--warning); background: var(--warning-bg); }
.find-hit.out .find-where strong { color: var(--warning); }
.find-where { text-align: right; }
.boxkey-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.boxkey-metrics > div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.boxkey-metrics small { color: var(--muted); font-size: 12px; }
.boxkey-metrics strong { font-size: 22px; }
.boxkey-metrics .alert { border-color: var(--danger); }
.boxkey-metrics .alert strong { color: var(--danger); }
.find-box + .table-wrap, .find-box + table { margin-top: 12px; }
@media (max-width: 700px) { .boxkey-metrics { grid-template-columns: 1fr 1fr; } }

/* Tour beendet: Boxen/Schlüssel ins Büro bringen und dort auschecken. Kräftiges Grün, große Großbuchstaben. */
.tour-done-banner, .tour-done-card { --td-bg: #4ade80; --td-ink: #052e16; color: var(--td-ink); }
.tour-done-banner { display: grid; gap: 12px; padding: 22px 20px; border-radius: 18px; background: var(--td-bg); }
.tour-done-title { margin: 0; font-family: 'Archivo Black', 'Arial Black', system-ui, sans-serif; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; line-height: .95; color: var(--td-ink); }
.tour-done-banner .tour-done-title { font-size: 40px; }
.tour-done-lead { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.25; }
.tour-done-list { margin: 0; padding: 0; list-style: none; display: grid; border: 3px solid var(--td-ink); border-radius: 12px; }
.tour-done-list li { display: flex; gap: 10px; padding: 10px 14px; font-size: 18px; font-weight: 800; letter-spacing: .02em; }
.tour-done-list li + li { border-top: 3px solid var(--td-ink); }
.tour-done-note { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
.tour-done-banner .btn { justify-self: start; background: var(--td-ink); color: var(--td-bg); border-color: var(--td-ink); }
.tour-done-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 28px 22px; background: #4ade80; overflow-y: auto; }
.tour-done-card { width: min(520px, 100%); display: grid; gap: 18px; }
.tour-done-card .tour-done-title { font-size: 64px; }
.tour-done-ok { min-height: 64px; border: 0; border-radius: 14px; background: var(--td-ink); color: var(--td-bg); font: 900 22px 'Archivo Black', 'Arial Black', system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .tour-done-banner { animation: none; } }
.med-banner.done { border-color: var(--success); background: rgba(34, 197, 94, .12); }
.med-banner.done strong { color: var(--success); font-size: 18px; }
.med-toggles { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 0; }
.med-toggles legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text-soft); }
.med-toggle { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.med-toggle input { width: 20px; height: 20px; flex: none; }
.med-toggle span { display: grid; gap: 1px; }
