*, *::before, *::after { box-sizing: border-box; }

body.rb-body.rb-theme-dark,
body.rb-body.rb-theme-light {
  --rb-radius: 12px;
  --rb-font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body.rb-body.rb-theme-dark {
  --rb-bg: #0b1220;
  --rb-surface: #111827;
  --rb-card: #151e32;
  --rb-border: #243045;
  --rb-text: #e5e7eb;
  --rb-muted: #94a3b8;
  --rb-accent: #38bdf8;
  --rb-accent-2: #0ea5e9;
  --rb-danger: #f87171;
  --rb-warn: #fbbf24;
  --rb-success: #4ade80;
  --rb-navbar-bg: rgba(17, 24, 39, 0.95);
  --rb-navbar-border: #243045;
  --rb-sidenav-bg: #111827;
  --rb-sidenav-border: #243045;
}

body.rb-body.rb-theme-light {
  --rb-bg: #f0f2f5;
  --rb-surface: #ffffff;
  --rb-card: #ffffff;
  --rb-border: #e2e8f0;
  --rb-text: #1e293b;
  --rb-muted: #64748b;
  --rb-accent: #0ea5e9;
  --rb-accent-2: #0284c7;
  --rb-danger: #dc2626;
  --rb-warn: #d97706;
  --rb-success: #16a34a;
  --rb-navbar-bg: #ffffff;
  --rb-navbar-border: #e2e8f0;
  --rb-sidenav-bg: #f9f9f9;
  --rb-sidenav-border: #e2e8f0;
}

body.rb-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--rb-font);
  color: var(--rb-text);
}
body.rb-body.rb-theme-dark {
  background: radial-gradient(1200px 600px at 10% -10%, #164e63 0%, transparent 55%), var(--rb-bg);
}
body.rb-body.rb-theme-light {
  background: var(--rb-bg);
}

/* Legacy topbar (halaman tanpa shell navbar+sidenav, jika ada) */
.rb-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(17, 24, 39, 0.92);
  border-bottom: 1px solid var(--rb-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.rb-brand { display: flex; align-items: center; gap: 0.75rem; }
.rb-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--rb-accent), var(--rb-accent-2));
  color: #0f172a;
  font-weight: 800;
  font-size: 0.85rem;
}
.rb-logo-lg { width: 48px; height: 48px; font-size: 1rem; }
.rb-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.rb-auth .rb-auth-brand .rb-logo-img.rb-logo-lg {
  width: 56px;
  height: 56px;
}
.rb-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; flex: 1; }
.rb-nav a {
  color: var(--rb-muted);
  text-decoration: none;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.9rem;
}
.rb-nav a:hover { color: var(--rb-text); background: rgba(56, 189, 248, 0.08); }
.rb-nav a.active { color: #0f172a; background: var(--rb-accent); font-weight: 600; }
.rb-userbar { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.rb-router-pick select {
  background: var(--rb-surface);
  color: var(--rb-text);
  border: 1px solid var(--rb-border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}
.rb-main { padding: 1.25rem; max-width: 1200px; margin: 0 auto 3rem; }
.rb-footer {
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--rb-muted);
  border-top: 1px solid var(--rb-border);
}
.rb-muted { color: var(--rb-muted); }
.rb-small { font-size: 0.8rem; }
.rb-page-head { margin-bottom: 1.25rem; }
.rb-page-head h1 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.rb-grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.rb-stat {
  background: var(--rb-card);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius);
  padding: 1rem;
}
.rb-stat h3 { margin: 0 0 0.35rem; font-size: 0.72rem; font-weight: 600; color: var(--rb-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rb-stat-value { margin: 0; font-size: 1.45rem; font-weight: 700; color: var(--rb-accent); }
.rb-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.rb-btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.rb-btn-primary { background: var(--rb-accent-2); color: #0f172a; font-weight: 600; }
.rb-btn-primary:hover { filter: brightness(1.08); }
.rb-btn-secondary { background: transparent; border-color: var(--rb-border); color: var(--rb-text); }
.rb-btn-secondary:hover { border-color: var(--rb-accent); color: var(--rb-accent); }
.rb-btn-ghost { background: transparent; color: var(--rb-muted); border-color: var(--rb-border); }
.rb-btn-block { width: 100%; text-align: center; }
.rb-card {
  background: var(--rb-card);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius);
  padding: 1.25rem;
}
.rb-narrow { max-width: 520px; }
.rb-alert { padding: 0.75rem 1rem; border-radius: 10px; margin: 0.75rem 0; font-size: 0.9rem; }
.rb-alert-danger { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35); color: #fecaca; }
.rb-alert-warn { background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.35); color: #fef3c7; }
.rb-alert-success { background: rgba(74, 222, 128, 0.1); border: 1px solid rgba(74, 222, 128, 0.35); color: #bbf7d0; }
.rb-table-wrap { overflow-x: auto; border: 1px solid var(--rb-border); border-radius: var(--rb-radius); }
.rb-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.rb-table th, .rb-table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--rb-border); }
.rb-table th { background: rgba(15, 23, 42, 0.6); color: var(--rb-muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
.rb-table tr:last-child td { border-bottom: 0; }
.rb-td-actions a, .rb-link-btn { color: var(--rb-accent); margin-right: 0.5rem; background: none; border: 0; cursor: pointer; font-size: inherit; text-decoration: underline; padding: 0; }
.rb-form { display: flex; flex-direction: column; gap: 0.35rem; max-width: 520px; }
.rb-form-grid { display: grid; grid-template-columns: 160px 1fr; gap: 0.5rem 1rem; align-items: center; max-width: 720px; }
.rb-form-tight { max-width: 900px; }
.rb-form label { color: var(--rb-muted); font-size: 0.85rem; }
.rb-textarea {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--rb-border);
  background: var(--rb-surface);
  color: var(--rb-text);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  grid-column: 1 / -1;
}
.rb-mb { margin-bottom: 1rem; }
.rb-btn-tiny { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.rb-danger-text { color: #fecaca !important; }
.rb-danger-outline { border-color: #f87171 !important; }
.rb-td-ops { white-space: normal; min-width: 220px; }
.rb-table-plain th { width: 160px; text-align: left; font-weight: 600; color: var(--rb-muted); }
.rb-table-plain td { border-bottom: 1px solid var(--rb-border); }
.rb-select-wide { min-width: 220px; margin: 0.5rem 0; }
.rb-tr-stats { font-size: 1.1rem; margin: 0.75rem 0; }
.rb-form input, .rb-form select {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--rb-border);
  background: var(--rb-surface);
  color: var(--rb-text);
}
.rb-form-actions { grid-column: 1 / -1; margin-top: 0.5rem; }
.rb-inline-form { display: inline; }
.rb-inline-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }
.rb-badge { padding: 0.15rem 0.45rem; border-radius: 6px; font-size: 0.72rem; text-transform: uppercase; font-weight: 600; }
.rb-stock { background: rgba(56, 189, 248, 0.15); color: var(--rb-accent); }
.rb-used { background: rgba(74, 222, 128, 0.15); color: var(--rb-success); }
.rb-expired { background: rgba(248, 113, 113, 0.12); color: #fecaca; }
.rb-cancelled { background: rgba(148, 163, 184, 0.2); color: var(--rb-muted); }
.rb-h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; color: var(--rb-muted); }

.rb-nav-more { position: relative; }
.rb-nav-more summary {
  cursor: pointer;
  list-style: none;
  color: var(--rb-muted);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.9rem;
}
.rb-nav-more summary::-webkit-details-marker { display: none; }
.rb-nav-more summary.rb-sum-active,
.rb-nav-more[open] summary { color: #0f172a; background: var(--rb-accent); font-weight: 600; }
.rb-subnav {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  background: var(--rb-surface);
  border: 1px solid var(--rb-border);
  border-radius: 10px;
  padding: 0.35rem;
  min-width: 200px;
  z-index: 50;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.rb-subnav a {
  color: var(--rb-text);
  text-decoration: none;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.rb-subnav a:hover { background: rgba(56, 189, 248, 0.12); }

/* Auth */
body.rb-auth {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: var(--rb-font);
  background: linear-gradient(160deg, #0c4a6e, #0f172a 45%, #020617);
  color: var(--rb-text);
}
body.rb-auth.rb-theme-light {
  background: var(--rb-bg);
}
body.rb-auth.rb-theme-light .rb-auth-card {
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
}
.rb-login-icon { margin-right: 0.35rem; opacity: 0.85; }
.rb-auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--rb-card);
  border: 1px solid var(--rb-border);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.rb-auth-wide { max-width: 520px; }
.rb-auth-brand { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; }
.rb-auth h1 { margin: 0 0 0.5rem; font-size: 1.35rem; }

.rb-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.rb-profile-count { font-size: 1.35rem; font-weight: 600; margin: 0.25rem 0 1rem; color: var(--rb-accent); }
.rb-list-plain { list-style: none; padding: 0; margin: 0; }
.rb-list-plain li { margin: 0.2rem 0; }
.rb-mt { margin-top: 1rem; }
.rb-num { text-align: right; font-variant-numeric: tabular-nums; }
.rb-textarea-code { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.rb-resume-bars { display: flex; flex-direction: column; gap: 0.5rem; }
.rb-resume-row { display: grid; grid-template-columns: 7rem 1fr auto; gap: 0.75rem; align-items: center; }
.rb-resume-date { font-size: 0.85rem; color: var(--rb-muted); }
.rb-resume-track { height: 10px; background: var(--rb-border); border-radius: 6px; overflow: hidden; }
.rb-resume-fill { height: 100%; background: linear-gradient(90deg, var(--rb-accent-2), var(--rb-accent)); border-radius: 6px; min-width: 2px; }
.rb-resume-val { font-size: 0.9rem; text-align: right; }
.rb-poll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.rb-poll-box { background: var(--rb-card); border: 1px solid var(--rb-border); border-radius: var(--rb-radius); padding: 1rem; }
.rb-poll-box h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--rb-muted); }
.rb-poll-wide { grid-column: 1 / -1; }
.rb-log-mini { margin: 0; padding-left: 1.1rem; font-size: 0.8rem; max-height: 180px; overflow-y: auto; }
.rb-log-mini li { margin: 0.2rem 0; }

@media (max-width: 768px) {
  .rb-form-grid { grid-template-columns: 1fr; }
  .rb-topbar { flex-direction: column; align-items: stretch; }
  .rb-nav { justify-content: center; }
}

/* ——— Shell panel (navbar + sidenav) ——— */
.rb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.rb-mm-app {
  padding-top: 50px;
}

.rb-mm-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.65rem 0 0.35rem;
  background: var(--rb-navbar-bg);
  border-bottom: 1px solid var(--rb-navbar-border);
  z-index: 1002;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.rb-mm-navbar-left,
.rb-mm-navbar-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.rb-mm-iconbtn {
  display: none;
  background: transparent;
  border: 0;
  color: var(--rb-text);
  font-size: 1.15rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  border-radius: 6px;
}
.rb-mm-iconbtn:hover { background: rgba(14, 165, 233, 0.12); }
.rb-mm-closebtn { display: none; }

.rb-mm-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--rb-text);
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
}
.rb-mm-brand:hover { background: rgba(14, 165, 233, 0.1); }
.rb-mm-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
}

.rb-mm-cpage {
  font-size: 0.95rem;
  color: var(--rb-muted);
  padding-left: 0.25rem;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rb-mm-select {
  font-size: 0.8rem;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--rb-border);
  background: var(--rb-surface);
  color: var(--rb-text);
  max-width: 160px;
}
.rb-mm-router-form { margin: 0; }
.rb-mm-logout {
  font-size: 0.85rem;
  color: var(--rb-muted);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
}
.rb-mm-logout:hover { color: var(--rb-danger); background: rgba(220, 38, 38, 0.06); }

.rb-mm-sidenav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 1000;
}
body.rb-mm-nav-open .rb-mm-sidenav-backdrop { display: block; }

.rb-mm-sidenav {
  position: fixed;
  top: 50px;
  left: 0;
  width: 252px;
  height: calc(100vh - 50px);
  overflow-y: auto;
  background: var(--rb-sidenav-bg);
  border-right: 1px solid var(--rb-sidenav-border);
  z-index: 1001;
  padding-bottom: 1rem;
}

.rb-mm-identity {
  text-align: center;
  padding: 0.85rem 0.65rem;
  border-bottom: 1px solid var(--rb-border);
  background: var(--rb-surface);
}
.rb-mm-identity h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  word-break: break-word;
}
.rb-mm-identity-sub {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
}

.rb-mm-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  color: var(--rb-text);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
}
.rb-mm-link:hover { background: rgba(14, 165, 233, 0.08); }
.rb-mm-link.rb-mm-active,
.rb-mm-sublink.rb-mm-active,
.rb-mm-drop a.rb-mm-active {
  font-weight: 700;
  background: rgba(14, 165, 233, 0.12);
  border-left-color: var(--rb-accent-2);
}

