/* Программа цеха «Мамулины Вкусняшки» — общий вид (вариант 4 «по логотипу»).
   Все цвета, шрифт, отступы и скругления — переменные здесь; шаблоны берут только их.
   Шрифт Golos Text (OFL, лицензия рядом в fonts/) — с нашего сервера: чужие сайты закрыты защитой программы. */

@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/static/fonts/golos-text-cyrillic-ext.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/static/fonts/golos-text-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url(/static/fonts/golos-text-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* цвета логотипа: вишнёвое сердце и графитовая надпись */
  --brand: #8A0032; --brand-dark: #5C0021; --graphite: #404040;
  --accent: var(--brand); --accent-ink: #fff; --accent-soft: #FBEFF3;
  /* белый фон и тёплые нейтральные (с оттенком вишни, а не серо-голубые) */
  --bg: #FFFFFF; --card: #FFFFFF; --soft: #F7F5F6; --line: #DCD5D8; --field: #8E8589;
  --ink: #2B2629; --muted: #5C5658;
  /* смысл: готово / ошибка / ждёт */
  --ok: #146C43; --okbg: #E8F3EC; --bad: #B42318; --badbg: #FDECEB; --warn: #7A5200; --warnbg: #FFF3CD;
  /* форма */
  --r: 14px; --r-sm: 10px; --shadow: 0 1px 2px rgba(43,38,41,.06), 0 6px 18px rgba(43,38,41,.05);
  --font: "Golos Text", "Segoe UI", system-ui, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { accent-color: var(--brand); }               /* галочки, переключатели, календарь — вишнёвые */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 17px/1.45 var(--font);
       -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
h1 { font-size: 27px; font-weight: 800; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 19px; font-weight: 800; line-height: 1.25; margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }          /* скрытое не показывают никакие стили ниже */
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* шапка: сердце из логотипа, название, разделы */
header { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; padding: 8px 20px;
         background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
header .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
                font-weight: 800; font-size: 18px; line-height: 1.1; min-height: 44px; min-width: 44px; justify-content: center; }
header .brand img { width: 34px; height: auto; flex: none; }
header .brand i { font-style: normal; color: var(--brand); }
@media (max-width: 1400px) { header .brand span { display: none; } }   /* у админа 8 разделов: место отдаём им, сердце остаётся */
header nav { display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }   /* на телефоне пункты переносятся */
header nav a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 9px 14px; border-radius: 999px;
               min-height: 44px; display: inline-flex; align-items: center; transition: background-color .12s, color .12s; }
header nav a:hover { background: var(--soft); color: var(--ink); }
header nav a.on { background: var(--accent-soft); color: var(--brand); font-weight: 700; }
header .grow { flex: 1; }
header .who { color: var(--ink); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; }
header .btn { min-height: 44px; padding: 8px 16px; }

main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 48px; }
.page-title { margin: 0 0 16px; }

/* карточки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }

/* кнопки: главная — вишнёвая, как сердце логотипа */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--line); background: var(--card);
       color: var(--ink); border-radius: 12px; padding: 12px 20px; font: inherit; font-weight: 700; cursor: pointer;
       text-decoration: none; min-height: 52px; touch-action: manipulation;
       transition-property: background-color, border-color, transform; transition-duration: .12s; }
