:root {
  --bg: #171717;
  --panel: #222222;
  --panel-2: #2a2a2a;
  --line: #333333;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --accent: #F59E0B;
  --accent-ink: #1a1100;
  --success: #22c55e;
  --warning: #F59E0B;
  --danger: #ef4444;
  --sidebar-w: 256px;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-body-font-family: 'Inter', system-ui, sans-serif;
  --bs-border-color: var(--line);
}

[x-cloak] {
  display: none !important;
}

body {
  font-family: var(--bs-body-font-family);
  background: var(--bg);
  color: var(--text);
  font-size: .9375rem;
}

.num {
  font-variant-numeric: tabular-nums;
}

.text-accent {
  color: var(--accent);
}

.text-muted {
  color: var(--muted) !important;
}

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

/* Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transform: translateX(-100%);
  transition: transform .2s ease;
}

.sidebar.is-open {
  transform: none;
}

.app-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 1030;
}

@media (min-width: 992px) {
  .sidebar {
    transform: none;
  }

  .app-main {
    margin-left: var(--sidebar-w);
  }

  .app-scrim {
    display: none !important;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.1rem;
}

.brand-text {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
}

.brand-text small {
  display: block;
  font-weight: 500;
  font-size: .75rem;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 .75rem 1rem;
}

.nav-group {
  padding: 1.1rem .75rem .4rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .75rem;
  border-radius: 8px;
  color: #cfcfcf;
  text-decoration: none;
  font-weight: 500;
}

.nav-item-link i {
  font-size: 1.05rem;
  width: 1.2rem;
  text-align: center;
}

.nav-item-link:hover {
  background: var(--panel);
  color: #fff;
}

.nav-item-link.active {
  background: var(--panel);
  color: var(--accent);
  /* box-shadow: inset 3px 0 0 var(--accent); */
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-2);
  font-size: .8rem;
  font-weight: 600;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: .75rem;
  height: 60px;
  padding: 0 1.25rem;
  background: rgba(23, 23, 23, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
}

.btn-icon:hover {
  background: var(--panel);
}

.live-pill {
  align-items: center;
  gap: .45rem;
  padding: .25rem .7rem;
  border-radius: 99px;
  background: var(--panel);
  font-size: .8rem;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

@media (prefers-reduced-motion: no-preference) {
  .live-dot {
    animation: pulse 1.8s ease-in-out infinite;
  }

  @keyframes pulse {
    50% {
      opacity: .35;
    }
  }
}

/* Dashboard full width */
.app-main {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}


.app-content {
    width: 100%;
    max-width: none !important;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding: 24px 28px;
    box-sizing: border-box;
}

/* Tablet */
@media (max-width: 991.98px) {
    .app-content {
        padding: 20px 20px;
    }
}

/* HP */
@media (max-width: 575.98px) {
    .app-content {
        padding: 16px;
    }
}


/* Buttons */
.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border: 0;
}

.btn-accent:hover {
  background: #fbb02c;
  color: var(--accent-ink);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--panel-2);
  color: var(--text);
  border-color: #444;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-head h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.panel-head p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 520px;
  margin: 3rem auto;
}

.empty-state i {
  font-size: 2rem;
  color: var(--accent);
}

.empty-state h2 {
  font-size: 1.15rem;
  margin: .75rem 0 .35rem;
}

.empty-state p {
  color: var(--muted);
}

/* Event header */
.event-head {
  margin-bottom: 1.25rem;
}

.event-switch {
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
  padding: 0;
}

.event-switch small {
  display: block;
  color: var(--muted);
  font-size: .8rem;
}

.event-switch strong {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  margin-top: .6rem;
  color: #bdbdbd;
  font-size: .875rem;
  align-items: center;
}

