/* ============================================================
   MEDIRA HMS — Design System
   Palette: Deep Pine / Paper Mint / Brass Gold
   Type: Bricolage Grotesque (display) · Public Sans (UI)
         IBM Plex Mono (clinical numerals)
   ============================================================ */

:root {
  /* Color tokens */
  --pine-950: #082520;
  --pine-900: #0e3a32;
  --pine-800: #145247;
  --pine-700: #1b6a5b;
  --pine-600: #22836f;
  --pine-100: #d9ece6;
  --pine-50:  #eef6f3;

  --paper:    #f4f7f5;
  --card:     #ffffff;
  --line:     #e2e9e5;
  --line-2:   #cfdad4;

  --ink:      #12211d;
  --ink-2:    #3c4f49;
  --muted:    #6b7d76;

  --gold:     #c9a24b;
  --gold-2:   #e3c47c;

  /* Triage rail — every status color in the UI derives from these */
  --t-critical: #d64533;
  --t-urgent:   #e08a1e;
  --t-standard: #22836f;
  --t-elective: #2e7fb8;
  --t-neutral:  #8a9a93;

  --shadow-sm: 0 1px 2px rgba(8, 37, 32, .06);
  --shadow-md: 0 6px 24px -8px rgba(8, 37, 32, .14);
  --shadow-lg: 0 24px 60px -20px rgba(8, 37, 32, .28);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --font-display: "Bricolage Grotesque", "Public Sans", sans-serif;
  --font-ui: "Public Sans", system-ui, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, monospace;

  --sidebar-w: 248px;
  --topbar-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; }

button, input, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--pine-100); }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }

.mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 46%) 1fr;
  background: var(--paper);
}

/* --- Brand panel --- */
.login-brand {
  position: relative;
  background:
    radial-gradient(1200px 700px at -10% 110%, rgba(201,162,75,.14), transparent 55%),
    linear-gradient(160deg, var(--pine-900) 0%, var(--pine-950) 78%);
  color: #eaf3ef;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 52px;
  overflow: hidden;
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(234,243,239,.05) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

.brand-lockup { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }

.brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  display: grid; place-items: center;
  color: var(--pine-950);
  box-shadow: 0 6px 18px -6px rgba(201,162,75,.55);
  flex: none;
}

.brand-name { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.brand-name small { display: block; font-family: var(--font-ui); font-size: 11px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: rgba(234,243,239,.55); margin-top: 2px; }

.login-hero { position: relative; z-index: 1; max-width: 460px; }

.login-hero h1 {
  font-size: clamp(30px, 3.2vw, 40px);
  line-height: 1.12;
  font-weight: 640;
  color: #f4f9f6;
}
.login-hero h1 em { font-style: normal; color: var(--gold-2); }

.login-hero p { color: rgba(234,243,239,.68); font-size: 15px; max-width: 40ch; margin: 16px 0 0; }

/* ECG trace */
.ecg-wrap { margin-top: 40px; }
.ecg { width: 100%; height: 72px; overflow: visible; }
.ecg path {
  fill: none;
  stroke: var(--gold-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: ecg-draw 4.5s linear infinite;
  filter: drop-shadow(0 0 6px rgba(227,196,124,.5));
}
@keyframes ecg-draw {
  0%   { stroke-dashoffset: 900; opacity: 0; }
  8%   { opacity: 1; }
  62%  { stroke-dashoffset: 0; opacity: 1; }
  78%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -900; opacity: 0; }
}

.login-stats {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 36px;
  justify-content: start;
}
.login-stat .v { font-family: var(--font-data); font-size: 22px; font-weight: 600; color: #f4f9f6; }
.login-stat .k { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(234,243,239,.5); margin-top: 4px; }

/* --- Form panel --- */
.login-form-panel {
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.login-card { width: min(400px, 100%); }

.login-card h2 { font-size: 26px; font-weight: 640; }
.login-card > p.sub { color: var(--muted); margin: 8px 0 30px; font-size: 14px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: var(--ink-2); margin-bottom: 7px; }

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
}
.input-shell svg { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 40px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--card);
  transition: border-color .16s, box-shadow .16s;
}
.input::placeholder { color: #9fb0a9; }
.input:hover { border-color: var(--pine-600); }
.input:focus { outline: none; border-color: var(--pine-700); box-shadow: 0 0 0 3.5px var(--pine-100); }

.pw-toggle {
  position: absolute; right: 6px;
  height: 34px; width: 34px;
  display: grid; place-items: center;
  border: 0; background: none; cursor: pointer;
  color: var(--muted); border-radius: 6px;
}
.pw-toggle:hover { color: var(--ink); background: var(--pine-50); }
.pw-toggle svg { position: static; }

.field-error {
  display: none;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--t-critical);
}
.field.invalid .input { border-color: var(--t-critical); }
.field.invalid .field-error { display: block; }

.login-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 0 24px;
  font-size: 13px;
}
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--pine-700); cursor: pointer; }
.link-quiet { color: var(--pine-700); font-weight: 600; text-decoration: none; }
.link-quiet:hover { text-decoration: underline; }

