/* ═══════════════════════════════════════════════════
   AHOM-RMC Vendor Dashboard · style.css
   Brand: Burgundy #800020 · Font: Lato
   ═══════════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────────── */
:root {
  --font-body: 'Lato', 'Helvetica Neue', sans-serif;

  /* Burgundy brand */
  --burgundy:         #800020;
  --burgundy-hover:   #6a001a;
  --burgundy-light:   #f5e6ea;
  --burgundy-muted:   rgba(128,0,32,.12);

  /* Surfaces */
  --color-bg:             #f4f3f0;
  --color-surface:        #ffffff;
  --color-surface-2:      #fafaf8;
  --color-surface-offset: #f0eeed;
  --color-border:         #e2e0db;
  --color-divider:        #e8e6e2;

  /* Text */
  --color-text:           #1e1c18;
  --color-text-muted:     #706e6a;
  --color-text-faint:     #b0aeaa;

  /* Accent palette */
  --color-teal:   #01696f;
  --color-blue:   #2563eb;
  --color-green:  #16a34a;
  --color-gold:   #ca8a04;
  --color-red:    #dc2626;

  /* Type scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;

  /* Radii */
  --r-sm: 0.375rem;
  --r-md: 0.625rem;
  --r-lg: 0.875rem;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 14px rgba(0,0,0,.08);

  /* Sidebar */
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --transition: 180ms cubic-bezier(.16,1,.3,1);
}

[data-theme="dark"] {
  --color-bg:             #131211;
  --color-surface:        #1c1b19;
  --color-surface-2:      #211f1e;
  --color-surface-offset: #1a1918;
  --color-border:         #333130;
  --color-divider:        #2a2927;
  --color-text:           #cccac6;
  --color-text-muted:     #7a7875;
  --color-text-faint:     #525050;
  --burgundy-light:       rgba(128,0,32,.2);
  --burgundy-muted:       rgba(128,0,32,.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 14px rgba(0,0,0,.4);
}

/* ── RESET ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
a { text-decoration: none; color: inherit; }
table { border-collapse: collapse; width: 100%; }
input { font: inherit; color: inherit; }

/* ── LAYOUT ─────────────────────────────────────── */
.dashboard {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100dvh;
}

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: transform var(--transition);
  z-index: 50;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-divider);
  height: var(--topbar-h);
  flex-shrink: 0;
}
.logo-mark { width: 32px; height: 32px; flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-name { font-size: var(--text-sm); font-weight: 900; letter-spacing: .04em; color: var(--color-text); }
.logo-sub  { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 400; }

.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.nav-group { display: flex; flex-direction: column; gap: var(--sp-1); }
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-1);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--color-surface-offset); color: var(--color-text); }
.nav-item.active {
  background: var(--burgundy-muted);
  color: var(--burgundy);
  font-weight: 700;
}

.sidebar-vendor {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--color-divider);
  flex-shrink: 0;
}
.vendor-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--burgundy);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vendor-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.vendor-name { font-size: var(--text-sm); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vendor-type { font-size: var(--text-xs); color: var(--color-text-muted); }
.vendor-menu-btn { color: var(--color-text-faint); padding: var(--sp-1); border-radius: var(--r-sm); }
.vendor-menu-btn:hover { color: var(--color-text); background: var(--color-surface-offset); }

/* ── TOPBAR ─────────────────────────────────────── */
.topbar {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--topbar-h);
  position: sticky; top: 0;
  z-index: 40;
}
.sidebar-toggle { display: none; color: var(--color-text-muted); padding: var(--sp-2); border-radius: var(--r-sm); }
.sidebar-toggle:hover { background: var(--color-surface-offset); }
.topbar-title { flex: 1; }
.topbar-title h1 { font-size: var(--text-lg); font-weight: 900; line-height: 1.1; }
.topbar-breadcrumb { font-size: var(--text-xs); color: var(--color-text-faint); }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }
.topbar-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.topbar-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px;
  border-radius: 9999px;
  background: var(--burgundy);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── MAIN CONTENT ───────────────────────────────── */
