@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #f0f2f9;
  --card: #f0f2f9;
  --shadow1: 8px 8px 18px rgba(0,0,0,.09);
  --shadow2: -8px -8px 18px rgba(255,255,255,.92);
  --inset1: inset 6px 6px 14px rgba(0,0,0,.07);
  --inset2: inset -6px -6px 14px rgba(255,255,255,.88);
  --text: #1a2033;
  --muted: #5a6478;
  --chip: #e4e8f5;
  --accent: #2d6cdf;
  --accent2: #4d8aef;
  --mint: #5bd6c6;
  --warn: #f5a623;
  --danger: #e63946;
  --ok: #2bb673;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

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

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

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ────────────────────────────────────── */
.container { display: flex; min-height: 100vh; }

.sidebar {
  width: 272px;
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.main { flex: 1; padding: 16px 16px 28px 0; min-width: 0; }

/* ── Brand ─────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow1), var(--shadow2);
  border: 1px solid rgba(0,0,0,.03);
  justify-content: center;
}
.brand img { height: 40px; width: auto; display: block; }
.brand .title { font-weight: 800; font-size: 17px; }
.brand .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Navigation ────────────────────────────────── */
.nav {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow1), var(--shadow2);
  border: 1px solid rgba(0,0,0,.03);
}

.nav h4 {
  margin: 0 0 10px 0;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  margin: 3px 0;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.nav a:hover {
  background: rgba(45,108,223,.06);
  color: var(--accent);
}

.nav a.active {
  background: linear-gradient(135deg, rgba(45,108,223,.12), rgba(77,138,239,.08));
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(45,108,223,.18);
}

.nav a.active .dot { background: var(--accent); box-shadow: 0 0 8px rgba(45,108,223,.5); }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip);
  box-shadow: var(--shadow1), var(--shadow2);
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
}

/* ── Top bar ───────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow1), var(--shadow2);
  border: 1px solid rgba(0,0,0,.03);
  margin: 0 16px 14px 0;
  flex-wrap: wrap;
}

.topbar .left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Badges & Pills ────────────────────────────── */
.badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid rgba(0,0,0,.04);
  box-shadow: var(--shadow1), var(--shadow2);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--chip);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.pill .s {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px rgba(43,182,115,.55);
  flex-shrink: 0;
}

