/* =====================================================================
   PHAROS ROUTE OPTIMIZER — Design system
   Primary #2563EB · Success #10B981 · Warning #F59E0B · Danger #EF4444
   Background #F8FAFC · Card #FFFFFF · Border #E2E8F0 · Font Inter
   Card radius 12px
   ===================================================================== */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #EFF6FF;
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --info: #3B82F6;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-faint: #94A3B8;
  --sidebar-bg: #0B1530;
  --sidebar-bg-2: #0F1B3D;
  --sidebar-text: #93A2C7;
  --sidebar-text-active: #FFFFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 8px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.14);
  --sidebar-w: 264px;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--primary-light); }

/* ---------- focus visibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, .focusable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

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

@media (max-width: 1080px) {
  .main-area { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.is-open { transform: translateX(0); }
}

@media (min-width: 1081px) {
  .sidebar { transition: transform .2s ease; }
  .main-area { transition: margin-left .2s ease; }
  .app-shell.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .app-shell.sidebar-collapsed .main-area { margin-left: 0; }
}

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 22px 18px;
}

.sidebar-brand .brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .3px;
  line-height: 1.1;
}

.sidebar-brand .brand-sub {
  color: #6F82B5;
  font-size: 10px;
  letter-spacing: 1.4px;
  font-weight: 600;
}

.nav-section { padding: 6px 14px; }
.nav-section + .nav-section { margin-top: 6px; }

.nav-section-title {
  color: #5B6E9C;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}

.nav-item svg { flex-shrink: 0; opacity: .85; }

.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }

.nav-item.active {
  background: var(--primary);
  color: var(--sidebar-text-active);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}
.nav-item.active svg { opacity: 1; }

/* ---------- topbar ---------- */
.topbar {
  height: 68px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }

.menu-toggle {
  display: inline-flex;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--bg); color: var(--text); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}
.breadcrumb .crumb-current { color: var(--text); font-weight: 600; }
.breadcrumb svg { color: var(--text-faint); flex-shrink: 0; }

.page-title { font-size: 17px; font-weight: 700; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 18px; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary); }

.notif-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--card);
}

.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta .u-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.user-meta .u-role { font-size: 11.5px; color: var(--text-muted); }

