/* PflegeLern P23 — Editorial Clinical UI
   Deliberately restrained: no gradients, glass, glow, oversized radii, or decorative shadows. */

:root {
  --bg: #e9edef;
  --surface: #f5f7f7;
  --surface-soft: #eef1f2;
  --surface-raised: #fbfcfc;
  --surface-tint: #e5edf3;
  --surface-blue: #e7eef4;
  --text: #1d2529;
  --text-secondary: #4d5a61;
  --text-muted: #68757c;
  --border: #bcc6cb;
  --border-strong: #8f9ca3;
  --accent: #28658f;
  --accent-hover: #1f5276;
  --accent-strong: #174564;
  --accent-soft: #dce8f0;
  --mint: #4f8d81;
  --mint-soft: #e1ebe8;
  --blue: #28658f;
  --blue-hover: #1f5276;
  --blue-soft: #dce8f0;
  --success: #38725d;
  --success-soft: #dfeae5;
  --warning: #8a621b;
  --warning-soft: #eee5d5;
  --danger: #a33f46;
  --danger-hover: #87333a;
  --danger-soft: #f0dfe1;
  --focus: rgba(40, 101, 143, .28);
  --on-accent: #ffffff;
  --button-primary: #28658f;
  --button-primary-hover: #1f5276;
  --button-primary-text: #ffffff;
  --sidebar-bg: #f2f4f4;
  --sidebar-text: #1d2529;
  --sidebar-muted: #5f6d74;
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-dialog: 0 18px 50px rgba(20, 28, 32, .18);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-dialog: 8px;
  --content-width: 960px;
  --study-width: 760px;
  --sidebar-width: 224px;
  --bottom-nav-height: 68px;
  --mobile-header-height: 58px;
  --font-ui: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #15191c;
  --surface: #1c2125;
  --surface-soft: #20262a;
  --surface-raised: #242a2e;
  --surface-tint: #202b33;
  --surface-blue: #202b33;
  --text: #f0f2f3;
  --text-secondary: #b8c0c5;
  --text-muted: #929da4;
  --border: #3c464c;
  --border-strong: #59656c;
  --accent: #74a9cf;
  --accent-hover: #91bddb;
  --accent-strong: #a7cce5;
  --accent-soft: #263844;
  --mint: #76a99e;
  --mint-soft: #26342f;
  --blue: #74a9cf;
  --blue-hover: #91bddb;
  --blue-soft: #263844;
  --success: #7faf98;
  --success-soft: #27362f;
  --warning: #d1ad68;
  --warning-soft: #3b3325;
  --danger: #e0878d;
  --danger-hover: #ee9ca1;
  --danger-soft: #402c2f;
  --focus: rgba(116, 169, 207, .35);
  --on-accent: #11181d;
  --button-primary: #5f91b4;
  --button-primary-hover: #74a9cf;
  --button-primary-text: #10171b;
  --sidebar-bg: #191e22;
  --sidebar-text: #edf0f1;
  --sidebar-muted: #aab3b8;
  --shadow-dialog: 0 22px 60px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

html, body { background: var(--bg); }
body {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.55;
  font-weight: 430;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 {
  color: var(--text);
  font-family: var(--font-ui);
  letter-spacing: -.018em;
}
h1 { font-size: clamp(1.9rem, 3.2vw, 2.25rem); line-height: 1.12; font-weight: 720; }
h2 { font-size: 1.08rem; line-height: 1.3; font-weight: 700; }
h3 { font-size: .98rem; line-height: 1.35; font-weight: 680; }
.muted { color: var(--text-secondary); }
.subtle { color: var(--text-muted); }

/* Shell / navigation */
.sidebar {
  width: var(--sidebar-width);
  padding: 22px 14px 18px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: none;
}
.brand {
  min-height: 44px;
  gap: 10px;
  padding: 0 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--sidebar-text);
  font-size: 1rem;
  font-weight: 720;
}
.brand:hover { color: var(--sidebar-text); }
.brand-mark { width: 29px; height: 29px; color: var(--accent); }
.brand-mark svg { width: 27px; height: 27px; stroke-width: 1.8; }
.side-nav { gap: 2px; margin-top: 18px; }
.nav-link {
  position: relative;
  min-height: 43px;
  padding: 0 10px 0 13px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--sidebar-muted);
  font-size: .91rem;
  font-weight: 590;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.nav-link svg { width: 19px; height: 19px; stroke-width: 1.8; }
.nav-link:hover { background: var(--surface-soft); color: var(--text); transform: none; }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  box-shadow: none;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent);
}
.nav-link-secondary {
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
  border-radius: 4px;
}
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 10px; }

