:root {
  --bg-top: #f2f6e7;
  --bg-bottom: #e7eef7;
  --ink: #1f2a37;
  --ink-muted: #4b5a6a;
  --card: #ffffff;
  --accent: #0e9f6e;
  --accent-2: #0b6bcb;
  --line: #d8e3ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #ffffff, transparent 45%),
    radial-gradient(circle at 90% 10%, #d5e9ff, transparent 38%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  min-height: 100vh;
}

.wrap {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.hidden {
  display: none !important;
}

/* ── Hero ─────────────────────────────────────────── */
.hero {
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, #083344, #0f766e 65%, #10b981);
  color: #f0fdf4;
  box-shadow: 0 12px 28px rgba(8, 51, 68, 0.22);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  flex-shrink: 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: 0.3px;
}

.hero p {
  margin: 8px 0 0;
  color: #d1fae5;
}

#logoutBtn {
  padding: 8px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
}

/* ── Card ─────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  margin-top: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

/* ── Toolbar ──────────────────────────────────────── */
.toolbar {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-refresh-btn {
  flex: 0 0 auto;
}

.toolbar label {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 600;
  white-space: nowrap;
}

select,
input,
button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

button {
  background: linear-gradient(135deg, var(--accent-2), #2563eb);
  color: #fff;
  border: none;
  cursor: pointer;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--ink);
  border: 1px solid var(--line) !important;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* ── Search ───────────────────────────────────────── */
#searchWrapper {
  margin-top: 10px;
  position: relative;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.search-input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 159, 110, 0.18);
}

.search-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

#searchInput {
  flex: 1 1 0;
  border: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}

#searchInput::placeholder {
  color: var(--ink-muted);
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  line-height: 1;
}

.search-clear-btn:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.search-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(14, 159, 110, 0.2);
  border-top-color: #0e9f6e;
  border-radius: 50%;
  animation: searchSpin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes searchSpin {
  to { transform: rotate(360deg); }
}

.search-results-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 1000;
}

.search-loading,
.search-empty {
  padding: 14px 16px;
  color: var(--ink-muted);
  font-size: 14px;
}

.search-date-group {
  padding: 5px 14px 3px;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-date-group:first-child {
  border-top: none;
}

.search-result-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: #fff;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
}

.search-result-row:hover {
  background: #f0fdf4;
}

.search-result-tujuan {
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}

.search-result-meta {
  font-size: 12px;
  color: var(--ink-muted);
}

.search-highlight {
  background: #fef08a;
  border-radius: 2px;
}

.search-flash-row {
  animation: row-flash 1.6s ease-out forwards;
}

.vehicle-allocation-row.search-flash-row {
  animation: row-flash 1.6s ease-out forwards;
}

@keyframes row-flash {
  0% { background-color: #fef08a; }
  100% { background-color: transparent; }
}

/* ── Vehicle list — mirror GAS .card-vehicle-top .vehicle-list exactly ── */
#vehicleInfoCard {
  width: 100%;
  margin-top: 18px;
  margin-bottom: 18px;
  font-size: 14px;
}

#vehicleInfoCard h2 {
  font-size: 18px;
  margin: 0;
}

.vehicle-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cleanup-duplicates-btn {
  background: #ef4444;
  color: #fff;
  border: 1px solid #dc2626 !important;
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

.cleanup-duplicates-btn:hover {
  background: #dc2626;
}

.vehicle-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 0;
  /* Default stretch: same card height per row (GAS parity). */
  align-items: stretch;
}

.vehicle-item {
  appearance: none;
  border: 2px solid #d7e3ee;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  width: 100%;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  font-family: inherit;
  font-size: inherit;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.vehicle-item:hover {
  transform: translateY(-1px);
  border-color: #7dd3c4;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.vehicle-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 8px 0;
  line-height: 1.2;
  color: var(--ink);
}

.vehicle-stats {
  display: grid;
  gap: 4px;
}

/* GAS: "Alokasi:" / "Sisa:" labels side by side, values stacked below each label. */
.vehicle-stat-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 16px;
  align-items: flex-start;
}

.vehicle-stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.vehicle-stat-label {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
  line-height: 1.2;
}

.vehicle-stat-number {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.vehicle-stat-number.is-zero {
  color: #dc2626;
  font-weight: 700;
}

.vehicle-stat-total {
  font-size: 12px;
  color: #7a8795;
  margin-top: 8px;
}

.vehicle-stat-sewa {
  font-size: 14px;
  color: #92400e;
  font-weight: 600;
  margin-top: 2px;
}

.vehicle-sewa-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 4px;
}

.plate-gps-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}