/* ---------- page content ---------- */
.page-content {
  padding: 24px;
  flex: 1;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- generic card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-pad { padding: 20px 22px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title { font-size: 15.5px; font-weight: 700; color: var(--text); }

.link-action {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.link-action:hover { text-decoration: underline; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: filter .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.97); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: stretch;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* Container-responsive variant for KPI grids inside narrow fixed-width
   containers (e.g. modals) - .kpi-grid's column count is keyed to viewport
   width via @media, which is wrong once the grid itself is narrower than the
   viewport (a modal), so it needs to size columns off its own width instead. */
.kpi-grid-modal { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.kpi-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.kpi-icon.tone-blue { background: #EAF1FF; color: var(--primary); }
.kpi-icon.tone-purple { background: #F1EAFE; color: #7C3AED; }
.kpi-icon.tone-green { background: var(--success-light); color: var(--success); }
.kpi-icon.tone-orange { background: var(--warning-light); color: #D97706; }
.kpi-icon.tone-skyblue { background: #E6F4FF; color: #0EA5E9; }
.kpi-icon.tone-teal { background: #E5FBF6; color: #0D9488; }

.kpi-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.kpi-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.kpi-delta { font-size: 11.5px; font-weight: 600; margin-top: 10px; color: var(--success); }
.kpi-delta.down { color: var(--danger); }

/* ---------- status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ready { background: var(--success-light); color: var(--success); }
.badge-processing { background: var(--warning-light); color: #B45309; }
.badge-failed { background: var(--danger-light); color: var(--danger); }
.badge-completed { background: var(--success-light); color: var(--success); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFBFF; }

.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--text-muted); }

.progress-track {
  width: 110px;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
.progress-fill { display: block; height: 100%; border-radius: 999px; background: var(--success); }
.progress-fill.inprogress { background: var(--primary); }
.progress-fill.warn { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }
.progress-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.row-action-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--card);
}
.row-action-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }

/* ---------- dashboard grid ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* donut chart */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.donut-figure { position: relative; width: 168px; height: 168px; }
.donut-figure svg { transform: rotate(-90deg); }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-center .pct { font-size: 26px; font-weight: 700; color: var(--text); }
.donut-center .pct-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.legend-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.legend-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; display: inline-block; }
.legend-name { display: flex; align-items: center; color: var(--text); font-weight: 500; }
.legend-val { color: var(--text-muted); font-weight: 600; font-size: 12.5px; }

/* ---------- login page ---------- */
.login-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; background: var(--card); }
@media (max-width: 920px) { .login-shell { grid-template-columns: 1fr; } .login-hero { display: none; } }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form-inner { width: 100%; max-width: 380px; }

.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; }
.login-brand .brand-name { font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: .2px; }
.login-brand .brand-sub { font-size: 10px; color: var(--text-muted); letter-spacing: 1.6px; font-weight: 700; }

.login-form-inner h1 { font-size: 26px; font-weight: 700; margin: 0 0 6px; color: var(--text); }
.login-form-inner .lede { color: var(--text-muted); margin: 0 0 30px; font-size: 14px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.field-input-wrap { position: relative; }
.field input[type="text"], .field input[type="email"], .field input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.field .reveal-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-faint); padding: 4px;
}

.form-row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--primary); }
.forgot-link { font-size: 13px; font-weight: 600; color: var(--primary); }

.login-foot { margin-top: 28px; font-size: 12px; color: var(--text-faint); }

.login-hero {
  position: relative;
  background: linear-gradient(160deg, #BFD8FF 0%, #E7F0FF 55%, #F4F8FF 100%);
  overflow: hidden;
}
.login-hero svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- project cards (All Projects) ---------- */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1180px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .project-grid { grid-template-columns: 1fr; } }

.project-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.project-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-card-name { font-weight: 700; font-size: 15px; color: var(--text); }
.project-card-company { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

.project-stats { display: flex; gap: 22px; }
.project-stat .v { font-weight: 700; font-size: 15px; color: var(--text); }
.project-stat .l { font-size: 11.5px; color: var(--text-muted); }

.project-card-actions { display: flex; gap: 8px; margin-top: auto; }
.project-card-actions .btn { flex: 1; }

/* ---------- project detail ---------- */
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.detail-title-row { display: flex; align-items: center; gap: 10px; }
.detail-title-row h1 { font-size: 22px; font-weight: 700; margin: 0; color: var(--text); }
.detail-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.detail-actions { display: flex; gap: 10px; }

.metrics-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) { .metrics-row { grid-template-columns: repeat(2, 1fr); } }
.metric-box { padding: 16px 18px; }
.metric-box .m-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.metric-box .m-value { font-size: 20px; font-weight: 700; margin-top: 8px; color: var(--text); }
.metric-box .m-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.workflow-strip { display: flex; align-items: flex-start; justify-content: space-between; padding: 26px 10px 10px; gap: 4px; }
.workflow-step { display: flex; flex-direction: column; align-items: center; flex: 1; text-align: center; position: relative; }
.workflow-step .w-circle {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text-faint);
  z-index: 2;
}
.workflow-step.done .w-circle { background: var(--success-light); border-color: var(--success); color: var(--success); }
.workflow-step.current .w-circle { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.workflow-step .w-label { font-size: 12.5px; font-weight: 600; color: var(--text); margin-top: 10px; }
.workflow-step .w-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.workflow-step::before {
  content: "";
  position: absolute;
  top: 21px; left: -50%; width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 1;
}
.workflow-step:first-child::before { display: none; }
.workflow-step.done::before { background: var(--success); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } }
.summary-card { padding: 16px 18px; }
.summary-card .s-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.summary-card .s-value { font-size: 19px; font-weight: 700; margin: 8px 0 2px; }
.summary-card .s-value.is-success { color: var(--success); }
.summary-card .s-updated { font-size: 11.5px; color: var(--text-faint); }
.summary-card .s-link { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--primary); }

.actions-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1100px) { .actions-grid { grid-template-columns: repeat(2, 1fr); } }
.action-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
}
.action-tile:hover { border-color: var(--primary); box-shadow: var(--shadow-card); }
.action-tile .a-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.action-tile .a-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.action-tile .a-sub { font-size: 11.5px; color: var(--text-muted); }
.action-tile.primary { background: var(--primary); border-color: var(--primary); }
.action-tile.primary .a-icon { background: rgba(255,255,255,.18); color: #fff; }
.action-tile.primary .a-title, .action-tile.primary .a-sub { color: #fff; }
.action-tile.primary .a-sub { opacity: .85; }

/* ---------- upload screen ---------- */
.upload-grid { display: grid; grid-template-columns: 230px 1fr 260px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .upload-grid { grid-template-columns: 1fr; } }

.steps-list { display: flex; flex-direction: column; gap: 0; }
.step-row { display: flex; gap: 12px; padding: 4px 0 28px; position: relative; }
.step-row:last-child { padding-bottom: 0; }
.step-row::before {
  content: "";
  position: absolute;
  left: 15px; top: 32px; bottom: 0;
  width: 2px;
  background: var(--border);
}
.step-row:last-child::before { display: none; }
.step-row .s-circle {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700;
  background: var(--bg); color: var(--text-faint);
  border: 2px solid var(--border);
  flex-shrink: 0; z-index: 1;
}
.step-row.current .s-circle { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-row.done .s-circle { background: var(--success); border-color: var(--success); color: #fff; }
.step-row .s-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.step-row.current .s-title { color: var(--primary); }
.step-row .s-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: #FAFBFE;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 50px 24px;
  gap: 14px;
  min-height: 280px;
  transition: border-color .15s, background .15s;
}
.dropzone.is-dragover { border-color: var(--primary); background: var(--primary-light); }
.dropzone .dz-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.dropzone .dz-title { font-weight: 600; font-size: 14px; color: var(--text); }
.dropzone .dz-sub { font-size: 12.5px; color: var(--text-muted); }

.uploaded-file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 16px;
  background: #fff;
}
.uploaded-file-row .f-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--success-light); color: var(--success);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.uploaded-file-row .f-name { font-weight: 600; font-size: 13px; color: var(--text); }
.uploaded-file-row .f-size { font-size: 11.5px; color: var(--text-muted); }
.uploaded-file-row .f-status { margin-left: auto; color: var(--success); }

.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-list li { display: flex; gap: 8px; font-size: 13px; color: var(--text); align-items: flex-start; }
.req-list li svg { color: var(--text-faint); flex-shrink: 0; margin-top: 1px; }
.req-list.checked li svg { color: var(--success); }

/* ---------- results screen ---------- */
.results-layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .results-layout { grid-template-columns: 1fr; } }

