html.dark,
html.dark body {
  background-color: #102216;
  color-scheme: dark;
}

/* Dashboard: warna eksplisit (class di template tidak selalu ter-scan Tailwind CDN) */
.dashboard-card {
  background-color: #112217;
  border: 1px solid #326744;
}

.dashboard-filter-input {
  background-color: #23482f;
  border-color: #326744;
  color: #fff;
}

.dashboard-filter-input option {
  background-color: #23482f;
  color: #fff;
}

.dashboard-map-section {
  position: relative;
}

.dashboard-map-card {
  min-height: 0;
}

.dashboard-map-frame {
  position: relative;
  width: 100%;
  height: clamp(420px, calc(100vh - 18rem), 960px);
  flex-shrink: 0;
}

.dashboard-map-frame #vehicle-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0.5rem;
  z-index: 1;
}

.dashboard-orders-toggle.is-active {
  border-color: #13ec5b;
  background-color: rgba(19, 236, 91, 0.15);
  color: #13ec5b;
}

.dashboard-live-orders {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100% - 24px));
  background-color: #112217;
  border: 1px solid #326744;
  border-radius: 12px;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
  transform: translateX(calc(100% + 16px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.dashboard-live-orders.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#vehicle-map.dashboard-map-full {
  min-height: 420px;
  height: 100%;
}

/* Routes page — peta full + panel slide */
.routes-map-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.routes-map-wrap #routes-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  z-index: 1;
}

.routes-panel-toggle.is-active {
  border-color: #13ec5b;
  background-color: rgba(19, 236, 91, 0.15);
  color: #13ec5b;
}

.routes-panel-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  background-color: #112217;
  border-left: 1px solid #326744;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  overflow: hidden;
}

.routes-panel-drawer.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.routes-map-legend {
  backdrop-filter: blur(8px);
}

.routes-legend-check {
  accent-color: #13ec5b;
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.route-orders-table-wrap {
  overflow-x: auto;
}

.route-orders-table {
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.4;
  min-width: 640px;
}

.route-orders-th {
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #92c9a4;
  white-space: nowrap;
  vertical-align: bottom;
}

.route-orders-th--total {
  text-align: right;
}

.route-orders-cell {
  padding: 8px;
  color: #e8f5ec;
  vertical-align: top;
}

.route-orders-cell--place {
  min-width: 130px;
  max-width: 180px;
}

.route-place-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route-place-cell .route-orders-id {
  display: block;
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 1px;
}

.route-place-cell .route-orders-name {
  display: block;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
}

.route-orders-sub {
  display: block;
  font-size: 10px;
  color: #92c9a4;
  line-height: 1.35;
}

.route-orders-meta {
  display: block;
  font-size: 9px;
  color: #6b9a7a;
  margin-top: 2px;
}

.route-orders-cell--items {
  min-width: 160px;
  font-size: 10px;
  color: #c5dcc9;
}

.route-orders-cell--total {
  min-width: 72px;
  text-align: right;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.route-orders-row:last-child {
  border-bottom: none;
}

.routes-panel-tabs {
  background: #112217;
}

.routes-panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
  padding: 12px 8px;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: #92c9a4;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.routes-panel-tab:hover {
  color: #fff;
  background: rgba(35, 72, 47, 0.35);
}

.routes-panel-tab.is-active {
  color: #fff;
  border-bottom-color: #13ec5b;
}

.routes-panel-tab[data-tab='stock'].is-active {
  border-bottom-color: #f59e0b;
}

.routes-panel-tab-count {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(35, 72, 47, 0.8);
  color: #92c9a4;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.routes-panel-tab.is-active .routes-panel-tab-count {
  color: #13ec5b;
  background: rgba(19, 236, 91, 0.15);
}

.routes-panel-tab.is-active .routes-panel-tab-count--stock {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
}

.routes-panel-tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
}

.routes-panel-tab-panel.is-active {
  display: block;
}

.route-panel-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.route-panel-type--order {
  color: #13ec5b;
  background: rgba(19, 236, 91, 0.15);
  border: 1px solid rgba(19, 236, 91, 0.35);
}

.route-status-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.route-time-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.route-stock-table {
  min-width: 560px;
}

.route-map-popup {
  min-width: 180px;
  font-size: 13px;
  line-height: 1.45;
}

.route-map-popup strong {
  color: #fff;
}

.route-map-popup .label {
  color: #92c9a4;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.route-map-popup .slot-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

.routes-panel {
  background-color: #112217;
  border-color: #1f2937;
}

.routes-field {
  background-color: transparent;
  border-color: #374151;
  color: #fff;
}

.routes-field option {
  background-color: #112217;
  color: #fff;
}

#layout-content .routes-page {
  background-color: #102216;
}

#layout-content .routes-panel-drawer {
  background-color: #112217;
}

/* Orders page — warna eksplisit (template tidak ter-scan Tailwind CDN) */
.orders-page,
#layout-content .orders-page {
  background-color: #102216;
}

.orders-card {
  background-color: #112217;
  border-color: #326744;
  color: #fff;
}

.orders-detail {
  background-color: #112217;
  color: #fff;
}

.orders-field {
  background-color: #112217;
  border-color: #326744;
  color: #fff;
}

.orders-field option {
  background-color: #112217;
  color: #fff;
}

#layout-toolbar {
  background-color: #112217;
  border-color: #326744;
}

/* Vehicles page */
.vehicles-page,
#layout-content .vehicles-page {
  background-color: #102216;
}

.vehicles-table-wrap {
  background-color: #112217;
  border-color: #326744;
}

.vehicles-detail {
  background-color: #112217;
  border-color: #326744;
  color: #fff;
}

.vehicles-field {
  background-color: #23482f;
  border-color: #326744;
  color: #fff;
}

/* Analytics page */
.analytics-page,
#layout-content .analytics-page {
  background-color: #102216;
}

.analytics-card {
  background-color: #112217;
  border-color: #326744;
  color: #fff;
}

/* Stock Moving page */
.stock-page,
#layout-content .stock-page {
  background-color: #102216;
}

.stock-card {
  background-color: #112217;
  border-color: #326744;
  color: #fff;
}

.stock-detail {
  background-color: #112217;
  color: #fff;
}

.stock-field {
  background-color: #112217;
  border-color: #326744;
  color: #fff;
}

.stock-field option {
  background-color: #112217;
  color: #fff;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 24px;
}

.material-symbols-outlined.filled {
  font-variation-settings: 'FILL' 1;
}

#routes-map {
  min-height: 320px;
}

.vehicle-map-marker {
  background: transparent !important;
  border: none !important;
}

.leaflet-container {
  background: #e8ecef;
  font-family: inherit;
}

.leaflet-popup-content-wrapper {
  background: #112217;
  color: #fff;
  border-radius: 0.5rem;
  border: 1px solid #326744;
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.4;
  color: #fff !important;
}

.routes-leaflet-popup .leaflet-popup-content-wrapper,
.routes-leaflet-popup .leaflet-popup-tip {
  background: #112217;
}

.leaflet-popup-tip {
  background: #112217;
}
