/* ==========================================================================
   Суточная сводка АО «Озенмунайгаз» — оформление
   Строгий «директорский» вид: крупные цифры, минимум декора,
   цвет — только там, где есть отклонение.
   ========================================================================== */

:root {
  --bg:          #f4f6f8;
  --bg-sunk:     #e9edf1;
  --surface:     #ffffff;
  --surface-2:   #f8fafb;
  --line:        #dde3e9;
  --line-strong: #c3ccd6;

  --text:        #16202b;
  --text-2:      #5a6875;
  --text-3:      #8a96a3;

  --brand:       #0d5c48;
  --brand-2:     #12775c;

  --ok:          #17794a;
  --ok-bg:       #e7f4ec;
  --warn:        #9a6300;
  --warn-bg:     #fdf2dc;
  --bad:         #b3261e;
  --bad-bg:      #fdeceb;
  --info:        #1b5e9e;
  --info-bg:     #e8f1fa;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 30, 45, .06), 0 4px 14px rgba(16, 30, 45, .05);

  --c1: #0d5c48; --c2: #1b5e9e; --c3: #9a6300; --c4: #7a3fa0; --c5: #b3261e;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg:          #0f1519;
  --bg-sunk:     #0a0f12;
  --surface:     #161e24;
  --surface-2:   #1c262d;
  --line:        #2a363f;
  --line-strong: #3b4a55;

  --text:        #e6edf3;
  --text-2:      #9fb0be;
  --text-3:      #6f8393;

  --brand:       #2f9e7d;
  --brand-2:     #3fb894;

  --ok:          #4cc38a;  --ok-bg:   #10291e;
  --warn:        #e0a437;  --warn-bg: #2e2312;
  --bad:         #f2635a;  --bad-bg:  #2e1614;
  --info:        #5aa9e6;  --info-bg: #10222f;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);

  --c1: #2f9e7d; --c2: #5aa9e6; --c3: #e0a437; --c4: #b98ede; --c5: #f2635a;

  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать любые display из правил ниже. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------------- шапка */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.topbar__id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__logo {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  border-radius: 8px;
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.topbar__title { font-size: 17px; letter-spacing: -.2px; }
.topbar__sub { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.topbar__actions { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 3px; }
.field--block { width: 100%; }
.field__label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }

.select, .input {
  padding: 7px 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 7px;
  font: inherit; font-size: 13px;
}
.select:focus, .input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

.btn {
  padding: 8px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 7px;
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn--icon { width: 36px; padding: 8px 0; text-align: center; font-size: 15px; }
.btn--sm { padding: 6px 11px; font-size: 12px; }
/* Короткие подписи кнопок включаются на узких экранах. */
.btn__short { display: none; }

/* ------------------------------------------------------------ аномалии */
.alerts {
  margin: 16px 20px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--bad);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.alerts__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.alerts__title { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; }
.alerts__icon { color: var(--bad); font-size: 17px; }
.alerts__count {
  min-width: 24px; padding: 1px 7px;
  background: var(--bad); color: #fff;
  border-radius: 11px; font-size: 12px; font-weight: 700; text-align: center;
}
.alerts__filters { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  padding: 4px 10px;
  background: transparent; color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: 20px;
  font: inherit; font-size: 12px; cursor: pointer;
}
.chip b { font-weight: 700; margin-left: 3px; }
.chip:hover { background: var(--surface); }
.chip--on { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip--high.chip--on { background: var(--bad); border-color: var(--bad); color: #fff; }
.chip--medium.chip--on { background: var(--warn); border-color: var(--warn); color: #fff; }
.chip--low.chip--on { background: var(--info); border-color: var(--info); color: #fff; }

.alerts__list { max-height: 340px; overflow-y: auto; }
.alerts.is-collapsed .alerts__list { display: none; }

.alert {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 0 12px;
  padding: 11px 16px 11px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.alert:last-child { border-bottom: 0; }
.alert:hover { background: var(--surface-2); }
.alert__bar { border-radius: 0 3px 3px 0; }
.alert--high   .alert__bar { background: var(--bad); }
.alert--medium .alert__bar { background: var(--warn); }
.alert--low    .alert__bar { background: var(--info); }
.alert__body { min-width: 0; }
.alert__title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert__msg { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.alert__meta { color: var(--text-3); font-size: 11.5px; margin-top: 4px; }
.alert__val { text-align: right; font-weight: 700; font-size: 15px; white-space: nowrap; align-self: center; }
/* Единица измерения — приглушённая, чтобы не спорить с самой цифрой. */
.alert__unit { margin-left: 4px; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.alert--high   .alert__val { color: var(--bad); }
.alert--medium .alert__val { color: var(--warn); }
.alert--low    .alert__val { color: var(--info); }

.tag {
  padding: 1px 7px; border-radius: 4px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
  background: var(--bg-sunk); color: var(--text-2);
}
.tag--chronic { background: var(--info-bg); color: var(--info); }
.tag--trend   { background: var(--bad-bg);  color: var(--bad); }
.tag--ops     { background: var(--warn-bg); color: var(--warn); }
.tag--quality { background: var(--bg-sunk); color: var(--text-2); }

/* ----------------------------------------------------------------- KPI */
.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 12px;
  padding: 16px 20px 4px;
}
.card, .kpicard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpicard { padding: 13px 15px 14px; position: relative; overflow: hidden; }
.kpicard::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line-strong);
}
.kpicard--ok::before   { background: var(--ok); }
.kpicard--warn::before { background: var(--warn); }
.kpicard--bad::before  { background: var(--bad); }

.kpicard__label {
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
  text-transform: uppercase; letter-spacing: .3px;
  min-height: 28px;
}
.kpicard__value {
  font-size: 27px; font-weight: 700; letter-spacing: -.8px; line-height: 1.1;
  margin-top: 5px;
}
.kpicard__unit { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.kpicard__foot { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; flex-wrap: wrap; font-size: 12px; }
.kpicard__delta { font-weight: 700; }
.kpicard__delta--ok  { color: var(--ok); }
.kpicard__delta--bad { color: var(--bad); }
.kpicard__delta--warn{ color: var(--warn); }
.kpicard__sub { color: var(--text-3); }

/* -------------------------------------------------------------- вкладки */
/* Закреплены под шапкой: панели длинные, вкладки должны оставаться под рукой.
   --header-h выставляется из app.js, т.к. шапка на узких экранах переносится. */
.tabs {
  position: sticky; top: var(--header-h, 66px); z-index: 30;
  display: flex; gap: 2px; overflow-x: auto;
  padding: 14px 20px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { height: 3px; }
.tabs::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.tab {
  position: relative;
  padding: 9px 15px;
  background: transparent; color: var(--text-2);
  border: 0; border-bottom: 2px solid transparent;
  font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab--on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab__badge {
  display: inline-block; min-width: 17px; margin-left: 6px; padding: 0 5px;
  background: var(--bad); color: #fff;
  border-radius: 9px; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}
.tab__badge--medium { background: var(--warn); }
.tab__badge--low    { background: var(--info); }

/* -------------------------------------------------------------- панели */
main { padding: 16px 20px 28px; }
.panel { display: none; }
.panel--on { display: block; }

.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }

.card { margin-bottom: 14px; overflow: hidden; }
.card__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.card__head h2 { font-size: 14px; }
.card__note { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

.chartbox { position: relative; height: 290px; padding: 12px 14px; }
.chartbox canvas { max-width: 100%; }

.tablebox { overflow-x: auto; }
.tablebox--scroll { max-height: 460px; overflow-y: auto; }

/* -------------------------------------------------------------- таблицы */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 12px; text-align: right; white-space: nowrap; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
  border-bottom: 1px solid var(--line-strong);
  text-align: right;
}
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th.t-l, .tbl td.t-l { text-align: left; }
.tbl tbody tr { border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.is-total { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line-strong); }
.tbl tr.is-total:hover { background: var(--surface-2); }
.tbl--compact th, .tbl--compact td { padding: 6px 10px; font-size: 12.5px; }
.tbl .num-bad  { color: var(--bad);  font-weight: 600; }
.tbl .num-ok   { color: var(--ok);   font-weight: 600; }
.tbl .num-warn { color: var(--warn); font-weight: 600; }
.tbl .muted    { color: var(--text-3); }
.tbl caption { caption-side: bottom; padding: 8px 12px; color: var(--text-3); font-size: 11.5px; text-align: left; }

.bar-cell { position: relative; }
.bar-cell__fill {
  position: absolute; left: 0; top: 4px; bottom: 4px;
  background: var(--brand); opacity: .13; border-radius: 3px;
}
.bar-cell > span { position: relative; }

.empty { padding: 22px 16px; color: var(--text-3); font-size: 13px; text-align: center; }

/* --------------------------------------------------------------- подвал */
.foot {
  padding: 14px 20px 26px;
  color: var(--text-3); font-size: 12px;
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.foot__sep { opacity: .5; }

/* ------------------------------------------------------------ ассистент */
.chat {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(440px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 30px rgba(16, 30, 45, .16);
}
.chat__backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(10, 18, 26, .3); }

.chat__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.chat__title { font-weight: 600; font-size: 15px; }
.chat__sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.chat__headbtns { display: flex; gap: 6px; }

.chat__settings { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chat__settings .field { margin-bottom: 10px; }
.chat__settings-actions { display: flex; gap: 8px; }
.chat__hint { margin: 10px 0 0; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

.chat__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.msg { max-width: 92%; font-size: 13.5px; line-height: 1.55; }
.msg--user {
  align-self: flex-end;
  background: var(--brand); color: #fff;
  padding: 9px 13px; border-radius: 12px 12px 3px 12px;
  white-space: pre-wrap;
}
.msg--bot {
  align-self: flex-start;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 13px; border-radius: 12px 12px 12px 3px;
}
.msg--bot h4 { margin: 0 0 6px; font-size: 13.5px; }
.msg--bot p { margin: 0 0 8px; }
.msg--bot p:last-child { margin-bottom: 0; }
.msg--bot ul { margin: 6px 0; padding-left: 19px; }
.msg--bot li { margin-bottom: 4px; }
.msg--bot b, .msg--bot strong { font-weight: 700; }
.msg--bot table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.msg--bot th, .msg--bot td { padding: 4px 7px; border-bottom: 1px solid var(--line); text-align: right; }
.msg--bot th:first-child, .msg--bot td:first-child { text-align: left; }
.msg--err { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.msg--sys { align-self: center; font-size: 11.5px; color: var(--text-3); text-align: center; }
.msg__src { margin-top: 7px; font-size: 11px; color: var(--text-3); }

/* ------------------------------------------------- индикатор «ИИ думает» */
.thinking { display: flex; align-items: center; gap: 9px; }
.dots { display: inline-flex; align-items: center; flex: none; }
.dots span {
  display: inline-block; width: 5px; height: 5px; margin-right: 3px;
  background: var(--brand); border-radius: 50%;
  animation: bounce 1.25s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: .16s; }
.dots span:nth-child(3) { animation-delay: .32s; }
@keyframes bounce {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35%           { opacity: 1;   transform: translateY(-4px); }
}

.thinking__label { color: var(--text-2); font-size: 12.5px; }
.thinking__label.is-swap { animation: swap .34s ease-out; }
@keyframes swap {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Плавное появление готового ответа. */
.msg--reveal { animation: fadein .3s ease-out; }
@keyframes fadein {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .dots span, .thinking__label.is-swap, .msg--reveal { animation: none; }
}

.chat__input:disabled, .chat__form .btn:disabled, .qbtn:disabled {
  opacity: .5; cursor: not-allowed;
}

.chat__quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.qbtn {
  padding: 5px 10px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: 16px;
  font: inherit; font-size: 11.5px; cursor: pointer; text-align: left;
}
.qbtn:hover { background: var(--bg-sunk); color: var(--text); }

.chat__form { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.chat__input {
  flex: 1; padding: 10px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13.5px;
}
.chat__input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.chat__form .btn { width: 44px; font-size: 17px; padding: 0; }

/* ------------------------------------------------------------- адаптив */

/* --- планшет --- */
@media (max-width: 1000px) {
  .topbar { padding: 10px 14px; }
  .topbar__title { font-size: 15px; }
  .kpi { padding: 14px 14px 4px; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
  .kpicard__value { font-size: 24px; }
  main, .tabs { padding-left: 14px; padding-right: 14px; }
  .alerts { margin: 14px 14px 0; }
  .grid--2 { grid-template-columns: 1fr; }
  .chartbox { height: 260px; }
}

/* --- компактная шапка: как только действия перестают помещаться в одну
       строку рядом с заголовком. Шапка залипающая, поэтому каждый лишний
       пиксель здесь — минус к полезной площади экрана. --- */
@media (max-width: 860px) {
  .topbar {
    flex-direction: column; align-items: stretch; gap: 8px;
    padding: 8px 12px;
  }
  .topbar__logo { width: 32px; height: 32px; font-size: 11px; border-radius: 7px; }
  .topbar__title { font-size: 14px; line-height: 1.25; }
  .topbar__sub { font-size: 11.5px; }
  .topbar__actions { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; }
  .topbar__actions .field { min-width: 0; }
  .topbar__actions .select { width: 100%; padding: 6px 8px; }
  .field__label { display: none; }          /* дата и так видна в самом списке */
  .btn { padding: 6px 9px; font-size: 12px; }
  .btn--icon { width: 32px; padding: 6px 0; }
  .btn__full { display: none; }
  .btn__short { display: inline; }
}

/* --- смартфон --- */
@media (max-width: 700px) {
  body { font-size: 13.5px; }
  .topbar__title { font-size: 13.5px; }
  .topbar__sub { font-size: 11px; }

  /* KPI: две колонки — цифры остаются крупными и читаемыми. */
  .kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px 12px 4px; }
  .kpicard { padding: 10px 11px 11px; }
  .kpicard__label { font-size: 10.5px; letter-spacing: .2px; min-height: 26px; }
  .kpicard__value { font-size: 20px; letter-spacing: -.5px; }
  .kpicard__unit { font-size: 11px; }
  .kpicard__foot { font-size: 11px; gap: 6px; margin-top: 5px; }

  /* Аномалии: значение уходит под текст. */
  .alerts { margin: 12px 12px 0; border-radius: 8px; }
  .alerts__head { padding: 10px 12px; }
  .alerts__title { font-size: 14px; }
  .alerts__filters { gap: 5px; }
  .chip { padding: 4px 8px; font-size: 11px; }
  .alerts__list { max-height: 240px; }
  .alert { grid-template-columns: 4px 1fr; padding: 10px 12px 10px 0; gap: 0 10px; }
  .alert__title { font-size: 13px; }
  .alert__msg { font-size: 12.5px; }
  .alert__val { grid-column: 2; text-align: left; margin-top: 6px; font-size: 14px; }

  main, .tabs { padding-left: 12px; padding-right: 12px; }
  .tabs { padding-top: 10px; }
  .tab { padding: 8px 11px; font-size: 12.5px; }

  .grid { gap: 10px; margin-bottom: 10px; }
  .card { margin-bottom: 10px; }
  .card__head { padding: 10px 12px; flex-wrap: wrap; gap: 4px 10px; }
  .card__head h2 { font-size: 13px; }
  .card__note { font-size: 11px; white-space: normal; }
  .chartbox { height: 230px; padding: 10px 8px; }

  /* Таблицы: горизонтальная прокрутка + закреплённая первая колонка,
     иначе на узком экране теряется, к какой строке относятся цифры. */
  .tablebox { -webkit-overflow-scrolling: touch; }
  .tbl { font-size: 12px; }
  .tbl th, .tbl td { padding: 7px 9px; }
  .tbl--compact th, .tbl--compact td { padding: 6px 8px; font-size: 11.5px; }
  .tbl th:first-child, .tbl td:first-child {
    position: sticky; left: 0; z-index: 2;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--line);
  }
  .tbl th:first-child { z-index: 3; background: var(--surface-2); }
  .tbl tbody tr:hover td:first-child { background: var(--surface-2); }
  .tbl tr.is-total td:first-child { background: var(--surface-2); }
  .tbl caption { font-size: 11px; padding: 8px 10px; }

  /* Чат на весь экран. */
  .chat { width: 100vw; border-left: 0; }
  .chat__head { padding: 11px 12px; }
  .chat__log { padding: 12px; gap: 10px; }
  .msg { max-width: 96%; font-size: 13px; }
  .msg--bot table { font-size: 11.5px; }
  .msg--bot th, .msg--bot td { padding: 4px 5px; }
  .chat__quick { padding: 0 12px 8px; max-height: 92px; overflow-y: auto; }
  .qbtn { font-size: 11px; padding: 5px 9px; }
  .chat__form { padding: 10px 12px 14px; }

  .foot { padding: 12px 12px 22px; font-size: 11.5px; }
}

/* --- очень узкий экран (iPhone SE и уже) --- */
@media (max-width: 340px) {
  .kpi { grid-template-columns: 1fr; }
  .kpicard__label { min-height: 0; }
  .kpicard__value { font-size: 22px; }
}

/* Экран ниже 480px в альбомной ориентации — ужимаем графики. */
@media (max-height: 480px) and (orientation: landscape) {
  .chartbox { height: 200px; }
  .alerts__list { max-height: 180px; }
}

/* --------------------------------------------------------------- печать */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; color: #000; font-size: 10px; }
  .topbar { position: static; box-shadow: none; border-bottom: 2px solid #000; }
  .topbar__actions, .tabs, .chat, .chat__backdrop, .btn, .alerts__filters { display: none !important; }
  .card, .kpicard, .alerts { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .panel { display: block !important; break-before: page; }
  .panel[data-panel="overview"] { break-before: auto; }
  .kpi { grid-template-columns: repeat(4, 1fr); }
  .kpicard__value { font-size: 17px; }
  .chartbox { height: 200px; }
  .alerts__list { max-height: none; overflow: visible; }
  .tablebox, .tablebox--scroll { max-height: none; overflow: visible; }
  .foot { border-top: 1px solid #999; }
}