.event-meta i {
  color: var(--accent);
  margin-right: .4rem;
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 992px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat.tone-success .stat-value {
  color: var(--success);
}

.stat.tone-warning .stat-value {
  color: var(--warning);
}

.stat-label {
  color: var(--text);
  margin-top: .15rem;
}

.stat-note {
  color: var(--muted);
  font-size: .8rem;
}

/* Route (arus checkpoint) */
.route-panel {
  margin-bottom: 1.25rem;
}

.route {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .route {
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
  }
}

.route-stop {
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .route-stop+.route-stop {
    border-left: 1px dashed #444;
  }

  .route-stop:first-child {
    padding-left: 0;
  }
}

.route-code {
  display: inline-block;
  font-weight: 700;
  font-size: .85rem;
  padding: .15rem .55rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
}

.route-count {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  margin: .5rem 0 .4rem;
  font-variant-numeric: tabular-nums;
}

.route-bar,
.meter {
  height: 6px;
  background: var(--panel-2);
  border-radius: 99px;
  overflow: hidden;
}

.route-bar span,
.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

.meter.is-hot span {
  background: var(--danger);
}

.route-name {
  margin-top: .75rem;
  font-weight: 600;
}

.route-detail {
  color: var(--muted);
  font-size: .8rem;
  margin-top: .15rem;
}

/* Tables */
.table-trabas {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
}

.table-trabas th {
  color: var(--muted);
  font-weight: 500;
  font-size: .8rem;
  border-bottom-color: var(--line);
  white-space: nowrap;
}

.table-trabas td {
  padding-top: .65rem;
  padding-bottom: .65rem;
}

.cell-note {
  color: var(--muted);
  font-size: .75rem;
  margin-top: .15rem;
}

.bib {
  display: inline-block;
  min-width: 2.6rem;
  text-align: center;
  padding: .15rem .45rem;
  border-radius: 6px;
  background: rgba(245, 158, 11, .14);
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Badges & tones */
.badge-soft {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-soft.tone-success {
  background: rgba(34, 197, 94, .15);
  color: #4ade80;
}

.badge-soft.tone-warning {
  background: rgba(245, 158, 11, .16);
  color: #fbbf24;
}

.badge-soft.tone-danger {
  background: rgba(239, 68, 68, .16);
  color: #f87171;
}

/* Quota & payments */
.quota+.quota {
  margin-top: 1rem;
}

.quota .meter {
  margin-top: .4rem;
}

.split-bar {
  display: flex;
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  gap: 2px;
  margin-bottom: 1rem;
}

.split-bar span {
  display: block;
  height: 100%;
}

.tone-success.dot,
.split-bar .tone-success {
  background: var(--success);
}

.tone-warning.dot,
.split-bar .tone-warning {
  background: var(--warning);
}

.tone-danger.dot,
.split-bar .tone-danger {
  background: var(--danger);
}

.tone-muted.dot,
.split-bar .tone-muted {
  background: #666;
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .6rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.legend b {
  margin-left: auto;
  font-weight: 600;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Dropdown */
.dropdown-menu {
  --bs-dropdown-bg: var(--panel);
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-link-hover-bg: var(--panel-2);
}

/* ===== Milestone 3: halaman event ===== */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-head h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.01em;
}

.page-head p {
  margin: .3rem 0 0;
  color: var(--muted);
}

.link-plain {
  color: var(--text);
  text-decoration: none;
}

.link-plain:hover {
  color: var(--accent);
}

.badge-soft.tone-muted {
  background: rgba(255, 255, 255, .08);
  color: #bdbdbd;
}

.alert-trabas {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.alert-trabas.is-success {
  border-color: rgba(34, 197, 94, .45);
}

.alert-trabas.is-success>i {
  color: var(--success);
}

.alert-trabas.is-danger {
  border-color: rgba(239, 68, 68, .5);
}

.alert-trabas.is-danger>i {
  color: var(--danger);
}

.form-panel {
  max-width: 960px;
}

.form-label {
  font-size: .85rem;
  color: #cfcfcf;
  margin-bottom: .3rem;
}

.form-control,
.form-select {
  background-color: var(--bg);
  border-color: #3a3a3a;
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem rgba(245, 158, 11, .2);
  color: var(--text);
}

.form-text {
  color: var(--muted);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-section {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.75rem 0 .9rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1.75rem;
}

.tabs-trabas {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  gap: .25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.tabs-trabas .nav-link {
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  white-space: nowrap;
  font-weight: 500;
  padding: .6rem 1rem;
}

.tabs-trabas .nav-link:hover {
  color: var(--text);
}

.tabs-trabas .nav-link.active {
  color: var(--accent);
  background: none;
  border-bottom-color: var(--accent);
}

.detail-list {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: .55rem 1rem;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 400;
}

.detail-list dd {
  margin: 0;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .8rem;
}

.checklist li {
  display: flex;
  gap: .65rem;
  align-items: center;
  color: var(--muted);
}

.checklist li.is-done {
  color: var(--text);
}

.checklist li i {
  color: var(--warning);
}

.checklist li.is-done i {
  color: var(--success);
}

.empty-inline {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #3a3a3a;
  border-radius: 10px;
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  font-size: .9rem;
  display: inline-grid;
}

.btn-icon-sm:disabled {
  opacity: .3;
}

.chip {
  display: inline-block;
  padding: .1rem .55rem;
  margin: .1rem .2rem .1rem 0;
  border-radius: 99px;
  background: var(--panel-2);
  font-size: .8rem;
}

.staff-row {
  padding: .9rem 0;
  border-top: 1px solid var(--line);
}

.staff-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.staff-cp {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.staff-person {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .35rem 0 .35rem 2.4rem;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--line);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
}

/* DataTables mengikuti tema gelap */
.dataTables_wrapper {
  color: var(--text);
}

.dataTables_wrapper .form-control,
.dataTables_wrapper .form-select {
  background-color: var(--bg);
  color: var(--text);
}

.dataTables_info,
.dataTables_length label,
.dataTables_filter label {
  color: var(--muted);
  font-size: .85rem;
}

.page-link {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.page-item.disabled .page-link {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}

table.dataTable thead th {
  border-bottom-color: var(--line) !important;
}

@media (max-width: 575.98px) {
  .detail-list {
    grid-template-columns: 1fr;
    gap: .1rem;
  }

  .detail-list dd {
    margin-bottom: .6rem;
  }
}

/* ===== Tahap 1: login & halaman publik ===== */
.guest-top {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.guest-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text);
  text-decoration: none;
}

.auth-wrap {
  min-height: calc(100vh - 73px);
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2rem 1.75rem;
}

.auth-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  letter-spacing: -.01em;
}

.auth-alt {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: .875rem;
  color: var(--muted);
}

a {
  color: var(--accent);
}

a:hover {
  color: #fbb02c;
}

.public-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ===== Tahap 2: pendaftaran, rider, pass ===== */
.cat-grid {
  display: grid;
  gap: .6rem;
}

.cat-option {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .85rem 1rem;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg);
}

.cat-option:hover {
  border-color: #555;
}

.cat-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.cat-option input {
  accent-color: var(--accent);
  width: 1.1rem;
  height: 1.1rem;
}

.cat-option.is-full {
  opacity: .45;
  cursor: not-allowed;
}

.cat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  line-height: 1.3;
}

.cat-body small {
  color: var(--muted);
}

.event-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text);
}

.event-card:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.chip-filter {
  padding: .35rem .85rem;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: .875rem;
}

.chip-filter.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

.qr-preview {
  width: 100%;
  max-width: 240px;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
}

/* ===== Milestone 5: scanner ===== */
.scanner {
  max-width: 560px;
  margin: 0 auto;
}

.scanner-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.scanner-view {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.scanner-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: .75rem 0;
}

.scan-result {
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
  border: 2px solid var(--line);
  background: var(--panel);
  transition: background .15s, border-color .15s;
}

.scan-label {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.scan-bib {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.scan-name {
  font-size: 1.15rem;
  font-weight: 600;
}

.scan-msg {
  color: #d4d4d4;
  margin-top: .35rem;
}

.scan-result.is-success {
  background: rgba(34, 197, 94, .18);
  border-color: var(--success);
}

.scan-result.is-warning {
  background: rgba(245, 158, 11, .18);
  border-color: var(--warning);
}

.scan-result.is-danger {
  background: rgba(239, 68, 68, .2);
  border-color: var(--danger);
}

.scanner-manual {
  margin-top: 1rem;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .4rem;
}

.recent-list li {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  padding: .4rem .6rem;
  border-left: 3px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
}

.recent-list li strong {
  flex: 1;
  font-weight: 500;
}

.recent-list li em {
  font-style: normal;
  font-size: .8rem;
  color: var(--muted);
}

.recent-list li.tone-success {
  border-left-color: var(--success);
}

.recent-list li.tone-warning {
  border-left-color: var(--warning);
}

.recent-list li.tone-danger {
  border-left-color: var(--danger);
}