.search-input-wrap { position: relative; margin-bottom: 14px; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search-input-wrap input {
  width: 100%; padding: 9px 12px 9px 36px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit;
}
.search-input-wrap input:focus { outline: none; border-color: var(--primary); }

.route-list { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; padding-right: 4px; }
.route-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.route-card:hover { border-color: #C7D6F5; }
.route-card.selected { border-color: var(--primary); background: var(--primary-light); }
.route-card .r-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.route-card .r-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.route-card .r-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.route-card .r-util { margin-left: auto; font-weight: 700; font-size: 13px; color: var(--success); }

.map-card { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 560px; border: 1px solid var(--border); }
.map-controls { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 5; }
.map-controls .icon-btn { background: #fff; box-shadow: var(--shadow-card); }

.vehicle-panel {
  position: absolute; top: 16px; left: 16px; width: 240px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-pop);
  padding: 16px; z-index: 6;
}
.vehicle-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.vehicle-panel-head .vp-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.vehicle-panel-head .vp-dot { width: 10px; height: 10px; border-radius: 50%; }
.vehicle-panel-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.vehicle-panel-stats div { text-align: left; }
.vehicle-panel-stats .vp-val { font-weight: 700; font-size: 13.5px; color: var(--text); }
.vehicle-panel-stats .vp-key { font-size: 10px; color: var(--text-muted); }
.vp-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 12px; }
.vp-tabs button { flex: 1; padding: 6px; border: none; background: none; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.vp-tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-card); }
.vp-timeline { display: flex; flex-direction: column; gap: 0; max-height: 220px; overflow-y: auto; }
.vp-stop { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 12.5px; position: relative; }
.vp-stop .vs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.vp-stop .vs-label { color: var(--text); font-weight: 500; flex: 1; }
.vp-stop .vs-time { color: var(--text-muted); }

/* fake map background */
.fake-map { position: absolute; inset: 0; background: #E7EEF7; }
.fake-map svg { width: 100%; height: 100%; }

.results-toolbar { display: flex; align-items: center; gap: 10px; }

@media print {
  .sidebar, .topbar, .detail-actions, .actions-grid { display: none !important; }
}

/* =====================================================================
   PHAROS — Extended styles (partials, modals, pagination, flash, toast)
   ===================================================================== */

/* ---------- flash / alert ---------- */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 16px;
}
.flash-success { background: var(--success-light); color: #065f46; }
.flash-danger  { background: var(--danger-light);  color: #991b1b; }
.flash-info    { background: var(--primary-light);  color: #1e3a8a; }
.flash-warning { background: var(--warning-light);  color: #B45309; }
.flash-close   { margin-left: auto; background: none; border: none; cursor: pointer; opacity: .7; }
.flash-close:hover { opacity: 1; }

/* ---------- toast ---------- */
.ph-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  box-shadow: var(--shadow-pop);
  min-width: 220px;
  max-width: 360px;
}

/* ---------- modal overlay + panel ---------- */
.ph-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ph-modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

/* ---------- tooltip ---------- */
.ph-tooltip {
  position: absolute;
  background: #0F172A;
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}

/* ---------- pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 18px;
  justify-content: flex-end;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.page-btn:hover       { background: var(--primary-light); color: var(--primary); }
.page-btn.active      { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- field helpers ---------- */
.field-select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.field-select:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

.field-error {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  min-height: 16px;
}

input.is-error {
  border-color: var(--danger) !important;
}

/* ---------- breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.crumb-current { color: var(--text); font-weight: 500; }
