/* Jade Gift — Desktop Dashboard (PC-first) */

:root {
  --font: "Inter", system-ui, sans-serif;
  --bg: #f5f6f8;
  --bg-outer: #e8eaef;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: #8b5cf6;
  --accent-soft: rgba(124, 58, 237, 0.1);
  --accent-softer: #f3e8ff;
  --accent-glow: rgba(124, 58, 237, 0.2);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.1);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --orange: #ea580c;
  --orange-soft: rgba(234, 88, 12, 0.1);
  --gray-soft: rgba(107, 114, 128, 0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --chart-lg: 340px;
  --chart-md: 280px;
  --chart-ltv: 260px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg-outer);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg);
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
}

.bg-orb--1 {
  width: 700px; height: 500px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.09) 0%, transparent 70%);
  top: -120px; right: 5%;
}

.bg-orb--2 {
  width: 500px; height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.07) 0%, transparent 70%);
  bottom: 0; left: 10%;
}

/* ── Shell: full width desktop ── */
.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 28px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.header {
  --header-h: 46px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 246, 248, 0.94);
  backdrop-filter: blur(10px);
}

.header__row--top {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.header__row--nav {
  display: flex;
  justify-content: center;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: 14px;
  padding-right: 6px;
}

.header__titles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, #f5f3ff 0%, #fff 100%);
  border: 1px solid rgba(124, 58, 237, 0.15);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.08);
}

.logo svg { width: 18px; height: 18px; }

.header h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  line-height: 1.15;
}