#vehicleDetailModal .plate-gps-inline,
#allocListModal .plate-gps-inline,
#queueModal .plate-gps-inline {
  display: block;
  margin: 4px 0 0;
  margin-left: 0;
}

.gps-location-link {
  color: #0284c7;
  font-weight: 600;
  text-decoration: underline;
  font-size: 12px;
}

.gps-location-link:hover {
  color: #0369a1;
}

.gps-no-badge {
  display: inline-block;
  background: #ef94d8;
  color: #1e293b;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
}

.plate-picker {
  position: relative;
}

.plate-picker__native-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.plate-picker__trigger {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 36px 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  position: relative;
}

.plate-picker__trigger::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #64748b;
  transform: translateY(-25%);
  pointer-events: none;
}

.plate-picker__trigger:focus {
  outline: 2px solid #0e9f6e;
  outline-offset: 1px;
}

.plate-picker__list {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.plate-picker__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.plate-picker__item:hover {
  background: #f8fafc;
}

.plate-picker__item.is-selected {
  background: #ecfdf5;
  font-weight: 700;
}

.plate-picker__item.is-allocated {
  color: #92400e;
}

.plate-picker__item.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.plate-picker__label {
  flex: 1 1 auto;
  min-width: 0;
}

.plate-picker__gps {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

/* ── Toolbar actions ──────────────────────────────── */
.toolbar-actions {
  display: flex;
  gap: 8px;
  margin-left: 8px;
}

.btn-laporan {
  background: #8b5cf6;
  border: 1px solid #7c3aed;
}

.btn-ritase {
  background: #d97706;
  border: 1px solid #b45309;
}

.cleanup-duplicates-btn {
  background: #ef4444;
  color: #fff;
  margin-left: 8px;
  border: 1px solid #dc2626;
}

/* ── Date info ────────────────────────────────────── */
.date-info {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 600;
}

/* ── Back to top ──────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #059669);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.35);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.back-to-top:hover {
  transform: translateY(-2px);
}

/* ── Update notice ────────────────────────────────── */
.update-notice {
  margin-top: 16px;
  border-radius: 14px;
  background: #fef9c3;
  border: 1px solid #fde047;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.update-notice.hidden {
  display: none !important;
}

.update-notice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.update-notice-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: #854d0e;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.update-notice-icon {
  font-size: 16px;
}

.update-notice-caret {
  font-size: 11px;
}

.update-notice-dismiss-all {
  background: rgba(255, 255, 255, 0.6);
  border: none;
  border-radius: 8px;
  color: #854d0e;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  box-shadow: none;
}

.update-notice-dismiss-all:hover {
  background: rgba(255, 255, 255, 0.9);
}

.update-notice-list {
  border-top: 1px solid #fde047;
  padding: 6px 0;
  max-height: 280px;
  overflow-y: auto;
}

.update-notice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
  border-bottom: 1px solid #fef08a;
  border-radius: 0;
  box-shadow: none;
}

.update-notice-item:last-child {
  border-bottom: none;
}

.update-notice-item:hover {
  background: #fef08a;
}

.update-notice-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.update-notice-item-label {
  font-weight: 700;
  font-size: 13px;
  color: #854d0e;
}

.update-notice-item-sub {
  font-size: 12px;
  color: #a16207;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.update-notice-item-action {
  font-size: 12px;
  font-weight: 700;
  color: #0e9f6e;
  white-space: nowrap;
}

/* ── Tabs ─────────────────────────────────────────── */
.tab-bar {
  display: none;
  background: #e2eaf5;
  border-radius: 16px;
  padding: 5px;
  gap: 5px;
  margin-top: 16px;
  margin-bottom: 14px;
}

.tab-btn {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 14px 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.18s;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.tab-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.tab-pane.hidden {
  display: none;
}

.coming-soon {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-muted);
}

.coming-soon .coming-soon-emoji {
  font-size: 42px;
  display: block;
  margin-bottom: 12px;
}

/* ── Table ────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Scrollable container for the laporan table: header stays visible, body
   rows scroll vertically inside a fixed-height box (matches GAS). */
.laporan-table-scroll {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 12px;
  background: #fff;
}

.laporan-pemesan-link {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f766e;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.laporan-pemesan-link:hover {
  color: #0b5f58;
  text-decoration: underline;
}

.laporan-pemesan-link:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
  border-radius: 4px;
}

.laporan-pemesan-link:disabled {
  color: inherit;
  cursor: default;
  text-decoration: none;
  font-weight: 600;
}

.laporan-pemesan-name {
  display: block;
}

.laporan-pemesan-email {
  display: block;
  font-size: 0.82em;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
}

