/* ============================================================
   CitraX Mini Design System - Clinical Worklist (PACS-style)
   Charcoal dark mode / soft light mode. Enterprise data grid.
   ============================================================ */

/* ---------- Fonts (self-hosted, LAN-safe) ---------- */
@font-face {
  font-family: "Google Sans Flex";
  src: url("../fonts/GoogleSansFlex-latin.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Google Sans Code";
  src: url("../fonts/GoogleSansCode-Italic[MONO,wght].ttf") format("truetype");
  font-weight: 100 700;
  font-style: italic;
}

:root {
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --radius-pill: 50px;

  --font: "Google Sans Flex", "Google Sans Code", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Google Sans Code", "Consolas", "SF Mono", "Cascadia Code", monospace;
}

/* ---------- Dark (KKBBS Clinical Forest Green Dark - Neumorphic) ---------- */
html[data-theme="dark"] {
  --bg: #131a15;
  --surface: #17211a;
  --surface-2: #1b261f;
  --surface-3: #223027;
  --border: #233228;
  --border-strong: #2e4235;
  --text: #FAF8F2;
  --text-2: #E6E2D6;
  --muted: #AEC3B0;
  /* KKBBS Clinic Green Palette */
  --accent: #6F8A6D;
  --accent-strong: #8ab692;
  --on-accent: #0F2A1D;
  --accent-soft: rgba(111, 138, 109, 0.2);
  --danger: #d96b5e;
  --danger-soft: #381c19;
  --success: #489462;
  --success-soft: #12281a;
  --warn: #d6b25c;
  --warn-soft: #332a13;
  --info: #6B9071;
  
  /* Neumorphic Soft Extrusions & Recesses */
  --neu-flat: 4px 4px 10px #0c120e, -4px -4px 10px #1e2c22;
  --neu-flat-sm: 2px 2px 6px #0c120e, -2px -2px 6px #1e2c22;
  --neu-convex: 4px 4px 10px #0c120e, -4px -4px 10px #1e2c22;
  --neu-pressed: inset 2px 2px 5px #0c120e, inset -2px -2px 5px #1e2c22;
  --neu-inset: inset 3px 3px 6px #0a0e0b, inset -3px -3px 6px #202e24;
  --shadow: var(--neu-flat);

  --topbar-bg: #141d17;
  --topbar-text: #FAF8F2;
  --sidebar-bg: #0F2A1D;
  --sidebar-text: #FAF8F2;
  --focus: rgba(111, 138, 109, 0.45);
  --row-hover: #1c2820;
  --row-alt: #131c15;
}

/* ---------- Light (Pure Soft White Content with Crisp Neumorphism & Deep Green Sidebar) ---------- */
html[data-theme="light"] {
  /* Soft ivory/sage off-white base for content */
  --bg: #EEF2EE;
  --surface: #EEF2EE;
  --surface-2: #E3E9E4;
  --surface-3: #D8E0DA;
  --border: rgba(255, 255, 255, 0.75);
  --border-strong: rgba(200, 212, 204, 0.65);
  --text: #0F2A1D;
  --text-2: #1E442B;
  --muted: #5C7667;
  /* KKBBS Clinic Green Accent Palette */
  --accent: #275534;
  --accent-strong: #0F2A1D;
  --on-accent: #FFFFFF;
  --accent-soft: rgba(39, 85, 52, 0.12);
  --danger: #b3392b;
  --danger-soft: #fbeae8;
  --success: #275534;
  --success-soft: #e3eed4;
  --warn: #946c15;
  --warn-soft: #fdf5de;
  --info: #275534;

  /* True Soft-White Neumorphic Dual Shadows (Pure White Highlight + Soft Cool Shadow) */
  --neu-flat: 8px 8px 18px #cad5cd, -8px -8px 18px #ffffff;
  --neu-flat-sm: 4px 4px 10px #cad5cd, -4px -4px 10px #ffffff;
  --neu-convex: 6px 6px 14px #cad5cd, -6px -6px 14px #ffffff;
  --neu-pressed: inset 3px 3px 6px #cad5cd, inset -3px -3px 6px #ffffff;
  --neu-inset: inset 3px 3px 7px #cad5cd, inset -3px -3px 7px #ffffff;
  --shadow: var(--neu-flat);

  --topbar-bg: #EEF2EE;
  --topbar-text: #0F2A1D;
  /* Kekalkan Hijau Pekat KKBBS pada panel sisi kiri */
  --sidebar-bg: #0F2A1D;
  --sidebar-text: #FAF8F2;
  --focus: rgba(39, 85, 52, 0.35);
  --row-hover: rgba(39, 85, 52, 0.05);
  --row-alt: #F4F7F4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

code, .mono { font-family: var(--mono); font-size: 0.92em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ============================================================
   KKBBS MODERN CLINICAL DASHBOARD LAYOUT (Image 3 inspired)
   Side panel + Top search bar + Thin compact study list table
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

/* ---------- Side Menu Panel ---------- */
.app-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  padding: 18px 14px 12px;
  gap: 18px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

.sidebar-logo {
  height: 36px;
  width: auto;
  border-radius: 4px;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.sidebar-app-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #FAF8F2;
}

.sidebar-sub {
  font-size: 11px;
  font-weight: 600;
  color: #C2D6C4;
  letter-spacing: 0.03em;
  margin-top: 1px;
}

.sidebar-facility {
  font-size: 9.5px;
  font-weight: 400;
  color: #8FA692;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.sidebar-app-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #FAF8F2;
}

.sidebar-sub {
  font-size: 10px;
  color: #AEC3B0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-m);
  color: #B8C3B2;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.14s ease;
}

.sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FAF8F2;
  text-decoration: none;
}

.sidebar-link.active {
  background: #275534;
  color: #FAF8F2;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(111, 138, 109, 0.35);
}

.sidebar-link.active svg {
  opacity: 1;
}

/* Jarakkan user icon & sign out button ke hujung bawah */
.sidebar-bottom {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-m);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  color: #FAF8F2;
  transition: background 0.14s;
}

.sidebar-user-card:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.sidebar-user-card .user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #275534;
  color: #FAF8F2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(174, 195, 176, 0.3);
}