.btn-primary {
  width: 100%;
  height: 47px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--pine-800);
  color: #fff;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: .01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--pine-700); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .7; cursor: progress; }

.spinner {
  width: 17px; height: 17px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.btn-primary.loading .spinner { display: block; }
.btn-primary.loading .btn-label { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: #fdefec;
  border: 1px solid #f3c9c1;
  color: #9c3324;
  font-size: 13.5px;
  margin-bottom: 20px;
}
.login-alert.show { display: flex; }

.demo-hint {
  margin-top: 26px;
  padding: 13px 15px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  background: var(--pine-50);
  font-size: 12.5px;
  color: var(--ink-2);
}
.demo-hint code { font-family: var(--font-data); font-size: 12px; background: #fff; border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }

.login-foot { margin-top: 34px; text-align: center; font-size: 12px; color: var(--muted); }

/* ============================================================
   APP SHELL (dashboard)
   ============================================================ */

.app-body { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: linear-gradient(180deg, var(--pine-900), var(--pine-950));
  color: #d7e6e0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar .brand-lockup { padding: 20px 20px 18px; border-bottom: 1px solid rgba(234,243,239,.08); }
.sidebar .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.sidebar .brand-name { font-size: 17px; color: #f4f9f6; }
.sidebar .brand-name small { font-size: 9.5px; }

.nav-scroll { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-scroll::-webkit-scrollbar { width: 5px; }
.nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-label {
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(215,230,224,.42);
  padding: 14px 12px 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9.5px 12px;
  border-radius: 9px;
  color: rgba(215,230,224,.82);
  text-decoration: none;
  font-size: 13.8px;
  font-weight: 500;
  border: 0;
  background: none;
  cursor: pointer;
  transition: background .13s, color .13s;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: rgba(201,162,75,.13);
  color: #f6ead0;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 7px; bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}
.nav-count {
  margin-left: auto;
  font-family: var(--font-data);
  font-size: 11px;
  background: rgba(255,255,255,.1);
  padding: 1.5px 7px;
  border-radius: 20px;
}
.nav-item.active .nav-count { background: rgba(201,162,75,.28); }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(234,243,239,.08); }
.duty-chip {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(215,230,224,.85);
}
.duty-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ad39a; box-shadow: 0 0 0 4px rgba(74,211,154,.16); flex: none; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(74,211,154,.05); } }

/* --- Main column --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* --- Topbar --- */
.topbar {
  height: var(--topbar-h);
  background: rgba(244,247,245,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.menu-btn {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 9px;
  cursor: pointer;
  place-items: center;
  color: var(--ink-2);
}

.search-shell {
  position: relative;
  width: min(380px, 100%);
}
.search-shell svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); }
.search-input {
  width: 100%; height: 40px;
  padding: 0 68px 0 38px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--card);
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { outline: none; border-color: var(--pine-700); box-shadow: 0 0 0 3px var(--pine-100); }
.search-kbd {
  position: absolute; right: 9px; top: 50%; translate: 0 -50%;
  font-family: var(--font-data); font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--paper);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 10px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: background .13s, border-color .13s;
}
.icon-btn:hover { background: var(--pine-50); border-color: var(--pine-600); }
.icon-btn svg { width: 18px; height: 18px; }
.badge-dot {
  position: absolute; top: 9px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--t-critical);
  border: 2px solid var(--card);
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 12px;
  padding: 5px 12px 5px 6px;
  cursor: pointer;
}
.user-chip:hover { border-color: var(--pine-600); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--pine-700), var(--pine-900));
  color: #f6ead0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 13px;
  flex: none;
}
.user-chip .u-name { font-size: 13px; font-weight: 650; line-height: 1.15; }
.user-chip .u-role { font-size: 11px; color: var(--muted); }

