/* Ave Mia — общий стиль всех экранов (версия 0).
   Цвета взяты из кафе: чёрный и терракотовая точка логотипа, шалфейные стены, штукатурка, тёплое дерево. */
@font-face { font-family: "Carlito"; font-weight: 700; font-display: swap; src: url("/static/carlito-bold.woff") format("woff"); }
@font-face { font-family: "Carlito"; font-weight: 400; font-display: swap; src: url("/static/carlito-regular.woff") format("woff"); }

:root {
  --ink: #000;               /* чёрный логотипа */
  --ink-2: #4a4741;          /* второстепенный текст */
  --ink-3: #8a857c;          /* подписи */
  --terra: #bf5b05;          /* терракотовая точка логотипа — действие и акцент */
  --terra-deep: #9c4a04;
  --terra-wash: #f8e9da;
  --brick: #a53c26;          /* стена у входа — срочное, ошибка */
  --brick-wash: #f7e2dc;
  --sage: #a9b79a;           /* шалфей — «сделано», спокойные поверхности */
  --sage-deep: #55664a;
  --sage-wash: #e8eee0;
  --plaster: #f3eee6;        /* штукатурка — фон */
  --paper: #fff;
  --wood: #c99a5b;           /* дерево — тонкие линии */
  --line: #e2dbcf;
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--plaster); color: var(--ink);
  font: 400 17px/1.4 "Carlito", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--terra); outline-offset: 2px; }

/* ---------- каркас ---------- */
.app { max-width: 560px; margin: 0 auto; padding: calc(10px + var(--safe-t)) 18px calc(var(--tab-h) + var(--safe-b) + 28px); min-height: 100vh; }
.app.wide { max-width: 1080px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 14px; }
.topbar .side { display: flex; align-items: center; gap: 8px; }
.wordmark { font-weight: 700; font-size: 22px; letter-spacing: .01em; line-height: 1; text-decoration: none; white-space: nowrap; }
.wordmark b::after, .dot::after { content: "."; color: var(--terra); }
.wordmark small { display: block; font-weight: 400; font-size: 11px; letter-spacing: .14em; color: var(--terra); margin-top: 3px; }

.screen { display: none; }
.screen.on { display: block; }

/* нижние вкладки */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--paper);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  display: flex; justify-content: center;
}
.tabbar .in { display: flex; width: 100%; max-width: 560px; }
.tab {
  flex: 1; height: var(--tab-h); border: 0; background: none; padding: 8px 2px 6px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; color: var(--ink-3); text-decoration: none;
}
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--ink); font-weight: 700; }
.tab.on::before { content: ""; position: absolute; top: 0; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--terra); }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brick); color: #fff; font-size: 12px; font-weight: 700; font-style: normal; line-height: 18px; text-align: center; display: inline-block; }

/* ---------- типографика ---------- */
.display { font-weight: 700; font-size: 34px; line-height: 1.08; letter-spacing: -.005em; text-wrap: balance; }
.display.sm { font-size: 27px; }
.title { font-weight: 700; font-size: 21px; line-height: 1.2; }
.sub { color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: 14.5px; }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.right { text-align: right; }
.center { text-align: center; }

