/* BICS multi-tenant sample dashboards - navy-teal-orange BICS chrome */
:root {
  --navy: #1b2a5b;
  --navy-700: #2a3c72;
  --navy-400: #6b78a0;
  --orange: #f47920;
  --teal: #2aadad;
  --amber: #e8a33d;
  --danger: #c0392b;
  --grey: #9aa3b2;
  --surface: #f5f7fa;
  --background: #f5f7fa;
  --line: #e3e8ef;
  --card: #fff;
  --foreground: #1b2a5b;
  --muted-foreground: #5a6478;
  --muted: #f5f7fa;
  --radius: 8px;
  --shadow-card: 0 1px 2px #1b2a5b0f, 0 6px 18px #1b2a5b12;
  --company-accent: #2aadad;
  --font: Arial, Helvetica, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: var(--font);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

::selection { background: #f4792040; }

a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img, svg { display: block; vertical-align: middle; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.num { font-variant-numeric: tabular-nums; }

.bics-card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius);
}

/* Demo banner */
.demo-banner {
  background: var(--navy);
  color: rgba(255,255,255,0.75);
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 6px 20px;
}

/* Company picker (pages.dev / localhost) */
.picker-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  background: var(--navy-700);
  color: rgba(255,255,255,0.8);
  padding: 8px 20px;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.picker-bar[hidden] { display: none !important; }
.picker-bar label { font-weight: 700; color: #fff; }
.picker-bar select {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  min-width: 200px;
}
.picker-bar select option { color: #1b2a5b; background: #fff; }
.picker-bar__hint { font-size: 11px; color: rgba(255,255,255,0.6); }

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bics-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
}
.bics-bars span {
  width: 5px;
  border-radius: 2px;
  display: block;
}
.bics-bars span:nth-child(1) { height: 10px; background: var(--teal); }
.bics-bars span:nth-child(2) { height: 16px; background: var(--orange); }
.bics-bars span:nth-child(3) { height: 20px; background: #fff; }
.bics-wordmark {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.header-title {
  margin-right: auto;
  border-left: 1px solid rgba(255,255,255,0.2);
  padding-left: 16px;
}
.header-title__name {
  font-size: 14px;
  font-weight: 700;
}
.header-title__sub {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}
.refresh-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.refresh-chip {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(42,173,173,0.6);
  background: rgba(42,173,173,0.1);
  border-radius: 6px;
  padding: 6px 12px;
  text-align: left;
}
.refresh-chip__top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
}
.refresh-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}
.refresh-chip__sub {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

/* Shell */
.app-shell {
  display: flex;
  min-height: calc(100vh - 90px);
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 256px;
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  padding-top: 16px;
  min-height: calc(100vh - 90px);
  display: none;
  flex-direction: column;
}
@media (min-width: 768px) {
  .sidebar { display: flex; }
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
  flex: 1;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.05); }
.nav-link.active {
  background: rgba(255,255,255,0.1);
  font-weight: 700;
  color: #fff;
}
.nav-link.active .nav-rail {
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 0 2px 2px 0;
  background: var(--orange);
}
.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}
.nav-link.active svg {
  color: var(--orange);
  opacity: 1;
}
.sidebar-collapse {
  margin: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}
.sidebar-collapse:hover { background: rgba(255,255,255,0.05); }

/* Main */
.main {
  min-width: 0;
  flex: 1;
  background: var(--background);
}

/* Filters */
.filters {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(27,42,91,0.15);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
}
.filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 0;
}
.filters__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
}
.filters__toggle svg { width: 14px; height: 14px; color: var(--orange); }
.filters__clear {
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
}
.filters__clear:hover { text-decoration: underline; }
.filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 20px;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-field label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.filter-field select,
.filter-field .filter-btn {
  border: 1px solid rgba(27,42,91,0.25);
  background: var(--card);
  color: var(--navy);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  min-width: 140px;
}
.filter-field select:focus,
.filter-field .filter-btn:hover {
  border-color: var(--orange);
  outline: none;
}
.segmented {
  display: flex;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(27,42,91,0.25);
}
.segmented button {
  padding: 8px 12px;
  font-size: 12px;
  background: var(--card);
  color: var(--navy);
}
.segmented button:hover { background: var(--muted); }
.segmented button.is-on {
  background: var(--orange);
  font-weight: 700;
  color: #fff;
}
.applied-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 20px 12px;
}
.applied-row > span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(27,42,91,0.2);
  background: var(--muted);
  padding: 4px 10px;
  font-size: 11px;
  color: var(--navy);
}
.chip:hover { border-color: var(--orange); }

/* Page title */
.page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 0;
}
.page-title svg {
  width: 20px;
  height: 20px;
  color: var(--orange);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.page-title h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--navy);
}
.page-title p {
  font-size: 12px;
  color: var(--muted-foreground);
}

/* Content */
.content { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 14px;
  transition: box-shadow 0.15s;
  width: 100%;
}
.kpi-card:hover { box-shadow: 0 8px 28px #1b2a5b29; }
.kpi-card__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.kpi-card__value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: var(--orange);
}
.kpi-card__value .unit {
  margin-left: 2px;
  font-size: 14px;
  color: rgba(27,42,91,0.7);
  font-weight: 700;
}
.kpi-card__meta {
  margin-top: 8px;
  display: flex;
  width: 100%;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.kpi-delta {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
}
.kpi-delta.up { color: var(--teal); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta .vs {
  margin-left: 4px;
  font-weight: 400;
  color: var(--muted-foreground);
}
.kpi-spark {
  width: 80px;
  height: 28px;
}
.kpi-card__foot {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted-foreground);
}

/* Chart grids */
.grid-2 {
  display: grid;
  gap: 16px;
}
@media (min-width: 1280px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.panel { padding: 16px; }
.panel__head { margin-bottom: 12px; }
.panel__head h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--navy);
}
.panel__head p {
  font-size: 11px;
  color: var(--muted-foreground);
}
.chart-box { position: relative; height: 288px; }
.chart-box--tall { height: 320px; }
.chart-box--short { height: 256px; }

/* Line cards with heat strip */
.line-list { display: flex; flex-direction: column; gap: 8px; }
.line-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  transition: border-color 0.15s;
}
.line-row:hover { border-color: rgba(27,42,91,0.3); }
.line-row.is-active { border-color: var(--orange); background: rgba(244,121,32,0.04); }
.line-row__name {
  width: 64px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
}
.line-row__bar {
  height: 16px;
  flex: 1;
  overflow: hidden;
  border-radius: 2px;
  background: var(--muted);
}
.line-row__fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--navy);
}
.line-row__val {
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-size: 11px;
  color: var(--navy);
}
.heat {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
}
.heat span {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted-foreground);
}
.heat-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.panel-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted-foreground);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  font-size: 11px;
  color: var(--muted-foreground);
}

/* Mobile sidebar toggle */
.mobile-nav {
  display: flex;
  gap: 8px;
  padding: 12px 20px 0;
  overflow-x: auto;
}
@media (min-width: 768px) {
  .mobile-nav { display: none; }
}
.mobile-nav a {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--navy);
}
.mobile-nav a.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
