/* Power Kitchen — dizayn tizimi.
   Iliq och fon, oq kartochkalar, bitta asosiy rang (ko'kat-yashil) va ikkita signal rangi (za'faron, qizil).
   Sarlavha va raqamlar: Bricolage Grotesque; matn: Onest. */
:root {
  color-scheme: light;
  --bg: #F4F1EA;
  --card: #FFFFFF;
  --text: #16241D;
  --hint: #56655D;
  --line: #E4DFD3;
  --fill: #ECE8DE;                 /* neytral to'ldirish: segment, progress */
  --accent: #1E6A49;
  --accent-dark: #124430;
  --accent-soft: #E3F0E9;
  --accent-text: #FFFFFF;
  --link: #1E6A49;
  --ok: #124430;   --ok-bg: #E3F0E9;
  --warn: #8F4A08; --warn-bg: #FBEBD6;
  --bad: #A32E24;  --bad-bg: #FAE3DF;
  --info: #8F4A08; --info-bg: #FBEBD6;      /* jarayondagi holatlar ham za'faron rangda */
  --side: #12281E;
  --display: 'Bricolage Grotesque', 'Onest', system-ui, sans-serif;
  --body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--body); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; font-weight: 600; }
h1, h2, h3 { margin: 0; }
h2 { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 700; }
button { font-family: inherit; }
[hidden] { display: none !important; }
svg.ic { flex-shrink: 0; display: block; }

.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--hint); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; justify-content: center; padding: 40px 0; }