.sidebar-user-card .user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-user-card .user-name {
  font-size: 12px;
  font-weight: 600;
  color: #FAF8F2;
}

.sidebar-user-card .user-role {
  font-size: 10px;
  color: #AEC3B0;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-m);
  background: rgba(217, 107, 94, 0.12);
  color: #f28b7e;
  font-weight: 600;
  font-size: 11.5px;
  border: 1px solid rgba(217, 107, 94, 0.25);
  text-decoration: none;
  transition: all 0.14s ease;
}

.sidebar-logout-btn:hover {
  background: rgba(217, 107, 94, 0.22);
  color: #ff9d92;
  border-color: rgba(217, 107, 94, 0.4);
  text-decoration: none;
}

/* ---------- Main Dashboard Content Area ---------- */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

/* Top bar with prominent search bar atas */
.app-topbar {
  min-height: 68px;
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--topbar-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 14px rgba(200, 212, 204, 0.35);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-search-wrap {
  flex: 1;
  max-width: 440px;
}

.topbar-search {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.topbar-search input {
  width: 100%;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  padding: 0 14px 0 32px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
  transition: all 0.14s ease;
}

.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus);
}

.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.topbar-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-select {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.14s ease;
}
.topbar-select:hover {
  border-color: var(--border-strong);
}
.topbar-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus);
}

/* Main Content Body */
.app-content-body {
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.content-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.content-badge {
  font-size: 11px;
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 10px;
}

/* Compact Table (Nipis dan compact macam Image 3) */
.compact-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: var(--neu-flat);
  transition: box-shadow 0.2s ease;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
}

