:root {
  color-scheme: light;
  --ad-ink: #1f2430;
  --ad-primary: #fc5f00;
  --ad-primary-dark: #d44f00;
  --ad-primary-deep: #b13f00;
  --ad-primary-light: #ff8a3d;
  --ad-primary-rgb: 252, 95, 0;
  --ad-primary-soft: #fff1e8;
  --ad-primary-softer: #fff8f3;
  --ad-grad: linear-gradient(135deg, #ff7a1f 0%, #fc5f00 55%, #e04e00 100%);
  --ad-link: #d44f00;
  --ad-link-hover: #b13f00;
  --ad-accent: #ff8a3d;
  --ad-bg: #faf7f4;
  --ad-card: #ffffff;
  --ad-surface-2: #f6f1ec;
  --ad-input-bg: #ffffff;
  --ad-border: #efe6df;
  --ad-border-strong: #e5dbd2;
  --ad-text: #1f2430;
  --ad-muted: #6b7280;
  --ad-label: #374151;
  --ad-th-text: #7c5a45;
  --ad-sidebar-bg: #ffffff;
  --ad-nav-text: #4b5563;
  --ad-nav-icon: #9ca3af;
  --ad-group: #a8a29e;
  --ad-topbar-bg: rgba(255, 255, 255, .92);
  --ad-radius: 14px;
  --ad-shadow: 0 1px 2px rgba(120, 53, 15, .04), 0 6px 20px rgba(120, 53, 15, .06);
  --ad-shadow-lg: 0 24px 60px rgba(120, 53, 15, .18);
  --ad-sidebar-w: 264px;
  --ad-ok-bg: #e8f8f0; --ad-ok-text: #0f6b43; --ad-ok-border: #b5e8cf;
  --ad-bad-bg: #fdecec; --ad-bad-text: #a12020; --ad-bad-border: #f5c2c2;
  --ad-info-text: #8a3200; --ad-info-border: #ffd9c2;
  --ad-busy-bg: #fff4e0; --ad-busy-border: #ffe2b0;

  --bs-primary: var(--ad-primary);
  --bs-primary-rgb: 252, 95, 0;
  --bs-link-color: var(--ad-link);
  --bs-link-hover-color: var(--ad-link-hover);
  --bs-link-color-rgb: 212, 79, 0;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: var(--ad-text);
  --bs-body-bg: var(--ad-bg);
  --bs-border-color: var(--ad-border);
  --bs-border-radius: 10px;
  --bs-focus-ring-color: rgba(252, 95, 0, .2);
}

/* ---------- Tema gelap (Bootstrap 5.3: data-bs-theme="dark" pada <html>) ---------- */
[data-bs-theme="dark"] {
  color-scheme: dark;
  --ad-ink: #f4f4f6;
  --ad-primary: #ff6a14;
  --ad-primary-dark: #e85a00;
  --ad-primary-deep: #ff8a3d;
  --ad-primary-light: #ff9a57;
  --ad-primary-soft: rgba(252, 95, 0, .16);
  --ad-primary-softer: rgba(252, 95, 0, .07);
  --ad-link: #ff9a57;
  --ad-link-hover: #ffb184;
  --ad-bg: #121214;
  --ad-card: #1b1b1f;
  --ad-surface-2: #232328;
  --ad-input-bg: #15151a;
  --ad-border: #2c2c33;
  --ad-border-strong: #3a3a44;
  --ad-text: #e8e8ec;
  --ad-muted: #9a9aa6;
  --ad-label: #cfcfd7;
  --ad-th-text: #bfaea2;
  --ad-sidebar-bg: #17171a;
  --ad-nav-text: #c4c4cc;
  --ad-nav-icon: #7f7f8b;
  --ad-group: #6f6f7b;
  --ad-topbar-bg: rgba(23, 23, 26, .88);
  --ad-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --ad-shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  --ad-ok-bg: rgba(25, 168, 108, .14); --ad-ok-text: #6fdcaa; --ad-ok-border: rgba(25, 168, 108, .35);
  --ad-bad-bg: rgba(239, 68, 68, .14); --ad-bad-text: #ff9a9a; --ad-bad-border: rgba(239, 68, 68, .35);
  --ad-info-text: #ffb184; --ad-info-border: rgba(252, 95, 0, .35);
  --ad-busy-bg: rgba(245, 158, 11, .14); --ad-busy-border: rgba(245, 158, 11, .35);
  --bs-link-color-rgb: 255, 154, 87;
  --bs-focus-ring-color: rgba(255, 106, 20, .3);
}

html { font-size: 15px; }
body { background: var(--ad-bg); color: var(--ad-text); -webkit-font-smoothing: antialiased; transition: background-color .25s ease, color .25s ease; }

.btn-primary {
  --bs-btn-bg: var(--ad-primary); --bs-btn-border-color: var(--ad-primary);
  --bs-btn-hover-bg: var(--ad-primary-dark); --bs-btn-hover-border-color: var(--ad-primary-dark);
  --bs-btn-active-bg: var(--ad-primary-dark); --bs-btn-active-border-color: var(--ad-primary-dark);
  --bs-btn-disabled-bg: var(--ad-primary); --bs-btn-disabled-border-color: var(--ad-primary);
  font-weight: 600;
}
.btn { font-weight: 500; border-radius: 10px; }
.btn-sm { border-radius: 8px; }
.btn-primary { --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; background-image: var(--ad-grad); border-color: transparent; box-shadow: 0 4px 12px rgba(252, 95, 0, .22); }
.btn-primary:hover, .btn-primary:focus-visible, .btn-primary:active { background-image: linear-gradient(135deg, #f26a14 0%, #e55600 55%, #c94700 100%); border-color: transparent; }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(252, 95, 0, .3); }
.btn-outline-primary { --bs-btn-color: var(--ad-link); --bs-btn-border-color: var(--ad-primary); --bs-btn-hover-bg: var(--ad-primary); --bs-btn-hover-border-color: var(--ad-primary); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--ad-primary-dark); --bs-btn-active-border-color: var(--ad-primary-dark); --bs-btn-active-color: #fff; }
.btn-link { color: var(--ad-link); }
.form-check-input:checked { background-color: var(--ad-primary); border-color: var(--ad-primary); }
.form-check-input:focus { border-color: var(--ad-primary-light); box-shadow: 0 0 0 .2rem rgba(252, 95, 0, .16); }
.input-group-text { border-color: var(--ad-border-strong); color: var(--ad-primary); background: var(--ad-input-bg); }
.page-link { color: var(--ad-link); background: var(--ad-card); border-color: var(--ad-border); }
.page-link:hover { color: var(--ad-link-hover); background: var(--ad-primary-soft); border-color: var(--ad-border); }
.page-item.active .page-link { background: var(--ad-primary); border-color: var(--ad-primary); color: #fff; }
.dropdown-item:active, .dropdown-item.active { background: var(--ad-primary); }
.dropdown-item:hover { background: var(--ad-primary-soft); }
.nav-pills .nav-link.active, .nav-tabs .nav-link.active { color: var(--ad-link); }
.nav-pills .nav-link.active { background: var(--ad-primary); color: #fff; }
.progress-bar { background: var(--ad-primary); }
.alert-info { --bs-alert-bg: var(--ad-primary-softer); --bs-alert-border-color: var(--ad-info-border); --bs-alert-color: var(--ad-info-text); }
.modal-header { border-bottom-color: var(--ad-border); } .modal-footer { border-top-color: var(--ad-border); }
.modal-content { border-radius: 16px; border: 1px solid var(--ad-border); box-shadow: var(--ad-shadow-lg); }
::selection { background: rgba(252, 95, 0, .22); }
.form-control, .form-select { border-color: var(--ad-border-strong); padding: .55rem .8rem; color: var(--ad-text); }
.form-control::placeholder { color: var(--ad-muted); opacity: .7; }
.form-control:focus, .form-select:focus { border-color: var(--ad-primary); box-shadow: 0 0 0 .2rem rgba(252, 95, 0, .16); }
.form-label { font-weight: 600; font-size: .85rem; color: var(--ad-label); margin-bottom: .35rem; }
.form-text { color: var(--ad-muted); }
.text-muted { color: var(--ad-muted) !important; }

/* ---------- Kerangka ---------- */
.ad-shell { display: flex; min-height: 100vh; }

.ad-sidebar {
  width: var(--ad-sidebar-w); flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 1040;
  background: var(--ad-sidebar-bg); border-right: 1px solid var(--ad-border);
  color: var(--ad-nav-text); display: flex; flex-direction: column; overflow-y: auto; transition: transform .25s ease;
}
.ad-brand { display: flex; align-items: center; gap: .8rem; padding: 1.2rem 1.3rem 1rem; color: var(--ad-ink); text-decoration: none; border-bottom: 1px solid var(--ad-border); margin-bottom: .25rem; }
.ad-brand img { width: 44px; height: 44px; border-radius: 12px; background: #fff; padding: 4px; object-fit: contain; box-shadow: 0 2px 8px rgba(0, 0, 0, .14); }
.ad-brand .name { font-weight: 800; font-size: 1.25rem; letter-spacing: .2px; line-height: 1.1; color: var(--ad-ink); }
.ad-brand .name span { color: var(--ad-primary); }
.ad-brand .sub { font-size: .64rem; color: var(--ad-muted); letter-spacing: .6px; text-transform: uppercase; margin-top: 2px; }

.ad-nav { padding: .5rem .85rem 1.5rem; flex: 1; }
.ad-nav .group { font-size: .66rem; text-transform: uppercase; letter-spacing: 1.1px; color: var(--ad-group); margin: 1.25rem .65rem .45rem; font-weight: 700; }
.ad-nav a {
  display: flex; align-items: center; gap: .75rem; color: var(--ad-nav-text); text-decoration: none;
  padding: .6rem .8rem; border-radius: 10px; font-weight: 500; font-size: .91rem; margin-bottom: 2px; transition: background .15s, color .15s, transform .15s;
}
.ad-nav a i { font-size: 1.1rem; color: var(--ad-nav-icon); width: 1.2rem; text-align: center; transition: color .15s; }
.ad-nav a:hover { background: var(--ad-primary-soft); color: var(--ad-link); }
.ad-nav a:hover i { color: var(--ad-primary); }
.ad-nav a.active { background: var(--ad-grad); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(252, 95, 0, .32); }
.ad-nav a.active i { color: #fff; opacity: 1; }
.ad-sidebar .foot { padding: 1rem 1.3rem; font-size: .7rem; color: var(--ad-muted); border-top: 1px solid var(--ad-border); background: var(--ad-primary-softer); }

.ad-main { flex: 1; margin-left: var(--ad-sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.ad-topbar {
  position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 1rem;
  background: var(--ad-topbar-bg); backdrop-filter: blur(8px); border-bottom: 1px solid var(--ad-border);
  padding: .75rem 1.75rem; min-height: 64px; box-shadow: 0 1px 0 rgba(252, 95, 0, .06);
}
.ad-topbar h1 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.ad-topbar .spacer { flex: 1; }
.ad-menu-btn { display: none; border: 0; background: transparent; font-size: 1.5rem; color: var(--ad-text); }
.ad-icon-btn { position: relative; border: 1px solid var(--ad-border); background: var(--ad-card); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ad-text); }
.ad-icon-btn:hover { background: var(--ad-primary-soft); color: var(--ad-link); border-color: var(--ad-info-border); }
.ad-icon-btn .dot { position: absolute; top: -5px; right: -5px; background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.ad-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--ad-grad); color: #fff; font-weight: 700; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(252, 95, 0, .3); }

.ad-content { padding: 1.75rem; flex: 1; }
.ad-footer { padding: 1rem 1.75rem; color: var(--ad-muted); font-size: .8rem; border-top: 1px solid var(--ad-border); background: var(--ad-sidebar-bg); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-head h2 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.page-head p { margin: .15rem 0 0; color: var(--ad-muted); }

/* ---------- Kartu ---------- */
.ad-card { background: var(--ad-card); border: 1px solid var(--ad-border); border-radius: var(--ad-radius); box-shadow: var(--ad-shadow); }
.ad-card > .head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--ad-border); }
.ad-card > .head h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.ad-card > .body { padding: 1.25rem; }
.ad-card > .body.flush { padding: 0; }

.stat-card { display: flex; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem; text-decoration: none; color: inherit; height: 100%; transition: transform .15s, box-shadow .15s; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(252, 95, 0, .14); color: inherit; }
.stat-card .icon { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-card .label { color: var(--ad-muted); font-size: .84rem; font-weight: 500; }
.tone-primary .icon { background: rgba(252, 95, 0, .12); color: var(--ad-link); }
.tone-success .icon { background: rgba(25, 168, 108, .12); color: #139a60; }
.tone-warning .icon { background: rgba(245, 158, 11, .15); color: #c27803; }
.tone-danger .icon { background: rgba(239, 68, 68, .12); color: #dc2626; }
.tone-info .icon { background: rgba(37, 99, 235, .12); color: #1d4ed8; }
.tone-secondary .icon { background: rgba(107, 114, 128, .14); color: #4b5563; }

/* ---------- Tabel ---------- */
.table-ad { margin: 0; --bs-table-bg: transparent; --bs-table-color: var(--ad-text); --bs-table-border-color: var(--ad-border); }
.table-ad thead th { background: var(--ad-primary-softer); color: var(--ad-th-text); font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; border-bottom: 1px solid var(--ad-border); padding: .8rem 1rem; white-space: nowrap; }
.table-ad tbody td { padding: .85rem 1rem; vertical-align: middle; border-color: var(--ad-border); }
.table-ad tbody tr:hover { background: var(--ad-primary-softer); }
.table-ad th a { color: inherit; text-decoration: none; }
.table-ad th a:hover { color: var(--ad-link); }
.plate { display: inline-block; font-weight: 700; font-size: .82rem; letter-spacing: .5px; background: #fff; border: 2px solid #1f2430; border-radius: 6px; padding: 1px 8px; color: #1f2430; font-family: 'Inter', monospace; white-space: nowrap; }
.badge { font-weight: 600; padding: .42em .7em; border-radius: 8px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; padding: 1rem 1.25rem; border-bottom: 1px solid var(--ad-border); background: var(--ad-primary-softer); border-radius: var(--ad-radius) var(--ad-radius) 0 0; }
.filter-bar > div { min-width: 150px; }
.pagination { margin: 0; }
.pager-wrap { padding: .9rem 1.25rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; border-top: 1px solid var(--ad-border); color: var(--ad-muted); font-size: .85rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ad-muted); }
.empty-state i { font-size: 2.6rem; color: var(--ad-primary-light); opacity: .55; display: block; margin-bottom: .6rem; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: .55rem 1rem; margin: 0; }
.kv dt { color: var(--ad-muted); font-weight: 500; font-size: .86rem; }
.kv dd { margin: 0; font-weight: 500; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 .4rem; border-left: 2px solid var(--ad-border); }
.timeline li { position: relative; padding: 0 0 1.1rem 1.1rem; }
.timeline li::before { content: ''; position: absolute; left: -.62rem; top: .25rem; width: 11px; height: 11px; border-radius: 50%; background: var(--ad-primary); border: 2px solid var(--ad-card); box-shadow: 0 0 0 2px var(--ad-primary); }
.timeline .when { font-size: .78rem; color: var(--ad-muted); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.photo-grid a { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--ad-border); background: var(--ad-card); text-decoration: none; color: inherit; }
.photo-grid img { width: 100%; height: 120px; object-fit: cover; display: block; background: var(--ad-surface-2); }
.photo-grid span { display: block; padding: .4rem .6rem; font-size: .74rem; color: var(--ad-muted); }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { background: linear-gradient(155deg, #ff7a1f 0%, #fc5f00 48%, #d84a00 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::before { content: ''; position: absolute; left: -160px; top: -160px; width: 460px; height: 460px; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.auth-hero::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgba(255, 255, 255, .11); }
.auth-hero .brand img { width: 56px; height: 56px; border-radius: 15px; box-shadow: 0 10px 24px rgba(120, 30, 0, .35); }
.auth-hero h2 { font-size: 2.1rem; font-weight: 800; line-height: 1.2; max-width: 470px; }
.auth-hero p { color: rgba(255, 255, 255, .88); max-width: 440px; }
.auth-hero ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .75rem; z-index: 1; position: relative; }
.auth-hero li { display: flex; gap: .7rem; align-items: center; color: #fff; }
.auth-hero li i { color: #fff; background: rgba(255, 255, 255, .2); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 1rem; flex-shrink: 0; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: linear-gradient(180deg, var(--ad-card), var(--ad-primary-softer)); position: relative; }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form .box .logo-sm { display: none; }
.auth-form h1 { font-size: 1.65rem; font-weight: 800; }
.auth-simple { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(900px 420px at 50% -10%, rgba(252, 95, 0, .16) 0%, transparent 70%), var(--ad-bg); position: relative; }
.auth-simple .ad-card { width: 100%; max-width: 440px; padding: 2rem; box-shadow: var(--ad-shadow-lg); }
.auth-simple .logo { width: 64px; height: 64px; border-radius: 16px; background: #fff; padding: 6px; object-fit: contain; box-shadow: 0 6px 18px rgba(0, 0, 0, .16); }

/* ---------- Peta ---------- */

/* ---------- Kalender & tanggal ---------- */
.flatpickr-day.has-busy { position: relative; background: var(--ad-busy-bg); border-color: var(--ad-busy-border); }
.flatpickr-day.has-busy::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: #e08a00; }
.flatpickr-day.selected.has-busy { background: var(--ad-primary); }

.avail-box { border-radius: 12px; padding: .85rem 1rem; font-weight: 500; display: flex; gap: .6rem; align-items: flex-start; }
.avail-box.ok { background: var(--ad-ok-bg); color: var(--ad-ok-text); border: 1px solid var(--ad-ok-border); }
.avail-box.bad { background: var(--ad-bad-bg); color: var(--ad-bad-text); border: 1px solid var(--ad-bad-border); }
.avail-box.info { background: var(--ad-primary-softer); color: var(--ad-info-text); border: 1px solid var(--ad-info-border); }
.busy-item { font-size: .84rem; padding: .4rem 0; border-bottom: 1px dashed var(--ad-border); }
.busy-item:last-child { border: 0; }

.notif-item { display: block; padding: .7rem 1rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--ad-border); }
.notif-item.unread { background: var(--ad-primary-softer); box-shadow: inset 3px 0 0 var(--ad-primary); }
.notif-item:hover { background: var(--ad-primary-soft); color: inherit; }
.notif-item .t { font-weight: 600; font-size: .88rem; }
.notif-item .b { font-size: .8rem; color: var(--ad-muted); }

.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .ad-sidebar { transform: translateX(-100%); }
  .ad-sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .ad-main { margin-left: 0; }
  .ad-menu-btn { display: block; }
  .ad-content { padding: 1.1rem; }
  .ad-topbar { padding: .6rem 1rem; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1035; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-form .box .logo-sm { display: block; width: 56px; height: 56px; border-radius: 14px; margin-bottom: 1rem; background: #fff; padding: 5px; object-fit: contain; box-shadow: 0 4px 14px rgba(0, 0, 0, .16); }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  #map { height: 420px; }
  .map-list { max-height: 320px; }
  .kv { grid-template-columns: 130px 1fr; }
}

@media print {
  .ad-sidebar, .ad-topbar, .ad-footer, .no-print { display: none !important; }
  .ad-main { margin: 0; }
}

/* ---------- Flatpickr (kalender tanggal) bertema oranye ---------- */
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange, .flatpickr-day.selected:hover { background: var(--ad-primary); border-color: var(--ad-primary); color: #fff; }
.flatpickr-day.today { border-color: var(--ad-primary); }
.flatpickr-day.today:hover { background: var(--ad-primary-soft); color: var(--ad-link); }
.flatpickr-day:hover { background: var(--ad-primary-soft); border-color: var(--ad-primary-soft); }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--ad-primary); }
.flatpickr-calendar { border-radius: 14px; box-shadow: var(--ad-shadow-lg); }
.flatpickr-time input:hover, .flatpickr-time .flatpickr-am-pm:hover, .flatpickr-time input:focus, .flatpickr-time .flatpickr-am-pm:focus { background: var(--ad-primary-soft); }

/* ---------- FullCalendar: tautan tanpa garis bawah ---------- */

/* ---------- Daftar pada peta: item berupa tautan, tampil sebagai baris biasa ---------- */
.map-list .item, .map-list .item:hover { text-decoration: none; color: var(--ad-text); }
.map-list .item .t { color: var(--ad-ink); }
.map-list .item .small, .map-list .item .text-muted { color: var(--ad-muted); }
.table-ad a:not(.btn) { text-decoration: none; font-weight: 500; }
.table-ad a:not(.btn):hover { text-decoration: underline; }

/* Kolom isian: putih bersih (terang) / gelap pekat (gelap), bukan warna latar halaman */
.form-control, .form-select, .form-control:focus, .form-select:focus, .flatpickr-input { background-color: var(--ad-input-bg); }
.form-control:disabled, .form-select:disabled { background-color: var(--ad-surface-2); }
.form-control[readonly] { background-color: var(--ad-input-bg); cursor: pointer; }
.filter-bar .form-control, .filter-bar .form-select { background-color: var(--ad-input-bg); }

/* Komponen Bootstrap yang memakai latar halaman -> putih bersih */
.modal { --bs-modal-bg: var(--ad-card); --bs-modal-color: var(--ad-text); }
.dropdown-menu { --bs-dropdown-bg: var(--ad-card); --bs-dropdown-color: var(--ad-text); --bs-dropdown-link-color: var(--ad-text); --bs-dropdown-link-hover-bg: var(--ad-primary-soft); --bs-dropdown-link-hover-color: var(--ad-link); --bs-dropdown-divider-bg: var(--ad-border); --bs-dropdown-border-color: var(--ad-border); --bs-dropdown-border-radius: 12px; box-shadow: var(--ad-shadow-lg); }
.dropdown-item:hover { background: var(--ad-primary-soft); }
.list-group { --bs-list-group-bg: var(--ad-card); }
.accordion { --bs-accordion-bg: var(--ad-card); }
.toast { --bs-toast-bg: var(--ad-card); }


/* ---------- Komponen tambahan ---------- */
.card-choice { display: block; border: 1px solid var(--ad-border-strong); border-radius: 12px; padding: .9rem 1rem; cursor: pointer; background: var(--ad-card); transition: border-color .15s, box-shadow .15s, background .15s; }
.card-choice:hover { border-color: var(--ad-primary); }
.card-choice:has(input:checked) { border-color: var(--ad-primary); background: var(--ad-primary-softer); box-shadow: 0 0 0 3px rgba(var(--ad-primary-rgb), .14); }
.code-block { background: var(--ad-surface-2); color: var(--ad-text); border: 1px solid var(--ad-border); }
.bg-light { background-color: var(--ad-surface-2) !important; }
.badge.text-bg-light { background-color: var(--ad-surface-2) !important; color: var(--ad-text) !important; }
.input-group-text.bg-white { background-color: var(--ad-input-bg) !important; }
.border, .border-bottom, .border-top { border-color: var(--ad-border) !important; }
.text-dark { color: var(--ad-text) !important; }

/* ---------- Pengganti tema (Terang / Gelap / Sistem) ---------- */
.theme-switch .dropdown-item { display: flex; align-items: center; gap: .6rem; }
.theme-switch .dropdown-item .check { margin-left: auto; opacity: 0; color: var(--ad-primary); }
.theme-switch .dropdown-item.active { background: var(--ad-primary-soft); color: var(--ad-link); }
.theme-switch .dropdown-item.active .check { opacity: 1; }
.theme-float { position: absolute; top: 1rem; right: 1rem; z-index: 5; }
.auth-wrap .theme-float .ad-icon-btn { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .35); color: #fff; backdrop-filter: blur(6px); }
.auth-form .theme-float .ad-icon-btn, .auth-simple .theme-float .ad-icon-btn { background: var(--ad-card); border-color: var(--ad-border); color: var(--ad-text); }

/* ---------- Penyesuaian tema gelap untuk pustaka pihak ketiga ---------- */
[data-bs-theme="dark"] .ad-brand img, [data-bs-theme="dark"] .auth-simple .logo { box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
[data-bs-theme="dark"] .modal-backdrop { --bs-backdrop-opacity: .65; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
[data-bs-theme="dark"] .alert { --bs-alert-bg: var(--ad-surface-2); }
[data-bs-theme="dark"] .alert-success { --bs-alert-bg: var(--ad-ok-bg); --bs-alert-color: var(--ad-ok-text); --bs-alert-border-color: var(--ad-ok-border); }
[data-bs-theme="dark"] .alert-danger { --bs-alert-bg: var(--ad-bad-bg); --bs-alert-color: var(--ad-bad-text); --bs-alert-border-color: var(--ad-bad-border); }
[data-bs-theme="dark"] .alert-warning { --bs-alert-bg: var(--ad-busy-bg); --bs-alert-color: #ffd28a; --bs-alert-border-color: var(--ad-busy-border); }
[data-bs-theme="dark"] .text-bg-secondary { background-color: #3a3a44 !important; color: #e8e8ec !important; }
[data-bs-theme="dark"] .text-bg-dark { background-color: #ececf1 !important; color: #121214 !important; }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--ad-nav-text); --bs-btn-border-color: var(--ad-border-strong); --bs-btn-hover-bg: var(--ad-surface-2); --bs-btn-hover-color: var(--ad-text); --bs-btn-hover-border-color: var(--ad-border-strong); }
[data-bs-theme="dark"] .photo-grid a, [data-bs-theme="dark"] .photo-grid img { background: var(--ad-surface-2); }

/* Leaflet: ubin peta digelapkan dengan filter, penanda & kontrol tetap terbaca */
[data-bs-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.85); }
[data-bs-theme="dark"] .leaflet-container { background: #1b1b1f; }
[data-bs-theme="dark"] .leaflet-popup-content-wrapper, [data-bs-theme="dark"] .leaflet-popup-tip { background: var(--ad-card); color: var(--ad-text); }
[data-bs-theme="dark"] .leaflet-bar a { background: var(--ad-card); color: var(--ad-text); border-bottom-color: var(--ad-border); }
[data-bs-theme="dark"] .leaflet-bar a:hover { background: var(--ad-surface-2); }
[data-bs-theme="dark"] .leaflet-control-attribution { background: rgba(23, 23, 26, .8) !important; color: var(--ad-muted); }
[data-bs-theme="dark"] .leaflet-control-attribution a { color: var(--ad-link); }

/* FullCalendar */

/* Flatpickr */
[data-bs-theme="dark"] .flatpickr-calendar { background: var(--ad-card); border: 1px solid var(--ad-border); box-shadow: var(--ad-shadow-lg); }
[data-bs-theme="dark"] .flatpickr-calendar.arrowTop:before, [data-bs-theme="dark"] .flatpickr-calendar.arrowTop:after { border-bottom-color: var(--ad-card); }
[data-bs-theme="dark"] .flatpickr-months .flatpickr-month, [data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months, [data-bs-theme="dark"] .flatpickr-current-month input.cur-year { color: var(--ad-text); fill: var(--ad-text); background: transparent; }
[data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month { background: var(--ad-card); }
[data-bs-theme="dark"] .flatpickr-months .flatpickr-prev-month, [data-bs-theme="dark"] .flatpickr-months .flatpickr-next-month { color: var(--ad-text); fill: var(--ad-text); }
[data-bs-theme="dark"] span.flatpickr-weekday { color: var(--ad-muted); background: transparent; }
[data-bs-theme="dark"] .flatpickr-day { color: var(--ad-text); }
[data-bs-theme="dark"] .flatpickr-day.prevMonthDay, [data-bs-theme="dark"] .flatpickr-day.nextMonthDay, [data-bs-theme="dark"] .flatpickr-day.flatpickr-disabled { color: var(--ad-group); }
[data-bs-theme="dark"] .flatpickr-day:hover { background: var(--ad-primary-soft); border-color: transparent; }
[data-bs-theme="dark"] .flatpickr-time { border-top-color: var(--ad-border); }
[data-bs-theme="dark"] .flatpickr-time input, [data-bs-theme="dark"] .flatpickr-time .flatpickr-time-separator, [data-bs-theme="dark"] .flatpickr-time .flatpickr-am-pm { color: var(--ad-text); background: transparent; }
[data-bs-theme="dark"] .numInputWrapper span.arrowUp:after { border-bottom-color: var(--ad-text); }
[data-bs-theme="dark"] .numInputWrapper span.arrowDown:after { border-top-color: var(--ad-text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Kalender Jadwal (angka per tanggal + rincian) ---------- */
.cal-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--ad-muted); }
.cal-key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: .3rem; border: 1px solid var(--ad-border-strong); }
.cal-key-empty { background: var(--ad-card); }
.cal-key-has { background: rgba(var(--ad-primary-rgb), .14); border-color: rgba(var(--ad-primary-rgb), .45); }
.cal-key-open { background: rgba(var(--ad-primary-rgb), .30); border: 2px solid var(--ad-primary); }
.cal-key-pending { background: #f59e0b; border-color: #f59e0b; border-radius: 999px; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.cal-title { flex: 1 1 auto; text-align: center; font-size: 1.15rem; font-weight: 700; margin: 0; min-width: 9rem; }
.cal-sync { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; font-size: .75rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--ad-th-text); padding: .35rem 0; }
.cal-day { position: relative; display: block; width: 100%; min-height: 84px; padding: .4rem .5rem; text-align: left; border: 1px solid var(--ad-border); border-radius: 10px; background: var(--ad-card); color: var(--ad-text); cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
.cal-day:hover { border-color: var(--ad-primary); }
.cal-day:focus-visible { outline: 3px solid rgba(var(--ad-primary-rgb), .45); outline-offset: 1px; }
.cal-day .cal-num { font-weight: 600; font-size: .9rem; }
.cal-day.is-other { opacity: .5; }
.cal-day.is-today .cal-num { display: inline-block; min-width: 1.7rem; text-align: center; background: var(--ad-primary); color: #fff; border-radius: 999px; padding: .05rem .4rem; }
.cal-day.has-agenda { background: rgba(var(--ad-primary-rgb), .10); border-color: rgba(var(--ad-primary-rgb), .40); }
.cal-day.is-open { background: rgba(var(--ad-primary-rgb), .26); border: 2px solid var(--ad-primary); padding: calc(.4rem - 1px) calc(.5rem - 1px); }
.cal-badge { position: absolute; top: 6px; right: 6px; min-width: 1.55rem; height: 1.55rem; padding: 0 .4rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--ad-primary); color: #fff; font-size: .8rem; font-weight: 700; line-height: 1; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.cal-badge.has-pending { background: #f59e0b; color: #1f2937; }
.cal-grid.is-compact .cal-day { min-height: 52px; }
.cal-grid.is-loading { opacity: .6; transition: opacity .15s; }
.cal-detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.cal-detail-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.cal-section-title { font-size: .78rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--ad-th-text); margin: 1.1rem 0 .5rem; }
.cal-empty { text-align: center; color: var(--ad-muted); padding: 2rem 1rem; border: 1px dashed var(--ad-border-strong); border-radius: 12px; }
.cal-item { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: flex-start; justify-content: space-between; padding: .85rem 1rem; margin-bottom: .6rem; border: 1px solid var(--ad-border); border-left: 5px solid var(--ad-border-strong); border-radius: 10px; background: var(--ad-card); }
.cal-item.st-pending { border-left-color: #f59e0b; } .cal-item.st-approved { border-left-color: #16a34a; }
.cal-item.st-in_use { border-left-color: #2563eb; } .cal-item.st-late { border-left-color: #dc2626; }
.cal-item.is-history { opacity: .75; }
.cal-item .plate { font-weight: 700; }
.cal-item .meta { color: var(--ad-muted); font-size: .85rem; }
.cal-role { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: rgba(var(--ad-primary-rgb), .14); color: var(--ad-primary-deep); }
@media (max-width: 575.98px) {
  .cal-grid { gap: 3px; }
  .cal-day { min-height: 60px; padding: .3rem; }
  .cal-day .cal-num { font-size: .8rem; }
  .cal-badge { top: 3px; right: 3px; min-width: 1.3rem; height: 1.3rem; font-size: .7rem; }
  .cal-grid.is-compact .cal-day { min-height: 44px; }
}

/* ---------- Lacak Kendaraan ---------- */
.nav-count { margin-left: auto; min-width: 1.4rem; height: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: #dc2626; color: #fff; font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.nav-count[hidden] { display: none; }
.ad-nav a.active .nav-count { background: #fff; color: #b13f00; }

.trk-live { display: inline-flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--ad-muted); padding: .4rem .75rem; border: 1px solid var(--ad-border); border-radius: 999px; background: var(--ad-card); }
.trk-live i { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); animation: trk-beat 2s infinite; }
.trk-live.off i { background: #dc2626; animation: none; }
@keyframes trk-beat { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); } 70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }

.page-head .trk-sub { max-width: 62ch; }
.trk-section-label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ad-muted); margin: 1.25rem 0 .55rem; }
.trk-desc { margin: .15rem 0 0; font-size: .82rem; font-weight: 400; color: var(--ad-muted); line-height: 1.45; max-width: 78ch; }
.trk-desc-pad { padding: .65rem 1.25rem; margin: 0; border-bottom: 1px solid var(--ad-border); background: var(--ad-surface-2, transparent); }
.stat-card .hint { font-size: .74rem; color: var(--ad-muted); margin-top: .15rem; line-height: 1.3; }
.trk-calm { display: flex; align-items: center; gap: .6rem; color: var(--ad-muted); font-size: .86rem; }
.trk-calm i { color: #16a34a; font-size: 1.1rem; }
#trkAlerts .trk-alert:last-child { margin-bottom: 0; }
.trk-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 1rem; height: calc(100vh - 150px); min-height: 600px; margin-bottom: 1rem; }
.trk-mapcard { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.trk-mapcard .trk-mapwrap { flex: 1 1 auto; }
.trk-legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; padding: .65rem 1.25rem; border-top: 1px solid var(--ad-border); font-size: .78rem; color: var(--ad-muted); }
.trk-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.trk-legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }
.trk-side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.trk-list { overflow-y: auto; flex: 1 1 auto; min-height: 120px; }
.trk-mapwrap { position: relative; min-height: 0; }
#trkMap { width: 100%; height: 100%; border-radius: 0; z-index: 1; }

.trk-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--ad-border); padding: .8rem 1rem; color: inherit; transition: background .15s; }
.trk-item:hover { background: var(--ad-primary-softer); }
.trk-item.on { background: var(--ad-primary-soft); box-shadow: inset 3px 0 0 var(--ad-primary); }
.trk-item.done { opacity: .72; }
.trk-item .top { display: flex; align-items: center; gap: .5rem; }
.trk-item .top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-item .who { margin-top: .25rem; font-size: .84rem; color: var(--ad-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-item .meta { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .25rem .85rem; font-size: .78rem; color: var(--ad-muted); }
.trk-item .meta i { margin-right: .25rem; }
.trk-badge-alert { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 700; color: #dc2626; }

.trk-pill { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; background: var(--ad-surface-2); color: var(--ad-muted); }
.trk-pill.c-success { background: var(--ad-ok-bg); color: var(--ad-ok-text); }
.trk-pill.c-warning { background: var(--ad-busy-bg); color: #9a5b00; }
.trk-pill.c-danger { background: var(--ad-bad-bg); color: var(--ad-bad-text); }
.trk-pill.c-primary { background: var(--ad-primary-soft); color: var(--ad-link); }

.trk-empty { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; padding: 2.5rem 1.5rem; color: var(--ad-muted); font-size: .86rem; }
.trk-empty i { font-size: 2rem; color: var(--ad-primary); opacity: .7; }
.trk-empty b { color: var(--ad-text); }

.trk-detail { flex: 0 0 auto; border-top: 1px solid var(--ad-border-strong, var(--ad-border)); background: var(--ad-card); padding: 1rem; animation: trk-rise .25s ease-out; max-height: 55%; overflow-y: auto; }
.trk-detail[hidden] { display: none; }
@keyframes trk-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.trk-detail-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.trk-detail-head > div { flex: 1; min-width: 0; }
.trk-detail-head .trk-plate { display: block; font-size: .8rem; color: var(--ad-muted); font-weight: 500; }
.trk-dl { margin: 0 0 .8rem; display: grid; gap: .35rem; }
.trk-dl > div { display: grid; grid-template-columns: 104px 1fr; gap: .5rem; font-size: .84rem; }
.trk-dl dt { color: var(--ad-muted); font-weight: 500; }
.trk-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.trk-detail-act { display: flex; flex-wrap: wrap; gap: .4rem; }

.trk-alert { display: flex; align-items: center; gap: 1rem; padding: .85rem 1rem; border-radius: var(--ad-radius); border: 1px solid var(--ad-busy-border); background: var(--ad-busy-bg); margin-bottom: .6rem; animation: trk-rise .25s ease-out; }
.trk-alert.critical { border-color: var(--ad-bad-border); background: var(--ad-bad-bg); }
.trk-alert.critical .ic { color: #dc2626; animation: trk-throb 1.2s ease-in-out infinite; }
.trk-alert .ic { font-size: 1.6rem; color: #d97706; flex: 0 0 auto; }
.trk-alert .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.trk-alert .tx span { font-size: .84rem; color: var(--ad-muted); }
.trk-alert .tx .note { color: var(--ad-text); }
.trk-alert .act { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
@keyframes trk-throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.trk-sound-note { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; margin-bottom: .6rem; border-radius: var(--ad-radius); border: 1px dashed var(--ad-border-strong); background: var(--ad-card); font-size: .86rem; }
.trk-sound-note span { flex: 1; }
.trk-toast-critical { box-shadow: 0 0 0 3px rgba(220, 38, 38, .25), var(--ad-shadow-lg); }

.trk-pin-wrap { background: none; border: 0; }
.trk-pin { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c, #6b7280); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .35); color: #fff; }
.trk-pin i { transform: rotate(45deg); font-size: .95rem; line-height: 1; }
.trk-pin.pulse::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--c); animation: trk-ring 1.6s ease-out infinite; }
@keyframes trk-ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
[data-bs-theme="dark"] .trk-pin { border-color: #1b1b1f; }
.bump { animation: trk-bump .35s ease-out; }
@keyframes trk-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

@media (max-width: 991.98px) {
  .trk-layout { grid-template-columns: 1fr; height: auto; }
  .trk-side { max-height: none; }
  .trk-list { max-height: 260px; }
  .trk-detail { max-height: none; }
  .trk-mapcard { min-height: 0; }
  .trk-mapwrap { height: 62vh; min-height: 380px; flex: none; }
  .trk-alert { flex-wrap: wrap; }
  .trk-alert .act { justify-content: flex-start; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .trk-live i, .trk-alert, .trk-alert.critical .ic, .trk-pin.pulse::after, .trk-detail, .bump { animation: none !important; }
}
