:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #101418;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #4f46e5;
  --accent-2: #8b5cf6;
  --ok-bg: #ecfdf3;
  --ok-ink: #067647;
  --warn-bg: #fffaeb;
  --warn-ink: #b54708;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f14;
    --surface: #151a21;
    --ink: #e8ebf0;
    --muted: #98a2b3;
    --line: #262d37;
    --ok-bg: #062c1c;
    --ok-ink: #6ce9a6;
    --warn-bg: #33200a;
    --warn-ink: #fec84b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
header strong { font-size: 15px; letter-spacing: -.01em; }
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
nav a {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
}
nav a:hover { background: var(--bg); color: var(--ink); }
main { max-width: 1240px; margin: 0 auto; padding: 24px; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; margin: 0 0 14px; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12.5px; color: var(--muted); }
.banner {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid color-mix(in srgb, var(--warn-ink) 25%, transparent);
  padding: 10px 14px;
  border-radius: 12px;
  margin: 0 0 16px;
  font-size: 13.5px;
}
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.head-actions { display: flex; gap: 8px; }
.btn {
  display: inline-block;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.btn.ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
}
.kpi-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12px; color: var(--muted); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.funnel { display: grid; gap: 7px; }
.funnel-row { display: grid; grid-template-columns: 220px 1fr 90px; align-items: center; gap: 12px; }
.funnel-label { font-size: 13px; color: var(--muted); }
.funnel-track { background: var(--bg); border-radius: 6px; height: 14px; overflow: hidden; }
.funnel-fill { display: block; height: 100%; min-width: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; }
.funnel-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.funnel-value em { font-style: normal; color: var(--muted); font-weight: 500; font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; padding: 9px 10px; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover, table tr:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }
textarea, input, select {
  font: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}
textarea { min-height: 90px; }
button { font: inherit; }
form.stack { display: grid; gap: 10px; max-width: 720px; margin: 16px 0; }
form.stack label, .settings-grid label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.settings-grid { display: grid; gap: 18px; }
.hours-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.settings-actions { display: flex; justify-content: flex-end; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.split { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 16px; }
.internal { background: var(--bg); border-radius: 12px; padding: 12px; }
.partner { background: var(--ok-bg); border-radius: 12px; padding: 12px; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 140px 1fr 70px; }
  main { padding: 16px; }
}
@media (max-width: 600px) {
  .funnel-row { grid-template-columns: 1fr; gap: 4px; }
  .funnel-value { text-align: left; }
  .page-head { flex-direction: column; }
}