.compact-table thead th {
  padding: 7px 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.compact-table tbody td {
  padding: 5px 10px;
  font-size: 12.5px;
  height: 33px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.compact-table tbody tr:last-child td {
  border-bottom: none;
}

.compact-table tbody tr:nth-child(even) {
  background: var(--row-alt);
}

.compact-table tbody tr:hover {
  background: var(--row-hover);
}

.compact-table .wl-name a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.compact-table .wl-name a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.compact-table .wl-id, .compact-table .wl-date {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
}

.compact-table .wl-badge {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--border);
}

.compact-table .wl-btn-sm {
  padding: 3px 8px;
  font-size: 11.5px;
}

/* ============================================================
   WORKLIST LAYOUT (PACS Harmony style)
   ============================================================ */
.wl-app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- Header ---------- */
.wl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 10px;
  column-gap: 16px;
  padding: 10px 20px;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  min-width: 0;
}
.wl-header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.wl-header-right, .wl-header-actions { 
  display: flex; 
  align-items: center; 
  gap: 6px; 
  flex-wrap: wrap; 
  justify-content: flex-end; 
  margin-left: auto;
}
.wl-header-right > .wl-btn-export {
  margin-right: 8px;
  padding-right: 12px;
}
.wl-header-right > .wl-btn-export::after {
  content: "";
  width: 1px;
  height: 18px;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  margin-left: 12px;
}
.export-group { display: flex; align-items: center; gap: 6px; }
/* Export (dalam export-group) kekal dengan divider supaya nampak berasingan */
.export-group .wl-btn-export { margin-right: 8px; padding-right: 12px; }
.export-group .wl-btn-export::after {
  content: "";
  width: 1px;
  height: 18px;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  margin-left: 12px;
}
.wl-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.wl-brand img { height: 46px; width: auto; border-radius: 3px; }
.wl-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.wl-app-name { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.wl-sub { font-size: 11px; color: color-mix(in srgb, var(--topbar-text) 65%, transparent); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }

.wl-header-title { text-align: left; }
.wl-header-title h1 { font-size: 17px; font-weight: 700; letter-spacing: 0.01em; margin: 0; white-space: nowrap; }
.wl-count { font-size: 12px; color: color-mix(in srgb, var(--topbar-text) 70%, transparent); }

/* ---------- Buttons ---------- */
.wl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 15px;
  border-radius: var(--radius-m);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--neu-flat-sm);
  transition: all 0.15s ease;
}
.wl-btn:hover {
  color: var(--accent-strong);
  border-color: var(--border-strong);
  box-shadow: var(--neu-flat);
  text-decoration: none;
}
.wl-btn:active {
  box-shadow: var(--neu-pressed);
  transform: translateY(1px);
}

.wl-btn-ghost {
  background: transparent;
  color: var(--topbar-text);
  border: none;
}
.wl-btn-ghost:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface-3)); }

.wl-btn-sm { padding: 4px 10px; font-size: 12.5px; }
.wl-btn-user { display: inline-flex; align-items: center; gap: 7px; }
.user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 35%, var(--surface-3));
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-name { font-size: 12.5px; font-weight: 600; }
.wl-btn-primary { 
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent));
  color: var(--on-accent);
  border: 1px solid var(--accent);
  box-shadow: var(--neu-flat-sm);
}
.wl-btn-primary:hover { 
  background: var(--accent-strong);
  color: var(--on-accent);
  box-shadow: var(--neu-flat);
}
.wl-btn-primary:active {
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.35);
}

/* Action button — subtle, professional (row action) */
.wl-btn-action {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--neu-flat-sm);
  transition: all 0.15s ease;
}
.wl-btn-action svg { opacity: 0.8; }
.wl-btn-action:hover {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--border-strong);
  box-shadow: var(--neu-flat);
}
.wl-btn-action:active {
  box-shadow: var(--neu-pressed);
}
.wl-btn-action:hover svg { opacity: 1; }

/* Nav button — header action, subtle professional (works on dark topbar) */
.wl-btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: color-mix(in srgb, var(--surface-2) 40%, transparent);
  color: var(--topbar-text);
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  border-radius: var(--radius-s);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.9;
  transition: opacity 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.wl-btn-nav svg { opacity: 0.8; }
.wl-btn-nav:hover {
  background: color-mix(in srgb, var(--accent) 24%, var(--surface-3));
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--topbar-text);
  opacity: 1;
  text-decoration: none;
}
.wl-btn-nav:hover svg { opacity: 1; }

/* Nav button — primary emphasis (e.g. Export Image) */
.wl-btn-nav-primary {
  background: color-mix(in srgb, var(--accent) 30%, var(--surface-2));
  color: var(--text);
  opacity: 1;
}
.wl-btn-nav-primary:hover {
  background: color-mix(in srgb, var(--accent) 45%, var(--surface-3));
  color: var(--text);
}
.wl-btn-nav-danger {
  background: transparent;
  color: color-mix(in srgb, var(--topbar-text) 85%, var(--danger));
}
.wl-btn-nav-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--neu-flat-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--border-strong);
  box-shadow: var(--neu-flat);
}
.theme-toggle:active {
  box-shadow: var(--neu-pressed);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- Toolbar ---------- */
.wl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 8px;
  flex-wrap: wrap;
}
.wl-search { flex: 1; max-width: 420px; }
.wl-search input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 8px 12px;
  font-size: 13.5px;
}
.wl-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus); outline: none; }

.wl-toolbar-right { display: flex; align-items: center; gap: 10px; }
.wl-clear { color: var(--muted); font-size: 12.5px; }
.wl-rows-label { font-size: 12.5px; color: var(--muted); }
.wl-rows {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 5px 8px;
  font-size: 13px;
}

