/* ──────────────────────────────────────────────────────────────────────
   KwikPHIS — light UI (v3) with GoKwik brand colors
   Off-white backgrounds · GoKwik navy + orange accents · soft shadows
────────────────────────────────────────────────────────────────────── */

:root {
  /* Backgrounds */
  --bg:        #f8f7f3;
  --bg-2:      #f2f1ea;
  --panel:     #ffffff;
  --panel-2:   #f8fafc;
  --panel-3:   #eef2f7;

  /* Borders */
  --border:    rgba(15, 23, 42, 0.07);
  --border-2:  rgba(15, 23, 42, 0.14);
  --border-3:  rgba(15, 23, 42, 0.22);

  /* Text */
  --text:      #0f172a;
  --text-2:    #1e293b;
  --muted:     #64748b;
  --muted-2:   #94a3b8;

  /* GoKwik brand */
  --primary:        #1449b2;          /* GoKwik royal blue */
  --primary-2:      #0039ab;
  --primary-soft:   rgba(20, 73, 178, 0.08);
  --primary-glow:   rgba(20, 73, 178, 0.18);
  --accent:         #F79D1D;          /* GoKwik orange */
  --accent-2:       #F5B942;          /* GoKwik amber */
  --accent-soft:    rgba(247, 157, 29, 0.10);
  --accent-strong:  #d58109;

  /* Semantic */
  --ok:        #15803d;
  --ok-soft:   rgba(22, 163, 74, 0.10);
  --warn:      #b45309;
  --warn-soft: rgba(217, 119, 6, 0.10);
  --high:      #c2410c;
  --high-soft: rgba(234, 88, 12, 0.10);
  --crit:      #b91c1c;
  --crit-soft: rgba(220, 38, 38, 0.08);
  --info:      #0369a1;
  --info-soft: rgba(2, 132, 199, 0.08);

  /* Radius / shadows */
  --r-sm: 6px;
  --r:    8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.05);
  --ring:      0 0 0 3px var(--primary-soft);

  /* Type */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --navy: #000428;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-feature-settings: "cv11", "ss01", "ss03";
  background:
    radial-gradient(circle at 0% 0%, rgba(247, 157, 29, 0.06), transparent 38%),
    radial-gradient(circle at 100% 0%, rgba(20, 73, 178, 0.05), transparent 32%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-2); text-decoration: underline; }

h1, h2, h3, h4 { color: var(--text); font-family: var(--font-head); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
code { font-family: var(--font-mono); font-size: 0.92em; background: var(--panel-3); padding: 1px 6px; border-radius: 4px; color: var(--primary); }
pre code { background: transparent; padding: 0; }

/* ── Top navigation ─────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 24px;
}

.topnav .brand a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.topnav .brand a:hover { text-decoration: none; }

.topnav .brand .gk-logo { display: block; flex-shrink: 0; }
.topnav .brand-text {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 17px;
  color: var(--accent);
}
.topnav .brand-text-2 { color: var(--primary); }

.topnav ul { list-style: none; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; flex: 1; }
.topnav ul a {
  display: inline-block;
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: var(--r);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.topnav ul a:hover { background: var(--panel-3); color: var(--text); text-decoration: none; }
.topnav .me { color: var(--muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }

.content { padding: 24px 28px; max-width: 1480px; margin: 0 auto; }

/* ── Flash messages ─────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--r);
  margin-bottom: 14px;
  font-size: 13px;
  border: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 10px;
}
.flash.ok { background: var(--ok-soft); border-color: rgba(22, 163, 74, 0.3); color: var(--ok); }
.flash.error { background: var(--crit-soft); border-color: rgba(220, 38, 38, 0.3); color: var(--crit); }

/* ── Cards / panels ─────────────────────────────────────────────── */
.card,
.dash-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover, .dash-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow);
}
.dash-card-h {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--text);
  letter-spacing: -0.01em;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.dash-card-h .muted { font-weight: 400; font-size: 11px; color: var(--muted); }

