:root {
  --bg: #F1F3F6; --card: #fff; --ink: #14181F; --muted: #5B6470; --soft: #E6E9EE; --line: #DCE0E6;
  --writeoff: #C62828; --transfer: #1565C0; --ok: #1B6B3A; --accent: #14181F;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 600 16px/1.35 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; -webkit-tap-highlight-color: transparent; }
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 800; }
#app { min-height: 100%; }

/* экраны на точке: колонка шириной с телефон */
.screen { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.pad { padding: 24px 16px 18px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.kicker { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.sub { font-size: 15px; color: var(--muted); }
.card { background: var(--card); border-radius: 22px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1 1 0; min-height: 0; }

.bar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.bar > i { display: block; height: 8px; border-radius: 4px; background: var(--ok); }

.item { min-height: 64px; border-radius: 18px; background: var(--bg); padding: 8px 12px; display: flex; align-items: center; gap: 12px; width: 100%; }
.item.white { background: var(--card); border-radius: 20px; min-height: 76px; padding: 10px 12px; }
.ico { flex: none; width: 44px; height: 44px; border-radius: 14px; color: #fff; display: flex; align-items: center; justify-content: center; }
.t1 { font-size: 17px; font-weight: 800; line-height: 1.2; display: block; }
.t2 { font-size: 13px; font-weight: 700; color: var(--muted); display: block; }
.chip { flex: none; font-size: 13px; font-weight: 800; padding: 6px 10px; border-radius: 10px; white-space: nowrap; }
.chip.done { background: #DDF3E4; color: #14522C; }
.chip.late { background: #FDE2DD; color: #8E1B14; }
.chip.todo { background: #FFF1CC; color: #6B4A00; }
.chip.later, .chip.ondemand { background: var(--soft); color: #3D4652; }
.chip.error { background: #FDE2DD; color: #8E1B14; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { color: #fff; border-radius: 22px; padding: 14px; height: 104px; display: flex; flex-direction: column; justify-content: space-between; }
.tile b { font-size: 18px; font-weight: 800; line-height: 1.15; display: block; }
.tile span { font-size: 13px; font-weight: 700; }
.tile.dark { background: var(--accent); }
.tile.light { background: var(--card); color: var(--ink); }

.btn { height: 64px; border-radius: 20px; font-size: 18px; font-weight: 800; text-align: center; padding: 0 20px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.soft { background: var(--soft); }
.btn.sm { height: 48px; border-radius: 14px; font-size: 15px; padding: 0 16px; }
.btn.danger { background: #FDE2DD; color: #8E1B14; }
.btn.wide { width: 100%; }
.sq { flex: none; width: 64px; padding: 0; }

.head { padding: 20px 20px 14px; color: #fff; display: flex; flex-direction: column; gap: 3px; background: var(--accent); }
.head small { font-size: 14px; font-weight: 700; }
.head h2 { font-size: 22px; }
.body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.foot { background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.note { display: flex; gap: 10px; padding: 6px 4px; color: var(--muted); font-size: 14px; line-height: 1.4; }

.lines { background: var(--card); border-radius: 20px; padding: 4px 14px; }
.line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--soft); }
.line:last-child { border-bottom: 0; }
.left .line, .left .footrow { flex-direction: row-reverse; }
.qty { flex: none; display: flex; align-items: center; gap: 8px; }
.step { width: 52px; height: 52px; border-radius: 16px; background: var(--soft); display: flex; align-items: center; justify-content: center; }
.qty input { width: 72px; height: 52px; border: 0; background: none; text-align: center; font-size: 24px; font-weight: 800; padding: 0; -moz-appearance: textfield; border-radius: 12px; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input.zero { color: #6B7480; }
.qty input:focus { outline: 2px solid var(--line); }
.footrow { display: flex; gap: 10px; }

.pad.sent { background: var(--card); padding: 56px 24px 20px; gap: 20px; }
.badge { width: 84px; height: 84px; border-radius: 42px; color: #fff; display: flex; align-items: center; justify-content: center; }
.steps { background: var(--bg); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.steps div { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.dot { flex: none; width: 14px; height: 14px; border-radius: 7px; }

/* вход */
.login { justify-content: center; padding: 24px; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.field input, .field select, .inp { height: 56px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); padding: 0 16px; font-size: 17px; font-weight: 700; width: 100%; }
.field input:focus, .field select:focus, .inp:focus { outline: 0; border-color: var(--ink); }
.err { background: #FDE2DD; color: #8E1B14; border-radius: 16px; padding: 14px 16px; font-weight: 700; }

/* админка: шире, работает и на телефоне, и на компьютере */
.admin { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { height: 48px; padding: 0 18px; border-radius: 14px; background: var(--soft); font-weight: 800; }
.tab.on { background: var(--accent); color: #fff; }
.list { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { width: 48px; height: 48px; border-radius: 14px; background: var(--soft); font-weight: 800; text-align: center; }
.day.on { background: var(--accent); color: #fff; }
.titem { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px 48px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--soft); }
.titem .inp { height: 48px; padding: 0 10px; text-align: center; }
.thead { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 48px; }
.check input { width: 24px; height: 24px; }
.del { width: 48px; height: 48px; border-radius: 14px; background: var(--soft); display: flex; align-items: center; justify-content: center; }
@media (max-width: 520px) { .titem { grid-template-columns: minmax(0, 1fr) 72px 72px 44px; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 16px; font-weight: 700; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10; }
#toast.on { opacity: 1; }
.center { text-align: center; color: var(--muted); padding: 24px 0; }