.btn:hover { background: var(--soft); border-color: #C9C0C4; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--accent-ink); box-shadow: 0 2px 0 var(--brand-dark); }
.btn.primary:hover { background: #73002A; border-color: #73002A; }
.btn.danger { color: var(--bad); border-color: #F0C4C0; background: var(--card); }
.btn.danger:hover { background: var(--badbg); }
.btn.sm { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* карточки-цифры («Контроль», «iiko»): вишнёвая полоска сверху, крупное число */
.stat { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--r);
        padding: 12px 16px 14px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat strong { font-size: 30px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* сообщения: цвет + значок + слова */
.flash { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: 12px; margin-bottom: 16px;
         background: var(--badbg); color: var(--bad); font-weight: 700; border: 1px solid #F0C4C0; transition: opacity .4s; }
.flash::before { content: "!"; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--bad); color: #fff;
                 display: grid; place-items: center; font-size: 15px; }
.flash.ok { background: var(--okbg); color: var(--ok); border-color: #B9DCC6; }
.flash.ok::before { content: "\2713"; background: var(--ok); }

/* полоса под шапкой: автоотправка в iiko стоит или с ошибками (бухгалтер, админ) — видно с любой страницы кабинета.
   Вся полоса — ссылка на страницу «iiko», касание в любом её месте */
.auto-ok { color:var(--ok); font-weight:600; }
.auto-bad { color:var(--bad); font-weight:600; }
.auto-wait { color:var(--warn); font-weight:600; }
.auto-muted { color:var(--muted); }
.bag-status, .bag-number { display:block; }
.iiko-alarm { background: var(--badbg); border-bottom: 1px solid #F0C4C0; }
.iiko-alarm a { display: flex; gap: 10px; align-items: center; max-width: 1100px; margin: 0 auto; padding: 10px 16px;
                min-height: 48px; color: var(--bad); font-weight: 700; text-decoration: none; }
.iiko-alarm a::before { content: "!"; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--bad);
                        color: #fff; display: grid; place-items: center; font-size: 15px; }
.iiko-alarm a > span { min-width: 0; overflow-wrap: break-word; text-wrap: pretty; }
.iiko-alarm .keep, .iiko-alarm u { white-space: nowrap; }       /* номер акта и «откройте «iiko»» не рвутся */
.iiko-alarm u { text-underline-offset: 3px; }
.iiko-alarm a:hover u { text-decoration-thickness: 2px; }

/* подсказка: свёрнута, раскрывается касанием — экран не забит инструкциями */
.help { margin: 0 0 12px; }
.help summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; color: var(--muted);
                font-weight: 700; font-size: 15px; list-style: none; }
.help summary::-webkit-details-marker { display: none; }
.help summary::before { content: "?"; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor;
                        display: grid; place-items: center; font-size: 13px; }
.help[open] summary { color: var(--brand); }
.help p { margin: 2px 0 0 30px; color: var(--muted); font-size: 15px; max-width: 70ch; text-wrap: pretty; }

/* окно поверх страницы (<dialog class="win">): одно на всю программу */
dialog.win { border: 0; border-radius: var(--r); padding: 20px; width: min(560px, calc(100vw - 24px));
             max-height: calc(100dvh - 24px); overflow: auto; color: var(--ink); background: var(--card);
             box-shadow: 0 20px 60px rgba(43,38,41,.3); }
dialog.win::backdrop { background: rgba(43,38,41,.45); }
dialog.win h2 { margin-bottom: 4px; padding-right: 8px; }
dialog.win p { margin: 0 0 8px; }
.win-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.win-btns .btn { flex: 1 1 140px; }

/* статус дня */
.state { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--okbg);
         color: var(--ok); font-weight: 700; font-size: 15px; }
.state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.state.closed { background: var(--warnbg); color: var(--warn); }
.state.closed::before { border-radius: 2px; }

/* поля */
label { display: block; font-weight: 600; font-size: 15px; color: var(--muted); }
label > input { margin-top: 6px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=search] {
  font: inherit; font-weight: 500; color: var(--ink); padding: 12px 14px; border: 1.5px solid var(--field); border-radius: 12px; width: 100%;
  background: var(--card); min-height: 52px; }
select { font: inherit; font-weight: 500; color: var(--ink); padding: 12px 14px; border: 1.5px solid var(--field); border-radius: 12px; width: 100%;
         background: var(--card); min-height: 52px; margin-top: 6px; }
input:focus, select:focus { border-color: var(--brand); outline: 3px solid var(--accent-soft); }

/* выбор дня (владелец 04.11): «Вчера», «Сегодня» и календарь — одинаково в «Контроле», на «Складе» и на «iiko» */
.day-switch { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin: 0; }
.day-switch .btn { flex: 1 1 140px; flex-direction: column; gap: 0; line-height: 1.15; padding: 8px 12px; }
.day-switch .btn small { font-size: 14px; font-weight: 600; color: var(--muted); }
.day-switch .btn.on { background: var(--accent-soft); border-color: var(--brand); color: var(--brand); }
.day-switch .btn.on small { color: var(--brand); }
.day-switch .cal { flex: 1 1 170px; display: flex; }
.day-switch .cal input { margin: 0; width: 100%; min-height: 52px; }
.day-switch .cal.on input { border-color: var(--brand); outline: 3px solid var(--accent-soft); }
input[type=file] { max-width: 100%; font-size: 16px; }      /* на телефоне выбор фото не шире экрана */
input[type=file]::file-selector-button { font: inherit; font-weight: 700; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 14px; margin-right: 10px; cursor: pointer; min-height: 44px; }
input[type=file]::file-selector-button:hover { background: var(--soft); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 150px; }
.row > .fit { flex: 0 0 auto; min-width: 0; }
.grow { flex: 1; }                                   /* распорка: опасную кнопку — подальше от рабочих */
.row > .grow { min-width: 0; }
.between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* поиск по списку на странице («Товары», «Склад», «Контроль», «iiko»): поле и «Стереть» в один ряд */
.find { margin: 0 0 14px; max-width: 640px; }
.find-row { display: flex; gap: 10px; margin-top: 6px; }
.find-row input { flex: 1; min-width: 0; }
.find-row .btn { flex: none; }
.find-row input::-webkit-search-cancel-button { display: none; }   /* мелкий крестик не нужен: есть большая «Стереть» */
.find-none { margin: 10px 0 0; font-weight: 700; color: var(--warn); }
.find-note { margin: 8px 0 0; font-size: 14px; }

/* таблицы */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
th.num { white-space: normal; }                    /* заголовок числа может переноситься, само число — нет */
td form { margin: 0; }

/* «Кто сколько сделал» в «Контроле»: у всех сотрудниц столбцы на одних местах (владелец 29.10: «всё не по уровням») */
table.cooktab { table-layout: fixed; width: 100%; }
table.cooktab col.c-bags { width: 110px; }
table.cooktab col.c-pack { width: 190px; }
table.cooktab col.c-total { width: 170px; }
table.cooktab td.main { overflow-wrap: anywhere; }
table.cooktab form.send-line { margin: 6px 0 0; }   /* «Отправить в iiko» под названием товара (Контроль) */
table.cooktab form.send-line .btn { white-space: nowrap; }

@media (max-width: 640px) {
  .day-switch .cal { flex-basis: 100%; }                 /* календарь — под «Вчера» и «Сегодня» */
  header { padding: 6px 12px; position: static; }   /* на телефоне шапка не занимает экран при прокрутке */
  /* сердце, имя и «Выйти» — первой строкой, разделы — под ними во всю ширину: шапка ниже на строку,
     сердце не висит сбоку от разделов */
  header nav { order: 1; flex: 1 1 100%; }
  header .brand span { display: none; }               /* на телефоне только сердце */
  /* длинное имя — в две строки, а не «Выйти» отдельной строкой: место под сердце (44), «Выйти» (~80) и промежутки */
  header .who { max-width: calc(100% - 180px); line-height: 1.2; overflow-wrap: anywhere; }
  main { padding: 14px 10px 40px; }
  .card { padding: 14px; }
  .row > .fit { flex: 1 1 100%; }
  .row > .fit .btn, .row > .fit.btn { width: 100%; }
  .find { max-width: none; }                         /* поиск — во всю ширину */
  /* переход по дням: дата сверху, кнопки по две в ряд */
  form.days { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  form.days > * { min-width: 0; }
  form.days label { grid-column: 1 / -1; order: -1; }
  form.days > :last-child:nth-child(even) { grid-column: 1 / -1; }   /* нечётная кнопка — во всю ширину */
  form.days .btn { padding-left: 10px; padding-right: 10px; }       /* «Экран фасовки» — в одну строку */
  /* таблица -> карточки */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 2px 0; text-align: left !important; white-space: normal; }
  table.stack td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-weight: 600; }
  table.stack td.main { font-size: 18px; font-weight: 800; margin-bottom: 2px; }
  table.stack td.main::before { content: none; }
  table.stack td.act { padding-top: 8px; }
  table.stack td.act .btn { width: 100%; }
}
/* широкая таблица (мешки: 8 столбцов): на планшете вертикально и телефоне — плотными карточками:
   товар крупно, остальное в строку с подписями, кнопка справа. Таблицей она не влезает и листается вбок */
@media (max-width: 900px) {
  table.stack.wide thead { display: none; }
  table.stack.wide, table.stack.wide tbody { display: block; width: 100%; }
  table.stack.wide tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; padding: 12px 0;
                        border-bottom: 1px solid var(--line); }
  table.stack.wide tr:last-child { border-bottom: 0; }
  table.stack.wide td { display: block; width: auto; border: 0; padding: 0; text-align: left !important; white-space: normal; }
  table.stack.wide td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-weight: 600; }
  table.stack.wide td.main { order: -1; flex: 1 1 100%; font-size: 18px; font-weight: 800; margin-bottom: 2px; }
  table.stack.wide td.main::before { content: none; }
  table.stack.wide td.act { margin-left: auto; padding: 4px 0 0; }
  table.stack.wide td.act:empty { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; animation: none !important; } }
@media print { header, .btn { display: none !important; } .card { box-shadow: none; } }