.main-content {
  margin-left: var(--sidebar-width);
  padding: 48px 48px 80px;
  background: var(--bg);
}
.page { max-width: var(--content-width); }
.page-header {
  position: relative;
  margin-bottom: 26px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-strong);
}
.page-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 54px;
  height: 2px;
  background: var(--accent);
}
.page-header h1 { margin: 0; }
.care-page-subtitle,
.page-header > .muted {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: .94rem;
}
.page-kicker {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

/* Structural surfaces */
.section {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
}
.section + .section { padding-top: 20px; border-top: 1px solid var(--border); }
.section-header { align-items: center; margin-bottom: 14px; }
.section-header a, .section-header .button-text { font-size: .84rem; }

/* Dashboard */
.hero-action {
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: none;
}
.hero-title { margin-top: 0; font-size: clamp(1.45rem, 3vw, 1.72rem); font-weight: 720; }
.hero-meta { gap: 6px 18px; color: var(--text-secondary); }
.hero-meta strong { color: var(--text); font-weight: 700; }
.primary-action-wrap { max-width: 420px; }
.metric-big { color: var(--accent-strong); font-weight: 740; letter-spacing: -.025em; }
.progress-track {
  height: 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface-soft);
  overflow: hidden;
}
.progress-fill { background: var(--accent); border-radius: 0; }
.care-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: stretch;
  margin-top: 18px;
}
.care-dashboard-grid > .section { margin-top: 0; min-width: 0; }

/* Buttons — compact, rectangular, utilitarian */
.button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--button-primary);
  border-radius: 6px;
  background: var(--button-primary);
  color: var(--button-primary-text) !important;
  font-size: .91rem;
  font-weight: 680;
  letter-spacing: 0;
  box-shadow: none;
  transition: background 110ms ease, border-color 110ms ease, color 110ms ease;
}
.button:hover {
  background: var(--button-primary-hover);
  border-color: var(--button-primary-hover);
  color: var(--button-primary-text) !important;
  box-shadow: none;
}
.button:active { transform: none; }
.button:disabled { opacity: .48; }
.button-secondary {
  background: transparent;
  color: var(--text) !important;
  border-color: var(--border-strong);
}
.button-secondary:hover {
  background: var(--surface-soft);
  color: var(--text) !important;
  border-color: var(--text-muted);
}
.button-soft { background: var(--accent-soft); color: var(--accent-strong) !important; border-color: color-mix(in srgb, var(--accent) 36%, var(--border)); }
.button-soft:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent) 20%); color: var(--accent-strong) !important; }
.button-danger { background: transparent; color: var(--danger) !important; border-color: var(--danger); }
.button-danger:hover { background: var(--danger-soft); color: var(--danger) !important; border-color: var(--danger); }
.button-text {
  min-height: 36px;
  padding: 6px 8px;
  background: transparent;
  border-color: transparent;
  border-radius: 4px;
  color: var(--accent-strong) !important;
  box-shadow: none;
  font-weight: 650;
}
.button-text:hover { background: var(--accent-soft); color: var(--accent-strong) !important; }
.icon-button { border: 1px solid transparent; border-radius: 4px; color: var(--text-secondary); }
.icon-button:hover { border-color: var(--border); background: var(--surface-soft); color: var(--text); }

/* Lists / rows */
.list { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.list-row {
  min-height: 58px;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-raised);
  box-shadow: none;
}
.list > :last-child .list-row,
.list > .list-row:last-child { border-bottom: 0; }
a.list-row { color: var(--text); }
a.list-row:hover { background: var(--surface-soft); }
.list-row-title { font-weight: 650; }
.list-row-subtitle { color: var(--text-secondary); }
.list-row-meta { color: var(--text-muted); font-weight: 600; }
.chevron { color: var(--accent); }

.quick-actions { gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.quick-action {
  min-height: 116px;
  padding: 16px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-raised);
  box-shadow: none;
  text-align: left;
}
.quick-action:last-child { border-right: 0; }
.quick-action:hover { background: var(--surface-soft); border-color: var(--border); }
.quick-action strong { font-size: .98rem; }
.quick-action span { color: var(--text-secondary); }

