/* Tema: Soft Gray Premium + Modern Minimalist + Automotive Analytics */
:root {
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --navy: #1B2A4A;
  --blue: #2563EB;
  --blue-soft: #E8EFFD;
  --text: #3A4150;
  --muted: #8A91A3;
  --border: #E6E8EE;
  --danger: #DC2626;
  --success: #059669;
  --warn: #D97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 42, 74, .06), 0 8px 24px rgba(27, 42, 74, .06);
}
* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  margin: 0;
  font-size: 15px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout dengan sidebar */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px;
  background: var(--navy);
  color: #C9D2E8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.sidebar .brand {
  padding: 20px 20px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand small { display: block; font-weight: 400; font-size: 11.5px; color: #8FA0C6; margin-top: 2px; }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  color: #C9D2E8; padding: 11px 12px; border-radius: 10px;
  margin-bottom: 2px; font-weight: 500; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--blue); color: #fff; }
.nav .ico { width: 20px; text-align: center; font-size: 16px; }
.sidebar .userbox { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .userbox .name { color: #fff; font-weight: 600; }
.sidebar .userbox form { margin-top: 8px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; color: var(--navy); font-weight: 700; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }

/* Kartu & grid */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1100px) { .grid.cols-6, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-6, .grid.cols-4 { grid-template-columns: 1fr; } }

.stat-card { padding: 18px 20px; }
.stat-card .label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-card .value { font-size: 24px; font-weight: 700; color: var(--navy); margin-top: 6px; white-space: nowrap; }
.stat-card .value.price { font-size: 17px; color: var(--blue); }
.stat-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Form */
.form-label { font-weight: 600; font-size: 13.5px; color: var(--navy); margin-bottom: 6px; display: block; }
.form-control, .form-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14.5px; background: #fff; color: var(--text); min-height: 44px;
}
.form-control:focus, .form-select:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #24365e; color: #fff; }
.btn-accent { background: var(--blue); color: #fff; }
.btn-accent:hover { background: #1d4fd7; color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* Tabel */
.table-wrap { overflow-x: auto; }
/* Scrollbar horizontal di atas tabel (dibuat via JS, sinkron dengan .table-wrap) */
.table-topbar { overflow-x: auto; overflow-y: hidden; height: 14px; margin-bottom: 2px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.table-topbar-inner { height: 1px; }
.table-topbar::-webkit-scrollbar { height: 10px; }
.table-topbar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
.table-topbar::-webkit-scrollbar-track { background: transparent; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 10px 12px; text-align: left; background: #F8F9FB; color: var(--navy);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700;
  border-bottom: 2px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none;
}
.table th .arrow { color: var(--blue); }
.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.sortable:hover { color: var(--blue); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table td.mono, .table td.num { font-variant-numeric: tabular-nums; }
.table tr:hover td { background: #FAFBFE; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-motor { background: var(--blue-soft); color: var(--blue); }
.badge-mobil { background: #FDEBD8; color: var(--warn); }
.badge-outlier { background: #FDE2E2; color: var(--danger); }
.badge-ok { background: #DFF5EA; color: var(--success); }

/* Flash */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; font-size: 14px; }
.flash.success { background: #DFF5EA; color: var(--success); }
.flash.danger { background: #FDE2E2; color: var(--danger); }
.flash.info { background: var(--blue-soft); color: var(--blue); }

/* Analisis */
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .choice-cards { grid-template-columns: 1fr; } }
.choice-card {
  display: block; text-align: center; padding: 34px 20px; border-radius: var(--radius);
  background: var(--card); border: 2px solid var(--border); box-shadow: var(--shadow);
  color: var(--navy); font-size: 20px; font-weight: 700;
}
.choice-card:hover { border-color: var(--blue); text-decoration: none; color: var(--blue); }
.choice-card small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; margin-top: 6px; }

.price-range-bar { position: relative; height: 14px; background: #EEF0F5; border-radius: 999px; margin: 18px 0 6px; }
.price-range-bar .fill { position: absolute; top: 0; bottom: 0; background: var(--blue); border-radius: 999px; }
.price-range-bar .dot { position: absolute; top: 50%; width: 22px; height: 22px; background: var(--navy); border: 3px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: var(--shadow); }
.tooltip-q {
  display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: var(--blue-soft);
  color: var(--blue); font-size: 11px; font-weight: 700; align-items: center; justify-content: center;
  cursor: help; vertical-align: middle;
}

.alert-soft { padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.alert-soft.warn { background: #FEF3D8; color: var(--warn); }
.alert-soft.info { background: var(--blue-soft); color: var(--blue); }

.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }

/* Paginasi */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span {
  min-width: 36px; min-height: 36px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 600;
}
.pagination a:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.pagination .current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1B2A4A 0%, #2563EB 130%); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 34px 30px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; color: var(--navy); margin: 0 0 4px; font-weight: 800; }
.login-card p { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }

/* Autocomplete */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; z-index: 50; top: 100%; left: 0; right: 0; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto; display: none;
}
.ac-list .item { padding: 10px 14px; cursor: pointer; font-size: 14px; }
.ac-list .item:hover, .ac-list .item.sel { background: var(--blue-soft); color: var(--blue); }

/* Bottom nav untuk smartphone */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--navy); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; text-align: center; color: #C9D2E8; font-size: 11px; padding: 6px 2px;
    border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  }
  .bottom-nav a .ico { font-size: 18px; }
  .bottom-nav a.active { color: #fff; background: rgba(255,255,255,.12); }
  .content { padding: 16px 14px 90px; }
  .topbar { padding: 12px 16px; }
}
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 16px; }
.justify-between { justify-content: space-between; } .align-center { align-items: center; } .flex-wrap { flex-wrap: wrap; }
.text-right { text-align: right; }
h2.sec { font-size: 16px; color: var(--navy); font-weight: 700; margin: 0 0 14px; }
