/* ═══════════════════════════════════════════════════════════
   PATIENT HEALTH DATA ROOM – Design System
   Palette: deep navy, clean white, medical teal accent
   Font: Georgia serif for display, system stack for UI
═══════════════════════════════════════════════════════════ */

:root {
  --navy:        #0f2b4a;
  --navy-dark:   #091d33;
  --navy-mid:    #1a3a5c;
  --navy-light:  #2a5080;
  --teal:        #2e9e82;
  --teal-light:  #4db8a0;
  --teal-pale:   #e6f7f3;
  --white:       #ffffff;
  --gray-50:     #f7f8fa;
  --gray-100:    #eef0f4;
  --gray-200:    #dde1e9;
  --gray-300:    #c0c8d4;
  --gray-500:    #7a8899;
  --gray-700:    #3c4a5a;
  --gray-900:    #1a2230;
  --warning:     #c47b00;
  --warning-bg:  #fff8e6;
  --danger:      #b0281e;
  --danger-bg:   #fdf0ef;
  --success:     #1a7a50;
  --success-bg:  #edf7f2;
  --border:      #dde1e9;
  --shadow-sm:   0 1px 3px rgba(15,43,74,.08);
  --shadow-md:   0 4px 12px rgba(15,43,74,.12);
  --shadow-lg:   0 8px 32px rgba(15,43,74,.16);
  --radius:      6px;
  --radius-lg:   10px;
  --font-ui:     -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-serif:  Georgia, 'Times New Roman', serif;
  --transition:  .18s ease;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-ui); color: var(--gray-900); background: var(--gray-50); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul { list-style: none; }

/* ── SCREEN SYSTEM ── */
.screen { display: none; }
.screen.active { display: block; }

/* ══════════════════════════════════════
   LOGIN
══════════════════════════════════════ */
.login-layout {
  display: flex; min-height: 100vh;
}
.login-brand-panel {
  flex: 0 0 42%;
  background: linear-gradient(160deg, var(--navy-dark) 0%, var(--navy-mid) 60%, var(--navy-light) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 60px 48px;
  position: relative; overflow: hidden;
}
.login-brand-panel::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(255,255,255,.018) 40px,
    rgba(255,255,255,.018) 41px
  );
}
.login-brand-inner { position: relative; z-index: 1; max-width: 360px; }
.brand-logo {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.brand-name {
  color: var(--white); font-family: var(--font-serif);
  font-size: 1.25rem; letter-spacing: -.01em; font-weight: normal;
}
.brand-tagline {
  color: rgba(255,255,255,.65); font-size: .9rem;
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.brand-pillars { display: flex; flex-direction: column; gap: 18px; }
.pillar {
  display: flex; align-items: flex-start; gap: 14px;
  color: rgba(255,255,255,.82); font-size: .875rem;
}
.pillar-icon { font-size: 1rem; flex-shrink: 0; }

.login-form-panel {
  flex: 1;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
}
.login-form-inner { width: 100%; max-width: 420px; }

.login-access-note {
  background: var(--teal-pale);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px; margin-bottom: 32px;
}
.login-access-note p { color: var(--gray-700); font-size: .85rem; margin-top: 6px; }
.access-badge {
  display: inline-block;
  background: var(--teal); color: white;
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 10px; border-radius: 20px;
}

.login-title {
  font-family: var(--font-serif); font-weight: normal;
  font-size: 1.75rem; color: var(--navy); margin-bottom: 28px;
}

.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--gray-700); letter-spacing: .03em;
  text-transform: uppercase; margin-bottom: 6px;
}
.optional-tag {
  font-weight: 400; color: var(--gray-500); text-transform: none;
  letter-spacing: 0; margin-left: 4px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem; color: var(--gray-900);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(42,80,128,.12);
}
.form-select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; color: var(--gray-900); background: var(--white);
  outline: none; cursor: pointer;
  transition: border-color var(--transition);
}
.form-select:focus { border-color: var(--navy-light); }
.form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; color: var(--gray-900); resize: vertical; outline: none;
  transition: border-color var(--transition);
}
.form-textarea:focus { border-color: var(--navy-light); }