/* ── Tables ─────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
table th, table td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
table th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
table tr:last-child td { border-bottom: 0; }
table tr:hover td { background: var(--panel-2); }

table.mini { border-radius: 0; border: 0; background: transparent; }
table.mini th, table.mini td { padding: 7px 8px; font-size: 12px; }
table.mini th { background: transparent; padding-top: 0; padding-bottom: 6px; }
table.mini tr:hover td { background: transparent; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  border: 0;
  border-radius: var(--r);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 1px 2px rgba(1, 76, 142, 0.2);
  text-decoration: none;
}
.btn:hover {
  background: linear-gradient(180deg, #02609b 0%, var(--primary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow), 0 1px 0 rgba(255,255,255,0.18) inset;
  color: #fff;
  text-decoration: none;
}
.btn:active { transform: translateY(0); }
.btn.danger { background: linear-gradient(180deg, var(--crit) 0%, #991b1b 100%); }
.btn.danger:hover { box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3); background: linear-gradient(180deg, #c92424 0%, var(--crit) 100%); }
.btn.accent { background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%); }
.btn.accent:hover { box-shadow: 0 4px 12px rgba(240, 152, 25, 0.35); }
.btn.ghost {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover {
  background: var(--panel-2);
  border-color: var(--border-3);
  transform: none;
  box-shadow: var(--shadow);
  color: var(--text);
}

/* ── Forms ──────────────────────────────────────────────────────── */
form .field { margin-bottom: 16px; }
form label { display: block; color: var(--text-2); margin-bottom: 6px; font-size: 12px; font-weight: 500; }
form input[type=text],
form input[type=email],
form input[type=password],
form input[type=number],
form input[type=url],
form input[type=time],
form input[type=datetime-local],
form input[type=file],
form select,
form textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: var(--panel);
}
form textarea { min-height: 120px; font-family: var(--font-mono); font-size: 12px; }
form input[type=checkbox], form input[type=radio] { accent-color: var(--primary); }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.badge.Low,    .badge.ok          { background: var(--ok-soft); color: var(--ok); }
.badge.Medium, .badge.scheduled, .badge.Easy { background: var(--info-soft); color: var(--info); }
.badge.High,   .badge.warn, .badge.sending  { background: var(--warn-soft); color: var(--warn); }
.badge.Critical, .badge.danger, .badge.Hard { background: var(--crit-soft); color: var(--crit); }
.badge.completed { background: var(--ok-soft); color: var(--ok); }
.badge.draft    { background: rgba(100, 116, 139, 0.12); color: var(--muted); }

