/* Салденс Мясо — компоновка «журнал». Две темы: «Луг» (светлая, по умолчанию) и «Тёплый вечер» (тёмная).
   Цвета — только здесь; переключатель в меню пишет html[data-theme] и куку theme. */
:root, [data-theme="meadow"] {
  color-scheme: light;
  --bg: #eef3ea;
  --panel: #ffffff;
  --panel-shadow: 0 1px 2px rgba(31, 42, 34, .06), 0 2px 10px rgba(31, 42, 34, .05);
  --nav: #2f5d45;
  --line: #dde7d6;
  --field: #ffffff;
  --field-line: #c6d4bd;
  --text: #1f2a22;
  --muted: #536357;
  --dim: #738378;
  --accent: #f5b731;
  --accent-ink: #2a1d00;
  --accent-soft: #fff4d4;
  --alarm: #d9472b;
  --ok: #23804a;
  --link: #23704a;
  --link-hover: #164f33;
  --warn: #9a5c00;
  --nav-text: #eef6ef;
  --nav-dim: #a9c6b3;
  --nav-line: #264d39;
  --nav-hover: #3b6f54;
  --brand: #ffd062;
  --alarm-text: #b93a1f;
  --alarm-soft: #fbe3dc;
  --on-alarm: #fff;
  --done: #cfd9cb;
  --done-ink: #2c362e;
  --radius: 18px;
}
[data-theme="evening"] {
  color-scheme: dark;
  --bg: #2b251f;
  --panel: #3a322a;
  --panel-shadow: none;
  --nav: #231e19;
  --line: #4d4339;
  --field: #2b251f;
  --field-line: #5f5246;
  --text: #fbf4ea;
  --muted: #ddcfbd;
  --dim: #bba995;
  --accent: #ffb547;
  --accent-ink: #2a1a00;
  --accent-soft: #4a3d2e;
  --alarm: #ff6b4a;
  --ok: #a3e4ae;
  --link: #ffbf5e;
  --link-hover: #ffd896;
  --warn: #ffbf5e;
  --nav-text: #fbf4ea;
  --nav-dim: #bba995;
  --nav-line: #3a3129;
  --nav-hover: #3a3129;
  --brand: #ffb547;
  --alarm-text: #ffa189;
  --alarm-soft: #4d2c23;
  --on-alarm: #fff;
  --done: #6e6052;
  --done-ink: #fbf4ea;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Golos Text', system-ui, sans-serif; font-size: 17px; line-height: 1.45;
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1 { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.15; }
h2.cap {
  margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}

/* Каркас: меню слева, на узком экране — полосой сверху */
.layout { display: flex; min-height: 100vh; }
.nav {
  width: 232px; flex: none; background: var(--nav); border-right: 1px solid var(--nav-line);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  font-size: 20px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--brand); padding: 0 12px 10px; text-decoration: none;
}
.nav a.item {
  display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 12px;
  border-radius: 10px; color: var(--nav-text); text-decoration: none; font-size: 15px;
}
.nav a.item:hover { background: var(--nav-hover); }
.nav a.item.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.nav a.item.on .badge { background: var(--accent-ink); color: var(--accent); }
.nav .badge {
  margin-left: auto; font-size: 13px; font-weight: 700; background: var(--accent);
  color: var(--accent-ink); border-radius: 10px; padding: 1px 9px;
}
.nav .grp { display: flex; align-items: center; gap: 8px; margin: 10px 2px 3px; padding: 10px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, .16); font-size: 11.5px; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--nav-dim); }
.nav .grp::before { content: ''; width: 4px; height: 12px; border-radius: 2px; background: var(--brand); }
.nav .me { margin-top: auto; padding: 12px 14px; font-size: 14px; color: var(--nav-dim); }
.nav .me a { color: var(--brand); }
.nav .me form { display: inline; }
.nav .me button { font: inherit; color: var(--brand); background: none; border: 0; padding: 0; cursor: pointer; }

.main { flex: 1; min-width: 0; padding: 26px 30px 40px; display: flex; flex-direction: column; gap: 20px; }
.wrap { width: 100%; max-width: 1760px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; align-items: baseline; gap: 14px 18px; flex-wrap: wrap; }
.head .sub { font-size: 16px; color: var(--dim); }
.head .right { margin-left: auto; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .nav {
    width: auto; height: auto; position: static; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--nav-line);
  }
  .brand { padding: 0 10px 0 4px; }
  .nav a.item { flex: none; min-height: 46px; }
  .nav .grp { display: none; }
  .nav .me { margin: 0 0 0 auto; flex: none; }
  .main { padding: 20px 16px 32px; }
  h1 { font-size: 25px; }
}