.login-role-select { margin-bottom: 22px; }
.role-options { display: flex; gap: 10px; margin-top: 8px; }
.role-option { flex: 1; }
.role-option input { display: none; }
.role-option-label {
  display: block; text-align: center;
  padding: 9px 8px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .85rem; cursor: pointer;
  transition: all var(--transition);
}
.role-option input:checked + .role-option-label {
  border-color: var(--navy-mid); background: var(--navy-mid); color: white;
}
.role-tab {
  flex: 1; background: var(--white); font-family: inherit;
}
.role-tab.active {
  border-color: var(--navy-mid); background: var(--navy-mid); color: white;
}

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
  border: none; border-radius: var(--radius); font-size: .875rem;
  font-weight: 600; transition: all var(--transition); }
.btn-primary { background: var(--navy-mid); color: white; }
.btn-primary:hover { background: var(--navy); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--navy-mid); color: var(--navy-mid); }
.btn-outline-danger { background: transparent; border: 1.5px solid #e0c0be; color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { color: var(--gray-900); }
.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-login { width: 100%; justify-content: center; padding: 13px; font-size: .95rem; }

.login-footer-note { margin-top: 20px; }
.login-footer-note p { font-size: .78rem; color: var(--gray-500); line-height: 1.6; }

/* ══════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════ */
#screen-app { display: none; }
#screen-app.active { display: flex; flex-direction: column; min-height: 100vh; }

.topnav {
  position: sticky; top: 0; z-index: 200;
  background: var(--navy-dark);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 0 24px;
}
.topnav-inner {
  display: flex; align-items: center; gap: 20px;
  max-width: 1400px; margin: 0 auto; height: 56px;
}
.topnav-brand {
  display: flex; align-items: center; gap: 10px;
  color: white; font-weight: 700; letter-spacing: .06em;
  font-size: .85rem; text-transform: uppercase;
}
.topnav-patient-badge {
  margin-left: 20px; padding-left: 20px;
  border-left: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; gap: 10px;
}
.nav-patient-name { color: rgba(255,255,255,.9); font-size: .875rem; font-weight: 600; }
.nav-role-badge {
  background: var(--teal); color: white;
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 12px;
}
.topnav-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.session-timer {
  display: flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,.55); font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.session-icon { font-size: .85rem; }

.app-layout {
  display: flex; flex: 1;
  max-width: 1400px; width: 100%; margin: 0 auto;
}

/* SIDEBAR */
.sidebar {
  flex: 0 0 220px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky; top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.sidebar-nav { display: flex; flex-direction: column; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--gray-700); font-size: .875rem;
  transition: all var(--transition); border-left: 3px solid transparent;
}
.sidebar-link:hover { background: var(--gray-50); color: var(--navy); }
.sidebar-link.active {
  background: var(--teal-pale); color: var(--navy);
  border-left-color: var(--teal); font-weight: 600;
}
.nav-icon { width: 18px; text-align: center; font-size: .9rem; }
.nav-separator {
  padding: 16px 20px 6px;
}
.nav-separator span {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gray-500); font-weight: 600;
}

/* MAIN */
.main-content {
  flex: 1; padding: 28px 32px;
  overflow-y: auto; min-width: 0;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════
   SECTION HEADERS
══════════════════════════════════════ */
.section-header { margin-bottom: 24px; }
.section-title {
  font-family: var(--font-serif); font-weight: normal;
  font-size: 1.6rem; color: var(--navy); letter-spacing: -.02em;
}
.section-desc {
  color: var(--gray-500); font-size: .875rem; margin-top: 4px;
}
.section-subtitle {
  font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 14px;
}
.last-updated { font-size: .8rem; color: var(--gray-500); display: block; margin-top: 4px; }

/* ══════════════════════════════════════
   DASHBOARD
══════════════════════════════════════ */
.patient-identity-card {
  background: var(--navy-dark);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}
.patient-avatar {
  flex-shrink: 0; width: 56px; height: 56px;
  background: var(--navy-light); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 1.1rem;
  letter-spacing: .05em;
}
.patient-name {
  color: white; font-family: var(--font-serif);
  font-weight: normal; font-size: 1.35rem; margin-bottom: 8px;
}
.patient-meta-row { display: flex; flex-wrap: wrap; gap: 18px; }
.meta-item { color: rgba(255,255,255,.7); font-size: .84rem; }
.meta-item strong { color: rgba(255,255,255,.9); }
.emergency-profile-btn { margin-left: auto; flex-shrink: 0; }

.dashboard-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-bottom: 28px;
}
.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-primary { border-top: 3px solid var(--navy-mid); }
.info-card-label {
  font-size: .72rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--gray-500); font-weight: 700; margin-bottom: 8px;
}
.info-card-value {
  font-size: 1rem; font-weight: 700; color: var(--gray-900);
  margin-bottom: 6px; line-height: 1.3;
}
.info-card-sub { font-size: .82rem; color: var(--gray-500); line-height: 1.4; }
.status-pending { color: var(--warning); }
.status-warning { color: var(--danger); }