/* ── Layout helpers ─────────────────────────────────────────────── */
.row { display: flex; gap: 16px; align-items: flex-start; }
.row > * { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.preview-frame { background: #fff; color: #000; border-radius: var(--r-lg); padding: 24px; margin-top: 12px; }

/* ── Login card ─────────────────────────────────────────────────── */
.login-card {
  max-width: 420px;
  margin: 80px auto;
  background: var(--panel);
  padding: 40px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-lg);
  position: relative;
}

/* ── Google Sign-In button ───────────────────────────────────────── */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(60,64,67,0.3); color: #1f1f1f; text-decoration: none; }
.btn-google:active { background: #e8eaed; }
.login-or {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--muted-2); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.login-or::before, .login-or::after {
  content: ""; flex: 1; height: 1px; background: var(--border-2);
}

/* ── Tag list ───────────────────────────────────────────────────── */
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-list a {
  padding: 6px 14px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.tag-list a:hover { background: var(--panel-3); color: var(--text); text-decoration: none; }
.tag-list a.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── KPI tiles (executive dashboard) ────────────────────────────── */
.exec-dash { max-width: 1480px; margin: 0 auto; }
.exec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.exec-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; margin: 0; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-tile {
  position: relative;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.kpi-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
}
.kpi-tile::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--primary);
}
.kpi-tile.danger::before { background: var(--accent); }
.kpi-tile.crit::before   { background: var(--crit); }
.kpi-tile.warn::before   { background: var(--high); }
.kpi-tile.ok::before     { background: var(--ok); }

.kpi-tile.danger { background: linear-gradient(180deg, var(--panel) 0%, rgba(240, 152, 25, 0.04) 100%); }
.kpi-tile.crit   { background: linear-gradient(180deg, var(--panel) 0%, rgba(220, 38, 38, 0.04) 100%); }
.kpi-tile.warn   { background: linear-gradient(180deg, var(--panel) 0%, rgba(234, 88, 12, 0.04) 100%); }
.kpi-tile.ok     { background: linear-gradient(180deg, var(--panel) 0%, rgba(22, 163, 74, 0.04) 100%); }

.kpi-l {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-v {
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { color: var(--muted-2); font-size: 11px; margin-top: 4px; }

/* ── Dash grid rows ─────────────────────────────────────────────── */
.dash-row { display: grid; gap: 14px; margin-bottom: 14px; }
.dash-row.r2 { grid-template-columns: 2.2fr 1fr; }
.dash-row.r3 { grid-template-columns: 1fr 1fr 1fr; }
.dash-row.r4 { grid-template-columns: 1fr 1fr 1.2fr; }

/* ── Bars (mini horizontal) ─────────────────────────────────────── */
.bar {
  display: inline-block;
  width: 80px; height: 6px;
  background: var(--panel-3);
  border-radius: 999px;
  vertical-align: middle;
  margin-right: 8px;
  overflow: hidden;
}
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--crit), #e53e3e); border-radius: 999px; }
.bar-fill.warn { background: linear-gradient(90deg, var(--accent), var(--high)); }
.bar-num { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Risk band legend dots ──────────────────────────────────────── */
.band-legend { display: flex; gap: 14px; justify-content: center; font-size: 11px; color: var(--muted); margin-top: 12px; flex-wrap: wrap; }
.bdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.bdot.Low      { background: var(--ok); }
.bdot.Medium   { background: var(--accent); }
.bdot.High     { background: var(--high); }
.bdot.Critical { background: var(--crit); }

/* ── Activity feed ──────────────────────────────────────────────── */
.feed { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow: auto; }
.feed li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.feed li:last-child { border-bottom: 0; }
.feed-time { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.feed-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.feed-dot.open    { background: var(--info); }
.feed-dot.click   { background: var(--accent); }
.feed-dot.submit  { background: var(--crit); }
.feed-dot.report  { background: var(--ok); }

.feed-kind {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.feed-kind.open   { background: var(--info-soft); color: var(--info); }
.feed-kind.click  { background: var(--accent-soft); color: var(--accent-strong); }
.feed-kind.submit { background: var(--crit-soft); color: var(--crit); }
.feed-kind.report { background: var(--ok-soft); color: var(--ok); }

/* ── Callouts ───────────────────────────────────────────────────── */
.callout {
  background: var(--info-soft);
  border-left: 3px solid var(--info);
  padding: 14px 16px;
  border-radius: var(--r);
  margin: 16px 0;
  font-size: 13px;
  color: var(--text);
}
.callout strong { color: var(--info); }
.danger-callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  border-radius: var(--r);
  margin: 16px 0;
  font-size: 13px;
  color: var(--text);
}
.danger-callout strong { color: var(--accent-strong); }

/* ── Old kpi-row (campaign view) ────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 16px 0; }
.kpi-row .kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--r);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.kpi .v { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Cards for old dashboard layout ─────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.cards .card .num { font-size: 28px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.cards .card .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Provider tiles (email integration) ─────────────────────────── */
.provider-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.provider-tile {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--panel);
}
.provider-tile:hover { background: var(--panel-2); border-color: var(--border-3); }
.provider-tile.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}
.provider-tile strong { display: block; color: var(--text); font-size: 13px; }
.provider-tile span { display: block; font-size: 11px; margin-top: 4px; line-height: 1.5; color: var(--muted); }
.provider-tile input { display: none; }

/* ── Segmented control (frequency picker on campaign form) ───── */
.seg { display: inline-flex; background: var(--panel-2); border-radius: var(--r); padding: 3px; gap: 2px; border: 1px solid var(--border); }
.seg-item {
  padding: 7px 14px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--muted);
  transition: all 0.15s;
}
.seg-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.7); }
.seg-item.active { background: var(--primary); color: #fff; }
.seg-item input { display: none; }

/* ── Scrollbar polish ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-3); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); border: 2px solid transparent; background-clip: padding-box; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .dash-row.r2, .dash-row.r3, .dash-row.r4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .topnav { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .topnav ul { flex-wrap: wrap; }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-row.r2, .dash-row.r3, .dash-row.r4 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
  .exec-head { flex-direction: column; }
}

/* ── Hero metrics (top of dashboard) ────────────────────────────── */
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.hero-card {
  position: relative;
  padding: 22px 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.hero-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hero-card.primary {
  background: linear-gradient(135deg, var(--primary) 0%, #02609b 100%);
  color: #fff;
  border-color: transparent;
}
.hero-card.primary .hero-label, .hero-card.primary .hero-info, .hero-card.primary .muted { color: rgba(255,255,255,0.85) !important; }
.hero-card.primary .hero-big { color: #fff; }
.hero-card.success { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); border-color: rgba(21, 128, 61, 0.15); }
.hero-card.warn { background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%); border-color: rgba(240, 152, 25, 0.20); }
.hero-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hero-info { color: var(--muted-2); font-size: 12px; cursor: help; }
.hero-big {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}
.hero-unit { font-size: 18px; font-weight: 500; opacity: 0.7; margin-left: 2px; }
.hero-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.benchmark-pill, .trend-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.benchmark-pill.good, .trend-pill.good { background: rgba(21, 128, 61, 0.15); color: #15803d; }
.benchmark-pill.bad, .trend-pill.bad { background: rgba(220, 38, 38, 0.15); color: #b91c1c; }
.hero-card.primary .benchmark-pill.good, .hero-card.primary .trend-pill.good { background: rgba(34, 197, 94, 0.25); color: #d1fae5; }
.hero-card.primary .benchmark-pill.bad, .hero-card.primary .trend-pill.bad { background: rgba(239, 68, 68, 0.25); color: #fee2e2; }

.resil-bar { width: 100%; height: 8px; background: rgba(15, 23, 42, 0.08); border-radius: 999px; overflow: hidden; }
.resil-fill { height: 100%; background: linear-gradient(90deg, #15803d, #16a34a); border-radius: 999px; transition: width 0.6s; }

/* ── Activity heatmap ────────────────────────────────────────────── */
.r-heat { grid-template-columns: 1.4fr 1fr 0.85fr; }
.heatmap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: 3px;
  margin-top: 8px;
}
.hm-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.05);
  display: inline-block;
  width: 100%;
}
.hm-cell.hm-0 { background: rgba(15, 23, 42, 0.05); }
.hm-cell.hm-1 { background: rgba(1, 76, 142, 0.18); }
.hm-cell.hm-2 { background: rgba(1, 76, 142, 0.40); }
.hm-cell.hm-3 { background: rgba(1, 76, 142, 0.65); }
.hm-cell.hm-4 { background: rgba(1, 76, 142, 0.95); }
.hm-legend {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--muted); margin-top: 10px;
}
.hm-legend .hm-cell { width: 12px; height: 12px; aspect-ratio: auto; }

/* ── Funnel ──────────────────────────────────────────────────────── */
.funnel { list-style: none; padding: 0; margin: 0; }
.funnel li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.funnel li:last-child { border-bottom: 0; }
.funnel-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
  font-size: 12px;
}
.funnel-label { font-weight: 600; color: var(--text); }
.funnel-num { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.funnel-pct { color: var(--muted); font-size: 11px; min-width: 50px; text-align: right; }
.funnel-bar { width: 100%; height: 6px; background: rgba(15, 23, 42, 0.04); border-radius: 999px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 999px; transition: width 0.6s; }

/* ── System health tiles ─────────────────────────────────────────── */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.health-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  transition: all 0.15s;
}
.health-tile:hover { background: var(--panel-3); border-color: var(--border-2); transform: translateY(-1px); text-decoration: none; }
.health-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}
.health-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15); }
.health-dot.bad { background: var(--muted-2); }

