@font-face { font-family: Onest; src: url("/assets/onest-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Onest; src: url("/assets/onest-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Onest; src: url("/assets/onest-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --blue: #145de8;
  --blue-deep: #0d48ba;
  --blue-black: #071c42;
  --forest: #145de8;
  --forest-soft: #0d48ba;
  --ice: #e7efff;
  --pearl: #f7f8fb;
  --white: #fff;
  --ink: #17211d;
  --muted: #6d7771;
  --line: #d9ddd6;
  --green: #0a8c62;
  --red: #c4473a;
  --amber: #b86e08;
  --shadow: 0 14px 42px rgba(24, 38, 31, .08);
  --radius: 18px;
  --rail-width: 226px;
  --table-text-size: 12px;
  --table-head-size: 11px;
  --table-meta-size: 9px;
  --control-text-size: 10px;
}

* { box-sizing: border-box; }
html { background: var(--pearl); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(rgba(20,93,232,.026) 1px, transparent 1px),
    linear-gradient(90deg,rgba(20,93,232,.026) 1px, transparent 1px),
    var(--pearl);
  background-size: 28px 28px;
  font-family: Onest, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}
button, input { font: inherit; }
button { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(247,248,246,.9);
  backdrop-filter: blur(18px);
}
.wordmark {
  position: relative;
  justify-self: start;
  color: var(--ink);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -.075em;
  line-height: 1;
  text-decoration: none;
}
.wordmark span:nth-child(2) { color: var(--blue); }
.wordmark small {
  position: absolute;
  top: 28px;
  left: 1px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.tabs { display: flex; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.tab {
  padding: 9px 19px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: .2s ease;
}
.tab:hover { color: var(--blue); }
.tab.is-active { color: var(--white); background: var(--blue); }
.refresh {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.refresh span:first-child { color: var(--blue); font-size: 18px; line-height: 1; }
.refresh.is-loading span:first-child { animation: spin .8s linear infinite; }
.refresh:disabled { cursor: default; opacity: .65; }

main { width: min(1480px, calc(100% - clamp(24px, 5vw, 80px))); margin: 0 auto; padding: 40px 0 80px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow {
  margin: 0 0 13px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
}
.intro h1 { margin: 0; font-size: clamp(34px, 4.3vw, 66px); font-weight: 300; letter-spacing: -.065em; line-height: .95; }
.intro h1::first-letter { color: var(--blue); }
.intro > div > p:last-child { margin: 13px 0 0; color: var(--muted); font-size: 13px; }
.status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(98,197,132,.15); }
.status.is-red i { background: var(--red); box-shadow: 0 0 0 5px rgba(217,80,80,.14); }
.status.is-amber i { background: var(--amber); box-shadow: 0 0 0 5px rgba(214,151,47,.15); }

.filters {
  position: sticky;
  top: 84px;
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(540px, 2fr) minmax(170px, .85fr) minmax(170px, .85fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(3,81,193,.12);
  border-radius: var(--radius);
  background: rgba(255,255,255,.93);
  box-shadow: 0 12px 35px rgba(6,18,38,.05);
  backdrop-filter: blur(16px);
}
.filters[hidden] { display: none; }
.filter-group label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 31px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pearl);
  cursor: pointer;
  font-size: 12px;
  transition: .18s ease;
}
.chip:hover { border-color: rgba(3,81,193,.45); color: var(--blue); }
.chip.is-active { border-color: var(--blue); color: var(--white); background: var(--blue); }
.chip.is-preview:not(.is-active)::after { content: "·"; margin-left: 5px; color: var(--amber); }
.period-control-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.period-mode { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 6px; }
.period-value { display: none; }
.period-value.is-active { display: block; }
.period-value select,
.period-range input {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--pearl);
  font: inherit;
}
.period-value select { width: 100%; padding: 6px 34px 6px 10px; }
.period-range.is-active { display: flex; align-items: center; gap: 7px; min-width: 0; }
.filter-group .period-range label { display: flex; align-items: center; gap: 5px; margin: 0; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.period-range input { display: block; width: 121px; margin: 0; padding: 5px 7px; }
.period-range input[aria-invalid="true"] { border-color: var(--red); }
.month-picker-popover {
  position: fixed;
  inset: var(--month-picker-top) auto var(--month-picker-bottom, auto) var(--month-picker-left);
  width: var(--month-picker-width, min(420px, calc(100vw - 24px)));
  max-height: var(--month-picker-max-height, calc(100vh - 24px));
  overflow-y: auto;
  margin: 0;
  padding: 13px;
  border: 1px solid rgba(3,81,193,.18);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 18px 46px rgba(6,18,38,.18);
}
.month-picker-popover::backdrop { background: transparent; }
.month-picker-popover__head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; }
.month-picker-popover__head span { color: var(--muted); }
.reset {
  min-height: 35px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  color: var(--blue);
  background: var(--ice);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  position: relative;
  min-height: 145px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.94);
  box-shadow: 0 7px 25px rgba(6,18,38,.035);
  transition: transform .2s ease, box-shadow .2s ease;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kpi::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; content: ""; background: var(--blue); }
.kpi.is-green::before { background: var(--green); }
.kpi.is-red::before { background: var(--red); }
.kpi.is-amber::before { background: var(--amber); }
.kpi__label { min-height: 34px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.kpi__value { margin: 14px 0 7px; font-size: 28px; font-weight: 600; letter-spacing: -.035em; line-height: 1.2; white-space: nowrap; }
.kpi__sub { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

.tax-card {
  display: grid;
  grid-template-columns: 1.1fr repeat(3, 1fr);
  gap: 0;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--blue-black);
}
.tax-card:not([open]) { grid-template-columns: 1fr; }
.tax-card__intro, .tax-card__metric { padding: 20px 22px; }
.tax-card__intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  cursor: pointer;
  list-style: none;
}
.tax-card__intro::-webkit-details-marker { display: none; }
.tax-card__action {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  color: rgba(255,255,255,.85);
  font-size: 11px;
}
.tax-card__action::after { content: "Скрыть"; }
.tax-card:not([open]) .tax-card__action::after { content: "Раскрыть"; }
.tax-card__intro p, .tax-card__metric p { margin: 0 0 8px; color: rgba(255,255,255,.68); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.tax-card__intro h2 { margin: 0; font-size: 19px; font-weight: 400; }
.tax-card__metric { border-left: 1px solid rgba(255,255,255,.12); }
.tax-card__metric strong { display: block; margin-bottom: 6px; font-size: clamp(19px,2vw,27px); font-weight: 500; letter-spacing: -.04em; }
.tax-card__metric small { color: rgba(255,255,255,.55); font-size: 11px; }
.tax-card__metric.is-good strong { color: #8ee4ab; }
.tax-card__metric.is-alert strong { color: #ffd28a; }

.ai-launch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 16px 20px;
  border: 1px solid rgba(3,81,193,.2);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(3,81,193,.09), rgba(255,255,255,.96) 48%);
}
.ai-launch p { margin: 0 0 4px; color: var(--blue); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.ai-launch h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.ai-launch span { color: var(--muted); font-size: 12px; }
.ai-launch button {
  flex: 0 0 auto;
  padding: 10px 16px;
  border: 0;
  border-radius: 9px;
  background: var(--blue);
  color: var(--white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.ai-launch button:hover { background: var(--blue-deep); }
.ai-launch button:disabled { cursor: wait; opacity: .55; }
.ai-card {
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid rgba(3,81,193,.28);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}
.ai-card.is-error { border-color: rgba(217,80,80,.35); border-left-color: var(--red); }
.ai-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
}
.ai-card__head button { padding: 0 5px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 22px; }
.ai-card__body { padding: 18px; font-size: 14px; line-height: 1.7; }
.ai-card__body h2, .ai-card__body h3, .ai-card__body h4 { margin: 14px 0 5px; line-height: 1.35; }
.ai-card__body h2 { font-size: 17px; }
.ai-card__body h3 { color: var(--blue); font-size: 16px; }
.ai-card__body h4 { font-size: 15px; }

.ai-methodology { display: grid; gap: 18px; }
.ai-methodology__hero {
  display: grid;
  grid-template-columns: minmax(0,1.6fr) minmax(240px,.7fr);
  gap: 24px;
  align-items: end;
  padding: 25px 28px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg,#123f83,#1851a6);
  box-shadow: 0 14px 34px rgba(18,63,131,.16);
}

.ai-methodology__hero > div {
  min-width: 0;
}

.ai-methodology__hero h2,
.ai-methodology__hero strong {
  overflow-wrap: anywhere;
}
.ai-methodology__hero p { margin: 0 0 7px; color: #b9d2ff; font-size: 9px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.ai-methodology__hero h2 { margin: 0 0 7px; font-size: 25px; font-weight: 500; letter-spacing: -.035em; }
.ai-methodology__hero span { color: rgba(255,255,255,.72); font-size: 11px; }
.ai-methodology__hero > div:last-child { padding: 14px 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(255,255,255,.07); }
.ai-methodology__hero small { display: block; margin-bottom: 5px; color: #b9d2ff; font-size: 9px; text-transform: uppercase; }
.ai-methodology__hero strong { display: block; font-size: 11px; font-weight: 500; }
.ai-methodology__grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(280px,.75fr); gap: 18px; align-items: start; }
.ai-methodology__editor form { display: grid; gap: 13px; padding: 16px 18px 0; }
.ai-methodology__editor label { display: grid; gap: 6px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.ai-methodology__editor input,
.ai-methodology__editor textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  line-height: 1.5;
  outline: 0;
  resize: vertical;
  text-transform: none;
  letter-spacing: 0;
}
.ai-methodology__editor textarea { min-height: 116px; }
.ai-methodology__editor textarea[name="examples"] { min-height: 145px; }
.ai-methodology__editor input:focus,
.ai-methodology__editor textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,93,232,.1); }
.ai-methodology__save { display: grid; grid-template-columns: minmax(220px,1fr) auto; gap: 12px; align-items: end; }
.ai-methodology__save button,
.ai-methodology__test button,
.ai-methodology__history button {
  min-height: 38px;
  padding: 8px 13px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}
.ai-methodology__save button:disabled,
.ai-methodology__test button:disabled,
.ai-methodology__history button:disabled { cursor: wait; opacity: .55; }
.ai-methodology__status { min-height: 30px; padding: 8px 18px 0; color: var(--green); font-size: 11px; }
.ai-methodology__status.is-error { color: var(--red); }
.ai-methodology__side { display: grid; gap: 18px; }
.ai-methodology__test > p { margin: 14px 18px 13px; color: var(--muted); font-size: 11px; }
.ai-methodology__test > div:last-child { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 18px 17px; }
.ai-methodology__guide ol { display: grid; gap: 9px; margin: 14px 18px 18px; padding-left: 19px; color: var(--muted); font-size: 11px; }
.ai-methodology__history td:first-child strong,
.ai-methodology__history td:first-child small { display: block; }
.ai-methodology__history td:first-child small { max-width: 680px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ai-methodology__history button { min-height: 30px; padding: 5px 9px; background: var(--blue-deep); }
.ai-methodology__active { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--green); background: rgba(10,140,98,.1); font-size: 9px; font-weight: 600; }

.grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; margin-bottom: 18px; }
.grid.is-equal { grid-template-columns: 1fr 1fr; }
.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.94);
  box-shadow: 0 7px 25px rgba(6,18,38,.035);
}
.chart-panel:not(.grid .chart-panel) { margin-bottom: 18px; }
.panel__head { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding: 19px 21px 4px; }
.panel__head p { margin: 0 0 6px; color: var(--blue); font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.panel__head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel__note { color: var(--muted); font-size: 11px; text-align: right; }
.panel__tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.panel-collapse {
  min-height: 29px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--white);
  cursor: pointer;
  font: 500 10px/1 Onest, sans-serif;
}
.panel-collapse:hover { color: var(--blue); border-color: rgba(20,93,232,.35); background: var(--ice); }
.panel.is-collapsed { align-self: start; }
.panel.is-collapsed .chart-wrap,
.panel.is-collapsed .collapsible-body { display: none; }
.panel.is-collapsed .panel__head { border-bottom: 0; }
.chart-segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pearl);
}
.chart-segmented button {
  min-height: 27px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 500 11px/1 Roboto, sans-serif;
  transition: .18s ease;
}
.chart-segmented button:hover { color: var(--blue); }
.chart-segmented button.is-active {
  color: var(--white);
  background: var(--blue);
  box-shadow: 0 3px 10px rgba(3,81,193,.24);
}
.chart-wrap { position: relative; height: 330px; padding: 12px 16px 18px; }
.chart-panel.is-compact .chart-wrap { height: 330px; }