.laporan-pemesan-link:hover .laporan-pemesan-email {
  color: #475569;
}

.laporan-pemesan-link:disabled .laporan-pemesan-email {
  color: #64748b;
}

/* Laporan panel (sits below Daftar Tujuan, like GAS) — hidden by default */
.laporan-card {
  display: none;
  margin-top: 18px;
}
.laporan-card.open {
  display: block;
}

.laporan-table-scroll .laporan-table {
  margin-top: 0;
}

.laporan-table-scroll .laporan-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  box-shadow: 0 1px 0 #e2e8f0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--ink-muted);
  font-weight: 700;
  white-space: nowrap;
}

.col-pemesan {
  width: 160px;
  min-width: 160px;
  word-break: break-word;
  white-space: normal;
}

.col-kendaraan {
  width: 110px;
  min-width: 110px;
  white-space: normal;
  word-break: break-word;
}

.col-jml {
  width: 40px;
  min-width: 40px;
  text-align: center;
}

.col-jam {
  width: 70px;
  min-width: 70px;
}

.col-durasi {
  width: 90px;
  min-width: 90px;
  text-align: center;
}

.col-dari,
.col-tujuan {
  width: 160px;
  min-width: 140px;
  white-space: normal;
  word-break: break-word;
}

.col-aksi {
  width: 90px;
  min-width: 90px;
}

.detail-row td {
  background: #e0f2fe;
  color: #1e3a8a;
  font-size: 13px;
}

/* Saat Detail terbuka: baris data atas ikut highlight. */
.compact-table tr.detail-open > td,
table tr.detail-open > td {
  background: #e0f2fe;
}

body.is-mobile .compact-table tr.detail-open > td,
body.is-mobile table tr.detail-open > td {
  background: #e0f2fe;
}

.detail-row .detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.detail-field-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 3px;
}

