/* ============================================================
   SIGAP — Shared Sidebar CSS  v2 (compact)
   PT Kereta Commuter Indonesia
   ============================================================ */

:root {
  --kci-red: #E42313;
  --kci-red-dark: #B91C1C;
  --kci-red-light: #FEE2E2;
  --sidebar-w: 240px;
  --header-h: 54px;
  --bg-app: #F1F5F9;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --bg-sidebar-active: rgba(228,35,19,.15);
  --text-sidebar: #94A3B8;
  --text-sidebar-active: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --card-bg: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 14px rgba(0,0,0,.09);
  --radius: 10px;
  --radius-sm: 7px;
  --font-main: 'Plus Jakarta Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-main);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
}

/* ── Header ─────────────────────────────────────────────── */
.hdr {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px 0 0;
  z-index: 100;
}

.hdr-brand {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  height: 100%;
}

.hdr-brand .logo-box {
  width: 30px; height: 30px;
  background: var(--kci-red);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hdr-brand .logo-box i { color: #fff; font-size: 13px; }
.hdr-brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.hdr-brand .brand-name { font-size: 14px; font-weight: 800; color: var(--text-primary); letter-spacing: -.3px; }
.hdr-brand .brand-sub { font-size: 9px; color: var(--kci-red); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }

.hdr-breadcrumb {
  display: flex; align-items: center; gap: 5px;
  padding: 0 14px; font-size: 12px; color: var(--text-secondary); flex: 1;
}
.hdr-breadcrumb span { color: var(--text-muted); }
.hdr-breadcrumb .bc-active { color: var(--text-primary); font-weight: 700; }
.hdr-breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.hdr-breadcrumb a:hover { color: var(--kci-red); }

.hdr-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.hdr-btn {
  width: 32px; height: 32px;
  border: none; background: var(--bg-app);
  border-radius: 7px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); position: relative; transition: background .15s;
  font-size: 13px;
}
.hdr-btn:hover { background: var(--border); }
.hdr-btn .badge {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--kci-red); border-radius: 50%; border: 2px solid #fff;
}

.hdr-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--kci-red), #F97316);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; cursor: pointer;
}

.hdr-user { text-align: right; cursor: pointer; }
.hdr-user-name { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.hdr-user-role { font-size: 10px; color: var(--text-muted); }

.live-badge {
  display: flex; align-items: center; gap: 4px;
  background: #DCFCE7; border-radius: 20px; padding: 3px 9px;
  font-size: 10px; font-weight: 700; color: #15803D;
}
.live-badge .dot {
  width: 6px; height: 6px;
  background: #22C55E; border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:.5; transform:scale(1.3); }
}

.hdr-clock {
  font-size: 11px; color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-app); padding: 3px 8px; border-radius: 5px;
}

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  position: fixed;
  top: var(--header-h); left: 0; bottom: 0;
  overflow-y: auto;
  display: flex; flex-direction: column;
  z-index: 90;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.nav-sec { padding: 10px 8px 2px; }

.nav-sec-label {
  font-size: 9px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: #3D5166;
  padding: 0 6px; margin-bottom: 3px;
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 7px;
  color: var(--text-sidebar); text-decoration: none;
  font-size: 12px; font-weight: 500;
  transition: all .12s; position: relative; cursor: pointer;
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #CBD5E1; }
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active); font-weight: 700;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 3px; background: var(--kci-red); border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.04); font-size: 11px; flex-shrink: 0;
}
.nav-item.active .nav-icon { background: rgba(228,35,19,.2); color: #FCA5A5; }

.nav-badge {
  margin-left: auto; background: var(--kci-red); color: #fff;
  font-size: 9px; font-weight: 800;
  padding: 1px 5px; border-radius: 8px; min-width: 16px; text-align: center;
}
.nav-badge.green  { background: #22C55E; }
.nav-badge.amber  { background: #F59E0B; }
.nav-badge.slate  { background: #475569; }

.nav-divider { height: 1px; background: #1E293B; margin: 6px 8px; }

.sidebar-footer {
  margin-top: auto; padding: 8px;
  border-top: 1px solid #1E293B;
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 7px;
  background: rgba(255,255,255,.04);
}
.sidebar-user .s-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--kci-red), #F97316);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user .s-info { flex: 1; min-width: 0; }
.sidebar-user .s-name { font-size: 11px; font-weight: 700; color: #E2E8F0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .s-role { font-size: 10px; color: #64748B; }
.sidebar-user .s-logout {
  width: 26px; height: 26px; border: none; background: transparent;
  color: #475569; cursor: pointer; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  transition: all .12s;
}
.sidebar-user .s-logout:hover { background: rgba(228,35,19,.15); color: #FCA5A5; }

/* ── Main Content ────────────────────────────────────────── */
.main {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 18px 20px; min-width: 0;
}

.page-title { font-size: 17px; font-weight: 800; color: var(--text-primary); margin-bottom: 2px; }
.page-sub { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }

/* ── KPI Cards ───────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.kpi {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 12px 14px; border-top: 3px solid var(--kpi-color, #E2E8F0);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.kpi-value { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.kpi-delta { font-size: 11px; color: var(--text-muted); }
.kpi-delta .up { color: #22C55E; }
.kpi-delta .down { color: var(--kci-red); }
.kpi-icon {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--kpi-color, #E2E8F0); opacity: .12;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head {
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.card-head h3 { font-size: 13px; font-weight: 700; flex: 1; }
.card-body { padding: 14px 16px; }

/* ── Table ───────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border); background: #F8FAFC;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #F8FAFC; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
}
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-green  { background: #DCFCE7; color: #15803D; }
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-amber  { background: #FEF3C7; color: #92400E; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }
.badge-slate  { background: #F1F5F9; color: #475569; }
.badge-orange { background: #FFEDD5; color: #C2410C; }
.badge .dot   { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 7px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  border: none; transition: all .12s; font-family: var(--font-main);
}
.btn-primary { background: var(--kci-red); color: #fff; }
.btn-primary:hover { background: var(--kci-red-dark); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-app); border-color: #CBD5E1; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-app); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 7px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 10px;
  flex: 1; min-width: 180px;
}
.search-box i { color: var(--text-muted); font-size: 12px; }
.search-box input {
  border: none; outline: none; font-family: var(--font-main);
  font-size: 12px; flex: 1; background: transparent; color: var(--text-primary);
}
.filter-select {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 10px;
  font-family: var(--font-main); font-size: 12px; color: var(--text-secondary);
  outline: none; cursor: pointer;
}

/* ── info-row (detail panel) ─────────────────────────────── */
.info-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 6px 0; border-bottom: 1px solid #F8FAFC;
}
.info-row:last-child { border-bottom: none; }
.info-lbl { font-size: 10px; color: #94A3B8; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.info-val { font-size: 11px; color: #0F172A; font-weight: 700; text-align: right; max-width: 190px; }

/* ── Utility ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }
.text-red { color: var(--kci-red); }
.text-green { color: #22C55E; }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Grid helpers ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
