/* =============================================================================
   dashboards.css — доп.стили для лендинга «Дашборды для бизнеса».
   Подключается ТОЛЬКО в dashboards.html поверх styles.css.
   Использует токены из styles.css (--bg, --accent и т.д.).

   .ddash — самодостаточный компонент «живого дашборда»: повторяет вид реальной
   рабочей панели Amospace (sheets.amospace.kz / dfz.amospace.kz), но в тёплой
   палитре бренда. Все токены объявлены внутри .ddash, чтобы стили панели
   не протекали в остальной сайт и наоборот.
============================================================================= */

/* ── HERO с дашбордом рядом ────────────────────────────────────────────── */
.hero--dash { text-align: left; }
.hero--dash .hero__inner { max-width: var(--maxw); }
.hero--dash .hero__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
}
.hero--dash .hero__title,
.hero--dash .hero__subtitle { margin-left: 0; margin-right: 0; }
.hero--dash .hero__subtitle { max-width: 520px; }
.hero--dash .hero__cta { justify-content: flex-start; }
.hero--dash .badge { margin-bottom: 22px; }

@media (max-width: 900px) {
  .hero--dash { text-align: center; }
  .hero--dash .hero__grid { grid-template-columns: 1fr; gap: 36px; }
  .hero--dash .hero__cta { justify-content: center; }
  .hero--dash .hero__subtitle { margin-left: auto; margin-right: auto; }
  .hero--dash .hero__col--media { order: 2; }
}

/* ── ПРОДУКТОВЫЙ ТУЛБАР (как в рабочей панели) ──────────────────────────── */
.dash-toolbar {
  max-width: 1000px; margin: 0 auto 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 12px 16px;
  box-shadow: 0 6px 22px rgba(24, 18, 12, 0.06);
}
.dash-toolbar__brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }
.dash-toolbar__mark { width: 16px; height: 16px; border-radius: 5px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.dash-toolbar__filters { display: flex; gap: 8px; flex-wrap: wrap; margin-left: 4px; }
.dash-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--ink-soft);
}
.dash-chip b { color: var(--ink); font-weight: 700; }
.dash-chip i { color: var(--ink-mut); font-style: normal; font-size: 10px; }
.dash-toolbar__sync { margin-left: auto; font-size: 12px; color: var(--ok); font-weight: 600; white-space: nowrap; }
@media (max-width: 620px) {
  .dash-toolbar__sync { margin-left: 0; }
  .dash-toolbar { justify-content: flex-start; }
}

/* ── ТАБЫ БЛОКА ЖИВЫХ ДАШБОРДОВ ────────────────────────────────────────── */
.dash-tabs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 24px; }
.dash-tab {
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--ink-soft);
  font-weight: 600; font-size: 14px; transition: all 0.2s var(--ease);
}
.dash-tab:hover { color: var(--ink); border-color: var(--accent); }
.dash-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-color: transparent; box-shadow: 0 8px 24px var(--accent-glow);
}
.dash-panel { display: none; max-width: 1000px; margin: 0 auto; }
.dash-panel.active { display: block; }
.dash-cta { text-align: center; margin-top: 36px; }

/* ═══════════════ .ddash — КОМПОНЕНТ ЖИВОГО ДАШБОРДА ═══════════════ */
.ddash {
  --dc-card: #ffffff; --dc-card2: #f8fafc; --dc-bg2: #f1f4f9;
  --dc-ink: #0f172a; --dc-ink2: #334155; --dc-mut: #64748b; --dc-faint: #94a3b8;
  --dc-line: #e6e9f1; --dc-line2: #eef1f7;
  --dc-acc: #ed533b; --dc-acc2: #d93f26; --dc-acc-bg: #fdeeeb;
  --dc-ok: #0f9d6c; --dc-ok-bg: #e6f6ee; --dc-bad: #dc2626; --dc-bad-bg: #fdeaea;
  --dc-warn: #b45309; --dc-warn-bg: #fdf1df; --dc-pur: #7c3aed;
  --dc-r: 14px; --dc-r-sm: 10px;
  --dc-sh: 0 1px 2px rgba(15,23,42,.05), 0 2px 6px rgba(15,23,42,.05);
  --dc-hero-a: #9e2a19; --dc-hero-b: #ed533b; --dc-hero-ink: #ffe3dc;

  background: var(--dc-bg2); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; color: var(--dc-ink);
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 15px; line-height: 1.5; text-align: left;
}
.ddash * { box-sizing: border-box; }