/* ── Status chips ──────────────────────────────── */
.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.status .s { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status.ok    { background: rgba(43,182,115,.12); color: #177a4a; }
.status.ok .s { background: var(--ok); box-shadow: 0 0 5px rgba(43,182,115,.5); }
.status.warn    { background: rgba(245,166,35,.13); color: #8a5800; }
.status.warn .s { background: var(--warn); }
.status.danger    { background: rgba(230,57,70,.12); color: #9b1c1c; }
.status.danger .s { background: var(--danger); }
.status.info    { background: rgba(45,108,223,.11); color: var(--accent); }
.status.info .s { background: var(--accent); }

/* ── Inputs & Selects ──────────────────────────── */
.select, .input {
  padding: 9px 13px;
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,.04);
  background: var(--card);
  box-shadow: var(--inset1), var(--inset2);
  font-size: 13px;
  color: var(--text);
  outline: none;
  font-family: var(--font);
  transition: box-shadow var(--transition);
}

.input:focus, .select:focus {
  box-shadow: var(--inset1), var(--inset2), 0 0 0 3px rgba(45,108,223,.15);
}

textarea.input { resize: vertical; }

/* ── Buttons ───────────────────────────────────── */
.btn {
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,.05);
  background: var(--card);
  box-shadow: var(--shadow1), var(--shadow2);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  transition: box-shadow var(--transition), transform var(--transition), filter var(--transition);
  white-space: nowrap;
}

.btn:hover {
  box-shadow: 10px 10px 22px rgba(0,0,0,.11), -10px -10px 22px rgba(255,255,255,.95);
  transform: translateY(-1px);
}

.btn:active {
  box-shadow: var(--inset1), var(--inset2);
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border-color: rgba(45,108,223,.3);
  box-shadow: 0 4px 16px rgba(45,108,223,.28), var(--shadow1);
}

.btn.primary:hover {
  box-shadow: 0 8px 24px rgba(45,108,223,.38), var(--shadow1);
  filter: brightness(1.06);
}

.btn.primary:active {
  box-shadow: 0 2px 8px rgba(45,108,223,.28);
  filter: brightness(.97);
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* ── Grid ──────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  padding-right: 16px;
}

/* ── Cards ─────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow1), var(--shadow2);
  padding: 18px;
  border: 1px solid rgba(0,0,0,.03);
}

.card h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

/* ── KPI ───────────────────────────────────────── */
.kpi { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi .val {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1;
}
.kpi .lab { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.kpi .trend {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(45,108,223,.1), rgba(45,108,223,.05));
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.muted { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ── Tables ────────────────────────────────────── */
.table { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  padding: 0 12px 6px 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.table td {
  padding: 12px;
  background: var(--card);
  box-shadow: var(--shadow1), var(--shadow2);
  border-top: 1px solid rgba(0,0,0,.025);
  border-bottom: 1px solid rgba(0,0,0,.025);
  vertical-align: middle;
  transition: background var(--transition);
}
.table tbody tr:hover td { background: rgba(45,108,223,.04); }
.table tr td:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); border-left: 1px solid rgba(0,0,0,.025); }
.table tr td:last-child  { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; border-right: 1px solid rgba(0,0,0,.025); }

/* ── Split / Panel ─────────────────────────────── */
.split { display: grid; grid-template-columns: 360px 1fr 360px; gap: 14px; padding-right: 16px; }
.panel {
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow1), var(--shadow2);
  padding: 14px;
  border: 1px solid rgba(0,0,0,.03);
}
.panel h4 { margin: 0 0 10px 0; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.map {
  height: 520px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 20% 30%, rgba(45,108,223,.15), transparent 42%),
    radial-gradient(circle at 78% 62%, rgba(91,214,198,.15), transparent 44%),
    linear-gradient(180deg, rgba(255,255,255,.6), rgba(220,225,240,1));
  box-shadow: var(--inset1), var(--inset2);
  border: 1px dashed rgba(45,108,223,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

.footer-strip { margin: 14px 16px 0 0; display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 14px; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 1200px) {
  .sidebar { display: none; }
  .main { padding-left: 16px; }
  .topbar { margin-left: 0; }
  .grid { padding-right: 0; }
  .split { grid-template-columns: 1fr; }
  .map { height: 380px; }
  .footer-strip { grid-template-columns: 1fr; }
}

/* ── Loading & Empty state ─────────────────────── */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
  color: var(--muted);
  font-size: 13px;
  gap: 10px;
}

.loading-overlay::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 3px solid rgba(45,108,223,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 52px 24px;
  color: var(--muted);
}
.empty-state .icon { font-size: 44px; margin-bottom: 12px; }
.empty-state strong { display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; }


/* ─── Breadcrumb / back-button polish ───────────────────────────
 *
 * Most v2 pages have a `.crumb` at the top with "← Home" or similar.
 * The default styling makes them look like body text links, which Chells
 * pointed out is hard to spot. Override with a higher-specificity rule
 * so the inline page styles defer to this.
 *
 * Each link in a .crumb gets:
 *   - a soft card background
 *   - a bit of padding so it reads as a clickable affordance
 *   - the accent colour and weight that buttons use elsewhere
 *
 * The wrapper itself keeps its small font size so it doesn't dominate
 * the page header.
 */
body .crumb {
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
body .crumb a {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--inset1), var(--inset2);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  transition: var(--transition, all 0.15s ease);
}
body .crumb a:hover {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow1, 0 2px 6px rgba(0,0,0,.08)),
              var(--shadow2, 0 1px 2px rgba(0,0,0,.06));
}
