/* Paramedik veb panel. Rənglər token-dir; qaranlıq rejim sistem ayarına görə. */
:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #16202a;
  --muted: #5b6875;
  --border: #d8dee4;
  --primary: #0b6bcb;
  --primary-text: #ffffff;
  --danger: #c62828;
  --danger-bg: #fdecea;
  --warn: #8a4b00;
  --warn-bg: #fff1dc;
  --info-bg: #e8f1fb;
  --selected: #e3effc;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #171e26;
    --surface-2: #1f2832;
    --text: #e6ebf0;
    --muted: #97a3af;
    --border: #2c3743;
    --primary: #5aa7f2;
    --primary-text: #08121c;
    --danger: #ff8a80;
    --danger-bg: #3a1a1a;
    --warn: #ffcc80;
    --warn-bg: #3a2a12;
    --info-bg: #16283b;
    --selected: #1c3550;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 1.4rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .8rem; margin-top: 1.5rem; }
.center { text-align: center; }
.error { color: var(--danger); }
.brand { font-weight: 700; color: var(--primary); letter-spacing: .02em; }

/* ── Giriş ── */
.auth { max-width: 420px; margin: 8vh auto; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: .8rem; color: var(--muted); }
.input { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; min-height: 40px; width: 100%; }
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 9px 16px; min-height: 40px; }
.btn:hover { filter: brightness(0.97); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.danger { color: var(--danger); }
.btn.link { background: none; border: none; color: var(--muted); text-decoration: underline; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.auth .btn { width: 100%; margin-top: 8px; }
.auth .btn.link { width: auto; }
.steps { padding-left: 1.2rem; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 22px 0 6px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.pair-code { text-align: center; font-size: 2.6rem; font-weight: 700; letter-spacing: .1em; font-variant-numeric: tabular-nums; margin: 4px 0 0; }
.qr { display: block; width: 100%; max-width: 280px; margin: 16px auto; border-radius: 8px; }

/* ── Panel ── */
.panel { max-width: 1400px; margin: 0 auto; padding: 0 16px 32px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 0; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.topbar .who { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.filters { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 10px; align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.filters .check { grid-column: 1 / span 2; display: flex; gap: 8px; align-items: center; }
.filters .quick { grid-column: 3 / -1; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chip { font: inherit; font-size: .85rem; cursor: pointer; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 4px 12px; }
.stats { margin: 12px 0; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.tile.warn { background: var(--warn-bg); }
.tile-value { font-size: 1.5rem; font-weight: 700; }
.tile-label { color: var(--muted); font-size: .85rem; }
.stats p { margin: 8px 0 0; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.columns { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.list { display: flex; flex-direction: column; gap: 6px; }
.day { font-size: .85rem; color: var(--primary); margin: 12px 0 2px; font-weight: 600; }
.row { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.row:hover { border-color: var(--primary); }
.row.selected { background: var(--selected); border-color: var(--primary); }
.row .time { font-weight: 600; font-variant-numeric: tabular-nums; }
.row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .name { font-weight: 600; }
.row .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 45%; }
.tag { font-size: .75rem; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--muted); white-space: nowrap; }
.tag.critical { color: var(--danger); border-color: var(--danger); }
.tag.draft { color: var(--warn); border-color: var(--warn); }
.detail { position: sticky; top: 64px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; max-height: calc(100vh - 80px); overflow: auto; }
.detail-head { margin-bottom: 10px; }
.patient { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; font-size: .9rem; }
.allergy.has { color: var(--danger); font-weight: 600; }
.flags { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.flag { border-radius: 8px; padding: 8px 10px; font-size: .88rem; }
.flag.critical { background: var(--danger-bg); }
.flag.warning { background: var(--warn-bg); }
.flag.info { background: var(--info-bg); }
.report { white-space: pre-wrap; word-break: break-word; font: .9rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); border-radius: 8px; padding: 12px; margin: 0; }
.empty { padding: 24px 4px; }

@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .check, .filters .quick { grid-column: 1 / -1; justify-content: flex-start; }
  .filters > .field:first-child { grid-column: 1 / -1; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; }
  .topbar .who { display: none; }
}