@media (max-width: 1280px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-card.primary { grid-column: 1 / -1; }
  .r-heat { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card.primary { grid-column: auto; }
  .r-heat { grid-template-columns: 1fr; }
  .heatmap { grid-template-columns: repeat(7, 1fr); grid-auto-flow: row; grid-template-rows: auto; }
}

/* ── Trend chart period switcher + stat banner ───────────────────── */
.trend-period {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.15s;
}
.trend-period:hover { border-color: var(--border-3); color: var(--text); }
.trend-period.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.trend-stats {
  display: flex; flex-wrap: wrap;
  gap: 18px;
  padding: 8px 0 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.trend-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
}
.trend-stat .dot {
  width: 8px; height: 8px; border-radius: 2px;
}
.trend-stat .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.trend-stat .num { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; letter-spacing: -0.01em; }

/* ── Misc utilities ─────────────────────────────────────────────── */
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
small { color: var(--muted); }
strong { color: var(--text); font-weight: 600; }

/* ── Left sidebar nav (v4) ──────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  display: flex; flex-direction: column;
  background: linear-gradient(185deg, #0b2a5e 0%, #000428 100%);
  border-right: 1px solid rgba(255,255,255,0.07);
  z-index: 60;
}
.sidebar .sb-brand { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.sidebar .sb-brand-link { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.sidebar .sb-brand-link:hover { text-decoration: none; }
.sidebar .sb-logo { background: #fff; border-radius: 9px; padding: 5px; display: flex; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
.sidebar .sb-logo img { display: block; }
.sidebar .sb-brand-meta { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar .sb-brand-title { color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.sidebar .sb-brand-title-2 { color: var(--accent); }
.sidebar .sb-brand-sub { color: rgba(255,255,255,0.5); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; margin-top: 2px; }

.sidebar .sb-nav { flex: 1; overflow-y: auto; padding: 8px 12px 12px; }
.sidebar .sb-nav::-webkit-scrollbar { width: 6px; }
.sidebar .sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
.sidebar .nav-section { margin-top: 14px; }
.sidebar .nav-section:first-child { margin-top: 4px; }
.sidebar .nav-section-label { color: rgba(255,255,255,0.38); font-size: 10px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; padding: 0 11px; margin-bottom: 6px; }
.sidebar .sb-nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; margin-bottom: 2px; border-radius: 9px;
  color: rgba(255,255,255,0.72); font-size: 13px; font-weight: 500;
  text-decoration: none; white-space: nowrap; transition: background .15s, color .15s;
}
.sidebar .sb-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar .sb-nav a.active { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar .sb-nav a.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar .sb-nav a.active .nav-ic { color: var(--accent); }
.sidebar .nav-ic { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.92; }

.sidebar .sb-foot { border-top: 1px solid rgba(255,255,255,0.07); padding: 11px 12px; }
.sidebar .sb-user { display: flex; align-items: center; gap: 10px; }
.sidebar .sb-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); }
.sidebar .sb-user-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.sidebar .sb-email { color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .sb-role { color: rgba(255,255,255,0.48); font-size: 10px; }
.sidebar .sb-logout { color: rgba(255,255,255,0.55); display: flex; flex-shrink: 0; padding: 4px; border-radius: 7px; }
.sidebar .sb-logout:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar .sb-logout .nav-ic { width: 16px; height: 16px; }

/* content shifts right of the fixed sidebar */
.content.has-sidebar { margin-left: 240px; max-width: none; }

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; flex-direction: column; }
  .sidebar .sb-nav { max-height: none; }
  .content.has-sidebar { margin-left: 0; }
}

/* ── GoKwik brand polish (v5, follows gokwik.co) ────────────────── */
.sidebar .sb-brand-title { font-family: var(--font-head); letter-spacing: -0.03em; }
.btn { border-radius: 999px; }
.btn.ghost { border-radius: 999px; }
.btn.accent { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: #3a2500; }
.btn.accent:hover { box-shadow: 0 6px 16px rgba(247,157,29,0.38); }
.badge { border-radius: 999px; }
