:root {
  --bg: #f4f2ec;
  --paper: #fffefb;
  --head: #efebe2;
  --ink: #1b1a17;
  --ink2: #3f3d37;
  --muted: #76726a;
  --faint: #a29d92;
  --line: #e4dfd4;
  --line2: #d2cbbd;
  --accent: #1e5a47;
  --accent2: #164536;
  --accent-soft: #e2ede7;
  --accent-line: #b9d3c6;
  --b: #545486;
  --b-soft: #e9e8f3;
  --warn: #875812;
  --warn-soft: #f7eedc;
  --danger: #a13a2c;
  --danger-soft: #f8e6e2;
  --r: 10px;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button { font-family: inherit; }
.muted { color: var(--muted); }
.loading { padding: 90px 0; text-align: center; color: var(--muted); }

/* ── topbar ── */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(244, 242, 236, .9); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1240px; margin: 0 auto; height: 58px; padding: 0 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.mark.lg { width: 46px; height: 46px; border-radius: 12px; font-size: 21px; }
.brand-t { font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand-c { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-c:not(:empty)::before { content: "·"; margin-right: 8px; color: var(--faint); }
.top-progress { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 13px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.top-progress[hidden] { display: none; }
.bar { height: 6px; width: 140px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s; }
.bar.b i { background: var(--b); }
.save { font-size: 12.5px; color: var(--muted); white-space: nowrap; min-width: 150px; text-align: right; }
.admin-page .save { margin-left: auto; min-width: 0; }
.save.saving { color: var(--ink2); }
.save.saved::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3f9a6e; margin-right: 7px; vertical-align: 1px; }
.save.error { color: var(--danger); font-weight: 600; }
.menu-btn { display: none; width: 38px; height: 38px; margin-left: -8px; border: 0; border-radius: 8px; background: none; color: var(--ink); place-items: center; cursor: pointer; }
.menu-btn:hover { background: rgba(0, 0, 0, .05); }
.scrim { display: none; }

/* ── layout ── */
.layout { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 56px; }
.side { position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); overflow: auto; padding: 26px 0 40px; scrollbar-width: thin; }
#main { min-width: 0; padding-bottom: 140px; }
#main > * { max-width: 900px; }
body.bare .side, body.bare .top-progress, body.bare .menu-btn { display: none; }
body.bare .layout { grid-template-columns: 1fr; }
body.bare #main > * { margin-left: auto; margin-right: auto; }

.nav-g { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 22px 0 6px 10px; }
.nav-i { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink2); text-decoration: none; font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.nav-i:hover { background: rgba(0, 0, 0, .035); }
.nav-i.active { background: var(--paper); box-shadow: 0 0 0 1px var(--line); color: var(--ink); font-weight: 600; }
.nav-code { flex: none; width: 26px; padding: 2px 0; border-radius: 5px; text-align: center; font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-soft); }
.nav-code.b { color: var(--b); background: var(--b-soft); }
.nav-code.dot { background: none; color: var(--faint); }
.nav-t { flex: 1; min-width: 0; }
.nav-p { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-p.full { color: var(--accent); font-weight: 700; }
.nav-i.send { color: var(--accent); font-weight: 700; }
.nav-i.send .nav-code { color: var(--accent); }

/* ── hero ── */
.hero { padding: 54px 0 36px; }
.eyebrow { display: inline-block; margin-bottom: 18px; padding: 4px 11px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; }
.hero h1 { margin: 0 0 16px; font-size: clamp(30px, 4.3vw, 46px); line-height: 1.07; letter-spacing: -.028em; font-weight: 800; }
.lead { margin: 0 0 28px; max-width: 62ch; font-size: 17px; color: var(--ink2); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 30px; }
.fact { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px 14px; }
.fact.open { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.fact-t { margin-bottom: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.fact.open .fact-t { color: var(--accent); }
.fact ul { margin: 0; padding-left: 18px; }
.fact li { margin: 3px 0; }
.how { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin-bottom: 26px; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.how-i strong { display: block; margin-bottom: 3px; font-size: 14.5px; }
.how-i p { margin: 0; font-size: 14px; color: var(--muted); }
.priority { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); }
.priority p { margin: 0; font-size: 14.5px; color: var(--ink2); }
.hero-cta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.conf { font-size: 13px; color: var(--muted); }

/* ── buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 9px; font: 600 14.5px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; border-color: var(--line2); color: var(--ink2); }
.btn.ghost:hover { background: var(--paper); border-color: var(--ink2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 50px; padding: 0 26px; font-size: 15.5px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .pill:focus-visible, .addrow:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── groups & blocks ── */
.grouphead { display: flex; align-items: center; gap: 16px; padding: 56px 0 4px; }
.gletter { flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 21px; }
.gletter.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }
.grouphead[data-g="B"] .gletter { background: var(--b); }
.grouphead h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.grouphead p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }

.block { margin-top: 36px; padding-top: 40px; border-top: 1px solid var(--line); }
.grouphead + .block { margin-top: 14px; border-top: 0; padding-top: 20px; }
.hero + .block { margin-top: 0; }
.bhead { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.code { flex: none; padding: 4px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.code.b { background: var(--b-soft); color: var(--b); }
.btitle { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; flex: 1; min-width: 0; }
.btitle h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
.btag { padding: 3px 9px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; font-weight: 700; }
.bprog { flex: none; padding: 3px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--muted); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bprog.full { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.bintro { margin: 8px 0 0; max-width: 68ch; color: var(--ink2); }
.bfields { display: grid; gap: 28px; margin-top: 24px; }
.bfields > *, .kv > * { min-width: 0; } /* grid bolasi keng jadval bilan sahifani kengaytirib yubormasin — jadval o'z ichida aylanadi */

/* ── fields ── */
.flabel { display: block; margin-bottom: 4px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.fhint { margin: 0 0 9px; font-size: 13px; color: var(--muted); }
.field > .in, .field > .affix { max-width: 440px; }
.field > textarea.in { max-width: none; }
.in { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--paper); color: var(--ink); font: 500 15px var(--font); transition: border-color .15s, box-shadow .15s; }
.in::placeholder { color: var(--faint); font-weight: 400; }
.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.in:disabled { background: transparent; }
textarea.in { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.5; resize: vertical; overflow: hidden; }
select.in { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2376726a' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.in.num { font-variant-numeric: tabular-nums; }
.affix { position: relative; display: flex; }
.affix .in { padding-right: 56px; }
.affix.t-pct .in, .grid td .affix.t-pct .in { padding-right: 30px; }
.suf { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 600; color: var(--muted); pointer-events: none; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { height: 38px; padding: 0 15px; border: 1px solid var(--line2); border-radius: 99px; background: var(--paper); color: var(--ink2); font: 500 14px var(--font); cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.pill:hover { border-color: var(--ink2); }
.pill.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.pills[role="group"] .pill.on::before { content: "✓  "; }

.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; max-width: 720px; }
.inline.wide { grid-template-columns: 1fr; max-width: none; gap: 8px; }
.inline.wide .sub { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; }
.slabel { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; color: var(--ink2); line-height: 1.35; }
.inline.wide .slabel { margin: 0; font-weight: 600; }

.field.izoh { margin-top: 26px; }
.field.izoh .flabel { font-size: 13px; font-weight: 600; color: var(--muted); }
.field.izoh textarea.in { min-height: 62px; border-style: dashed; background: transparent; }
.field.izoh textarea.in:focus { border-style: solid; background: var(--paper); }

.note { margin: 28px 0 0; padding: 12px 16px; border-left: 3px solid #d6a03e; border-radius: 0 var(--r) var(--r) 0; background: var(--warn-soft); }
.note-t { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--warn); }
.note p { margin: 0; font-size: 14.5px; color: #4a3a1d; }

/* ── tables ── */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); -webkit-overflow-scrolling: touch; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--head); color: var(--ink2); text-align: left; font-size: 12px; font-weight: 700; line-height: 1.3; vertical-align: bottom; }
.grid th small { display: block; font-weight: 500; color: var(--muted); }
.grid td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: middle; }
.grid td:last-child { border-right: 0; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td .in { height: 44px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.grid td .in:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--accent); }
.grid td .affix .in { padding-right: 46px; }
.grid td .suf { font-size: 12px; }
.grid td.lc { min-width: 170px; padding: 10px 12px; background: #fbfaf6; color: var(--ink); font-weight: 600; line-height: 1.35; }
.grid td.lc.edit { padding: 0; background: #fbfaf6; }
.grid td.lc.edit .in { font-weight: 600; }
.grid th.act, .grid td.act { width: 40px; text-align: center; }
.ptitle { display: block; }
.none { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; }
.none input { margin: 0; accent-color: var(--accent); }
tr.is-none td:not(.lc) { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0, 0, 0, .028) 6px 12px); }
tr.is-none .ptitle { color: var(--muted); text-decoration: line-through; }
.x { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--faint); font-size: 20px; line-height: 1; cursor: pointer; }
.x:hover { background: var(--danger-soft); color: var(--danger); }
.addrow { margin-top: 10px; height: 38px; padding: 0 14px; border: 1px dashed var(--line2); border-radius: 8px; background: none; color: var(--accent); font: 600 13.5px var(--font); cursor: pointer; }
.addrow:hover { border-color: var(--accent); background: var(--accent-soft); }

.lines td.lc { width: 46%; font-weight: 500; }
.lines td.c-money { width: 220px; }
.matrix td.lc { width: 160px; font-size: 15px; }
.matrix td.mcell { padding: 12px; vertical-align: top; }
.mhint { min-height: 1.35em; margin-bottom: 7px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.mpair { display: grid; grid-template-columns: 1fr 104px; gap: 8px; }
.matrix td.mcell .in { height: 40px; border: 1px solid var(--line2); border-radius: 8px; background: var(--paper); }
.matrix td.mcell .in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── calc ── */
.calc { padding: 16px 18px; border: 1px solid var(--accent-line); border-radius: var(--r); background: var(--accent-soft); }
.calc-t { margin-bottom: 10px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat span { display: block; font-size: 12.5px; color: var(--ink2); }
.stat strong { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat.muted strong { color: var(--faint); }
.calc-msg { margin: 10px 0 0; font-size: 14px; color: var(--ink2); }
.calc-empty { margin: 0; font-size: 14px; color: var(--ink2); }

/* ── files ── */
.drop { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px; border: 1.5px dashed var(--line2); border-radius: var(--r); background: var(--paper); color: var(--ink2); font-size: 14px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over, .drop:focus-visible { outline: none; border-color: var(--accent); background: var(--accent-soft); }
.drop strong { color: var(--accent); }
.drop .fhint { margin: 2px 0 0; }
.drop-ic { width: 30px; height: 30px; margin-bottom: 6px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.flist { display: grid; gap: 6px; }
.flist:not(:empty) { margin-top: 8px; }
.fitem { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 14px; }
.fic { flex: none; min-width: 40px; padding: 3px 5px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 800; text-align: center; }
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; text-decoration: none; }
a.fname:hover { color: var(--accent); text-decoration: underline; }
.fsize { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.fdel { min-width: 30px; padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--faint); font: 600 13px var(--font); cursor: pointer; }
.fdel:hover { background: var(--danger-soft); color: var(--danger); }
.fdel.armed { background: var(--danger); color: #fff; }
.fbar { position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; }
.fbar i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.fitem.err { border-color: #e7b9b1; background: var(--danger-soft); }
.fitem.err .fsize { color: var(--danger); font-weight: 600; white-space: normal; }

/* ── submit ── */
.sum { display: grid; gap: 12px; margin: 20px 0 22px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.sum-row { display: grid; grid-template-columns: 110px 1fr 70px; align-items: center; gap: 14px; font-size: 14px; font-weight: 600; }
.sum-row .bar { width: auto; height: 8px; }
.sum-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink2); }
.sum-files { font-size: 13.5px; color: var(--muted); }
.gaps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink2); }
.gaps a { padding: 2px 9px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 700; text-decoration: none; }
.gaps a:hover { background: #f0e0c0; }
.gaps.ok { color: var(--accent); font-weight: 600; }
.send-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sent { margin-top: 16px; }
.sent:empty { display: none; }
.sent-ok { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 16px; border: 1px solid var(--accent-line); border-radius: var(--r); background: var(--accent-soft); color: var(--accent2); font-size: 14.5px; }
.sent-ok span { font-size: 13px; color: var(--ink2); }
.sent-err { margin: 0; color: var(--danger); font-size: 14px; font-weight: 600; }
.steps { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.steps-t { margin-bottom: 14px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.steps ol { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 1px 12px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 26px; height: 26px; border: 1px solid var(--line2); border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: var(--ink2); }
.steps li span { font-size: 14px; color: var(--muted); }

/* ── center card (index, login, xato) ── */
.center-card { display: grid; justify-items: center; gap: 12px; max-width: 420px; margin: 12vh auto; padding: 36px 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); text-align: center; }
.center-card h1 { margin: 4px 0 0; font-size: 22px; letter-spacing: -.015em; }
.center-card p { margin: 0; color: var(--muted); }
.login .in { text-align: center; }
.login .btn { width: 100%; }
.err { min-height: 1em; margin: 0; color: var(--danger); font-size: 14px; font-weight: 600; }

/* ── admin ── */
.admin { max-width: 1000px; margin: 0 auto; padding: 30px 24px 100px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-head h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.card-t { margin-bottom: 10px; font-weight: 700; }
.create .row { display: flex; gap: 10px; }
.create .err:not(:empty) { margin-top: 8px; }
.flist-admin { display: grid; gap: 10px; margin-top: 22px; }
.empty { margin-top: 24px; }
.fcard { display: grid; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.fcard:hover { border-color: var(--accent-line); box-shadow: 0 6px 20px -10px rgba(30, 90, 71, .3); }
.fcard-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fcard-n { font-size: 16.5px; }
.badge { padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.new { background: #edeae3; color: var(--muted); }
.badge.open { background: var(--b-soft); color: var(--b); }
.badge.work { background: var(--warn-soft); color: var(--warn); }
.badge.sent { background: var(--accent-soft); color: var(--accent); }
.badge.arx { background: #ebebeb; color: #7a7a7a; }
.fcard-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mini { display: grid; grid-template-columns: 16px 1fr 40px; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink2); }
.mini .bar { width: auto; }
.mini-n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.fcard-meta { display: flex; gap: 18px; font-size: 12.5px; color: var(--muted); }

.back { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.dhead { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin: 12px 0 8px; }
.dhead h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.rename { display: flex; gap: 8px; flex: 1; max-width: 560px; }
.dmeta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.linkrow { display: flex; gap: 8px; margin-bottom: 12px; }
.linkrow .in { flex: 1; height: 34px; font-size: 13.5px; color: var(--ink2); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 13.5px; color: var(--ink2); cursor: pointer; }
.toggle input { accent-color: var(--accent); }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 26px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); cursor: pointer; }
.chip:hover { border-color: var(--line2); }
.chip .code { padding: 2px 6px; font-size: 11px; }
.chip .bar { flex: 1; width: auto; height: 5px; }
.chip-n { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.ablock { margin-bottom: 14px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ablock .bhead { margin-bottom: 12px; }
.ablock h2 { font-size: 18px; }
.kv { display: grid; grid-template-columns: minmax(180px, 38%) 1fr; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-child { border-top: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 500; white-space: pre-wrap; word-break: break-word; }
.kv.empty .v { color: var(--faint); font-weight: 400; }
.kv.izoh .v { color: var(--warn); }
.kv.tbl { grid-template-columns: 1fr; gap: 8px; }
.kv .tablewrap { border-radius: 8px; }
.atable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.atable th { padding: 7px 9px; background: var(--head); color: var(--ink2); font-size: 12px; font-weight: 700; text-align: left; }
.atable td { padding: 7px 9px; border-top: 1px solid var(--line); vertical-align: top; white-space: pre-wrap; }
.atable td:first-child { font-weight: 600; }
.atable td.empty { color: var(--faint); }
.afiles { margin: 0; padding-left: 18px; }
.nodata { margin: 0; }

/* ── keyingi bo'lim ── */
.next { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 26px; color: var(--accent); font-size: 14px; text-decoration: none; }
.next span:first-child { color: var(--muted); }
.next strong { font-weight: 700; }
.next:hover strong { text-decoration: underline; }
.tog { display: none; }

/* ── responsive ── */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(300px, 86vw); height: auto; padding: 18px 12px 30px; background: var(--bg); border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform .25s ease; }
  body.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .18); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(20, 20, 15, .3); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  #main > * { max-width: none; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar-in { gap: 10px; padding: 0 14px; }
  .brand-t, .brand-c { display: none; }
  .admin-page .brand-t { display: inline; }
  .top-progress .bar { width: 64px; }
  .save { min-width: 0; font-size: 12px; }
  .layout { padding: 0 16px; }
  .hero { padding: 30px 0 22px; }
  .lead { font-size: 16px; }
  .facts, .how { grid-template-columns: 1fr; }
  .grouphead { padding-top: 44px; }
  .block { margin-top: 28px; padding-top: 30px; }
  .field > .in, .field > .affix { max-width: none; }
  .in, select.in, textarea.in { font-size: 16px; } /* 16px dan kichik bo'lsa iPhone maydonga bosganda ekranni kattalashtiradi */
  .top-progress .w, .save .w { display: none; }
  .inline { grid-template-columns: 1fr; }
  .inline.compact { grid-template-columns: 1fr 1fr; }
  .inline.wide .sub { grid-template-columns: 1fr; gap: 4px; }
  .next { justify-content: center; margin-top: 22px; padding: 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--paper); }

  /* jadvallar → kartochkalar */
  .tablewrap { overflow: visible; border: 0; border-radius: 0; background: none; }
  .grid { min-width: 0 !important; }
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: auto !important; }
  .grid tr { margin-bottom: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
  .grid td { display: grid; grid-template-columns: 40% 1fr; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .grid tbody tr:last-child td { border-bottom: 1px solid var(--line); }
  .grid tbody tr td:last-child { border-bottom: 0; }
  .grid td::before { content: attr(data-label); padding: 0 10px; font-size: 12.5px; line-height: 1.25; color: var(--muted); }
  .grid td.lc { display: block; padding: 10px 12px; background: var(--head); font-size: 15px; }
  .grid td.lc::before { content: none; }
  .grid td.lc.edit { padding: 0; }
  .grid td.act { display: flex; justify-content: flex-end; padding: 2px 4px; }
  .grid td.act::before, .grid td.act:empty { display: none; }
  .lines td.lc { background: var(--paper); font-weight: 600; font-size: 14px; }
  .matrix td.mcell { display: block; padding: 10px 12px; }
  .matrix td.mcell::before { display: block; padding: 0 0 2px; font-weight: 700; color: var(--ink2); }
  .mpair { grid-template-columns: 1fr 92px; }

  .grid.collapsible td.lc { position: relative; padding-right: 54px; cursor: pointer; -webkit-user-select: none; user-select: none; }
  .grid.collapsible td.lc.edit { padding: 0 50px 0 0; }
  .grid.collapsible tr:not(.open) td:not(.lc) { display: none; }
  .grid.collapsible tr:not(.open) td.lc { border-bottom: 0; }
  .tog { position: absolute; top: 4px; right: 6px; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; cursor: pointer; }
  .chev { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
  tr.open .chev { transform: translateY(2px) rotate(225deg); }
  .grid.collapsible tr.filled:not(.is-none) .ptitle::after { content: "  ✓"; color: var(--accent); }

  .sum-row { grid-template-columns: 84px 1fr 56px; gap: 10px; }
  .send-row .btn { width: 100%; }
  .admin { padding: 22px 16px 80px; }
  .create .row, .linkrow { flex-direction: column; }
  .fcard-bars { grid-template-columns: 1fr; gap: 8px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .toggle { margin-left: 0; }
}

@media print {
  .topbar, .back, .linkrow, .actions, .chips, #logoutBtn { display: none !important; }
  body { background: #fff; font-size: 12.5px; }
  .admin { max-width: none; padding: 0; }
  .ablock { border: 0; padding: 0 0 8px; break-inside: auto; }
  .atable, .kv { break-inside: avoid; }
}