.header__subtitle {
  font-size: 0.66rem;
  font-weight: 300;
  color: var(--text-3);
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.header-block {
  height: var(--header-h);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.header-kpis {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex: 0.9 1 200px;
  min-width: 180px;
  max-width: 340px;
}

.header-kpi {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 10px;
  height: var(--header-h);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-kpi--alert {
  border-color: rgba(239, 68, 68, 0.2);
  background: linear-gradient(180deg, #fff 0%, #fff8f8 100%);
}

.header-kpi--green {
  border-color: rgba(16, 185, 129, 0.2);
  background: linear-gradient(180deg, #fff 0%, #f6fffb 100%);
}

.header-kpi__icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-kpi__icon svg {
  width: 18px;
  height: 18px;
}

.header-kpi--alert .header-kpi__icon svg {
  color: #ef4444;
}

.header-kpi--green .header-kpi__icon svg {
  color: #10b981;
}

.header-kpi__body {
  min-width: 0;
}

.header-kpi__lbl {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-kpi__val {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.header-kpi--alert .header-kpi__val {
  color: #dc2626;
}

.header-plan {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0.7 1 130px;
  min-width: 130px;
  max-width: 200px;
  padding: 0 10px;
  border-color: rgba(124, 58, 237, 0.14);
  background: linear-gradient(180deg, #fff 0%, #faf8ff 100%);
}

.header-plan__lbl {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  white-space: nowrap;
}

.header-plan__input {
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 8px;
  height: 30px;
  width: 100%;
  min-width: 0;
}

.header-plan__input:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.header-plan__input::placeholder {
  color: var(--text-3);
  font-weight: 500;
}

.header-hero {
  display: flex;
  align-items: stretch;
  flex: 1.4 1 220px;
  min-width: 0;
  height: var(--header-h);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(124, 58, 237, 0.22);
  box-shadow: 0 3px 14px rgba(124, 58, 237, 0.1);
  background: var(--surface);
}

.header-hero__main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0 12px;
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 55%, #8b5cf6 100%);
  color: #fff;
}

.header-hero__badge {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.88;
  white-space: nowrap;
}

.header-hero__val {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.header-hero__stats {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.header-hero__stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 10px;
  border-left: 1px solid var(--border);
}

.header-hero__stat-lbl {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  line-height: 1;
}

.header-hero__stat-val {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-hero__stat:nth-child(n+3) {
  display: none;
}

@media (min-width: 1200px) {
  .header-hero__stat:nth-child(3) {
    display: flex;
  }
}

@media (min-width: 1400px) {
  .header-hero__stat:nth-child(4) {
    display: flex;
  }
}

.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 6px;
  flex: 1.6 1 260px;
  min-width: 0;
  padding: 0 8px;
}

.filters__field {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.filters__lbl {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  white-space: nowrap;
}

.filters__field input,
.filters__field select {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 6px;
  min-width: 0;
  height: 30px;
}

.filters__field input:focus,
.filters__field select:focus,
.header-plan__input:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.4);
}

.filters__field input[type="date"] {
  width: 100%;
  min-width: 96px;
  max-width: 118px;
}

.filters__field--mgr {
  flex: 1.2 1 140px;
  min-width: 132px;
  max-width: 220px;
}

.filters__select-wrap {
  position: relative;
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.filters__select-wrap::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: translateY(-60%) rotate(45deg);
  pointer-events: none;
}

.filters__field--mgr select {
  width: 100%;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0 28px 0 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.filters__field--mgr select::-ms-expand {
  display: none;
}

.btn-period {
  height: 30px;
  padding: 0 11px;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-period:hover {
  background: var(--accent-softer);
}

.btn-period:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-period--mgr {
  align-self: flex-end;
  height: 38px;
  padding: 0 14px;
  font-size: 0.78rem;
}

.dash-busy .dashboard {
  pointer-events: none;
}

.dash-progress {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
}

.dash-progress.hidden {
  display: none;
}

.dash-progress__card {
  width: min(360px, 100%);
  padding: 22px 24px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  text-align: center;
}

.dash-progress__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.dash-progress__pct {
  margin: 10px 0 14px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.dash-progress__track {
  height: 10px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  overflow: hidden;
}

.dash-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #2563eb);
  transition: width 0.25s ease-out;
}

.dash-progress__hint {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--text-2);
}

body.dash-manager-mode [data-company-only],
body.dash-manager-mode [data-nav-company] {
  display: none !important;
}

body:not(.dash-manager-mode) [data-manager-only] {
  display: none !important;
}

body.dash-manager-mode .dash-row--half-pair {
  display: none;
}

body.dash-manager-mode .ops-mgr-plan-slot {
  display: flex;
  min-width: 0;
  min-height: 280px;
}

body.dash-manager-mode .ops-mgr-plan-slot > .panel--mgr-plan {
  width: 100%;
  min-height: 280px;
}

body.dash-manager-mode #header-kpi-ltv {
  display: none;
}

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

.btn-refresh--compact {
  width: var(--header-h);
  height: var(--header-h);
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.28);
}

.btn-refresh--compact svg {
  width: 17px;
  height: 17px;
}

.nav-jump {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.nav-jump a {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.nav-jump a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-2);
}

.pill svg { width: 13px; height: 13px; color: var(--text-3); }

.pill--accent {
  background: var(--accent-softer);
  border-color: rgba(124, 58, 237, 0.2);
  color: var(--accent);
}

.pill--accent svg { color: var(--accent); }

.pill__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-refresh svg { width: 14px; height: 14px; }
.btn-refresh:hover { background: var(--accent-hover); }
.btn-refresh:disabled { opacity: 0.5; cursor: wait; }

/* ── Loading / errors ── */
.loading { text-align: center; padding: 80px; flex: 1; }

.loader { width: 40px; height: 40px; margin: 0 auto 16px; }

.loader__ring {
  width: 100%; height: 100%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading__text { color: var(--text-2); font-size: 0.88rem; }

.error-banner {
  background: var(--red-soft);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.84rem;
}

.hidden { display: none !important; }

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

/* ══════════════════════════════════════
   ROW 1 — KPI strip (plan + 2×3 tiles)
   ══════════════════════════════════════ */
.kpi-strip {
  --kpi-cell-h: 58px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.plan-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
  overflow: hidden;
  height: calc(var(--kpi-cell-h) * 2 + 8px);
  min-height: calc(var(--kpi-cell-h) * 2 + 8px);
  max-height: calc(var(--kpi-cell-h) * 2 + 8px);
}

.plan-compact__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.plan-compact__head-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.plan-compact__title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-3);
}

.plan-compact__pct {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
}

.plan-compact__pct--over {
  color: var(--green);
}

.plan-compact__foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.plan-compact__stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.plan-compact__stat-lbl {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.plan-compact__stat-val {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-compact__stat--fact .plan-compact__stat-val { color: var(--accent); }
.plan-compact__stat--green .plan-compact__stat-val { color: var(--green); }
.plan-compact__stat--warn .plan-compact__stat-val { color: var(--orange); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 152px);
  grid-template-rows: repeat(2, var(--kpi-cell-h));
  gap: 8px;
}

.kpi-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--kpi-cell-h);
  min-height: var(--kpi-cell-h);
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
  overflow: visible;
}

.kpi-cell__icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--icon-bg, var(--accent-soft));
  color: var(--icon-color, var(--accent));
}

.kpi-cell__icon svg { width: 15px; height: 15px; }

.kpi-cell__lbl {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.kpi-cell__val {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.kpi-cell--accent { --icon-bg: var(--accent-soft); --icon-color: var(--accent); }
.kpi-cell--green { --icon-bg: var(--green-soft); --icon-color: var(--green); }
.kpi-cell--orange { --icon-bg: var(--orange-soft); --icon-color: var(--orange); }
.kpi-cell--red { --icon-bg: var(--red-soft); --icon-color: var(--red); }
.kpi-cell--gray { --icon-bg: var(--gray-soft); --icon-color: var(--text-2); }

.cell-alert { color: var(--red); font-weight: 800; }

.chart-box canvas {
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   ROW 2–3 — CHARTS (12-col grid)
   ══════════════════════════════════════ */
.dash-row--charts {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.panel--chart.panel--wide { grid-column: span 6; }
.panel--chart:not(.panel--wide) { grid-column: span 4; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.panel__head h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.panel__title-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel__head--stack { align-items: flex-start; }

.panel__hint {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.35;
}

.panel__empty {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--text-3);
  text-align: center;
}

.panel__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.panel__sub--with-help {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Help tooltips (? icons) ── */
.help-tip {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  vertical-align: middle;
  opacity: 0.55;
  transition: opacity 0.15s var(--ease);
}

.help-tip--corner {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
}

.help-tip:hover,
.help-tip:focus-within {
  z-index: 201;
  opacity: 1;
}

.help-tip__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 1px solid rgba(156, 163, 175, 0.35);
  border-radius: 50%;
  background: rgba(243, 244, 246, 0.45);
  color: rgba(107, 114, 128, 0.75);
  font-family: var(--font);
  font-size: 0.48rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), opacity 0.15s var(--ease);
}

.help-tip__btn:hover,
.help-tip__btn:focus-visible {
  background: var(--accent-soft);
  border-color: rgba(124, 58, 237, 0.35);
  color: var(--accent);
  outline: none;
}

.help-tip__popup {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: min(280px, calc(100vw - 32px));
  padding: 10px 12px;
  background: #111827;
  color: #f9fafb;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s var(--ease), visibility 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 200;
}

.help-tip__popup::before {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 5px;
  border: 5px solid transparent;
  border-bottom-color: #111827;
}

.help-tip:hover .help-tip__popup,
.help-tip:focus-within .help-tip__popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.help-tip--up .help-tip__popup {
  top: auto;
  bottom: calc(100% + 7px);
  transform: translateY(-4px);
}

.help-tip--up .help-tip__popup::before {
  bottom: auto;
  top: 100%;
  border-bottom-color: transparent;
  border-top-color: #111827;
}

.help-tip--up:hover .help-tip__popup,
.help-tip--up:focus-within .help-tip__popup {
  transform: translateY(0);
}

.header-kpi,
.kpi-cell {
  position: relative;
}

.panel__sub {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin: 10px 0 6px;
}

.tag {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
}

.tag--blue { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.tag--teal { background: rgba(20, 184, 166, 0.12); color: #0d9488; }

.chart-box--ltv { min-height: var(--chart-ltv); }

/* ══════════════════════════════════════
   LTV + Manager plan — 50/50 row
   ══════════════════════════════════════ */
.dash-row--half-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.dash-row--ltv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.panel--full { width: 100%; }

.table-scroll--ltv {
  max-height: 280px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.ltv-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.tbl--compact td,
.tbl--compact th {
  padding: 5px 8px;
  font-size: 0.72rem;
}

.chart-box {
  position: relative;
  flex: 1;
  min-height: var(--chart-md);
}

.chart-box--empty canvas {
  opacity: 0.42;
  filter: grayscale(1);
  pointer-events: none;
}

.chart-box + .panel__empty:not(.hidden) {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  z-index: 2;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.panel--chart {
  position: relative;
}

.chart-box--plan-compact {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.chart-box--plan-compact canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: 100%;
}

.chart-box--lg { min-height: var(--chart-lg); }
.chart-box--md { min-height: var(--chart-md); }

.forecast-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.forecast-stat {
  text-align: center;
  padding: 10px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.forecast-stat__val {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.forecast-stat__lbl {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 3px;
}

.forecast-stat--green .forecast-stat__val { color: var(--green); }
.forecast-stat--orange .forecast-stat__val { color: var(--orange); }
.forecast-stat--accent .forecast-stat__val { color: var(--accent); }

.forecast-empty {
  text-align: center;
  padding: 28px 16px 12px;
  color: var(--text-3);
}

.forecast-empty__icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--orange-soft);
  color: var(--orange);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 800;
}

.forecast-empty__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.forecast-empty__text {
  font-size: 0.72rem;
  line-height: 1.45;
  max-width: 360px;
  margin: 0 auto;
}

.chart-box--forecast { min-height: auto; }

.table-scroll--forecast {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 8px;
}

.panel--forecast .panel__sub { margin-top: 4px; }

@media (max-width: 1100px) {
  .forecast-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════
   ROW 4 — OPS (3 equal columns)
   ══════════════════════════════════════ */
.dash-row--ops {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: stretch;
}

.panel--ops {
  min-height: 280px;
}

.panel--funnel {
  display: flex;
  flex-direction: column;
}

.funnel-loss {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 200px;
  padding-bottom: 4px;
}

.funnel-loss__summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.funnel-loss__headline {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.funnel-loss__outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.funnel-loss__outcome {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
}

.funnel-loss__outcome--won {
  background: var(--green-soft);
  color: var(--green);
}

.funnel-loss__outcome--lost {
  background: rgba(220, 38, 38, 0.1);
  color: var(--red);
}

.funnel-loss__bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
  max-height: 240px;
  padding-right: 2px;
}

.loss-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.loss-row__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.loss-row__name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  line-height: 1.25;
}

.loss-row__nums {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--red);
  white-space: nowrap;
}

.loss-row__nums em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  margin-left: 4px;
}

.loss-row__track {
  height: 12px;
  background: #fee2e2;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.loss-row__fill {
  height: 100%;
  min-width: 12px;
  border-radius: 999px;
  background: #ef4444;
}

.loss-row--hot .loss-row__fill {
  background: #dc2626;
}

.loss-row--hot .loss-row__name {
  font-weight: 700;
}

.funnel-empty--compact {
  min-height: 72px;
}

.funnel-empty {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 120px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.82rem;
}

.tasks-summary, .calls-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.mini-stat {
  text-align: center;
  padding: 8px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mini-stat__val {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mini-stat__lbl {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 2px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 99px;
  transition: width 0.7s var(--ease);
}

.progress-note {
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 4px;
}

.calls-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-3);
  font-size: 0.82rem;
}

.calls-empty__icon {
  width: 36px; height: 36px;
  margin: 0 auto 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}

.calls-empty__icon svg { width: 18px; height: 18px; }

/* ══════════════════════════════════════
   ROW 5 — LTV TABLE
   ══════════════════════════════════════ */
.dash-row--table .panel--full {
  width: 100%;
}

.table-scroll { overflow-x: auto; }

.table-scroll--compact { max-height: 140px; overflow-y: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.tbl th {
  text-align: left;
  padding: 7px 10px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.tbl th.r, .tbl td.r { text-align: right; }

.tbl td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 500;
}

.tbl tbody tr:hover { background: var(--accent-soft); }

.tbl td.r {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.tbl .empty-row td {
  text-align: center;
  color: var(--text-3);
  padding: 16px;
}

/* ── Wide screens: taller charts ── */
@media (min-width: 1400px) {
  :root {
    --chart-lg: 380px;
    --chart-md: 300px;
  }

  .header { --header-h: 48px; }
  .header-hero__val { font-size: 1.12rem; }
}

@media (max-width: 600px) {
  .shell { padding: 0 12px 16px; }
  .nav-jump { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .header-hero__stat { padding: 0 6px; }
  .filters__lbl { display: none; }
}

@media (min-width: 1200px) and (max-height: 900px) {
  :root {
    --chart-lg: 300px;
    --chart-md: 240px;
  }

  .panel--ops { min-height: 240px; }
}

/* Access gate — в стиле login Web App */
.dash-access-gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #e8eaef;
}

.dash-access-gate.hidden {
  display: none;
}

.dash-login {
  width: 100%;
  max-width: 430px;
  min-height: min(100dvh, 640px);
  padding: 48px 24px 32px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.dash-login__brand {
  text-align: center;
  margin-bottom: 36px;
}

.dash-login__logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: 18px;
  color: var(--accent);
}

.dash-login__logo svg {
  width: 32px;
  height: 32px;
}

.dash-login__brand h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-login__brand p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.95rem;
}

.dash-login__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-field__label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
}

.dash-field__input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.dash-field__input::placeholder {
  color: var(--text-3);
}

.dash-field__input:focus {
  border-color: var(--accent);
}

.dash-login__error {
  margin: 0;
  color: var(--red);
  font-size: 0.85rem;
  text-align: center;
}

.dash-btn-primary {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.dash-btn-primary:hover {
  background: var(--accent-hover);
}

.dash-btn-primary:active {
  transform: scale(0.98);
}

.dash-login__guest {
  margin-top: auto;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-btn-secondary {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.dash-btn-secondary:hover {
  background: var(--surface-2);
  border-color: #d1d5db;
  color: var(--text);
}

.dash-login__note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-3);
  text-align: center;
  line-height: 1.4;
}

@media (max-width: 480px) {
  .dash-access-gate {
    padding: 0;
    background: var(--bg);
  }

  .dash-login {
    max-width: none;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 0;
}

.header-data-age {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  line-height: 1.2;
  text-align: right;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-auth__badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-2);
  white-space: nowrap;
}

.header-auth__badge--admin {
  background: var(--accent-soft);
  color: var(--accent);
}

.header-auth__btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.header-auth__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

body.dash-guest [data-admin-only] {
  display: none !important;
}

.mgr-pf__plan-readonly {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.panel--instructor-hours {
  min-height: 220px;
}

.panel--instructor-hours .tbl td.r strong {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.panel--mgr-plan,
.panel--ltv-table {
  min-width: 0;
  min-height: 320px;
}

.panel--mgr-plan .panel__head--stack {
  align-items: flex-start;
  gap: 12px 24px;
}

.mgr-plan-filters {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.mgr-plan-filters__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mgr-plan-filters__lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.mgr-plan-filters select {
  min-width: 110px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.table-scroll--mgr-plan {
  flex: 1;
  min-height: 0;
  max-height: 280px;
  overflow: auto;
}

.tbl--mgr-pf {
  width: 100%;
  min-width: 0;
}

.tbl--mgr-pf td,
.tbl--mgr-pf th {
  padding: 6px 8px;
  vertical-align: middle;
}

.tbl--mgr-pf tbody tr {
  height: auto;
}

.tbl--mgr-pf .mgr-pf__th-name {
  width: 34%;
  min-width: 88px;
}

.tbl--mgr-pf .mgr-pf__th-month {
  width: 66%;
}

.mgr-pf__name {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.25;
  vertical-align: middle;
}

.mgr-pf__cell {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-softer));
  border: 1px solid rgba(124, 58, 237, 0.18);
  text-align: left;
  min-height: 44px;
}

.mgr-pf__cell--total {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), var(--accent-softer));
  border-color: rgba(124, 58, 237, 0.28);
}

.mgr-pf__metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  flex: 0 0 auto;
  min-width: 0;
}

.mgr-pf__metric--fact {
  min-width: 72px;
}

.mgr-pf__metric--plan {
  min-width: 76px;
}

.mgr-pf__metric--delta {
  min-width: 68px;
}

.mgr-pf__metric-lbl {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.1;
  white-space: nowrap;
}

.mgr-pf__metric-body {
  line-height: 1.2;
}

.mgr-pf__money {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.mgr-pf__delta-val {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.mgr-pf__delta--behind { color: var(--orange); }
.mgr-pf__delta--ahead { color: var(--green); }
.mgr-pf__delta--ok { color: var(--accent); }
.mgr-pf__delta--muted { color: var(--text-muted); }

.mgr-pf__plan-input {
  width: 76px;
  max-width: 76px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid rgba(124, 58, 237, 0.22);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.mgr-pf__plan-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.mgr-pf__pct {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

.mgr-pf__pct--ok {
  color: var(--green);
  background: rgba(16, 185, 129, 0.12);
}

.mgr-pf__pct--mid {
  color: var(--orange);
  background: rgba(245, 158, 11, 0.12);
}

.mgr-pf__pct--low {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.mgr-pf__sales {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.mgr-pf__total td {
  border-top: 2px solid rgba(124, 58, 237, 0.2);
  padding-top: 8px;
}

.mgr-plan-filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Tablet / mobile fallback ── */
@media (max-width: 900px) {
  .header__row--top {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header__brand {
    margin-right: 0;
    padding-right: 0;
  }

  .header-kpis,
  .header-plan,
  .header-hero,
  .filters {
    flex: 1 1 100%;
    max-width: none;
  }

  .filters {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
    padding: 6px 8px;
    justify-content: flex-start;
  }

  .btn-refresh--compact {
    margin-left: auto;
  }

  .header-hero__stat:nth-child(n+3) {
    display: flex;
  }

  .kpi-strip {
    grid-template-columns: 1fr;
  }

  .plan-compact {
    height: auto;
    min-height: 140px;
    max-height: none;
  }

  .kpi-grid {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .kpi-cell {
    width: auto;
  }

  .dash-row--charts {
    grid-template-columns: 1fr;
  }

  .panel--chart.panel--wide,
  .panel--chart:not(.panel--wide) {
    grid-column: span 1;
  }

  .dash-row--ops {
    grid-template-columns: 1fr;
  }

  .dash-row--half-pair {
    grid-template-columns: 1fr;
  }

  .dash-row--ltv {
    grid-template-columns: 1fr;
  }
}

.dash-row--sla{margin:12px 0 8px}
.panel--sla .sla-stats{display:flex;gap:24px;padding:8px 4px 4px}
.sla-stat{display:flex;flex-direction:column;gap:4px}
.sla-stat__lbl{font-size:.75rem;color:var(--text-2)}
.sla-stat strong{font-size:1.25rem}

@media (max-width:720px) {
  body.desktop .shell { padding: 0; }
  .header__row--top { flex-wrap: wrap; gap: 8px; }
  .header-kpis,
  .header-hero__stats { display: none; }
  .header-hero { width: 100%; }
  .header-meta {
    width: 100%;
    align-items: center;
    order: 5;
  }
  .header-data-age { text-align: center; }
  .nav-jump a[href="#block-charts"],
  .nav-jump a[href="#block-ltv"],
  #block-charts,
  .dash-row--ltv,
  #block-instructor-hours { display: none !important; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  #block-sla { display: block !important; }
  body.dash-manager-mode .dash-row--ops {
    grid-template-columns: 1fr;
  }
}
