/* Сметы — мобильный интерфейс.
   Порядок: переменные, база, компоненты, экраны, печать.
   Мобильный-first: базовые правила — для телефона, @media — для широких экранов. */

:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #dfe4ec;
  --text: #1b2430;
  --muted: #6a7686;
  --brand: #1f3a5f;
  --brand-light: #2d5488;
  --accent: #0b7a5a;
  --accent-light: #0e9b72;
  --danger: #b42318;
  --danger-light: #d64545;
  --warn: #8a5b00;
  --warn-bg: #fff4d6;
  --radius: 12px;
  --radius-sm: 8px;
  --tap: 44px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .08);
  --tabbar-h: 58px;
  --actionbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  /* Мобильные браузеры подсвечивают поля при тапе — отключаем. */
  -webkit-tap-highlight-color: transparent;
}

body.page--with-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
body.page--with-actionbar { padding-bottom: calc(var(--actionbar-h) + env(safe-area-inset-bottom)); }
body.page--with-tabbar.page--with-actionbar {
  padding-bottom: calc(var(--tabbar-h) + var(--actionbar-h) + env(safe-area-inset-bottom));
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
p { margin: 0 0 8px; }
a { color: var(--brand-light); text-decoration: none; }
code { font-size: .92em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

/* --- Шапка ------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--brand);
  color: #fff;
  padding-top: calc(8px + env(safe-area-inset-top));
}

.topbar__brand { display: flex; align-items: center; gap: 8px; color: #fff; }
.topbar__logo { font-size: 20px; }
.topbar__title { font-weight: 700; letter-spacing: .2px; }
.topbar__nav { display: flex; gap: 10px; margin-left: auto; font-size: 14px; }
.topbar__nav a { color: rgba(255, 255, 255, .85); }
.topbar__nav a:hover { color: #fff; }
.topbar__logout { margin-left: 4px; }
.topbar .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .4); }

/* --- Нижняя навигация ------------------------------------------------------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
}
.tabbar__icon { font-size: 20px; line-height: 1; }
.tabbar__item.is-active { color: var(--brand); font-weight: 600; }
.tabbar__item--accent { color: var(--accent); font-weight: 600; }

/* --- Страница --------------------------------------------------------------- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 12px 24px;
}

.page-title { font-size: 22px; font-weight: 700; }
.section-title { font-size: 15px; color: var(--muted); margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .6px; }
.muted { color: var(--muted); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden, [hidden] { display: none !important; }

/* --- Кнопки ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger-ghost { color: var(--danger); border-color: #f0c8c4; background: #fff; }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 36px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn--lg { min-height: 50px; font-size: 16px; }
.btn--block { display: flex; width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions--sticky { position: sticky; bottom: 0; padding: 8px 0; background: var(--bg); }
.inline { display: inline-flex; }

/* --- Поля ------------------------------------------------------------------- */

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  color: var(--text);
}
.input:focus { outline: 2px solid var(--brand-light); outline-offset: -1px; }
.input--sm { min-height: 36px; font-size: 13px; padding: 4px 8px; }
textarea.input { min-height: 80px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.checkbox { width: 20px; height: 20px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field--tight { margin-bottom: 0; }
.field--name { margin: 6px 0; }
.req { color: var(--danger); }
.help { color: var(--muted); font-size: 12px; }
.help--block { margin: 4px 0 0; }
.error { color: var(--danger); font-size: 12px; }
.field--error .input { border-color: var(--danger); background: #fff6f5; }

.grid { display: grid; gap: 0 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* --- Сообщения -------------------------------------------------------------- */

.messages { padding: 8px 12px 0; max-width: 1180px; margin: 0 auto; }
.message {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  border: 1px solid transparent;
}
.message--success { background: #e8f6f0; border-color: #b9e3d1; color: #0a5f45; }
.message--error { background: #fdecea; border-color: #f4c7c3; color: #8f1a12; }
.message--warning { background: var(--warn-bg); border-color: #f0dca6; color: var(--warn); }
.message--info { background: #eaf1fa; border-color: #c6d8ef; color: var(--brand); }
.message + .message { margin-top: -2px; }

/* --- Панели ----------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.panel--flush { padding: 0; }
.panel > legend, .panel__title { font-size: 15px; font-weight: 700; }
.panel__title { margin: 0; }
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.panel__actions { display: flex; gap: 6px; }
details.panel > summary, .line__more > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 2px 0;
}
details.panel > summary { list-style: none; position: relative; padding-left: 18px; }
details.panel > summary::before { content: "▸"; position: absolute; left: 0; transition: transform .15s; }
details.panel[open] > summary::before { transform: rotate(90deg); }
details.panel > *:not(summary) { margin-top: 12px; }
.panel__title + .grid, .panel__title + .field { margin-top: 10px; }

.counter {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* --- Карточки списка -------------------------------------------------------- */

.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}
.card:active { background: var(--surface-2); }
.card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card__title { font-weight: 700; }
.card__sub { font-size: 14px; }
.card__meta, .card__date { font-size: 12px; color: var(--muted); }
.card__date--warn { color: var(--warn); }
.card__bottom { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 4px; }
.card__sum { font-weight: 700; font-size: 16px; color: var(--brand); }
.card__tags { font-size: 12px; color: var(--muted); }
.warn-dot {
  display: inline-block;
  width: 16px; height: 16px; margin-left: 4px;
  border-radius: 50%;
  background: var(--warn-bg);
  border: 1px solid #e3c374;
  color: var(--warn);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 14px;
}

.badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge--draft { background: #f0f2f5; color: #5b6472; }
.badge--issued { background: #eaf1fa; color: var(--brand-light); border-color: #c6d8ef; }
.badge--agreed { background: #e8f6f0; color: #0a5f45; border-color: #b9e3d1; }
.badge--closed { background: #efe9fb; color: #4b2f8f; border-color: #d5c9f0; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.tag--warn { color: var(--warn); border-color: #e3c374; background: var(--warn-bg); }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat__value { display: block; font-size: 20px; font-weight: 700; color: var(--brand); }
.stat__label { font-size: 12px; color: var(--muted); }

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

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters .input { flex: 1 1 160px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* --- Фотогалерея ------------------------------------------------------------ */

.upload__actions { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px; }
.upload__btn {
  /* 56 px — минимум, за который не промахиваются пальцем в перчатке */
  min-height: 56px; justify-content: center; align-items: center;
  font-size: 16px; cursor: pointer;
}
.upload__icon { font-size: 20px; }
/* Сам input прячем, но не `display:none`: иначе iOS не откроет камеру */
.upload__input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.upload__picked {
  font-size: 13px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; margin-bottom: 10px; word-break: break-word;
}
.upload__picked.is-error { color: var(--danger); border-color: var(--danger); background: #fdf0ef; }

.upload__progress { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 10px; }
.upload__bar {
  flex: 1; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden;
}
.upload__bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.gallery {
  display: grid;
  /* Две колонки на телефоне: на 390 px это ~180 px на фото — достаточно,
     чтобы узнать, что на снимке, и не листать список по одному */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 620px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.photo {
  position: relative; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.photo__link { display: block; background: #f2f4f7; }
.photo__img {
  display: block; width: 100%; height: 140px; object-fit: cover; background: #f2f4f7;
}
@media (min-width: 620px) { .photo__img { height: 180px; } }

.photo__meta { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.photo__meta input[type="text"] { font-size: 14px; }
.photo__meta input[type="date"] { font-size: 13px; padding: 6px 8px; }
.photo__size { font-size: 11px; color: var(--muted); }

.photo__remove {
  position: absolute; top: 6px; right: 6px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .92);
  color: var(--danger); font-size: 16px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.photo__remove:active { background: #fdf0ef; }

.empty__icon { font-size: 40px; margin: 0 0 8px; }
.empty__text { margin: 0; }

/* --- Экран сметы ------------------------------------------------------------ */

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.detail-head__number { font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.detail-head__title { font-size: 19px; }
.detail-head__meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); align-items: center; }

.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.status-switch { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.status-switch .input { width: auto; }

/* --- Калькулятор ------------------------------------------------------------ */

.calc {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.calc__total { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.calc__label { font-size: 12px; opacity: .8; }
.calc__value { font-size: 28px; font-weight: 700; margin-left: auto; }
.calc__unit { font-size: 14px; opacity: .8; }
.calc__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 10px; margin-top: 10px; font-size: 13px; }
.calc__grid div { display: flex; justify-content: space-between; gap: 8px; }
.calc__grid span { opacity: .8; }
.calc__details { margin-top: 10px; }
.calc__details > summary { cursor: pointer; font-size: 13px; opacity: .9; }
.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.calc__details .calc-table { margin-top: 8px; }
.calc-table td { padding: 3px 0; vertical-align: top; }
.calc-table td:last-child { text-align: right; white-space: nowrap; padding-left: 10px; }
.calc-table__sub td { border-top: 1px solid rgba(127, 127, 127, .3); font-weight: 600; padding-top: 6px; }
.calc-table__total td { font-weight: 700; font-size: 15px; border-top: 2px solid currentColor; padding-top: 6px; }
.panel .calc-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; }
.panel .calc-table td:last-child { font-weight: 600; }

/* --- Строки позиций --------------------------------------------------------- */

.lines { display: flex; flex-direction: column; }

.line, .stage {
  position: relative;
  /* правый отступ зарезервирован под кнопку удаления (40px + зазор) */
  padding: 10px 50px 10px 12px;
  border-bottom: 1px solid var(--line);
}
.line:last-child, .stage:last-child { border-bottom: 0; }
.line--saved { background: var(--surface); }
.line[data-has-errors], .stage[data-has-errors] { background: #fff7f6; }
.line__head { display: flex; align-items: center; gap: 8px; }
.line__num {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.line__fields { display: grid; grid-template-columns: 1fr 76px; gap: 6px; flex: 1; }
.line__fields .input, .line__fields select { min-height: 36px; font-size: 13px; padding: 4px 8px; }
.line__nums { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 6px; align-items: end; }
.line__nums .field { margin-bottom: 0; }
.line__nums .input { min-height: 40px; }
.line__sum { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding-left: 6px; }
.line__sum span { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.line__sum b { font-size: 14px; color: var(--brand); white-space: nowrap; }
.line__more { margin-top: 8px; }
.line__more > summary { font-size: 12px; color: var(--muted); }
.line__remove {
  position: absolute;
  top: 6px; right: 6px;
  /* Палец на телефоне промахивается мимо 30px: держим кнопку крупной */
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.line__remove:active { background: #fdecea; color: var(--danger); }
/* Чекбокс DELETE из formset'а — служебное поле: им управляет кнопка ✕.
   Прячем, но оставляем в DOM — без него сервер не узнает об удалении. */
.line input[name$="-DELETE"],
.stage input[name$="-DELETE"] { display: none; }
.line--compact .line__nums { grid-template-columns: repeat(5, 1fr); }
.stage__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stage__grid .field { margin-bottom: 0; }

/* --- Прайс ------------------------------------------------------------------ */

.price-list { list-style: none; margin: 0; padding: 0; }
.price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.price:last-child { border-bottom: 0; }
.price__main { display: flex; flex-direction: column; gap: 2px; color: var(--text); min-width: 0; }
.price__name { font-weight: 600; }
.price__unit, .price__code { font-size: 12px; color: var(--muted); }
.price__value { text-align: right; white-space: nowrap; display: flex; flex-direction: column; }
.price__value b { color: var(--brand); }

.pre {
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
}

/* --- Таблицы просмотра ------------------------------------------------------ */

.sheet { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); padding: 4px; }
.sheet td { padding: 6px 4px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
.sheet .num { text-align: right; white-space: nowrap; }
.kv { margin: 0; }
.kv__row { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--surface-2); }
.kv__row:last-child { border-bottom: 0; }
.kv dt { flex: 0 0 40%; color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; }
.prose { white-space: normal; }

/* --- Нижняя панель действия -------------------------------------------------- */

.actionbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
body.page--with-tabbar .actionbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.actionbar__total { display: flex; flex-direction: column; }
.actionbar__total span { font-size: 11px; color: var(--muted); }
.actionbar__total b { font-size: 18px; color: var(--brand); }
.actionbar .btn { margin-left: auto; }

/* --- Модальные окна ---------------------------------------------------------- */

.modal {
  width: min(560px, calc(100vw - 24px));
  max-height: 82vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(16, 24, 40, .25);
}
.modal::backdrop { background: rgba(16, 24, 40, .5); }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 { font-size: 16px; margin: 0; }
.modal__body { padding: 12px; overflow-y: auto; max-height: calc(82vh - 56px); }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.modal__list { margin-top: 10px; display: flex; flex-direction: column; }
.modal__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.modal__item:active { background: var(--surface-2); }
.modal__item-name { font-weight: 600; }
.modal__item-meta { font-size: 12px; color: var(--muted); }
.modal__item-price { font-weight: 700; color: var(--brand); white-space: nowrap; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; }
.chip {
  flex: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--actionbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 16px;
  border-radius: 10px;
  background: #1b2430;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.toast.is-visible { opacity: 1; }

/* --- Вход -------------------------------------------------------------------- */

.page--login { display: grid; place-items: center; min-height: 100vh; background: var(--brand); }
.login { width: 100%; padding: 16px; }
.login__box { max-width: 400px; margin: 0 auto; background: var(--surface); border-radius: 16px; padding: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.login__logo { font-size: 34px; text-align: center; }
.login__title { font-size: 17px; text-align: center; margin-bottom: 16px; }

/* --- Широкие экраны ------------------------------------------------------------ */

@media (min-width: 720px) {
  .page { padding: 16px 20px 32px; }
  .calc__grid { grid-template-columns: repeat(4, 1fr); }
  .page-title { font-size: 26px; }
}

@media print {
  .topbar, .tabbar, .actionbar, .toolbar, .status-switch { display: none !important; }
  body { background: #fff; }
}