/* Сетки: на широком экране больше колонок */
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel { background: var(--panel); border-radius: var(--radius); padding: 16px 20px; min-width: 0; box-shadow: var(--panel-shadow); }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 58px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.row:last-child { border-bottom: 0; }
.row .end { margin-left: auto; text-align: right; }
.row > span:not(.dot):not(.end) { flex: 1 1 200px; min-width: 0; }
.row .btn.end, .row .end .btn { min-height: 44px; padding: 0 14px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.empty { color: var(--dim); padding: 14px 0; }
.dot { width: 12px; height: 12px; border-radius: 6px; flex: none; background: var(--accent); }
.dot.alarm { background: var(--alarm); }
.dot.warn { background: var(--warn); }
.big { font-size: 24px; font-weight: 800; }

table.list { width: 100%; border-collapse: collapse; font-size: 16px; }
table.list th { text-align: left; font-weight: 500; font-size: 14px; color: var(--dim); padding: 8px 10px 8px 0; }
table.list td { padding: 11px 10px 11px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
.scroll { overflow-x: auto; }

/* Кнопки и поля: не меньше 48 px под палец */
.btn {
  font: inherit; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
}
.btn:hover { filter: brightness(1.07); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--field-line); font-weight: 500; }
.btn.ghost:hover { border-color: var(--accent); color: var(--text); }
.btn.alarm { background: var(--alarm); color: var(--on-alarm); }
.btn.wide { width: 100%; min-height: 62px; font-size: 20px; font-weight: 800; border-radius: 14px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px;
  border: 1.5px solid var(--field-line); color: var(--text); text-decoration: none; font-size: 15px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 18px; color: var(--text); background: var(--field);
  border: 1.5px solid var(--field-line); border-radius: 12px; padding: 10px 14px; min-height: 50px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--accent-soft); }
input[type=file] { padding: 10px; }
input.num { text-align: right; font-weight: 800; font-size: 22px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--alarm-text); font-size: 14px; }

.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.messages li { background: var(--panel); border-left: 0; border-radius: 12px; padding: 12px 16px; }
.messages li.success { color: var(--ok); }
.messages li.error { color: var(--alarm-text); }

/* Вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .panel { width: min(420px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 16px; }

/* Широкий экран (компьютер): три колонки на «Сегодня» */
.cols3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); align-items: start; }

/* Камеры плиткой */
.tiles { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; }
.tile { display: flex; flex-direction: column; gap: 8px; }
.tile.over { box-shadow: inset 0 0 0 2px var(--alarm); }
.tile-head { display: flex; gap: 12px; align-items: flex-start; }
.tile-num { margin-left: auto; font-size: 26px; white-space: nowrap; }
.tile-num .dim { font-size: 18px; }
.fill { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.fill span { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.tile.over .fill span { background: var(--alarm); }
.tile-free { font-size: 14px; }
.alarm-text { color: var(--alarm-text); font-weight: 700; }
.tile-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 10px; align-items: center; padding: 9px 0;
  border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.tile-row:hover { background: var(--accent-soft); }
.tile-row .tr-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-row .tr-meta { font-size: 14px; color: var(--dim); text-align: right; white-space: nowrap; }
.tile-row .tr-end { grid-column: 2 / 4; font-size: 14px; color: var(--muted); }
.tile-row .tr-end:empty { display: none; }
.chip.alarm { border-color: var(--alarm); color: var(--text); text-decoration: none; gap: 8px; }
.chip.alarm:hover { background: var(--alarm-soft); }

/* Шкала созревания */
.legend { font-size: 14px; color: var(--dim); display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; }
.lg { display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.lg.done { background: var(--done); }
.lg.now { background: var(--accent); }
.lg.next { border: 1.5px solid var(--accent); }
.lg.ready { width: 10px; height: 10px; border-radius: 5px; background: var(--alarm); }
.tl { min-width: 900px; }
.tl-row { display: grid; grid-template-columns: 260px 1fr; align-items: center; min-height: 38px; color: var(--text); text-decoration: none; }
a.tl-row:hover { background: var(--accent-soft); }
.tl-label { padding-right: 12px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 38px; }
.tl-axis .tl-track { height: 26px; }
.tl-tick { position: absolute; top: 4px; transform: translateX(-50%); font-size: 13px; color: var(--dim); }
.tl-today-label { position: absolute; top: 4px; transform: translateX(-50%); font-size: 13px; color: var(--warn); font-weight: 700;
  background: var(--panel); padding: 0 4px; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .8; }
.tl-group { margin-top: 12px; padding: 6px 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line); }
.tl-seg { position: absolute; top: 9px; height: 20px; border-radius: 4px; overflow: hidden; font-size: 12px; line-height: 20px;
  padding: 0 6px; white-space: nowrap; box-shadow: 0 0 0 2px var(--panel); }
.tl-seg.done { background: var(--done); color: var(--done-ink); }
.tl-seg.now { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tl-seg.next { border: 1.5px solid var(--accent); color: var(--muted); line-height: 17px; }
.tl-seg.open { border-top-right-radius: 0; border-bottom-right-radius: 0; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  mask-image: linear-gradient(90deg, #000 85%, transparent); }
.tl-seg-text { overflow: hidden; text-overflow: ellipsis; display: block; }
.tl-ready { position: absolute; top: 12px; width: 14px; height: 14px; margin-left: -7px; border-radius: 7px; background: var(--alarm);
  box-shadow: 0 0 0 2px var(--panel); }

/* «Сегодня»: камеры строками с полосой */
.room-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line);
  color: var(--text); text-decoration: none; }
.room-line:first-of-type { border-top: 0; }
.room-line:hover { background: var(--accent-soft); }
.room-line .fill { grid-column: 1 / 3; height: 8px; }
.room-line.over .fill span { background: var(--alarm); }
.room-line .rl-num { font-weight: 700; }
.room-line .rl-free { grid-column: 1 / 3; font-size: 14px; }

/* Переключатель темы в меню */
.theme { display: flex; gap: 4px; padding: 4px; margin: 0 0 10px; border-radius: 12px; background: var(--nav-line); }
.theme button { flex: 1; font: inherit; font-size: 14px; min-height: 40px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--nav-dim); }
.theme button[aria-pressed="true"] { background: var(--nav-hover); color: var(--nav-text); font-weight: 700; }
@media (max-width: 900px) { .theme { margin: 0 0 0 8px; flex: none; } .theme button { padding: 0 10px; } }
