/* Страница «Аналитика» */
.content:has(> .an) { max-width: 1480px; }
.an { --an-ink: #101828; --an-sub: #475467; --an-navy: #14306a; --an-sales: #2f6bff; --an-profit: #22b04b; --an-loss: #e5484d; color: var(--an-ink); }
.an .neg { color: #b42318; }
.an .pos { color: #1d7a3e; }

/* Шапка */
.an-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.an-title { display: flex; align-items: center; gap: 14px; margin-right: auto; }
.an-title .ico { color: #24324a; display: flex; }
.an-title h1 { font-size: 1.85rem; margin: 0; line-height: 1.1; }
.an-title .sub { color: var(--an-sub); margin-top: 3px; }

.an-range-box { position: relative; }
.an-range { display: inline-flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px;
  min-height: 44px; font: inherit; font-size: 1rem; color: var(--an-ink); cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; }
.an-range svg { color: #344054; flex: none; }
.an-range:hover { border-color: var(--line-strong); }
.an-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14); padding: 14px; display: grid; gap: 10px; min-width: 240px; }
.an-pop label { display: grid; gap: 4px; font-size: .86rem; color: var(--muted); font-weight: 500; }
.an-pop.hidden { display: none; }

.an-seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; }
.an-seg a { padding: 8px 18px; border-radius: 8px; color: #344054; font-weight: 500; white-space: nowrap; }
.an-seg a:hover { background: #f2f4f7; text-decoration: none; }
.an-seg a.on { background: var(--an-navy); color: #fff; font-weight: 600; }

.an-dl { width: 48px; height: 46px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  color: #24324a; cursor: pointer; box-shadow: var(--shadow); }
.an-dl:hover { background: #f5f7fa; }

/* Цветовые темы карточек */
.an .blue   { --tint-a: #f4f8ff; --tint-b: #e6eeff; --tint-line: #d5e1fb; --tint-ico: #dce7ff; --tint-fg: #2f6bff; }
.an .green  { --tint-a: #f1fcf4; --tint-b: #def5e6; --tint-line: #c9ecd5; --tint-ico: #d0f0db; --tint-fg: #179a45; }
.an .violet { --tint-a: #f9f5ff; --tint-b: #efe6fe; --tint-line: #e2d5fb; --tint-ico: #ebdffd; --tint-fg: #8b5cf6; }
.an .orange { --tint-a: #fffaf3; --tint-b: #fff0dd; --tint-line: #fbe2c2; --tint-ico: #ffe9cc; --tint-fg: #f08c00; }

/* KPI */
.an-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.an-kpi { display: flex; gap: 16px; padding: 18px; border-radius: 14px; border: 1px solid var(--tint-line);
  background: linear-gradient(135deg, var(--tint-a), var(--tint-b)); box-shadow: 0 2px 8px rgba(16, 24, 40, .06); min-width: 0; }
.an-kpi .ico, .an-gold .ico { width: 54px; height: 54px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--tint-ico); color: var(--tint-fg); }
.an-kpi .body { min-width: 0; flex: 1; }
.an-kpi .title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 1.02rem; }
.an-kpi .val { font-size: clamp(1.35rem, 1.75vw, 1.75rem); overflow: hidden; text-overflow: ellipsis; font-weight: 800; line-height: 1.25; margin: 4px 0 2px; white-space: nowrap; }
.an-kpi .sub { color: var(--an-sub); font-size: .9rem; }
.an-change { display: inline-flex; align-items: center; gap: 2px; font-size: .88rem; font-weight: 600; color: #15803d; background: #d3f2dc; border-radius: 6px; padding: 2px 7px; flex: none; }
.an-change.neg { color: #b42318; background: #fde2e1; }

/* Заголовок секции */
.an-sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.an-sec h2, .an-card-head h2 { display: flex; align-items: center; gap: 12px; font-size: 1.25rem; font-weight: 700; margin: 0; }
.an-sec h2 svg, .an-card-head h2 svg { color: #24324a; flex: none; }
.an-sec a, .an-card-head a { display: inline-flex; align-items: center; gap: 2px; color: #1d4ed8; font-weight: 600; font-size: .95rem; white-space: nowrap; }

/* Где товар */
.an-golds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.an-gold { position: relative; display: flex; gap: 16px; padding: 18px; border-radius: 14px; border: 1px solid var(--tint-line);
  background: linear-gradient(135deg, #fff 0%, var(--tint-a) 45%, var(--tint-b) 100%); box-shadow: 0 2px 8px rgba(16, 24, 40, .06); min-width: 0; }
.an-gold .ico { width: 46px; height: 46px; }
.an-gold .body { flex: 1; min-width: 0; padding-right: 84px; }
.an-gold .title b { font-weight: 700; }
.an-gold .title span { color: #344054; }
.an-gold .val { font-size: 1.75rem; font-weight: 800; margin: 6px 0 2px; line-height: 1.2; }
.an-gold .sub { color: var(--an-sub); font-size: .92rem; }
.an-gold .sub b { color: var(--an-ink); }
.an-gold .probes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.an-gold .probes span { background: rgba(255, 255, 255, .75); border: 1px solid var(--tint-line); border-radius: 6px; padding: 1px 8px; font-size: .8rem; color: #344054; }
.an-gold .decor { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); pointer-events: none; }

/* Карточки */
.an-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 8px rgba(16, 24, 40, .05); padding: 18px 20px; margin-bottom: 18px; min-width: 0; }
.an-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.an-card-head h2 .light { font-weight: 700; }
.an-two { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; }

/* График */
.an-legend { display: flex; gap: 18px; color: #344054; font-size: .93rem; }
.an-legend span { display: inline-flex; align-items: center; gap: 7px; }
.an-legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.an-legend i.sales { background: var(--an-sales); }
.an-legend i.profit { background: var(--an-profit); }
.an-two > .an-card { display: flex; flex-direction: column; }
.an-chart-wrap { position: relative; margin: auto 0; }
.an-chart { width: 100%; height: auto; display: block; overflow: visible; }
.an-chart .grid { stroke: #e7eaf0; stroke-width: 1; }
.an-chart .grid.zero { stroke: #b8c0cc; }
.an-chart .ylab, .an-chart .xlab { fill: #475467; font-size: 12px; font-family: inherit; }
.an-chart .b-sales { fill: var(--an-sales); }
.an-chart .b-profit { fill: var(--an-profit); }
.an-chart .b-loss { fill: var(--an-loss); }
.an-chart .hit { fill: transparent; }
.an-chart .col:hover .hit { fill: rgba(47, 107, 255, .06); }
.an-chart-empty { position: absolute; inset: 0 0 30px 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: #344054; pointer-events: none; }
.an-chart-empty svg { color: #b4bfd3; }

/* Кольцо */
.an-donut { display: flex; align-items: center; gap: 24px; min-height: 220px; }
.an-donut .ring { position: relative; flex: none; width: 160px; height: 160px; }
.an-donut .ring svg { display: block; }
.an-donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #344054; font-size: .9rem; }
.an-donut .center b { font-size: 1.1rem; color: var(--an-ink); }
.an-donut .legend { flex: 1; min-width: 0; display: block; margin: 0; }
.an-donut .lg-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eef0f4; }
.an-donut .lg-row:last-child { border-bottom: 0; }
.an-donut .lg-row i { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.an-donut .lg-row .name { flex: 1; min-width: 0; }
.an-donut .lg-row b { white-space: nowrap; }
.an-donut .lg-row .pct { background: #f2f4f7; border-radius: 6px; padding: 1px 8px; font-size: .85rem; color: #344054; min-width: 46px; text-align: center; }

/* Таблица «Что продаётся» */
.an-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.an-table table.t th { background: #f4f6f9; color: #344054; text-transform: none; letter-spacing: 0; font-size: .92rem; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.an-table table.t td { padding: 10px 14px; }
.an-table table.t .n { width: 48px; color: var(--muted); }
.an-table .table-wrap { margin: 0; }
.an-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 10px 6px; color: #8a96a8; }
.an-empty b { color: #24324a; font-weight: 500; font-size: 1.05rem; }
.an-note { color: var(--an-sub); font-size: .85rem; text-align: center; margin: 10px 14px 14px; }

/* Подробно по периодам */
.an-details summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; align-items: center; gap: 8px; }
.an-details summary::-webkit-details-marker { display: none; }
.an-details summary svg { transition: transform .15s; color: #475467; }
.an-details[open] summary { margin-bottom: 12px; }
.an-details[open] summary svg { transform: rotate(90deg); }
.an-details .an-note { text-align: left; margin: 10px 0 0; }

/* Адаптив */
@media (max-width: 1250px) { .an-kpi { gap: 12px; padding: 16px; } .an-kpi .ico { width: 46px; height: 46px; } }
@media (max-width: 1400px) { .an-donut { flex-direction: column; align-items: stretch; gap: 14px; } .an-donut .ring { align-self: center; } }
@media (max-width: 1100px) {
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-two { grid-template-columns: 1fr; }
}
@media (max-width: 1050px) { .an-golds { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .an-title { width: 100%; }
  .an-title h1 { font-size: 1.5rem; }
  .an-seg { order: 3; width: 100%; }
  .an-seg a { flex: 1; text-align: center; padding: 8px 10px; }
  .an-range-box { flex: 1; }
  .an-range { width: 100%; justify-content: space-between; }
  .an-kpi .val, .an-gold .val { font-size: 1.45rem; }
  .an-donut { flex-direction: column; align-items: stretch; }
  .an-donut .ring { align-self: center; }
  .an-card { padding: 14px; }
  .an-table { border: 0; overflow: visible; }
  .an-table table.t.stack td.n { display: none; }
  .an-chart .ylab, .an-chart .xlab { font-size: 16px; }
}
@media (max-width: 520px) {
  .an-kpis { grid-template-columns: 1fr; }
  .an-gold .body { padding-right: 0; }
  .an-gold .decor { display: none; }
}

/* ---- Спокойный вид (18.11): белые карточки, цветная полоска сверху, без тяжёлых шрифтов ---- */
.an-kpi, .an-gold { background: #fff !important; border: 1px solid var(--line) !important; border-top: 3px solid var(--tint-fg) !important; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.an-kpi { padding: 16px 18px; gap: 14px; align-items: flex-start; }
.an-kpi .ico { width: 42px; height: 42px; border-radius: 10px; }
.an-kpi .title { font-weight: 500; font-size: .92rem; color: var(--an-sub); }
.an-kpi .val { font-size: clamp(1.25rem, 1.5vw, 1.55rem); font-weight: 700; margin: 4px 0 2px; }
.an-kpi .sub { font-size: .84rem; }
.an-gold { padding: 16px 18px; gap: 14px; align-items: flex-start; }
.an-gold .ico { width: 40px; height: 40px; border-radius: 10px; }
.an-gold .body { padding-right: 52px; }
.an-gold .title b { font-weight: 600; font-size: 1rem; }
.an-gold .title small { display: block; color: var(--an-sub); font-size: .82rem; margin-top: 1px; }
.an-gold .val { font-size: 1.55rem; font-weight: 700; margin: 8px 0 2px; }
.an-gold .sub { font-size: .86rem; }
.an-gold .probes span { background: var(--c-gray-bg); border: 0; border-radius: 999px; padding: 2px 9px; }
.an-gold .decor { top: 16px; right: 16px; transform: scale(.6); transform-origin: top right; opacity: .35; }
.an-sec h2 { font-size: 1.15rem; font-weight: 600; }
.an-title h1 { font-size: 1.6rem; }
.an-card-head h2 { font-size: 1.12rem; font-weight: 600; }
.an-card { box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }

/* Подробно по месяцам: компактно, без горизонтальной прокрутки */
.an-month th { white-space: nowrap; vertical-align: bottom; }
.an-month th small { display: block; font-size: .72rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.an-month td { padding-top: 9px; padding-bottom: 9px; white-space: nowrap; }
.an-month td small { display: block; color: var(--muted); font-size: .78rem; margin-top: 1px; }
.an-zero { color: #c3c9d4; }
