/* ===== Nasiya tizimi — to'q (dark) dizayn ===== */
:root {
  color-scheme: dark;
  --bg: #0a0e17; --side: #0c111d; --surface: #121a2a; --surface-2: #172136; --hover: #1b2640;
  --text: #e9eef8; --text-2: #c5cddd; --muted: #8590a7; --line: #212b3f; --line-2: #2f3b54;
  --primary: #7c6cff; --primary-600: #6b5af5; --cyan: #22d3ee; --primary-soft: rgba(124, 108, 255, .15); --ring: rgba(124, 108, 255, .38);
  --grad: linear-gradient(135deg, #7c6cff 0%, #4f8bff 55%, #22d3ee 100%);
  --green: #34d399; --green-soft: rgba(52, 211, 153, .13);
  --red: #fb7185; --red-soft: rgba(251, 113, 133, .13);
  --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .13);
  --violet: #c084fc; --violet-soft: rgba(192, 132, 252, .14);
  --blue: #60a5fa; --blue-soft: rgba(96, 165, 250, .14);
  --r: 16px; --r-sm: 11px;
  --sh-sm: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --sh-lg: 0 30px 80px rgba(0, 0, 0, .6);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14px/1.5 var(--font); color: var(--text); display: flex; min-height: 100vh; -webkit-font-smoothing: antialiased;
  background: radial-gradient(900px 500px at 85% -10%, rgba(124, 108, 255, .13), transparent 60%),
              radial-gradient(700px 400px at 20% 110%, rgba(34, 211, 238, .07), transparent 60%), var(--bg);
  background-attachment: fixed;
}
a { color: #a5b4ff; text-decoration: none; }
a:hover { color: #c7d0ff; text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 4px; font-weight: 700; letter-spacing: -.025em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: #fff; }
h2 { font-size: 15px; margin: 0 0 14px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; color: #fff; }
h2 > .ic { color: var(--primary); }
h3 { font-size: 14px; margin: 16px 0 8px; }
small, .muted { color: var(--muted); }
b { font-weight: 600; }
.ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; }
::selection { background: rgba(124, 108, 255, .45); }
* { scrollbar-width: thin; scrollbar-color: #2b3650 transparent; }

/* ----- yon panel ----- */
#side { width: 252px; background: rgba(12, 17, 29, .92); backdrop-filter: blur(10px); border-right: 1px solid var(--line); color: var(--muted); padding: 20px 14px 14px; position: sticky; top: 0; height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 16px; color: #fff; }
.brand-text b { display: block; font-size: 17px; letter-spacing: -.01em; }
.brand-text small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.logo { width: 42px; height: 42px; border-radius: 13px; background: var(--grad); display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; box-shadow: 0 8px 24px rgba(124, 108, 255, .45); flex-shrink: 0; }
.new-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--grad); color: #fff; font-weight: 650; margin: 0 0 12px; box-shadow: 0 10px 26px rgba(91, 110, 255, .35); transition: transform .15s, box-shadow .15s, filter .15s; }
.new-btn:hover { color: #fff; text-decoration: none; transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 14px 30px rgba(91, 110, 255, .45); }
#side nav { flex: 1; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; position: relative; }
nav a span:first-of-type { flex: 1; }
nav a:hover { background: rgba(255, 255, 255, .04); color: var(--text); text-decoration: none; }
nav a.on { background: linear-gradient(90deg, rgba(124, 108, 255, .2), rgba(124, 108, 255, .04)); color: #fff; }
nav a.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); box-shadow: 0 0 12px rgba(124, 108, 255, .9); }
nav a.on .ic { color: #a99dff; }
.pill { background: var(--amber); color: #1f1300; border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 700; line-height: 19px; min-width: 20px; text-align: center; }
.pill.red { background: var(--red); color: #2a0610; }
.pill:empty { display: none; }
.me { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 14px 4px 2px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.me-text { flex: 1; min-width: 0; }
.me-text b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: transparent; border: 0; color: var(--muted); width: 32px; height: 32px; padding: 0; border-radius: 9px; display: grid; place-items: center; box-shadow: none; }
.icon-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; border: 0; }
body.auth #side { display: none; }

/* ----- asosiy maydon ----- */
main { flex: 1; padding: 30px 34px 64px; min-width: 0; max-width: 1400px; margin: 0 auto; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head > div:first-child small { display: block; margin-top: 2px; }
.head .row { flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.card { background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; box-shadow: var(--sh-sm); }
.card > h2:first-child { margin-top: -2px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); align-items: start; }
.grid > .card, .grid > div > .card:last-child { margin-bottom: 0; }
.grid > div > .card { margin-bottom: 18px; }

/* ----- statistika kartalari: har biri o'z yorqin rangida ----- */
/* Ikki ustunli sahifalar: ustunlar bo'yi teng, har ustunning oxirgi kartasi qolgan joyni to'ldiradi —
   bir tomonda katta bo'sh joy qolib ketmasin */
.g2.stretch { align-items: stretch; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stack > .card, .grid > .stack > .card { margin: 0; }
.stack > .card:last-child { flex: 1; }
.g2.measure { align-items: start; }
.g2.measure .stack > .card:last-child { flex: none; }
.card.fill { display: flex; flex-direction: column; }
.card.fill > .table-wrap, .card.fill > .grow { flex: 1; }
.card-foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { --tone: var(--blue); --tone-soft: var(--blue-soft);
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--tone); opacity: .9; }
.stat::after { content: ""; position: absolute; width: 160px; height: 160px; right: -60px; top: -70px; border-radius: 50%; background: var(--tone); opacity: .1; filter: blur(30px); pointer-events: none; }
.stat > div { min-width: 0; position: relative; }
.stat small { display: block; font-size: 12.5px; }
.stat b { display: block; font-size: clamp(19px, 1.6vw, 24px); margin-top: 3px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.25; color: #fff; }
.stat .sub { margin-top: 4px; }
.stat-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); flex-shrink: 0; position: relative; }
.stat-ic .ic { width: 20px; height: 20px; }
.stat.red { --tone: var(--red); --tone-soft: var(--red-soft); } .stat.red b { color: var(--red); }
.stat.green { --tone: var(--green); --tone-soft: var(--green-soft); } .stat.green b { color: var(--green); }
.stat.amber { --tone: var(--amber); --tone-soft: var(--amber-soft); } .stat.amber b { color: var(--amber); }
.stat.violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }

/* ----- grafik ----- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 220px; padding: 26px 4px 0; border-bottom: 1px solid var(--line); }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.chart .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.chart .bar { width: min(22px, 40%); border-radius: 7px 7px 3px 3px; position: relative; min-height: 3px; transition: filter .15s; }
.chart .bar:hover { filter: brightness(1.25); }
.chart .bar span { position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--text-2); white-space: nowrap; font-weight: 600; }
.chart .sold { background: linear-gradient(180deg, #c084fc, #7c6cff); box-shadow: 0 0 18px rgba(124, 108, 255, .35); }
.chart .paid { background: linear-gradient(180deg, #5eead4, #22d3ee); box-shadow: 0 0 18px rgba(34, 211, 238, .3); }
h2 small.unit { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.chart .lbl { font-size: 12px; color: var(--muted); padding: 8px 0 0; }
.chart .col.now .lbl { color: #fff; font-weight: 600; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ----- jadvallar ----- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.card.table-wrap { margin: 0 0 18px; padding: 20px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; background: rgba(255, 255, 255, .025); white-space: nowrap; }
th:first-child { border-top-left-radius: 10px; } th:last-child { border-top-right-radius: 10px; }
tr:last-child td { border-bottom: 0; }
td { color: var(--text-2); }
td b { color: var(--text); }
td small { line-height: 1.35; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click td { transition: background .12s; }
tr.click:hover td { background: var(--hover); }
.cell-title { font-weight: 600; color: #fff; }
a.cell-title:hover { color: #c7d0ff; }
table.compact th, table.compact td { padding: 10px 7px; }
table.compact th:first-child, table.compact td:first-child { padding-left: 10px; color: var(--muted); }
table.compact .badge { padding: 2px 8px; font-size: 11.5px; }

/* ----- belgilar (badge) ----- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.badge.plain::before { display: none; }
.b-green { background: var(--green-soft); color: var(--green); border-color: rgba(52, 211, 153, .25); }
.b-red { background: var(--red-soft); color: var(--red); border-color: rgba(251, 113, 133, .28); }
.b-amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(251, 191, 36, .25); }
.b-blue { background: var(--primary-soft); color: #a99dff; border-color: rgba(124, 108, 255, .3); }
.b-gray { background: rgba(255, 255, 255, .06); color: var(--muted); border-color: var(--line-2); }

/* ----- tugmalar ----- */
button, .btn { font: inherit; font-weight: 550; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); padding: 0 14px; height: 38px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, filter .15s; text-decoration: none !important; }
button:hover, .btn:hover { border-color: #435170; background: var(--hover); color: #fff; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.loading { position: relative; color: transparent !important; }
button.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(91, 110, 255, .32); }
.primary:hover { border-color: transparent; background: var(--grad); color: #fff; filter: brightness(1.1); }
.danger { color: var(--red); }
.danger:hover { color: var(--red); border-color: rgba(251, 113, 133, .45); background: var(--red-soft); }
.danger.solid { background: linear-gradient(135deg, #fb7185, #e11d48); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(225, 29, 72, .3); }
.danger.solid:hover { color: #fff; filter: brightness(1.1); background: linear-gradient(135deg, #fb7185, #e11d48); }
.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.sm .ic { width: 16px; height: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }

/* ----- forma ----- */
label { display: block; font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 6px; }
input, select, textarea { font: inherit; width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #0e1523; color: var(--text); transition: border-color .15s, box-shadow .15s, background .15s; }
textarea { height: auto; min-height: 84px; padding: 10px 13px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--primary); }
input::placeholder, textarea::placeholder { color: #5d6880; }
input:hover, select:hover, textarea:hover { border-color: #3c4966; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #101829; box-shadow: 0 0 0 4px var(--ring); }
input:user-invalid:not(:focus) { border-color: rgba(251, 113, 133, .6); }
select option { background: #121a2a; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.form-actions { padding-top: 4px; }
.section-title { grid-column: 1 / -1; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: #a99dff; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.input-ic { position: relative; }
.input-ic .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #66728b; pointer-events: none; }
.input-ic input { padding-left: 40px; }
.search, .quick-search { width: 300px; max-width: 100%; }
.big-search { max-width: 640px; }
.big-search input { height: 56px; font-size: 18px; border-radius: 15px; padding-left: 48px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.big-search .ic { width: 22px; height: 22px; left: 16px; }
.tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; margin-bottom: 16px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.tabs button { border: 0; background: transparent; box-shadow: none; height: 34px; border-radius: 10px; color: var(--muted); }
.tabs button:hover { background: rgba(255, 255, 255, .05); color: var(--text); border: 0; }
.tabs button.on { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(91, 110, 255, .35); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.presets button { height: 30px; border-radius: 999px; font-size: 12.5px; padding: 0 13px; }
.presets button.on { background: var(--primary-soft); border-color: rgba(124, 108, 255, .55); color: #c4bcff; }

/* ----- ma'lumotlar ro'yxati ----- */
.kv { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; gap: 0; margin: 0; }
.kv dt, .kv dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }

/* ----- hisob-kitob ----- */
.calc { position: relative; overflow: hidden; background: linear-gradient(135deg, rgba(124, 108, 255, .22), rgba(34, 211, 238, .1)); border: 1px solid rgba(124, 108, 255, .35); border-radius: 14px; padding: 20px; }
.calc::after { content: ""; position: absolute; width: 200px; height: 200px; right: -80px; top: -90px; border-radius: 50%; background: #7c6cff; opacity: .25; filter: blur(40px); }
.calc small { font-weight: 500; color: #c5cddd; }
.calc .big { font-size: 34px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; background: linear-gradient(90deg, #fff, #c7d2ff); -webkit-background-clip: text; background-clip: text; color: transparent; position: relative; }
.calc .kv { margin-top: 10px; position: relative; }
.calc .kv dt, .calc .kv dd { border-color: rgba(255, 255, 255, .08); }
.sms { background: #0e1523; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; font-size: 13px; margin-top: 8px; color: var(--text-2); max-width: 540px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .ic { width: 30px; height: 30px; display: block; margin: 0 auto 10px; color: #3c4966; }
.progress { height: 6px; background: rgba(255, 255, 255, .07); border-radius: 4px; overflow: hidden; margin-top: 7px; min-width: 80px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #22d3ee, #34d399); border-radius: 4px; box-shadow: 0 0 10px rgba(52, 211, 153, .6); }
.loading-page { display: grid; place-items: center; padding: 90px 0; color: var(--muted); }
.loading-page::before { content: ""; width: 30px; height: 30px; border-radius: 50%; border: 3px solid #253049; border-top-color: var(--primary); animation: spin .8s linear infinite; margin-bottom: 10px; }

/* ----- rasmlar ----- */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.photo-slot { border: 2px dashed #34405a; border-radius: 14px; padding: 12px; display: grid; gap: 10px; justify-items: center; text-align: center; background: rgba(255, 255, 255, .02); transition: border-color .15s, background .15s; }
.photo-slot:hover { border-color: #4b5878; }
.photo-slot.ok { border-style: solid; border-color: rgba(52, 211, 153, .55); background: var(--green-soft); }
.photo-slot img, .photo-box img { width: 100%; height: 180px; object-fit: contain; border-radius: 10px; background: #0b111d; cursor: zoom-in; display: block; }
.ph-empty { width: 100%; height: 180px; display: grid; place-items: center; align-content: center; gap: 6px; color: #5d6880; background: #0e1523; border-radius: 10px; padding: 8px; font-size: 13px; }
.ph-empty .ic { width: 30px; height: 30px; }
.photo-box { display: grid; gap: 8px; justify-items: center; text-align: center; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; background: #0e1523; display: block; border: 1px solid var(--line-2); }
.cam video { width: 100%; max-height: 60vh; background: #000; border-radius: 12px; display: block; }

/* ----- mijoz profili, ogohlantirishlar, MIB ----- */
.profile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.profile-head h2 { font-size: 18px; margin-bottom: 6px; }
.profile-head h2 a { color: #fff; }
.meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.meta .ic { width: 15px; height: 15px; }
.warn { display: flex; align-items: center; gap: 9px; background: var(--red-soft); color: var(--red); border: 1px solid rgba(251, 113, 133, .3); border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-weight: 600; }
.alert-bar { display: flex; align-items: center; gap: 14px; padding: 15px 18px; margin-bottom: 18px; border-radius: var(--r); background: linear-gradient(90deg, rgba(251, 191, 36, .16), rgba(251, 191, 36, .05)); border: 1px solid rgba(251, 191, 36, .3); color: var(--amber); transition: box-shadow .15s, border-color .15s; }
.alert-bar:hover { text-decoration: none; color: var(--amber); border-color: rgba(251, 191, 36, .55); box-shadow: 0 0 30px rgba(251, 191, 36, .12); }
.alert-bar > .ic { width: 22px; height: 22px; }
.alert-bar span:not(.go) { flex: 1; }
.alert-bar b, .alert-bar small { display: block; }
.alert-bar small { color: #c9a35a; }
.alert-bar .go { font-weight: 650; white-space: nowrap; }
/* xodim login-parol kartochkasi */
.cred { text-align: center; }
.cred .cred-kv { text-align: left; margin: 16px 0; padding: 12px 16px; border-radius: 13px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line-2); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 16px; letter-spacing: .04em; user-select: all; }
.modal-box:has(.cred) { width: 480px; }
/* ----- rollar ----- */
.no-access { display: none !important; }
.b-violet { background: var(--violet-soft, rgba(155, 123, 255, .14)); color: #b9a3ff; border-color: rgba(155, 123, 255, .3); }
.badge .ic { width: 13px; height: 13px; }
/* bosh sahifa: bugungi ko'rsatkichlar qatori */
.today-bar { display: flex; align-items: center; gap: 8px 26px; flex-wrap: wrap; padding: 13px 18px; margin-bottom: 18px; border-radius: var(--r);
  background: linear-gradient(90deg, rgba(124, 108, 255, .14), rgba(34, 211, 238, .06)); border: 1px solid rgba(124, 108, 255, .3); color: var(--text); }
.today-bar:hover { text-decoration: none; color: var(--text); border-color: rgba(124, 108, 255, .55); }
.today-bar .tb-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: #b9a3ff; }
.today-bar span small { display: block; color: var(--muted); font-size: 11.5px; }
.today-bar span b { font-size: 15px; }
.today-bar span b + small { display: inline; margin-left: 6px; }
.today-bar .go { margin-left: auto; font-weight: 650; color: #b9a3ff; }
/* bekor qilingan shartnoma */
.cancel-bar { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; margin-bottom: 18px; border-radius: var(--r); background: rgba(255, 255, 255, .04); border: 1px dashed var(--line-2); color: var(--muted); }
.cancel-bar > .ic { width: 22px; height: 22px; flex: none; color: var(--red); }
.cancel-bar b { display: block; color: var(--text); }
.cancel-bar span, .cancel-bar small { display: block; margin-top: 3px; }
/* undiruvchi kartalari */
.debtors { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 18px; }
.debtor { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.debtor-top { display: flex; gap: 12px; align-items: flex-start; }
.thumb.lg { width: 58px; height: 58px; flex: none; }
.debtor-main { flex: 1; min-width: 0; }
.debtor-main small { display: block; color: var(--muted); }
.debtor-sum { text-align: right; }
.debtor-sum small { display: block; color: var(--muted); font-size: 11.5px; }
.debtor-sum b { color: var(--red); font-size: 16px; white-space: nowrap; }
.debtor-kv { font-size: 13px; margin: 0; }
.debtor-actions { margin-top: auto; gap: 8px; }
.debtor-actions .primary { flex: 1; justify-content: center; }
/* hisobot, xodimlar, tizim */
.report-filter { gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.role-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.role-help small { display: block; color: var(--muted); margin-top: 6px; }
tr.err-new td { background: rgba(251, 113, 133, .06); }
pre.stack { white-space: pre-wrap; word-break: break-all; font-size: 11px; color: var(--muted); max-height: 220px; overflow: auto; margin: 6px 0 0; }
details summary { cursor: pointer; color: var(--muted); }
.tabs .pill { margin-left: 6px; }
@media (max-width: 640px) {
  .debtors { grid-template-columns: 1fr; }
  .debtor-top { flex-wrap: wrap; }
  .debtor-sum { flex-basis: 100%; text-align: left; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
    padding: 9px 12px; border-radius: 11px; background: var(--red-soft); }
  .debtor-sum b { order: 1; }
  .debtor-sum small:first-child { order: 0; }
  .debtor-sum small:last-child { order: 2; flex-basis: 100%; }
  .debtor-kv { display: grid; grid-template-columns: 82px 1fr; }
  .today-bar { gap: 8px 18px; }
  .today-bar .go { margin-left: 0; }
}
.mib-box { border-radius: 13px; padding: 12px 14px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .02); }
.mib-box.good { background: var(--green-soft); border-color: rgba(52, 211, 153, .3); }
.mib-box.bad { background: var(--red-soft); border-color: rgba(251, 113, 133, .32); color: var(--red); }
.mib-box.warnbox { background: var(--amber-soft); border-color: rgba(251, 191, 36, .3); color: var(--amber); }
.mib-box p { margin: 8px 0 0; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 13px 14px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--text); background: rgba(255, 255, 255, .02); transition: border-color .15s, background .15s; }
.choice label:hover { background: var(--hover); }
.choice label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--ring); }
.ack { display: flex; gap: 9px; align-items: center; margin: 10px 0 0; color: var(--red); font-weight: 600; cursor: pointer; }
.file-btn { margin: 0; }

/* ----- modal oyna ----- */
#modal { position: fixed; inset: 0; background: rgba(3, 6, 12, .7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease-out; }
#modal[hidden] { display: none; }
.modal-box { background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 26px; width: min(680px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--sh-lg); animation: pop .18s ease-out; }
.modal-box h2 { font-size: 19px; margin-bottom: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ----- xabarlar (toast) ----- */
#toast { position: fixed; bottom: 22px; right: 22px; z-index: 60; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
#toast div { display: flex; align-items: center; gap: 10px; background: #1a2338; border: 1px solid var(--line-2); color: #fff; padding: 12px 16px; border-radius: 13px; box-shadow: var(--sh-lg); animation: pop .2s ease-out; font-weight: 500; }
#toast div .ic { color: var(--green); }
#toast div.err { background: #3a1220; border-color: rgba(251, 113, 133, .45); }
#toast div.err .ic { color: var(--red); }

/* ----- kirish sahifasi ----- */
body.auth { background: radial-gradient(700px 420px at 50% 0%, rgba(124, 108, 255, .3), transparent 65%), radial-gradient(600px 400px at 50% 110%, rgba(34, 211, 238, .14), transparent 60%), var(--bg); }
body.auth main { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login { width: min(410px, 100%); padding: 34px; border-radius: 22px; margin: 0; background: rgba(18, 26, 42, .85); backdrop-filter: blur(14px); border-color: var(--line-2); box-shadow: var(--sh-lg); }
.login .logo { width: 52px; height: 52px; font-size: 24px; margin-bottom: 20px; border-radius: 15px; }
.login h1 { font-size: 24px; }
.login p { margin: 0 0 24px; }
.login form { display: grid; gap: 14px; }
.login button.primary { height: 46px; margin-top: 6px; font-size: 15px; }


#print { display: none; }
td.nowrap { white-space: nowrap; }

/* ----- to'lov cheki (kassa cheki ko'rinishida, doim oq qog'oz) ----- */
.modal-box.rc-modal { width: min(400px, 100%); padding: 22px; background: radial-gradient(420px 260px at 50% 0%, rgba(124, 108, 255, .22), transparent 70%), var(--surface); }
.rc-wrap { display: flex; justify-content: center; padding: 4px 0 18px; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45)); }
.rc-actions { justify-content: center; }
.rc-actions button { flex: 1; }
.receipt {
  --ink: #12131a; --ink-2: #5b6070; --paper: #fffdf8;
  position: relative; width: 100%; max-width: 330px; background: var(--paper); color: var(--ink);
  padding: 22px 20px 26px; font-size: 13px; line-height: 1.45; font-variant-numeric: tabular-nums;
  border-radius: 6px 6px 0 0;
  /* pastki tishli chet */
  -webkit-mask: radial-gradient(7px at 50% 100%, #0000 98%, #000) 50% / 18px 100% repeat-x;
          mask: radial-gradient(7px at 50% 100%, #0000 98%, #000) 50% / 18px 100% repeat-x;
}
.receipt::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, #7c6cff, #4f8bff, #22d3ee); border-radius: 6px 6px 0 0; }
.rc-head { text-align: center; margin-top: 4px; }
.rc-logo { font-size: 30px; font-weight: 800; letter-spacing: .22em; padding-left: .22em; line-height: 1.1;
  background: linear-gradient(135deg, #5b4ae6, #2f6fe8 55%, #0aa5c4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rc-tag { font-size: 11.5px; color: var(--ink-2); letter-spacing: .02em; }
.rc-title { text-align: center; margin: 14px 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .28em; color: var(--ink); }
.rc-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.receipt hr { border: 0; border-top: 1.5px dashed #c9ccd6; margin: 12px 0; }
.rc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 2.5px 0; }
.rc-row span { color: var(--ink-2); flex-shrink: 0; }
.rc-row b { font-weight: 600; text-align: right; overflow-wrap: anywhere; color: var(--ink); }
.rc-row.rc-strong b { font-size: 15px; font-weight: 800; }
.rc-amount { text-align: center; margin: 2px 0 10px; padding: 12px 8px; border-radius: 10px; background: #f1efff; border: 1px solid #e2ddff; }
.rc-amount small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #6b5fd6; font-weight: 700; }
.rc-amount b { display: block; font-size: 27px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); margin-top: 2px; }
.rc-amount i { font-style: normal; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.rc-closed { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; padding: 8px; border-radius: 8px; background: #e7f8ef; color: #0f7a46; font-weight: 700; }
.rc-closed .ic { width: 16px; height: 16px; }
.rc-foot { text-align: center; }
.rc-foot b { display: block; font-size: 14px; }
.rc-foot small { color: var(--ink-2); font-size: 11px; }

/* telefonda pastki o'ng burchakdagi "Yangi nasiya" tugmasi */
.fab { display: none; position: fixed; right: 16px; bottom: 18px; z-index: 30; height: 54px; padding: 0 22px; border-radius: 27px; background: var(--grad); color: #fff; font-weight: 650; align-items: center; gap: 8px; box-shadow: 0 12px 30px rgba(91, 110, 255, .5); }
.fab:hover { text-decoration: none; color: #fff; }
body.auth .fab { display: none !important; }

/* ----- telefon va planshet ----- */
@media (max-width: 900px) {
  body { flex-direction: column; }
  #side { width: auto; height: auto; position: sticky; top: 0; z-index: 20; padding: 10px 12px 8px; gap: 8px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand me" "nav nav"; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
  .brand { grid-area: brand; padding: 0; }
  .brand .logo { width: 36px; height: 36px; font-size: 17px; border-radius: 11px; }
  .brand-text small { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .me { grid-area: me; border: 0; padding: 0; gap: 2px; }
  .me .avatar, .me-text { display: none; }
  .new-btn { display: none; }
  #side nav { grid-area: nav; flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  #side nav::-webkit-scrollbar { display: none; }
  nav a { white-space: nowrap; padding: 8px 12px; flex-shrink: 0; }
  nav a.on::before { display: none; }
  /* ustun rejimida margin:auto asosiy maydonni kontent kengligiga cho'zib yuborardi — ekran kengligiga bog'laymiz */
  main { padding: 18px 16px 96px; width: 100%; max-width: none; margin: 0; }
  h1 { font-size: 22px; }
  .head { margin-bottom: 18px; align-items: stretch; }
  .head .row, .head .search, .head .quick-search { width: 100%; }
  .head .row > * { flex: 1 1 auto; }
  .card { padding: 16px; border-radius: 14px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .card.table-wrap { padding: 16px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat-ic { width: 34px; height: 34px; border-radius: 10px; }
  .stat b { font-size: 18px; }
  .chart { height: 180px; gap: 6px; }
  .chart .bar span { display: none; }
  .kv { grid-template-columns: 110px 1fr; }
  .photo-slot img, .photo-box img, .ph-empty { height: 140px; }
  .fab { display: flex; }
}
@media (max-width: 520px) {
  .photos, .choice { grid-template-columns: 1fr; }
}

@page report { size: A4 landscape; margin: 10mm; }
@page doc { size: A4 portrait; margin: 14mm 15mm 14mm 20mm; }
textarea.terms { font-size: 13px; line-height: 1.55; }
.doc-ready { text-align: center; }
.doc-ready h2 { text-align: center; justify-content: center; }
.modal-box:has(.doc-ready) { width: min(480px, 100%); }
.doc-ready-ic { display: inline-grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--green-soft, rgba(52, 211, 153, .15)); color: var(--green); margin: 4px auto 12px; box-shadow: 0 0 0 8px rgba(52, 211, 153, .07); }
.doc-ready-ic .ic { width: 28px; height: 28px; }
.doc-ready p { color: var(--muted); margin: 0 auto 20px; max-width: 420px; }
/* chop etish doim oq qog'ozda */
@media print {
  :root { color-scheme: light; }
  body { display: block; background: #fff !important; color: #000; }
  #side, main, #modal, #toast, .fab { display: none !important; }
  #print { display: block; font-size: 12px; color: #000; }
  #print h2, #print h3, #print b, #print strong { color: #000; }
  #print table { font-size: 11px; }
  #print th, #print td { padding: 4px 6px; border: 1px solid #bbb; color: #000; background: #fff; }
  #print .photos img { width: 100%; max-height: 230px; object-fit: contain; }
  #print .page { page-break-after: always; }
  #print .page:last-child { page-break-after: auto; }
  /* qog'oz shartnoma: A4 tik, rasmiy hujjat ko'rinishi */
  #print .doc { page: doc; font-family: "Times New Roman", Times, serif; font-size: 11.5pt; line-height: 1.42; color: #000; }
  #print .doc-page { break-after: page; }
  #print .doc-page:last-child { break-after: auto; }
  #print .doc-top { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; padding-bottom: 4px; margin-bottom: 14px; font-family: Inter, Arial, sans-serif; font-size: 9pt; }
  #print .doc-logo { font-size: 15pt; font-weight: 800; letter-spacing: .25em; color: #3f46c4; }
  #print .doc h1 { text-align: center; font-size: 13.5pt; font-weight: 700; margin: 0 0 12px; line-height: 1.3; color: #000; letter-spacing: .02em; }
  #print .doc h2 { font-size: 11.5pt; font-weight: 700; margin: 12px 0 4px; text-align: center; color: #000; break-after: avoid; }
  #print .doc h3 { font-size: 11pt; margin: 0 0 4px; color: #000; text-transform: uppercase; letter-spacing: .04em; }
  #print .doc p { margin: 0 0 4px; text-align: justify; }
  #print .doc p.indent { text-indent: 1.2em; margin-bottom: 6px; }
  #print .doc p.center { text-align: center; margin-bottom: 10px; }
  #print .doc p.small { font-size: 9.5pt; margin-top: 8px; }
  #print .doc-place { display: flex; justify-content: space-between; margin-bottom: 12px; }
  #print .doc .blank { display: inline-block; border-bottom: 1px solid #000; min-width: 150px; height: 1em; vertical-align: bottom; }
  #print .doc .blank.short { min-width: 90px; }
  #print .doc table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-size: 10.5pt; }
  #print .doc th, #print .doc td { border: 1px solid #000; padding: 3px 7px; color: #000; background: #fff; text-align: left; vertical-align: top; }
  #print .doc th { text-transform: none; letter-spacing: 0; font-size: inherit; }
  #print .doc .doc-sum th { width: 34%; font-weight: 400; }
  #print .doc-grid th { background: #eee !important; font-size: 9.5pt; text-align: center; }
  #print .doc-grid td { height: 22px; }
  #print .doc-grid td:first-child { text-align: center; width: 26px; }
  #print .doc .num { text-align: right; white-space: nowrap; }
  #print .doc-grid tfoot td { font-weight: 700; }
  #print .doc-grid tr { break-inside: avoid; }
  #print .doc-annex { text-align: right; font-size: 10pt; margin-bottom: 14px; }
  #print .sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 8px; break-inside: avoid; }
  #print .sigs.three { grid-template-columns: 1fr 1fr 1fr; gap: 12px; font-size: 10pt; }
  #print .doc h1, #print .doc h2 { display: block; }
  #print .sig { display: flex; flex-direction: column; }
  #print .sig div { margin-bottom: 2px; overflow-wrap: anywhere; color: #000; }
  #print .sig .sig-line { margin-top: auto; padding-top: 22px; }
  #print .sig span:first-child { color: #333; }
  #print .sig-note { font-size: 9pt; font-style: italic; margin-top: 6px !important; text-align: left !important; }
  #print .sig-line { display: flex; flex-direction: column; }
  #print .sig-line span { border-bottom: 1px solid #000; height: 1px; }
  #print .sig-line small { font-size: 8pt; color: #444; text-align: center; }
  /* qarzdorlar ro'yxati: A4 albom (yotiq) */
  #print .report { page: report; font-size: 10.5px; color: #111; }
  .rp-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid #4f5bd5; padding-bottom: 8px; margin-bottom: 10px; }
  .rp-logo { font-size: 24px; font-weight: 800; letter-spacing: .2em; color: #3f46c4; }
  .rp-head small { color: #555; }
  .rp-title { text-align: right; }
  .rp-title h1 { margin: 0; font-size: 18px; color: #000; }
  .rp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
  .rp-stats div { border: 1px solid #ccd; border-left: 4px solid #4f5bd5; border-radius: 6px; padding: 6px 10px; }
  .rp-stats div.red { border-left-color: #d93a4a; }
  .rp-stats small { display: block; color: #555; text-transform: uppercase; font-size: 8.5px; letter-spacing: .06em; font-weight: 700; }
  .rp-stats b { font-size: 14px; color: #000; }
  .rp-stats i { font-style: normal; color: #555; margin-left: 6px; }
  #print .report table { width: 100%; border-collapse: collapse; font-size: 10px; }
  #print .report th { background: #eef0fb !important; color: #222; text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .03em; }
  #print .report th, #print .report td { border: 1px solid #c8cbd8; padding: 4px 6px; vertical-align: top; }
  #print .report .num { text-align: right; white-space: nowrap; }
  #print .report tr.late td:last-child { color: #b45309; font-weight: 700; }
  #print .report tr.col td:last-child { color: #c0262d; font-weight: 700; }
  #print .report .mut { color: #555; }
  #print .report thead { display: table-header-group; }
  #print .report tr { break-inside: avoid; }
  #print .report tfoot td { font-weight: 800; background: #f4f5fa !important; }
  .rp-foot { display: flex; justify-content: space-between; margin-top: 18px; color: #333; }
  #print .report.rep h2 { display: block; font-size: 12px; margin: 12px 0 5px; color: #000; text-transform: uppercase; letter-spacing: .05em; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* chek: 80 mm kassa printeri yoki oddiy printerda tor ustun */
  body.print-receipt #print .receipt { max-width: 76mm; margin: 0 auto; padding: 4mm 3mm; -webkit-mask: none; mask: none; border-radius: 0; background: #fff; font-size: 12px; }
  body.print-receipt #print .receipt::before { display: none; }
  body.print-receipt #print .rc-logo { color: #000; background: none; -webkit-text-fill-color: #000; }
  body.print-receipt #print .rc-amount { background: #fff; border: 1.5px solid #000; }
  body.print-receipt #print .rc-amount small, body.print-receipt #print .rc-row span, body.print-receipt #print .rc-tag, body.print-receipt #print .rc-meta { color: #000; }
  body.print-receipt #print .rc-closed { background: #fff; color: #000; border: 1px solid #000; }
  body.print-receipt #print hr { border-top-color: #000; }
}