.quick-actions { margin-top: 4px; }
.quick-action-row { display: flex; gap: 12px; flex-wrap: wrap; }
.quick-action-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--white);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .875rem; color: var(--gray-700); font-weight: 600;
  transition: all var(--transition);
}
.quick-action-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ══════════════════════════════════════
   KURZAKTE
══════════════════════════════════════ */
.kurzakte-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.ka-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.ka-highlight {
  border-top: 3px solid var(--navy-mid);
}
.ka-alert {
  border-top: 3px solid var(--warning);
  background: var(--warning-bg);
}
.ka-label {
  font-size: .72rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--gray-500); font-weight: 700; margin-bottom: 8px;
}
.ka-value {
  font-size: 1rem; font-weight: 700; color: var(--gray-900);
  margin-bottom: 8px; line-height: 1.3;
}
.ka-detail { font-size: .85rem; color: var(--gray-700); line-height: 1.5; }
.ka-list { padding-left: 0; }
.ka-list li {
  font-size: .875rem; color: var(--gray-700);
  padding: 4px 0; border-bottom: 1px solid var(--gray-100);
  line-height: 1.4;
}
.ka-list li:last-child { border-bottom: none; }
.ka-list li::before { content: '—'; color: var(--teal); margin-right: 8px; }

/* Steckbrief (Punkt 1) */
.ka-steckbrief {
  background: var(--navy-dark);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: background .15s;
}
.ka-steckbrief:hover { background: var(--navy); }
.ka-steckbrief-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--navy-light); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.ka-steckbrief-name { color: white; font-family: var(--font-serif); font-size: 1.2rem; margin-bottom: 4px; }
.ka-steckbrief-meta { color: rgba(255,255,255,.65); font-size: .82rem; }
.ka-steckbrief-meta strong { color: rgba(255,255,255,.9); }
.ka-steckbrief-arrow { color: rgba(255,255,255,.5); margin-left: auto; font-size: 1.2rem; flex-shrink: 0; }

/* Sektionstitel innerhalb Kurzakte */
.ka-section-title {
  font-size: .82rem; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: .05em;
  margin: 22px 0 10px; display: flex; align-items: center; gap: 8px;
}
.ka-section-title:first-child { margin-top: 0; }
.ka-section-badge {
  font-size: .65rem; padding: 2px 8px; border-radius: 10px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge-bericht { background: var(--teal-pale); color: var(--teal); }
.badge-patient { background: #fff0e0; color: #a06020; }

/* Patientenangabe-Karten (Punkt 3) – visuell abgesetzt */
.ka-card-patient {
  border-left: 3px solid #d99a3f;
  background: #fffaf2;
}

/* Konflikt-Block (Punkt 6/7) */
.ka-conflict {
  background: var(--danger-bg);
  border: 1px solid #e0c0be;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
  grid-column: 1/-1;
}
.ka-conflict-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--danger); font-size: .9rem; margin-bottom: 10px;
}
.ka-conflict-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-bottom: 8px;
}
.ka-conflict-side {
  background: white; border-radius: 6px; padding: 10px 12px;
  font-size: .82rem; line-height: 1.5;
}
.ka-conflict-side-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 700; margin-bottom: 4px; display: block;
}
.ka-conflict-hinweis {
  font-size: .8rem; color: var(--gray-600); font-style: italic; margin-top: 8px;
}

/* Quellenangabe unter Listenelementen */
.ka-quelle {
  font-size: .72rem; color: var(--gray-400); display: block; margin-top: 2px;
}

/* ══════════════════════════════════════
   TIMELINE
══════════════════════════════════════ */
.timeline-filters {
  display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}
.tl-filter-btn {
  padding: 7px 16px; border-radius: 20px;
  border: 1.5px solid var(--border); background: transparent;
  font-size: .82rem; color: var(--gray-700);
  transition: all var(--transition);
}
.tl-filter-btn:hover { border-color: var(--navy-mid); color: var(--navy); }
.tl-filter-btn.active {
  background: var(--navy-mid); color: white; border-color: var(--navy-mid);
}