.main-content {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* ── KPI ROW ─────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-4);
}
.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-3);
}
.kpi-label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon--blue     { background: #eff6ff; color: var(--color-blue); }
.kpi-icon--gold     { background: #fefce8; color: var(--color-gold); }
.kpi-icon--green    { background: #f0fdf4; color: var(--color-green); }
.kpi-icon--burgundy { background: var(--burgundy-light); color: var(--burgundy); }
.kpi-icon--teal     { background: #f0fdfa; color: var(--color-teal); }
[data-theme="dark"] .kpi-icon--blue     { background: #1e3a5f; }
[data-theme="dark"] .kpi-icon--gold     { background: #3b2f0a; }
[data-theme="dark"] .kpi-icon--green    { background: #14291e; }
[data-theme="dark"] .kpi-icon--teal     { background: #0f2e2f; }

.kpi-value {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums lining-nums;
  margin-bottom: var(--sp-2);
}
.kpi-delta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 700;
}
.kpi-delta--up      { color: var(--color-green); }
.kpi-delta--down    { color: var(--color-red); }
.kpi-delta--neutral { color: var(--color-text-muted); }

/* ── CARD BASE ─────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.card-title { font-size: var(--text-base); font-weight: 900; }
.card-sub   { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }

/* ── MID ROW ─────────────────────────────────────── */
.mid-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-4);
}

/* ── CHART ─────────────────────────────────────── */
.chart-tabs { display: flex; gap: var(--sp-1); }
.chart-tab {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  transition: all var(--transition);
}
.chart-tab:hover { background: var(--color-surface-offset); }
.chart-tab.active {
  background: var(--burgundy-muted);
  color: var(--burgundy);
  border-color: rgba(128,0,32,.2);
}
.chart-wrap { padding: 0 var(--sp-5) var(--sp-5); }

/* ── QUICK ACTIONS ────────────────────────────── */
.quick-actions { padding: 0 var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); }
.quick-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  transition: background var(--transition);
  text-align: left;
}
.quick-btn:hover { background: var(--color-surface-offset); }
.quick-btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--burgundy-muted);
  color: var(--burgundy);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.quick-btn-text { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.quick-btn-text strong { font-size: var(--text-sm); font-weight: 700; }
.quick-btn-text small  { font-size: var(--text-xs); color: var(--color-text-muted); }
.quick-arrow { color: var(--color-text-faint); flex-shrink: 0; }

/* ── TABLE ─────────────────────────────────────── */
.table-card { }
.table-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  color: var(--color-text-faint);
  pointer-events: none;
}
.search-input {
  padding: var(--sp-2) var(--sp-3) var(--sp-2) 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  background: var(--color-bg);
  font-size: var(--text-sm);
  width: 200px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px var(--burgundy-muted);
}
.btn-outline {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-surface);
  transition: all var(--transition);
}
.btn-outline:hover { background: var(--color-surface-offset); color: var(--color-text); }

.table-scroll { overflow-x: auto; }
.data-table { min-width: 800px; }
.data-table thead tr {
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}
.data-table th {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--color-surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.mono { font-variant-numeric: tabular-nums; font-size: var(--text-xs); color: var(--color-text-muted); }
.transferee-cell { display: flex; align-items: center; gap: var(--sp-3); }
.t-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.transferee-cell strong { font-size: var(--text-sm); display: block; font-weight: 700; }
.transferee-cell small  { font-size: var(--text-xs); color: var(--color-text-muted); }
.corridor { font-size: var(--text-xs); white-space: nowrap; }
.corridor .arrow { color: var(--color-text-faint); margin: 0 4px; }

/* ── BADGES ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge--active   { background: #eff6ff; color: var(--color-blue); }
.badge--complete { background: #f0fdf4; color: var(--color-green); }
.badge--pending  { background: #fefce8; color: #92400e; }
.badge--review   { background: var(--burgundy-light); color: var(--burgundy); }
[data-theme="dark"] .badge--active   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge--complete { background: #14291e; color: #86efac; }
[data-theme="dark"] .badge--pending  { background: #3b2f0a; color: #fcd34d; }
[data-theme="dark"] .badge--review   { background: rgba(128,0,32,.25); color: #f9a8c9; }

.row-action {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--burgundy);
  border: 1px solid rgba(128,0,32,.25);
  background: var(--burgundy-light);
  transition: all var(--transition);
}
.row-action:hover { background: var(--burgundy); color: #fff; }

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--color-divider);
}
.table-count { font-size: var(--text-xs); color: var(--color-text-muted); }
.pagination { display: flex; gap: var(--sp-1); align-items: center; }
.page-btn {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { background: var(--color-surface-offset); }
.page-btn--active { background: var(--burgundy); color: #fff; border-color: var(--burgundy); }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── BOTTOM ROW ──────────────────────────────────── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

/* ── ALERTS ─────────────────────────────────────── */
.alerts-list { padding: 0 var(--sp-5) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.alert-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}
.alert-item--urgent { border-color: rgba(220,38,38,.25); background: rgba(220,38,38,.04); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-dot--red  { background: var(--color-red); box-shadow: 0 0 0 3px rgba(220,38,38,.2); }
.alert-dot--gold { background: var(--color-gold); }
.alert-dot--blue { background: var(--color-blue); }
.alert-body { flex: 1; }
.alert-body strong { font-size: var(--text-sm); font-weight: 700; display: block; }
.alert-body small  { font-size: var(--text-xs); color: var(--color-text-muted); }
.btn-xs { padding: var(--sp-1) var(--sp-3); border-radius: var(--r-sm); font-size: var(--text-xs); font-weight: 700; flex-shrink: 0; }
.btn-burgundy { background: var(--burgundy); color: #fff; }
.btn-burgundy:hover { background: var(--burgundy-hover); }
.btn-outline-sm {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  transition: all var(--transition);
}
.btn-outline-sm:hover { background: var(--color-surface-offset); color: var(--color-text); }

/* ── PERFORMANCE ─────────────────────────────────── */
.perf-list { padding: 0 var(--sp-5) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-4); }
.perf-item { display: flex; flex-direction: column; gap: var(--sp-2); }
.perf-label-row { display: flex; justify-content: space-between; font-size: var(--text-sm); }
.perf-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.perf-score--green { color: var(--color-green); }
.perf-score--gold  { color: var(--color-gold); }
.perf-bar {
  height: 6px;
  background: var(--color-surface-offset);
  border-radius: 9999px;
  overflow: hidden;
}
.perf-fill {
  height: 100%;
  width: var(--w);
  border-radius: 9999px;
  transform-origin: left;
  animation: growBar 0.8s cubic-bezier(.16,1,.3,1) forwards;
}
.perf-fill--green { background: var(--color-green); }
.perf-fill--gold  { background: var(--color-gold); }
@keyframes growBar {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.perf-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--color-divider);
}
.perf-tier {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
}

/* ── FOOTER ─────────────────────────────────────── */
.page-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) 0;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  border-top: 1px solid var(--color-divider);
  margin-top: var(--sp-2);
}
.page-footer a { color: var(--color-text-faint); transition: color var(--transition); }
.page-footer a:hover { color: var(--burgundy); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 240px;
    height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .dashboard { grid-template-columns: 1fr; }
  .topbar, .main-content { grid-column: 1; }
  .sidebar-toggle { display: flex !important; }
  .mid-row { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .main-content { padding: var(--sp-4); }
}