.toolbar { display: flex; align-items: center; gap: 10px; }
.search {
  width: min(330px, 50vw);
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  background: var(--pearl);
  font-size: 13px;
}
.search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(3,81,193,.08); }
.table-scroll { max-height: 520px; overflow: auto; margin-top: 12px; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--ice);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .07em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; }
td { padding: 10px 13px; border-bottom: 1px solid rgba(16,19,24,.07); text-align: right; white-space: nowrap; }
tbody tr:nth-child(even) { background: rgba(247,248,246,.65); }
tbody tr:hover { background: var(--ice); }
.cell-main { display: block; max-width: 330px; overflow: hidden; font-weight: 500; text-overflow: ellipsis; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.positive { color: #278d4a; }
.negative { color: var(--red); }
.abc { display: inline-grid; place-items: center; min-width: 30px; padding: 4px 7px; border-radius: 999px; font-weight: 600; }
.abc-a { color: #237b42; background: rgba(98,197,132,.18); }
.abc-b { color: #956211; background: rgba(214,151,47,.18); }
.abc-c { color: #a43131; background: rgba(217,80,80,.14); }
.incomplete { color: var(--amber); }

.abc-panel { margin-bottom: 18px; }
.abc-actions { display: flex; align-items: center; gap: 10px; }
.abc-actions span { color: var(--muted); font-size: 12px; }
.abc-actions button {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  font-size: 12px;
}
.abc-actions button.is-active { border-color: var(--blue); color: var(--white); background: var(--blue); }
.abc-grid {
  display: grid;
  grid-template-columns: 105px repeat(3, minmax(170px, 1fr));
  gap: 7px;
  min-width: 720px;
  padding: 14px 20px 20px;
  overflow-x: auto;
}
.abc-axis {
  display: grid;
  min-height: 34px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.abc-cell {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: .15s ease;
}
.abc-cell:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(6,18,38,.08); }
.abc-cell.is-active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(3,81,193,.12); }
.abc-cell strong { grid-row: span 2; align-self: center; font-size: 19px; }
.abc-cell span { font-size: 12px; font-weight: 600; }
.abc-cell small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.abc-level-a { background: rgba(98,197,132,.13); }
.abc-level-b { background: rgba(214,151,47,.13); }
.abc-level-c { background: rgba(217,80,80,.10); }

/* ПиУ — полноразмерная финансовая форма в логике исходного дашборда Lunari */
.revenue-table { max-height: 330px; }
.pnl-report { margin: 18px 0 24px; }
.pnl-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
}
.pnl-toolbar p {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.pnl-toolbar h2 { margin: 0; font-size: 14px; font-weight: 500; }
.pnl-toolbar__actions {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-self: center;
  flex-wrap: wrap;
  gap: 7px;
}
.pnl-toolbar__spacer { grid-column: 3; }
.pnl-toolbar button {
  min-height: 29px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: .15s ease;
}
.pnl-toolbar button:hover { border-color: rgba(3,81,193,.35); color: var(--blue); background: var(--ice); }
.pnl-toolbar button.is-active { border-color: var(--blue); color: var(--white); background: var(--blue); }
.pnl-toolbar__period {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pearl);
}
.pnl-toolbar__period button {
  min-height: 25px;
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}
.pnl-weekly-note {
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--ice);
  color: var(--muted);
  font-size: 10.5px;
}
.pnl-table-scroll {
  max-height: min(72vh, 860px);
  overflow: auto;
  scrollbar-gutter: stable;
}
.pnl-table {
  width: 100%;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.pnl-table th {
  top: 0;
  z-index: 4;
  min-width: 112px;
  padding: 10px 12px;
  background: #eef3f9;
  cursor: default;
  font-size: 11px;
  letter-spacing: .04em;
  text-align: right;
}
.pnl-table th:first-child {
  left: 0;
  z-index: 6;
  min-width: 330px;
  text-align: left;
}
.pnl-table td {
  height: 36px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(16,19,24,.07);
}
.pnl-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 330px;
  max-width: 430px;
  overflow: hidden;
  background: #fff;
  text-align: left;
  text-overflow: ellipsis;
}
.pnl-table tbody tr:nth-child(even) { background: transparent; }
.pnl-table tbody tr[data-expand-row] { cursor: pointer; user-select: none; }
.pnl-table tbody tr:hover,
.pnl-table tbody tr:hover td:first-child { background: #e8eef6; }
.pnl-table .pnl-num { min-width: 112px; text-align: right; }
.pnl-value-wrap { display: inline-block; }
.pnl-value-wrap[data-change] { position: relative; }
.pnl-value-wrap[data-change]::before {
  content: attr(data-change);
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 12;
  width: max-content;
  max-width: 210px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--ink);
  box-shadow: 0 5px 16px rgba(16,19,24,.18);
  color: var(--white);
  opacity: 0;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.25;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity .12s ease, transform .12s ease;
  white-space: normal;
}
.pnl-num:hover .pnl-value-wrap[data-change]::before {
  opacity: 1;
  transform: translateY(0);
}
.pnl-value-wrap[data-share]::after {
  content: attr(data-share);
  display: block;
  margin-top: 2px;
  color: var(--muted);
  opacity: 1;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.1;
  pointer-events: none;
  transition: opacity .12s ease;
  white-space: nowrap;
}
.pnl-shares-hover-only .pnl-value-wrap[data-share]::after,
.pnl-shares-hidden .pnl-value-wrap[data-share]::after { opacity: 0; }
.pnl-shares-hover-only:hover .pnl-value-wrap[data-share]::after,
.pnl-shares-hidden tr:hover .pnl-value-wrap[data-share]::after { opacity: 1; }
.pnl-table tbody tr:hover .cell-down { color: var(--red); font-weight: 600; }
.pnl-table tbody tr:hover .cell-up { color: #278d4a; font-weight: 600; }
.pnl-table tbody tr:hover .cell-down .pnl-value-wrap[data-share]::after { color: var(--red); }
.pnl-table tbody tr:hover .cell-up .pnl-value-wrap[data-share]::after { color: #278d4a; }
.pnl-row-top { font-weight: 600; }
.pnl-row-top.pnl-income > td { background: rgba(98,197,132,.10); }
.pnl-row-top.pnl-expense > td { background: rgba(217,80,80,.08); }
.pnl-row-top.pnl-income:hover > td { background: rgba(98,197,132,.18); }
.pnl-row-top.pnl-expense:hover > td { background: rgba(217,80,80,.15); }
.pnl-table tr[data-code^="tax_revenue_ref_"] > td,
.pnl-table tr[data-code^="op_margin_reference"] > td {
  background: #f1f3f5;
  font-size: 9.5px;
}
.pnl-table tr[data-code^="tax_revenue_ref_"]:hover > td,
.pnl-table tr[data-code^="op_margin_reference"]:hover > td { background: #e4e7eb; }
.pnl-placeholder { color: #a0a6af; }
.pnl-depth-1 td:first-child { padding-left: 29px; }
.pnl-depth-2 td:first-child { padding-left: 49px; font-size: 11px; }
.pnl-depth-3 td:first-child { padding-left: 69px; font-size: 11px; }
.pnl-toggle,
.pnl-toggle-spacer {
  display: inline-grid;
  width: 17px;
  height: 17px;
  margin-right: 4px;
  place-items: center;
  vertical-align: -2px;
}
.pnl-toggle {
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #7d8793;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}
.pnl-toggle:hover { color: var(--blue); background: rgba(3,81,193,.08); }

.loading, .error {
  display: grid;
  place-items: center;
  min-height: 420px;
  color: var(--muted);
  font-size: 13px;
}
.loading i { width: 28px; height: 28px; margin-bottom: 12px; border: 2px solid var(--ice); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.error { color: var(--red); }
.load-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.load-summary .kpi { min-height: 126px; }
.load-tabs {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  gap: 5px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}
.load-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.load-tab:hover { color: var(--blue); }
.load-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.load-tab.is-active { color: var(--white); background: var(--blue); }
.load-panel .panel__head { align-items: center; }
.load-run {
  padding: 10px 16px;
  border: 0;
  border-radius: 9px;
  color: var(--white);
  background: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.load-run:hover { background: var(--blue-deep); }
.load-run:disabled { cursor: wait; opacity: .55; }
.load-table th, .load-table td { cursor: default; white-space: nowrap; }
.load-table .load-error { max-width: 430px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.weekly-load-table th:not(:first-child), .weekly-load-table td:not(:first-child) { text-align: center; }
.weekly-load-table tr.is-expected { background: rgba(217,80,80,.07); }
.weekly-load-table tr.is-expected:hover { background: rgba(217,80,80,.12); }
.weekly-load-table .load-note { color: var(--muted); font-size: 12px; }
.weekly-load-table a { color: var(--blue); font-size: 12px; font-weight: 600; }
.load-state { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.load-state.is-ok { color: #1d743a; background: rgba(98,197,132,.18); }
.load-state.is-partial { color: #8b5a0d; background: rgba(214,151,47,.17); }
.load-state.is-error { color: #a92f2f; background: rgba(217,80,80,.14); }
.load-state.is-missing { color: #a92f2f; background: rgba(217,80,80,.14); }
.load-state.is-not_configured { color: #8b5a0d; background: rgba(214,151,47,.17); }
.load-state.is-requires_jam { color: #8b5a0d; background: rgba(214,151,47,.17); }
.load-state.is-running { color: var(--blue); background: var(--ice); }
.load-state.is-processing { color: var(--blue); background: var(--ice); }
.load-state.is-active { color: #1d743a; background: rgba(98,197,132,.18); }
.load-state.is-archived { color: #59616b; background: rgba(139,146,156,.14); }
.load-state.is-history { color: #59616b; background: rgba(139,146,156,.14); }
.load-state.is-replaced { color: #8b5a0d; background: rgba(214,151,47,.17); }
.finance-upload-panel { margin-bottom: 18px; }
.manual-upload {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 0 20px 20px;
}
.manual-upload__file {
  min-width: 0;
  padding: 11px 13px;
  overflow: hidden;
  border: 1px dashed #b7c2d0;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manual-upload__file:hover { border-color: var(--blue); color: var(--blue); }
.manual-upload__file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.manual-upload__template { color: var(--blue); font-size: 12px; font-weight: 600; white-space: nowrap; }
.manual-upload > small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.input-history-panel { overflow: hidden; }
.input-history-scroll { max-height: 580px; }
.input-history-table { border-collapse: separate; border-spacing: 0; }
.input-history-table th, .input-history-table td { min-width: 150px; text-align: right; }
.input-history-table th:first-child, .input-history-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  text-align: left;
  white-space: normal;
  background: var(--white);
}
.input-history-table thead th:first-child { z-index: 4; }
.input-history-table td:first-child strong,
.input-history-table td:first-child small,
.input-version time,
.input-version small,
.input-version em { display: block; }
.input-history-table td:first-child strong { font-size: 12px; font-weight: 600; }
.input-history-table td:first-child small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.input-version time { color: var(--ink); font-size: 11px; }
.input-version small { margin: 3px 0 6px; color: var(--muted); font-weight: 400; }
.input-version a { display: block; margin-top: 6px; color: var(--blue); font-size: 10px; }
.input-version em { max-width: 150px; margin-top: 5px; overflow: hidden; color: var(--red); font-size: 9px; font-style: normal; text-overflow: ellipsis; }
.input-history-table .is-current { background: rgba(98,197,132,.08); }
.input-history-table tr.is-excluded td { color: var(--muted); background-image: linear-gradient(rgba(139,146,156,.04), rgba(139,146,156,.04)); }
.input-history-empty { min-height: 180px; }
.cost-upload { grid-template-columns: 180px minmax(260px,1fr) auto auto; }
.cost-effective-date { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.cost-effective-date input,
.cost-catalog-toolbar input[type="search"],
.cost-manual-input {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
}
.cost-effective-date input { min-height: 39px; }
.cost-readonly { padding: 0 20px 20px; color: var(--muted); font-size: 12px; }
.cost-readonly a { color: var(--blue); font-weight: 600; }
.cost-catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(240px,1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 0 20px 16px;
}
.cost-catalog-toolbar > label:first-child { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.cost-missing-filter { align-self: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.cost-catalog-table th, .cost-catalog-table td { min-width: 125px; }
.cost-catalog-table th:first-child, .cost-catalog-table td:first-child {
  width: 340px;
  min-width: 340px;
  max-width: 340px;
}
.cost-catalog-table tr.is-missing td { background-color: rgba(217,80,80,.09); }
.cost-catalog-table tr.is-missing td:first-child { background-color: #fff3f3; }
.cost-catalog-table tr.is-missing .cost-current-value { color: var(--red); }
.cost-catalog-table tr.is-unmatched:not(.is-missing) td { background-color: rgba(214,151,47,.08); }
.cost-mapping-warning { color: #835604; font-weight: 700; }
.cost-catalog-table tr[hidden] { display: none; }
.cost-manual-input { width: 112px; text-align: right; }
.cost-manual-input:focus { border-color: var(--blue); outline: 2px solid rgba(20,93,232,.12); }
.ozon-input-note {
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid rgba(3,81,193,.16);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  color: var(--muted);
  background: var(--ice);
  font-size: 12px;
  line-height: 1.5;
}
.ozon-input-note strong { color: var(--ink); }
.ozon-input-table th:first-child, .ozon-input-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  background: var(--white);
  white-space: normal;
}
.ozon-input-table thead th:first-child { z-index: 4; background: var(--ice); }
.ozon-input-table tr.is-current td { background-color: rgba(98,197,132,.08); }
.ozon-input-table td:first-child strong, .ozon-input-table td:first-child small { display: block; }
.ozon-input-table td:first-child small, .ozon-input-table td:nth-child(4) small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
.ozon-input-table a { color: var(--blue); font-size: 11px; font-weight: 600; }
.ozon-input-error { color: var(--red) !important; }
.ozon-event {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.ozon-event.is-writeoff { color: #a92f2f; background: rgba(217,80,80,.14); }
.ozon-event.is-restock { color: #1d743a; background: rgba(98,197,132,.18); }
.ozon-event.is-compensation { color: #1d743a; background: rgba(98,197,132,.18); }
.ozon-event.is-decompensation { color: #a92f2f; background: rgba(217,80,80,.14); }

.sales-plan {
  overflow: hidden;
  border: 1px solid rgba(3,81,193,.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,.97);
  box-shadow: var(--shadow);
}
.sales-plan__body p {
  margin: 0 0 7px;
  color: #78aef7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.sales-plan__body { display: grid; gap: 18px; padding: 20px; }
.sales-plan__chart, .sales-plan__scenarios { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.sales-plan__body h3 { margin: 0; font-size: 15px; }
.sales-plan__chart > div:last-child { position: relative; height: 275px; padding-top: 16px; }
.sales-plan__pnl { grid-column: 1 / -1; }
.sales-plan__pnl .table-scroll { max-height: none; }
.sales-plan__scenarios { border-color: rgba(3,81,193,.22); background: color-mix(in srgb,var(--ice) 42%,var(--white)); }
.sales-plan__scenarios-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.sales-plan__baseline { flex: 0 0 auto; min-width: 280px; padding: 12px 14px; border: 1px solid rgba(3,81,193,.18); border-radius: 11px; background: var(--white); text-align: right; }
.sales-plan__baseline > span { display: block; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.sales-plan__baseline > strong { display: block; margin-top: 4px; color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; }
.sales-plan__baseline small { display: flex; justify-content: flex-end; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.sales-plan__baseline small span { display: inline-flex; gap: 4px; }
.sales-plan__baseline-margin { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; gap: 3px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); text-align: left; }
.sales-plan__baseline-margin > span { color: var(--muted); font-size: 9px; font-weight: 650; }
.sales-plan__baseline-margin > strong { color: var(--green); font-size: 17px; font-variant-numeric: tabular-nums; }
.sales-plan__baseline-margin > em { grid-column: 1 / -1; color: var(--muted); font-size: 9px; font-style: normal; }
.sales-plan__scenario-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 16px; }
.sales-plan__scenario-card { overflow: hidden; border: 1px solid rgba(3,81,193,.17); border-radius: 12px; background: var(--white); }
.sales-plan__scenario-card > header { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 15px 16px 12px; }
.sales-plan__scenario-card > header span { color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.sales-plan__scenario-card h4 { margin: 3px 0 0; color: var(--ink); font-size: 18px; }
.sales-plan__scenario-card > header > strong { color: var(--blue); font-size: 22px; font-variant-numeric: tabular-nums; }
.sales-plan__scenario-gap { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: baseline; gap: 9px; padding: 11px 16px; background: var(--ice); }
.sales-plan__scenario-gap > span { color: var(--muted); font-size: 10px; font-weight: 600; }
.sales-plan__scenario-gap > strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.sales-plan__scenario-gap > small { color: var(--muted); font-size: 10px; font-weight: 650; }
.sales-plan__scenario-margin, .sales-plan__scenario-forecast { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; gap: 5px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.sales-plan__scenario-margin { background: rgba(10,140,98,.045); }
.sales-plan__scenario-margin > span, .sales-plan__scenario-forecast > span { color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.sales-plan__scenario-margin > strong, .sales-plan__scenario-forecast > strong { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.sales-plan__scenario-margin > strong { color: var(--green); }
.sales-plan__scenario-margin > small, .sales-plan__scenario-forecast > small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.sales-plan__scenario-margin > small b, .sales-plan__scenario-forecast > small b { font-weight: 700; }
.sales-plan__scenario-card dl { margin: 0; }
.sales-plan__scenario-card dl > div { display: grid; grid-template-columns: 72px minmax(0,1fr); align-items: center; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--line); }
.sales-plan__scenario-card dt { color: var(--ink); font-size: 11px; font-weight: 700; }
.sales-plan__scenario-card dd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; }
.sales-plan__scenario-card dd strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.sales-plan__scenario-card dd span { color: var(--muted); font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.sales-plan__scenario-card .is-up { color: var(--green); }
.sales-plan__scenario-card .is-down { color: var(--red); }
.sales-plan__method { margin: 0; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--muted); background: var(--pearl); font-size: 11px; line-height: 1.55; }
.sales-plan__method strong { color: var(--ink); }
.plan-opex__forms { display: grid; grid-template-columns: 1.45fr .75fr; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.plan-opex__forms form { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.plan-opex__forms label { display: grid; flex: 1 1 120px; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.plan-opex__forms input, .plan-opex__forms select {
  width: 100%; min-height: 34px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); background: var(--white); font: 500 10px Onest, sans-serif;
}
.plan-opex__forms button { min-height: 34px; padding: 7px 12px; border: 0; border-radius: 8px; color: #fff; background: var(--blue); cursor: pointer; font-size: 10px; font-weight: 600; }
.plan-opex__forms button:disabled { cursor: wait; opacity: .55; }
.plan-opex__forms a { align-self: center; color: var(--blue); font-size: 10px; }
.plan-opex__status { min-height: 0; padding: 0 18px; color: var(--green); font-size: 10px; }
.plan-opex__status:not(:empty) { padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.plan-opex__status.is-error { color: var(--red); }
.plan-opex > h3 { margin: 15px 18px 4px; font-size: 14px; }
.plan-opex > h3 + .panel__note { margin: 0 18px 10px; text-align: left; }
.plan-view-tabs, .fact-comparison-toolbar { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:14px 20px; border-bottom:1px solid var(--line); background:var(--pearl); }
.plan-view-tabs > div, .fact-comparison-toolbar > div { display:flex; gap:6px; }
.plan-view-tabs button, .fact-comparison-toolbar button { min-height:34px; padding:7px 14px; border:1px solid var(--line); border-radius:9px; color:var(--muted); background:var(--white); cursor:pointer; font:600 11px/1 inherit; }
.plan-view-tabs button.is-active, .fact-comparison-toolbar button.is-active { color:#fff; border-color:var(--blue); background:var(--blue); }
.plan-view-tabs > span, .fact-comparison-toolbar > span { color:var(--muted); font-size:11px; }
.plan-fact-primary { display:grid; grid-template-columns:minmax(280px,.8fr) minmax(360px,1.2fr); gap:22px; margin:18px 20px; padding:20px; border:1px solid rgba(20,93,232,.25); border-radius:14px; background:linear-gradient(135deg,rgba(20,93,232,.10),var(--white) 55%); }
.plan-fact-primary > div:first-child > span, .plan-fact-primary__scenario span { color:var(--blue); font-size:10px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; }
.plan-fact-primary h2 { margin:7px 0 5px; font-size:17px; }
.plan-fact-primary > div:first-child > strong { display:block; margin:8px 0; color:var(--green); font-size:34px; }
.plan-fact-primary.is-negative > div:first-child > strong { color:var(--red); }
.plan-fact-primary small { display:block; color:var(--muted); font-size:10px; line-height:1.5; }
.plan-fact-primary__scenarios { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.plan-fact-primary__scenario { padding:14px; border:1px solid var(--line); border-left:4px solid var(--green); border-radius:10px; background:var(--white); }
.plan-fact-primary__scenario.is-behind { border-left-color:var(--red); }
.plan-fact-primary__scenario b { display:block; margin:8px 0 5px; font-size:18px; }
.plan-fact-matrix { margin:0 20px; overflow:hidden; border:1px solid var(--line); border-radius:13px; background:var(--white); }
.plan-fact-matrix__head { display:flex; align-items:end; justify-content:space-between; gap:16px; padding:16px 18px; border-bottom:1px solid var(--line); }
.plan-fact-matrix__head p { margin:0 0 5px; color:var(--blue); font-size:9px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
.plan-fact-matrix__head h2 { margin:0; font-size:15px; }
.plan-fact-matrix__head > span { max-width:380px; color:var(--muted); font-size:10px; text-align:right; }
.plan-fact-matrix table { min-width:880px; }
.plan-fact-matrix th, .plan-fact-matrix td { text-align:right; white-space:nowrap; }
.plan-fact-matrix th:first-child { min-width:210px; text-align:left; }
.plan-fact-matrix thead tr:first-child th { color:var(--ink); background:var(--ice); }
.plan-fact-matrix tbody th { color:var(--ink); font-weight:600; }
.plan-fact-matrix tbody th small { display:block; margin-top:3px; color:var(--blue); font-size:8px; letter-spacing:.06em; text-transform:uppercase; }
.plan-fact-matrix tbody tr.is-primary { background:rgba(98,197,132,.10); }
.plan-fact-matrix tbody tr.is-primary th, .plan-fact-matrix tbody tr.is-primary td { font-weight:700; }
.price-impact-panel { margin:20px; overflow:hidden; }
.price-impact-controls { display:grid; grid-template-columns:minmax(260px,1.4fr) minmax(210px,1fr) minmax(210px,1fr); gap:14px; padding:16px 18px; border-top:1px solid var(--line); }
.price-impact-controls label { display:grid; gap:7px; color:var(--muted); font-size:9px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; }
.price-impact-controls select, .price-impact-controls input { width:100%; min-height:36px; padding:7px 10px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--white); font:500 11px/1.2 Onest,sans-serif; }
.price-impact-controls input[type="range"] { min-height:20px; padding:0; border:0; }
.price-impact-controls output { float:right; color:var(--blue); font-weight:700; }
.price-impact-demand { display:flex; gap:6px; }
.price-impact-demand button { flex:0 0 auto; min-height:36px; padding:7px 11px; border:1px solid var(--line); border-radius:8px; color:var(--blue); background:var(--white); cursor:pointer; font:600 10px/1 Onest,sans-serif; }
.price-impact-summary { border-bottom:1px solid var(--line); }
.price-impact-layout { display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr); }
.price-impact-layout > section { min-width:0; padding:18px; border-right:1px solid var(--line); }
.price-impact-layout > section:last-child { border-right:0; }
.price-impact-title p { margin:0 0 6px; color:var(--blue); font-size:9px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
.price-impact-title h3 { margin:0; font-size:14px; }
.price-impact-chart { position:relative; height:300px; margin-top:12px; }
.price-impact-scenarios { margin-top:12px; }
.price-impact-scenarios table { min-width:700px; }
.price-impact-history { padding:18px; border-top:1px solid var(--line); }
.price-impact-history .table-scroll { max-height:330px; margin-top:12px; }
.price-impact-history table { min-width:980px; }
.price-impact-note { margin:0; padding:13px 18px; border-top:1px solid var(--line); color:var(--muted); background:var(--pearl); font-size:10px; line-height:1.55; }
.price-impact-note strong { color:var(--ink); }
.fact-dashboard-grid { grid-template-columns:1fr; }
.fact-editor { margin:0 20px 20px; overflow:hidden; }
.financial-edit-cell input { width:100%; min-width:120px; padding:8px 9px; border:1px solid var(--line); border-radius:7px; color:var(--ink); background:var(--white); text-align:right; font:600 11px/1.2 inherit; }
.financial-derived { background:var(--pearl); }
.financial-row-remove { padding:6px 8px; border:1px solid var(--line); border-radius:7px; color:var(--red); background:var(--white); cursor:pointer; font-size:10px; }
.financial-accept { display:flex; align-items:end; justify-content:flex-end; flex-wrap:wrap; gap:8px; padding:13px 18px; border-top:1px solid var(--line); background:var(--pearl); }
.financial-accept label { display:grid; flex:1 1 260px; gap:5px; color:var(--muted); font-size:9px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; }
.financial-scope-note { flex:1 1 100%; color:var(--red); font-size:10px; }
.financial-accept input { min-height:34px; padding:7px 9px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--white); font:400 11px/1.2 inherit; }
.financial-accept button { min-height:34px; padding:7px 12px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--white); cursor:pointer; font:600 10px/1 inherit; }
.financial-accept button.is-primary { color:#fff; border-color:var(--blue); background:var(--blue); }
.financial-accept button:disabled { cursor:not-allowed; opacity:.45; }
.financial-history { padding:10px 18px; border-top:1px solid var(--line); color:var(--muted); font-size:10px; }
.financial-history summary { cursor:pointer; color:var(--blue); font-weight:600; }
.financial-history > div { display:grid; gap:5px; margin-top:8px; }
.financial-history span { display:flex; gap:8px; }
.financial-history b { color:var(--ink); }

.inventory-notice {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(217,80,80,.24);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  color: #713434;
  background: rgba(217,80,80,.07);
  font-size: 13px;
  line-height: 1.55;
}
.inventory-notice strong { margin-right: 5px; }
.inventory-notice a { color: inherit; font-weight: 700; text-underline-offset: 2px; }
.inventory-view-tabs { width: max-content; margin: 0 auto 12px; }
.inventory-view-tabs button { min-width: 130px; }
.inventory-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.inventory-overview .panel { min-height: 385px; }
.inventory-share-table { max-height: 305px; }
.inventory-share-table th, .inventory-table th { cursor: default; }
.inventory-share-table td:first-child { max-width: 320px; white-space: normal; }
.inventory-section { margin-bottom: 18px; }
.inventory-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 13px 16px;
}
.inventory-filter { display: grid; gap: 5px; min-width: 160px; flex: 1 1 180px; }
.inventory-filter span { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.inventory-filter select, .inventory-filter input {
  width: 100%;
  min-height: 34px;
  padding: 6px 28px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--white);
  font: 500 10px Onest, sans-serif;
}
.inventory-filter input { padding-right: 9px; }
.inventory-trend { height: 390px; }
.inventory-table { max-height: min(64vh, 720px); scrollbar-gutter: stable; }
.inventory-table .inventory-location { width: 360px; max-width: 360px; overflow-wrap: anywhere; text-align: left; white-space: normal; }
.inventory-table tr.is-affected { background: rgba(217,80,80,.055); }
.inventory-table tr.is-affected:hover { background: rgba(217,80,80,.12); }
.inventory-table tr.is-destroyed { background: rgba(217,80,80,.07); }
.inventory-table tr.is-uncertain { background: rgba(214,151,47,.09); }
.inventory-product, .unit-product { display: flex; align-items: center; gap: 9px; width: 220px; max-width: 220px; }
.inventory-product > span:last-child, .unit-product > span:last-child { min-width: 0; overflow: hidden; }
.inventory-product .cell-main, .unit-product .cell-main,
.inventory-product .cell-sub, .unit-product .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-preview { position: relative; display: inline-grid; flex: 0 0 34px; outline: none; }
.product-thumb { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: var(--pearl); }
.product-thumb.is-empty { display: inline-block; background: linear-gradient(135deg,#edf1ea,#f8f9f5); }
.product-preview__large {
  position: fixed;
  top: 12px;
  top: attr(data-top type(<length>),12px);
  left: 12px;
  left: attr(data-left type(<length>),12px);
  z-index: 300;
  display: block;
  width: 240px;
  width: attr(data-width type(<length>),240px);
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  box-shadow: 0 18px 55px rgba(6,18,38,.28);
  opacity: 0;
  pointer-events: none;
  transform: scale(.82);
  transition: opacity .14s ease, transform .14s ease;
  visibility: hidden;
}
.product-preview__large img { display: block; width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: var(--pearl); }
.product-preview__large b { display: block; overflow: hidden; margin-top: 7px; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.product-preview:hover .product-preview__large,
.product-preview:focus .product-preview__large,
.product-preview.is-preview-open .product-preview__large { opacity: 1; transform: scale(1); visibility: visible; }
.inventory-state {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  color: #386448;
  background: rgba(98,197,132,.15);
  font-size: 11px;
  font-weight: 600;
}
.inventory-state.is-risk { color: #9d3030; background: rgba(217,80,80,.14); }
.inventory-state.is-warning { color: #835604; background: rgba(214,151,47,.18); }
.price-controls { position: sticky; z-index: 18; top: 62px; }
.price-product-filter { flex-grow: 2; min-width: 240px; }
.price-problems { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 6px; color: var(--ink); font-size: 10px; font-weight: 600; white-space: nowrap; }
.price-problems input { accent-color: var(--forest); }
.price-refresh { min-height: 34px; padding: 7px 12px; border: 0; border-radius: 8px; color: #fff; background: var(--forest); font: 600 10px Onest, sans-serif; cursor: pointer; white-space: nowrap; }
.price-refresh:disabled { cursor: wait; opacity: .62; }
.price-mapping-toggle { min-height: 34px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--forest); background: var(--white); font: 600 10px Onest, sans-serif; cursor: pointer; white-space: nowrap; }
.price-auto { align-self: center; color: var(--muted); font-size: 9px; white-space: nowrap; }
.price-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.price-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
.price-table td { vertical-align: middle; }
.price-table td strong { display: block; white-space: nowrap; }
.price-table tr.is-price-risk { background: rgba(217,80,80,.09); }
.price-table tr.is-price-risk:hover { background: rgba(217,80,80,.16); }
.price-economics-panel, .price-simulator-panel { margin-bottom: 18px; }
.price-target-profit { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 600; }
.price-target-profit input { width: 66px; min-height: 34px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--white); font: inherit; }
.price-economics-table { max-height: min(62vh,680px); margin: 0; }
.price-economics-table table { width: max-content; min-width: 100%; }
.price-economics-table th, .price-economics-table td { min-width: 94px; vertical-align: middle; white-space: nowrap; }
.price-economics-table th:first-child, .price-economics-table td:first-child { position: sticky; z-index: 2; left: 0; min-width: 270px; max-width: 270px; background: var(--white); }
.price-economics-table th:first-child { z-index: 4; }
.price-economics-table tr.is-economics-missing { color: var(--muted); background: color-mix(in srgb,var(--pearl) 58%,var(--white)); }
.price-economics-product { width: 100%; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.price-economics-product:focus-visible { border-radius: 7px; outline: 2px solid var(--blue); outline-offset: 3px; }
.price-economics-coverage { padding: 10px 18px 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.price-simulator-controls { display: grid; grid-template-columns: minmax(280px,1.4fr) repeat(2,minmax(220px,1fr)); gap: 18px; padding: 16px 18px; border-top: 1px solid var(--line); }
.price-simulator-controls label { display: grid; align-content: start; gap: 9px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .045em; text-transform: uppercase; }
.price-simulator-controls label > span { display: flex; justify-content: space-between; gap: 10px; }
.price-simulator-controls output { color: var(--ink); font-size: 11px; letter-spacing: normal; }
.price-simulator-controls select { width: 100%; min-height: 38px; padding: 8px 34px 8px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--white); font: 500 10px Onest,sans-serif; text-overflow: ellipsis; }
.price-simulator-controls input[type="range"] { width: 100%; accent-color: var(--blue); cursor: ew-resize; }
.price-scenario-results { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); border-top: 1px solid var(--line); }
.price-scenario-results > div { min-height: 88px; padding: 16px 18px; border-right: 1px solid var(--line); }
.price-scenario-results > div:last-child { border-right: 0; }
.price-scenario-results span, .price-scenario-results small { display: block; color: var(--muted); font-size: 9px; }
.price-scenario-results strong { display: block; margin-top: 8px; color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.price-scenario-results small { margin-top: 4px; line-height: 1.35; }
.channel-calculator { margin-bottom:18px; overflow:hidden; }
.channel-calculator-reference { display:grid; grid-template-columns:minmax(260px,1.5fr) repeat(3,minmax(150px,1fr)); border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.channel-calculator-reference > div, .channel-calculator-reference > label { min-width:0; padding:14px 16px; border-right:1px solid var(--line); }
.channel-calculator-reference > :last-child { border-right:0; }
.channel-calculator-reference span, .channel-calculator-reference small { display:block; color:var(--muted); font-size:9px; }
.channel-calculator-reference strong { display:block; margin-top:7px; font-size:17px; }
.channel-calculator-reference small { margin-top:4px; line-height:1.35; }
.channel-calculator-reference select { width:100%; min-height:38px; margin-top:7px; padding:8px 32px 8px 10px; overflow:hidden; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--white); font:500 10px Onest,sans-serif; text-overflow:ellipsis; }
.channel-calculator-controls { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); align-items:end; gap:12px; padding:16px 18px; }
.channel-calculator-controls label { display:grid; gap:7px; color:var(--muted); font-size:9px; font-weight:650; letter-spacing:.045em; text-transform:uppercase; }
.channel-calculator-controls label.is-price { grid-column:span 2; }
.channel-calculator-controls label > span { display:flex; justify-content:space-between; gap:8px; }
.channel-calculator-controls output { color:var(--ink); font-size:11px; letter-spacing:normal; }
.channel-calculator-controls input { width:100%; min-height:36px; padding:7px 9px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--white); font:500 11px Onest,sans-serif; }
.channel-calculator-controls input[type="range"] { min-height:18px; padding:0; border:0; accent-color:var(--blue); cursor:ew-resize; }
.channel-calculator-controls button { min-height:36px; padding:7px 10px; border:1px solid var(--line); border-radius:8px; color:var(--blue); background:var(--white); cursor:pointer; font:600 10px Onest,sans-serif; }
.channel-calculator-results { display:grid; grid-template-columns:repeat(auto-fit,minmax(135px,1fr)); border-top:1px solid var(--line); }
.channel-calculator-results > div { min-height:94px; padding:15px 16px; border-right:1px solid var(--line); }
.channel-calculator-results span, .channel-calculator-results small { display:block; color:var(--muted); font-size:9px; }
.channel-calculator-results strong { display:block; margin-top:8px; font-size:17px; font-variant-numeric:tabular-nums; }
.channel-calculator-results small { margin-top:4px; line-height:1.35; }
.channel-calculator-note { margin:0; padding:12px 16px; border-top:1px solid var(--line); color:var(--muted); background:var(--pearl); font-size:10px; line-height:1.55; }
.price-state { display: inline-flex; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 650; white-space: nowrap; }
.price-state.is-ok { color: #17724e; background: rgba(10,140,98,.12); }
.price-state.is-risk { color: #a12f2f; background: rgba(196,71,58,.14); }
.price-state.is-empty { color: var(--muted); background: var(--pearl); }
.price-method-note { margin-bottom: 18px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.65); font-size: 10px; line-height: 1.55; }
.price-method-note strong { color: var(--ink); }
.price-mapping-panel { margin-bottom: 18px; }
.price-mapping-form { display: grid; grid-template-columns: 110px minmax(220px,1fr) auto minmax(220px,1fr) auto; align-items: end; gap: 10px; padding: 15px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.price-mapping-arrow { align-self: center; color: var(--blue); font-size: 18px; font-weight: 700; }
.price-mapping-status { grid-column: 1 / -1; min-height: 0; color: var(--green); font-size: 10px; }
.price-mapping-status.is-error { color: var(--red); }
.price-mapping-table { max-height: 310px; margin: 0; }
.price-mapping-table td:last-child { display: flex; gap: 6px; }
.price-mapping-table button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--blue); background: var(--white); font: 600 9px Onest, sans-serif; cursor: pointer; }
.price-heat-panel .panel__head { align-items: center; }
.price-heat-controls { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 9px; }
.price-heat-control, .price-heat-filter { display: grid; gap: 5px; }
.price-heat-control > span, .price-heat-filter > span { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .055em; text-transform: uppercase; }
.price-heat-filter select { width: min(310px,32vw); min-height: 38px; padding: 8px 34px 8px 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background-color: var(--white); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.price-heatmap { max-height: min(65vh,720px); margin-top: 0; }
.price-heatmap table { width: max-content; min-width: 100%; }
.price-heatmap th, .price-heatmap td { min-width: 68px; text-align: center; white-space: nowrap; }
.price-heatmap th:first-child, .price-heatmap td:first-child { position: sticky; z-index: 2; left: 0; min-width: 250px; max-width: 250px; text-align: left; background: var(--white); }
.price-heatmap th:first-child { z-index: 4; }
.price-heat-cell { position: relative; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; transition: box-shadow .16s ease,transform .16s ease; }
.price-heat-cell span, .price-heat-cell small { display: block; }
.price-heat-cell small { margin-top: 3px; color: currentColor; font-size: 8px; font-weight: 600; opacity: .76; }
.price-heat-cell.is-base { background: color-mix(in srgb,var(--blue) 11%,var(--white)); }
.price-heat-cell.is-flat { background: color-mix(in srgb,var(--muted) 9%,var(--white)); }
.price-heat-cell.is-rise-1 { background: color-mix(in srgb,var(--green) 14%,var(--white)); }
.price-heat-cell.is-rise-2 { background: color-mix(in srgb,var(--green) 29%,var(--white)); }
.price-heat-cell.is-rise-3 { color: color-mix(in srgb,var(--ink) 74%,#052e21); background: color-mix(in srgb,var(--green) 50%,var(--white)); }
.price-heat-cell.is-fall-1 { background: color-mix(in srgb,var(--red) 13%,var(--white)); }
.price-heat-cell.is-fall-2 { background: color-mix(in srgb,var(--red) 27%,var(--white)); }
.price-heat-cell.is-fall-3 { color: color-mix(in srgb,var(--ink) 78%,#4b1515); background: color-mix(in srgb,var(--red) 47%,var(--white)); }
.price-heat-cell:not(.is-empty):hover { z-index: 3; outline: 2px solid var(--blue); outline-offset: 1px; box-shadow: 0 10px 24px color-mix(in srgb,var(--blue-black) 19%,transparent); transform: translateY(-2px) scale(1.035); }
.price-heat-cell.is-empty { color: var(--muted); background: color-mix(in srgb,var(--pearl) 72%,var(--white)); font-weight: 400; }
.price-heat-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 18px 14px; color: var(--muted); font-size: 9px; }
.price-heat-legend span { display: inline-flex; align-items: center; gap: 5px; }
.price-heat-legend i { width: 16px; height: 8px; border-radius: 3px; }
.price-heat-legend i.is-fall { background: color-mix(in srgb,var(--red) 42%,var(--white)); }
.price-heat-legend i.is-flat { background: color-mix(in srgb,var(--muted) 10%,var(--white)); }
.price-heat-legend i.is-rise { background: color-mix(in srgb,var(--green) 44%,var(--white)); }
.price-heat-legend small { margin-left: auto; font-size: 9px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .inventory-kpis { grid-template-columns: repeat(4, 1fr); }
  .price-kpis { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filter-period { grid-column: 1 / -1; }
  .tax-card { grid-template-columns: 1fr 1fr; }
  .tax-card__metric { border-top: 1px solid rgba(255,255,255,.12); }
  .plan-opex__forms { grid-template-columns: 1fr; }
  .fact-dashboard-grid { grid-template-columns:1fr; }
  .price-impact-layout { grid-template-columns:1fr; }
  .price-impact-layout > section { border-right:0; border-bottom:1px solid var(--line); }
  .price-impact-layout > section:last-child { border-bottom:0; }
}
@media (max-width: 780px) {
  .topbar { grid-template-columns: 1fr auto; gap: 8px; padding: 8px 14px; }
  .tabs { grid-row: 2; grid-column: 1 / -1; justify-self: stretch; overflow-x: auto; }
  .tab { flex: 1 0 auto; white-space: nowrap; }
  .tab { padding: 8px 11px; }
  .refresh span:last-child { display: none; }
  main { width: calc(100% - 24px); padding-top: 26px; }
  .intro { align-items: start; flex-direction: column; }
  .filters { position: static; grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid, .grid.is-equal { grid-template-columns: 1fr; }
  .tax-card { grid-template-columns: 1fr; }
  .tax-card__metric { border-left: 0; }
  .chart-wrap { height: 285px; }
  .panel__head { flex-direction: column; }
  .panel__tools { justify-content: flex-start; }
  .toolbar, .search { width: 100%; }
  .ai-launch { align-items: flex-start; flex-direction: column; }
  .ai-launch button { width: 100%; }
  .pnl-toolbar { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .pnl-toolbar__actions { grid-column: 1; }
  .pnl-toolbar__spacer { display: none; }
  .pnl-table { font-size: 10.5px; }
  .pnl-table th, .pnl-table td { padding-right: 8px; padding-left: 8px; }
  .pnl-table th:first-child, .pnl-table td:first-child {
    width: clamp(150px, 44vw, 220px);
    min-width: clamp(150px, 44vw, 220px);
    max-width: clamp(150px, 44vw, 220px);
  }
  .pnl-table th:not(:first-child), .pnl-table .pnl-num { min-width: 98px; }
  .pnl-depth-1 td:first-child { padding-left: 18px; }
  .pnl-depth-2 td:first-child { padding-left: 28px; }
  .pnl-depth-3 td:first-child { padding-left: 38px; }
  .load-summary { grid-template-columns: repeat(2, 1fr); }
  .manual-upload { grid-template-columns: 1fr; padding: 0 14px 16px; }
  .manual-upload .load-run, .manual-upload__template { width: 100%; text-align: center; }
  .manual-upload > small { grid-column: 1; }
  .input-history-table th:first-child, .input-history-table td:first-child {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
  }
  .cost-catalog-toolbar { grid-template-columns: 1fr; padding: 0 14px 14px; }
  .cost-missing-filter { white-space: normal; }
  .cost-catalog-table th:first-child, .cost-catalog-table td:first-child {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
  }
  .ozon-input-table th:first-child, .ozon-input-table td:first-child {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
  }
  .inventory-kpis { grid-template-columns: repeat(2, 1fr); }
  .price-kpis { grid-template-columns: repeat(2, 1fr); }
  .price-charts { grid-template-columns: 1fr; }
  .price-simulator-controls { grid-template-columns: 1fr; }
  .price-scenario-results { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .price-scenario-results > div:nth-child(3) { border-right: 0; }
  .price-scenario-results > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .price-controls { position: static; }
  .price-heat-controls { width: 100%; justify-content: flex-start; }
  .price-heat-filter { width: 100%; }
  .price-heat-filter select { width: 100%; }
  .price-heat-legend small { width: 100%; margin-left: 0; }
  .price-mapping-form { grid-template-columns: 1fr; }
  .price-mapping-arrow { display: none; }
  .channel-calculator-reference { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .channel-calculator-reference > :nth-child(2n) { border-right:0; }
  .inventory-view-tabs { width: 100%; }
  .inventory-view-tabs button { flex: 1; min-width: 0; }
  .sales-plan__scenarios-head { align-items: stretch; flex-direction: column; }
  .sales-plan__baseline { width: 100%; min-width: 0; text-align: left; }
  .sales-plan__baseline small { justify-content: flex-start; }
  .sales-plan__scenario-grid { grid-template-columns: 1fr; }
  .ai-methodology__hero, .ai-methodology__grid { grid-template-columns: 1fr; }
  .price-impact-controls { grid-template-columns:1fr; }
}
@media (max-width: 480px) {
  .wordmark { font-size: 20px; }
  .wordmark small { display: none; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi { min-height: 128px; }
  .price-economics-panel .panel__head { align-items: flex-start; gap: 10px; }
  .price-target-profit { width: 100%; justify-content: flex-start; }
  .channel-calculator-reference { grid-template-columns:1fr; }
  .channel-calculator-reference > div, .channel-calculator-reference > label { border-right:0; border-bottom:1px solid var(--line); }
  .channel-calculator-reference > :last-child { border-bottom:0; }
  .channel-calculator-controls label.is-price { grid-column:span 1; }
  .price-scenario-results { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .price-scenario-results > div { border-bottom: 1px solid var(--line); }
  .price-scenario-results > div:nth-child(2n) { border-right: 0; }
  .price-scenario-results > div:nth-last-child(-n+2) { border-bottom: 0; }
  .intro h1 { font-size: 39px; }
  .load-summary { grid-template-columns: 1fr; }
  .sales-plan__body { padding: 14px; }
  .plan-view-tabs, .fact-comparison-toolbar { align-items:flex-start; flex-direction:column; padding:12px 14px; }
  .plan-fact-primary { grid-template-columns:1fr; margin:14px; padding:16px; }
  .plan-fact-primary__scenarios { grid-template-columns:1fr; }
  .plan-fact-matrix { margin:0 14px; }
  .plan-fact-matrix__head { align-items:flex-start; flex-direction:column; }
  .plan-fact-matrix__head > span { text-align:left; }
  .fact-editor { margin:0 14px 14px; }
  .price-impact-panel { margin:14px; }
  .sales-plan__chart, .sales-plan__scenarios { padding: 13px; }
  .sales-plan__scenario-card > header { align-items: flex-start; flex-direction: column; }
  .sales-plan__scenario-gap { grid-template-columns: 1fr auto; }
  .sales-plan__scenario-gap > span { grid-column: 1 / -1; }
  .sales-plan__scenario-card dd { align-items: flex-end; flex-direction: column; }
  .ai-methodology__hero { padding: 20px 18px; }
  .ai-methodology__save { grid-template-columns: 1fr; }
}

/* Единая оболочка главного и аналитического контуров */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  transition: grid-template-columns .2s ease;
}
.app-shell.is-nav-collapsed { --rail-width: 62px; }
.app-stage { min-width: 0; }
.app-rail {
  position: sticky;
  top: 0;
  z-index: 130;
  display: flex;
  flex-direction: column;
  width: var(--rail-width);
  height: 100vh;
  overflow: hidden;
  padding: 22px 17px 16px;
  color: #f7fbf8;
  background: linear-gradient(180deg,#1851a6 0%,#123f83 100%);
  transition: width .2s ease, transform .2s ease;
}
.app-rail::before {
  position: absolute;
  top: -80px;
  right: -160px;
  width: 330px;
  height: 210px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: rotate(-18deg);
}
.rail-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 38px;
  margin: 0 5px 24px;
  color: #f7fbf8;
  text-decoration: none;
}
.rail-brand__mark {
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  border-radius: 50% 44% 54% 38%;
  background: linear-gradient(145deg,#fff,#bcd2ff);
  box-shadow: 0 0 0 6px rgba(255,255,255,.05);
}
.rail-brand__text { min-width: 0; }
.rail-brand strong { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.04em; }
.rail-brand small { display: block; color: rgba(255,255,255,.72); font-size: 8px; letter-spacing: .14em; text-transform: uppercase; }
.topbar-brand { display: none; }
.app-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.16) transparent;
}
.app-nav__items { display: grid; gap: 3px; }
.app-nav__group { min-width: 0; }
.app-nav__group[hidden] { display: none; }
.app-nav__group > summary {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9px;
  color: rgba(255,255,255,.62);
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  list-style: none;
  text-transform: uppercase;
}
.app-nav__group > summary::-webkit-details-marker { display: none; }
.app-nav__group > summary svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; transition: transform .16s ease; }
.app-nav__group[open] > summary svg { transform: rotate(180deg); }
.app-nav__group > summary:hover,
.app-nav__group:has(button.is-active) > summary { color: #fff; background: rgba(255,255,255,.08); }
.app-nav__group-panel { display: grid; gap: 1px; padding: 2px 0 6px 8px; }
.app-nav__group:not([open]) > .app-nav__group-panel { display: none; }
.app-nav button {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 1px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  color: rgba(255,255,255,.82);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color .16s ease, background .16s ease;
}
.app-nav button > b { overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.app-nav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.app-nav button.is-active { color: var(--blue-deep); background: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.nav-settings-wrap { position: relative; flex: 0 0 auto; margin: 6px 0 0; }
.nav-settings {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  color: rgba(255,255,255,.86);
  background: rgba(7,28,66,.16);
  cursor: pointer;
  font-size: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
}
.nav-settings > span { font-size: 14px; line-height: 1; }
.nav-settings > b { overflow: hidden; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.nav-settings:hover,
.nav-settings[aria-expanded="true"] { color: #fff; background: rgba(7,28,66,.28); }
.nav-settings-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 4;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 11px;
  background: #071c42;
  box-shadow: 0 16px 30px rgba(0,0,0,.28);
  max-height: min(68vh, 620px);
  overflow: auto;
}
.nav-settings-panel > strong { display: block; margin-bottom: 7px; color: #fff; font-size: 9px; }
.nav-settings__list { display: grid; gap: 5px; }
.nav-settings__row { display: grid; grid-template-columns: minmax(0,1fr) 26px 26px; gap: 4px; align-items: center; color: #c8d7f2; font-size: 9px; }
.nav-settings__row--group { margin-top: 4px; color: #fff; font-weight: 600; }
.nav-settings__row--item { padding-left: 9px; color: #9fb5dd; }
.nav-settings__row button { width: 26px; height: 26px; padding: 0; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; color: #fff; background: rgba(255,255,255,.07); }
.nav-settings__row button:hover:not(:disabled) { background: var(--blue); }
.nav-settings__row button:disabled { opacity: .3; cursor: default; }
.app-rail__foot {
  position: relative;
  margin-top: auto;
  padding: 14px 9px 2px;
  border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.66);
  font-size: 9px;
}
.app-rail__foot strong { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; color: #fff; font-size: 10px; }
.app-rail__foot i { width: 7px; height: 7px; border-radius: 50%; background: #5cdda7; box-shadow: 0 0 0 4px rgba(92,221,167,.1); }
.is-nav-collapsed .rail-brand { justify-content: center; margin-right: 0; margin-left: 0; }
.is-nav-collapsed .rail-brand__text,
.is-nav-collapsed .app-nav,
.is-nav-collapsed .nav-settings-wrap,
.is-nav-collapsed .app-rail__foot { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 110;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 0 clamp(15px,2.4vw,34px);
  border-bottom: 1px solid rgba(189,198,189,.82);
  background: rgba(255,254,250,.9);
  box-shadow: 0 6px 24px rgba(24,38,31,.035);
  backdrop-filter: blur(18px);
}
.nav-toggle {
  min-width: 38px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
}
.nav-toggle:hover { border-color: var(--forest); }
.nav-toggle__icon { position: relative; width: 15px; height: 11px; border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.nav-toggle__icon::after { position: absolute; top: 4px; left: 0; width: 15px; border-top: 1.5px solid currentColor; content: ""; }
.app-rail__toggle {
  width: 100%;
  margin-bottom: 8px;
  border-color: rgba(255,255,255,.14);
  color: #d8e4f8;
  background: rgba(255,255,255,.06);
}
.app-rail__toggle:hover { border-color: rgba(255,255,255,.34); color: #fff; background: rgba(255,255,255,.1); }
.is-nav-collapsed .app-rail__toggle { width: 36px; padding: 0; align-self: center; }
.is-nav-collapsed .app-rail__toggle .nav-toggle__label { display: none; }
.nav-mobile-toggle { display: none; }
.topbar__context { min-width: 0; }
.topbar__context p { margin: 0 0 2px; color: var(--blue); font-size: 8px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.topbar__context strong { display: block; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.refresh {
  min-height: 36px;
  padding: 0 13px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--white);
  font-size: 10px;
}
.refresh span:first-child { color: var(--blue); }
.topbar__actions,
.topbar-account { display: flex; align-items: center; }
.topbar__actions { justify-self: end; gap: 8px; }
.topbar-account { gap: 6px; padding-left: 8px; border-left: 1px solid var(--line); }
.topbar-account[hidden] { display: none; }
.topbar-account strong {
  max-width: 150px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-account a,
.topbar-account button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--white);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}
.topbar-account a:hover,
.topbar-account button:hover { border-color: var(--blue); color: var(--blue); background: var(--ice); }
.topbar-account a:focus-visible,
.topbar-account button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.topbar-account svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-scrim { display: none; }

.password-dialog {
  width: min(420px,calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 28px 80px rgba(7,28,66,.22);
}
.password-dialog::backdrop { background: rgba(7,28,66,.45); backdrop-filter: blur(3px); }
.password-dialog form { display: grid; gap: 14px; padding: 22px; }
.password-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.password-dialog__head p { margin: 0 0 3px; color: var(--blue); font-size: 9px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.password-dialog__head h2 { margin: 0; font-size: 19px; font-weight: 500; }
.password-dialog__head button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); cursor: pointer; font-size: 20px; line-height: 1; }
.password-dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 500; }
.password-dialog input { width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfcf8; font-size: 12px; }
.password-dialog input:focus { border-color: var(--blue); outline: 2px solid rgba(20,93,232,.14); }
.password-dialog__error { min-height: 15px; margin: -3px 0 0; color: var(--red); font-size: 10px; }
.password-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }
.password-dialog__actions button { min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); cursor: pointer; font-size: 10px; }
.password-dialog__actions button[type="submit"] { border-color: var(--blue); color: #fff; background: var(--blue); }

main {
  width: 100%;
  margin: 0;
  padding: 27px clamp(16px,2.5vw,38px) 64px;
}
.intro { margin-bottom: 20px; }
.intro h1 {
  font-size: clamp(31px,3.4vw,49px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .98;
}
.intro h1::first-letter { color: inherit; }
.eyebrow { margin-bottom: 7px; font-size: 9px; letter-spacing: .13em; }
.intro > div > p:last-child { margin-top: 9px; font-size: 11px; }
.status { font-size: 10px; }
.filters {
  top: 76px;
  gap: 11px;
  margin-bottom: 18px;
  padding: 12px;
  border-color: rgba(189,198,189,.8);
  border-radius: 16px;
  background: rgba(255,254,250,.92);
  box-shadow: 0 10px 32px rgba(24,38,31,.07);
}
.filter-group label { margin-bottom: 6px; font-size: 9px; }
.chip { min-height: 30px; padding: 6px 10px; border-radius: 9px; background: #fbfcf8; font-size: 10px; }
.chip.is-active { border-color: var(--forest); background: var(--forest); }
.reset { min-height: 32px; padding: 7px 11px; border-radius: 9px; font-size: 10px; }
.kpi-grid { gap: 10px; margin-bottom: 12px; }
.kpi {
  min-height: 118px;
  padding: 20px;
  border-color: var(--line);
  border-left: 3px solid var(--forest);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 2px 0 rgba(16,39,31,.02);
}
.kpi:hover { transform: none; box-shadow: var(--shadow); }
.kpi::before { display: none; }
.kpi-grid .kpi:first-child { color: var(--ink); border-color: var(--line); border-left-color: var(--forest); background: var(--white); }
.kpi-grid .kpi:first-child .kpi__label,
.kpi-grid .kpi:first-child .kpi__sub { color: var(--muted); }
.kpi.is-green { border-left-color: #10b981; }
.kpi.is-red { border-left-color: #ef4444; }
.kpi.is-amber { border-left-color: #f59e0b; }
.kpi__label { min-height: 26px; font-size: 11px; }
.kpi__value { margin: 10px 0 6px; font-size: clamp(21px,2vw,29px); font-weight: 600; }
.kpi__sub { color: #8a9ab4; font-size: 10px; }
.pnl-kpis { grid-template-columns: repeat(5,minmax(0,1fr)); }
@media (max-width: 1180px) { .pnl-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); } }
.panel {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 2px 0 rgba(16,39,31,.02);
}
.panel__head { padding: 16px 18px 12px; border-bottom: 1px solid #e9ece7; }
.panel__head p { margin-bottom: 3px; font-size: 9px; letter-spacing: .1em; }
.panel__head h2 { font-size: 15px; }
.panel__note { font-size: 9px; }
.chart-wrap { padding: 10px 12px 16px; }
.chart-segmented { border-radius: 9px; background: #f7f7f2; }
.chart-segmented button { border-radius: 6px; font-family: Onest, sans-serif; font-size: 9px; }
.chart-segmented button.is-active { background: var(--forest); box-shadow: 0 2px 7px rgba(16,39,31,.18); }
.search { border-radius: 9px; background: #fbfcf8; }
th { background: #f5f7f3; }
.pnl-table th { background: #f5f7f3; }
.pnl-table tbody tr:hover,
.pnl-table tbody tr:hover td:first-child { background: #eef3ef; }
.tax-card { background: var(--forest); }
.tax-card__intro { background: linear-gradient(135deg,var(--forest-soft),var(--forest)); }
.ai-launch { border-color: var(--line); background: linear-gradient(120deg,rgba(20,93,232,.08),var(--white) 48%); }
.analytics-host {
  height: calc(100vh - 64px);
  min-height: 560px;
  overflow: hidden;
  background: var(--pearl);
}
.analytics-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--pearl); }
[hidden] { display: none !important; }

@media (max-width: 1180px) {
  .app-shell:not(.is-nav-collapsed) { --rail-width: 206px; }
}
@media (max-width: 820px) {
  .app-shell:not(.is-nav-collapsed),
  .app-shell.is-nav-collapsed { display: block; --rail-width: min(292px,86vw); }
  .app-rail {
    position: fixed;
    left: 0;
    width: var(--rail-width);
    transform: translateX(-102%);
    box-shadow: 22px 0 48px rgba(8,25,18,.24);
  }
  .app-shell.is-nav-open .app-rail { transform: translateX(0); }
  .is-nav-collapsed .rail-brand { justify-content: flex-start; margin-right: 5px; margin-left: 5px; }
  .is-nav-collapsed .rail-brand__text,
  .is-nav-collapsed .app-nav,
  .is-nav-collapsed .app-rail__foot { display: block; }
  .is-nav-collapsed .app-nav { display: flex; }
  .is-nav-collapsed .app-nav { flex-direction: column; }
  .is-nav-collapsed .app-rail__foot { display: block; }
  .is-nav-collapsed .nav-settings-wrap { display: block; }
  .is-nav-collapsed .app-rail__toggle { width: 100%; padding: 0 11px; align-self: auto; }
  .is-nav-collapsed .app-rail__toggle .nav-toggle__label { display: inline; }
  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: block;
    border: 0;
    background: rgba(8,24,18,.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .app-shell.is-nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .topbar {
    min-height: 58px;
    grid-template-columns: auto minmax(0,1fr) auto;
    grid-template-rows: 1fr;
    gap: 9px;
    padding: 0 10px;
  }
  .nav-mobile-toggle { display: inline-flex; }
  .nav-toggle { width: 40px; height: 40px; padding: 0; }
  .nav-toggle__label { display: none; }
  .refresh { min-width: 40px; height: 40px; padding: 0 10px; }
  .refresh span:last-child { display: none; }
  .topbar__actions { gap: 4px; }
  .topbar-account { gap: 4px; padding-left: 4px; }
  .topbar-account strong { display: none; }
  main { width: 100%; padding: 19px 10px 38px; }
  .intro { align-items: flex-start; margin-bottom: 17px; }
  .intro h1 { font-size: 34px; }
  .filters { position: relative; top: auto; display: flex; overflow-x: auto; padding: 9px; }
  .filter-group { flex: 0 0 auto; min-width: 142px; }
  .filter-group:first-child { min-width: 240px; }
  .filter-period.is-range { min-width: 540px; }
  .filters .reset { flex: 0 0 auto; }
  .analytics-host { height: calc(100vh - 58px); min-height: 0; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kpi { min-width: 0; }
  .kpi__value { white-space: normal; }
  .pnl-table th:first-child,
  .pnl-table td:first-child {
    width: 168px;
    min-width: 168px;
    max-width: 168px;
  }
}
@media (max-width: 480px) {
  .topbar__context strong { font-size: 10px; }
  .kpi-grid, .pnl-kpis { grid-template-columns: 1fr; }
  .kpi { min-height: 105px; padding: 13px; }
  .kpi__label { min-height: 22px; }
  .kpi__value { font-size: 21px; }
}

/* Единая табличная типографика: эталон — ПиУ. */
table, .pnl-table { font-size: var(--table-text-size); font-variant-numeric: tabular-nums; }
table th, .pnl-table th { font-size: var(--table-head-size); }
table td, .pnl-table td, table .cell-main { font-size: var(--table-text-size); }
table small, table .cell-sub,
table .load-state, table .input-version time, table .input-version em { font-size: var(--table-meta-size); }
table a { font-size: inherit; }

.app-nav .is-user-hidden { display: none !important; }
.nav-settings__row--item { grid-template-columns: minmax(0,1fr) 28px 28px 28px; }
.nav-settings__row [data-nav-item-toggle][aria-pressed="true"] { color: #75e4b4; }
.nav-settings__row [data-nav-item-toggle][aria-pressed="false"] { color: #8298bc; }
.nav-settings__hint { display: block; margin: -2px 0 9px; color: #8298bc; font-size: 8px; }

@media (max-width: 820px) {
  .app-stage { display: block; }
  .topbar { grid-template-columns: auto auto minmax(0,1fr) auto; }
  .topbar-brand { display: flex; }
  .topbar .rail-brand {
    min-height: 34px;
    margin: 0;
    color: var(--ink);
  }
  .topbar .rail-brand__mark { width: 28px; height: 28px; background: linear-gradient(145deg,#f9fbff,#9ec0ff); }
  .topbar .rail-brand strong { font-size: 15px; }
  .topbar .rail-brand small { display: none; }
  .app-rail {
    top: 58px;
    height: calc(100vh - 58px);
  }
  .app-nav__items { display: flex; width: 100%; flex-direction: column; overflow: visible; }
  .app-nav__group { width: 100%; }
  .app-rail__foot { display: block; }
  .analytics-host { height: calc(100vh - 58px); }
}

@media (max-width: 560px) {
  .topbar__context { display: none; }
  .topbar { grid-template-columns: auto auto 1fr; }
  .topbar__actions { grid-column: 3; }
}

/* Защита бренда — плотный рабочий реестр в текущей системе дашборда. */
.filters.brand-filters { grid-template-columns: repeat(4,minmax(140px,1fr)) auto; }
.brand-filters .search { width: 100%; min-width: 0; }
.brand-summary { margin-bottom: 12px; }
.brand-summary .panel__head { align-items: center; }
.brand-run-meta {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 1px;
  margin: 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
}
.brand-run-meta span { padding: 11px 13px; color: var(--muted); background: var(--white); font-size: 10px; }
.brand-run-meta strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 9px; text-transform: uppercase; }
.brand-run-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; padding: 12px 18px 0; }
.brand-run { min-width: 0; padding: 11px; border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 10px; background: var(--pearl); }
.brand-run.is-ok { border-left-color: var(--green); }
.brand-run.is-partial { border-left-color: var(--amber); }
.brand-run.is-error { border-left-color: var(--red); }
.brand-run.is-running { border-left-color: var(--blue); }
.brand-run > div { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.brand-run strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.brand-run > span, .brand-run time { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.brand-state { display: inline-flex; max-width: 190px; padding: 4px 7px; border-radius: 999px; color: var(--muted); background: rgba(139,146,156,.14); font-size: 9px; font-weight: 600; line-height: 1.25; white-space: normal; }
.brand-state.is-ok, .brand-state.is-own, .brand-state.is-authorized, .brand-state.is-probably_gone { color: var(--green); background: rgba(10,140,98,.1); }
.brand-state.is-error, .brand-state.is-new, .brand-state.is-returned, .brand-state.is-confirmed_violation { color: var(--red); background: rgba(217,80,80,.12); }
.brand-state.is-partial, .brand-state.is-active, .brand-state.is-not_seen_once, .brand-state.is-unreviewed { color: var(--amber); background: rgba(214,151,47,.13); }
.brand-state.is-running { color: var(--blue); background: var(--ice); }
.brand-disclaimer { margin: 12px 18px 16px; padding: 10px 12px; border-left: 3px solid var(--amber); color: var(--muted); background: rgba(214,151,47,.08); font-size: 10px; line-height: 1.5; }
.brand-kpis { grid-template-columns: repeat(5,minmax(0,1fr)); }
.brand-list .panel__head { align-items: center; }
.brand-table-scroll { max-height: min(64vh,720px); overflow: auto; }
.brand-table-scroll > table { min-width: 1120px; }
.brand-table-scroll th { cursor: default; }
.brand-product { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 390px; text-align: left; }
.brand-product > img, .brand-product > span { flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: var(--pearl); }
.brand-product > div { min-width: 0; }
.brand-product strong, .brand-product small { display: block; overflow: hidden; text-overflow: ellipsis; }
.brand-product strong { white-space: normal; }
.brand-product small { margin-top: 4px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.brand-product a { color: var(--ink); text-decoration: none; }
.brand-product a:hover { color: var(--blue); text-decoration: underline; }
.brand-signals { display: flex; max-width: 230px; flex-wrap: wrap; gap: 4px; }
.brand-signals span { padding: 3px 6px; border-radius: 999px; color: var(--blue); background: var(--ice); font-size: 9px; }
.brand-signals .is-muted { color: var(--muted); background: var(--pearl); }
.brand-history { position: relative; text-align: left; }
.brand-history > summary { color: var(--blue); cursor: pointer; font-size: 10px; font-weight: 600; }
.brand-history__content { width: min(760px,72vw); padding: 10px 0 3px; color: var(--muted); font-size: 10px; white-space: normal; }
.brand-history__decision { margin-bottom: 9px; }
.brand-note { margin: 0 0 9px; padding: 9px 11px; border-radius: 8px; background: var(--pearl); }
.brand-review { display: grid; grid-template-columns: minmax(180px,.65fr) minmax(260px,1.35fr); gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--pearl); }
.brand-review label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 600; }
.brand-review select, .brand-review textarea { width: 100%; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--white); font: inherit; }
.brand-review textarea { resize: vertical; }
.brand-review > div { display: flex; grid-column: 1 / -1; align-items: center; gap: 8px; }
.brand-review [role="status"] { color: var(--muted); font-size: 9px; }
.brand-run-errors { margin-top: 9px; padding: 9px 11px; border-left: 3px solid var(--red); background: rgba(217,80,80,.07); }
.brand-run-errors ul { margin: 6px 0 0; padding-left: 17px; }
.brand-empty { display: grid; min-height: 190px; place-content: center; gap: 7px; padding: 24px; text-align: center; }
.brand-empty strong { font-size: 14px; }
.brand-empty span { max-width: 540px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.brand-empty.is-error strong { color: var(--red); }

@media (max-width: 1180px) {
  .filters.brand-filters { grid-template-columns: repeat(2,minmax(0,1fr)) auto; }
  .brand-run-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .brand-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .brand-table-scroll { max-height: 68vh; overflow: auto; }
  .brand-run-meta, .brand-run-grid { grid-template-columns: 1fr; }
  .brand-run > div { align-items: flex-start; }
  .brand-review { grid-template-columns: 1fr; }
  .brand-history__content { width: 78vw; }
  .brand-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
