:root {
    --bg: #f5f2ee;
    --card: #ffffff;
    --text: #1a1714;
    --muted: #7c7670;
    --accent: #2d6a4f;
    --accent2: #b7e4c7;
    --accent3: #e76f51;
    --border: #e8e3dc;
    --sidebar: #1a1714;
    --sidebar-text: #f5f2ee;
    --sidebar-muted: #7c7670;
    --pill-blue: #dbeafe;
    --pill-blue-text: #1e40af;
    --pill-green: #dcfce7;
    --pill-green-text: #166534;
    --pill-yellow: #fef9c3;
    --pill-yellow-text: #854d0e;
    --pill-red: #fee2e2;
    --pill-red-text: #991b1b;
    --pill-gray: #f3f4f6;
    --pill-gray-text: #374151;
  }
  /* DARK MODE */
  [data-theme="dark"] {
    --bg: #0f1117;
    --card: #1a1d27;
    --text: #e8eaf0;
    --muted: #6b7280;
    --border: #2a2d3a;
    --sidebar: #111318;
    --sidebar-text: #e8eaf0;
    --sidebar-muted: #6b7280;
    --pill-blue: #1e3a5f;
    --pill-blue-text: #93c5fd;
    --pill-green: #14532d;
    --pill-green-text: #86efac;
    --pill-yellow: #431407;
    --pill-yellow-text: #fde68a;
    --pill-red: #450a0a;
    --pill-red-text: #fca5a5;
    --pill-gray: #1f2937;
    --pill-gray-text: #d1d5db;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; transition: background .3s, color .3s; }

  /* SIDEBAR */
  .sidebar {
    width: 240px; min-height: 100vh; background: var(--sidebar); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transition: width .25s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
  }
  .sidebar.collapsed { width: 64px; }

  /* Sidebar header / logo */
  .sidebar-logo {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 12px; border-bottom: 1px solid #2e2b27; flex-shrink: 0;
  }
  .sb-brand { flex: 1; overflow: hidden; min-width: 0; transition: opacity .2s; }
  .sb-brand h1 { font-family: 'DM Serif Display', serif; font-size: 20px; color: #fff; letter-spacing: -0.5px; white-space: nowrap; }
  .sb-brand span { font-size: 10px; color: var(--sidebar-muted); letter-spacing: 1.5px; text-transform: uppercase; white-space: nowrap; }
  .sidebar.collapsed .sb-brand { opacity: 0; width: 0; pointer-events: none; }
  .sidebar.collapsed .sb-pin-btn { display: none; }

  /* Toggle & Pin buttons */
  .sb-toggle-btn, .sb-pin-btn {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 8px;
    background: none; border: none; cursor: pointer;
    color: var(--sidebar-muted); display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
  }
  .sb-toggle-btn:hover, .sb-pin-btn:hover { background: #2e2b27; color: #fff; }
  .sb-pin-btn { opacity: .5; }
  .sb-pin-btn.pinned { opacity: 1; color: var(--accent2); }

  /* Nav */
  .sidebar-nav { flex: 1; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; }
  .nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    cursor: pointer; font-size: 14px; color: var(--sidebar-muted); transition: background .15s, color .15s, padding .25s; font-weight: 500;
    white-space: nowrap; overflow: hidden;
  }
  .nav-item:hover { background: #2e2b27; color: #fff; }
  .nav-item.active { background: var(--accent); color: #fff; }
  .nav-item .icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
  .nav-item .icon svg { width: 18px; height: 18px; stroke: currentColor; }
  .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }
  .sidebar.collapsed .nav-label { opacity: 0; width: 0; pointer-events: none; }
  .sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
  .sidebar.collapsed .notif-dot { display: none; }
  .sb-admin { margin-top: 8px; border-top: 1px solid #2e2b27; padding-top: 12px !important; }

  /* Footer */
  .sidebar-footer { padding: 14px 16px; border-top: 1px solid #2e2b27; flex-shrink: 0; }
  .user-pill { display: flex; align-items: center; gap: 10px; overflow: hidden; }
  .user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0; }
  .user-info { overflow: hidden; }
  .user-info .name { font-size: 13px; color: #fff; font-weight: 500; white-space: nowrap; }
  .user-info .role { font-size: 11px; color: var(--sidebar-muted); white-space: nowrap; }
  .sidebar.collapsed .user-info { display: none; }
  .sidebar.collapsed .sidebar-footer { padding: 12px 0; justify-content: center; display: flex; }

  /* MAIN */
  .main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .25s cubic-bezier(.4,0,.2,1); }
  .main.sb-collapsed { margin-left: 64px; }
  .topbar {
    background: var(--card); border-bottom: 1px solid var(--border); padding: 16px 32px;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50;
  }
  .topbar-title { font-family: 'DM Serif Display', serif; font-size: 22px; }
  .topbar-actions { display: flex; gap: 10px; }
  .btn {
    padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
    border: none; transition: all .2s; font-family: 'DM Sans', sans-serif;
  }
  .btn-primary { background: var(--accent); color: #fff; }
  .btn-primary:hover { background: #245c43; }
  .btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
  .btn-outline:hover { border-color: var(--accent); color: var(--accent); }
  .btn-danger { background: #fee2e2; color: #991b1b; }
  .btn-danger:hover { background: #fecaca; }
  .btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); border: 1.5px solid var(--border); color: var(--muted); border-radius: 8px; }
  .btn-icon:hover { color: var(--text); border-color: var(--accent); }
  .btn-icon svg { width: 16px; height: 16px; stroke: currentColor; }

  .content { padding: 28px 32px; flex: 1; }

  /* PAGE */
  .page { display: none; }
  .page.active { display: block; }

  /* STATS ROW */
  .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
  .stat-card {
    background: var(--card); border-radius: 14px; padding: 22px 24px; border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 8px;
  }
  .stat-card .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
  .stat-card .value { font-family: 'DM Serif Display', serif; font-size: 34px; color: var(--text); }
  .stat-card .sub { font-size: 12px; color: var(--muted); }
  .stat-card .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
  .stat-card { border-left: 4px solid var(--border); }
  .stat-card--accent { border-left-color: #2d6a4f; }
  .stat-card--blue   { border-left-color: #3b82f6; }
  .stat-card--purple { border-left-color: #8b5cf6; }
  .stat-card--orange { border-left-color: #f97316; }
  .trend-up   { color: #16a34a; font-weight: 600; }
  .trend-down { color: #dc2626; font-weight: 600; }

  /* GRID 2 COL */
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
  .grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

  /* CARD */
  .card { background: var(--card); border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }
  .card-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .card-title { font-size: 15px; font-weight: 600; }
  .card-body { padding: 20px 24px; }

  /* TABLE */
  table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; padding: 16px 12px; }
  td { padding: 13px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
  tr:hover td { background: var(--bg); }

  /* BADGE */
  .badge {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  }
  .badge-green { background: var(--pill-green); color: var(--pill-green-text); }
  .badge-blue { background: var(--pill-blue); color: var(--pill-blue-text); }
  .badge-yellow { background: var(--pill-yellow); color: var(--pill-yellow-text); }
  .badge-red { background: var(--pill-red); color: var(--pill-red-text); }
  .badge-gray { background: var(--pill-gray); color: var(--pill-gray-text); }

  /* AVATAR */
  .avatar {
    width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center;
    justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
  }
  .av1 { background: #2d6a4f; } .av2 { background: #e76f51; } .av3 { background: #457b9d; }
  .av4 { background: #e9c46a; color: #7c6200; } .av5 { background: #8338ec; }
  .av6 { background: #fb5607; } .av7 { background: #3a86ff; } .av8 { background: #06d6a0; color: #064e3b; }
  .av-row { display: flex; align-items: center; gap: 10px; }
  .av-name { font-weight: 500; font-size: 13.5px; }
  .av-sub { font-size: 11px; color: var(--muted); }

  /* SCHEDULE GRID */
  .schedule-wrap { overflow-x: auto; }
  .schedule-grid { display: grid; grid-template-columns: 90px repeat(7,1fr); min-width: 780px; }
  .sch-header { display: contents; }
  .sch-day { padding: 10px 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border); }
  .sch-time { padding: 10px 8px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--border); display: flex; align-items: center; }
  .sch-cell { border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; min-height: 52px; position: relative; }
  .sch-block {
    border-radius: 6px; padding: 4px 7px; font-size: 11px; font-weight: 600; cursor: pointer;
    transition: opacity .15s; height: 100%; display: flex; flex-direction: column; gap: 1px;
  }
  .sch-block:hover { opacity: 0.8; }
  .sch-block.green { background: #dcfce7; color: #166534; border-left: 3px solid #16a34a; }
  .sch-block.blue { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
  .sch-block.orange { background: #ffedd5; color: #9a3412; border-left: 3px solid #f97316; }
  .sch-block.purple { background: #ede9fe; color: #5b21b6; border-left: 3px solid #7c3aed; }
  .sch-block.empty { background: transparent; }

  /* FORM */
  .form-group { margin-bottom: 16px; }
  .form-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
  .form-control {
    width: 100%; padding: 10px 14px; border-radius: 8px; border: 1.5px solid var(--border);
    font-size: 14px; font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text);
    transition: border .2s; outline: none;
  }
  .form-control:focus { border-color: var(--accent); background: #fff; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

  /* MODAL */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200;
    display: none; align-items: center; justify-content: center; backdrop-filter: blur(2px);
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--card); border-radius: 18px; width: 520px; max-width: 95vw;
    box-shadow: 0 24px 60px rgba(0,0,0,0.18); animation: slideUp .25s ease;
  }
  @keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  .modal-header { padding: 22px 28px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-title { font-family: 'DM Serif Display', serif; font-size: 20px; }
  .modal-close { font-size: 22px; cursor: pointer; color: var(--muted); background: none; border: none; line-height: 1; }
  .modal-body { padding: 24px 28px; }
  .modal-footer { padding: 16px 28px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

  /* TIMELINE */
  .timeline { display: flex; flex-direction: column; gap: 0; }
  .tl-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
  .tl-item:last-child { border-bottom: none; }
  .tl-time { font-size: 12px; color: var(--muted); width: 52px; flex-shrink: 0; padding-top: 2px; font-weight: 500; }
  .tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
  .tl-content .name { font-size: 13.5px; font-weight: 600; }
  .tl-content .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

  /* TABS */
  .tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 20px; width: fit-content; }
  .tab { padding: 7px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); transition: all .2s; }
  .tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.08); font-weight: 600; }

  /* PROGRESS */
  .progress-bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 6px; }
  .progress-fill { height: 100%; border-radius: 99px; background: var(--accent); }

  /* TERAPIS CARD */
  .terapis-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .terapis-card {
    background: var(--card); border-radius: 14px; border: 1px solid var(--border);
    padding: 22px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
    cursor: pointer; transition: box-shadow .2s, border-color .2s;
  }
  .terapis-card:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(45,106,79,0.1); }
  .terapis-card .big-av { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #fff; }
  .terapis-card .tc-name { font-weight: 600; font-size: 15px; }
  .terapis-card .tc-spec { font-size: 12px; color: var(--muted); }
  .terapis-card .tc-stats { display: flex; gap: 16px; }
  .tc-stat { font-size: 12px; color: var(--muted); } .tc-stat strong { color: var(--text); display: block; font-size: 16px; }

  /* REKAM MEDIS */
  .rm-list { display: flex; flex-direction: column; gap: 12px; }
  .rm-item { background: var(--bg); border-radius: 10px; padding: 14px 16px; border: 1px solid var(--border); cursor: pointer; transition: border-color .15s; }
  .rm-item:hover { border-color: var(--accent); }
  .rm-item .rm-head { display: flex; justify-content: space-between; align-items: flex-start; }
  .rm-item .rm-name { font-weight: 600; font-size: 14px; }
  .rm-item .rm-date { font-size: 11px; color: var(--muted); }
  .rm-item .rm-body { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

  /* PAYMENT */
  .pay-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .pay-row:last-child { border-bottom: none; }
  .pay-label { font-size: 13.5px; }
  .pay-amount { font-weight: 600; font-size: 14px; }

  /* SEARCH */
  .search-bar {
    display: flex; align-items: center; gap: 10px; background: var(--card);
    border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 16px; width: 260px;
  }
  .search-bar input { border: none; background: none; font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; flex: 1; color: var(--text); }
  .search-icon { color: var(--muted); font-size: 15px; display: flex; align-items: center; }
  .search-icon svg { width: 15px; height: 15px; stroke: currentColor; }

  /* NOTIFICATION DOT */
  .notif-dot { width: 7px; height: 7px; background: var(--accent3); border-radius: 50%; display: inline-block; margin-left: 6px; }

  /* EMPTY */
  .empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
  .empty-state .emoji { font-size: 40px; margin-bottom: 12px; }

  /* TODAY HIGHLIGHT */
  .today-col { background: rgba(45,106,79,0.04); }

  /* TOAST */
  .toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
  .toast {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); color: var(--text);
    border: 1px solid var(--border); border-left: 4px solid var(--accent);
    border-radius: 10px; padding: 13px 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    font-size: 13.5px; font-weight: 500;
    pointer-events: all; min-width: 260px; max-width: 360px;
    animation: toastIn .25s ease;
  }
  .toast.toast-success { border-left-color: #16a34a; }
  .toast.toast-error   { border-left-color: #dc2626; }
  .toast.toast-warning { border-left-color: #f59e0b; }
  .toast.toast-info    { border-left-color: #3b82f6; }
  .toast svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }
  .toast.toast-success svg { color: #16a34a; }
  .toast.toast-error   svg { color: #dc2626; }
  .toast.toast-warning svg { color: #f59e0b; }
  .toast.toast-info    svg { color: #3b82f6; }
  .toast-close { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--muted); padding: 0; display: flex; align-items: center; }
  .toast-close svg { width: 14px; height: 14px; }
  .toast.toast-hide { animation: toastOut .2s ease forwards; }
  @keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes toastOut { from { opacity: 1; transform: translateX(0); }    to { opacity: 0; transform: translateX(20px); } }

  select.form-control { appearance: auto; }
  textarea.form-control { resize: vertical; min-height: 80px; }

  /* ===================== BOOKING WILDCARD SEARCH ===================== */
  .booking-search-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--card); border: 1.5px solid var(--border); border-radius: 12px;
    padding: 12px 18px; margin-bottom: 16px;
  }
  .booking-search-count {
    font-size: 12px; font-weight: 600; color: var(--accent);
    background: var(--accent2); border-radius: 20px; padding: 3px 10px;
    white-space: nowrap;
  }
  .booking-search-hint {
    font-size: 11px; color: var(--muted); margin-left: auto;
  }
  .booking-search-hint code {
    background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
    padding: 1px 5px; font-size: 11px; font-family: monospace; color: var(--accent);
  }

  /* ===================== DRAG & DROP JADWAL ===================== */
  .sch-block[draggable="true"] { cursor: grab; user-select: none; }
  .sch-block[draggable="true"]:active { cursor: grabbing; }
  .sch-block.dragging { opacity: 0.3; box-shadow: 0 4px 16px rgba(0,0,0,0.15); }

  .sch-cell.drag-over {
    background: rgba(45,106,79,0.1);
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    border-radius: 4px;
  }
  .sch-cell.drag-over-occupied {
    background: rgba(231,111,81,0.08);
    outline: 2px dashed var(--accent3);
    outline-offset: -2px;
    border-radius: 4px;
  }
  /* Drag-over tooltip-style label */
  .sch-cell.drag-over::after {
    content: '↓ Letakkan di sini';
    position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
    font-size: 9px; color: var(--accent); font-weight: 600; white-space: nowrap;
    pointer-events: none;
  }
  .sch-cell.drag-over-occupied::after {
    content: '⇅ Tukar posisi';
    position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
    font-size: 9px; color: var(--accent3); font-weight: 600; white-space: nowrap;
    pointer-events: none;
  }

  /* ===================== VARIABLE MANAGER MODAL ===================== */
  .var-modal {
    width: 900px; max-width: 97vw; max-height: 92vh;
    display: flex; flex-direction: column;
  }
  .var-modal-body {
    display: grid; grid-template-columns: 1fr 300px;
    gap: 0; overflow: hidden; flex: 1;
  }
  .var-list-panel {
    padding: 22px 24px; overflow-y: auto; border-right: 1px solid var(--border);
  }
  .var-form-panel {
    padding: 22px 24px; overflow-y: auto; background: #fafaf8;
  }
  .var-panel-title {
    font-size: 13px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px;
    display: flex; align-items: center;
  }

  /* Variable table specifics */
  .var-key {
    background: var(--bg); padding: 2px 7px; border-radius: 5px;
    font-size: 11.5px; font-family: monospace; color: #1e40af; border: 1px solid #dbeafe;
  }
  .var-label-col { font-size: 13px; max-width: 130px; }
  .lov-preview { font-size: 11.5px; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .var-actions { text-align: right; white-space: nowrap; }
  .empty-cell { text-align: center; padding: 28px 12px; color: var(--muted); font-size: 13px; }

  /* LOV chips */
  .lov-list {
    display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px;
    background: var(--card); border: 1.5px solid var(--border); border-radius: 8px;
    padding: 8px 10px;
  }
  .lov-item {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
    padding: 3px 10px 3px 12px; font-size: 12px; font-weight: 500;
  }
  .lov-item button {
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: 15px; line-height: 1; padding: 0; display: flex; align-items: center;
  }
  .lov-item button:hover { color: #dc2626; }

  /* Alert messages inside var manager */
  .var-msg {
    border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 500;
    margin-bottom: 14px; display: none;
  }
  .var-msg-error  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
  .var-msg-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

  /* Purple badge (missing from original) */
  .badge-purple { background: #ede9fe; color: #5b21b6; }
  .badge-orange { background: #ffedd5; color: #9a3412; }

  /* ===================== VARIABLE MANAGER — ENTITY VIEW ===================== */
  #vm-entity-view { padding: 24px 28px 28px; }

  .vm-entity-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;
  }
  .vm-entity-card {
    border-radius: 14px; border: 2px solid var(--border); padding: 24px 18px;
    cursor: pointer; transition: all .2s; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
  }
  .vm-entity-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.1); }
  .vm-entity-icon  { font-size: 38px; line-height: 1; }
  .vm-entity-name  { font-size: 16px; font-weight: 700; margin-top: 2px; }
  .vm-entity-desc  { font-size: 11.5px; color: var(--muted); }
  .vm-entity-count { font-size: 12px; font-weight: 600; padding: 3px 12px; border-radius: 20px; margin-top: 4px; }
  .vm-entity-action { font-size: 12px; font-weight: 700; margin-top: 6px; }

  /* User — blue */
  .vm-entity-user { border-color: #bfdbfe; }
  .vm-entity-user:hover { border-color: #3b82f6; background: #eff6ff; }
  .vm-entity-user .vm-entity-count { background: #dbeafe; color: #1e40af; }
  .vm-action-user { color: #3b82f6; }

  /* Patient — green */
  .vm-entity-patient { border-color: #bbf7d0; }
  .vm-entity-patient:hover { border-color: #16a34a; background: #f0fdf4; }
  .vm-entity-patient .vm-entity-count { background: #dcfce7; color: #166534; }
  .vm-action-patient { color: #16a34a; }

  /* Therapist — orange */
  .vm-entity-therapist { border-color: #fed7aa; }
  .vm-entity-therapist:hover { border-color: #f97316; background: #fff7ed; }
  .vm-entity-therapist .vm-entity-count { background: #ffedd5; color: #9a3412; }
  .vm-action-therapist { color: #f97316; }

  /* Summary table below entity cards */
  .vm-all-summary {
    background: var(--bg); border-radius: 12px; padding: 18px 20px;
    border: 1px solid var(--border); max-height: 280px; overflow-y: auto;
  }
  .vm-summary-title {
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
    display: flex; align-items: center;
  }

  /* Pill badge in summary table rows */
  .vm-entity-pill {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 20px; white-space: nowrap;
  }
  .vm-badge-user      { background: #dbeafe; color: #1e40af; }
  .vm-badge-patient   { background: #dcfce7; color: #166534; }
  .vm-badge-therapist { background: #ffedd5; color: #9a3412; }

  /* Summary rows are clickable */
  #vm-all-tbody tr:hover td { background: #f0fdf4; cursor: pointer; }

  /* ===================== VARIABLE MANAGER — DRILL-DOWN VIEW ===================== */
  .vm-breadcrumb {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 24px; border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .vm-bread-label {
    font-size: 15px; font-weight: 700; padding: 3px 14px;
    border-radius: 20px;
  }
  .vm-bread-user      { background: #dbeafe; color: #1e40af; }
  .vm-bread-patient   { background: #dcfce7; color: #166534; }
  .vm-bread-therapist { background: #ffedd5; color: #9a3412; }

  /* Wider modal for variable manager */
  .var-modal {
    width: 920px; max-width: 97vw; max-height: 90vh;
    display: flex; flex-direction: column; overflow: hidden;
  }
  .var-modal-body {
    display: grid; grid-template-columns: 1fr 300px;
    overflow: hidden; flex: 1; min-height: 0;
  }
  .var-list-panel {
    padding: 20px 22px; overflow-y: auto; border-right: 1px solid var(--border);
  }
  .var-form-panel {
    padding: 20px 22px; overflow-y: auto; background: #fafaf8;
  }
  .var-panel-title {
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px;
    display: flex; align-items: center;
  }
  .var-key {
    background: var(--bg); padding: 2px 7px; border-radius: 5px;
    font-size: 11.5px; font-family: monospace; color: #1e40af; border: 1px solid #dbeafe;
  }
  .var-label-col  { font-size: 13px; }
  .lov-preview    { font-size: 11.5px; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .var-actions    { text-align: right; white-space: nowrap; gap: 4px; display: flex; justify-content: flex-end; }
  .empty-cell     { text-align: center; padding: 28px 12px; color: var(--muted); font-size: 13px; }

  /* LOV chips */
  .lov-list {
    display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px;
    background: var(--card); border: 1.5px solid var(--border); border-radius: 8px;
    padding: 8px 10px;
  }
  .lov-item {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
    padding: 3px 10px 3px 12px; font-size: 12px; font-weight: 500;
  }
  .lov-item button {
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: 15px; line-height: 1; padding: 0; display: flex; align-items: center;
  }
  .lov-item button:hover { color: #dc2626; }

  /* Alert messages */
  .var-msg { border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
  .var-msg-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
  .var-msg-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

  /* GLOBAL SEARCH RESULTS */
  .global-search-results {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 900;
    width: 400px; background: var(--card);
    border: 1.5px solid var(--border); border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,.16);
    max-height: 420px; overflow-y: auto;
  }
  .gs-section-title {
    padding: 10px 16px 6px;
    font-size: 10.5px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px;
    border-top: 1px solid var(--border);
  }
  .gs-section-title:first-child { border-top: none; }
  .gs-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px; cursor: pointer; transition: background .12s;
  }
  .gs-item:hover { background: var(--bg); }
  .gs-avatar { width: 30px; height: 30px; font-size: 11px; flex-shrink: 0; }
  .gs-item-info { flex: 1; min-width: 0; }
  .gs-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gs-item-sub  { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
  .gs-tag {
    flex-shrink: 0; font-size: 10px; font-weight: 600;
    padding: 2px 7px; border-radius: 20px;
  }
  .gs-tag-pasien  { background: #dcfce7; color: #166534; }
  .gs-tag-booking { background: #dbeafe; color: #1e40af; }
  .gs-tag-terapis { background: #ffedd5; color: #9a3412; }
  .gs-empty { padding: 20px 16px; text-align: center; font-size: 13px; color: var(--muted); }

  /* TERAPIS & PASIEN TOOLBAR */
  .terapis-toolbar, .pasien-toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 24px 0; flex-wrap: wrap;
  }
  .terapis-toolbar input, .terapis-toolbar select,
  .pasien-toolbar input, .pasien-toolbar select {
    height: 38px; padding: 0 12px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 13px; font-family: inherit;
    background: var(--card); color: var(--text); outline: none;
    transition: border-color .2s;
  }
  .terapis-toolbar input:focus, .terapis-toolbar select:focus,
  .pasien-toolbar input:focus, .pasien-toolbar select:focus {
    border-color: var(--accent);
  }
  .terapis-toolbar input { width: 200px; }
  .terapis-toolbar select { width: 160px; }
  .pasien-toolbar input  { width: 220px; }
  .pasien-toolbar select { width: 170px; }
  .terapis-count, .pasien-count {
    font-size: 12px; color: var(--muted); margin-left: auto;
  }

  /* PATIENT AUTOCOMPLETE */
  .patient-ac-wrap {
    position: relative;
  }
  .patient-autocomplete {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 500;
    background: var(--card); border: 1.5px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 220px; overflow-y: auto;
  }
  .patient-ac-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; cursor: pointer; transition: background .15s;
  }
  .patient-ac-item:hover { background: var(--bg); }
  .patient-ac-item + .patient-ac-item { border-top: 1px solid var(--border); }
  .patient-ac-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
  }
  .patient-ac-name { font-size: 13px; font-weight: 600; }
  .patient-ac-sub  { font-size: 11.5px; color: var(--muted); }
  .patient-ac-empty { padding: 8px 14px; font-size: 12.5px; color: var(--muted); display: inline; }
  .patient-ac-create {
    border-top: 1px dashed var(--border);
    color: var(--accent); font-weight: 500;
  }
  .patient-ac-create:hover { background: #f0fdf4; }

  /* SELECTED PATIENT PILL */
  .selected-patient-pill {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: 10px; padding: 8px 12px;
  }
  .selected-patient-pill .spp-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
  }
  .selected-patient-pill .spp-info { flex: 1; }
  .selected-patient-pill .spp-name { font-size: 13px; font-weight: 600; }
  .selected-patient-pill .spp-code { font-size: 11.5px; color: var(--muted); }
  .selected-patient-pill .spp-clear {
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 18px; line-height: 1;
    padding: 0 2px; display: flex; align-items: center; transition: color .15s;
  }
  .selected-patient-pill .spp-clear:hover { color: #dc2626; }

  /* TERAPIS USER LINK BADGE */
  .terapis-user-link {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; color: #1e40af; background: #dbeafe;
    border-radius: 20px; padding: 2px 8px; margin-top: 4px;
    font-weight: 500;
  }

  /* BOOKING DETAIL MODAL */
  .bd-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
  }
  .bd-row:last-child { border-bottom: none; }
  .bd-label {
    width: 120px; flex-shrink: 0;
    font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .5px; padding-top: 1px;
  }
  .bd-value { font-size: 13.5px; color: var(--text); flex: 1; }
  .bd-status-row {
    display: flex; align-items: center; gap: 10px;
    margin-top: 18px; padding-top: 16px; border-top: 2px solid var(--border);
  }
  .bd-status-row label { font-size: 13px; font-weight: 600; }
  .bd-status-row select {
    flex: 1; height: 36px; padding: 0 10px;
    border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: inherit; background: var(--card);
    outline: none; transition: border-color .2s;
  }
  .bd-status-row select:focus { border-color: var(--accent); }


