/* ================= mavzu (kun / tun) =================
   Standart — tizim sozlamasi. data-theme="light" | "dark" — foydalanuvchi tanlovi (theme.js). */
:root {
  /* Calm Ops: tinch neytral fon, bitta urg'u rang (Unico yashili), ingichka chiziqlar, soyasiz. */
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f6f6f4;
  --text: #151515;
  --text-2: #3c3f44;
  --muted: #6b6e74;
  --line: #ebebe8;
  --line-strong: #dcdcd7;
  /* --accent — asosiy tugma foni (oq yozuv, 5.1:1), havola, fokus; --brand — kichik urg'ular (son belgisi, grafik). */
  --accent: #3b7d16;
  --accent-ink: #ffffff;
  --accent-soft: #f0f5ea;
  --brand: #6cbb2a;
  --brand-ink: #151515;
  --ok: #1d7a43;
  --warn: #8a5a00;
  --bad: #b3261e;
  --shadow: none;
  --overlay: rgba(15, 16, 18, .32);
  --radius: 10px;
  --sidebar: 228px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111213; --surface: #18191b; --surface-2: #1e1f22; --text: #ececea; --text-2: #c9cbc7; --muted: #9a9ca2;
    --line: #26282b; --line-strong: #34363a; --accent: #8fd94f; --accent-ink: #101a08; --accent-soft: #1b2614;
    --brand: #78c83a; --brand-ink: #101a08;
    --ok: #63c98e; --warn: #e6a94f; --bad: #ff8f86;
    --shadow: none; --overlay: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111213; --surface: #18191b; --surface-2: #1e1f22; --text: #ececea; --text-2: #c9cbc7; --muted: #9a9ca2;
  --line: #26282b; --line-strong: #34363a; --accent: #8fd94f; --accent-ink: #101a08; --accent-soft: #1b2614;
  --brand: #78c83a; --brand-ink: #101a08;
  --ok: #63c98e; --warn: #e6a94f; --bad: #ff8f86;
  --shadow: none; --overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ================= asos ================= */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; line-height: 1.25; }
h2 { font-size: 15px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.boot { color: var(--muted); text-align: center; padding: 80px 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* ================= kirish ================= */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; position: relative; }
.login form {
  width: 100%; max-width: 360px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 28px 24px; box-shadow: var(--shadow);
}
.login .brand { font-weight: 700; font-size: 19px; margin-bottom: 2px; display: flex; align-items: center; gap: 8px; }
.login .sub { color: var(--muted); margin: 0 0 22px; }
.login .btn { width: 100%; margin-top: 4px; min-height: 38px; }
.login .theme-switch { position: absolute; top: 16px; right: 16px; }
.logo { width: 26px; height: 26px; flex: none; border-radius: 7px; background: #fff; }
/* kirish sahifasi: to'liq logo oq kartochkada (tun rejimida ham "Unico" yozuvi ko'rinsin) */
.login-logo { display: flex; justify-content: center; margin: 0 auto 12px; padding: 14px 18px; width: 180px; background: #fff; border-radius: 18px; border: 1px solid var(--line); }
.login-logo img { display: block; width: 100%; height: auto; }

/* ================= karkas ================= */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.side {
  border-right: 1px solid var(--line); background: var(--surface);
  padding: 14px 10px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.side .brand { font-weight: 700; padding: 4px 10px 16px; display: flex; align-items: center; gap: 8px; }
.side .brand span { color: var(--accent); font-weight: 600; }
.nav { display: grid; gap: 1px; }
.nav a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px; color: var(--text); text-decoration: none;
}
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav .count, .tabs .count {
  font-size: 11px; font-weight: 600; min-width: 18px; padding: 1px 6px; border-radius: 9px;
  background: var(--brand); color: var(--brand-ink); text-align: center; font-variant-numeric: tabular-nums;
}
.nav .sep { height: 1px; background: var(--line); margin: 8px 10px; }
.side .me { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); font-size: 13px; display: grid; gap: 2px; }
.side .me .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me .role { color: var(--muted); }
.side .me .links { margin-top: 6px; color: var(--muted); }
.side .theme-switch { margin-top: 10px; }

.topbar { display: none; }

.main { padding: 24px 28px 56px; min-width: 0; max-width: 1200px; transition: opacity .12s ease; }
.main.is-loading { opacity: .55; pointer-events: none; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head .meta { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.toolbar.flat { margin: 0; }

/* ================= boshqaruv elementlari ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 5px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .12s ease, border-color .12s ease;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; }
.btn.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.btn.small { min-height: 26px; padding: 2px 9px; font-size: 13px; }
.btn.icon { padding: 5px 8px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

.input {
  min-height: 32px; border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 6px; padding: 5px 10px; min-width: 0;
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input.search { width: 260px; max-width: 100%; }
textarea.input { width: 100%; resize: vertical; padding-top: 7px; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; }

/* select: barcha brauzerlarda bir xil o'q, tun rejimida ochilgan ro'yxat ham qorong'i */
select.input {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-right: 30px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px; background-repeat: no-repeat;
}
select.input:disabled { cursor: default; opacity: .6; }
select.input option, select.input optgroup { background-color: var(--surface); color: var(--text); }
.totals .discount select.input { padding-right: 26px; background-position: right 12px center, right 7px center; }
.hint.picked { color: var(--ok); }
.hint.picked.warn { color: var(--warn); }
.hint.picked:empty { display: none; }
.totals .grand.neg { color: var(--bad); font-size: 13px; }

/* ikki-to'rt variantli tanlov (davomat, xarid turi, mavzu) */
.segmented, .seg {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: 7px;
  background: var(--bg); border: 1px solid var(--line);
}
.segmented button, .seg button {
  border: 0; background: none; padding: 4px 11px; border-radius: 5px; cursor: pointer;
  color: var(--muted); font-size: 13px; white-space: nowrap;
}
.segmented button:hover, .seg button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 0 0 1px var(--line-strong); }
.segmented { justify-self: start; }

.theme-switch.segmented button { padding: 3px 9px; font-size: 12px; }

/* ================= panel, jadval ================= */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel, .grid2 + .panel, .panel + .grid2, .grid2 + .grid2 { margin-top: 20px; }
.grid2 > div > .panel + .panel { margin-top: 20px; }
.grid2 > .panel + .panel { margin-top: 0; } /* ikkinchi ustun — yuqoridan chekinmasin */
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--line); min-height: 46px;
}
.panel .empty { padding: 32px 16px; text-align: center; color: var(--muted); margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ko'rsatkichlar: 1px gap — qator o'tganda ham chegaralar to'g'ri */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin: 0 0 20px; box-shadow: var(--shadow);
}
.stats > div { padding: 12px 14px; background: var(--surface); box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 3px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats dd small { font-size: 12px; font-weight: 400; color: var(--muted); }
.stats dd.neg { color: var(--bad); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td .muted { font-size: 13px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.selected td { background: var(--accent-soft); }
tr.inactive td { color: var(--muted); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 4px; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); }

.tag { font-size: 12px; white-space: nowrap; }
.tag::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); }
.tag.bad { color: var(--bad); } .tag.muted { color: var(--muted); }
.tag.accent { color: var(--accent); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-decoration: none; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }

dl.info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; padding: 14px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; overflow-wrap: anywhere; }

