/* Rhudesi Hospital Design System  by CollabNotes: dark editorial, Inter UI, tight & clean. */

/* Variables */
:root {
  --bg:            #111113;
  --bg-surface:    #18181b;
  --bg-elevated:   #212126;
  --bg-hover:      #27272d;
  --bg-active:     #2e2e36;

  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.13);

  --text:          #eeede6;
  --text-2:        #a3a29c;
  --text-muted:    #585753;

  --accent:        #3b82f6;
  --accent-dim:    rgba(59,130,246,0.14);
  --accent-hover:  #60a5fa;

  --teal:          #10b981;
  --teal-dim:      rgba(16,185,129,0.14);
  --teal-border:   rgba(16,185,129,0.3);

  --green:         #6fcf97;
  --green-dim:     rgba(111,207,151,0.12);

  --red:           #e05c5c;
  --red-dim:       rgba(224,92,92,0.12);
  --red-border:    rgba(224,92,92,0.3);

  --amber:         #f59e0b;
  --amber-dim:     rgba(245,158,11,0.12);
  --amber-border:  rgba(245,158,11,0.3);

  --purple:        #a78bfa;
  --purple-dim:    rgba(167,139,250,0.12);
  --purple-border: rgba(167,139,250,0.3);

  --blue:          #56b4e9;
  --blue-dim:      rgba(86,180,233,0.12);

  --radius-sm:     5px;
  --radius:        9px;
  --radius-lg:     13px;

  --shadow:        0 2px 12px rgba(0,0,0,0.45);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.55);

  --nav-h:         54px;
  --sb-w:          220px;

  --font-ui:       'Inter', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  --ease:          cubic-bezier(0.4,0,0.2,1);
  --dur:           140ms;
}

/* ── Backward-compat aliases (so dashboard templates keep working) ── */
:root {
  --surface:        var(--bg-surface);
  --surface2:       var(--bg-elevated);
  --surface3:       var(--bg-active);
  --border2:        var(--border-strong);
  --text2:          var(--text-2);
  --text3:          var(--text-muted);

  --accent-light:   var(--accent-dim);
  --accent-border:  rgba(59,130,246,.3);

  --teal-light:     var(--teal-dim);
  --blue-light:     var(--blue-dim);
  --blue-border:    rgba(86,180,233,.3);
  --amber-light:    var(--amber-dim);
  --red-light:      var(--red-dim);
  --purple-light:   var(--purple-dim);
  --green-light:    var(--green-dim);

  --r:              var(--radius-sm);
  --r-md:           var(--radius);
  --r-lg:           var(--radius-lg);
  --r-xl:           var(--radius-lg);
  --r-full:         99px;
  --shadow-md:      var(--shadow-lg);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── Layout shell ── */
.layout { display: flex; min-height: 100dvh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sb-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  display: flex; flex-direction: column;
  transition: transform .25s var(--ease);
  overflow: hidden;
}
.sb-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px;
}
.sb-logo-mark {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; color: #111113;
  flex-shrink: 0;
}
.sb-logo-name { font-size: .9rem; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.sb-logo-sub  { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }

.sb-nav { flex: 1; padding: 8px 8px; overflow-y: auto; scrollbar-width: none; }
.sb-nav::-webkit-scrollbar { display: none; }

.sb-section {
  font-size: .68rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 12px 8px 4px;
}
.sb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  font-size: .855rem; font-weight: 500; color: var(--text-2);
  margin-bottom: 1px; cursor: pointer;
  transition: background var(--dur), color var(--dur);
  text-decoration: none;
}
.sb-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sb-item.active { background: var(--accent-dim); color: var(--accent); }
.sb-icon { width: 18px; font-size: .9rem; flex-shrink: 0; opacity: .85; text-align: center; }
.sb-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--accent-dim); color: var(--accent);
  font-size: .65rem; font-weight: 700; display: flex; align-items: center;
  justify-content: center; font-family: var(--font-mono);
}
.sb-badge.muted { background: var(--bg-active); color: var(--text-muted); }