/* ---------- layout ---------- */
.shell { min-height: 100vh; display: flex; }
.sidebar { display: none; width: 252px; flex: none; background: var(--side); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand, .drawer .brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 700; font-size: 19px; padding: 0 8px 18px; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--hint); padding: 16px 12px 6px; }
.sidebar .group { color: #8FA599; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--text); cursor: pointer; font-size: 14.5px; font-weight: 500; }
.nav-item:hover { background: var(--fill); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.sidebar .nav-item { color: #C9D6CE; }
.sidebar .nav-item:hover { background: rgba(255,255,255,.07); }
.sidebar .nav-item.active { background: rgba(255,255,255,.13); color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 14px 20px 10px; background: var(--bg); }
.topbar h1 { font-family: var(--display); font-size: 25px; font-weight: 700; letter-spacing: -0.02em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { position: relative; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 22px; cursor: pointer; color: var(--text); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn:active { background: var(--fill); }
.icon-btn.bare { border-color: transparent; background: transparent; }
.dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; line-height: 17px; text-align: center; font-weight: 700; }
.content { flex: 1; padding: 6px 20px calc(96px + var(--safe-b)); max-width: 1180px; width: 100%; margin: 0 auto; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + var(--safe-b)); }
.tab { flex: 1; border: 0; background: none; min-height: 54px; padding: 4px 2px; color: var(--hint); font-size: 11px; font-weight: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; min-width: 0; }
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab.active { color: var(--accent); font-weight: 700; }
.drawer-back { position: fixed; inset: 0; background: rgba(18,40,30,.45); z-index: 40; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); background: var(--card); z-index: 41; overflow-y: auto; padding: 20px 12px calc(20px + var(--safe-b)); }
.drawer .who { padding: 0 12px 10px; color: var(--hint); font-size: 13px; }
@media (min-width: 900px) {
  .sidebar { display: block; }
  .tabs { display: none; }
  .topbar { padding: 24px 32px 10px; }
  .topbar h1 { font-size: 30px; }
  .content { padding: 8px 32px 40px; }
}

/* ---------- komponentlar ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card > h2, .card > h3 { margin-bottom: 10px; }
.card.sub { background: var(--bg); padding: 12px; border-radius: 16px; margin-bottom: 10px; }
.card.sub input, .card.sub select { background: var(--card); }
.hero { background: var(--accent); border-color: transparent; color: #fff; border-radius: 24px; padding: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero .lbl { font-size: 14px; font-weight: 600; opacity: .92; }
.hero .num { font-family: var(--display); font-size: 80px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.hero .side { text-align: right; font-size: 14px; font-weight: 600; line-height: 1.7; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; }
.big { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.huge { font-family: var(--display); font-size: 72px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.unit { font-family: var(--body); font-size: 16px; font-weight: 500; color: var(--hint); letter-spacing: 0; margin-left: 8px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.tile { width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; flex: none; }
.tile.plain { background: var(--fill); color: var(--text); }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--hint); }
.section-title { font-size: 12px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .06em; }

.btn { appearance: none; border: 0; border-radius: 16px; padding: 0 18px; font: inherit; font-size: 15.5px; font-weight: 700; cursor: pointer; background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; text-align: center; }
.btn:active { filter: brightness(.94); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--accent-soft); color: var(--accent-dark); }
.btn.plain { background: var(--card); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.btn.danger { background: var(--card); color: var(--bad); border: 1px solid var(--line); }
.btn.ok { background: var(--accent); color: #fff; }
.btn.sm { padding: 0 14px; min-height: 44px; font-size: 14px; border-radius: 14px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--fill); color: var(--hint); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.info { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.banner { display: flex; align-items: center; gap: 10px; border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.banner > span, .banner > div { min-width: 0; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--fill); color: var(--text); font-weight: 500; }
.banner a { color: inherit; text-decoration: underline; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--hint); margin-bottom: 6px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; outline: none; min-height: 50px; }
textarea { min-height: 76px; padding: 12px 16px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--accent); }
input[type=file] { padding: 12px 16px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 500; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters > * { flex: 1 1 150px; margin: 0 !important; }
.filters .btn { flex: 0 0 auto; }
.filters input, .filters select, .content > label.field input, .content > label.field select { background: var(--card); }

.stepper { display: flex; align-items: center; gap: 14px; margin: 18px 0 6px; }
.stepper button { width: 64px; height: 64px; flex: none; border-radius: 20px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.stepper button.plus { border-color: transparent; background: var(--accent-soft); color: var(--accent-dark); }
.stepper button:disabled { opacity: .4; }
.stepper input { text-align: center; font-family: var(--display); font-size: 72px; font-weight: 700; height: 92px; border: 0; background: transparent; padding: 0; letter-spacing: -0.03em; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .l { font-size: 13px; font-weight: 600; color: var(--hint); }
.kpi .v { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.1; margin-top: 4px; word-break: break-word; letter-spacing: -0.02em; }
.kpi.ok { background: var(--ok-bg); border-color: transparent; } .kpi.ok .l, .kpi.ok .v { color: var(--ok); }
.kpi.warn { background: var(--warn-bg); border-color: transparent; } .kpi.warn .l, .kpi.warn .v { color: var(--warn); }
.kpi.bad { background: var(--bad-bg); border-color: transparent; } .kpi.bad .l, .kpi.bad .v { color: var(--bad); }

.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 700; color: var(--hint); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
td input, td select { min-height: 42px; padding: 0 10px; min-width: 84px; font-size: 15px; }
.empty { text-align: center; color: var(--hint); padding: 28px 0; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; }
.list-item .qty { font-family: var(--display); font-size: 22px; font-weight: 700; }
.progress { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.steps { display: flex; gap: 4px; margin: 12px 0; }
.steps > i { flex: 1; height: 6px; border-radius: 3px; background: var(--fill); }
.steps > i.on { background: var(--accent); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--fill); margin-bottom: 14px; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--hint); font-size: 14px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(22,36,29,.12); }

.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(18,40,30,.5); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 18px 20px calc(20px + var(--safe-b)); }
.modal.wide { max-width: 920px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; position: sticky; top: -18px; background: var(--card); padding: 8px 0; z-index: 2; }
.modal-head h2 { flex: 1; }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 24px; } }

#toasts { position: fixed; top: 12px; left: 0; right: 0; z-index: 99; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; max-width: 520px; box-shadow: 0 8px 28px rgba(22,36,29,.25); }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--accent); }
#offline { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; background: var(--bad); color: #fff; text-align: center; padding: 12px 16px calc(12px + var(--safe-b)); font-size: 14px; font-weight: 600; }

.login { max-width: 420px; margin: 0 auto; padding: 40px 24px; }
.login .logo { width: 76px; height: 76px; border-radius: 24px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.login h1 { text-align: center; font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.login .tagline { text-align: center; color: var(--hint); margin: 0 0 24px; }
.sig-pad { width: 100%; height: 190px; background: #fff; border: 2px dashed var(--line); border-radius: 16px; touch-action: none; display: block; }
.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: flex; justify-content: center; }
.qr-box svg { width: min(260px, 70vw); height: auto; }
.matrix th, .matrix td { text-align: center; padding: 6px 4px; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.pin-input { letter-spacing: .5em; text-align: center; font-family: var(--display); font-size: 30px; font-weight: 700; height: 68px; border-width: 2px; }
pre.json { background: var(--bg); padding: 10px; border-radius: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 4px 0 0; max-height: 220px; overflow: auto; }

/* Buyurtma: kunlar lentasi */
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.day { flex: 1 0 40px; min-height: 76px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); padding: 6px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font: inherit; }
.day .wd { font-size: 11px; font-weight: 600; color: var(--hint); }
.day b { font-family: var(--display); font-size: 20px; font-weight: 700; line-height: 1.1; }
.day .qty { font-size: 12px; font-weight: 700; color: var(--hint); min-height: 16px; }
.day.done .qty { color: var(--ok); }
.day.on { background: var(--accent); border-color: transparent; color: #fff; }
.day.on .wd, .day.on .qty { color: #fff; opacity: .9; }

/* ---------- Mobil: jadval qatorlari kartochka ko'rinishida ---------- */
@media (max-width: 720px) {
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  .table-wrap.scroll { overflow-x: auto; }
  table.resp, table.resp tbody, table.resp tr { display: block; width: 100%; }
  table.resp thead { display: none; }
  table.resp tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.resp tr:last-child { border-bottom: 0; padding-bottom: 0; }
  table.resp tr:first-child { padding-top: 2px; }
  table.resp td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 3px 0; border: 0; text-align: right; white-space: normal; word-break: break-word; min-height: 26px; }
  table.resp td::before { content: attr(data-label); color: var(--hint); font-size: 13px; text-align: left; flex: 0 0 auto; max-width: 46%; font-weight: 500; }
  table.resp td:first-child { display: block; text-align: left; font-weight: 700; font-size: 15.5px; padding-bottom: 4px; }
  table.resp td:first-child::before { display: none; }
  table.resp td:first-child .small { font-weight: 400; }
  table.resp td.nil { display: none; }
  table.resp td.nolabel { justify-content: flex-end; padding-top: 8px; }
  table.resp td.nolabel::before { display: none; }
  table.resp td.nolabel .row { flex-wrap: wrap; justify-content: flex-end; }
  table.resp td input, table.resp td select { width: auto; min-width: 120px; max-width: 58%; text-align: right; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px 16px; }
  .kpi .v { font-size: 24px; }
  .filters > * { flex: 1 1 46%; }
  .filters .btn { flex: 1 1 auto; }
  .row.between { flex-wrap: wrap; }
  .matrix { font-size: 12px; }
  .matrix th { white-space: normal; font-size: 10px; letter-spacing: 0; }
}
.topbar h1.long { font-size: 20px; }
@media (min-width: 900px) { .topbar h1.long { font-size: 30px; } }
.seg button { padding: 0 10px; white-space: nowrap; }
