/* ══════════════════════════════════════════
   DecOrg — стили. Цвета — переменные в :root.
══════════════════════════════════════════ */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f4f1ec;
  --line: #e7e2da;
  --text: #22201c;
  --muted: #847d72;
  --accent: #2f5d50;
  --accent-soft: #e6efeb;
  --pos: #2e7d4f;
  --neg: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(34, 32, 28, .05), 0 4px 16px rgba(34, 32, 28, .04);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); }
h1 { font-size: 26px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
[hidden] { display: none !important; }

/* ── Шапка ── */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left));
  background: rgba(250, 248, 245, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand span, .auth-brand span { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topnav { display: flex; gap: 4px; margin-right: auto; margin-left: 12px; }
.topnav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.topnav a:hover { color: var(--text); }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.studio { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.page { max-width: 1120px; margin: 0 auto; padding: 20px 16px 64px; }

.demo-banner {
  padding: 8px 16px; text-align: center; font-size: 13px; line-height: 1.4;
  background: #fff4dc; color: #6b4e12; border-bottom: 1px solid #f0dfb4;
}

/* ── Кнопки и поля ── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer;
}
.btn:hover { border-color: #cfc8bd; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.danger-text { color: var(--neg); }
.btn-link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); }
.field em { font-style: normal; opacity: .8; }

input, textarea {
  width: 100%; min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.form-error { color: var(--neg); margin: 0 0 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Вход ── */

.auth { max-width: 400px; margin: 6vh auto 0; }
.auth-brand { font-weight: 700; font-size: 34px; text-align: center; letter-spacing: -.02em; }
.auth-lead { text-align: center; color: var(--muted); margin: 6px 0 22px; }
.auth-card { padding: 24px; }
.auth-card h1 { font-size: 22px; margin-bottom: 16px; }
.auth-switch { text-align: center; margin: 14px 0 0; color: var(--muted); }

/* ── Список мероприятий ── */

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-color: var(--accent); font-weight: 500; }

.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.event-card { display: block; padding: 16px 18px; color: inherit; text-decoration: none; transition: border-color .15s; }
.event-card:hover { border-color: #cfc8bd; }
.event-date { color: var(--accent); font-size: 13px; font-weight: 500; }
.event-title { font-size: 17px; font-weight: 600; margin: 2px 0; overflow-wrap: anywhere; }
.event-place { color: var(--muted); font-size: 14px; }
.event-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.event-nums dt { font-size: 12px; color: var(--muted); }
.event-nums dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 40px 16px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); grid-column: 1 / -1; }

/* ── Окна ── */

.dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); color: var(--text); }
.dialog::backdrop { background: rgba(34, 32, 28, .35); }
.dialog-body { padding: 22px; }
.dialog-body h2 { margin-bottom: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Карточка мероприятия ── */

.back { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.event-head { padding: 18px; margin-bottom: 14px; }
.title-input { font-size: 22px; font-weight: 600; border-color: transparent; padding: 6px 8px; margin: -6px -8px 10px; width: calc(100% + 16px); }
.title-input:hover { border-color: var(--line); }
.head-grid { display: grid; grid-template-columns: 170px 120px 1fr; gap: 10px; }
.head-grid .span2 { grid-column: auto; }
.event-head .field:last-child { margin-bottom: 0; }

.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.tile.accent { background: var(--accent-soft); border-color: transparent; }
.tile-label { font-size: 12px; color: var(--muted); }
.tile-value { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-hint { font-size: 11px; color: var(--muted); line-height: 1.25; }
.tile-input { border-color: var(--accent); }
.tile-input .money-field input { font-size: 18px; font-weight: 650; padding: 4px 26px 4px 6px; }

.money-field { position: relative; display: block; }
.money-field input { text-align: right; padding-right: 26px; font-variant-numeric: tabular-nums; }
.money-field i { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); pointer-events: none; }

/* ── Смета ── */

.estimate { padding: 16px 18px; }
.estimate-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

.est-row {
  display: grid;
  grid-template-columns: 28px minmax(130px, 1fr) minmax(160px, 1.8fr) 250px 126px 96px 92px;
  gap: 8px; align-items: start;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.est-row > div, .est-row > label { min-width: 0; }
.est-header { font-size: 12px; color: var(--muted); padding-top: 0; }
.est-header .c-plan, .est-header .c-fact, .est-total .c-plan, .est-total .c-fact { text-align: right; }
.c-num { color: var(--muted); padding-top: 9px; font-variant-numeric: tabular-nums; }
.c-when { display: grid; grid-template-columns: 1fr 96px; gap: 6px; }
/* Пустые дата и время — бледные, чтобы «дд.мм.гггг» не шумело */
.is-empty { color: #b8b1a6; }
.c-fact { text-align: right; padding-top: 9px; font-variant-numeric: tabular-nums; }
.c-tools { display: flex; gap: 2px; justify-content: flex-end; padding-top: 4px; }
.est-row .cap { display: none; }
.est-row textarea { min-height: 40px; overflow: hidden; resize: none; }
.est-total { font-weight: 650; border-bottom: 0; font-variant-numeric: tabular-nums; }
.est-empty { padding: 18px 0; border-bottom: 1px solid var(--line); }

.icon-btn { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.del:hover { color: var(--neg); }

.add-row { margin-top: 12px; }
.event-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.actions-left { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Общие мелочи для склада ── */

.lead { margin: -6px 0 14px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.row3 { display: grid; grid-template-columns: 1fr 80px 1.2fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0 0 12px; cursor: pointer; }
.check input { width: auto; margin: 0; accent-color: var(--accent); }
select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--text); font: inherit;
}
select:disabled { opacity: .6; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; margin-bottom: 14px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font: inherit; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.fixed-target { margin: 0 0 12px; padding: 8px 12px; background: var(--accent-soft); border-radius: 9px; font-weight: 500; }

/* ── Факт в смете: кнопка суммы и список расходов статьи ── */

.fact-btn {
  border: 0; background: none; padding: 6px 4px; margin: -6px -4px 0 0; border-radius: 7px;
  font: inherit; font-variant-numeric: tabular-nums; color: var(--text); cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.fact-btn:hover { background: var(--surface-2); }
.fact-btn.empty { color: var(--accent); text-decoration: none; font-size: 14px; }
.fact-btn.neg { color: var(--neg); }

.est-exp { margin: -1px 0 0; padding: 10px 12px 12px; background: var(--surface-2); border-radius: 0 0 10px 10px; border-bottom: 1px solid var(--line); }
.exp-row { display: grid; grid-template-columns: 64px 1fr minmax(100px, auto) 110px 30px; gap: 8px; align-items: center; padding: 4px 0; font-size: 14px; }
.exp-date { color: var(--muted); }
.exp-sup { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-sup:hover { color: var(--accent); text-decoration: underline; }
.exp-sum { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.exp-empty { margin: 2px 0 6px; }
.exp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ── Склад: списки ── */

.stock-total { margin: 0 0 12px; }
.stock-list { display: flex; flex-direction: column; gap: 10px; }
.stock-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: inherit; text-decoration: none; }
a.stock-row:hover { border-color: #cfc8bd; }
.stock-main { flex: 1; min-width: 0; }
.stock-name { font-weight: 600; overflow-wrap: anywhere; }
.stock-from { text-decoration: none; }
.stock-from:hover { text-decoration: underline; }
.stock-left { text-align: right; white-space: nowrap; }
.stock-sum { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Карточка покупки ── */

.purchase-grid { grid-template-columns: 170px 1fr; }
.pl-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.6fr) 90px 70px 130px 112px minmax(190px, 1fr) 32px;
  gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.pl-row > * { min-width: 0; }
.pl-row .cap { display: none; }
.pl-qty input { text-align: right; }
.pl-own { margin: 0; font-size: 13px; color: var(--muted); }
.pl-left { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.pl-allocs { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; padding-left: 4px; }
.alloc { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.alloc a { text-decoration: none; }
.alloc a:hover { text-decoration: underline; }
.alloc .icon-btn { width: 26px; height: 26px; }
.p-totals { margin-top: 14px; color: var(--muted); }
.p-totals b { color: var(--text); }

.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.photo { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.photo-open { width: 100%; height: 100%; border: 0; padding: 0; cursor: zoom-in; background: var(--surface-2) center / cover no-repeat; }
.photo-open .pdf { font-weight: 700; color: var(--muted); }
.photo-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; line-height: 1; }
.photo-add { display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--accent); font-weight: 500; border-style: dashed; background: var(--surface); }

/* ── Распознавание и черновик покупки ── */

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions label.btn { cursor: pointer; }
.head-actions .btn.busy { opacity: .6; pointer-events: none; }
.rec-status { margin: -4px 0 12px; padding: 8px 12px; border-radius: 9px; background: var(--accent-soft); }
.rec-status.form-error { background: #fbe9e7; }
.recognize-box { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.recognize-box .btn { cursor: pointer; }
.recognize-box .btn.busy { opacity: .6; pointer-events: none; }
.recognize-box p { margin: 6px 0 0; }
.dialog:has(.draft) { width: min(720px, calc(100vw - 32px)); }
.draft-lines { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 45vh; overflow-y: auto; }
.draft-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 58px 112px auto 30px; gap: 6px; align-items: center; }
.draft-row .check { margin: 0; font-size: 13px; color: var(--muted); }
.draft-row input { padding: 7px 9px; }
.draft-row .money-field input { padding-right: 24px; }
.draft-total { margin: 10px 0 6px; color: var(--muted); }
.draft-total b { color: var(--text); }

/* ── Команда и вид помощника ── */

.section-title { margin: 22px 0 10px; font-size: 16px; }
.stock-row.is-off { opacity: .6; }
.invite-link { margin: 4px 0 6px; font-size: 14px; }
.helper-title { font-size: 22px; margin-bottom: 4px; }
.event-head p { margin: 6px 0 0; }
.pre { white-space: pre-wrap; }
.helper-item { display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.helper-item:last-child { border-bottom: 0; }
.hi-num { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Задачи ── */

.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--neg); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; margin-left: 2px; vertical-align: 1px; }
.task { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 8px; align-items: start; padding: 7px 0;
  border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task-check { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.task-title { border: 0; background: none; padding: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.task-title:hover { color: var(--accent); }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task.mine .task-title { font-weight: 600; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; font-size: 13px; color: var(--muted); }
.task-meta a { color: var(--muted); text-decoration: none; }
.task-meta a:hover { color: var(--accent); text-decoration: underline; }
.due { white-space: nowrap; }
.due.late { color: var(--neg); font-weight: 600; }
.who { white-space: nowrap; padding: 0 6px; border-radius: 6px; background: var(--surface-2); }
.task-chip { display: block; margin: 4px 0 0 auto; border: 0; background: var(--surface-2); color: var(--muted); border-radius: 7px;
  padding: 1px 7px; font: inherit; font-size: 12px; cursor: pointer; }
.task-chip.all-done { color: var(--pos); }
.exp-sub { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 2px; }
.exp-sub:not(:first-child) { margin-top: 14px; }
.est-exp .task { border-color: #e2ddd4; }
.hi-tasks { margin-top: 6px; }
.task-group { padding: 12px 16px; margin-bottom: 12px; }
.task-group h2 { font-size: 15px; margin-bottom: 4px; }
.task-group h2.late { color: var(--neg); }
.quick-due { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.push-left { margin-right: auto; }

/* ── Механика и страница бригады ── */

.mech-day { margin-bottom: 14px; }
.mech-date { font-weight: 600; color: var(--accent); margin: 6px 0 4px; }
.mech-step { display: grid; grid-template-columns: 56px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, auto); gap: 4px 12px; padding: 7px 0;
  border-bottom: 1px solid var(--line); align-items: start; }
.mech-step:last-child { border-bottom: 0; }
.mech-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.mech-what { overflow-wrap: anywhere; }
.mech-edit { border: 0; background: none; padding: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.mech-edit:hover { color: var(--accent); }
.mech-step.from-est .mech-what > span:first-child { color: var(--muted); }
.mech-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--accent-soft);
  color: var(--accent); font-size: 11px; vertical-align: 1px; }
.mech-where { color: var(--muted); font-size: 14px; }
.mech-who { text-align: right; font-size: 13px; }
.mech-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.crew-link { font-size: 14px; color: var(--muted); }
.crew-link .btn-link, .crew-link a { font-size: 14px; padding: 0; }
.crew { max-width: 760px; margin: 0 auto; }
.crew-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

@media print {
  .topbar, .demo-banner, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

/* ── Окно «Взять со склада» ── */

.fs-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.fs-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.fs-row:hover { border-color: var(--accent); }
.fs-left { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 500; }

/* ── Сообщение внизу ── */

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 10px; background: var(--text); color: #fff;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--neg); }

/* ── Планшет ── */

@media (max-width: 1000px) {
  .summary { grid-template-columns: repeat(3, 1fr); }
  .summary .tile-input { grid-column: 1 / -1; }
}

/* ── Телефон: статьи сметы — карточками ── */

@media (max-width: 760px) {
  h1 { font-size: 22px; }
  .head-grid { grid-template-columns: 1fr 1fr; }
  .head-grid .span2 { grid-column: 1 / -1; }
  .summary { grid-template-columns: 1fr 1fr; }
  .estimate { padding: 14px; }

  .est-header { display: none; }
  .est-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "num tools"
      "title title"
      "desc desc"
      "when when"
      "plan fact";
    gap: 8px 10px; padding: 12px 0;
  }
  .est-row .cap { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
  .est-row .c-when .cap { grid-column: 1 / -1; margin-bottom: 0; }
  .c-num { grid-area: num; padding-top: 4px; }
  .c-title { grid-area: title; }
  .c-desc { grid-area: desc; }
  .c-when { grid-area: when; grid-template-columns: 1fr 110px; }
  .c-plan { grid-area: plan; }
  .c-fact { grid-area: fact; padding-top: 0; }
  .c-tools { grid-area: tools; padding-top: 0; }
  .est-total { grid-template-areas: "title plan" "title fact"; grid-template-columns: 1fr auto; }
  .est-total .c-num, .est-total .c-desc, .est-total .c-when, .est-total .c-tools { display: none; }
  .est-total .c-fact::before { content: "Факт "; font-weight: 400; color: var(--muted); }
  .est-total .c-plan::before { content: "План "; font-weight: 400; color: var(--muted); }
  .event-actions .btn, .actions-left { width: 100%; }

  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topnav { order: 3; width: 100%; margin: 0 -10px; }
  .studio { display: none; }
  .topnav { overflow-x: auto; scrollbar-width: none; gap: 0; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { padding: 6px 8px; white-space: nowrap; }
  .task { grid-template-columns: 22px minmax(0, 1fr); }
  .mech-step { grid-template-columns: 48px minmax(0, 1fr); }
  .mech-where, .mech-who { grid-column: 2; text-align: left; }
  .task-meta { grid-column: 2; justify-content: flex-start; }

  .exp-row { grid-template-columns: 1fr auto 30px; grid-template-areas: "name sum del" "date sup sup"; row-gap: 0; }
  .exp-name { grid-area: name; } .exp-sum { grid-area: sum; } .exp-row .del { grid-area: del; }
  .exp-date { grid-area: date; font-size: 13px; } .exp-sup { grid-area: sup; font-size: 13px; }

  .purchase-grid { grid-template-columns: 1fr; }
  .pl-row {
    grid-template-columns: 1fr 70px 1fr;
    grid-template-areas: "name name tools" "qty unit amount" "own own own" "left left left" "allocs allocs allocs";
    padding: 12px 0;
  }
  .pl-row .cap { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
  .pl-name { grid-area: name; } .pl-qty { grid-area: qty; } .pl-unit { grid-area: unit; } .pl-amount { grid-area: amount; }
  .pl-own { grid-area: own; } .pl-left { grid-area: left; } .pl-tools { grid-area: tools; align-self: end; }
  .pl-allocs { grid-area: allocs; }
  .stock-row { flex-wrap: wrap; }
  .stock-row .btn { width: 100%; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .row3 { grid-template-columns: 1fr 70px; }
  /* телефон: название — во всю ширину; кол-во, ед., сумма, × — в ряд; «свой» — ниже */
  .draft-row { grid-template-columns: 64px 52px minmax(0, 1fr) 30px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .draft-row > input:first-child { grid-column: 1 / -1; }
  .draft-row [data-d-del] { order: 4; }
  .draft-row .check { order: 5; grid-column: 1 / -1; }
  .row3 .field:last-child { grid-column: 1 / -1; }
}

@media (max-width: 380px) {
  .event-nums { grid-template-columns: 1fr 1fr; }
}
