/* CofeNeroo — smena ilovasi. Telegram mavzusiga moslashadi (yorug' / qorong'i). */
:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --surface-2: #f8f6f2;
  --text: #1f1a16;
  --muted: #7a6f66;
  --border: #e6e0d8;
  --accent: #a8541f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7db;
  --ok: #1f8a4c;
  --ok-soft: #e3f4ea;
  --warn: #b26b00;
  --warn-soft: #fdf0d9;
  --danger: #c0352b;
  --danger-soft: #fbe5e3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 26, 22, .06), 0 4px 16px rgba(31, 26, 22, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15110e; --surface: #201a16; --surface-2: #2a231e; --text: #f3ede7; --muted: #a39789;
    --border: #3a312a; --accent: #e08a4c; --accent-ink: #1b120c; --accent-soft: #3b2a1e;
    --ok: #4cc47e; --ok-soft: #173325; --warn: #f0b04a; --warn-soft: #3a2c12;
    --danger: #ff7a6e; --danger-soft: #3d1d1a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #15110e; --surface: #201a16; --surface-2: #2a231e; --text: #f3ede7; --muted: #a39789;
  --border: #3a312a; --accent: #e08a4c; --accent-ink: #1b120c; --accent-soft: #3b2a1e;
  --ok: #4cc47e; --ok-soft: #173325; --warn: #f0b04a; --warn-soft: #3a2c12;
  --danger: #ff7a6e; --danger-soft: #3d1d1a; --shadow: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.boot { flex: 1; display: grid; place-content: center; text-align: center; gap: 8px; min-height: 80vh; }
.boot-logo { font-size: 44px; }

/* ---------- header / nav */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  padding: 12px 16px 8px; display: flex; align-items: center; gap: 12px;
}
.topbar h1 { font-size: 20px; margin: 0; flex: 1; letter-spacing: -.01em; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; display: grid; place-items: center;
}
.content { flex: 1; padding: 4px 16px 96px; display: flex; flex-direction: column; gap: 14px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar-inner { display: flex; width: 100%; max-width: 560px; }
.tab {
  flex: 1; border: 0; background: none; padding: 6px 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--accent); }