/* ---------- Table (enterprise grid) ---------- */
.wl-table-wrap {
  margin: 0 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.wl-table { width: 100%; border-collapse: collapse; }
.wl-table thead th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.wl-table thead th.sortable { cursor: pointer; }
.wl-table thead th.sortable:hover { color: var(--text); }
.wl-table thead th.sorted-asc, .wl-table thead th.sorted-desc { color: var(--accent); }
.sort-ind { font-size: 9px; opacity: 0.4; }
th.sorted-asc .sort-ind, th.sorted-desc .sort-ind { opacity: 1; }

/* filter row */
.wl-filter-row th { background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 3px 6px; height: 30px; }
.wl-filter-row input {
  width: 100%;
  height: 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  box-sizing: border-box;
}
.wl-filter-row input:focus { border-color: var(--accent); outline: none; background: var(--surface-2); }

/* zebra rows */
.wl-table tbody tr:nth-child(even) { background: var(--row-alt); }
.wl-table tbody tr:hover { background: var(--row-hover); }
.wl-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}
.wl-table tbody tr:last-child td { border-bottom: none; }
.wl-name { font-weight: 600; }
.wl-id, .wl-date { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); }
.wl-desc { color: var(--text-2); }
.right { text-align: right; }

/* badge */
.wl-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ---------- Empty ---------- */
.wl-empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- Pagination ---------- */
.wl-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 12px 20px 20px;
  flex-wrap: wrap;
}
.wl-page-info { font-size: 12.5px; color: var(--muted); }
.wl-page-nav { display: flex; align-items: center; gap: 4px; }
.wl-page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  font-family: var(--font);
}
.wl-page-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.wl-page-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.wl-page-btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- Error ---------- */
.wl-error {
  margin: 14px 20px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  padding: 12px 14px;
  border-radius: var(--radius-m);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wl-error span { font-weight: 400; font-size: 13px; }

/* ---------- Login (minimalist premium, clear liquid glass) ---------- */
.login-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #0f1216;
  position: relative;
  overflow: hidden;
}
/* Background bangunan — neutral tones dengan warna biru dikurangkan (toned down) */
.login-bg {
  position: fixed;
  inset: 0;
  background-image: url("../login-bg.jpg");
  background-size: cover;
  /* Aerial KKBBS: anchor sekitar bangunan/signboard */
  background-position: 50% 40%;
  opacity: 0.58;
  filter: sepia(0.24) hue-rotate(15deg) saturate(1.05) contrast(1.06) brightness(0.88);
  z-index: 0;
  pointer-events: none;
}
html[data-theme="dark"] .login-bg {
  opacity: 0.52;
  filter: sepia(0.26) hue-rotate(15deg) saturate(1.05) contrast(1.08) brightness(0.85);
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}
/* Panel form (pusat) */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.login-card {
  width: 100%;
  /* Ultra-clear iOS Liquid Glass - Asas charcoal tembus pandang lembut 0.15 */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.10) 0%,
    rgba(255, 255, 255, 0.03) 22%,
    rgba(26, 30, 36, 0.15) 55%,
    rgba(18, 21, 26, 0.20) 100%
  );
  /* Shiny specular rim border khas kaca cecair Apple iOS */
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-top: 1.5px solid rgba(255, 255, 255, 0.65);
  border-left: 1.2px solid rgba(255, 255, 255, 0.42);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  /* Multi-layered shadows & liquid glass internal optical reflections */
  box-shadow:
    0 32px 75px -15px rgba(0, 0, 0, 0.8),
    0 12px 30px -6px rgba(0, 0, 0, 0.55),
    inset 0 1.5px 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 24px 0 rgba(255, 255, 255, 0.06),
    inset 0 -12px 24px rgba(0, 0, 0, 0.25);
  padding: 42px 38px;
  /* Ketajaman Pembiasan Optik - 10px tembus pandang */
  backdrop-filter: blur(10px) saturate(135%);
  -webkit-backdrop-filter: blur(10px) saturate(135%);
  position: relative;
  overflow: hidden;
}
/* Specular liquid gloss shimmer pada bahagian atas kad */
.login-card::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.03) 45%,
    transparent 100%
  );
  border-radius: 26px 26px 0 0;
  pointer-events: none;
  z-index: 0;
}
.login-card-header { position: relative; z-index: 1; margin-bottom: 26px; text-align: center; }
.login-card form { position: relative; z-index: 1; }
.login-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.login-logo-wrap img {
  width: auto;
  height: 96px;
  object-fit: contain;
}
/* Logo besar tanpa box teal — premium, clean */
.login-logo-wrap.small {
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
}
.login-logo-wrap.small img {
  width: auto;
  height: 96px;
  border-radius: 0;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.65));
}
.login-card h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  margin-bottom: 4px;
}
.login-card .tagline {
  font-size: 13px;
  color: #e2e8f0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  margin-bottom: 0;
  line-height: 1.45;
}
.login-card .field { margin-bottom: 16px; text-align: left; }
.login-card .field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  margin-bottom: 6px;
}
.login-card .field label svg { opacity: 0.95; color: #cbd5e1; }
.login-card .input-wrap input {
  width: 100%;
  background: rgba(18, 22, 28, 0.38);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--font);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.login-card .input-wrap input:focus {
  border-color: rgba(56, 178, 165, 0.85);
  box-shadow:
    0 0 0 3px rgba(56, 178, 165, 0.35),
    inset 0 2px 4px rgba(0, 0, 0, 0.3);
  outline: none;
  background: rgba(18, 22, 28, 0.6);
}
.login-card .input-wrap input::placeholder { color: #94a3b8; }

.login-submit {
  width: 100%;
  justify-content: center;
  margin-top: 14px;
  padding: 13px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(180deg, #38b2a5 0%, #298d83 100%);
  color: #041f1c;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-top: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 4px 14px rgba(40, 160, 148, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.login-submit:hover {
  background: linear-gradient(180deg, #4cc0b2 0%, #309e93 100%);
  color: #041f1c;
  box-shadow:
    0 6px 20px rgba(40, 160, 148, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.65);
  transform: translateY(-1px);
}
.login-submit:active {
  transform: translateY(0);
  box-shadow:
    0 2px 8px rgba(40, 160, 148, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.login-submit svg { transition: transform 0.15s ease; }
.login-submit:hover svg { transform: translateX(3px); }

.login-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.login-footer-text {
  font-size: 11.5px;
  color: #94a3b8;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

@media (max-width: 520px) {
  .login-card { padding: 32px 24px; }
}

/* ---------- Legacy classes (admin/view pages still use) ---------- */
.page { min-height: 100dvh; display: flex; flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: var(--font);
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus); outline: none; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1; padding: 20px 0 44px; }
.topbar {
  background: var(--topbar-bg);
  color: var(--topbar-text);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 34px; border-radius: 3px; }
.brand .title { font-size: 15px; font-weight: 600; }
.brand .title .app { color: var(--topbar-text); }
.brand .title .sub { color: color-mix(in srgb, var(--topbar-text) 72%, transparent); font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  padding: 7px 13px;
  border-radius: var(--radius-m);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-strong); color: var(--on-accent); text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--text-2); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 20px;
  box-shadow: var(--neu-flat);
  margin-bottom: 20px;
  transition: all 0.2s ease;
}
.card h2 { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.card-title-row h2 { margin-bottom: 0; }
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 4px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline { display: inline-flex; gap: 6px; align-items: center; }
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-hover); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  border: 1px solid transparent;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.search-box { display: flex; gap: 8px; align-items: center; flex: 1; max-width: 420px; }
.search-box input {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 8px 11px;
  font-size: 13.5px;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus); outline: none; }
.count { color: var(--muted); font-size: 12.5px; }
.flash { padding: 10px 14px; border-radius: var(--radius-m); margin-bottom: 14px; font-size: 13.5px; border: 1px solid transparent; }
.flash.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.flash.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash.warning { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty-state .glyph { font-size: 26px; margin-bottom: 8px; opacity: 0.4; }
.error-banner {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  padding: 12px 14px;
  border-radius: var(--radius-m);
  margin-bottom: 14px;
  font-weight: 500;
}
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-strong); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font);
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* ---------- Patient info bar (view page) ---------- */
.patient-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.pb-item { display: flex; flex-direction: column; gap: 1px; }
.pb-clinic { margin-left: auto; align-items: flex-end; }
.pb-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.pb-value { font-size: 13px; font-weight: 600; color: var(--text); }
.pb-value.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- Patient info strip (compact, workstation dark charcoal & subtle teal) ---------- */
.viewer-page .wl-header {
  background: #1c2024;
  border-bottom: 1px solid #282d33;
  padding: 6px 16px;
}
.viewer-page .wl-header h1 {
  font-size: 14px;
  font-weight: 600;
  color: #c9d2db;
  letter-spacing: 0.02em;
}
.patient-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 5px 16px;
  background: #15181b;
  border-bottom: 1px solid #24292f;
  white-space: nowrap;
  overflow-x: auto;
  flex-shrink: 0;
  font-size: 11.5px;
}
.ps-item { 
  display: flex; 
  flex-direction: column; 
  gap: 2px; 
  min-width: 0; 
}
.ps-patient { 
  flex-shrink: 1; 
  min-width: 0; 
}
.ps-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7d8b99;
}
.ps-value {
  font-size: 13px;
  font-weight: 600;
  color: #dbe2e8;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-value.mono { 
  font-family: var(--mono); 
  font-variant-numeric: tabular-nums; 
  font-weight: 500; 
  color: #c4d1dc;
}
.ps-patient .ps-value { 
  color: #38b2a5; 
  font-weight: 700; 
  letter-spacing: 0.02em;
}
.ps-clinic .ps-value { 
  color: #8e9ca8; 
  font-weight: 600; 
  font-size: 12px;
}
.ps-sep {
  width: 1px;
  height: 20px;
  background: #2b3036;
  flex-shrink: 0;
}
.ps-spacer { flex: 1; }
.ps-clinic { text-align: right; align-items: flex-end; }