.section-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 24px 2px 8px; text-transform: uppercase; letter-spacing: .04em; }
.section-title:first-of-type { margin-top: 4px; }

.notice {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--accent-soft); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 20px;
}

/* ================= davomat va jurnal ================= */
.att-row td:first-child { width: 40%; }
.seg button[aria-pressed="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 0 0 1px currentColor; }
.seg button[aria-pressed="true"][data-v="present"] { color: var(--ok); }
.seg button[aria-pressed="true"][data-v="absent"] { color: var(--bad); }
.seg button[aria-pressed="true"][data-v="late"] { color: var(--warn); }
.seg button[aria-pressed="true"][data-v="excused"] { color: var(--text); }

.journal th, .journal td { padding: 6px 8px; text-align: center; }
.journal th:first-child, .journal td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.journal th:first-child { background: var(--surface-2); }
.mk { font-weight: 600; font-size: 13px; }
.mk.present { color: var(--ok); } .mk.absent { color: var(--bad); }
.mk.late { color: var(--warn); } .mk.excused { color: var(--muted); }

/* ================= Unicoins, do'kon, xarajatlar ================= */
.coin { font-weight: 600; font-variant-numeric: tabular-nums; }
.coin.plus { color: var(--ok); }
.coin.minus { color: var(--bad); }
.coin-balance { color: var(--text); font-weight: 600; }
.coin-btns { display: inline-flex; gap: 4px; }
.coin-btns .btn { min-width: 38px; font-variant-numeric: tabular-nums; }


details.items { margin-top: 6px; }
details.items summary { cursor: pointer; color: var(--accent); font-size: 13px; width: fit-content; }
details.items table { margin-top: 4px; }
details.items td { padding: 3px 0; border: 0; font-size: 13px; background: none; }
details.items td + td { padding-left: 12px; }

/* ================= modal ================= */
dialog {
  border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(540px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}
dialog::backdrop { background: var(--overlay); }
dialog[open] { animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
dialog header { padding: 18px 20px 0; }
dialog .body { padding: 16px 20px; overflow-y: auto; display: grid; gap: 14px; }
dialog footer {
  padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2);
  display: flex; justify-content: flex-end; gap: 8px; border-radius: 0 0 12px 12px;
}
dialog:has(form.wide) { width: min(740px, calc(100vw - 32px)); }
dialog form.wide { width: 100%; }

.field { display: grid; gap: 5px; }
.field > span { font-size: 13px; color: var(--muted); }
.field .input { width: 100%; }
.field .hint { font-size: 12px; color: var(--muted); }
.field.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.field.check > span { color: var(--text); font-size: 14px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label {
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 4px 10px; cursor: pointer; user-select: none;
  min-width: 38px; text-align: center;
}
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days label:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.days label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error { color: var(--bad); font-size: 13px; margin: 0; }

/* xarid formasi */
.items-edit th, .items-edit td { padding: 4px; border-bottom: 0; background: none; }
.items-edit th { padding-bottom: 2px; }
.items-edit th:first-child, .items-edit td:first-child { padding-left: 0; }
.items-edit .input { width: 100%; padding: 5px 8px; }
.items-edit td:nth-child(2) { width: 72px; }
.items-edit td:nth-child(3) { width: 124px; }
.items-edit td:nth-child(4) { width: 110px; color: var(--muted); }
.items-edit td:last-child { width: 34px; padding-right: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 14px 0 0; align-items: center; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.totals dt { color: var(--muted); text-align: right; }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .discount { display: flex; gap: 4px; justify-content: flex-end; }
.totals .discount input { width: 110px; }
.totals .discount select { width: auto; }
.totals .grand { font-weight: 600; color: var(--text); font-size: 15px; }

/* ================= xabar (toast) ================= */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 20; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 6px;
  font-size: 13px; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); animation: pop .14s ease-out; max-width: calc(100vw - 32px);
}

/* ================= yordamchi ================= */
.narrow { max-width: 440px; }
.stack { display: grid; gap: 12px; }
.stack.pad { padding: 14px; }

/* ================= telefon ================= */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 15;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .18s ease, visibility 0s linear .18s;
  }
  .shell.menu-open .side {
    transform: none; visibility: visible; box-shadow: 0 0 0 100vmax var(--overlay);
    transition: transform .18s ease, visibility 0s;
  }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 10;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 12px; min-height: 52px;
  }
  .topbar strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding: 16px 12px 48px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .input.search { width: 100%; }
  .toolbar .grow { display: none; }
  .toolbar > .input:not(.search) { flex: 1 1 140px; }
  th, td { padding: 9px 10px; }
  .row2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .page-head { align-items: flex-start; }
  .page-head > .btn.primary, .page-head > .toolbar { width: 100%; }
  .page-head > .btn { min-height: 38px; }
  /* iOS fokusda kattalashtirmasligi uchun */
  .input, select.input, textarea.input { font-size: 16px; min-height: 38px; }
  .btn.small { min-height: 30px; }
  /* davomat: ism tepada, tugmalar to'liq kenglikda */
  .att-row td { display: block; width: auto !important; border: 0; padding-bottom: 2px; }
  .att-row td.actions { text-align: left; padding-top: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .att-row .seg { display: flex; }
  .att-row .seg button { flex: 1; padding: 7px 4px; }
  dialog { width: calc(100vw - 16px); }
  dialog form { max-height: calc(100dvh - 16px); }
  dialog header, dialog .body, dialog footer { padding-left: 16px; padding-right: 16px; }
  dialog footer .btn { flex: 1; min-height: 40px; }
  .items-edit td:nth-child(3) { width: 96px; }
  .items-edit td:nth-child(4), .items-edit th:nth-child(4) { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats dd { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .side, .topbar, .toolbar, .btn, td.actions { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .panel { box-shadow: none; break-inside: avoid; }
}

/* ================= topshiriqlar ================= */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .check {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; padding: 0; position: relative;
}
.task .check:hover { border-color: var(--ok); }
.task .check[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.task .check[aria-pressed="true"]::after {
  content: ""; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px;
  border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.task-body { min-width: 0; flex: 1; }
.task-title { font-weight: 500; overflow-wrap: anywhere; }
.task-desc { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.task-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task.done .task-desc { display: none; }
.section-title.bad { color: var(--bad); }
.count-inline { font-weight: 500; color: var(--muted); margin-left: 4px; }
.section-title.bad .count-inline { color: var(--bad); }
.rate-low { color: var(--bad); }
@media (max-width: 860px) {
  .task { padding: 12px; }
  .task .check { width: 24px; height: 24px; }
  .task .check[aria-pressed="true"]::after { left: 7.5px; top: 3.5px; width: 6px; height: 11px; }
}

/* ================= sozlamalar ================= */
.steps { margin: 0; padding: 14px 14px 14px 36px; display: grid; gap: 10px; }
.steps li { padding-left: 4px; }
.steps li.done { color: var(--muted); }
.steps li.done::marker { color: var(--ok); content: "✓  "; }
.steps code { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 13px; }

/* ================= sovg'a rasmlari ================= */
.thumb-col { width: 64px; padding-right: 0 !important; }
.thumb {
  display: block; width: 48px; height: 48px; border-radius: 6px; overflow: hidden; padding: 0;
  border: 1px solid var(--line); background: var(--surface-2); cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.empty { cursor: default; background:
  linear-gradient(135deg, transparent 47%, var(--line) 47%, var(--line) 53%, transparent 53%), var(--surface-2); }
.photo-edit { display: flex; gap: 12px; align-items: center; }
.photo-preview {
  flex: none; width: 96px; height: 96px; border-radius: 8px; border: 1px dashed var(--line-strong);
  display: grid; place-items: center; overflow: hidden; background: var(--surface-2); text-align: center; font-size: 12px;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-buttons { display: grid; gap: 6px; justify-items: start; }
.photo-buttons label.btn { cursor: pointer; }
.photo-view { padding: 0; }
.photo-view img { display: block; width: 100%; max-height: 70vh; max-height: 70dvh; object-fit: contain; background: #fff; border-radius: 12px 12px 0 0; }
.photo-caption { display: flex; justify-content: space-between; gap: 16px; padding: 14px 20px; }
@media (max-width: 860px) {
  .thumb-col { width: 52px; }
  .thumb { width: 40px; height: 40px; }
}

/* ================= rasm muharriri ================= */
.photo-preview.drag { border-color: var(--accent); background: var(--accent-soft); }
.photo-buttons .toolbar { gap: 6px; }
kbd { font: 11px/1 ui-monospace, monospace; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 4px; background: var(--surface); }
dialog.cropper { width: auto; max-width: calc(100vw - 16px); }
.crop-tools { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.crop-stage {
  position: relative; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none;
  overflow: hidden; border-radius: 4px; background: #000;
}
.crop-image { display: block; }
.crop-box {
  position: absolute; cursor: move; outline: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55);
}
.crop-box:focus-visible { outline: 2px solid var(--accent); }
/* uchdan bir chiziqlari */
.crop-box::before, .crop-box::after { content: ""; position: absolute; pointer-events: none; border: 0 solid rgba(255, 255, 255, .45); }
.crop-box::before { inset: 0 33.333%; border-left-width: 1px; border-right-width: 1px; }
.crop-box::after { inset: 33.333% 0; border-top-width: 1px; border-bottom-width: 1px; }
.crop-handle { position: absolute; width: 22px; height: 22px; z-index: 1; }
.crop-handle::after { content: ""; position: absolute; width: 12px; height: 12px; background: #fff; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.crop-handle.nw { left: -11px; top: -11px; cursor: nwse-resize; }
.crop-handle.se { right: -11px; bottom: -11px; cursor: nwse-resize; }
.crop-handle.ne { right: -11px; top: -11px; cursor: nesw-resize; }
.crop-handle.sw { left: -11px; bottom: -11px; cursor: nesw-resize; }
.crop-handle::after { left: 5px; top: 5px; }
.crop-size { text-align: center; margin: 0; }
@media (max-width: 860px) {
  .crop-handle { width: 32px; height: 32px; }
  .crop-handle.nw { left: -16px; top: -16px; } .crop-handle.se { right: -16px; bottom: -16px; }
  .crop-handle.ne { right: -16px; top: -16px; } .crop-handle.sw { left: -16px; bottom: -16px; }
  .crop-handle::after { left: 10px; top: 10px; }
}

/* ================= do'kon posteri ================= */
dialog:has(form.poster-view) { width: min(760px, calc(100vw - 16px)); }
.poster-frame {
  max-height: 62vh; max-height: 62dvh; overflow: auto; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); display: grid; place-items: center; min-height: 160px;
}
.poster-frame img { display: block; width: 100%; height: auto; }
.poster-view .toolbar { gap: 16px; }
.poster-size { margin-left: auto; font-size: 12px; }

/* o'quvchi hisobi */
.panel-head .neg { color: var(--bad); }
.panel-note { margin: 0; padding: 10px 16px 6px; font-size: 13px; }

/* bot e'loni QR kodi */
.qr-view .qr-frame { display: flex; justify-content: center; }
.qr-view .qr-frame canvas { width: 240px; height: 240px; border-radius: 8px; border: 1px solid var(--line); }
.qr-view .qr-link { text-align: center; margin: 8px 0 12px; overflow-wrap: anywhere; }

/* umumiy kassa kartasi: usullar bo'yicha bo'linish */

/* ================= o'quvchi profili ================= */
.notice.warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.ok-text { color: var(--ok); }
.neg-text { color: var(--bad); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.field.inline { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.note-text { margin: 0 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* davomat kalendari */
.cal-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; padding: 14px; }
.cal-head { font-weight: 600; margin-bottom: 6px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { font-size: 11px; color: var(--muted); text-align: center; }
.cal-day {
  display: grid; place-items: center; aspect-ratio: 1; font-size: 12px; border-radius: 6px;
  color: var(--muted); background: var(--surface-2);
}
.cal-day.present { background: color-mix(in srgb, var(--ok) 22%, var(--surface)); color: var(--text); font-weight: 600; }
.cal-day.late { background: color-mix(in srgb, var(--warn) 24%, var(--surface)); color: var(--text); font-weight: 600; }
.cal-day.absent { background: color-mix(in srgb, var(--bad) 22%, var(--surface)); color: var(--text); font-weight: 600; }
.cal-day.excused { background: var(--line-strong); color: var(--text); }
.cal-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-legend .cal-day { aspect-ratio: auto; padding: 2px 8px; font-size: 11px; }

/* coin grafigi (.cbar — xarajatlardagi .bar bilan to'qnashmasin) */
.cbars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 14px 14px 8px; overflow-x: auto; }
.cbar { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.cbar-fill { width: 100%; max-width: 40px; min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; }
.cbar-val { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cbar-label { font-size: 11px; color: var(--muted); }
.reasons { display: grid; gap: 12px; }
.reason-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 4px; }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* loyihalar */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.project { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.project img, .project-empty { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.project-empty { display: grid; place-items: center; font-size: 40px; }
.project-body { padding: 12px 14px; }
.project-body h3 { margin: 0 0 2px; font-size: 15px; }
.project-body p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.project-body .toolbar { margin-top: 10px; }

/* izohlar, tarix */
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 12px 14px; border-top: 1px solid var(--line); }
.notes li:first-child { border-top: 0; }
.timeline { list-style: none; margin: 0; padding: 8px 14px; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 8px 0; border-left: 2px solid var(--line); padding-left: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li span:first-child { font-variant-numeric: tabular-nums; }
.report-frame img { display: block; width: 100%; max-width: 540px; margin: 0 auto; }

/* ================= UX: xato xabari, tasdiq oynasi ================= */
.toast.error { background: var(--bad); color: var(--bg); }
dialog.confirm { max-width: 400px; width: calc(100% - 32px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
dialog.confirm::backdrop { background: var(--overlay); }
dialog.confirm .confirm-body { padding: 20px 20px 8px; }
dialog.confirm .confirm-body p { margin: 0; white-space: pre-line; line-height: 1.5; }
dialog.confirm footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: var(--bg); font-weight: 600; }
.save-state { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 8px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.hint-line { font-size: 12px; margin: 0 0 12px; }
.stats > [data-href] { cursor: pointer; transition: background .12s; }
.stats > [data-href]:hover { background: var(--surface-2); }
.stats > [data-href]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav .nav-h { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; }

/* ================= UI audit tuzatishlari ================= */
.pad, .toolbar.pad { padding: 14px; }
.toolbar.flat.pad { padding: 12px 14px 0; }
.stats-group { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 2px 8px; }
.stats dd.dd-sm { font-size: 15px; line-height: 1.3; }
.nowrap { white-space: nowrap; }
.show-sm { display: none; }
.btn.subtle-accent { color: var(--accent); border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); font-weight: 600; }
/* qator amallari: kichik «⋯» menyu */
details.more { position: relative; display: inline-block; }
details.more > summary { list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > .more-menu { display: flex; }
.more-menu { display: none; flex-direction: column; position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 180px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }
.more-menu .btn { justify-content: flex-start; border: 0; width: 100%; text-align: left; }
/* do'kon: toifalar bo'yicha jadvallarda ustunlar bir xil */
table.fixed-cols { table-layout: fixed; width: 100%; }
table.fixed-cols .c-price { width: 130px; } table.fixed-cols .c-stock, table.fixed-cols .c-given { width: 90px; }
table.fixed-cols .c-actions { width: 190px; }
@media (max-width: 860px) {
  .show-sm { display: initial; }
  .hide-sm-inline { display: none !important; }
  /* coin: ism tepada, tugmalar ostida to'liq kenglikda */
  .coin-row td { display: block; width: auto !important; border: 0; padding-bottom: 2px; }
  .coin-row td.actions { text-align: left; padding-top: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .coin-row .coin-btns { display: flex; gap: 6px; }
  .coin-row .coin-btns .btn { flex: 1; min-height: 36px; }
  .coin-table thead { display: none; }
  .coin-row td.num { display: inline-block; padding-top: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chip { flex: none; }
  table.fixed-cols { table-layout: auto; }
  table.fixed-cols .c-actions { width: auto; }
}

/* ================= Calm Ops karkasi ================= */
body { font-size: 14px; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.side { padding: 12px 10px; gap: 0; }
.side .brand { padding: 4px 8px 14px; gap: 10px; font-weight: 600; font-size: 14px; line-height: 1.2; }
.side .brand .logo { width: 28px; height: 28px; border-radius: 7px; }
.side .brand small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.nav a { justify-content: flex-start; gap: 10px; padding: 6px 10px; border-radius: 7px; color: var(--text-2); font-size: 13.5px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; box-shadow: none; }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a .ico { color: var(--muted); }
.nav a.active .ico { color: var(--accent); }
.nav .count { background: none; color: var(--muted); font-weight: 500; padding: 0; min-width: 0; }
.nav a.active .count { color: var(--text-2); }
.nav .nav-h { text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 500; padding: 14px 10px 4px; }
.side .me { font-size: 12.5px; }

.appbar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.search-trigger { display: flex; align-items: center; gap: 8px; width: min(400px, 100%); height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.search-trigger:hover { border-color: var(--line-strong); }
.search-trigger span { flex: 1; }
kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); color: var(--muted); }
.appbar-date { font-size: 13px; }
.main { padding: 22px 28px 56px; }

.panel { border-radius: var(--radius); box-shadow: none; }
.panel-head { min-height: 44px; padding: 10px 16px; }
.panel-head h2 { font-size: 14px; font-weight: 600; }
.stats { border-radius: var(--radius); box-shadow: none; }
.stats dt { font-size: 12px; }
.stats dd { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
th { font-weight: 500; font-size: 12px; color: var(--muted); }
.btn { border-radius: 7px; min-height: 32px; font-weight: 500; }
.tag { border-radius: 999px; }

/* qidiruv oynasi */
dialog.palette { width: min(600px, calc(100vw - 24px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .22); }
dialog.palette::backdrop { background: var(--overlay); }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pal-in .ico { width: 18px; height: 18px; color: var(--muted); }
.pal-q { flex: 1; border: 0; outline: none; background: none; font-size: 16px; color: var(--text); }
.pal-list { max-height: min(60vh, 440px); overflow-y: auto; padding: 6px; }
.pal-h { font-size: 11.5px; color: var(--muted); padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pal-item .ico { color: var(--muted); }
.pal-item.on, .pal-item:hover { background: var(--accent-soft); }
.pal-l { flex: 1; min-width: 0; } .pal-l small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-hint { font-size: 12px; color: var(--muted); }
.pal-empty { padding: 18px; text-align: center; color: var(--muted); margin: 0; }

@media (max-width: 860px) {
  .appbar { display: none; }
  .topbar .btn.icon:last-child { margin-left: auto; }
  .topbar .btn.icon .ico { width: 18px; height: 18px; }
  dialog.palette { margin-top: 8px; }
}

/* bosh sahifa: ko'rsatkichlar qatori */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpis > div { padding: 14px 16px 10px; border-right: 1px solid var(--line); min-width: 0; }
.kpis > div:last-child { border-right: 0; }
.kpis > [data-href] { cursor: pointer; } .kpis > [data-href]:hover { background: var(--surface-2); }
.kpis > [data-href]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.kpis dt { font-size: 12px; color: var(--muted); }
.kpis dd { margin: 6px 0 2px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis dd.neg { color: var(--bad); }
.kpi-sub { font-size: 12px; min-height: 18px; }
.delta-up { color: var(--ok); font-weight: 600; } .delta-dn { color: var(--bad); font-weight: 600; }
.spark { display: block; width: 100%; height: 26px; margin-top: 6px; }
.spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark.neutral polyline { stroke: var(--line-strong); }
.h-count { font-weight: 400; font-size: 13px; margin-left: 4px; }

/* «Bugun qilinadigan» */
.inbox-h { font-size: 11.5px; color: var(--muted); padding: 10px 16px 4px; letter-spacing: .02em; }
.inbox-row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-top: 1px solid var(--line); }
.inbox-h + .inbox-row { border-top: 0; }
.inbox-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; }
.inbox-main { flex: 1; min-width: 0; }
.inbox-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-title a { color: inherit; }
.inbox-sub { font-size: 12px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-more { display: block; padding: 8px 16px 10px; font-size: 13px; border-top: 1px solid var(--line); }
.tag.bad { color: var(--bad); }

/* kassa bo'linishi */
.cash-bar { display: flex; height: 8px; margin: 14px 16px 10px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.cash-bar span { display: block; height: 100%; }
.cb-cash { background: var(--accent); } .cb-card { background: color-mix(in srgb, var(--accent) 40%, var(--surface)); } .cb-transfer { background: var(--line-strong); }
.cash-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 16px 14px; font-size: 12.5px; color: var(--muted); }
.cash-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }

@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div { border-bottom: 1px solid var(--line); }
  .kpis > div:nth-child(2n) { border-right: 0; }
  .kpis > div:last-child { grid-column: span 2; }
  .kpis dd { font-size: 18px; }
  .inbox-row { flex-wrap: wrap; }
  .inbox-main { flex-basis: calc(100% - 26px); }
  .inbox-row .tag { margin-left: 26px; }
  .inbox-row .btn { margin-left: auto; }
}
/* havola ko'rinishidagi tugmalar ham neytral (havola rangini olmasin) */
a.btn { color: var(--text); }
a.btn.primary { color: var(--accent-ink); }
a.btn:hover { text-decoration: none; }

/* ================= Calm Ops — 2-bosqich: komponentlar ================= */
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.search-input { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; min-width: 240px; flex: 0 1 320px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--muted); }
.search-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input input { flex: 1; border: 0; outline: 0; background: none; min-width: 0; font: inherit; color: var(--text); }
.seg-filter { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.seg-filter a { padding: 5px 12px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.seg-filter a:hover { color: var(--text); text-decoration: none; }
.seg-filter a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  font-size: 12px; font-weight: 600; color: #2b2d31; letter-spacing: .02em; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.sq { border-radius: 8px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-lg { gap: 14px; }
.who-name { color: var(--text); font-weight: 500; }
.who-name:hover { color: var(--accent); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.att-meter { display: inline-block; vertical-align: middle; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-right: 8px; }
.att-meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.att-meter.low span { background: var(--bad); }
td small { font-variant-numeric: tabular-nums; color: var(--text-2); }
.days-chips { display: inline-flex; gap: 2px; vertical-align: middle; }
.days-chips span { width: 22px; text-align: center; font-size: 11px; padding: 2px 0; border-radius: 4px; color: var(--muted); opacity: .5; }
.days-chips span.on { opacity: 1; }
.days-chips span.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.method { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.m-cash { background: var(--accent-soft); color: var(--accent); }
.m-card { background: color-mix(in srgb, #3b6fd1 12%, var(--surface)); color: color-mix(in srgb, #3b6fd1 85%, var(--text)); }
.m-transfer { background: var(--surface-2); color: var(--text-2); }
table.list td { padding-top: 10px; padding-bottom: 10px; }
table.list tbody tr:hover td { background: var(--surface-2); }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* yon panel (drawer) */
dialog.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100vh; height: 100dvh; max-height: none; width: min(440px, 100vw);
  padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0, 0, 0, .12); animation: drawer-in .16s ease-out; }
dialog.drawer:not([open]) { display: none; }
dialog.drawer::backdrop { background: var(--overlay); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
dialog.drawer header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog.drawer header h2 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; display: grid; gap: 18px; align-content: start; }
dialog.drawer footer { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.peek-head { display: flex; align-items: center; gap: 14px; }
.peek-name { font-size: 17px; font-weight: 600; }
.peek-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0; }
.peek-kpis > div { background: var(--surface); padding: 10px 12px; }
.peek-kpis dt { font-size: 12px; color: var(--muted); } .peek-kpis dd { margin: 4px 0 0; font-weight: 600; font-size: 15px; }
.peek-sec h3 { font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 0 6px; }
.peek-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.peek-row > span:first-child { color: var(--muted); }
.peek-row:last-child { border-bottom: 0; }

@media (max-width: 860px) {
  dialog.drawer { inset: auto 0 0 0; width: 100vw; height: auto; max-height: 88dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; animation: sheet-in .18s ease-out; }
  @keyframes sheet-in { from { transform: translateY(30px); } to { transform: none; } }
  .search-input { flex: 1 1 100%; min-width: 0; }
  .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.kpis-4 > div:last-child { grid-column: auto; }
}

/* ================= Calm Ops — 3-bosqich ================= */
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fw-500 { font-weight: 500; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.page-note { font-size: 12.5px; max-width: 760px; line-height: 1.5; }
.filterbar .grow { flex: 1; }
.pill-x { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 500; }
.pill-x a { color: inherit; text-decoration: none; }
a.pill { text-decoration: none; } a.pill:hover { border-color: var(--line-strong); }
.role-superadmin { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.role-admin { background: color-mix(in srgb, #3b6fd1 12%, var(--surface)); color: color-mix(in srgb, #3b6fd1 85%, var(--text)); border-color: transparent; }
.btn.icon-btn { padding-left: 8px; padding-right: 8px; }
tr.inactive .avatar { opacity: .55; }

/* reyting: birinchi uchtalik */
.rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; }
.rank.r1 { background: #fbe7a6; color: #6b4e00; } .rank.r2 { background: #e4e6ea; color: #3d4148; } .rank.r3 { background: #f3d6bd; color: #6b3b12; }

/* xarajat kategoriyalari */
.grid2.grid-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cat-list { display: grid; padding: 4px 0; }
.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 9px 16px; color: var(--text); text-decoration: none; border-top: 1px solid var(--line); }
.cat-row:first-child { border-top: 0; }
.cat-row:hover { background: var(--surface-2); text-decoration: none; }
.cat-row.on { background: var(--accent-soft); }
.cat-name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-sum { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.cat-sum small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.cat-meter { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.cat-meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* telefon: pastki menyu */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 12;
    background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 4px;
    border: 0; background: none; font: inherit; font-size: 10.5px; color: var(--muted); text-decoration: none; border-radius: 8px; min-width: 0; cursor: pointer; }
  .tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .ico { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--accent); font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--bad); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; }
  .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .shell.menu-open .tabbar { visibility: hidden; }
  .kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.kpis-3 > div { border-bottom: 0; border-right: 1px solid var(--line); }
  .kpis.kpis-3 > div:last-child { grid-column: auto; border-right: 0; }
  .kpis.kpis-3 dd { font-size: 16px; }
  .grid2.grid-wide { grid-template-columns: minmax(0, 1fr); }
  .grid2.grid-wide > .panel:last-child { order: -1; }
}
@media print { .tabbar { display: none !important; } }

/* harakatlar lentasi (coinlar) */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed-main { flex: 1; min-width: 0; }
.feed-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .coin { flex: none; }

/* telefon: segmentli filtr ekrandan chiqmasin; arizalar — kartochka */
.show-sm-inline { display: none; }
.lead-m { display: none; }
@media (max-width: 860px) {
  .seg-filter { display: flex; flex-wrap: wrap; max-width: 100%; }
  .seg-filter a { white-space: nowrap; flex: 1 0 auto; text-align: center; padding: 7px 10px; }
  .show-sm-inline { display: inline-flex; }
  .lead-m { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: 12px; }
}

/* telefon: jadvallar ekranga sig'sin */
@media (max-width: 860px) {
  .tabs a { padding: 8px 9px; }
  .att-meter { width: 40px; margin-right: 4px; }
  dl.info dd { overflow-wrap: normal; }
  .shop-sub { display: none; }
  table.fixed-cols .thumb-col { display: none; }
  table.list td { padding-left: 8px; padding-right: 8px; }
  table.list td:first-child { padding-left: 12px; }
}
@media (max-width: 860px) {
  div.show-sm { display: block; }
  div.lead-m.show-sm { display: flex; }
  table.fixed-cols td.actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .tabs a { padding: 8px 8px; }
  .att-meter { width: 34px; }
}

/* ================= Calm Ops — 4-bosqich ================= */
.kpis.kpis-auto { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpis dd small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.kpis dd.dd-sm { font-size: 15px; line-height: 1.3; white-space: normal; }
.kpis dd.dd-sm small { margin-left: 0; }
.kpis.flat { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); margin: 0; }
.panel > form > .kpis.flat { margin: -14px -14px 4px; }
.att-progress { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.att-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.note-item { display: flex; gap: 10px; align-items: flex-start; }
.note-item > div { min-width: 0; flex: 1; }
.note-meta { font-size: 13px; margin-bottom: 3px; }
table.journal td:first-child { min-width: 180px; }
table.journal td, table.journal th { text-align: center; }
table.journal td:first-child, table.journal th:first-child { text-align: left; }
table.journal tbody tr:hover td { background: var(--surface-2); }
@media (max-width: 860px) {
  .kpis.kpis-auto { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.kpis-auto > div:last-child { grid-column: auto; }
  .kpis.kpis-auto > div:nth-child(odd):last-child { grid-column: span 2; }
  .att-progress { width: 60px; }
  table.journal td:first-child { min-width: 130px; }
}

/* formalar (Calm): sarlavha chiziq bilan ajratilgan, yorliqlar aniqroq; telefonda — pastdan chiquvchi oyna */
dialog:not(.drawer):not(.palette) { border-radius: 14px; box-shadow: 0 16px 48px rgba(0, 0, 0, .16); }
dialog:not(.drawer):not(.palette) header { padding: 16px 20px 14px; border-bottom: 1px solid var(--line); }
dialog:not(.drawer):not(.palette) header h2 { font-size: 16px; font-weight: 600; }
dialog .body .field > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
dialog footer { border-radius: 0 0 14px 14px; }
@media (max-width: 860px) {
  dialog:not(.drawer):not(.palette):not(.confirm) { margin: auto 0 0 0; width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; border-bottom: 0; animation: sheet-in .18s ease-out; }
  dialog:not(.drawer):not(.palette):not(.confirm) form { max-height: 92dvh; }
  dialog:not(.drawer):not(.palette):not(.confirm) footer { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
.kpis.kpis-auto dd { white-space: normal; overflow: visible; font-size: 20px; line-height: 1.25; }
.kpis.kpis-auto dd small { display: block; margin: 2px 0 0; }
.kpis.kpis-auto dd.dd-sm { font-size: 15px; }

/* AI */
.ai-panel .panel-head h2 { display: flex; align-items: center; gap: 6px; }
.ai-summary { margin: 0; padding: 12px 16px; line-height: 1.55; border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.ai-actions { margin: 0; padding: 4px 16px 14px 34px; display: grid; gap: 6px; }
.ai-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.ai-hint { font-size: 12px; }
.ai-panel .inbox-title, .ai-panel .inbox-sub { white-space: normal; overflow: visible; }

/* muzlatish izohi va to'lov tarixi */
.frozen-note { color: var(--warn); font-size: 12.5px; margin-top: 2px; }
.edit-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13px; }
.edit-log li { display: grid; gap: 2px; }
.edit-log s { color: var(--muted); }

/* arizadan kelgan o'quvchi bosqichi */
.stage { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.stage::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.stage-ok { color: var(--ok); } .stage-warn { color: var(--warn); } .stage-bad { color: var(--bad); font-weight: 600; }
.form-info { margin: 0; }
/* moliya: 6 oylik ustunlar */
.fin-bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 150px; padding: 12px 16px 0; align-items: end; }
.fin-col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; text-align: center; color: var(--muted); }
.fin-col.cur small { color: var(--text); font-weight: 600; }
.fin-pair { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.fin-pair span { width: 40%; max-width: 18px; border-radius: 3px 3px 0 0; }
.fb-in { background: var(--accent); } .fb-out { background: var(--muted); opacity: .55; }
.cash-legend i.fb-in, .cash-legend i.fb-out { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* filial tanlovi */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.branch-sel { display: block; padding: 0 12px 10px; font-size: 13px; }
.branch-sel select { width: 100%; }

.branch-bar { margin: 0 0 14px; flex-wrap: wrap; }
.filterbar .branch-bar { margin: 0; }
.branch-bar button { border: 0; background: none; font: inherit; cursor: pointer; padding: 5px 12px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.branch-bar button:hover { color: var(--text); }
.branch-bar button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.branch-bar > a { padding: 5px 10px; font-size: 13px; }

/* mavzu savollari va natijalar (admin) */
.quiz-q { margin-bottom: 10px; display: grid; gap: 6px; }
.quiz-q-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.quiz-opts { margin: 4px 0; padding-left: 0; list-style: none; display: grid; gap: 3px; }
.quiz-opts li.ok { color: var(--ok); font-weight: 600; }
.quiz-res { padding: 8px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.quiz-res.bad > div:first-child { color: var(--bad); }

.quiz-start ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.quiz-preview { display: grid; gap: 10px; max-height: 60vh; overflow: auto; }
.quiz-pv { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.quiz-pv input { margin-top: 4px; }

/* audit: telefonda segment-filtrlar bitta qatorda, yonga suriladi (2 qatorga bo'linib ketmasin) */
@media (max-width: 860px) {
  .seg-filter { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .seg-filter::-webkit-scrollbar { display: none; }
  .seg-filter a, .seg-filter button { flex: none; white-space: nowrap; }
  .page-head .head-actions { flex-wrap: nowrap; }
  .page-head .head-actions > .btn { white-space: nowrap; }
}
