:root {
  --bg: #080C10;
  --surface: #0F151D;
  --surface-2: #151E29;
  --surface-3: #1B2736;
  --border: #233142;
  --border-strong: #324760;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --text-soft: #CBD5E1;
  --teal: #14B8A6;
  --teal-bright: #2DD4BF;
  --teal-dim: rgba(20, 184, 166, 0.14);
  --green: #22C55E;
  --green-dim: rgba(34, 197, 94, 0.14);
  --amber: #F59E0B;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --red: #EF4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --blue: #38BDF8;
  --blue-dim: rgba(56, 189, 248, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, "Noto Sans Malayalam", "Noto Sans Devanagari", "Noto Sans Tamil", "Noto Sans Kannada", "Noto Sans Telugu", "Noto Sans Bengali", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, select, input {
  font-family: inherit;
  font-size: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(8, 12, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-bright);
  background: var(--teal-dim);
  border: 1px solid rgba(20, 184, 166, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 8px var(--teal-bright);
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-nav {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-btn:hover {
  color: var(--text);
}

.mode-btn.active {
  background: var(--teal);
  color: #041311;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-outline, .btn-ghost, .btn-danger, .btn-amber {
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: #031512;
}

.btn-primary:hover {
  background: var(--teal-bright);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: #233346;
}

.btn-outline {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  border-color: var(--teal);
  color: var(--text);
}

.btn-ghost {
  background: var(--amber-dim);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-ghost:hover {
  background: rgba(245, 158, 11, 0.25);
}

.btn-danger {
  background: var(--red-dim);
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

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

.btn-amber:hover {
  background: rgba(245, 158, 11, 0.26);
}

.full-width {
  width: 100%;
}

/* Hero Strip */
.hero-strip {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0D151E 0%, #080C10 100%);
}

.hero-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero-text {
  max-width: 680px;
}

.hero-text h1 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-text p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.hero-metrics {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-shrink: 0;
}

.metric-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 104px;
}

.metric-chip .m-val {
  display: block;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.metric-chip .m-val.teal { color: var(--teal-bright); }
.metric-chip .m-val.green { color: var(--green); }
.metric-chip .m-val.amber { color: var(--amber); }

.metric-chip .m-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Toast Region */
.toast-region {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

.toast-banner {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
}

.toast-banner.ok {
  background: var(--green-dim);
  border-color: rgba(34, 197, 94, 0.4);
  color: #BBF7D0;
}

.toast-banner.block {
  background: var(--red-dim);
  border-color: rgba(239, 68, 68, 0.45);
  color: #FECACA;
}

.toast-banner.warn {
  background: var(--amber-dim);
  border-color: rgba(245, 158, 11, 0.45);
  color: #FEF08A;
}

.toast-close {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* Main Workspace */
.workspace {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 28px;
  flex: 1;
}

/* Station Stepper */
.station-bar-wrap {
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.station-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 8px;
}

.station-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  color: var(--text-soft);
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.station-tab:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.station-tab.active {
  background: var(--surface-2);
  border-color: var(--teal);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.35);
}

.st-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.st-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal-bright);
  font-family: var(--mono);
}

.st-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-soft);
}

.station-tab.active .st-count {
  background: var(--teal);
  color: #041311;
}

.st-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.st-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* 2-Column Clinic Grid */
.clinic-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 16px;
  align-items: start;
}

.queue-column, .stage-card, .trail-card, .owner-table-card, .hardware-card, .tv-remote-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-header.compact {
  padding: 12px 16px;
}

.panel-header h2, .panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.panel-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.count-badge, .custody-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--teal-bright);
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}

.queue-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 540px;
  overflow-y: auto;
}

.queue-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.cand-card {
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s ease;
}

.cand-card:hover {
  border-color: var(--border-strong);
}

.cand-card.selected {
  border-color: var(--teal);
  background: rgba(20, 184, 166, 0.08);
}

.cand-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.cand-token {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-bright);
}