/* шапка панели */
.ddash-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 18px; flex-wrap: wrap; margin-bottom: 16px;
}
.ddash-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ddash-brand .dot {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--dc-hero-a), var(--dc-hero-b));
  box-shadow: var(--dc-sh);
}
.ddash-brand .dot svg { width: 18px; height: 18px; }
.ddash-brand h3 { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
.ddash-brand .sub { display: block; font-size: 12.5px; font-weight: 500; color: var(--dc-mut); letter-spacing: 0; margin-top: 1px; }
.ddash-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: #16a34a;
  background: var(--dc-ok-bg); border: 1px solid transparent;
  border-radius: 20px; padding: 4px 10px; white-space: nowrap;
}
.ddash-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.5);
  animation: ddash-pulse 2.2s infinite;
}
@keyframes ddash-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); }
  70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* KPI-плитки */
.ddash-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.ddash-kpi {
  background: var(--dc-card); border: 1px solid var(--dc-line);
  border-radius: var(--dc-r); box-shadow: var(--dc-sh);
  padding: 14px 15px; position: relative; overflow: hidden;
}
.ddash-kpi .lab { font-size: 11px; color: var(--dc-mut); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ddash-kpi .val { font-size: 25px; font-weight: 750; letter-spacing: -.025em; margin-top: 5px; line-height: 1.05; }
.ddash-kpi .sub { font-size: 12px; color: var(--dc-mut); margin-top: 3px; }
.ddash-kpi .sub b { color: var(--dc-ok); font-weight: 700; }
.ddash-kpi.accent {
  background: linear-gradient(140deg, var(--dc-hero-a), var(--dc-hero-b));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 22px rgba(158,42,25,.28);
}
.ddash-kpi.accent .lab, .ddash-kpi.accent .sub { color: var(--dc-hero-ink); }
.ddash-kpi.accent .sub b { color: #fff; }
.ddash-kpi .val.warn { color: var(--dc-warn); }
.ddash-kpi .val.bad { color: var(--dc-bad); }

/* сегментированный бар исполнения (заказали/ждём/не будет) */
.ddash-seg { display: flex; gap: 3px; height: 8px; margin-top: 10px; border-radius: 999px; overflow: hidden; background: var(--dc-bg2); }
.ddash-seg i { display: block; height: 100%; border-radius: 999px; }
.ddash-seg .s-done { background: var(--dc-ok); }
.ddash-seg .s-wait { background: var(--dc-warn); }
.ddash-seg .s-lost { background: var(--dc-bad); }

/* сетка панелей */
.ddash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ddash-panel {
  background: var(--dc-card); border: 1px solid var(--dc-line);
  border-radius: var(--dc-r); box-shadow: var(--dc-sh);
  padding: 15px 17px; min-width: 0;
}
.ddash-panel.span2 { grid-column: 1 / -1; }
.ddash-panel h4 {
  font-size: 14px; font-weight: 700; margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px; letter-spacing: -.01em;
}
.ddash-panel h4 svg { width: 16px; height: 16px; color: var(--dc-acc); flex: none; }
.ddash-panel h4 .cohort {
  margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--dc-acc);
  background: var(--dc-acc-bg); border-radius: 20px; padding: 3px 9px; letter-spacing: 0; text-transform: none;
}

/* воронка */
.ddash-fun { display: flex; flex-direction: column; gap: 10px; }
.ddash-fun .stage { display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 12px; }
.ddash-fun .name { font-size: 13px; color: var(--dc-ink2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ddash-fun .name span { color: var(--dc-faint); font-weight: 700; margin-right: 7px; }
.ddash-fun .track { background: var(--dc-bg2); border-radius: 9px; height: 34px; overflow: hidden; }
.ddash-fun .fill { height: 100%; border-radius: 9px; min-width: 4px;
  background: linear-gradient(90deg, var(--dc-hero-a), var(--dc-acc)); transition: width .6s var(--ease); }
.ddash-fun .num { font-size: 16px; font-weight: 750; text-align: right; min-width: 118px; }
.ddash-fun .num small { display: block; font-size: 11px; font-weight: 600; color: var(--dc-mut); }
.ddash-fun .num small.up { color: var(--dc-ok); }

/* таблица */
.ddash table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ddash th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--dc-mut); font-weight: 700; padding: 0 9px 9px; border-bottom: 1px solid var(--dc-line); white-space: nowrap; }
.ddash th.r, .ddash td.r { text-align: right; }
.ddash td { padding: 9px; border-bottom: 1px solid var(--dc-line2); }
.ddash tbody tr:last-child td { border-bottom: 0; }
.ddash tbody tr { transition: background .12s; }
.ddash tbody tr:hover { background: var(--dc-card2); }
.ddash td:first-child { font-weight: 600; }
.ddash td .strong { font-weight: 700; }
.ddash tfoot td { border-top: 1px solid var(--dc-line); border-bottom: 0; font-weight: 700; padding-top: 10px; }
.ddash .pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.ddash .pill.ok { background: var(--dc-ok-bg); color: var(--dc-ok); }
.ddash .pill.bad { background: var(--dc-bad-bg); color: var(--dc-bad); }
.ddash .pill.mid { background: var(--dc-bg2); color: var(--dc-ink2); }
/* инлайн-бар исполнения в ячейке таблицы */
.ddash .cbar { display: inline-flex; align-items: center; gap: 8px; }
.ddash .cbar .t { flex: 1; min-width: 46px; height: 6px; border-radius: 999px; background: var(--dc-bg2); overflow: hidden; }
.ddash .cbar .f { display: block; height: 100%; background: var(--dc-acc); }
.ddash .cbar .p { font-weight: 700; font-size: 12.5px; min-width: 34px; text-align: right; }
.ddash .cbar.bad .f { background: var(--dc-bad); }
.ddash .cbar.bad .p { color: var(--dc-bad); }
.ddash .cbar:not(.bad) .p { color: var(--dc-acc); }

/* горизонтальные бары (источники / причины) */
.ddash-rbar { display: flex; flex-direction: column; gap: 9px; }
.ddash-rbar .row { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 10px; }
.ddash-rbar .rn { grid-column: 1 / -1; font-size: 12.5px; color: var(--dc-ink2); display: flex; justify-content: space-between; gap: 8px; }
.ddash-rbar .rn b { font-weight: 700; }
.ddash-rbar .rt { grid-column: 1 / -1; background: var(--dc-bg2); border-radius: 6px; height: 20px; overflow: hidden; }
.ddash-rbar .rf { height: 100%; border-radius: 6px; transition: width .6s var(--ease);
  background: linear-gradient(90deg, var(--dc-acc), #f6845f); }
.ddash-rbar.neg .rf { background: linear-gradient(90deg, var(--dc-bad), #f97362); }

/* мини-столбики (динамика / план vs факт) */
.ddash-mchart { display: flex; align-items: stretch; gap: 6px; height: 178px; padding-top: 8px; overflow-x: auto; }
.ddash-mcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; min-width: 24px; }
.ddash-mbars { flex: 1; min-height: 0; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.ddash-mbars i { display: block; width: 13px; border-radius: 5px 5px 0 0; transition: height .6s var(--ease); }
.ddash-mbars .b1 { background: linear-gradient(180deg, var(--dc-acc), var(--dc-hero-a)); }
.ddash-mbars .b2 { background: linear-gradient(180deg, #64748b, #475569); }
.ddash-mcol .ml { font-size: 10.5px; color: var(--dc-mut); white-space: nowrap; }
.ddash-legend { display: flex; gap: 16px; font-size: 12px; color: var(--dc-mut); margin-bottom: 4px; }
.ddash-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ddash-legend .l1 { background: var(--dc-acc); }
.ddash-legend .l2 { background: #64748b; }

/* прогресс план-факт */
.ddash-prog { margin-top: 2px; }
.ddash-prog .ph { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--dc-ink2); margin-bottom: 7px; }
.ddash-prog .ph b { font-weight: 700; }
.ddash-prog .pt { height: 12px; background: var(--dc-bg2); border-radius: 999px; overflow: hidden; }
.ddash-prog .pf { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--dc-hero-a), var(--dc-acc)); transition: width .6s var(--ease); }

/* карточки «темп плана» */
.ddash-pace { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ddash-pace .pc { border: 1px solid var(--dc-line); border-radius: var(--dc-r-sm); background: var(--dc-card2); padding: 14px 15px; }
.ddash-pace .pc-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.ddash-pace .pc-t { font-weight: 700; font-size: 13.5px; }
.ddash-pace .pc-d { font-size: 12px; color: var(--dc-mut); }
.ddash-pace .pc-rate { font-size: 30px; font-weight: 750; letter-spacing: -.03em; line-height: 1; margin-bottom: 8px; }
.ddash-pace .pt { height: 10px; background: var(--dc-bg2); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.ddash-pace .pf { height: 100%; border-radius: 999px; background: var(--dc-acc); transition: width .6s var(--ease); }
.ddash-pace .pc-note { font-size: 12px; color: var(--dc-mut); }
.ddash-pace .pc-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--dc-mut); }
.ddash-pace .badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.ddash-pace .badge.up { background: var(--dc-ok-bg); color: var(--dc-ok); }
.ddash-pace .badge.down { background: var(--dc-bad-bg); color: var(--dc-bad); }

/* список ключевых сигналов (руководителю) */
.ddash-signals { display: flex; flex-direction: column; gap: 8px; }
.ddash-signals .sig { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 9px 11px; border: 1px solid var(--dc-line); border-radius: var(--dc-r-sm); background: var(--dc-card2); }
.ddash-signals .sig .ic { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ddash-signals .sig.ok .ic { background: var(--dc-ok); }
.ddash-signals .sig.warn .ic { background: var(--dc-warn); }
.ddash-signals .sig.bad .ic { background: var(--dc-bad); }
.ddash-signals .sig b { font-weight: 700; }
.ddash-signals .sig .v { margin-left: auto; font-weight: 700; white-space: nowrap; }

/* компактный дашборд в hero */
.ddash--hero { padding: 15px; }
.ddash--hero .ddash-kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ddash--hero .ddash-kpi { padding: 11px 12px; }
.ddash--hero .ddash-kpi .val { font-size: 21px; }
.ddash--hero .ddash-grid { grid-template-columns: 1fr; }

@media (max-width: 720px) {
  .ddash-grid, .ddash-pace { grid-template-columns: 1fr; }
  .ddash-fun .stage { grid-template-columns: 130px 1fr auto; }
  .ddash-fun .num { min-width: 92px; }
}

/* ── ИНТЕГРАЦИИ ────────────────────────────────────────────────────────── */
.integrations {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.integr {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 18px 20px;
  transition: border-color 0.3s, transform 0.3s var(--ease);
}
.integr:hover { border-color: var(--accent); transform: translateY(-3px); }
.integr__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--accent); }
.integr__name { font-weight: 600; font-size: 15px; }
@media (max-width: 760px) { .integrations { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .integrations { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .ddash-live::before { animation: none; }
  .ddash .fill, .ddash .rf, .ddash .pf, .ddash-mbars i { transition: none; }
}
