/* Калькулятор Chang — по брендбуку (Материалы/Обновленное: «Графика + цвета», шрифт Rubik).
   Основной — тёмно-зелёный Chang, акцент — розовый, фон — кремовый.
   Одна выразительная деталь — зелёная шапка с логотипом и розовой «таблеткой» точки;
   всё остальное спокойное и рабочее. */
@font-face {
  font-family: "Rubik";
  src: url("/static/brand/Rubik.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}
:root {
  --green: #0D5A33;
  --green-deep: #094426;
  --pink: #EF9CB8;
  --rose: #C3768E;
  --cream: #F0EEDF;
  --beige: #EBDABA;
  --ochre: #B8813E;
  --teal: #00A099;
  --ink: #3C3C3B;
  --muted: #6B675C;
  --line: #DAD3BD;      /* разделители */
  --field: #8E866F;     /* рамки полей: контраст 3.5:1 (WCAG 1.4.11) */
  --paper: #FBFAF4;
  --warn-bg: #F6E9CF;
  --warn-ink: #7A5320;
  --bad-bg: #F7DCE4;
  --bad-ink: #8C2F4C;
  --ok-bg: #D7EEE6;
  --ok-ink: #0B5B3A;
  --radius: 12px;
  --tabbar: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 16px/1.45 "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1;
}
a { color: var(--green); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }   /* на светлом — зелёная рамка */
.top :focus-visible, .tabs :focus-visible, .login-wrap > :focus-visible { outline-color: var(--pink); } /* на зелёном — розовая */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; color: var(--green); margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 600; color: var(--green); margin: 28px 0 10px; }
.hint, .small { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.path { word-break: break-all; }

/* шапка */
.top { background: var(--green); color: var(--cream); }
.top-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 14px 20px; }
.logo img { height: 26px; display: block; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who a { color: var(--cream); opacity: .9; padding: 10px 4px; }
.chip { background: var(--pink); color: var(--green-deep); border-radius: 999px; padding: 3px 12px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs { max-width: 1240px; margin: 0 auto; display: flex; gap: 4px; padding: 0 12px; }
.tabs a { color: var(--cream); text-decoration: none; padding: 10px 14px 12px; border-bottom: 3px solid transparent; font-weight: 500; opacity: .85; display: flex; align-items: center; gap: 8px; }
.tabs a[aria-current="page"] { border-bottom-color: var(--pink); opacity: 1; }
.tabs svg { width: 20px; height: 20px; }
.badge { background: var(--pink); color: var(--green-deep); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 7px; line-height: 18px; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
main.narrow { max-width: 620px; }

/* сообщения */
.note { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.note.ok { background: var(--ok-bg); color: var(--ok-ink); }
.note.bad { background: var(--bad-bg); color: var(--bad-ink); }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* кнопки */
button, .btn {
  font: inherit; font-weight: 500; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--green); background: transparent; color: var(--green);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button.primary, .btn.primary { background: var(--green); color: var(--cream); }
button.primary:hover, .btn.primary:hover { background: var(--green-deep); }
button.ghost, .btn.ghost { border-color: var(--line); color: var(--muted); }
button.big, .btn.big { width: 100%; padding: 15px; font-size: 18px; border-radius: 12px; }
button:disabled { opacity: .55; cursor: default; }
form { margin: 0; }

/* поля */
input, select, textarea { font: inherit; color: var(--ink); }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.field input, .field select, .txt {
  font-size: 17px; padding: 11px 12px; border: 1.5px solid var(--field); border-radius: 10px; background: var(--paper); width: 100%;
}
.field input:focus, .field select:focus, .txt:focus { border-color: var(--green); outline: none; }

/* переключатели-«таблетки» */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg label { display: block; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 11px 6px; border: 1.5px solid var(--field); border-radius: 10px; background: var(--paper); font-size: 15px; }
.seg input:checked + span { background: var(--green); border-color: var(--green); color: var(--cream); }
.seg input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 2px; }
.points { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.points a { text-decoration: none; padding: 7px 14px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 999px; border: 1.5px solid var(--green); color: var(--green); font-weight: 500; }
.points a[aria-current="true"] { background: var(--green); color: var(--cream); }

/* «Действие» */
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.act { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 10px; align-content: start; }
.act h3 { margin: 0; font-size: 21px; color: var(--green); }
.act p { margin: 0; color: var(--muted); font-size: 14px; }
.act .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ввод цифрами */
.form { display: grid; gap: 14px; background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.items .nm { font-size: 15px; }
.items .in { display: flex; align-items: center; gap: 6px; flex: none; }
.items input { width: 92px; font-size: 18px; padding: 9px; text-align: right; border: 1.5px solid var(--field); border-radius: 10px; background: #fff; }
.items input:not(:placeholder-shown) { border-color: var(--green); background: var(--ok-bg); }
.items em { font-style: normal; color: var(--muted); width: 38px; font-size: 14px; }
.sticky-save { position: sticky; bottom: 0; z-index: 2; margin: 0 -16px -16px; padding: 12px 16px 16px; background: linear-gradient(to bottom, rgba(251,250,244,0), var(--paper) 30%); border-radius: 0 0 16px 16px; }

/* загрузка */
.shoot { position: relative; }
.shoot input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shoot span { display: block; text-align: center; padding: 24px; border: 2px dashed var(--green); border-radius: 14px; color: var(--green); font-size: 18px; background: var(--paper); }
.shoot input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 2px; }
.previews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.previews img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }
.previews .doc { grid-column: 1 / -1; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }

/* списки */
.list { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; }
.list th, .list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.list th { font-weight: 500; font-size: 13px; color: var(--muted); background: var(--cream); }
.list tr:last-child td { border-bottom: 0; }
.list .num { text-align: right; white-space: nowrap; }
.list .path { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.cards a, .cards .card { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.cards .t { font-weight: 500; }
.cards .m { color: var(--muted); font-size: 14px; }
.cards .r { text-align: right; color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); padding: 28px 0; }

/* статусы и пометки */
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; background: var(--beige); color: var(--ink); white-space: nowrap; }
.st-draft { background: var(--warn-bg); color: var(--warn-ink); }
.st-confirmed, .st-sent { background: #E5E0F2; color: #463A75; }
.st-posted { background: var(--ok-bg); color: var(--ok-ink); }
.st-failed { background: var(--bad-bg); color: var(--bad-ink); }
.st-cancelled { background: transparent; color: var(--muted); border: 1px solid var(--line); }
tr.undone td { color: var(--muted); }
.flag { background: var(--warn-bg); color: var(--warn-ink); border-radius: 999px; padding: 1px 9px; font-size: 13px; }
.remind { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px; }
.remind ul { margin: 6px 0 0; padding-left: 18px; }
.remind a { color: var(--warn-ink); }

.bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; }
.bar.actions { justify-content: flex-start; margin-top: 18px; }
/* фильтры: сетка, подписи всегда сверху на одном уровне; на телефоне — точка и кнопка
   на всю ширину, две даты рядом */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; margin: 6px 0 16px; max-width: 760px; }
.filters .field { min-width: 0; }
.filters .field input, .filters .field select { font-size: 16px; padding: 9px 10px; min-height: 46px; width: 100%; min-width: 0; }
.filters input[type="date"] { -webkit-appearance: none; appearance: none; display: block; text-align: left; }
.filters input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.filters button { min-height: 46px; }
@media (max-width: 760px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field.wide, .filters button { grid-column: 1 / -1; }
}
.typechips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.typechips a { text-decoration: none; padding: 5px 14px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--field); color: var(--ink); background: var(--paper); font-size: 14px; }
.typechips a[aria-current="true"] { border-color: var(--green); background: var(--green); color: var(--cream); }

/* черновик */
.split { display: grid; grid-template-columns: minmax(260px, 32%) 1fr; gap: 20px; align-items: start; }
.photo { position: sticky; top: 12px; }
.photo-box { overflow: hidden; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.photo img { display: block; width: 100%; }
.edit { width: 100%; border-collapse: collapse; background: var(--paper); }
.edit th, .edit td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.edit th { font-weight: 500; font-size: 13px; color: var(--muted); }
.edit input, .edit select { font: inherit; font-size: 14px; padding: 5px 7px; border: 1px solid var(--field); border-radius: 6px; width: 100%; background: #fff; }
.edit select[name^="section"] { width: 150px; } .edit select[name^="unit"] { width: 72px; }
.edit .q { width: 84px; } .edit .p { min-width: 220px; } .edit .c { min-width: 120px; }
.edit tr.flagged td { background: var(--warn-bg); }
.edit tr.flags td { background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; padding-top: 0; }
.written { color: var(--muted); font-size: 12px; margin-top: 2px; }
.route { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 10px; }
.route select { font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; }
.route .arrow { font-size: 18px; color: var(--muted); }
.route .note, .route .written { flex-basis: 100%; margin: 0; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.rows > button { margin-top: 12px; }

/* учётки */
.userform { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0 20px; }
.userform .checks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 15px; color: var(--ink); }
.pw { font-family: ui-monospace, Menlo, monospace; font-size: 17px; }
.actions-cell { white-space: nowrap; } .actions-cell form { display: inline-block; margin-left: 4px; }

/* вход */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--green); }
.login { width: 100%; max-width: 360px; background: var(--cream); padding: 28px 24px; border-radius: 20px; display: grid; gap: 14px; }
.login img { height: 34px; justify-self: start; }

/* телефон: вкладки внизу */
@media (max-width: 760px) {
  h1 { font-size: 24px; }
  .top-in { padding: 12px 16px; }
  .who .name { display: none; }
  .tabs { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); background: var(--green);
          padding: 0 4px env(safe-area-inset-bottom); justify-content: space-around; box-shadow: 0 -1px 0 var(--green-deep); }
  .tabs a { flex-direction: column; gap: 2px; font-size: 12px; padding: 8px 6px; border-bottom: 0; border-top: 3px solid transparent; }
  .tabs a[aria-current="page"] { border-top-color: var(--pink); }
  .tabs a.desk { display: none; }
  main { padding: 18px 16px calc(var(--tabbar) + 40px); }
  .sticky-save { bottom: var(--tabbar); }
  .split { grid-template-columns: 1fr; } .photo { position: static; }
  .list .hide-m { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* табель смен: первый столбец закреплён, дни прокручиваются вбок */
.grid-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.grid-wrap:focus-visible { outline: 3px solid var(--green); }
.tsheet { border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 100%; }
.tsheet th, .tsheet td { padding: 4px 3px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.tsheet thead th { font-weight: 500; color: var(--muted); background: var(--cream); position: sticky; top: 0; }
.tsheet .who-col { position: sticky; left: 0; z-index: 1; background: var(--paper); text-align: left; min-width: 118px; max-width: 160px; padding: 6px 10px; font-weight: 500; border-right: 1px solid var(--line); }
.tsheet thead .who-col { background: var(--cream); z-index: 2; }
.tsheet .who-col .small { font-weight: 400; }
.tsheet td input { width: 50px; font: inherit; font-size: 15px; text-align: center; padding: 6px 2px; border: 1px solid var(--field); border-radius: 6px; background: #fff; display: block; margin: 1px auto; }
.tsheet td input.changed { background: var(--warn-bg); border-color: var(--ochre); font-weight: 600; }
.tsheet td input.removed { background: var(--bad-bg); border-color: var(--rose); text-decoration: line-through; }
.tsheet .tot { font-weight: 600; color: var(--green); padding: 6px 10px; white-space: nowrap; }
.tsheet td input.odd, .oddmark { box-shadow: 0 0 0 2px var(--ochre); }
.oddmark { border-radius: 4px; padding: 0 3px; }
@media (max-width: 760px) { .tabs a { flex: 1 1 0; font-size: 11px; padding: 8px 2px; text-align: center; } }
.tsheet thead th:not(.who-col):not(.tot) { min-width: 58px; }
.cellinfo { margin: 0 0 8px; font-size: 14px; color: var(--ink); background: var(--beige); border-radius: 8px; padding: 8px 10px; }

/* Проработка и новое блюдо */
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 12px; }
.grid3 .field input { width: 100%; min-width: 0; }
.tscroll { overflow-x: auto; border-radius: var(--radius); }
.list.ing td { padding: 6px 8px; }
.list.ing input, .list.edit input:not([type="checkbox"]), .list.edit select { width: 100%; min-width: 0; font: inherit; font-size: 16px; padding: 8px; border: 1px solid var(--field); border-radius: 6px; background: #fff; }
.list.ing td:last-child { width: 34%; }
.photo .photo-box + .photo-box { margin-top: 10px; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr; } }