.cand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.cand-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-tag.ready { background: var(--teal-dim); color: var(--teal-bright); }
.status-tag.fit { background: var(--green-dim); color: #86EFAC; }
.status-tag.hold { background: var(--amber-dim); color: #FDE68A; }
.status-tag.unfit { background: var(--red-dim); color: #FCA5A5; }
.status-tag.wait { background: var(--blue-dim); color: #7DD3FC; }

/* Stage Column */
.stage-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stage-body {
  padding: 16px;
}

.cand-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cand-banner h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.cand-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.cand-facts strong {
  color: var(--text-soft);
}

.journey-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.j-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.j-pill.done {
  background: var(--green-dim);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86EFAC;
}

.j-pill.blocked {
  background: var(--amber-dim);
  border-color: rgba(245, 158, 11, 0.4);
  color: #FDE68A;
}

.j-pill.current {
  border-color: var(--teal);
  color: var(--teal-bright);
}

/* Controls & Forms inside Station */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input, .field select {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--teal);
}

.check-box-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  cursor: pointer;
}

.check-box-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* Lab Panel Table */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.lab-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lab-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.lab-row span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.lab-row select {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
}

/* Barcode / X-ray Preview Cards */
.device-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.barcode-box {
  background: #F8FAFC;
  color: #090C10;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--mono);
  min-width: 220px;
}

.barcode-bars {
  height: 28px;
  background: repeating-linear-gradient(
    90deg,
    #090C10 0px, #090C10 2px,
    transparent 2px, transparent 4px,
    #090C10 4px, #090C10 5px,
    transparent 5px, transparent 8px,
    #090C10 8px, #090C10 11px,
    transparent 11px, transparent 13px
  );
  margin-bottom: 6px;
}

.barcode-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.xray-plate {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 42%, #294156 0%, #0E1722 60%, #05080C 100%);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #7DD3FC;
  font-family: var(--mono);
  font-size: 11px;
  flex-shrink: 0;
}

.gate-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.gate-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.gate-box.ok { border-color: rgba(34, 197, 94, 0.45); }
.gate-box.fail { border-color: rgba(245, 158, 11, 0.55); background: rgba(245, 158, 11, 0.07); }

.gate-box strong {
  display: block;
  font-size: 12px;
  color: var(--text);
}

.gate-box span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Audit Trail */
.audit-list {
  margin: 0;
  padding: 12px 16px 14px 32px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

.audit-list li strong {
  color: var(--teal-bright);
  font-family: var(--mono);
  font-size: 11px;
  margin-right: 6px;
}

.audit-list li.audit-block {
  color: #FCA5A5;
}

/* WAITING ROOM TV VIEW */
.tv-control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.tv-title-block h2 {
  margin: 0 0 2px;
  font-size: 17px;
}

.tv-title-block p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.tv-control-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.field-inline select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
}

.toggle-inline input {
  accent-color: var(--teal);
}

.tv-screen {
  background: linear-gradient(145deg, #070B10 0%, #0D1622 100%);
  border: 2px solid var(--border-strong);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}

.tv-screen-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tv-clinic-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tv-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.tv-clinic-brand strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.tv-pii-badge {
  font-size: 11px;
  color: var(--teal-bright);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.tv-clock-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tv-lang-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--teal-dim);
  color: var(--teal-bright);
  border: 1px solid rgba(20, 184, 166, 0.35);
}

.tv-clock {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.tv-now-calling {
  background: rgba(20, 184, 166, 0.08);
  border: 1px solid rgba(20, 184, 166, 0.45);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.now-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--teal-bright);
  margin-bottom: 8px;
}

.now-main {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.now-token {
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--teal);
  border-radius: 12px;
  padding: 12px 22px;
}

.now-arrow {
  font-size: 28px;
  color: var(--teal-bright);
}

.now-dept-en {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.now-dept-reg {
  font-size: 20px;
  font-weight: 600;
  color: var(--teal-bright);
  margin-top: 4px;
}

.now-speech-bar {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(20, 184, 166, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.speech-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--teal);
  color: #031512;
}

.speech-text {
  font-size: 14px;
  color: var(--text-soft);
}

.tv-dept-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tv-dept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.tv-dept-card.calling {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.35);
}

.tv-dept-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.tv-dept-head strong {
  font-size: 13px;
  letter-spacing: 0.04em;
}

.tv-dept-head span {
  font-size: 13px;
  color: var(--teal-bright);
  font-weight: 600;
}

.tv-dept-token {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.tv-dept-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.tv-remote-grid {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.remote-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.remote-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.remote-box-head strong {
  font-size: 13px;
}

.remote-box-head span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--teal-bright);
}

.remote-btns {
  display: flex;
  gap: 6px;
}

.remote-btns button {
  flex: 1;
  padding: 7px 8px;
  font-size: 12px;
}

/* MULTI-CENTRE OWNER VIEW */
.owner-top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.owner-top-strip h2 {
  margin: 0 0 4px;
  font-size: 19px;
}

.owner-top-strip p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  max-width: 760px;
}

.owner-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.owner-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.owner-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.owner-kpi .k-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.owner-kpi .k-val {
  font-size: 24px;
  font-weight: 800;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}

.owner-kpi .k-sub {
  font-size: 12px;
  color: var(--teal-bright);
}

.owner-table-card {
  margin-bottom: 16px;
}

.table-scroll {
  overflow-x: auto;
}

.branch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.branch-table th, .branch-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.branch-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-2);
}

.branch-table tr:last-child td {
  border-bottom: 0;
}

.hw-grid {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.hw-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.hw-item strong {
  display: block;
  font-size: 13px;
  color: var(--teal-bright);
  margin-bottom: 4px;
}

.hw-item p {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 6, 10, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
}

.modal-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.modal-head p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.icon-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}

.drill-list {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drill-item {
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s ease;
}

.drill-item:hover {
  border-color: var(--amber);
}

.drill-item strong {
  display: block;
  font-size: 13px;
  color: #FDE68A;
  margin-bottom: 3px;
}

.drill-item span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive (Mobile 390x844 clean, zero clipping, zero awkward nav wrap) */
@media (max-width: 1080px) {
  .clinic-grid {
    grid-template-columns: 1fr;
  }
  .tv-dept-grid, .tv-remote-grid, .owner-kpi-grid, .hw-grid, .gate-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-metrics {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px;
    gap: 10px;
  }
  .mode-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }
  .mode-btn {
    padding: 8px 6px;
    font-size: 12px;
    text-align: center;
  }
  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .hero-inner {
    padding: 14px;
  }
  .hero-text h1 {
    font-size: 18px;
  }
  .metric-chip {
    flex: 1 1 42%;
    min-width: 0;
    padding: 8px 10px;
  }
  .workspace {
    padding: 12px 14px 24px;
  }
  .station-bar {
    grid-template-columns: repeat(6, minmax(132px, 1fr));
  }
  .form-grid, .lab-grid, .tv-dept-grid, .tv-remote-grid, .owner-kpi-grid, .hw-grid, .gate-summary {
    grid-template-columns: 1fr;
  }
  .now-token {
    font-size: 34px;
    padding: 10px 16px;
  }
  .now-dept-en {
    font-size: 18px;
  }
  .now-dept-reg {
    font-size: 16px;
  }
  .brand-sub {
    white-space: normal;
  }
}