/* --- Content --- */
.content { padding: 28px 26px 48px; max-width: 1460px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 25px; font-weight: 640; }
.page-head .crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.page-head .crumb b { color: var(--pine-700); font-weight: 600; }

.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-ghost, .btn-solid {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .14s;
}
.btn-ghost { border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--pine-600); background: var(--pine-50); }
.btn-solid { border: 0; background: var(--pine-800); color: #fff; box-shadow: var(--shadow-sm); }
.btn-solid:hover { background: var(--pine-700); box-shadow: var(--shadow-md); }
.btn-ghost svg, .btn-solid svg { width: 16px; height: 16px; }

/* --- KPI cards with triage rail --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 18px 16px 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .18s, translate .18s;
}
.kpi:hover { box-shadow: var(--shadow-md); translate: 0 -2px; }
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--rail, var(--t-neutral));
}
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .k-label { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.kpi .k-ico {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--rail, var(--t-neutral)) 12%, white);
  color: var(--rail, var(--t-neutral));
}
.kpi .k-ico svg { width: 17px; height: 17px; }
.kpi .k-value {
  font-family: var(--font-data);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 10px;
  line-height: 1;
}
.kpi .k-value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.kpi .k-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-data); font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.trend svg { width: 12px; height: 12px; }
.trend.up   { color: #14735c; background: #e2f3ec; }
.trend.down { color: #ab3423; background: #fbe9e5; }

/* --- Generic panel --- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 20px 0;
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 15.5px; font-weight: 640; }
.panel-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.panel-body { padding: 14px 20px 20px; }

.seg {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0; background: none;
  padding: 5px 12px;
  font-size: 12.5px; font-weight: 600;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  transition: all .13s;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--card); color: var(--pine-800); box-shadow: var(--shadow-sm); }

/* --- Layout rows --- */
.grid-main {
  display: grid;
  grid-template-columns: 1.9fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.grid-tri {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.grid-bottom {
  display: grid;
  grid-template-columns: 1.9fr 1fr;
  gap: 16px;
}

.chart-shell { position: relative; width: 100%; }
.chart-shell canvas { width: 100% !important; }

/* --- Legend --- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend .li { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* --- Ward occupancy bars --- */
.ward-row { display: grid; grid-template-columns: 118px 1fr 76px; align-items: center; gap: 12px; padding: 9px 0; }
.ward-row + .ward-row { border-top: 1px dashed var(--line); }
.ward-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ward-track { height: 9px; background: var(--paper); border-radius: 20px; overflow: hidden; }
.ward-fill { height: 100%; border-radius: 20px; background: var(--pine-600); transition: width 1s cubic-bezier(.22,1,.36,1); width: 0; }
.ward-fill.warn { background: var(--t-urgent); }
.ward-fill.crit { background: var(--t-critical); }
.ward-val { font-family: var(--font-data); font-size: 12.5px; text-align: right; color: var(--ink-2); }

/* --- Wristband status tags (signature) --- */
.band {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .03em;
  padding: 3.5px 10px 3.5px 8px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--rail) 10%, white);
  color: color-mix(in srgb, var(--rail) 82%, black);
  border: 1px solid color-mix(in srgb, var(--rail) 26%, white);
  white-space: nowrap;
}
.band::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--rail);
}
.band.critical { --rail: var(--t-critical); }
.band.urgent   { --rail: var(--t-urgent); }
.band.standard { --rail: var(--t-standard); }
.band.elective { --rail: var(--t-elective); }
.band.neutral  { --rail: var(--t-neutral); }