.rb-mm-details > summary,
.rb-mm-nested > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  color: var(--rb-text);
  border-left: 3px solid transparent;
  user-select: none;
}
.rb-mm-details > summary::-webkit-details-marker,
.rb-mm-nested > summary::-webkit-details-marker { display: none; }
.rb-mm-details > summary:hover,
.rb-mm-nested > summary:hover { background: rgba(14, 165, 233, 0.06); }
.rb-mm-sum-active { font-weight: 700; background: rgba(14, 165, 233, 0.1); }
.rb-mm-caret { margin-left: auto; opacity: 0.55; font-size: 0.75rem; }

.rb-mm-drop {
  background: var(--rb-bg);
  border-top: 1px solid var(--rb-border);
}
.rb-mm-drop a,
.rb-mm-sublink {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem 0.45rem 1.35rem;
  font-size: 0.82rem;
  color: var(--rb-text);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.rb-mm-drop a:hover,
.rb-mm-sublink:hover { background: rgba(14, 165, 233, 0.08); }
.rb-mm-drop2 a { padding-left: 2rem; }

.rb-mm-nested { border-bottom: 1px solid var(--rb-border); }

.rb-mm-main {
  margin-left: 252px;
  min-height: calc(100vh - 50px);
  display: flex;
  flex-direction: column;
}
.rb-mm-inner {
  flex: 1;
  padding: 1rem 1.15rem 2rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.rb-mm-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--rb-muted);
  padding: 0.75rem;
  border-top: 1px solid var(--rb-border);
  background: var(--rb-surface);
}

@media (max-width: 899px) {
  .rb-mm-iconbtn { display: inline-block; }
  body.rb-mm-nav-open .rb-mm-closebtn { display: inline-block; }
  body.rb-mm-nav-open #rbOpenNav { display: none; }
  .rb-mm-sidenav {
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }
  body.rb-mm-nav-open .rb-mm-sidenav { transform: translateX(0); }
  .rb-mm-main { margin-left: 0; }
  .rb-mm-cpage { max-width: 55vw; }
}

@media (min-width: 900px) {
  .rb-mm-sidenav-backdrop { display: none !important; }
}

/* Pagination (daftar voucher / user / sesi aktif) */
.rb-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius);
  background: var(--rb-card);
}
.rb-pagination-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.rb-pagination-info {
  font-size: 0.85rem;
}
.rb-pagination-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Status monitor profile (seperti indikator Mikhmon) */
.rb-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}
.rb-dot-green {
  background: var(--rb-success);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}
.rb-dot-orange {
  background: var(--rb-warn);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}
.rb-td-icon { width: 2rem; text-align: center; }
