/* TajirAi — minimalizm / luxury. Tashqi shrift, rasm yoki kutubxona yo'q: sahifa tez ochiladi. */
:root {
  --ink: #17181a;
  --ink-soft: #5b5d62;
  --ink-faint: #8c8e93;
  --paper: #f7f5f1;
  --card: #ffffff;
  --line: #e6e2d9;
  --line-soft: #efece5;
  --gold: #a8844b;
  --gold-deep: #7d6236;
  --gold-wash: #f5eee1;
  --ok: #2e6b4e;
  --ok-wash: #e6f1ea;
  --bad: #9c3b32;
  --bad-wash: #f7e6e3;
  --warn: #8a5f12;
  --warn-wash: #f8efd9;
  --info: #3a5a85;
  --info-wash: #e8eef6;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  /* eski nomlar (boshqa fayllar bilan moslik) */
  --tile: var(--ink);
  --tile-wash: var(--gold-wash);
  --tile-deep: #121314;
  --tile-deeper: #0b0c0d;
  --saffron: var(--gold);
  --saffron-wash: var(--warn-wash);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.55 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
h2 { font-size: 16px; letter-spacing: .01em; }
h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* ---------- Karkas ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: #121314; color: #a9a59c; padding: 26px 14px 18px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
.brand { font-family: var(--serif); font-size: 26px; font-weight: 500; color: #fff; padding: 0 12px 2px; letter-spacing: .02em; }
.brand span { color: var(--gold); }
.brand-sub { padding: 0 12px 18px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #6f6c65; border-bottom: 1px solid #25272a; margin-bottom: 10px; }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a {
  color: #a9a59c; padding: 10px 12px; border-radius: 8px; font-size: 14.5px; border-left: 2px solid transparent;
  display: flex; justify-content: space-between; align-items: center;
}
.side nav a:hover { color: #fff; background: #1b1c1e; text-decoration: none; }
.side nav a.on { color: #fff; background: #1b1c1e; border-left-color: var(--gold); font-weight: 600; }
.side nav .count { background: var(--gold); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; font-weight: 600; }
.nav-group { margin: 14px 12px 4px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #6f6c65; }
.side-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid #25272a; font-size: 13px; color: #7c7970; }
.side-foot strong { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.side-foot form { margin-top: 10px; }
.nav-toggle, .burger { display: none; }

.main { padding: 34px 40px 70px; min-width: 0; max-width: 1280px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.top h1 { font-size: 30px; }
.top .sub { color: var(--ink-soft); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Kartochka, jadval ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.card-head .muted { font-size: 13px; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1.7fr 1fr; }
.cols-2e { grid-template-columns: 1fr 1fr; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .v { font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1.15; margin-top: 4px; }
.kpi .v small { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.kpi .l { color: var(--ink-faint); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.kpi .d { font-size: 13px; margin-top: 4px; color: var(--ink-faint); }
.kpi.alert { border-color: #e6d3aa; background: var(--warn-wash); }
.up { color: var(--ok); font-weight: 600; }
.down { color: var(--bad); font-weight: 600; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfaf7; }
td.num, th.num { text-align: right; white-space: nowrap; }
.empty { padding: 30px 12px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; color: var(--ink); margin-bottom: 2px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
details.card > summary { cursor: pointer; font-weight: 600; }
details[open].card > summary { margin-bottom: 14px; }

.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; }
.flash.ok { background: var(--ok-wash); border-color: #c4dccf; color: #214c37; }
.flash.err, .flash.bad { background: var(--bad-wash); border-color: #e9c6c1; color: #6e2820; }
.flash.warn { background: var(--warn-wash); border-color: #e6d3aa; color: #5f430c; }
.flash a { margin-left: 8px; font-weight: 600; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding-top: 14px; color: var(--ink-soft); font-size: 14px; }

/* ---------- Belgilar ---------- */
.badge { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-wash); color: var(--ok); }
.b-warn { background: var(--warn-wash); color: var(--warn); }
.b-bad { background: var(--bad-wash); color: var(--bad); }
.b-info { background: var(--info-wash); color: var(--info); }
.b-mute { background: #efede8; color: var(--ink-soft); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--ink-faint); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--gold); } .dot.fail { background: var(--bad); }

/* ---------- Tugmalar, formalar ---------- */
.btn {
  display: inline-block; border: 1px solid #d6d1c5; background: var(--card); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; line-height: 1.3;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f3f1ec; text-decoration: none; border-color: #c5bfb0; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; border-color: #000; }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn.ghost-light { background: transparent; border-color: #34363a; color: #cfcbc2; width: 100%; }
.btn.ghost-light:hover { background: #1b1c1e; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d6d1c5; border-radius: 10px; background: #fff;
  font: inherit; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-wash); }
.field { margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }

/* ---------- Diagramma (CSS ustunlar) ---------- */
.bars { display: flex; gap: 6px; align-items: stretch; height: 210px; }
.bar-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bar-val { height: 18px; font-size: 11px; color: var(--ink-faint); text-align: center; white-space: nowrap; overflow: hidden; }
.bar-area { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.bar { width: 100%; background: #2a2c2f; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-col.today .bar { background: var(--gold); }
.bar-lbl { text-align: center; font-size: 11px; color: var(--ink-faint); padding-top: 5px; }

/* ---------- Ro'yxatlar ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 12px; }
.list li:last-child { border-bottom: 0; }
.list .sub { color: var(--ink-soft); font-size: 13px; }
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { padding: 4px 0; display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.prose { white-space: pre-wrap; line-height: 1.65; }
.ai-card { border-color: #e3d6bb; background: linear-gradient(180deg, #fbf7ee, #fff 60%); }
.hint-box { background: var(--gold-wash); border-radius: 10px; padding: 11px 16px; color: #5c4721; font-size: 14px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }

/* ---------- Kirish sahifasi ---------- */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px); }
.login-art {
  background: #121314; color: #bdb9af; padding: 60px 60px 40px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-art::before { /* nozik oltin chiziqlar */
  content: ""; position: absolute; inset: 0; opacity: .55;
  background: repeating-linear-gradient(135deg, transparent 0 46px, rgba(168,132,75,.14) 46px 47px);
  -webkit-mask-image: radial-gradient(ellipse at 90% 10%, #000 0%, transparent 70%); mask-image: radial-gradient(ellipse at 90% 10%, #000 0%, transparent 70%);
}
.login-art > * { position: relative; }
.login-art .brand { font-size: 40px; padding: 0; }
.login-art h2 { font-family: var(--serif); font-size: 32px; font-weight: 500; color: #fff; max-width: 15em; margin: 0 0 14px; line-height: 1.2; }
.login-art p { max-width: 32em; color: #a39f95; font-size: 16px; }
.login-types { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.login-types span { border: 1px solid #34363a; border-radius: 99px; padding: 3px 13px; font-size: 13.5px; color: #b7b3a9; }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 32px; background: var(--paper); }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-size: 30px; margin-bottom: 4px; }
.login-box .btn.primary { width: 100%; padding: 12px; font-size: 16px; }
.demo { margin-top: 26px; font-size: 14px; }
.demo summary { cursor: pointer; font-weight: 600; }
.demo table { margin-top: 8px; font-size: 13px; }
.demo td { padding: 6px 8px; cursor: pointer; }
.demo td:hover { background: var(--gold-wash); }

/* ---------- Moslashuvchan (telefon, planshet) ---------- */
@media (max-width: 1000px) {
  .cols-2, .cols-2e { grid-template-columns: 1fr; }
  .main { padding: 26px 24px 60px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; max-height: 100vh; flex-direction: column; padding: 10px 14px; gap: 0; }
  .brand { padding: 0; font-size: 22px; line-height: 40px; }
  .burger {
    display: flex; position: absolute; right: 12px; top: 8px; width: 44px; height: 44px; align-items: center; justify-content: center;
    border: 1px solid #34363a; border-radius: 10px; color: #fff; font-size: 22px; cursor: pointer; margin: 0;
  }
  .drawer {
    display: flex; flex-direction: column; gap: 4px; position: fixed; z-index: 40; top: 0; left: 0; bottom: 0;
    width: min(84vw, 320px); background: #121314; padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    transform: translateX(-102%); transition: transform .25s ease; box-shadow: 6px 0 30px rgba(0,0,0,.4); visibility: hidden;
  }
  .nav-toggle:checked ~ .drawer { transform: none; visibility: visible; }
  .drawer .brand-sub { display: block; }
  .backdrop { display: none; position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.5); }
  .nav-toggle:checked ~ .backdrop { display: block; }
  body:has(.nav-toggle:checked) { overflow: hidden; }
  .side nav a { padding: 13px 12px; font-size: 16px; }
  .main { padding: 20px 16px 50px; }
  .top h1 { font-size: 25px; }
  .card { padding: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .v { font-size: 23px; }
  input, select, textarea { font-size: 16px; } /* iPhone yaqinlashtirib yubormasin */
  .btn { padding: 11px 16px; }
  .btn.small { padding: 8px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .filters .field { min-width: 0; flex: 1 1 100%; }
  .login-shell { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px; }
  .login-art h2 { font-size: 24px; }
  .login-art .login-types, .login-art p { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .bar { transition: height .4s ease; }
}

/* iPhone: notch va pastki chiziq ostida qolmasin (to'liq ekran rejimi) */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.side { padding-top: calc(26px + env(safe-area-inset-top)); }
.main { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.fs-btn { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; background: #121314; color: #fff; border: 1px solid #3a3c40; border-radius: 99px; padding: 9px 14px; font-size: 13px; cursor: pointer; opacity: .9; }
.ios-hint { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 70; background: #121314; color: #fff; border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.45; box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.ios-hint button { margin-top: 8px; background: #fff; color: #121314; border: 0; border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto; }
.splash { position: fixed; inset: 0; z-index: 9999; background: radial-gradient(circle at 50% 42%, #1f2022 0%, #121314 62%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; transition: opacity .45s ease; }
.splash.hide { opacity: 0; pointer-events: none; }
.sp-logo { width: 124px; height: 124px; animation: sp-pop .7s cubic-bezier(.2,.9,.3,1.2) both; filter: drop-shadow(0 10px 28px rgba(217,182,111,.25)); }
.sp-t { stroke-dasharray: 1; stroke-dashoffset: 1; animation: sp-draw .8s .15s ease-out forwards; }
.sp-tfill { opacity: 0; animation: sp-fadein .45s .75s ease-out forwards; }
.sp-star { transform-box: fill-box; transform-origin: center; opacity: 0; animation: sp-star 1.1s 1s ease-out forwards, sp-twinkle 1.6s 2.1s ease-in-out infinite; }
.sp-name { font-family: var(--serif); font-weight: 500; font-size: 32px; color: #fff; letter-spacing: .04em; animation: sp-rise .6s .55s ease-out both; }
.sp-name span { color: #d9b66f; }
.sp-bar { display: block; width: 120px; height: 3px; background: #2a2c2f; border-radius: 3px; overflow: hidden; animation: sp-rise .6s .7s ease-out both; }
.sp-bar u { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, #d9b66f, #a8844b); border-radius: 3px; animation: sp-load 1.1s .8s ease-in-out infinite; }
@keyframes sp-pop { 0% { transform: scale(.6) rotate(-6deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes sp-draw { to { stroke-dashoffset: 0; } }
@keyframes sp-fadein { to { opacity: 1; } }
@keyframes sp-star { 0% { opacity: 0; transform: scale(0) rotate(-90deg); } 60% { opacity: 1; transform: scale(1.35) rotate(15deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes sp-twinkle { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes sp-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sp-load { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .splash *, .sp-logo { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; } }

/* Kamera skaneri */
.scan-box { position: fixed; inset: 0; z-index: 200; background: #000; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 42%; width: min(78vw, 420px); height: min(34vw, 200px); transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scan-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.scan-flash.ok { background: rgba(34,197,94,.55); }
.scan-flash.bad { background: rgba(239,68,68,.5); }
.scan-flash.go { animation: scan-flash .6s ease-out; }
@keyframes scan-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.scan-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(14px + env(safe-area-inset-top)) 16px 14px; background: linear-gradient(#000a, transparent); }
.scan-count { color: #fff; font-size: 16px; font-weight: 600; }
.scan-done { background: #22c55e; color: #05220f; border: 0; border-radius: 99px; padding: 10px 22px; font-size: 16px; font-weight: 700; cursor: pointer; }
.scan-info { position: absolute; left: 12px; right: 12px; bottom: calc(24px + env(safe-area-inset-bottom)); text-align: center; background: rgba(18,19,20,.88); color: #fff; padding: 14px 16px; border-radius: 14px; font-size: 18px; font-weight: 600; }
.scan-info.ok { background: rgba(21,128,61,.95); }
.scan-info.bad { background: rgba(185,28,28,.95); }
body.scanning { overflow: hidden; }

.cam-btn { margin-left: 8px; }

/* Menyuni tortganda oq sahifaga (pull-to-refresh) o'tib ketmasin */
html, body { overscroll-behavior-y: none; }
.drawer { display: contents; }
@media (max-width: 860px) { .drawer { display: flex; } }