.detail-field-value {
  font-size: 13px;
  color: var(--ink);
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.btn-stack > button {
  width: 100%;
  text-align: center;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

.assign-btn .btn-spinner {
  border-color: rgba(255, 255, 255, 0.85);
  border-top-color: transparent;
}

.alokasi-btn.is-saved-flash,
.cancel-btn.is-saved-flash {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.cancel-btn .btn-spinner,
.alokasi-btn .btn-spinner {
  border-color: rgba(255, 255, 255, 0.85);
  border-top-color: transparent;
}

.vehicle-return-btn .btn-spinner {
  border-color: rgba(255, 255, 255, 0.85);
  border-top-color: transparent;
}

.detail-btn {
  border: 1px solid #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.detail-btn:hover {
  background: #bfdbfe;
}

.assign-btn {
  background: linear-gradient(135deg, #0e9f6e, #059669);
  color: #fff;
  border: none;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.assign-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

.assign-btn:disabled,
.assign-btn:disabled:hover {
  background: #9ca3af;
  color: #eef2f7;
  cursor: not-allowed;
}

.alokasi-btn {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #fff;
  border: none;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.alokasi-btn:hover {
  background: linear-gradient(135deg, #b45309, #d97706);
}

.cancel-btn {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  border: none;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}

.cancel-btn:hover {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.hapus-pesanan-btn {
  background: linear-gradient(135deg, #1f2937, #374151);
  color: #fff;
  border: none;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}

.hapus-pesanan-btn:hover {
  background: linear-gradient(135deg, #111827, #1f2937);
}

.hapus-pesanan-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.request-status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.request-status-badge.is-complete {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.request-status-badge.is-under {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.request-status-badge.is-partial {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.pemesan-name {
  font-weight: 700;
  font-size: 16px;
}

.cell-stack {
  display: grid;
  gap: 4px;
}

.days-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
  margin-top: 4px;
  white-space: nowrap;
}

.days-badge.is-continuation {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.pemesan-phone-link {
  font-size: 12px;
  display: block;
  margin-top: 2px;
  color: #0f766e;
  text-decoration: none;
}

.pemesan-phone-link:hover {
  text-decoration: underline;
}

.pemesan-email {
  font-size: 12px;
  display: block;
  color: var(--ink-muted);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-muted);
}

/* ── Mobile pemesan list ──────────────────────────── */
.pemesan-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.pemesan-item-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
}

.pemesan-item-info {
  flex: 1;
  min-width: 0;
}

.pemesan-item-name {
  font-size: 16px;
  font-weight: 800;
  display: block;
  line-height: 1.2;
}

.pemesan-item-meta {
  font-size: 13px;
  color: var(--ink-muted);
  display: block;
  margin-top: 4px;
  line-height: 1.4;
}

.pemesan-item-tujuan {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

/* ── Modal (match GAS assign modal) ──────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.modal-box--wide {
  width: min(720px, 100%);
}

.alloc-list-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alloc-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}

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

.alloc-list-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 4px;
}

.alloc-list-meta {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.45;
}

.alloc-list-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.alloc-list-empty {
  text-align: center;
  color: var(--ink-muted);
  padding: 24px 12px;
  font-size: 14px;
}

.modal-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.modal-sub {
  margin: 0 0 16px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.45;
}

.modal-field {
  margin-bottom: 12px;
}

.modal-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.modal-field select,
.modal-field input[type="text"],
.modal-field input[type="time"] {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
  background: #fff;
}

.sewa-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.driver-warning {
  margin: 6px 0 0;
  font-size: 12px;
  color: #b45309;
}

.own-driver-back {
  display: none;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.own-driver-back.is-visible {
  display: inline-block;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.modal-actions #modalSaveBtn {
  background: linear-gradient(135deg, #0e9f6e, #059669);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.modal-actions #modalSaveBtn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.modal-actions #cancelAllocBtn {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.modal-actions #cancelAllocBtn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.pemesan-item-chevron {
  font-size: 22px;
  color: #9ba8b8;
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.2s ease;
}

.pemesan-item.open .pemesan-item-chevron {
  transform: rotate(90deg);
}

.pemesan-item-detail {
  display: none;
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
  background: #e0f2fe;
}

.pemesan-item.open .pemesan-item-detail {
  display: block;
}

/* Mobile accordion: header + kartu ikut highlight saat Detail/accordion terbuka. */
.pemesan-item.open {
  background: #e0f2fe;
}

.pemesan-item.open .pemesan-item-header {
  background: #e0f2fe;
}

.pemesan-item-actions {
  display: none;
}

.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

/* ── Login overlay ────────────────────────────────── */
#loginOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

#loginFormBox,
#loginSentBox {
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

#loginSentBox {
  text-align: center;
}

/* ── Loading overlay ──────────────────────────────── */
#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(160deg, #ecfdf5, #d1fae5 60%, #a7f3d0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.loading-ring {
  width: 52px;
  height: 52px;
  border: 5px solid rgba(14, 159, 110, 0.2);
  border-top-color: #0e9f6e;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loading-label {
  font-size: 15px;
  color: #065f46;
  letter-spacing: 0.03em;
  font-weight: 600;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ── Responsive (CSS media) ───────────────────────── */
@media (max-width: 900px) {
  body {
    /* fallback if is-mobile class not applied yet */
  }
}

/* Mobile vehicle grid (tab Kendaraan) */
.vehicle-grid-mobile {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 10px;
}

.vehicle-card-m {
  appearance: none;
  background: #fff;
  border: 2px solid #d7e3ee;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  font-family: inherit;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.vehicle-card-m-type {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

body.is-mobile .vehicle-card-m {
  padding: 12px 14px;
}

body.is-mobile .vehicle-card-m-type {
  font-size: 15px;
  font-weight: 600;
}

body.is-mobile .vehicle-grid-mobile .vehicle-stat-line {
  font-size: 13px;
  gap: 14px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

body.is-mobile .vehicle-grid-mobile .vehicle-stat-number {
  font-size: 13px;
}

body.is-mobile .vehicle-grid-mobile .vehicle-stat-total {
  font-size: 12px;
  margin-top: 8px;
}

body.is-mobile .vehicle-grid-mobile .vehicle-stat-sewa {
  font-size: 12px;
}

/* Force mobile layout via body class (set by JS like GAS) */
body.is-mobile .tab-bar {
  display: flex !important;
}

body.is-mobile .desktop-only {
  display: none !important;
}

body.is-mobile .mobile-only {
  display: block !important;
}

body.is-mobile #vehicleInfoCard {
  display: none !important; /* GAS hides card-vehicle-top on mobile */
}

body.is-mobile .wrap {
  padding: 14px 12px 36px;
}

body.is-mobile .hero h1 {
  font-size: 22px;
}

body.is-mobile .hero-logo {
  height: 40px;
  padding: 4px 8px;
}

body.is-mobile .hero-heading {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

body.is-mobile .toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

body.is-mobile .toolbar-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
}

body.is-mobile .toolbar-field label {
  display: inline-block;
  margin: 0;
  min-width: 62px;
  font-size: 13px;
  flex: 0 0 auto;
}

body.is-mobile .toolbar-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

body.is-mobile .toolbar-field-month select {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

body.is-mobile .toolbar-field-date select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

body.is-mobile .toolbar select,
body.is-mobile .toolbar button {
  min-height: 40px;
  font-size: 14px;
}

body.is-mobile .toolbar #refreshBtn {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
  padding: 0 12px;
}

/* Toolbar action buttons (Laporan/Ritase/Bersihkan Duplikat) only for desktop.
   Mobile already has tab bar for Laporan/Ritase. */
body.is-mobile .toolbar-actions,
body.is-mobile .cleanup-duplicates-btn {
  display: none !important;
}

body.is-mobile .pemesan-item {
  border-radius: 18px;
  margin-bottom: 14px;
}

body.is-mobile .pemesan-item-header {
  padding: 16px;
}

body.is-mobile .pemesan-item-name {
  font-size: 20px;
  font-weight: 800;
}

body.is-mobile .pemesan-item-meta {
  font-size: 15px;
  margin-top: 6px;
}

body.is-mobile .pemesan-item-tujuan {
  font-size: 16px;
}

body.is-mobile .pemesan-item-actions {
  padding: 0 12px 12px;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 6px;
}

body.is-mobile .pemesan-item-actions .detail-btn,
body.is-mobile .pemesan-item-actions .assign-btn,
body.is-mobile .pemesan-item-actions .alokasi-btn,
body.is-mobile .pemesan-item-actions .cancel-btn,
body.is-mobile .pemesan-item-actions .hapus-pesanan-btn {
  flex: 1 1 0;
  min-width: 0;
  width: auto !important;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  white-space: nowrap;
}

body.is-mobile .search-input-row input {
  min-height: 46px;
  font-size: 16px;
}

body.is-mobile .tab-btn {
  min-height: 44px;
  font-size: 14px;
  font-weight: 700;
}

/* Also keep CSS media query for browsers without JS body class yet */
@media (max-width: 900px) {
  .tab-bar {
    display: flex;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  #vehicleInfoCard {
    display: none;
  }

  .wrap {
    padding: 16px 12px 32px;
  }

  .toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .toolbar-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .toolbar-field label {
    display: inline-block;
    margin: 0;
    min-width: 62px;
    font-size: 13px;
    flex: 0 0 auto;
  }

  .toolbar-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .toolbar-field-month select {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  .toolbar-field-date select {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .toolbar select,
  .toolbar button {
    min-height: 40px;
    font-size: 14px;
  }

  .toolbar #refreshBtn {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    padding: 0 12px;
  }

  .toolbar-actions,
  .cleanup-duplicates-btn {
    display: none !important;
  }

  .pemesan-item-actions {
    padding: 0 12px 12px;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 6px;
  }

  .pemesan-item-actions .detail-btn,
  .pemesan-item-actions .assign-btn,
  .pemesan-item-actions .alokasi-btn,
  .pemesan-item-actions .cancel-btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto !important;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  #loginFormBox,
  #loginSentBox {
    width: 85% !important;
    max-width: 440px !important;
    padding: 40px 28px !important;
    border-radius: 24px !important;
  }
}

/* Vehicle detail modal (klik card Informasi Kendaraan) */
.vehicle-detail-content {
  display: flex;
  flex-direction: column;
  margin: 8px 0 4px;
  min-height: 0;
}

.vehicle-detail-scroll {
  max-height: min(60vh, 520px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.vehicle-detail-count {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 10px;
}

.vehicle-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

.vehicle-detail-toolbar .vehicle-detail-count {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.vehicle-detail-find {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  flex: 0 0 auto;
  max-width: 100%;
}

.vehicle-detail-find input {
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  padding: 6px 10px;
  width: 130px;
  min-width: 0;
  color: var(--ink);
}

.vehicle-detail-find input::placeholder {
  color: var(--ink-muted);
}

.vehicle-detail-find-nav {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.vehicle-detail-find-nav button {
  border: 0;
  background: #f8fafc;
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1;
  padding: 3px 7px;
  cursor: pointer;
  min-width: 22px;
}

.vehicle-detail-find-nav button:hover {
  background: #eef2f7;
  color: var(--ink);
}

.vehicle-detail-find-nav button + button {
  border-top: 1px solid var(--line);
}
.vehicle-detail-empty {
  color: var(--ink-muted);
  font-size: 14px;
  margin: 8px 0;
}
.vehicle-allocation-list {
  display: grid;
  gap: 10px;
}
.vehicle-allocation-row {
  border: 1px solid #d7e3ee;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}
.vehicle-allocation-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.vehicle-allocation-copy {
  min-width: 0;
  flex: 1;
}
.vehicle-allocation-person {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.vehicle-allocation-destination {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.4;
}
.vehicle-allocation-unit {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink);
}
.vehicle-allocation-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}
.vehicle-return-btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  font-family: inherit;
  white-space: nowrap;
}
.vehicle-return-btn:hover { filter: brightness(1.05); }
.vehicle-edit-btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  font-family: inherit;
  white-space: nowrap;
}
.vehicle-edit-btn:hover { filter: brightness(1.05); }
.alloc-list-empty {
  padding: 16px 4px;
  color: var(--ink-muted, #64748b);
  font-size: 14px;
}
.alloc-list-count {
  font-size: 13px;
  color: var(--ink-muted, #64748b);
  margin: 0 0 10px;
}
.vehicle-returned-badge {
  display: inline-block;
  margin: 6px 0 0;
  padding: 2px 8px;
  background: #e2e8f0;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}
.request-status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.request-status-badge.is-kurang,
.request-status-badge.is-partial {
  background: #fef3c7;
  color: #92400e;
}
.request-status-badge.is-tambah {
  background: #ffedd5;
  color: #9a3412;
}
.request-status-badge.is-lengkap {
  background: #dbeafe;
  color: #1e40af;
}
.request-status-badge.is-selesai,
.request-status-badge.is-complete {
  background: #d1fae5;
  color: #065f46;
}
.vehicle-queue-btn,
.alloc-copy-btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  font-family: inherit;
  white-space: nowrap;
}
.vehicle-queue-btn:hover,
.alloc-copy-btn:hover { filter: brightness(1.05); }
.vehicle-queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vehicle-queue-row {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.vehicle-queue-order {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
}
.vehicle-queue-person {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.vehicle-queue-meta {
  margin: 0;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}
.vehicle-carry-forward-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
body.is-mobile .vehicle-allocation-top {
  flex-direction: column;
}
body.is-mobile .vehicle-allocation-actions {
  width: 100%;
}
body.is-mobile .vehicle-return-btn {
  width: 100%;
  min-height: 40px;
}

body.is-mobile .vehicle-queue-btn,
body.is-mobile .alloc-copy-btn {
  width: 100%;
  min-height: 40px;
}

/* ── Laporan Tab ──────────────────────────────────── */
.laporan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.laporan-title-section {
  flex: 1;
  min-width: 200px;
}

.laporan-header h2 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.laporan-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 400;
}

.laporan-header-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-close {
  appearance: none;
  border: 1px solid #94a3b8;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-close:hover {
  background: #f1f5f9;
  border-color: #64748b;
}

.laporan-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 14px 0 0 0;
  padding: 0 0 0 0;
  border-bottom: 2px solid #e2e8f0;
  position: relative;
}

.laporan-tab-btn {
  appearance: none;
  border: 1.5px solid transparent;
  background: transparent;
  color: #64748b;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  border-radius: 10px 10px 0 0;
  margin-bottom: -2px;
  position: relative;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.laporan-tab-btn:hover {
  background: #f8fafc;
  color: #334155;
}

/* Per-tab visual differentiation matching GAS: each tab has its own color
   theme, and the active tab gets a colored box (top + sides) that visually
   pops out from the rest. The colored bottom border on the .laporan-tabs
   container stays in place so the underline runs behind the active tab. */
.laporan-tab-btn[data-mode="allocated"] {
  color: #047857;
}
.laporan-tab-btn[data-mode="allocated"]:hover {
  background: #ecfdf5;
}
.laporan-tab-btn[data-mode="allocated"].active {
  color: #047857;
  background: #ecfdf5;
  border-color: #0e9f6e;
  border-bottom-color: #ecfdf5;
  font-weight: 700;
  box-shadow: 0 -2px 6px rgba(14, 159, 110, 0.08);
}

.laporan-tab-btn[data-mode="unallocated"] {
  color: #b45309;
}
.laporan-tab-btn[data-mode="unallocated"]:hover {
  background: #fffbeb;
}
.laporan-tab-btn[data-mode="unallocated"].active {
  color: #b45309;
  background: #fffbeb;
  border-color: #f59e0b;
  border-bottom-color: #fffbeb;
  font-weight: 700;
  box-shadow: 0 -2px 6px rgba(245, 158, 11, 0.08);
}

.laporan-tab-btn[data-mode="all"] {
  color: #1d4ed8;
}
.laporan-tab-btn[data-mode="all"]:hover {
  background: #eff6ff;
}
.laporan-tab-btn[data-mode="all"].active {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #3b82f6;
  border-bottom-color: #eff6ff;
  font-weight: 700;
  box-shadow: 0 -2px 6px rgba(59, 130, 246, 0.08);
}

.laporan-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-export {
  background: linear-gradient(135deg, #0e9f6e, #059669);
  color: #fff;
  border: 1px solid #047857;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-export:hover {
  background: linear-gradient(135deg, #047857, #065f46);
}

.btn-print {
  background: linear-gradient(135deg, #0e9f6e, #059669);
  color: #fff;
  border: 1px solid #047857;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-print:hover {
  background: linear-gradient(135deg, #047857, #065f46);
}

.laporan-table {
  margin-top: 12px;
  /* Auto layout so the table expands to its natural width; long text
     columns (Pemesan, Tujuan, Dept, Event) wrap to multiple lines like
     GAS, while short columns (No., Plat, Jam, etc.) stay on one line. */
  table-layout: auto;
  width: 100%;
  border-collapse: collapse;
}

.laporan-table th {
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
  line-height: 1.3;
}

.laporan-table td {
  padding: 10px 8px;
  font-size: 13px;
  vertical-align: top;
  line-height: 1.4;
}

.laporan-table tbody tr:hover {
  background: #f0fdf4;
}

.laporan-carry-note {
  margin-top: 4px;
  display: block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.cell-empty {
  color: #cbd5e1;
  text-align: center;
}

.col-no {
  width: 40px;
  min-width: 40px;
  text-align: center;
  white-space: nowrap;
}

.col-status {
  width: 100px;
  min-width: 100px;
  text-align: center;
  white-space: nowrap;
}

.col-status-l {
  width: 100px;
  min-width: 100px;
  white-space: nowrap;
}

.col-pemesan {
  width: 160px;
  min-width: 160px;
}

.col-kendaraan {
  width: 100px;
  min-width: 100px;
  white-space: nowrap;
}

/* Kolom "Kendaraan Diperlukan" di laporan unallocated/all: sempit + text wrap. */
.laporan-table .col-kendaraan-wrap {
  width: 110px;
  min-width: 110px;
  max-width: 150px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.35;
}

.col-plat {
  width: 90px;
  min-width: 90px;
  white-space: nowrap;
}

.col-supir {
  width: 11.5em;
  min-width: 11.5em;
  max-width: 13em;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.35;
}

.col-jam {
  width: 9.5em;
  min-width: 9.5em;
  text-align: left;
  white-space: normal;
  word-break: normal;
  line-height: 1.35;
}

.col-durasi {
  width: 90px;
  min-width: 90px;
  text-align: center;
  white-space: nowrap;
}

.col-dari {
  width: 140px;
  min-width: 140px;
}

.col-dept {
  width: 110px;
  min-width: 110px;
}

.col-tujuan,
.col-event {
  min-width: 150px;
  /* Long text wraps to multiple lines (matches GAS). */
}

/* GAS uses "Semua baris" by default — pagination is hidden unless the user
   picks a smaller rpp. Match that by default. */
.laporan-pagination {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.laporan-page-info,
.laporan-page-num {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 600;
}

.laporan-page-btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}

.laporan-page-btn:hover:not(:disabled) {
  background: #f1f5f9;
}

.laporan-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.laporan-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-muted);
  font-size: 14px;
}

/* ── Ritase Tab ───────────────────────────────────── */
.ritase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ritase-header h2 {
  margin: 0;
  font-size: 18px;
  flex: 1;
}

.ritase-actions {
  display: flex;
  gap: 8px;
}

.ritase-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 70vh;
}

.ritase-form-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 860px;
  font-size: 11px;
  color: #111827;
}

.ritase-form-table th,
.ritase-form-table td {
  border: 1px solid #94a3b8;
  padding: 4px 6px;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ritase-form-table thead th {
  background: #e2e8f0;
  text-align: center;
  font-weight: 800;
}

.ritase-form-table .col-no { width: 36px; text-align: center; }
.ritase-form-table .ritase-center { text-align: center; }
.ritase-form-table .ritase-muted { color: #475569; }
.ritase-form-table .ritase-bold { font-weight: 700; }

.ritase-form-table tbody tr:hover {
  background: #f0fdf4;
}

/* Ritase Estafet (Dashboard Order Room) — mirror GAS layout exactly:
   fixed columns, left-aligned, compact padding, larger monospace text
   for legibility without wasting horizontal space. */
.ritase-estafet-table {
  font-family: "Consolas", "Courier New", monospace;
  min-width: 1000px;
  font-size: 13px;
}

.ritase-estafet-table th,
.ritase-estafet-table td {
  border-color: #6b7280;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ritase-estafet-table thead th {
  background: #e5e7eb;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.ritase-estafet-table .col-driver { width: 220px; }
.ritase-estafet-table .col-fase { width: 300px; }

.ritase-estafet-table .driver-cell {
  white-space: pre-line;
  font-weight: 700;
  line-height: 1.5;
}

.ritase-estafet-table .phase-cell {
  white-space: normal;
  line-height: 1.5;
}

.ritase-estafet-table .phase-empty {
  color: #64748b;
  font-style: italic;
}

.ritase-estafet-table .phase-warning {
  color: #b45309;
  font-weight: 700;
}

.ritase-estafet-table tbody tr + tr td {
  border-top-width: 2px;
}

@media (max-width: 768px) {
  .ritase-estafet-table,
  .ritase-form-table.ritase-estafet-table {
    font-size: 20px;
  }
  .ritase-estafet-table th,
  .ritase-estafet-table td {
    padding: 10px 12px;
  }
  .ritase-estafet-table .col-no { width: 60px; }
  .ritase-estafet-table .col-driver { width: 220px; }
  .ritase-estafet-table .col-fase { width: 380px; }
  .ritase-estafet-table { min-width: 1600px; }
}

.phase-validation-btn {
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  background: #0ea5e9;
  color: #fff;
  cursor: pointer;
  font-size: inherit !important;
  font-weight: 600;
  display: block;
  width: 100%;
  text-align: center;
}

.phase-validation-btn:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
  cursor: not-allowed;
}

.ritase-estafet-table th.planner-col {
  background: #dbeafe;
  color: #1e40af;
}

.ritase-estafet-table th.driver-col {
  background: #fef3c7;
  color: #92400e;
}

.ritase-estafet-table th.validator-col {
  background: #d1fae5;
  color: #065f46;
}

.ritase-estafet-table th.checker-col {
  background: #fee2e2;
  color: #991b1b;
}

.ritase-status-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.ritase-status-btn {
  appearance: none;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}

.ritase-status-btn.pending {
  background: #e2e8f0;
  color: #475569;
}

.ritase-status-btn.approved {
  background: #d1fae5;
  color: #065f46;
}

.ritase-status-btn.rejected {
  background: #fee2e2;
  color: #991b1b;
}

.ritase-status-btn:hover {
  filter: brightness(0.95);
}

.ritase-status-time {
  font-size: 10px;
  color: var(--ink-muted);
}

.ritase-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-muted);
  font-size: 14px;
}

/* Mobile responsiveness for Laporan and Ritase */
body.is-mobile .laporan-header,
body.is-mobile .ritase-header {
  flex-direction: column;
  align-items: flex-start;
}

body.is-mobile .laporan-modes,
body.is-mobile .ritase-actions,
body.is-mobile .laporan-actions {
  width: 100%;
  justify-content: flex-start;
}

body.is-mobile .laporan-mode-btn {
  flex: 1;
  min-width: 0;
}

body.is-mobile .laporan-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: 100%;
  overflow: visible;
}

body.is-mobile .laporan-tab-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 6px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-label-short {
  display: none;
}

body.is-mobile .tab-label-full {
  display: none;
}

body.is-mobile .tab-label-short {
  display: inline;
}

body.is-mobile .laporan-pagination {
  flex-direction: column;
  align-items: flex-start;
}

/* ── Validator Role Mode (mirror GAS) ─────────────────
   Non-admin: boleh lihat dashboard / laporan / ritase / print-export,
   tetapi tombol mutasi disembunyikan.
*/
body.is-validator #cleanupDuplicatesBtn,
body.is-validator #kirimKeDriverBtn,
body.is-validator #kirimKeDriverMenu,
body.is-validator #kirimKeDriverModal,
body.is-validator #modalSaveBtn,
body.is-validator #cancelAllocBtn,
body.is-validator .assign-btn,
body.is-validator .cancel-btn,
body.is-validator .hapus-pesanan-btn,
body.is-validator .vehicle-return-btn,
body.is-validator .vehicle-edit-btn,
body.is-validator .vehicle-queue-btn {
  display: none !important;
}

/* Menu popup "Kirim ke Driver" */
.kirim-driver-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}

.kirim-driver-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  z-index: 1200;
  min-width: 220px;
  width: max-content;
  max-width: min(280px, 90vw);
  background: #fff !important;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}

.kirim-driver-menu.hidden {
  display: none !important;
}

/* Override global `button` styles so items look like menu rows, not green CTA buttons */
button.kirim-driver-menu-item,
.kirim-driver-menu-item {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: block;
  border: none !important;
  background: transparent !important;
  background-image: none !important;
  text-align: left;
  width: 100%;
  min-height: auto;
  padding: 10px 12px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  cursor: pointer;
  box-shadow: none !important;
  white-space: nowrap;
  line-height: 1.3;
}

button.kirim-driver-menu-item:hover,
.kirim-driver-menu-item:hover {
  background: #f1f5f9 !important;
  background-image: none !important;
  color: #0f172a !important;
}
