/* AIVA ОП — премиум-дашборд отдела продаж. Apple-light стекло + изумрудный акцент. */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --bg: #eceff5;
  --bg-grad-1: rgba(16, 185, 129, 0.10);
  --bg-grad-2: rgba(59, 130, 246, 0.08);
  --surface: rgba(255, 255, 255, 0.74);
  --surface-2: rgba(255, 255, 255, 0.55);
  --surface-solid: #ffffff;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent: #059669;
  --accent-dim: #047857;
  --accent-soft: rgba(5, 150, 105, 0.10);
  --blue: #2563eb; --blue-soft: rgba(37, 99, 235, 0.10);
  --gold: #d97706;
  --danger: #dc2626;
  --r-sm: 12px; --r-md: 18px; --r-lg: 24px;
  --shadow: 0 24px 60px -28px rgba(15, 40, 60, 0.34);
  --shadow-soft: 0 10px 30px -18px rgba(15, 40, 60, 0.26);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b12; --bg-grad-1: rgba(16,185,129,0.12); --bg-grad-2: rgba(59,130,246,0.10);
    --surface: rgba(22,28,40,0.66); --surface-2: rgba(30,38,54,0.5); --surface-solid: #131926;
    --line: rgba(148,163,184,0.14); --line-strong: rgba(148,163,184,0.24);
    --text: #eef2f8; --muted: #94a3b8; --faint: #64748b;
    --accent: #34d399; --accent-dim: #10b981; --accent-soft: rgba(52,211,153,0.12);
    --blue: #60a5fa; --blue-soft: rgba(96,165,250,0.12);
    --gold: #fbbf24; --danger: #f87171;
    --shadow: 0 24px 60px -26px rgba(0,0,0,0.7); --shadow-soft: 0 12px 30px -18px rgba(0,0,0,0.6);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  letter-spacing: -0.011em; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 640px at 8% -12%, var(--bg-grad-1), transparent 55%),
    radial-gradient(1000px 560px at 108% 0%, var(--bg-grad-2), transparent 52%), var(--bg);
  min-height: 100vh;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: 'tnum' 1; }