/* Forms */
.field label { color: var(--text); font-size: .84rem; font-weight: 650; }
input[type="text"], input[type="search"], input[type="number"], input[type="date"], textarea, select {
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: none;
}
input:hover, textarea:hover, select:hover { border-color: var(--text-muted); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus); }
.search-field { border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-raised); box-shadow: none; }
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: transparent;
  overflow: hidden;
}
.segmented button {
  min-width: 90px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-right: 1px solid var(--border-strong);
  border-radius: 0;
  background: var(--surface-raised);
  color: var(--text-secondary);
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }

/* Notices and status */
.notice { border: 1px solid var(--border); border-left-width: 3px; border-radius: 5px; background: var(--surface-soft); }
.notice-warning { border-left-color: var(--warning); background: var(--warning-soft); }
.notice-success { border-left-color: var(--success); background: var(--success-soft); }
.notice-danger { border-left-color: var(--danger); background: var(--danger-soft); }
.badge, .status-badge { border-radius: 3px; font-weight: 650; }

/* Study + exam */
.study-topbar, .exam-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: none;
}
.question-shell,
.flashcard {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: none;
}
.answer-option {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}
.answer-option:hover { border-color: var(--border-strong); background: var(--surface-soft); }
.answer-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.order-item, .matching-row { border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.explanation, .answer-panel, .study-feedback { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 5px; background: var(--surface-soft); }
.rating-buttons { gap: 8px; }
.rating-button { border-radius: 5px; box-shadow: none; }

/* P20 exam */
.p20-exam-builder { border-top: 1px solid var(--border); }
.p20-presets { gap: 6px; }
.p20-chapter-picker,
.p20-overview,
.p20-result-summary {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  box-shadow: none;
}
.p20-q { border: 1px solid var(--border); border-radius: 3px; background: var(--surface); }
.p20-q.answered { background: var(--surface-soft); }
.p20-q.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.p20-q.flagged { border-color: var(--warning); }
.p20-timer { border: 1px solid var(--border); border-radius: 4px; background: var(--surface-soft); }

/* Settings / data — rows, not floating AI cards */
.care-settings > section:not(.section) { margin-top: 18px; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.data-actions { display: grid; gap: 0; margin-top: 14px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.care-data-card {
  display: grid;
  grid-template-columns: 32px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-raised);
  box-shadow: none;
}
.care-data-card:last-child { border-bottom: 0; }
.care-data-card-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
}
.care-data-card-icon svg { width: 22px; height: 22px; stroke-width: 1.7; }
.care-data-card-copy { display: grid; gap: 2px; min-width: 0; }
.care-data-card-copy strong { font-size: .94rem; }
.care-data-card-copy span { color: var(--text-secondary); font-size: .85rem; }
.care-data-card-copy small { color: var(--text-muted); font-size: .75rem; }
.info-table { border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.info-table td { border-bottom: 1px solid var(--border); }

/* Dialogs / toast */
.dialog { border: 1px solid var(--border-strong); border-radius: var(--radius-dialog); background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-dialog); }
.toast { border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-dialog); }
.empty-state { border: 1px dashed var(--border-strong); border-radius: 6px; background: var(--surface); }

/* Mobile */
.mobile-header {
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: none;
}
.mobile-brand { color: var(--text); font-weight: 720; }
.bottom-nav {
  background: var(--surface-raised);
  border-top: 1px solid var(--border-strong);
  box-shadow: none;
}
.bottom-nav-link { color: var(--text-muted); }
.bottom-nav-link.active { color: var(--accent-strong); background: transparent; }
.bottom-nav-link.active::before { content:""; position:absolute; top:0; left:24%; right:24%; height:2px; background:var(--accent); }

@media (max-width: 900px) {
  .main-content { margin-left: 0; padding: calc(var(--mobile-header-height) + 28px) 22px calc(var(--bottom-nav-height) + 34px); }
  .care-dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .main-content { padding-left: 15px; padding-right: 15px; }
  .page-header { margin-bottom: 20px; padding-bottom: 12px; }
  h1 { font-size: 1.82rem; }
  .hero-action, .section { padding: 17px; }
  .hero-action { border-left-width: 3px; }
  .quick-actions { display: grid; grid-template-columns: 1fr; }
  .quick-action { min-height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .quick-action:last-child { border-bottom: 0; }
  .care-data-card { grid-template-columns: 28px minmax(0,1fr); }
  .care-data-card .button { grid-column: 2; justify-self: start; width: auto; }
  .p20-overview { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
