:root {
  /* VISION brand: black, white and greys only. */
  --bg: #080808;
  --sidebar-bg: #080808;
  --surface: #171717;
  --surface-2: #1f1f1f;
  --surface-hover: #262626;
  --border: #303030;
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --text-faint: #737373;
  --accent-a: #ffffff;
  --accent-b: #a3a3a3;
  --accent-c: #e5e5e5;
  --green: #ffffff;
  --red: #a3a3a3;
  --amber: #e5e5e5;
  --sidebar-w: 108px;
  --sidebar-w-collapsed: 64px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 13.5px;
}

/* ---------------- Login ---------------- */
#login-screen {
  height: 100%;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
  background: var(--bg);
}

.login-logo svg {
  width: 34px;
  height: auto;
  color: #fff;
}

.link-btn {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--accent-c);
}

.link-btn:hover {
  text-decoration: underline;
}

#request-access-success {
  color: var(--green);
  font-size: 12.5px;
  margin-top: 14px;
  line-height: 1.5;
}

#request-access-error {
  color: var(--red);
  font-size: 12.5px;
  margin-top: 14px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
  color: var(--text-muted);
}

.login-card {
  width: min(380px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px;
}

.login-card h1 {
  font-size: 21px;
  margin: 0 0 4px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 0 0 24px;
}

.login-card label {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  margin-bottom: 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}

.login-card input:focus {
  border-color: #fff;
}

.login-card button[type="submit"] {
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  height: 44px;
  line-height: 44px;
  text-align: center;
  border-radius: 10px;
  background: #fff;
  color: #080808;
  font-weight: 600;
  font-size: 13.5px;
}

#login-error {
  color: var(--red);
  font-size: 12.5px;
  margin-top: 14px;
}

/* ---------------- Shell (fixed sidebar + topbar; only #main scrolls) ---------------- */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Compact icon-over-label dock — every item the same shape, always. No
   separate "expanded" text-row style: the collapse toggle (in the topbar)
   just shrinks this further to icon-only, it doesn't switch to a wider
   text-row layout. */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  transition: width 0.16s ease;
}

#sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}

#sidebar.collapsed .nav-item span:not(.nav-badge) {
  display: none;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 8px;
}

.brand-mark {
  width: 30px;
  height: auto;
  color: #fff;
  flex-shrink: 0;
}

.icon-btn-plain {
  all: unset;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.icon-btn-plain:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  text-align: center;
  line-height: 1.15;
  position: relative;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: #fff;
  color: #080808;
}

.nav-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: 10px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: #fff;
  color: #080808;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sidebar-footer {
  margin-top: auto;
  padding-top: 6px;
  width: 100%;
  display: flex;
  justify-content: center;
}

#sidebar.collapsed #logout-btn span {
  display: none;
}

#logout-btn {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px 4px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 10.5px;
}

#logout-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ---------------- Content column + topbar ---------------- */
#content-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#topbar {
  height: 62px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
}

#topbar-title {
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  min-width: 120px;
}

#topbar-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 13px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-faint);
}

#topbar-search input {
  all: unset;
  flex: 1;
  color: var(--text);
  font-size: 12.5px;
}

#topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn-round {
  all: unset;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.icon-btn-round:hover {
  color: var(--text);
}

#demo-pill {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--amber);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #080808;
}

#main {
  flex: 1;
  padding: 26px 30px 60px;
  overflow-y: auto;
}

/* ---------------- Section header + export ---------------- */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.view-header h2 {
  font-size: 21px;
  margin: 0 0 4px;
}

.view-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  max-width: 560px;
}

.btn {
  all: unset;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-hover);
}

.btn-export {
  background: #fff;
  border: none;
  color: #080808;
  font-weight: 600;
}

.btn-export:hover {
  filter: brightness(1.08);
}

/* ---------------- KPI stat cards ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-c);
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 15px;
  height: 15px;
}

.kpi-value {
  font-size: 25px;
  font-weight: 700;
  margin-bottom: 4px;
}

.kpi-delta {
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kpi-delta.up {
  color: var(--green);
}

.kpi-delta.down {
  color: var(--red);
}

.kpi-delta.flat {
  color: var(--text-faint);
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ---------------- Panels ---------------- */
.panel-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.panel-title {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 2px 0 16px;
  max-width: 480px;
}

.panel-filter {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  flex-shrink: 0;
}

/* ---------------- Line/area chart ---------------- */
.line-chart-wrap {
  position: relative;
  margin-top: 6px;
}

.lc-stats {
  display: flex;
  gap: 28px;
  margin: 14px 0 10px;
}

.lc-stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.lc-stat-label {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.lc-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: pan-y;
}

.lc-grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.lc-axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.lc-axis-text {
  fill: var(--text-faint);
  font-size: 11px;
  font-family: inherit;
}

.lc-line {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.lc-area {
  fill: rgba(255, 255, 255, 0.06);
}

.lc-last-dot {
  fill: #fff;
}

.lc-cursor {
  stroke: var(--text-faint);
  stroke-width: 1;
  opacity: 0;
}

.lc-focus {
  fill: var(--bg);
  stroke: #fff;
  stroke-width: 2;
  opacity: 0;
}

.lc-empty-text {
  fill: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
}

.line-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #fff;
  color: #080808;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 11.5px;
  line-height: 1.35;
  transform: translate(-50%, -125%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
}

.line-chart-tooltip strong {
  display: block;
  font-size: 13px;
}

/* ---------------- Donut + gauge ---------------- */
.donut-row {
  display: flex;
  align-items: center;
  gap: 22px;
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-item strong {
  color: var(--text);
  margin-left: auto;
  font-weight: 600;
  padding-left: 10px;
}

.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gauge-value {
  font-size: 26px;
  font-weight: 700;
}

.gauge-caption {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------------- Table ---------------- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:last-child td {
  border-bottom: none;
}

.progress-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}

.progress-track-inline {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill-inline {
  height: 100%;
  background: #fff;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}

.badge-country {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---------------- Funnel ---------------- */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.funnel-row:last-child {
  border-bottom: none;
}

.funnel-label {
  width: 170px;
  flex-shrink: 0;
  font-size: 12.5px;
}

.funnel-bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  background: #fff;
}

.funnel-count {
  width: 150px;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.empty-note {
  color: var(--text-faint);
  font-size: 12.5px;
  padding: 30px 0;
  text-align: center;
}