/* Multi-part Exam Switcher Pills */
.ps-exams-strip { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ps-parts-pills { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ps-part-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  user-select: none;
}
.ps-part-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}
.ps-part-pill.active {
  background: #ffffff;
  color: #090d16;
  border-color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.ps-part-pill .pill-acc {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.8;
}

.viewer-page .main { padding: 0; display: flex; flex-direction: column; }
.wl-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.viewer-page { background: #000; height: 100vh; overflow: hidden; }
.viewer-page .wl-app { height: 100vh; display: flex; flex-direction: column; }
.viewer-page .wl-main { background: #000; }
.viewer-frame { flex: 1; width: 100%; border: none; background: #000; min-height: 0; }
.viewer-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
}
.viewer-placeholder .glyph { font-size: 36px; opacity: 0.4; }

@media (max-width: 768px) {
  .container { padding: 0 12px; }
  .topbar { padding: 0 12px; }
  .wl-header { padding: 10px 12px; }
  .wl-table-wrap { margin: 0 12px; }
  .wl-pagination { padding: 10px 12px 16px; }
  .wl-toolbar { padding: 12px 12px 6px; }
  .brand .title .sub { display: none; }
  .form-row { align-items: stretch; }
  .search-box { max-width: none; }
  .card { padding: 14px; }
  thead th, tbody td { padding: 7px 9px; }
}

/* ---------------- Reject / Urus imej (modal) ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 18px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--bg-card, #24282d);
  border: 1px solid var(--border-color, #3a4047);
  border-radius: 12px;
  width: 100%;
  max-width: 620px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 46px rgba(0,0,0,.5);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color, #3a4047);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim, #aab2bb);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--text, #fff); }
.reject-list { padding: 8px; }
.reject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #3a4047);
  margin-bottom: 8px;
  background: var(--bg-control, #2b3036);
}
.reject-row.is-rejected { border-color: #5a2a2a; opacity: .82; }
.rej-info { min-width: 0; }
.rej-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rej-sub { color: var(--text-dim, #aab2bb); font-size: 12px; margin-top: 2px; }
.rej-badge {
  background: #b03535;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  border-radius: 4px;
  padding: 2px 6px;
}
.rej-actions { flex-shrink: 0; }

.wl-patient-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}
.wl-patient-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ============================================================
   AI Assist Drawer & Controls (CitraX Dark / Teal Theme)
   ============================================================ */
.viewer-body-container {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  width: 100%;
}

/* Progressive Instant Preview Overlay */
.fast-preview-overlay {
  position: absolute;
  inset: 0;
  background: #0b0d0e;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s ease-out, visibility 0.45s ease-out;
  pointer-events: none;
}

.fast-preview-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.fast-preview-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.fast-preview-img {
  max-width: 96%;
  max-height: 92%;
  object-fit: contain;
  filter: contrast(105%) brightness(98%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  border-radius: 4px;
}

.fast-preview-spinner-large {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(56, 178, 165, 0.2);
  border-top-color: #38b2a5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.fast-preview-badge {
  position: absolute;
  bottom: 24px;
  background: rgba(18, 21, 23, 0.88);
  border: 1px solid rgba(56, 178, 165, 0.35);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.fast-preview-dot {
  width: 8px;
  height: 8px;
  background-color: #38b2a5;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 1.2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.wl-btn-ai {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-strong);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}
.wl-btn-ai:hover {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  border-color: var(--accent);
  color: #ffffff;
}

.ai-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -6px 0 28px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  z-index: 50;
  animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.ai-drawer[hidden] {
  display: none !important;
}

.ai-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.ai-drawer-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
  text-transform: uppercase;
}

.ai-drawer-close {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-s);
}
.ai-drawer-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.ai-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Subdued clinical disclaimer */
.ai-disclaimer {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  border-left: 2px solid var(--border-strong);
  padding: 6px 0 6px 12px;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
}

.ai-projections-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.ai-thumbnails-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.ai-thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  width: 76px;
}

.ai-thumb-box {
  width: 76px;
  height: 76px;
  background: #0d0f12;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.ai-thumb-box:hover {
  border-color: var(--accent);
}

.ai-thumb-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ai-thumb-desc {
  font-size: 10.5px;
  color: var(--text-2);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ai-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.ai-run-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.ai-force-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  font-size: 12.5px;
  cursor: pointer;
}

.ai-loading-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.ai-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: aiSpin 0.75s linear infinite;
}

@keyframes aiSpin {
  to { transform: rotate(360deg); }
}

.ai-loading-msg {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.ai-privacy-note {
  font-size: 11px;
  color: var(--muted);
}

.ai-result-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.ai-meta-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.ai-timestamp {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.ai-output-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
}

.ai-bullet-list {
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-bullet-list li {
  color: var(--text);
}

.ai-bullet-list li strong {
  color: var(--accent-strong);
}

.ai-empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.ai-tip {
  margin-top: 8px;
  color: var(--text-2);
}


/* ---------- Neumorphism Extensions for Forms, Tabs & Cards ---------- */
.form-control,
.dig-card,
.stat-card,
.kpi-card,
.portal-card,
.search-panel,
.tabs button {
  transition: all 0.18s ease;
}

/* Inset inputs for forms */
.form-control,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
textarea,
select.form-control {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-m) !important;
  box-shadow: var(--neu-inset) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.form-control:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
textarea:focus,
select.form-control:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: var(--neu-inset), 0 0 0 3px var(--focus) !important;
}

/* Extruded cards for Digitization, Statistics & Admin */
.dig-card,
.kpi-card,
.stat-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-l) !important;
  box-shadow: var(--neu-flat) !important;
}

/* Neumorphic Tabs (Admin & Multi-mode) */
.tabs, .mode-tabs {
  background: var(--surface) !important;
  padding: 6px !important;
  border-radius: var(--radius-m) !important;
  box-shadow: var(--neu-inset) !important;
  display: inline-flex !important;
  gap: 8px !important;
  border: 1px solid var(--border) !important;
}

.tabs button, .mode-btn {
  background: transparent !important;
  border: none !important;
  padding: 7px 16px !important;
  border-radius: var(--radius-s) !important;
  color: var(--muted) !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}

.tabs button.active, .mode-btn.active {
  background: var(--surface) !important;
  color: var(--accent) !important;
  box-shadow: var(--neu-flat-sm) !important;
  border: 1px solid var(--border) !important;
}

/* Dropzone Neumorphic recessed basin */
.dropzone {
  background: var(--surface) !important;
  border: 2px dashed var(--border-strong) !important;
  border-radius: var(--radius-l) !important;
  box-shadow: var(--neu-inset) !important;
}

/* Pagination buttons neumorphic lift */
.wl-page-btn {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-s) !important;
  box-shadow: var(--neu-flat-sm) !important;
  transition: all 0.15s ease !important;
}

