/* Coffee ERP — интерфейс сервисной компании.
   Палитра: холодный «пар» и тёмная нефть, акцент — эмаль кофемашины.
   Единственный «громкий» элемент — шкалы остатков в виде бункеров с отметкой минимума. */
:root {
  --bg: #EEF1EF;
  --panel: #FFFFFF;
  --ink: #17262B;
  --muted: #5E6E72;
  --line: #D5DCDA;
  --brand: #0E6B61;
  --brand-soft: #E3F0ED;
  --amber: #B7791F;
  --low: #C2410C;
  --ok: #2F7D4E;
  --bad: #B42318;
  --min-mark: #F2A65A;
  --r-s: 6px;
  --r-m: 10px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-w: 232px;
  --tab-h: 62px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); font-feature-settings: "tnum" 1; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.boot { padding: 40px; color: var(--muted); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- каркас */
.shell { min-height: 100vh; }
.nav { position: fixed; inset: 0 auto 0 0; width: var(--nav-w); background: var(--ink); color: #DCE6E3; display: flex; flex-direction: column; padding: 18px 12px; }
.nav .brand { font-weight: 700; font-size: 17px; color: #fff; padding: 4px 10px 2px; }
.nav .who { font-size: 13px; color: #9FB2AE; padding: 0 10px 16px; border-bottom: 1px solid #2A3C41; margin-bottom: 10px; }
.nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 10px; border-radius: var(--r-s); color: #DCE6E3; text-decoration: none; }
.nav a:hover { background: #22363B; }
.nav a.on { background: var(--brand); color: #fff; }
.nav .spacer { flex: 1; }
.nav button.link { background: none; border: 0; color: #9FB2AE; text-align: left; padding: 9px 10px; cursor: pointer; }
.count { min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--min-mark); color: var(--ink); font-size: 12px; font-weight: 700; text-align: center; }
.main { margin-left: var(--nav-w); padding: 28px 32px 48px; max-width: 1240px; }
.tabs { display: none; }
.topbar { display: none; }

@media (max-width: 860px) {
  .nav { display: none; }
  .main { margin-left: 0; padding: 16px 14px calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); max-width: 100vw; overflow-x: clip; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 0; }
  .topbar .brand { font-weight: 700; }
  .topbar button { background: none; border: 0; color: var(--muted); padding: 6px; }
  .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); height: var(--tab-h); background: var(--ink); border-radius: 18px; box-shadow: 0 10px 30px rgba(23,38,43,.35); z-index: 20; padding: 0 4px; }
  .tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: #A9BBB7; text-decoration: none; position: relative; border-radius: 14px; margin: 6px 2px; }
  .tabs a .ico { font-size: 19px; line-height: 1; }
  .tabs a.on { color: #fff; background: var(--brand); font-weight: 600; }
  .tabs a .count { position: absolute; top: 6px; left: 54%; min-width: 18px; padding: 0 5px; font-size: 11px; }
}

/* ---------- заголовки страниц */
.page-head { min-width: 0; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 8px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- блоки */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* сводные цифры — простая строка, без «карточек ради карточек» */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 45%), 1fr)); border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); overflow: hidden; }
.figures > * { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.figures .v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.figures .l { font-size: 13px; color: var(--muted); }
.figures .v.pos { color: var(--ok); }
.figures .v.neg { color: var(--bad); }
.figures a { text-decoration: none; color: inherit; display: block; }

/* ---------- таблицы и списки */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 13px; font-weight: 500; color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #F6F8F7; }
.list { display: flex; flex-direction: column; }
.item { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; padding: 13px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.item:last-child { border-bottom: 0; }
.item .t { font-weight: 600; }
.item > .grow { min-width: 60%; }
.item .s { font-size: 13px; color: var(--muted); }
a.item:hover { background: #F6F8F7; }
.empty { padding: 26px 8px; color: var(--muted); text-align: center; }

/* ---------- статусы */
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #E8ECEB; color: var(--muted); white-space: nowrap; }
.tag.ok { background: #E3F2E8; color: var(--ok); }
.tag.bad { background: #FBE7E5; color: var(--bad); }
.tag.warn { background: #FBF0DD; color: var(--amber); }
.tag.info { background: var(--brand-soft); color: var(--brand); }
.tag.urgent { background: var(--bad); color: #fff; }

/* ---------- формы */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; min-height: 42px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.check { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.check input { width: 18px; height: 18px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; margin: 0 0 12px; }
legend { font-size: 13px; color: var(--muted); padding: 0 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 9px 16px; border-radius: var(--r-s); border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: #B7C3C0; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0B5A51; }
.btn.danger { color: var(--bad); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- шкалы остатков (бункеры) */
.hoppers { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px 10px; }
.hopper { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.hopper .can { position: relative; width: 44px; height: 92px; border: 2px solid var(--ink); border-top-width: 5px; border-radius: 4px 4px 10px 10px; background: #F4F6F5; overflow: hidden; }
.hopper .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--brand); transition: height .5s ease; }
.hopper.warn .fill { background: var(--amber); }
.hopper.low .fill { background: var(--low); }
.hopper.unknown .can { border-style: dashed; border-color: #9AA8A5; }
.hopper .min { position: absolute; left: -2px; right: -2px; height: 0; border-top: 2px dashed var(--min-mark); }
.hopper .name { font-size: 13px; line-height: 1.25; }
.hopper .qty { font-weight: 700; font-size: 14px; }
.hopper.low .qty { color: var(--low); }
.hopper button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; }
.shop-stock { padding: 16px 0; border-bottom: 1px solid var(--line); }
.shop-stock:last-child { border-bottom: 0; }
.shop-stock header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- мастер отчёта сотрудника */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 16px; }
.steps div { height: 5px; border-radius: 3px; background: var(--line); }
.steps div.done { background: var(--brand); }
.shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .shots { grid-template-columns: repeat(4, 1fr); } }
.shot { position: relative; border: 2px dashed #A9B6B3; border-radius: var(--r-m); background: #F6F8F7; min-height: 176px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; cursor: pointer; }
.shot.has { border-style: solid; border-color: var(--brand); }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot .cap { position: relative; z-index: 1; padding: 8px 10px; font-size: 13px; line-height: 1.3; background: linear-gradient(transparent, rgba(23,38,43,.82)); color: #fff; }
.shot:not(.has) .cap { background: none; color: var(--ink); }
.shot .n { font-weight: 700; }
.shot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.shot.busy::after { content: "Загрузка…"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.75); font-weight: 600; z-index: 2; }
.stock-input { display: grid; grid-template-columns: 1fr 96px 96px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stock-input .h { font-size: 12px; color: var(--muted); }

/* ---------- фото в проверке */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--r-s); background: #E3E8E6; cursor: zoom-in; display: block; }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.ai-box { border-left: 4px solid var(--brand); padding: 10px 14px; background: var(--brand-soft); border-radius: 0 var(--r-s) var(--r-s) 0; }
.ai-box.FAIL { border-color: var(--bad); background: #FBE7E5; }
.ai-box.REVIEW { border-color: var(--amber); background: #FBF0DD; }
.decide { border: 2px solid var(--brand); }

/* ---------- рейтинг сотрудника */
.score { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; flex: none; }
.ring b { width: 74px; height: 74px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-size: 24px; }
.money { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.tips li { margin-bottom: 8px; }
.tips li::marker { color: var(--brand); }

/* ---------- график */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 6px; }
.bars div { flex: 1; background: var(--brand); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.bars div:hover { background: var(--ink); }

/* ---------- логин */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: 100%; max-width: 380px; }
.login h1 { margin-bottom: 4px; }
.login p { color: var(--muted); margin: 0 0 20px; }

/* ---------- модалки и уведомления */
dialog { border: 0; border-radius: var(--r-m); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(23,38,43,.3); }
dialog::backdrop { background: rgba(23,38,43,.45); }
#modal-body { padding: 20px; }
#modal-body h2 { margin-bottom: 14px; }
dialog.wide { width: min(980px, calc(100vw - 24px)); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 860px) { #toast { bottom: calc(var(--tab-h) + 28px); } }
#toast-in-modal { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: 92vw; }
#toast-in-modal div { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-s); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
#toast-in-modal div.err { background: var(--bad); }
.map { height: min(62vh, 560px); border-radius: var(--r-m); border: 1px solid var(--line); overflow: hidden; background: #DDE4E2; }
label.item.check { align-items: flex-start; cursor: pointer; }
label.item.check input { margin-top: 3px; flex: none; }
#toast div { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-s); max-width: 90vw; }
#toast div.err { background: var(--bad); }
.cred { background: #FBF0DD; border-radius: var(--r-s); padding: 12px; font-family: ui-monospace, monospace; font-size: 14px; word-break: break-all; }
.zoom img { width: 100%; height: auto; display: block; }
td.pos { color: var(--ok); font-weight: 600; } td.neg { color: var(--bad); font-weight: 600; }
.stock-card { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px; margin-top: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-top: 4px; }
.seg button { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: var(--r-s); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper .row { flex-wrap: nowrap; gap: 4px; }
.stepper input { width: 64px; text-align: center; min-height: 36px; padding: 4px; }
.stepper .btn { min-width: 36px; padding: 4px 0; }
.inv-line { display: grid; grid-template-columns: 1fr 90px 110px 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 600px) { .inv-line { grid-template-columns: 1fr 1fr; } .inv-line select { grid-column: 1 / -1; } }

.shot.locked { opacity: .45; cursor: not-allowed; }
.shot.locked input { pointer-events: none; }