/* --- Table --- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 720px;
}
table.data thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  white-space: nowrap;
}
table.data tbody td { padding: 12.5px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--pine-50); }
table.data tbody tr:last-child td { border-bottom: 0; }

.pt-cell { display: flex; align-items: center; gap: 11px; }
.pt-cell .avatar { border-radius: 50%; width: 34px; height: 34px; font-size: 12px; }
.pt-cell .nm { font-weight: 650; line-height: 1.2; }
.pt-cell .id { font-family: var(--font-data); font-size: 11px; color: var(--muted); }
td .mono { font-size: 12.5px; color: var(--ink-2); }

.row-actions { display: flex; gap: 6px; }
.mini-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--muted);
}
.mini-btn:hover { border-color: var(--pine-600); color: var(--pine-800); background: var(--pine-50); }
.mini-btn svg { width: 14px; height: 14px; }

/* --- Doctor duty list --- */
.doc-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.doc-row + .doc-row { border-top: 1px dashed var(--line); }
.doc-row .avatar { border-radius: 50%; }
.doc-info { min-width: 0; flex: 1; }
.doc-info .nm { font-weight: 650; font-size: 13.5px; }
.doc-info .sp { font-size: 12px; color: var(--muted); }
.doc-load { text-align: right; }
.doc-load .n { font-family: var(--font-data); font-size: 13px; font-weight: 600; }
.doc-load .l { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* --- Activity feed --- */
.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.feed li { position: relative; padding: 0 0 18px 30px; }
.feed li:last-child { padding-bottom: 2px; }
.feed .dot {
  position: absolute; left: 2px; top: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--rail, var(--t-neutral));
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1.5px var(--line-2);
}
.feed .tx { font-size: 13px; color: var(--ink-2); }
.feed .tx b { color: var(--ink); font-weight: 650; }
.feed .tm { font-family: var(--font-data); font-size: 11px; color: var(--muted); margin-top: 3px; }

/* --- Footer --- */
.app-foot { padding: 22px 26px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* --- Toast --- */
.toast {
  position: fixed;
  right: 22px; bottom: 22px;
  background: var(--pine-900);
  color: #eef6f3;
  padding: 13px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  opacity: 0;
  translate: 0 14px;
  pointer-events: none;
  transition: opacity .25s, translate .25s;
  z-index: 90;
}
.toast.show { opacity: 1; translate: 0 0; }
.toast svg { width: 17px; height: 17px; color: var(--gold-2); }

/* --- Reveal on load --- */
.reveal { opacity: 0; translate: 0 12px; animation: rise .55s cubic-bezier(.22,1,.36,1) forwards; }
@keyframes rise { to { opacity: 1; translate: 0 0; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-tri { grid-template-columns: 1fr 1fr; }
  .grid-tri .panel:first-child { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  .grid-main, .grid-bottom { grid-template-columns: 1fr; }
  .login-body { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

@media (max-width: 880px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    translate: -100% 0;
    transition: translate .28s cubic-bezier(.22,1,.36,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { translate: 0 0; }
  .menu-btn { display: grid; }
  .scrim {
    position: fixed; inset: 0;
    background: rgba(8,37,32,.4);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .search-shell { display: none; }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .grid-tri { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .user-chip .u-meta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  .reveal { opacity: 1; translate: 0 0; }
  .ecg path { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
}


/* ---- Brand logo (added v1.1) ------------------------------------------- */
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-mark { overflow: hidden; }


/* ---- Inline entry rows (added v1.5) ------------------------------------
   Used by consultation components, POS lines and similar. On a phone these
   stack, so the submit button is always reachable — a fixed multi-column
   grid pushed it off-screen. */
.entry-row {
  display: grid;
  gap: 10px;
  align-items: end;
  grid-template-columns: 130px minmax(0,1fr) 110px 74px auto;
}
.entry-row .btn-solid,
.entry-row .btn-ghost { height: 44px; }

@media (max-width: 760px) {
  .entry-row {
    grid-template-columns: 1fr 1fr;
  }
  .entry-row > *:nth-child(1),
  .entry-row > *:nth-child(2) { grid-column: 1 / -1; }
  .entry-row > button,
  .entry-row > .btn-solid { grid-column: 1 / -1; width: 100%; justify-content: center; }
}