.wl-page-btn:hover:not(:disabled) {
  box-shadow: var(--neu-flat) !important;
  border-color: var(--border-strong) !important;
}

.wl-page-btn.active {
  background: var(--accent) !important;
  color: var(--on-accent) !important;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.4) !important;
}

.wl-page-btn:disabled {
  box-shadow: none !important;
  opacity: 0.4 !important;
}

/* ---------- Smart Picker Menu & Spacing Extensions ---------- */
.smart-picker-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--neu-flat);
  border-radius: var(--radius-l);
  padding: 10px;
  min-width: 310px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smart-picker-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.smart-picker-option:hover {
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: var(--neu-flat-sm);
}

.smart-option-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(39, 85, 52, 0.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.smart-option-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.smart-option-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.selected-summary-box {
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-m);
  background: var(--surface);
  box-shadow: var(--neu-inset);
  border: 1px solid var(--border);
  font-size: 13px;
  display: inline-block;
}

/* System-Wide Button & Field Sizing (Clinical Desktop Standards) */
.wl-btn, .btn {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s ease;
}

.wl-btn:hover, .btn:hover {
  border-color: var(--border-strong);
  color: var(--accent);
}

.wl-btn-primary, .btn-primary {
  background: var(--accent) !important;
  color: var(--on-accent) !important;
  border-color: var(--accent) !important;
}

