body {
  --rsi-sidebar-width: 232px;
  --rsi-header-height: 90px;
  --rsi-sidebar-color: #102d43;
  --rsi-accent: #0f766e;
  --rsi-row-line: #dce6ed;
}

body[data-theme="soft-dark"] {
  --rsi-sidebar-color: #292420;
  --rsi-accent: #d7b98f;
  --rsi-row-line: #514842;
}
body[data-theme="red-maroon"] { --rsi-sidebar-color: #44202c; }

@media (min-width: 901px) {
  body > header:has(#nav:not(.hidden)) {
    padding: 10px clamp(12px, 2vw, 28px);
    overflow: visible;
    gap: 8px 16px;
    flex-wrap: nowrap;
  }
  body > header:has(#nav:not(.hidden))::after { display: none; }
  #nav {
    --rsi-nav-card: #183a50;
    --rsi-nav-card-alt: #1c4057;
    --rsi-nav-edge: #385c72;
    --rsi-nav-label: #c3dce8;
    --rsi-nav-active: #23606c;
    --rsi-nav-active-edge: #77c9d0;
    --rsi-nav-focus: #a3e9ef;
  }
  body[data-theme="soft-dark"] #nav {
    --rsi-nav-card: #352d26;
    --rsi-nav-card-alt: #3b3028;
    --rsi-nav-edge: #5d4c3d;
    --rsi-nav-label: #ead0b6;
    --rsi-nav-active: #614633;
    --rsi-nav-active-edge: #ba8e6b;
    --rsi-nav-focus: #f2caa1;
  }
  body:not([data-theme]) #nav,
  body[data-theme="default"] #nav {
    --rsi-sidebar-color: #112f28;
    --rsi-nav-card: #173e34;
    --rsi-nav-card-alt: #1a473b;
    --rsi-nav-edge: #3b6355;
    --rsi-nav-label: #c4e5d5;
    --rsi-nav-active: #236254;
    --rsi-nav-active-edge: #72b49d;
    --rsi-nav-focus: #a6e8cf;
  }
  body[data-theme="red-maroon"] #nav {
    --rsi-nav-card: #532b37;
    --rsi-nav-card-alt: #5a303d;
    --rsi-nav-edge: #79505c;
    --rsi-nav-label: #f1d5dd;
    --rsi-nav-active: #754353;
    --rsi-nav-active-edge: #c28195;
    --rsi-nav-focus: #f5bbcd;
  }

  #nav {
    position: fixed;
    inset: var(--rsi-header-height) auto 0 0;
    width: var(--rsi-sidebar-width);
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--rsi-sidebar-color);
    padding: 12px 10px 20px;
    color: #f5fbff;
    box-shadow: 6px 0 20px #142c4314;
  }
  .rsi-nav-group:not(:has(button:not(.hidden))) { display: none; }
  #nav .rsi-nav-group {
    padding: 4px;
    border: 1px solid var(--rsi-nav-edge);
    border-radius: 10px;
    background: var(--rsi-nav-card);
  }
  #nav .rsi-nav-group:nth-child(even) { background: var(--rsi-nav-card-alt); }
  #nav .rsi-nav-group + .rsi-nav-group { margin-top: 8px; }
  .rsi-nav-label {
    padding: 6px 10px;
    color: var(--rsi-nav-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .045em;
  }
  #nav button {
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    margin: 2px 0;
    border: 1px solid transparent;
    border-radius: 7px;
    text-align: left;
    color: inherit;
    background: transparent;
    box-shadow: none;
    transform: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  #nav button:hover { background: #ffffff17; }
  #nav button[aria-current="page"] {
    border-color: var(--rsi-nav-active-edge);
    background: var(--rsi-nav-active);
  }
  #nav button:focus-visible {
    outline: 2px solid var(--rsi-nav-focus);
    outline-offset: -2px;
  }

  #nav button { min-height: 34px; padding-block: 6px; }
  body:has(#nav:not(.hidden)) > .rsi-workspace {
    padding-left: var(--rsi-sidebar-width);
  }
}

#queueTopStats .stat {
  --status-color: var(--rsi-accent);
  border: 1px solid var(--rsi-row-line);
  border-inline-start: 4px solid var(--status-color) !important;
  min-width: 0;
}
#queueTopStats .stat[aria-pressed="true"],
#queueTopStats .stat:focus-visible { outline: 2px solid var(--status-color); outline-offset: -2px; }
#queueTopStats .stat b { color: var(--status-color); font-variant-numeric: tabular-nums; }
[data-status="MENUNGGU"] { --status-bg: #fff0d5; --status-text: #854700; }
[data-status="DIPANGGIL"] { --status-bg: #e3f1ff; --status-text: #174d85; }
[data-status="DIPERIKSA"] { --status-bg: #f0e8ff; --status-text: #57369c; }
[data-status="SELESAI"] { --status-bg: #def5e9; --status-text: #196046; }
[data-status="BATAL"], [data-status="DUPLIKAT"] { --status-bg: #fee8e7; --status-text: #982f31; }
#queueTopStats [data-status] { --status-color: var(--status-text); }
body[data-theme="soft-dark"] #queueTopStats [data-status] { --status-color: var(--status-bg); }

/* RSI mobile horizontal navigation — visual-only, all authorized roles.
   Keep existing .hidden and onclick permission logic unchanged. */
#rsi-mobile-menu-toggle {display:none !important;}
#rsi-mobile-menu-toggle[hidden] {display:none !important;}
@media (max-width: 900px) {
  header {min-width:0;}
  #nav > .rsi-nav-group {display:none;}
  #nav.nav:not(.hidden) {
    display:flex !important;
    flex-direction:row !important;
    flex-wrap:nowrap !important;
    grid-template-columns:none !important;
    flex:0 0 100%;
    width:100%;max-width:100%;min-width:0;
    gap:8px;align-items:center;
    overflow-x:auto !important;overflow-y:hidden !important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
    scroll-behavior:smooth;
    scrollbar-width:none;
    padding:3px 1px 9px;
    touch-action:pan-x pan-y;
  }
  #nav.nav:not(.hidden)::-webkit-scrollbar {display:none;}
  #nav.nav:not(.hidden) > button:not(.hidden) {
    display:inline-flex;
    flex:0 0 auto;
    width:max-content;min-width:max-content;
    min-height:42px;
    align-items:center;justify-content:center;
    white-space:nowrap !important;
    word-break:normal !important;
    overflow-wrap:normal !important;
    text-align:center;
    line-height:1.2;
  }
}

@media print {
  #nav, #rsi-mobile-menu-toggle { display: none !important; }
  body > .rsi-workspace { padding-left: 0 !important; }
}