/* ---------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; margin: 0 0 4px; }
.card h3 { font-size: 15px; margin: 0 0 10px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 4px -4px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.hero { padding: 20px; }
.hero .status-line { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.hero .title { font-size: 24px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -.02em; }
.hero .meta { color: var(--muted); font-size: 15px; }
.hero.open { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.hero.handover { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.timer { font-size: 15px; font-weight: 700; color: var(--ok); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 17px; font-weight: 700; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- buttons */
.btn {
  border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px;
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.ghost { background: none; color: var(--accent); padding: 8px 10px; min-height: 0; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.action {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; text-align: center;
}
.action svg { width: 26px; height: 26px; color: var(--accent); }
.action.main { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.action.main svg { color: var(--accent-ink); }
.action[disabled] { opacity: .45; }

/* ---------- progress */
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.progress.done > i { background: var(--ok); }
.cl-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); }
.cl-row:first-of-type { border-top: 0; padding-top: 0; }

/* ---------- lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; }
.list-item button.x { border: 0; background: none; color: var(--muted); font-size: 22px; padding: 4px 8px; }
.clickable { cursor: pointer; }

/* ---------- forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 13px 14px; font-size: 17px; color: var(--text); outline: none;
}
.input:focus { border-color: var(--accent); }
.input.money { font-weight: 700; font-variant-numeric: tabular-nums; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }
.input-wrap .input { padding-right: 64px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { border: 1.5px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px; text-align: left; }
.seg button .t { font-weight: 700; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); }

.check {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface); text-align: left; width: 100%;
}
.check .box { flex: 0 0 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; color: transparent; }
.check.on { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.check.on .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check.on.danger { border-color: var(--danger); background: var(--danger-soft); }
.check.on.danger .box { background: var(--danger); border-color: var(--danger); }

.count-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.count-row:first-child { border-top: 0; }
.count-row .grow { flex: 1; min-width: 0; font-weight: 600; }
.count-row .input-wrap { width: 150px; }
.count-row .input { text-align: right; }
.count-row.filled .grow::after { content: " ✓"; color: var(--ok); }

/* ---------- qoldiq tekshirish qatori */
.cr { background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.cr.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.cr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cr-name { font-weight: 700; font-size: 15px; }
.cr-sys { font-size: 14px; color: var(--muted); white-space: nowrap; }
.cr-sys b { color: var(--text); }
.cr-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cr-btn { border: 1.5px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 11px 8px; font-weight: 700; font-size: 15px; color: var(--text); }
.cr-btn.ok.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.cr-btn.edit.on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.cr-edit { display: flex; flex-direction: column; gap: 6px; }
.cr-diff { min-height: 18px; }

/* ---------- full-screen flow (wizard) */
.flow { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; }
.flow-head { padding: 12px 16px 10px; display: flex; align-items: center; gap: 8px; max-width: 560px; width: 100%; margin: 0 auto; }
.flow-head .back { border: 0; background: var(--surface-2); width: 40px; height: 40px; border-radius: 50%; font-size: 20px; }
.flow-head .ttl { flex: 1; }
.flow-head .ttl b { display: block; font-size: 17px; }
.flow-steps { display: flex; gap: 6px; padding: 0 16px; max-width: 560px; width: 100%; margin: 0 auto; }
.flow-steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--border); }
.flow-steps i.on { background: var(--accent); }
.flow-body { flex: 1; overflow-y: auto; padding: 16px; max-width: 560px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.flow-body h2 { font-size: 22px; margin: 4px 0 0; letter-spacing: -.01em; }
.flow-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); max-width: 560px; width: 100%; margin: 0 auto; border-top: 1px solid var(--border); background: var(--bg); }
.note { border-radius: 12px; padding: 12px 14px; font-size: 14px; background: var(--surface-2); }
.note.info { background: var(--accent-soft); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.danger { background: var(--danger-soft); color: var(--danger); }
.note.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  animation: up .18s ease-out;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 4px; background: var(--border); margin: 0 auto 4px; }
.sheet h2 { margin: 0; font-size: 20px; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- PIN */
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 8px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { border: 0; background: var(--surface); border-radius: 16px; height: 62px; font-size: 26px; font-weight: 600; box-shadow: var(--shadow); }
.keypad button:active { background: var(--surface-2); }
.keypad button.fn { background: none; box-shadow: none; font-size: 16px; color: var(--muted); }


/* ---------- til tanlash */
.lang-switch { display: inline-flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.lang-switch button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--muted); }
.lang-switch button.on { background: var(--accent); color: var(--accent-ink); }
.login > .lang-switch { position: absolute; top: 14px; right: 16px; }
.login { position: relative; }

/* ---------- login */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); min-height: 100vh; }
.login-head { text-align: center; }
.login-head h1 { font-size: 26px; margin: 6px 0 4px; letter-spacing: -.02em; }
.login-pad { width: 100%; max-width: 320px; margin: 0 auto; }
.login-pad .keypad button { height: 68px; }

/* ---------- result table */
.rtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.rtable th { text-align: right; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 4px; }
.rtable th:first-child, .rtable td:first-child { text-align: left; }
.rtable td { padding: 9px 4px; border-top: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.rtable td.name { font-weight: 600; max-width: 140px; }
.neg { color: var(--danger); font-weight: 700; }
.pos { color: var(--ok); font-weight: 700; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 20px; font-weight: 800; margin-top: 2px; }
.kpi .sub { font-size: 13px; color: var(--muted); }

.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.upload { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--border); border-radius: 12px; padding: 14px; color: var(--muted); font-weight: 600; cursor: pointer; }

.empty { text-align: center; padding: 18px 8px; color: var(--muted); font-size: 15px; }

/* ---------- toast */
.toast-root { position: fixed; left: 0; right: 0; top: 12px; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: up .2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

@media (max-width: 360px) {
  .actions { grid-template-columns: 1fr 1fr; }
  .count-row .input-wrap { width: 128px; }
}