.wl-btn-primary:hover, .btn-primary:hover {
  background: var(--accent-strong) !important;
  border-color: var(--accent-strong) !important;
  color: var(--on-accent) !important;
}

.wl-btn-action {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 10px !important;
  font-size: 11.5px !important;
}

.compact-table .wl-btn-sm {
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 8px !important;
  font-size: 11px !important;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 6px;
  box-shadow: none !important;
}

/* Compact Table (Medical Workstation Density) */
.compact-table thead th:not(.wl-filter-row th) {
  padding: 6px 12px !important;
  font-size: 11px !important;
  height: 30px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.compact-table tbody td {
  padding: 5px 12px !important;
  font-size: 12.5px !important;
  height: 32px !important;
}

/* Row clickability & hover */
.compact-table tbody tr.clickable-row {
  cursor: pointer;
}
.compact-table tbody tr.clickable-row:hover {
  background: var(--row-hover) !important;
}

/* Card & Content Density */
.app-content-body {
  padding: 16px 20px 36px;
  gap: 14px;
}

.card, .dig-card, .kpi-card, .stat-card {
  padding: 18px 20px;
  border-radius: var(--radius-m);
  margin-bottom: 16px;
}

.field-group, .field {
  margin-bottom: 14px;
}

.field-group label, .field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

.field-row, .grid-2, .grid-3 {
  gap: 14px;
}

/* ==========================================================================
   PACS Diagnostic Viewer Topbar - Zero-Glow Medical Workstation Aesthetic
   ========================================================================== */
.viewer-page .wl-header {
  background: #111417 !important;
  border-bottom: 1px solid #1f252c !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  box-shadow: none !important;
}

.viewer-page .wl-header-title h1 {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #8c9ba8 !important;
}

.viewer-page .wl-btn-nav,
.viewer-page .wl-btn {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 10px !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  background: #1c2127 !important;
  border: 1px solid #2b333d !important;
  color: #cbd5e1 !important;
  text-shadow: none !important;
  filter: none !important;
  transition: all 0.12s ease;
}

.viewer-page .wl-btn-nav:hover,
.viewer-page .wl-btn:hover {
  background: #262d36 !important;
  border-color: #3f4a57 !important;
  color: #ffffff !important;
  box-shadow: none !important;
  filter: none !important;
}

.viewer-page .wl-btn-nav:active,
.viewer-page .wl-btn:active {
  background: #181d22 !important;
}

.viewer-page .wl-btn-nav-primary {
  background: #134e4a !important;
  border-color: #0d9488 !important;
  color: #ccfbf1 !important;
}

.viewer-page .wl-btn-nav-primary:hover {
  background: #0f766e !important;
  border-color: #14b8a6 !important;
  color: #ffffff !important;
}

.viewer-page .wl-btn-ai {
  background: rgba(56, 178, 165, 0.1) !important;
  border: 1px solid rgba(56, 178, 165, 0.3) !important;
  color: #5eead4 !important;
  box-shadow: none !important;
}

.viewer-page .wl-btn-ai:hover {
  background: rgba(56, 178, 165, 0.2) !important;
  border-color: #38b2a5 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.viewer-page .wl-btn-ai .fast-preview-dot {
  background-color: #2dd4bf !important;
  animation: none !important;
  opacity: 0.8 !important;
}

.viewer-page .theme-toggle {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 4px !important;
  background: #1c2127 !important;
  border: 1px solid #2b333d !important;
  box-shadow: none !important;
  color: #94a3b8 !important;
}

.viewer-page .theme-toggle:hover {
  background: #262d36 !important;
  border-color: #3f4a57 !important;
  box-shadow: none !important;
  color: #ffffff !important;
}

.viewer-page .wl-btn-nav-danger {
  background: transparent !important;
  border-color: transparent !important;
  color: #f87171 !important;
  box-shadow: none !important;
}

.viewer-page .wl-btn-nav-danger:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
  box-shadow: none !important;
}

.viewer-page .export-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-page .export-group .wl-btn-export::after {
  display: none !important;
}

.viewer-page .user-avatar {
  width: 18px !important;
  height: 18px !important;
  font-size: 10px !important;
  background: #38b2a5 !important;
  color: #0b1915 !important;
  font-weight: 700 !important;
}