.timeline {
  position: relative; padding-left: 36px;
}
.timeline::before {
  content: ''; position: absolute; left: 14px; top: 0; bottom: 0;
  width: 2px; background: var(--gray-200);
}
.tl-item {
  position: relative; margin-bottom: 0;
  cursor: pointer;
}
.tl-dot {
  position: absolute; left: -30px; top: 16px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2.5px solid var(--white);
  box-shadow: 0 0 0 2px var(--gray-300);
}
.tl-item:hover .tl-dot { box-shadow: 0 0 0 3px var(--teal-light); }
.tl-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.tl-card:hover { border-color: var(--teal-light); box-shadow: var(--shadow-md); }
.tl-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.tl-date { font-size: .78rem; color: var(--gray-500); font-weight: 600; min-width: 80px; }
.tl-title { font-size: .9rem; font-weight: 700; color: var(--gray-900); }
.tl-institution { font-size: .8rem; color: var(--gray-500); }
.tl-cat-badge {
  display: inline-block; margin-left: auto;
  font-size: .68rem; padding: 2px 8px; border-radius: 12px;
  font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; flex-shrink: 0;
}
.cat-diagnostik { background: #e8eef8; color: #2a5080; }
.cat-bildgebung { background: #f0e8f8; color: #6a3080; }
.cat-therapie { background: var(--teal-pale); color: var(--teal); }
.cat-labor { background: #fff0e8; color: #a06020; }

.timeline-detail-overlay {
  position: fixed; inset: 0; background: rgba(9,29,51,.5);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.timeline-detail-panel {
  background: var(--white); border-radius: var(--radius-lg);
  max-width: 620px; width: 100%; padding: 28px;
  box-shadow: var(--shadow-lg); position: relative;
  max-height: 80vh; overflow-y: auto;
}
.detail-close {
  position: absolute; top: 16px; right: 18px;
  background: none; border: none; font-size: 1.1rem;
  color: var(--gray-500); cursor: pointer;
}
.detail-title {
  font-family: var(--font-serif); font-size: 1.2rem;
  color: var(--navy); margin-bottom: 16px;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.detail-meta-item { font-size: .82rem; color: var(--gray-700); }
.detail-meta-item strong { display: block; color: var(--gray-500); font-size: .7rem; text-transform: uppercase; margin-bottom: 2px; }
.detail-findings { font-size: .875rem; color: var(--gray-700); line-height: 1.7; }
.detail-findings ul { padding-left: 16px; margin-top: 8px; }
.detail-findings li { margin-bottom: 4px; }

/* ══════════════════════════════════════
   DOCUMENTS
══════════════════════════════════════ */
.doc-filter-bar {
  display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
  align-items: center;
}
.doc-filter-bar .form-select { flex: 0 0 200px; }
.search-input { flex: 1; min-width: 180px; }

.doc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.doc-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  display: flex; flex-direction: column;
}
.doc-card:hover { border-color: var(--teal-light); box-shadow: var(--shadow-md); }
.doc-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.doc-title { font-weight: 700; font-size: .9rem; color: var(--gray-900); line-height: 1.3; }
.doc-status { flex-shrink: 0; }
.status-badge {
  display: inline-block; font-size: .67rem;
  padding: 2px 8px; border-radius: 12px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.badge-neu { background: #e8f0fe; color: #2a4db0; }
.badge-geprueft { background: var(--success-bg); color: var(--success); }
.badge-verfuegbar { background: var(--gray-100); color: var(--gray-700); }

.doc-meta { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.doc-meta-row { font-size: .8rem; color: var(--gray-500); display: flex; gap: 8px; }
.doc-meta-row strong { color: var(--gray-700); min-width: 70px; }
.doc-category-tag {
  display: inline-block; font-size: .7rem;
  padding: 2px 8px; border-radius: 4px;
  background: var(--gray-100); color: var(--gray-700);
  font-weight: 600; margin-bottom: 12px;
}
.doc-filetype {
  display: inline-block; font-size: .72rem;
  padding: 2px 7px; border-radius: 4px;
  background: var(--navy-dark); color: rgba(255,255,255,.9);
  font-weight: 700; margin-left: 6px;
}
.doc-actions { margin-top: auto; display: flex; gap: 8px; }
.doc-actions .btn { flex: 1; justify-content: center; }

/* ══════════════════════════════════════
   VIEWER
══════════════════════════════════════ */
.viewer-note-bar {
  background: var(--teal-pale);
  border: 1px solid rgba(46,158,130,.2);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: .85rem; color: var(--teal);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 20px;
}
.viewer-layout { display: flex; gap: 20px; height: 520px; }
.viewer-sidebar {
  flex: 0 0 240px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px; overflow-y: auto;
}
.viewer-sidebar-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--gray-500); font-weight: 700; margin-bottom: 12px; }
.viewer-doc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer; transition: background var(--transition);
  border: 1px solid transparent; margin-bottom: 6px;
}
.viewer-doc-item:hover { background: var(--gray-50); border-color: var(--border); }
.viewer-doc-icon { font-size: 1.1rem; flex-shrink: 0; }
.viewer-doc-info { min-width: 0; }
.viewer-doc-name { font-size: .82rem; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-doc-type { font-size: .72rem; color: var(--gray-500); }
.viewer-main {
  flex: 1; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.viewer-placeholder { text-align: center; max-width: 480px; padding: 40px; }
.viewer-placeholder-icon { font-size: 2.5rem; margin-bottom: 12px; }
.viewer-placeholder-title { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.viewer-placeholder p { font-size: .875rem; color: var(--gray-500); margin-bottom: 24px; }
.viewer-type-info { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.viewer-type-card {
  background: var(--gray-50); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
}
.viewer-type-card strong { display: block; color: var(--navy); font-size: .85rem; margin-bottom: 2px; }
.viewer-type-card span { font-size: .8rem; color: var(--gray-500); }
.viewer-content {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
}
.viewer-bar {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-50);
}
.viewer-bar-title { font-weight: 700; font-size: .9rem; color: var(--navy); }
.viewer-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--gray-50); overflow: hidden;
}
.dicom-placeholder {
  text-align: center; color: var(--gray-500);
  max-width: 340px;
}
.dicom-placeholder-icon { font-size: 3rem; margin-bottom: 12px; }
.dicom-placeholder p { font-size: .85rem; line-height: 1.6; }
.dicom-hint {
  background: var(--navy-dark); color: rgba(255,255,255,.8);
  font-size: .75rem; padding: 8px 14px; border-radius: var(--radius);
  margin-top: 12px; display: inline-block;
}
.pdf-placeholder {
  text-align: center; color: var(--gray-500); max-width: 340px;
}

/* ══════════════════════════════════════
   FREIGABEN / SHARES
══════════════════════════════════════ */
.shares-list { margin-bottom: 32px; }
.share-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.share-card-info { flex: 1; }
.share-recipient { font-weight: 700; color: var(--gray-900); font-size: .95rem; }
.share-details { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.share-detail { font-size: .8rem; color: var(--gray-500); }
.share-detail strong { color: var(--gray-700); }
.share-status { flex-shrink: 0; }
.share-active { color: var(--success); font-size: .78rem; font-weight: 700; }
.share-revoke-btn {
  flex-shrink: 0; padding: 7px 14px; border-radius: var(--radius);
  border: 1.5px solid #e0c0be; background: transparent;
  color: var(--danger); font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.share-revoke-btn:hover { background: var(--danger-bg); }
.share-revoked { opacity: .5; }
.share-revoked .share-recipient { text-decoration: line-through; }

.new-share-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.form-row { display: flex; gap: 16px; margin-bottom: 0; }
.form-row .form-group { flex: 1; margin-bottom: 16px; }
.form-group-inner { display: flex; flex-direction: column; }
.mt-sm { margin-top: 10px; }
.checkbox-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; }
.share-form-actions { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.share-note { font-size: .8rem; color: var(--gray-500); }

/* ══════════════════════════════════════
   UPLOAD
══════════════════════════════════════ */
.upload-note-bar {
  background: var(--teal-pale); border: 1px solid rgba(46,158,130,.2);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: .85rem; color: var(--teal); display: flex; align-items: center; gap: 8px;
  margin-bottom: 20px;
}
.upload-zone {
  border: 2px dashed var(--gray-300); border-radius: var(--radius-lg);
  background: var(--gray-50); padding: 48px 32px;
  text-align: center; cursor: pointer;
  transition: all var(--transition); margin-bottom: 24px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--teal); background: var(--teal-pale);
}
.upload-zone-icon { font-size: 2rem; color: var(--gray-300); margin-bottom: 10px; }
.upload-zone-title { font-weight: 700; color: var(--gray-700); margin-bottom: 8px; }
.upload-zone-formats { font-size: .82rem; color: var(--gray-500); line-height: 1.6; }
.not-allowed { color: var(--danger); }

.upload-form {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.upload-form-actions { display: flex; gap: 12px; margin-top: 4px; }
.upload-success {
  text-align: center; padding: 48px;
  background: var(--success-bg); border: 1px solid rgba(26,122,80,.2);
  border-radius: var(--radius-lg);
}
.success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--success); color: white;
  font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.success-title { font-weight: 700; font-size: 1.1rem; color: var(--success); margin-bottom: 8px; }

/* ══════════════════════════════════════
   AUDIT LOG
══════════════════════════════════════ */
.audit-controls { display: flex; gap: 12px; margin-bottom: 20px; align-items: center; }
.audit-controls .search-input { flex: 1; }
.audit-table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.audit-table {
  width: 100%; border-collapse: collapse; background: var(--white);
}
.audit-table th {
  background: var(--gray-50);
  padding: 11px 14px; text-align: left;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray-500); font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.audit-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--gray-100);
  font-size: .85rem; color: var(--gray-700);
  vertical-align: top;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover td { background: var(--gray-50); }
.audit-action { color: var(--gray-900); font-weight: 600; }
.audit-status-ok { color: var(--success); font-weight: 600; font-size: .78rem; }
.audit-status-revoked { color: var(--danger); font-weight: 600; font-size: .78rem; }
.audit-status-new { color: var(--warning); font-weight: 600; font-size: .78rem; }
.audit-new-row td { animation: highlight-row .8s ease; }
@keyframes highlight-row { from { background: var(--teal-pale); } to { background: transparent; } }

/* ══════════════════════════════════════
   DATENSCHUTZ
══════════════════════════════════════ */
.trust-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 28px;
}
.trust-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.trust-icon { font-size: 1.5rem; margin-bottom: 10px; }
.trust-title { font-weight: 700; color: var(--navy); font-size: .9rem; margin-bottom: 8px; }
.trust-card p { font-size: .82rem; color: var(--gray-500); line-height: 1.6; }
.compliance-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-item {
  padding: 6px 14px; border: 1.5px solid var(--border);
  border-radius: 20px; font-size: .78rem; font-weight: 700;
  color: var(--gray-700); letter-spacing: .04em;
}

/* ══════════════════════════════════════
   EXPORT
══════════════════════════════════════ */
.export-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }
.export-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  cursor: pointer; transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.export-card:hover { border-color: var(--teal); box-shadow: var(--shadow-md); }
.export-icon { font-size: 1.5rem; margin-bottom: 12px; }
.export-title { font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.export-card p { font-size: .85rem; color: var(--gray-500); line-height: 1.5; margin-bottom: 14px; }
.export-note {
  background: var(--warning-bg); border: 1px solid rgba(196,123,0,.2);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: .82rem; color: var(--gray-700);
}

/* ══════════════════════════════════════
   MODALS
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(9,29,51,.55);
  z-index: 400; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  max-width: 520px; width: 100%;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-wide { max-width: 840px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
}
.modal-header h3 { font-family: var(--font-serif); font-weight: normal; color: var(--navy); font-size: 1.05rem; }
.modal-close {
  background: none; border: none; font-size: 1.1rem;
  color: var(--gray-500); cursor: pointer; padding: 4px 8px;
}
.modal-body { padding: 24px; }
.emergency-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.emergency-grid div { font-size: .9rem; color: var(--gray-700); padding: 10px 14px; background: var(--gray-50); border-radius: var(--radius); }
.emergency-note { font-size: .8rem; color: var(--gray-500); border-top: 1px solid var(--border); padding-top: 14px; line-height: 1.5; }

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 500;
  background: var(--navy-dark); color: white;
  padding: 12px 20px; border-radius: var(--radius);
  font-size: .875rem; box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0;
  transition: all .3s ease; pointer-events: none;
  max-width: 340px;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ══════════════════════════════════════
   ROLE VISIBILITY
══════════════════════════════════════ */
.patient-only { }
.patient-section { }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
  .export-options { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login-brand-panel { display: none; }
  .kurzakte-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .main-content { padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .trust-grid { grid-template-columns: 1fr; }
  .viewer-layout { flex-direction: column; height: auto; }
  .viewer-sidebar { flex: none; height: 200px; }
  .viewer-main { height: 340px; }
  .patient-identity-card { flex-wrap: wrap; }
}