.sb-foot {
  padding: 10px 10px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--dur);
}
.user-chip:hover { background: var(--bg-hover); }
.user-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #111113;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; flex-shrink: 0;
}
.user-name  { font-size: .825rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.user-role  { font-size: .68rem; color: var(--text-muted); margin-top: 1px; }
.user-signout { margin-left: auto; font-size: .72rem; color: var(--text-muted); opacity: .5; transition: opacity var(--dur); }
.user-chip:hover .user-signout { opacity: 1; color: var(--red); }

/* ── Main ── */
.main { margin-left: var(--sb-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Topbar ── */
.topbar {
  height: var(--nav-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 10px;
  position: sticky; top: 0; z-index: 100;
}
.menu-btn {
  display: none; width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); font-size: .9rem;
  align-items: center; justify-content: center;
  cursor: pointer; transition: background var(--dur), color var(--dur);
  flex-shrink: 0;
}
.menu-btn:hover { background: var(--bg-hover); color: var(--text); }
.topbar-title { font-size: 1.05rem; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.theme-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); font-size: .82rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur), color var(--dur);
}
.theme-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ── Page content ── */
.content { padding: 1.75rem 1.5rem; flex: 1; max-width: 1400px; }

/* ── Grid ── */
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(2,1fr); }
.cols-3 { grid-template-columns: repeat(3,1fr); }
.cols-4 { grid-template-columns: repeat(4,1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.flex-col { display: flex; flex-direction: column; gap: 0.875rem; }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card:hover { border-color: var(--border-strong); }
.card-header {
  padding: .875rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.card-title {
  font-size: .9rem; font-weight: 700; color: var(--text); letter-spacing: -.2px;
  display: flex; align-items: center; gap: 6px;
}
.card-title-icon {
  width: 22px; height: 22px; border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
}
.card-body { padding: 1.1rem; }
.card-footer { padding: .75rem 1.1rem; border-top: 1px solid var(--border); }

.card-accent { border-color: rgba(59,130,246,.3); }
.card-teal   { border-color: var(--teal-border); }
.card-red    { border-color: var(--red-border); }
.card-amber  { border-color: var(--amber-border); }

/* ── Stat cards ── */
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.1rem;
  transition: border-color var(--dur), transform .15s var(--ease);
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; margin-bottom: .875rem;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.9rem; font-weight: 800; line-height: 1;
  letter-spacing: -1px; margin-bottom: 3px;
}
.stat-label { font-size: .775rem; color: var(--text-muted); font-weight: 500; }

.stat-accent .stat-icon { background: var(--accent-dim); color: var(--accent); }
.stat-accent .stat-value { color: var(--accent); }
.stat-teal   .stat-icon { background: var(--teal-dim);   color: var(--teal); }
.stat-teal   .stat-value { color: var(--teal); }
.stat-red    .stat-icon { background: var(--red-dim);    color: var(--red); }
.stat-red    .stat-value { color: var(--red); }
.stat-amber  .stat-icon { background: var(--amber-dim);  color: var(--amber); }
.stat-amber  .stat-value { color: var(--amber); }
.stat-purple .stat-icon { background: var(--purple-dim); color: var(--purple); }
.stat-purple .stat-value { color: var(--purple); }
.stat-green  .stat-icon { background: var(--green-dim);  color: var(--green); }
.stat-green  .stat-value { color: var(--green); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 99px;
  font-size: .68rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; white-space: nowrap; border: 1px solid transparent;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.b-accent  { background: var(--accent-dim);  color: var(--accent);  border-color: rgba(59,130,246,.3); }
.b-teal    { background: var(--teal-dim);    color: var(--teal);    border-color: var(--teal-border); }
.b-green   { background: var(--green-dim);   color: var(--green);   border-color: rgba(111,207,151,.3); }
.b-red     { background: var(--red-dim);     color: var(--red);     border-color: var(--red-border); }
.b-amber   { background: var(--amber-dim);   color: var(--amber);   border-color: var(--amber-border); }
.b-purple  { background: var(--purple-dim);  color: var(--purple);  border-color: var(--purple-border); }
.b-blue    { background: var(--blue-dim);    color: var(--blue);    border-color: rgba(86,180,233,.3); }
.b-gray    { background: var(--bg-active);   color: var(--text-muted); border-color: var(--border); }
.b-lg { padding: 3px 10px; font-size: .72rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .855rem; cursor: pointer;
  letter-spacing: -.1px;
  border: 1px solid transparent; transition: all var(--dur);
  white-space: nowrap; font-family: var(--font-ui);
}
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--accent); color: #111113; border-color: var(--accent); }
.btn-primary:hover { opacity: .88; }

.btn-teal { background: var(--teal); color: #111113; border-color: var(--teal); }
.btn-teal:hover { opacity: .88; }

.btn-ghost {
  background: transparent; color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

.btn-surface {
  background: var(--bg-elevated); color: var(--text);
  border-color: var(--border-strong);
}
.btn-surface:hover { background: var(--bg-hover); }

.btn-danger { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }
.btn-danger:hover { background: rgba(224,92,92,.18); }

.btn-amber  { background: var(--amber-dim); color: var(--amber); border-color: var(--amber-border); }
.btn-amber:hover { background: rgba(245,158,11,.18); }

.btn-blue   { background: var(--blue-dim); color: var(--blue); border-color: rgba(86,180,233,.3); }
.btn-blue:hover { background: rgba(86,180,233,.2); }

.btn-purple { background: var(--purple-dim); color: var(--purple); border-color: var(--purple-border); }
.btn-purple:hover { background: rgba(167,139,250,.2); }

.btn-sm  { padding: 0.35rem 0.75rem; font-size: .8rem; }
.btn-xs  { padding: 0.25rem 0.6rem;  font-size: .75rem; }
.btn-lg  { padding: 0.65rem 1.35rem; font-size: .9rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); width: 32px; height: 32px; }

/* ── Forms ── */
.fg { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0.875rem; }
.fg:last-child { margin-bottom: 0; }
.label {
  font-size: .775rem; font-weight: 500; color: var(--text-2);
  display: flex; align-items: center; gap: 4px;
}
.label-req { color: var(--red); }
.inp {
  font-family: var(--font-ui); font-size: .9rem;
  color: var(--text); background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .55rem .8rem;
  outline: none; width: 100%;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.inp::placeholder { color: var(--text-muted); }
select.inp {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23585753' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 32px;
}
textarea.inp { resize: vertical; min-height: 70px; line-height: 1.6; }
.inp-hint { font-size: .72rem; color: var(--text-muted); }

/* ── Tabs ── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px; font-size: .835rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur), border-color var(--dur);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count {
  background: var(--bg-active); color: var(--text-muted);
  font-size: .65rem; padding: 1px 6px; border-radius: 99px;
  font-family: var(--font-mono); font-weight: 600;
  transition: all var(--dur);
}
.tab.active .tab-count { background: var(--accent-dim); color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .855rem; }
thead { background: var(--bg-elevated); }
th {
  padding: 8px 14px; text-align: left;
  font-size: .7rem; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}
th:first-child { padding-left: 16px; }
th:last-child  { padding-right: 16px; text-align: right; }
td {
  padding: 10px 14px; border-top: 1px solid var(--border);
  color: var(--text-2); vertical-align: middle;
}
td:first-child { padding-left: 16px; color: var(--text); font-weight: 500; }
td:last-child  { padding-right: 16px; text-align: right; }
tr:hover td { background: var(--bg-hover); }

/* ── Modals ── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  z-index: 1000; display: none; align-items: center;
  justify-content: center; padding: 16px;
}
.overlay.open { display: flex; animation: overlayIn .16s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 500px;
  max-height: 92vh; overflow: visible;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-lg { max-width: 640px; }
.modal-xl { max-width: 860px; }
.modal-header {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title    { font-weight: 800; font-size: .95rem; color: var(--text); letter-spacing: -.3px; }
.modal-subtitle { font-size: .775rem; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .8rem;
  transition: background var(--dur), color var(--dur);
}
.modal-close:hover { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }
.modal-body { padding: 1.1rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: .875rem 1.1rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 7px;
  flex-shrink: 0; background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Visit cards ── */
.visit-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 8px;
  transition: border-color var(--dur);
}
.visit-card:hover { border-color: var(--border-strong); }
.vc-header {
  padding: 11px 14px; display: flex; align-items: center;
  gap: 10px; cursor: pointer; user-select: none;
}
.vc-queue {
  width: 30px; height: 30px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600; color: var(--accent);
}
.vc-info { flex: 1; min-width: 0; }
.vc-name {
  font-weight: 700; font-size: .9rem; color: var(--text); letter-spacing: -.2px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.vc-meta {
  font-size: .755rem; color: var(--text-muted);
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; align-items: center;
}
.vc-meta-dot { width: 2px; height: 2px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.vc-body { padding: 0 14px 12px; border-top: 1px solid var(--border); display: none; }
.vc-body.open { display: block; }
.vc-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0 2px; }

/* ── Vitals grid ── */
.vitals-grid {
  display: grid; grid-template-columns: repeat(auto-fill,minmax(80px,1fr));
  gap: 6px; margin-top: 8px;
}
.vital-item {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.vital-label { font-size: .62rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.vital-value { font-family: var(--font-mono); font-size: .9rem; font-weight: 600; color: var(--text); margin-top: 3px; }
.vital-unit  { font-size: .6rem; color: var(--text-muted); }

/* ── Drug rows ── */
.drug-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 5px;
  transition: border-color var(--dur);
}
.drug-row:hover { border-color: var(--border-strong); }
.drug-name  { flex: 1; font-weight: 500; font-size: .855rem; color: var(--text); }
.drug-meta  { font-size: .72rem; color: var(--text-muted); display: block; margin-top: 1px; }
.drug-remove {
  width: 24px; height: 24px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .78rem;
  transition: background var(--dur), color var(--dur);
}
.drug-remove:hover { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }

/* ── Search dropdown ── */
.search-wrap { position: relative; }
.search-drop {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 2000; max-height: 240px; overflow-y: auto; display: none;
}
.search-drop.open { display: block; animation: dropIn .12s var(--ease); }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sd-item {
  padding: 9px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background var(--dur);
}
.sd-item:last-child { border-bottom: none; }
.sd-item:hover { background: var(--bg-hover); }
.sd-name { font-weight: 500; color: var(--text); font-size: .855rem; }
.sd-sub  { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

/* ── Alerts ── */
.alert {
  padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: .835rem; border-left: 3px solid;
  display: flex; align-items: flex-start; gap: 9px;
}
.alert-icon { flex-shrink: 0; margin-top: 1px; }
.a-info   { background: var(--blue-dim);   border-color: var(--blue);   color: var(--blue); }
.a-ok     { background: var(--teal-dim);   border-color: var(--teal);   color: var(--teal); }
.a-warn   { background: var(--amber-dim);  border-color: var(--amber);  color: var(--amber); }
.a-err    { background: var(--red-dim);    border-color: var(--red);    color: var(--red); }
.a-accent { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── Section label ── */
.section-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  margin: 13px 0 8px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Toggle ── */
.toggle { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--bg-active); border: 1px solid var(--border-strong);
  cursor: pointer; transition: .2s;
}
.toggle input:checked + .toggle-track { background: var(--teal); border-color: var(--teal); }
.toggle-dot {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; top: 2px; left: 2px; transition: .2s; pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle input:checked ~ .toggle-dot { left: 18px; }

/* ── Bed grid ── */
.bed-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(60px,1fr)); gap: 6px; margin-top: 8px; }
.bed {
  height: 50px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; transition: all var(--dur);
  font-size: .65rem; font-weight: 600; color: var(--text-muted);
  background: var(--bg-elevated);
}
.bed:hover:not(.bed-taken) { border-color: var(--teal); color: var(--teal); background: var(--teal-dim); }
.bed-taken    { opacity: .45; cursor: not-allowed; }
.bed-selected { border-color: var(--teal); color: var(--teal); background: var(--teal-dim); }

/* ── Steps ── */
.steps { display: flex; align-items: center; margin: 12px 0; }
.step  { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.step:not(:last-child)::after {
  content: ''; position: absolute; top: 12px; left: 50%; right: -50%;
  height: 1px; background: var(--border); z-index: 0;
}
.step.done:not(:last-child)::after,
.step.active:not(:last-child)::after { background: var(--teal); }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 700; color: var(--text-muted);
  z-index: 1; position: relative; transition: .2s;
}
.step.done .step-dot   { background: var(--teal); border-color: var(--teal); color: #111; }
.step.active .step-dot { background: transparent; border-color: var(--teal); color: var(--teal); box-shadow: 0 0 0 4px var(--teal-dim); }
.step-label { font-size: .6rem; font-weight: 600; color: var(--text-muted); margin-top: 5px; text-align: center; }
.step.done .step-label,
.step.active .step-label { color: var(--teal); }

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 10px; padding: 5px 0; position: relative; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute; left: 4px; top: 16px; bottom: -5px;
  width: 1px; background: var(--border);
}
.tl-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 4px;
  border: 2px solid var(--bg-surface); box-shadow: 0 0 0 2px var(--accent-dim);
}
.tl-body { flex: 1; }
.tl-text { font-size: .835rem; color: var(--text); }
.tl-time { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }

/* ── Toasts ── */
#toast-container {
  position: fixed; bottom: 16px; right: 16px;
  z-index: 9999; display: flex; flex-direction: column-reverse; gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  color: var(--text); padding: 10px 13px; border-radius: var(--radius);
  font-size: .835rem; font-weight: 500;
  opacity: 0; transform: translateX(8px);
  transition: all .2s var(--ease);
  max-width: 280px; pointer-events: auto;
  display: flex; align-items: center; gap: 9px;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: none; }
.toast-icon { width: 20px; height: 20px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: .72rem; flex-shrink: 0; font-weight: 700; }
.toast-ok   .toast-icon { background: var(--teal-dim);   color: var(--teal); }
.toast-err  .toast-icon { background: var(--red-dim);    color: var(--red); }
.toast-warn .toast-icon { background: var(--amber-dim);  color: var(--amber); }
.toast-ok   { border-color: var(--teal-border); }
.toast-err  { border-color: var(--red-border); }
.toast-warn { border-color: var(--amber-border); }

/* ── Empty states ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 3.5rem 1.5rem; gap: .75rem;
}
.empty-icon  { font-size: 2rem; opacity: .35; }
.empty-title { font-size: .95rem; font-weight: 800; color: var(--text); letter-spacing: -.2px; }
.empty-sub   { font-size: .835rem; color: var(--text-muted); max-width: 260px; }

/* ── Mobile sidebar overlay ── */
.sb-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 199;
}
.sb-overlay.open { display: block; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ── Utilities ── */
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 5px; }
.gap-2 { gap: 9px; }
.gap-3 { gap: 14px; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 16px; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-5 { font-weight: 500; }
.fw-6 { font-weight: 600; }
.fw-7 { font-weight: 700; }
.fw-8 { font-weight: 800; }
.text-sm  { font-size: .855rem; }
.text-xs  { font-size: .775rem; }
.text-2xs { font-size: .7rem; }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-2); }
.text-accent { color: var(--accent); }
.text-teal   { color: var(--teal); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-green  { color: var(--green); }

/* ── Gradient text (landing-page style accent) ── */
.text-grad{
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-hover) 50%, var(--teal) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ── Page hero title (optional, for dashboard page headers) ── */
.page-title{
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  font-weight: 800; letter-spacing: -.6px; line-height: 1.2;
  color: var(--text); margin-bottom: 2px;
}
.page-subtitle{
  font-size: .82rem; color: var(--text-muted); font-weight: 500;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Responsive ── */
@media(max-width:1024px){
  :root { --sb-w: 200px; }
  .cols-4 { grid-template-columns: repeat(2,1fr); }
  .cols-3 { grid-template-columns: repeat(2,1fr); }
}
@media(max-width:768px){
  .menu-btn { display: flex; }
  .sidebar  { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main     { margin-left: 0; }
  .topbar   { padding: 0 14px; }
  .content  { padding: 1rem; }
  .cols-2,.cols-3,.cols-4 { grid-template-columns: 1fr; }
  .col-span-2,.col-span-3,.col-span-4 { grid-column: span 1; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 94vh; max-width: 100% !important; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }
  .overlay { padding: 0; align-items: flex-end; }
}
@media(max-width:480px){
  .topbar-title { font-size: .95rem; }
  .stat-value   { font-size: 1.4rem; }
  .tab { padding: 7px 12px; font-size: .795rem; }
}

@media print {
  .sidebar,.topbar,.menu-btn,.sb-overlay,#toast-container { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { border: 1px solid #333; box-shadow: none; }
}