/* раздел экрана: заголовок + содержимое */
.sec { margin-top: 28px; }
.sec > .title { margin-bottom: 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec > .title .act { font-weight: 400; font-size: 15.5px; color: var(--terra-deep); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.hero { padding: 10px 0 4px; }
.hero .sub { margin-top: 8px; font-size: 18px; }
.stack > * + * { margin-top: 10px; }
.flow { display: flex; flex-wrap: wrap; gap: 8px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.row .grow { overflow-wrap: anywhere; }   /* длинное слово или адрес не распирает строку */

/* ---------- поверхности ---------- */
.card { background: var(--paper); border-radius: var(--r-lg); padding: 18px; }
.card.line { border: 1px solid var(--line); }
.card.sage { background: var(--sage-wash); }
.card.terra { background: var(--terra-wash); }
.card.ink { background: var(--ink); color: #fff; }
.card.ink .sub, .card.ink .muted { color: #cfc9be; }
.card.urgent { background: var(--brick-wash); box-shadow: inset 4px 0 0 var(--brick); }
.card > .title + * { margin-top: 8px; }

/* список строк с тонкими линиями — для второстепенного, вместо россыпи карточек */
.list { background: var(--paper); border-radius: var(--r-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 54px; width: 100%; text-align: left; background: none; border: 0; text-decoration: none; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow > .sub, .row .grow > .muted { font-size: 14.5px; display: block; margin-top: 1px; }
.row .trail { color: var(--ink-2); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
button.row:active, a.row:active { background: var(--plaster); }
.row.chev::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-top: 2px solid var(--ink-3); transform: rotate(45deg); flex: none; margin-left: 2px; }
.row.done .grow { color: var(--ink-3); text-decoration: line-through; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border-radius: var(--r-md); border: 0; background: var(--ink); color: #fff; font-weight: 700; font-size: 18px;
  text-decoration: none; text-align: center; line-height: 1.15;
}
.btn:active { transform: scale(.985); }
.btn.block { display: flex; width: 100%; }
.btn.accent { background: var(--terra); }
.btn.quiet { background: var(--sage-wash); color: var(--ink); }
.btn.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.danger { background: none; color: var(--brick); box-shadow: inset 0 0 0 1.5px var(--brick); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 16px; border-radius: var(--r-sm); }
.btn.xl { min-height: 64px; font-size: 21px; border-radius: var(--r-lg); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--terra-deep); text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--paper); display: grid; place-items: center; position: relative; }
.icon-btn svg { width: 22px; height: 22px; }

/* выбор: чипы и переключатель */
.chip {
  min-height: 42px; padding: 0 15px; border-radius: 21px; border: 1.5px solid var(--line); background: var(--paper);
  display: inline-flex; align-items: center; gap: 6px; font-size: 16.5px;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.chip[disabled] { opacity: .45; text-decoration: line-through; }
.seg { display: flex; background: var(--line); border-radius: var(--r-md); padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; border: 0; background: none; border-radius: 11px; font-size: 16px; }
.seg button.on { background: var(--paper); font-weight: 700; }

/* метки состояния */
.pill { display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 14px; line-height: 20px; background: var(--line); color: var(--ink-2); white-space: nowrap; }
button.pill { border: 0; font-family: inherit; cursor: pointer; }
.pill.ok { background: var(--sage-wash); color: var(--sage-deep); }
.pill.warn { background: var(--terra-wash); color: var(--terra-deep); }
.pill.bad { background: var(--brick); color: #fff; }
.pill.ink { background: var(--ink); color: #fff; }

/* ---------- поля ---------- */
.field { display: block; }
.field > span { display: block; font-size: 14.5px; color: var(--ink-2); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line);
  background: var(--paper); font-size: 17px; appearance: none;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.35; }
.input:focus { outline: none; border-color: var(--ink); }
.check { display: flex; gap: 12px; align-items: flex-start; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.stepper { display: inline-flex; align-items: center; background: var(--plaster); border-radius: var(--r-md); }
.stepper button { width: 46px; height: 46px; border: 0; background: none; font-size: 24px; line-height: 1; }
.stepper output, .stepper input { min-width: 54px; text-align: center; font-weight: 700; font-size: 18px; border: 0; background: none; padding: 0; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--line); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--sage-deep); }
.switch input:checked + i::after { transform: translateX(20px); }

/* ---------- сообщения ---------- */
.banner { border-radius: var(--r-md); padding: 12px 14px; background: var(--terra-wash); color: var(--terra-deep); }
.banner.bad { background: var(--brick); color: #fff; }
.banner.ok { background: var(--sage-wash); color: var(--sage-deep); }
.banner.ink { background: var(--ink); color: #fff; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); z-index: 80;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-md); width: max-content; max-width: min(92vw, 480px);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 26px 16px; text-align: center; color: var(--ink-3); }

/* шторка снизу */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .2s; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0 auto; max-width: 560px; max-height: 90vh; overflow: auto;
  background: var(--plaster); border-radius: 24px 24px 0 0; padding: 10px 18px calc(22px + var(--safe-b));
  transform: translateY(102%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet.show { transform: none; }
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet > .title { margin-bottom: 12px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
/* на широком экране шторка — окно по центру (у владельца — по центру области справа от меню) */
@media (min-width: 900px) {
  .sheet { bottom: auto; top: 50%; border-radius: 24px; max-height: 86vh; padding-top: 22px; padding-bottom: 22px;
    transform: translateY(-46%); opacity: 0; transition: opacity .16s, transform .2s; }
  .sheet.show { transform: translateY(-50%); opacity: 1; }
  .sheet::before { display: none; }
  .app.wide ~ .sheet { left: 220px; }
}

/* ход заказа: принят → готовим → на полке → выдан */
.steps { display: flex; gap: 6px; margin-top: 14px; }
.steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--terra); }
.steps-cap { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-3); margin-top: 6px; }

/* цифры сводки */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--paper); border-radius: var(--r-lg); padding: 14px 16px; }
.tile b { display: block; font-size: 30px; line-height: 1.05; }
.tile span { font-size: 14.5px; color: var(--ink-2); }

/* таблица (широкие экраны владельца) */
.table { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--r-lg); overflow: hidden; font-size: 16px; }
.table th { text-align: left; font-weight: 400; font-size: 14px; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }

/* PIN-клавиатура */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 22px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.keypad button { height: 68px; border-radius: 50%; border: 0; background: var(--paper); font-size: 28px; font-weight: 700; }
.keypad button:active { background: var(--sage-wash); }

/* фото в заявках и списаниях */
.photo { width: 72px; height: 72px; border-radius: var(--r-sm); object-fit: cover; background: var(--line); flex: none; }
.photo-pick { width: 100%; min-height: 96px; border-radius: var(--r-md); border: 1.5px dashed var(--ink-3); background: none; color: var(--ink-2); display: grid; place-items: center; overflow: hidden; }
.photo-pick img { width: 100%; max-height: 240px; object-fit: cover; }
.photo-pick svg { width: 28px; height: 28px; margin: 0 auto 4px; display: block; }

/* ---------- планшет бара ---------- */
.board { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(280px, .9fr); gap: 16px; align-items: start; }
.board .col > .title { margin-bottom: 10px; }
.ticket { background: var(--paper); border-radius: var(--r-lg); padding: 16px; border-left: 8px solid var(--line); }
.ticket + .ticket { margin-top: 10px; }
.ticket.soon { border-left-color: var(--terra); }
.ticket.late { border-left-color: var(--brick); background: var(--brick-wash); }
.ticket.ready { border-left-color: var(--sage-deep); }
.ticket .when { font-weight: 700; font-size: 30px; line-height: 1; }
.ticket .who { font-weight: 700; font-size: 21px; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } }

/* ---------- широкий экран владельца ---------- */
@media (min-width: 900px) {
  .app.wide { padding-left: 250px; padding-bottom: 40px; }
  .app.wide ~ .tabbar { top: 0; bottom: 0; right: auto; width: 220px; border-top: 0; border-right: 1px solid var(--line); padding: 24px 12px; display: block; }
  .app.wide ~ .tabbar .in { flex-direction: column; gap: 4px; }
  .app.wide ~ .tabbar .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; height: 48px; padding: 0 14px; font-size: 17px; border-radius: var(--r-md); }
  .app.wide ~ .tabbar .tab.on { background: var(--plaster); }
  .app.wide ~ .tabbar .tab.on::before { position: static; margin: 0 -6px 0 0; order: 2; margin-left: auto; }
  .app.wide ~ .tabbar .tab .badge { position: static; margin-left: auto; }
  .app.wide ~ .toast { bottom: 24px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
  .cols-2 > .sec { margin-top: 28px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  body { background: #fff; }
  .tabbar, .topbar .side, .no-print { display: none !important; }
  .app { padding: 0; max-width: none; }
}

/* лента разделов внутри экрана */
.subnav { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 4px; padding: 2px 18px 10px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav button { flex: none; min-height: 40px; padding: 0 16px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--paper); font-size: 16.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.subnav button.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.part { display: none; }
.part.on { display: block; }
.whatsnew { margin-bottom: 16px; }