a { color: var(--accent-dim); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; padding: 13px 26px; border-bottom: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(20px) saturate(160%); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 15.5px; letter-spacing: -0.02em; }
.brand::before { content: ''; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(140deg, var(--accent), var(--accent-dim)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 8px 20px -8px var(--accent-dim); }
.tabs { display: flex; gap: 4px; margin: 0 auto; padding: 4px; border-radius: 999px; background: var(--accent-soft); }
.tab { border: 0; background: transparent; color: var(--muted); padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; transition: color .18s, background .18s; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; background: linear-gradient(140deg, var(--accent), var(--accent-dim)); box-shadow: 0 8px 18px -10px var(--accent-dim); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.link-btn { border: 0; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 6px 10px; border-radius: 10px; }
.link-btn:hover { color: var(--danger); background: var(--line); }

/* Content */
.content { max-width: 1280px; margin: 0 auto; padding: 24px 26px 60px; }
.content > section { display: flex; flex-direction: column; gap: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .content > section > * { animation: rise .5s cubic-bezier(0.16,1,0.3,1) both; }
  .content > section > *:nth-child(2){animation-delay:.05s} .content > section > *:nth-child(3){animation-delay:.1s} .content > section > *:nth-child(4){animation-delay:.15s} .content > section > *:nth-child(5){animation-delay:.2s}
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-soft); backdrop-filter: blur(16px); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--accent), var(--accent-dim)); }
.kpi .kpi-val { font-family: 'JetBrains Mono', monospace; font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.kpi .kpi-lbl { font-size: 12.5px; color: var(--muted); margin-top: 8px; font-weight: 600; }

/* Heroes */
.heroes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 22px 24px; background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.hero:nth-child(2) { background: linear-gradient(135deg, var(--blue-soft), transparent 60%), var(--surface); }
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.hero .hero-cap { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.hero .hero-name { font-size: 25px; font-weight: 800; margin: 6px 0 4px; letter-spacing: -0.02em; }
.hero .hero-sub { font-size: 13.5px; color: var(--muted); font-weight: 600; }

/* Blocks */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 22px; box-shadow: var(--shadow-soft); backdrop-filter: blur(14px); }
.sec-title { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.sec-title .count { margin-left: auto; font-family: 'JetBrains Mono', monospace; color: var(--accent-dim); }
.row { display: flex; gap: 16px; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 900px) { .row { flex-direction: column; } .kpis { grid-template-columns: repeat(2,1fr); } .heroes { grid-template-columns: 1fr; } .tabs { display: none; } }

/* Manager bar-list (провёл / предстоит / привёл) */
.barlist { display: flex; flex-direction: column; gap: 9px; }
.barrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.barrow .bl-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barrow .bl-track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.barrow .bl-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-dim)); }
.barrow.blue .bl-fill { background: linear-gradient(90deg, var(--blue), #1d4ed8); }
.barrow .bl-num { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 14px; }

/* Gantt-таймлайн назначенных встреч */
.gantt { overflow-x: auto; }
.gantt-inner { min-width: 720px; }
.gantt-axis { display: grid; grid-template-columns: 150px 1fr; align-items: end; margin-bottom: 6px; }
.gantt-hours { position: relative; display: flex; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--faint); }
.gnow-tag { position: absolute; top: -2px; transform: translateX(-50%); font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700; color: #e11d48; white-space: nowrap; z-index: 2; }
.gnow { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: #e11d48; box-shadow: 0 0 6px -1px #e11d48; border-radius: 2px; pointer-events: none; z-index: 1; }
.gantt-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 0; padding: 5px 0; border-top: 1px solid var(--line); }
.gantt-mgr { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.gantt-track { position: relative; height: 26px; background: linear-gradient(90deg, var(--surface-2) 1px, transparent 1px) 0 0 / calc(100%/11) 100%; border-radius: 8px; }
.gbar { position: absolute; top: 3px; height: 20px; min-width: 8px; border-radius: 6px; background: linear-gradient(140deg, var(--accent), var(--accent-dim)); box-shadow: 0 4px 10px -5px var(--accent-dim); cursor: pointer; display: flex; align-items: center; padding: 0 6px; font-size: 10px; color: #fff; font-weight: 700; overflow: hidden; white-space: nowrap; }
.gbar.came { background: linear-gradient(140deg, #10b981, #059669); box-shadow: 0 4px 10px -5px #059669; }
.gbar.noshow { background: linear-gradient(140deg, #f43f5e, #e11d48); box-shadow: 0 4px 10px -5px #e11d48; }
.gbar.wait { background: linear-gradient(140deg, #fbbf24, #f59e0b); box-shadow: 0 4px 10px -5px #f59e0b; color: #3b2a06; }
.gbar.online { outline: 2px dashed rgba(255, 255, 255, .85); outline-offset: -3px; }
.gbar:hover { filter: brightness(1.08); transform: translateY(-1px); z-index: 3; }

/* Таблицы-строки */
.calls-head { display: grid; grid-template-columns: 92px 1fr 1fr 1fr; gap: 12px; padding: 0 12px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; }
.calls-row { display: grid; grid-template-columns: 92px 1fr 1fr 1fr; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 12px; font-size: 14px; }
.calls-row:nth-child(odd) { background: var(--surface-2); }
.calls-row b { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
#op-rating .calls-row, #kc-rating .calls-row { grid-template-columns: 1fr auto; }
#op-rating .calls-head, #kc-rating .calls-head { display: none; }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 7px; font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; background: var(--line); color: var(--muted); margin-right: 9px; }
.rank.r1 { background: linear-gradient(140deg, #fbbf24, #d97706); color: #fff; }
.rank.r2 { background: linear-gradient(140deg, #cbd5e1, #94a3b8); color: #fff; }
.rank.r3 { background: linear-gradient(140deg, #f0a173, #c2703a); color: #fff; }

/* Пилюли (тип встречи / стадия / источник) */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--muted); }
.pill.office { background: var(--accent-soft); color: var(--accent-dim); }
.pill.online { background: var(--blue-soft); color: var(--blue); }
.pill.street { background: rgba(217,119,6,0.14); color: var(--gold); }
.pill.self { background: rgba(37,99,235,0.12); color: var(--blue); }
.pill.came { background: rgba(5,150,105,0.14); color: var(--accent-dim); }
.pill.upcoming { background: rgba(217,119,6,0.15); color: var(--gold); }
.pill.noshow { background: rgba(220,38,38,0.13); color: var(--danger); }

/* Раскрывающийся отчёт по дням */
.day-row { display: grid; grid-template-columns: 22px 130px 1fr 1fr 1fr 84px; gap: 12px; align-items: center; padding: 13px 14px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.day-row:hover { background: var(--surface-2); }
.day-row .chev { transition: transform .2s; color: var(--faint); }
.day-row.open .chev { transform: rotate(90deg); }
.day-row .d-metric { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.day-row .d-rate { text-align: right; }
.day-detail { padding: 4px 14px 14px 48px; }
.day-detail .lead-line { display: grid; grid-template-columns: 72px 1fr 1fr 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; }
.day-detail .lead-line:hover { background: var(--surface-2); }
.day-detail .lead-line + .lead-line { border-top: 1px solid var(--line); }

/* Детальная сводка — широкая таблица клиентов */
.dtable-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.dtable { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 960px; }
table.dtable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; padding: 0 12px 10px; white-space: nowrap; }
table.dtable td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.dtable tr:hover td { background: var(--surface-2); }
table.dtable td.num { font-family: 'JetBrains Mono', monospace; }
.filled { color: var(--accent-dim); font-weight: 600; }
.empty-cell { color: var(--danger); font-size: 12px; opacity: .8; }

/* Login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; padding: 34px 32px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.login-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.login-card > p { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.control, .field input { width: 100%; padding: 11px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text); font-size: 14.5px; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .control:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn { padding: 12px 20px; border: 0; border-radius: var(--r-sm); background: linear-gradient(140deg, var(--accent), var(--accent-dim)); color: #fff; font-size: 14.5px; font-weight: 700; box-shadow: 0 12px 26px -12px var(--accent-dim); transition: transform .12s, filter .15s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-lg { width: 100%; padding: 13px; font-size: 15px; }
.error { background: rgba(220,38,38,0.10); color: var(--danger); border: 1px solid rgba(220,38,38,0.24); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); }
#nokc-warn { background: var(--surface); border: 1px solid rgba(217,119,6,0.32); border-radius: var(--r-md); padding: 20px 22px; box-shadow: var(--shadow-soft); backdrop-filter: blur(14px); }
#nokc-warn .nokc-title { font-weight: 700; color: var(--gold); margin-bottom: 12px; font-size: 14px; }
#range-table .calls-head, #range-table .calls-row { display: none; }
.filterbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 6px; }
.empty { color: var(--muted); font-size: 14px; padding: 20px 0; text-align: center; }
