/* SITRAS — gaya diselaraskan dengan Command Center Sumedang (template Poco, Bootstrap 4) */
@font-face { font-family: 'Work Sans'; font-weight: 400; font-display: swap; src: url(/vendor/fonts/work-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Work Sans'; font-weight: 500; font-display: swap; src: url(/vendor/fonts/work-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Work Sans'; font-weight: 600; font-display: swap; src: url(/vendor/fonts/work-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Work Sans'; font-weight: 700; font-display: swap; src: url(/vendor/fonts/work-sans-latin-700-normal.woff2) format('woff2'); }

:root {
  --primary: #7e37d8;
  --primary-dark: #5a1eb0;
  --pink: #fe5a8a;
  --green: #80cf00;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #2b2b3a;
  --ink-2: #59667a;
  --ink-3: #8a94a6;
  --line: #ecedf3;
  --shadow: 0 0 37px rgba(8, 21, 66, 0.06);
  /* status armada (selalu disertai ikon + label) */
  --st-bergerak: #2f9e44;
  --st-idle: #d48806;
  --st-parkir: #5c6b7e;
  --st-offline: #c92a2a;
  --st-none: #adb5bd;
}

html, body { height: 100%; }
body { font-family: 'Work Sans', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover, .btn-outline-primary.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.form-control:focus { border-color: #b48ef0; box-shadow: 0 0 0 .2rem rgba(126, 55, 216, .15); }
.custom-range::-webkit-slider-thumb { background: var(--primary); }
.custom-range::-moz-range-thumb { background: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.page-link { color: var(--primary); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, #efe6fb 0, transparent 45%), radial-gradient(circle at 90% 90%, #e6f7ff 0, transparent 40%), var(--bg); }
.login-card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 400px; }

/* ---------- layout ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 38px; height: 38px; }
.brand b { display: block; font-size: 18px; letter-spacing: .5px; color: var(--primary); line-height: 1.1; }
.brand small { color: var(--ink-3); font-size: 11px; }

.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 240px; background: var(--surface); box-shadow: var(--shadow);
  padding: 20px 14px; display: flex; flex-direction: column; z-index: 1030; transition: transform .2s; }
.sidebar .brand { padding: 0 8px 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; margin-bottom: 2px; }
.sidebar nav a svg { width: 18px; height: 18px; }
.sidebar nav a:hover { background: #f4eefc; color: var(--primary); text-decoration: none; }
.sidebar nav a.active { background: linear-gradient(90deg, var(--primary), #9b5ee6); color: #fff; box-shadow: 0 6px 14px rgba(126, 55, 216, .3); }
.sidebar-foot { margin-top: auto; color: var(--ink-3); padding: 8px; }

.main { margin-left: 240px; min-height: 100vh; }
.topbar { display: flex; align-items: center; padding: 18px 28px; background: transparent; }
.topbar h1 { font-size: 24px; font-weight: 700; color: var(--primary); margin: 0; }
.crumb { color: var(--ink-3); font-size: 12px; }
.user-chip { background: var(--surface); border-radius: 20px; padding: 5px 14px; box-shadow: var(--shadow); font-weight: 500; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--st-none); margin-right: 6px; }
.live-dot.on { background: var(--st-bergerak); box-shadow: 0 0 0 4px rgba(47, 158, 68, .18); }
.content { padding: 0 28px 28px; }
.page { display: none; }
.page.active { display: block; }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}
body.embed .sidebar, body.embed .topbar { display: none; }
body.embed .main { margin-left: 0; }
body.embed .content { padding: 12px; }

/* ---------- cards ---------- */
.card-x { background: var(--surface); border-radius: 15px; box-shadow: var(--shadow); padding: 20px; height: 100%; }
.card-x-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.card-x-head h5 { font-size: 16px; font-weight: 600; margin: 0; }
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; }

.kpi { border-radius: 15px; padding: 22px 24px; color: #fff; height: 100%; position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.kpi-purple { background: linear-gradient(135deg, #7e37d8, #5a1eb0); box-shadow: 0 10px 24px rgba(126, 55, 216, .3); }
.kpi-pink { background: linear-gradient(135deg, #fe5a8a, #e8366b); box-shadow: 0 10px 24px rgba(254, 90, 138, .3); }
.kpi-green { background: linear-gradient(135deg, #6fb300, #4c8a00); box-shadow: 0 10px 24px rgba(111, 179, 0, .3); }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .85; font-weight: 600; }
.kpi-value { font-size: 34px; font-weight: 700; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 15px; font-weight: 500; opacity: .85; }
.kpi-sub { font-size: 12.5px; opacity: .92; }

.mini { background: var(--surface); border-radius: 15px; box-shadow: var(--shadow); padding: 16px 18px; height: 100%; border-left: 4px solid var(--primary); }
.mini-label { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.mini-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-value small { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.mini.warn { border-left-color: var(--st-idle); }

/* ---------- map ---------- */
.map { width: 100%; border-radius: 12px; z-index: 1; }
.map-mini { height: 380px; }
.map-full { height: calc(100vh - 150px); min-height: 480px; border-radius: 15px; }
body.embed .map-full { height: calc(100vh - 40px); }
.map-layout { display: flex; gap: 16px; }
.map-side { width: 320px; flex-shrink: 0; height: calc(100vh - 150px); min-height: 480px; display: flex; flex-direction: column; padding: 14px; }
.map-main { flex: 1; position: relative; min-width: 0; }
@media (max-width: 991px) {
  .map-layout { flex-direction: column-reverse; }
  .map-side { width: 100%; height: 340px; min-height: 0; }
  .map-full { height: 60vh; min-height: 360px; }
}
.truck-list { overflow-y: auto; flex: 1; margin: 0 -6px; }
.truck-item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.truck-item:hover { background: #f7f3fd; }
.truck-item.selected { border-color: #c9adf1; background: #f4eefc; }
.truck-item .meta { flex: 1; min-width: 0; }
.truck-item .meta b { display: block; font-size: 13.5px; }
.truck-item .meta span { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.truck-item .spd { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink-2); text-align: right; }

.st-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.st-bergerak { background: var(--st-bergerak); }
.st-idle { background: var(--st-idle); }
.st-parkir { background: var(--st-parkir); }
.st-offline { background: var(--st-offline); }
.st-belum_ada_data { background: var(--st-none); }
.status-filter { display: flex; flex-wrap: wrap; gap: 4px; }
.status-filter button { border: 1px solid var(--line); background: #fff; border-radius: 14px; font-size: 12px; padding: 2px 10px; color: var(--ink-2); }
.status-filter button.on { border-color: var(--primary); color: var(--primary); background: #f4eefc; font-weight: 600; }

.truck-marker { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; }
.truck-marker svg { width: 16px; height: 16px; }
.loc-marker { width: 14px; height: 14px; border-radius: 3px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.loc-tps { background: #0e9fc2; }
.loc-tpa { background: #2b2b3a; width: 20px; height: 20px; }
.loc-pool { background: var(--primary); width: 20px; height: 20px; border-radius: 50%; }
.loc-spbu { background: #e0365f; border-radius: 50%; }
.stop-num { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }

.legend-box { position: absolute; left: 12px; bottom: 12px; z-index: 500; background: rgba(255, 255, 255, .95); border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 12px; }
.legend-box div { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend-box .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.playback { position: absolute; right: 12px; top: 12px; z-index: 500; width: 340px; max-width: calc(100% - 24px); background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); padding: 12px 14px; max-height: calc(100% - 24px); overflow-y: auto; }
.pb-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.pb-stats div { background: var(--bg); border-radius: 8px; padding: 6px 8px; }
.pb-stats b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.pb-stats span { font-size: 11px; color: var(--ink-3); }
.pb-visits { margin-top: 10px; font-size: 12px; }
.pb-visits .v { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pb-visits .v .t { color: var(--ink-3); width: 86px; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
table.dataTable thead th { font-size: 12px; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line) !important; white-space: nowrap; }
table.dataTable td { white-space: nowrap; vertical-align: middle; font-size: 13px; border-top: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.flag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 0 5px; }
.flag-warn { background: #fff0f0; color: var(--st-offline); }
.flag-idle { background: #fff7e6; color: #9c6200; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; }
.chip-terpilah { background: #eaf6dc; color: #3f7f00; }
.chip-sebagian { background: #e3f5fa; color: #0b7d99; }
.chip-tidak { background: #f1f1f4; color: #5c6b7e; }

pre.code { background: #1f1b2e; color: #e8e3f3; border-radius: 10px; padding: 14px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

.route-item { padding: 10px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 8px; cursor: pointer; }
.route-item:hover, .route-item.selected { border-color: #c9adf1; background: #faf7fe; }
.route-item .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.route-item ol { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); display: none; }
.route-item.selected ol { display: block; }

.apexcharts-tooltip { box-shadow: 0 4px 14px rgba(0, 0, 0, .12) !important; }
.toast-x { position: fixed; right: 16px; bottom: 16px; z-index: 2000; background: #2b2b3a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
body.embed .map-side { height: calc(100vh - 40px); }
