/* LA CRM — оформлення */
:root {
  --accent: #FF8C00;
  --accent-soft: rgba(255, 140, 0, .14);
  --red: #E5484D;
  --yellow: #F5A524;
  --green: #30A46C;
  --radius: 10px;
  --font-h: 'Montserrat', 'DejaVu Sans', system-ui, sans-serif;
  --font-b: 'Inter', 'DejaVu Sans', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #121212;
  --panel: #1A1A1A;
  --panel-2: #202020;
  --line: #2C2C2C;
  --text: #EDEDED;
  --muted: #8E8E8E;
}

[data-theme="light"] {
  --bg: #F4F4F5;
  --panel: #FFFFFF;
  --panel-2: #FAFAFA;
  --line: #E3E3E6;
  --text: #1A1A1A;
  --muted: #6B6B70;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-family: var(--font-h); font-weight: 800; letter-spacing: -.01em; margin: 0 0 14px; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Каркас ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px; flex: 0 0 224px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 0 20px 20px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.brand b { font-family: var(--font-h); font-weight: 900; font-size: 15px; letter-spacing: .04em; display: block; }
.brand span { color: var(--accent); font-size: 9px; letter-spacing: .18em; font-weight: 700; }

.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: var(--text); font-size: 13.5px; text-decoration: none;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.active { border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .sep { margin: 12px 20px 6px; font-size: 10px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }

.content { flex: 1; padding: 26px 32px 60px; max-width: 1400px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Панелі ── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }

.kpi .label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kpi .value { font-family: var(--font-h); font-weight: 800; font-size: 26px; margin-top: 6px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .value.accent { color: var(--accent); }

/* ── Таблиці ── */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-family: var(--font-h); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ── Форми ── */
label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-family: var(--font-b); font-size: 13.5px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: grid; gap: 14px; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: 1fr 1fr 1fr; }
.row.c4 { grid-template-columns: repeat(4, 1fr); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-family: var(--font-h);
  font-weight: 700; font-size: 12.5px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #14100B; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }

/* ── Статуси ── */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; font-family: var(--font-h); white-space: nowrap;
}
.badge.gray { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.green { background: rgba(48,163,108,.15); color: var(--green); }
.badge.yellow { background: rgba(245,165,36,.15); color: var(--yellow); }
.badge.red { background: rgba(229,72,77,.15); color: var(--red); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }

.flash {
  background: rgba(48,163,108,.13); border: 1px solid var(--green); color: var(--green);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px;
}
.flash.err { background: rgba(229,72,77,.13); border-color: var(--red); color: var(--red); }

/* ── Воронка ── */
.funnel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.funnel .col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.funnel .col h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; }
.funnel .lead { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; font-size: 12.5px; }
.funnel .lead b { display: block; font-weight: 600; margin-bottom: 3px; }
@media (max-width: 1200px) { .funnel { grid-template-columns: repeat(2, 1fr); } }

.fcol { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 140px; }
.fhead { display: flex; justify-content: space-between; align-items: center; font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.fcount { background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px;
  padding: 1px 8px; font-size: 11px; color: var(--text); }
.fsum { font-size: 12px; color: var(--accent); font-weight: 700; margin: 6px 0 10px; }
.fcard { display: block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; margin-bottom: 8px; font-size: 12.5px; color: var(--text); }
.fcard:hover { border-color: var(--accent); text-decoration: none; }
.ftitle { font-weight: 600; margin-bottom: 3px; }
.fmeta { font-size: 11.5px; color: var(--muted); }
.fnext { margin-top: 6px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 5px; }
.fnext.late { color: var(--red); }
.fempty { font-size: 11.5px; color: var(--muted); opacity: .5; padding: 6px 0; }
.hidden { display: none; }

/* ── Вхід ── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.login-box .brand { text-align: center; border: none; margin-bottom: 24px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 15px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.hint { font-size: 12px; color: var(--muted); margin-top: -6px; margin-bottom: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
