:root {
  --bg: #f6f8fb;
  --bg-card: #ffffff;
  --ink-900: #0b1220;
  --ink-700: #1e293b;
  --ink-500: #475569;
  --ink-400: #64748b;
  --ink-300: #94a3b8;
  --ink-200: #cbd5e1;
  --ink-100: #e2e8f0;
  --line: #eef2f7;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-ink: #1d4ed8;
  --ok: #059669;
  --ok-soft: #d1fae5;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
}

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

html, body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--ink-700);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { color: var(--ink-900); font-weight: 700; letter-spacing: -0.01em; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select { font-family: inherit; outline: none; }
table { border-collapse: collapse; width: 100%; }

/* ===== Header ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: 1px;
  box-shadow: var(--shadow-md);
}
.titles h1 { font-size: 18px; line-height: 1.2; }
.titles p { font-size: 12px; color: var(--ink-400); margin-top: 2px; }

.header-right { display: flex; gap: 10px; align-items: center; }
.date-pill, .data-pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--ink-100);
  color: var(--ink-500);
}
.data-pill { background: var(--accent-soft); color: var(--accent-ink); }

.nav-link {
  padding: 7px 14px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  box-shadow: 0 1px 2px rgba(251, 191, 36, 0.25);
}
.nav-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(251, 191, 36, 0.35);
  filter: brightness(1.05);
}

main { padding: 24px 40px 60px; max-width: 1440px; margin: 0 auto; }

/* ===== Search ===== */
.search-section {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  border: 1px solid var(--line);
}
.search-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-400); margin-bottom: 14px;
}
.search-label-badge {
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  color: #fff;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
}
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--ink-100);
  border-radius: 12px;
  padding: 0 18px;
  transition: all 0.2s;
}
.search-bar:focus-within {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.search-icon { color: var(--ink-400); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  padding: 16px 14px;
  font-size: 15px;
  background: transparent;
  color: var(--ink-900);
}
.search-bar input::placeholder { color: var(--ink-300); }
.search-bar button {
  background: var(--accent);
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s;
}
.search-bar button:hover { background: var(--accent-ink); }

.suggested-queries {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--ink-100);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-500);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ===== Answer Card ===== */
.answer-card {
  margin-top: 20px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f5f3ff 0%, #eff6ff 100%);
  border: 1px solid #ddd6fe;
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.answer-header { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.a-label {
  background: #0b1220; color: #fff;
  padding: 3px 10px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px;
}
.intent-tag {
  background: var(--purple-soft); color: var(--purple);
  padding: 3px 10px; border-radius: 5px;
  font-size: 11px; font-weight: 600;
}
.confidence {
  margin-left: auto;
  font-size: 11px; color: var(--ink-400);
}
.answer-body {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-900);
  white-space: pre-wrap;
}
.answer-body strong { color: var(--accent-ink); font-weight: 700; }
.answer-body .num-em {
  background: #fef9c3;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  color: #854d0e;
}
.evidence-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed #ddd6fe;
}
.evidence-wrap h4 {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 10px;
  display: flex; gap: 6px; align-items: center;
  font-weight: 600;
}
.evidence-count {
  background: var(--ink-100); color: var(--ink-500);
  padding: 1px 7px; border-radius: 10px;
  font-size: 10.5px;
}
.evidence {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.evidence-row {
  display: grid;
  grid-template-columns: 90px 60px 70px 1fr 80px 120px;
  gap: 12px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12.5px;
  align-items: center;
}
.evidence-row .ev-date { color: var(--ink-400); font-variant-numeric: tabular-nums; }
.evidence-row .ev-product { font-weight: 600; }
.evidence-row .ev-qty { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.evidence-row .ev-cust { color: var(--ink-500); }

/* ===== KPI ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.kpi.ok::before { background: var(--ok); }
.kpi.warn::before { background: var(--warn); }
.kpi.danger::before { background: var(--danger); }

.kpi-label { font-size: 12px; color: var(--ink-400); margin-bottom: 6px; font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 800; color: var(--ink-900); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: 13px; color: var(--ink-400); margin-left: 4px; font-weight: 500; }
.kpi-sub { font-size: 11.5px; color: var(--ink-400); margin-top: 4px; }
.kpi-sub .up { color: var(--ok); font-weight: 600; }
.kpi-sub .down { color: var(--danger); font-weight: 600; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.card h3 { font-size: 14.5px; }
.muted { color: var(--ink-400); font-size: 11.5px; font-weight: 500; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-container { min-height: 280px; }

/* ===== Bar Chart (품목별 재고) ===== */
.bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 70px;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.bar-label { color: var(--ink-700); font-weight: 600; }
.bar-track {
  height: 20px;
  background: var(--bg);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.bar-fill.low { background: linear-gradient(90deg, #f97316, #ea580c); }
.bar-fill.critical { background: linear-gradient(90deg, #ef4444, #dc2626); }
.bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-700); }
.bar-safety { font-size: 10.5px; color: var(--ink-400); }

/* ===== Line Chart (SVG) ===== */
.trend-svg { width: 100%; height: 260px; }
.trend-svg .axis-line { stroke: var(--ink-200); stroke-width: 1; }
.trend-svg .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.trend-svg .axis-label { fill: var(--ink-400); font-size: 10px; }
.trend-svg .path-in { fill: none; stroke: var(--ok); stroke-width: 2; }
.trend-svg .path-out { fill: none; stroke: var(--accent); stroke-width: 2; }
.trend-svg .area-in { fill: var(--ok-soft); opacity: 0.4; }
.trend-svg .area-out { fill: var(--accent-soft); opacity: 0.4; }
.trend-svg .dot-in { fill: var(--ok); }
.trend-svg .dot-out { fill: var(--accent); }

.chart-legend {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  justify-content: flex-end;
  font-size: 11.5px;
  color: var(--ink-500);
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* ===== Table ===== */
.table-head { margin-bottom: 16px; }
.filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filters select, .filters input {
  padding: 8px 12px;
  border: 1px solid var(--ink-100);
  border-radius: 7px;
  font-size: 13px;
  background: #fff;
  color: var(--ink-700);
  transition: border-color 0.15s;
}
.filters select:focus, .filters input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.filters input { min-width: 220px; }

.table-wrap { overflow-x: auto; }
table th {
  background: #fafbfc;
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-500);
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
table th.num, table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-700);
}
table tbody tr { transition: background 0.1s; }
table tbody tr:hover { background: #fafbfc; }
table tbody tr.matched { background: #fef9c3; }

.type-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.type-입고 { background: var(--ok-soft); color: var(--ok); }
.type-출고 { background: var(--accent-soft); color: var(--accent-ink); }
.type-회수 { background: var(--purple-soft); color: var(--purple); }
.type-반품 { background: var(--warn-soft); color: var(--warn); }
.type-조정 { background: var(--ink-100); color: var(--ink-500); }

.qty-positive { color: var(--ok); font-weight: 700; }
.qty-negative { color: var(--accent-ink); font-weight: 700; }
.qty-neutral { color: var(--ink-500); font-weight: 700; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.pagination button {
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-500);
  transition: all 0.15s;
}
.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
#pageInfo { font-size: 12.5px; color: var(--ink-500); font-variant-numeric: tabular-nums; }

/* ===== Footer ===== */
.app-footer {
  padding: 20px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-400);
  background: #fff;
}

/* ===== Tabs ===== */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--line);
}
.tab-btn {
  padding: 8px 18px;
  background: transparent;
  color: var(--ink-500);
  font-size: 13px;
  font-weight: 600;
  border-radius: 7px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--ink-900); }
.tab-btn.active {
  background: #fff;
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.tab-btn .tab-icon { font-size: 14px; }
.tab-btn .tab-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--danger);
  margin-left: 4px;
}
.tab-panel[hidden] { display: none !important; }

/* ===== Alert Banner ===== */
.alert-banner {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.alert-banner.critical {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  border-color: #fca5a5;
  border-left-color: var(--danger);
}
.alert-banner .alert-icon { font-size: 22px; flex-shrink: 0; }
.alert-banner .alert-body { flex: 1; }
.alert-banner .alert-title { font-weight: 700; font-size: 13.5px; color: var(--ink-900); }
.alert-banner .alert-sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.alert-banner .alert-cta {
  background: var(--ink-900); color: #fff;
  padding: 7px 14px; border-radius: 7px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.alert-banner .alert-cta:hover { background: var(--ink-700); }

/* ===== Notification Bell & Panel ===== */
.notification-bell {
  position: relative;
  width: 40px; height: 40px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}
.notification-bell:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.notification-bell .badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 5px;
  border-radius: 999px;
  min-width: 18px; text-align: center;
  border: 2px solid #fff;
  animation: pulsate 1.8s infinite;
}
@keyframes pulsate {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.notification-panel {
  position: absolute;
  top: 56px; right: 40px;
  width: 380px;
  max-height: 500px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: dropIn 0.2s ease-out;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.notification-panel[hidden] { display: none; }
.np-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.np-head h4 { font-size: 13.5px; }
.np-head .np-clear {
  background: none; color: var(--ink-400); font-size: 11px;
  cursor: pointer;
}
.np-head .np-clear:hover { color: var(--accent); }
.np-list { overflow-y: auto; flex: 1; }
.np-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
  display: flex; gap: 10px;
  position: relative;
}
.np-item:hover { background: #fafbfc; }
.np-item.unread::before {
  content: '';
  position: absolute;
  left: 8px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
}
.np-item .np-icon { font-size: 20px; flex-shrink: 0; }
.np-item .np-content { flex: 1; min-width: 0; }
.np-item .np-title { font-size: 12.5px; font-weight: 600; color: var(--ink-900); }
.np-item .np-body { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.np-item .np-time { font-size: 10.5px; color: var(--ink-300); margin-top: 4px; }
.np-item .np-sev {
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px;
  margin-left: auto; align-self: flex-start;
}
.np-sev.critical { background: var(--danger-soft); color: var(--danger); }
.np-sev.high { background: var(--warn-soft); color: var(--warn); }
.np-sev.medium { background: var(--accent-soft); color: var(--accent-ink); }

.np-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-400);
  font-size: 12.5px;
}

/* ===== Toast ===== */
.toast-stack {
  position: fixed;
  top: 80px; right: 24px;
  z-index: 200;
  display: flex; flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 300px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  display: flex; gap: 10px;
  animation: slideRight 0.3s ease-out, fadeOut 0.5s ease-in 4.5s forwards;
  pointer-events: auto;
}
.toast.critical { border-left-color: var(--danger); }
.toast.high { border-left-color: var(--warn); }
.toast.medium { border-left-color: var(--accent); }
.toast .toast-icon { font-size: 20px; flex-shrink: 0; }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-size: 12.5px; font-weight: 700; color: var(--ink-900); }
.toast .toast-msg { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
@keyframes slideRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: flex; justify-content: center; align-items: center;
  animation: fadeIn 0.2s ease-out;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-panel {
  background: #fff;
  border-radius: 14px;
  max-width: 760px;
  width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { font-size: 15px; }
.modal-head .modal-close {
  background: var(--bg);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--ink-500);
  transition: all 0.15s;
}
.modal-head .modal-close:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}
.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
  display: flex; justify-content: flex-end; gap: 8px;
}
.modal-foot button {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-foot .btn-primary {
  background: var(--accent);
  color: #fff;
}
.modal-foot .btn-primary:hover { background: var(--accent-ink); }
.modal-foot .btn-secondary {
  background: #fff;
  border: 1px solid var(--ink-100);
  color: var(--ink-500);
}
.modal-foot .btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Evidence Modal Content ===== */
.evidence-detail {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
}
.evidence-detail .ev-image-wrap {
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 3/4;
  display: flex; align-items: center; justify-content: center;
}
.evidence-detail .ev-image {
  width: 100%; height: 100%; object-fit: cover;
}
.evidence-detail .ev-meta dt {
  font-size: 10.5px;
  color: var(--ink-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.evidence-detail .ev-meta dd {
  font-size: 13px;
  color: var(--ink-900);
  font-weight: 600;
  margin-bottom: 12px;
}
.evidence-detail .ev-timeline {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.evidence-detail .ev-timeline h4 {
  font-size: 11px; color: var(--ink-400); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 8px;
}
.evidence-detail .ev-timeline ul { list-style: none; font-size: 12px; }
.evidence-detail .ev-timeline li {
  padding: 5px 0 5px 18px;
  position: relative;
  color: var(--ink-500);
}
.evidence-detail .ev-timeline li::before {
  content: '';
  position: absolute;
  left: 4px; top: 10px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

/* ===== P-BOX Asset View ===== */
.asset-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.asset-summary .kpi { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); }
.asset-summary .kpi.danger { background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%); }
.asset-summary .kpi.warn { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); }
.asset-summary .kpi.ok { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.asset-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.15s;
  cursor: pointer;
  position: relative;
}
.asset-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 10px 0 0 10px;
}
.asset-card.severity-critical::before { background: var(--danger); }
.asset-card.severity-high::before { background: var(--warn); }
.asset-card.severity-medium::before { background: var(--accent); }
.asset-card.severity-low::before { background: var(--ok); }
.asset-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.asset-card .ac-name { font-size: 13px; font-weight: 700; color: var(--ink-900); margin-bottom: 2px; }
.asset-card .ac-region { font-size: 11px; color: var(--ink-400); margin-bottom: 10px; }
.asset-card .ac-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.asset-card .ac-stat { text-align: center; padding: 6px; background: var(--bg); border-radius: 6px; }
.asset-card .ac-stat .label { font-size: 10px; color: var(--ink-400); }
.asset-card .ac-stat .val { font-size: 14px; font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; margin-top: 2px; }
.asset-card .ac-outstanding {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.asset-card.severity-critical .ac-outstanding { background: var(--danger-soft); color: var(--danger); }
.asset-card.severity-high .ac-outstanding { background: var(--warn-soft); color: var(--warn); }
.asset-card.severity-medium .ac-outstanding { background: var(--accent-soft); color: var(--accent-ink); }
.asset-card.severity-low .ac-outstanding { background: var(--ok-soft); color: var(--ok); }
.asset-card .ac-outstanding .big { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ===== Customer Detail ===== */
.customer-selector {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 20px;
}
.customer-selector select {
  padding: 10px 16px;
  min-width: 280px;
  border: 1px solid var(--ink-100);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
  font-weight: 500;
}
.customer-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  border-radius: 14px;
  padding: 26px 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.customer-hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
}
.customer-hero .ch-name { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; color: #fff; }
.customer-hero .ch-meta { display: flex; gap: 18px; margin-top: 6px; font-size: 12px; color: #94a3b8; }
.customer-hero .ch-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}
.customer-hero .ch-stat .val { font-size: 22px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.customer-hero .ch-stat .unit { font-size: 12px; color: #94a3b8; font-weight: 500; margin-left: 3px; }
.customer-hero .ch-stat .label { font-size: 11px; color: #64748b; margin-top: 3px; }

/* ===== Driver KPI ===== */
.kpi-ranking {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  margin-bottom: 20px;
}
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table th {
  background: #fafbfc;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
}
.rank-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.rank-table tr { cursor: pointer; transition: background 0.1s; }
.rank-table tr:hover { background: #fafbfc; }
.rank-table .rank-num {
  display: inline-flex;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink-100);
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 700;
  align-items: center; justify-content: center;
}
.rank-table tr:nth-child(1) .rank-num { background: #fbbf24; color: #fff; }
.rank-table tr:nth-child(2) .rank-num { background: #94a3b8; color: #fff; }
.rank-table tr:nth-child(3) .rank-num { background: #d97706; color: #fff; }
.rank-table .score-bar {
  display: flex; align-items: center; gap: 6px;
}
.rank-table .score-bar .bar {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.rank-table .score-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 3px;
}
.rank-table .score-bar .val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 28px; }

.radar-svg { width: 100%; height: 320px; }
.radar-svg .axis-line { stroke: var(--ink-200); stroke-width: 1; }
.radar-svg .radar-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-svg .radar-polygon { fill: rgba(37, 99, 235, 0.15); stroke: var(--accent); stroke-width: 2; }
.radar-svg .radar-dot { fill: var(--accent); }
.radar-svg .radar-label { fill: var(--ink-500); font-size: 11px; font-weight: 600; }

/* ===== Driver Mobile View (Phone Frame) ===== */
.phone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  z-index: 400;
  display: flex; justify-content: center; align-items: center;
  animation: fadeIn 0.2s ease-out;
}
.phone-overlay[hidden] { display: none; }
.phone-frame {
  width: 340px;
  height: 680px;
  background: #0b1220;
  border-radius: 40px;
  padding: 14px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: slideUp 0.3s ease-out;
}
.phone-frame::before {
  content: '';
  position: absolute;
  top: 14px; left: 50%; transform: translateX(-50%);
  width: 100px; height: 22px;
  background: #0b1220;
  border-radius: 0 0 14px 14px;
  z-index: 2;
}
.phone-screen {
  width: 100%; height: 100%;
  background: var(--bg);
  border-radius: 28px;
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
}
.phone-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  padding: 38px 18px 16px;
  font-size: 13px;
}
.phone-header .greeting { font-size: 11px; color: #94a3b8; }
.phone-header .driver-name { font-size: 16px; font-weight: 800; margin-top: 2px; }
.phone-header select {
  margin-top: 10px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.phone-header select option { color: #000; }
.phone-summary {
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  text-align: center;
}
.phone-summary .ps-val { font-size: 16px; font-weight: 800; color: var(--ink-900); }
.phone-summary .ps-label { font-size: 10px; color: var(--ink-400); margin-top: 2px; }
.phone-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
}
.phone-txn {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-size: 12px;
}
.phone-txn .pt-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.phone-txn .pt-cust { font-weight: 700; color: var(--ink-900); font-size: 12.5px; }
.phone-txn .pt-time { font-size: 10px; color: var(--ink-400); }
.phone-txn .pt-body { color: var(--ink-500); font-size: 11.5px; }
.phone-txn .pt-badges { margin-top: 4px; display: flex; gap: 4px; }
.phone-txn .pt-badges .type-badge { font-size: 9.5px; padding: 1px 6px; }
.phone-close {
  position: absolute;
  top: -38px; right: 0;
  background: rgba(255,255,255,0.9);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: #000;
}

.fab {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 80;
  background: linear-gradient(135deg, #0f172a, #334155);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.3);
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15, 23, 42, 0.4); }

/* ===== Monthly Report ===== */
.report-controls {
  display: flex; gap: 10px; margin-bottom: 20px; align-items: center;
}
.report-controls select {
  padding: 8px 14px;
  border: 1px solid var(--ink-100);
  border-radius: 7px;
  font-size: 13px;
  background: #fff;
}
.report-controls .print-btn {
  margin-left: auto;
  background: var(--ink-900);
  color: #fff;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.report-controls .print-btn:hover { background: var(--ink-700); }

.report-page {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 44px 52px;
  max-width: 820px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}
.report-page h2 { font-size: 22px; margin-bottom: 2px; }
.report-page .r-subtitle { font-size: 12.5px; color: var(--ink-400); margin-bottom: 24px; padding-bottom: 18px; border-bottom: 2px solid var(--ink-900); }
.report-page h3 { font-size: 14px; margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.report-page .r-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 8px;
}
.report-page .r-kpi {
  background: var(--bg);
  border-radius: 7px;
  padding: 12px 14px;
}
.report-page .r-kpi .r-label { font-size: 10.5px; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.5px; }
.report-page .r-kpi .r-val { font-size: 18px; font-weight: 800; color: var(--ink-900); margin-top: 3px; font-variant-numeric: tabular-nums; }
.report-page table { width: 100%; font-size: 11.5px; }
.report-page table th { background: #fafbfc; font-size: 10.5px; }
.report-page .r-footer {
  margin-top: 30px; padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--ink-400);
}
@media print {
  body * { visibility: hidden; }
  .report-page, .report-page * { visibility: visible; }
  .report-page { position: absolute; left: 0; top: 0; width: 100%; border: none; box-shadow: none; padding: 0; }
  .app-header, .tab-nav, .report-controls, .app-footer, .fab { display: none !important; }
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-ranking { grid-template-columns: 1fr; }
  .customer-hero .ch-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .app-header { padding: 16px 20px; flex-wrap: wrap; }
  main { padding: 16px 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .asset-summary { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-wrap: wrap; }
  .filters input { min-width: 100%; }
  .table-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .evidence-row { grid-template-columns: 1fr 1fr; font-size: 11.5px; }
  .tab-nav { overflow-x: auto; }
  .evidence-detail { grid-template-columns: 1fr; }
  .notification-panel { right: 16px; width: calc(100vw - 32px); max-width: 380px; }
}
