/* =====================================================================
   Qo'qon kolbasa — asosiy dizayn.
   • Mobil birinchi: telefonda pastki menyu, kompyuterda chap menyu.
   • Ikki mavzu: yorug' va qorong'i. Barcha ranglar faqat o'zgaruvchilar
     orqali beriladi — shuning uchun qorong'i mavzuda ham har bir yozuv
     o'qiladi (kontrast WCAG AA ≥ 4.5:1 tekshirilgan, scripts/contrast.py).
   • Tashqi kutubxona yo'q — internet bo'lmasa ham ishlaydi.
   ===================================================================== */

/* ---------- Yorug' mavzu (standart) ---------- */
:root {
  color-scheme: light;
  --bg: #f5f2ef;
  --card: #ffffff;
  --surface-2: #faf7f4;     /* jadval sarlavhasi, ro'yxat sarlavhasi */
  --hover: #f6f1ec;
  --text: #1d1a17;
  --muted: #655e57;
  --line: #e8e2db;
  --input-border: #cbc2b9;
  --label: #463f39;

  --brand: #d42e12;          /* logotip rangi — tugma va bloklar foni */
  --brand-hover: #b0240c;
  --brand-text: #b8260d;     /* brend rangidagi YOZUV (oq fonda o'qiladi) */
  --on-brand: #ffffff;
  --brand-soft: #fdece7;

  --green: #13734a;  --green-soft: #e4f3ea;  --green-solid: #13734a;
  --orange: #9a4d06; --orange-soft: #fcefdf;
  --red: #b9241a;    --red-soft: #fde7e4;    --red-solid: #c0261c;
  --blue: #1b5ba1;   --blue-soft: #e6eff9;
  --help-text: #17406b;

  --row-has: #fff4ec;
  --toast-bg: #2b2724;
  --topbar-bg: var(--brand);
  --topbar-text: #ffffff;
  --overlay: rgba(245, 242, 239, .88);
  --shadow: 0 1px 2px rgba(30, 20, 10, .06), 0 2px 8px rgba(30, 20, 10, .05);
  --shadow-lg: 0 -2px 18px rgba(30, 20, 10, .14);

  --chart-1: #d42e12; --chart-2: #1b5ba1; --chart-3: #13734a; --chart-4: #c27a0e; --chart-5: #7a4bb5; --chart-6: #0f8a8a;
  --chart-grid: #ece6df;

  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- Qorong'i mavzu ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121110;
  --card: #1d1b19;
  --surface-2: #262320;
  --hover: #2a2724;
  --text: #f3eee9;
  --muted: #b5ada5;
  --line: #36312c;
  --input-border: #5a524b;
  --label: #dcd5ce;

  --brand: #d42e12;
  --brand-hover: #b0240c;
  --brand-text: #ff8d72;
  --on-brand: #ffffff;
  --brand-soft: #3b1e17;

  --green: #5fd49a;  --green-soft: #153024;  --green-solid: #13734a;
  --orange: #f4ac62; --orange-soft: #3a2a17;
  --red: #ff8278;    --red-soft: #3e1e1b;    --red-solid: #c0261c;
  --blue: #8dbdf3;   --blue-soft: #18283b;
  --help-text: #d3e5f9;

  --row-has: #2d211b;
  --toast-bg: #3a3530;
  --topbar-bg: #1d1b19;
  --topbar-text: #f3eee9;
  --overlay: rgba(18, 17, 16, .88);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-lg: 0 -2px 18px rgba(0, 0, 0, .6);
  --chart-1: #ff7a5c; --chart-2: #6ea8f0; --chart-3: #4fc98b; --chart-4: #f2b24a; --chart-5: #b48ef0; --chart-6: #4fd1cf;
  --chart-grid: #312c28;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  transition: background-color .2s, color .2s;
}
a { color: var(--brand-text); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
svg { width: 20px; height: 20px; flex: none; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.warn { color: var(--orange); }
[hidden] { display: none !important; }

/* ---------- Karkas ---------- */
.sidebar { display: none; }
.main { min-height: 100vh; padding-bottom: calc(78px + var(--safe-b)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--topbar-bg); color: var(--topbar-text);
  border-bottom: 1px solid transparent;
}
:root[data-theme="dark"] .topbar { border-bottom-color: var(--line); }
.top-title { color: var(--topbar-text); font-weight: 700; display: flex; align-items: center; gap: 8px; flex: 1;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title img { height: 40px; width: auto; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.back-btn { color: var(--topbar-text); display: flex; padding: 4px; margin-left: -6px; }
.back-btn svg { width: 24px; height: 24px; }
.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: rgba(255,255,255,.16); color: var(--topbar-text); cursor: pointer; flex: none; }
:root[data-theme="dark"] .icon-btn { background: var(--surface-2); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .dot { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: #ffd23f; color: #1d1a17; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.script-switch { display: flex; background: rgba(255,255,255,.16); border-radius: 999px; padding: 2px; flex: none; }
:root[data-theme="dark"] .script-switch { background: var(--surface-2); }
.script-switch a { color: var(--topbar-text); font-size: 12px; padding: 5px 9px; border-radius: 999px; }
.script-switch a.on { background: #fff; color: #9e220c; font-weight: 700; }
:root[data-theme="dark"] .script-switch a.on { background: var(--brand); color: #fff; }
/* Telefonda tepada faqat logotip (nom sig'maydi) */
@media (max-width: 520px) { .top-title .tt-name { display: none; } }
.content { padding: 14px; max-width: 1180px; margin: 0 auto; overflow-x: hidden; }

/* Pastki menyu (telefon) */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  align-items: flex-end; background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-b));
}
.bottombar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted);
  font-size: 11px; min-width: 58px; padding: 4px 0; }
.bottombar a.on { color: var(--brand-text); font-weight: 700; }
.bottombar svg { width: 24px; height: 24px; }
.bottombar .fab { background: var(--brand); color: var(--on-brand); width: 54px; height: 54px; min-width: 0;
  border-radius: 50%; justify-content: center; margin-top: -26px; box-shadow: 0 4px 14px rgba(212,46,18,.45); }
.bottombar .fab svg { width: 28px; height: 28px; }

/* Kompyuter: chap menyu */
@media (min-width: 960px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 252px;
    background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; z-index: 25;
  }
  .brand { display: block; padding: 14px 18px 8px; }
  .brand img { width: 150px; height: auto; display: block; }
  .sidebar nav { flex: 1; padding: 0 10px 10px; }
  .sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
    color: var(--text); margin-bottom: 1px; }
  .sidebar nav a svg { color: var(--muted); }
  .sidebar nav a:hover { background: var(--hover); }
  .sidebar nav a.on { background: var(--brand-soft); color: var(--brand-text); font-weight: 700; }
  .sidebar nav a.on svg { color: var(--brand-text); }
  .nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    padding: 14px 10px 4px; font-weight: 600; }
  .side-foot { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center;
    justify-content: space-between; gap: 8px; }
  .who { font-weight: 600; font-size: 14px; }
  .who small { display: block; font-weight: 400; color: var(--muted); }
  .main { margin-left: 252px; padding-bottom: 30px; }
  .bottombar { display: none; }
  .topbar { --topbar-text: var(--text); background: var(--overlay); backdrop-filter: blur(8px);
    border-bottom-color: var(--line); }
  .top-title img { display: none; }
  .icon-btn { background: var(--card); border: 1px solid var(--line); }
  .script-switch { background: var(--card); border: 1px solid var(--line); }
  .script-switch a { color: var(--muted); }
  .script-switch a.on { background: var(--brand); color: #fff; }
  .content { padding: 22px 26px; }
}

/* ---------- Sahifa sarlavhasi ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Bo'lim izohi (yordam) */
.help { background: var(--blue-soft); border-radius: 12px; margin-bottom: 14px; color: var(--help-text); font-size: 14px; }
.help a { color: var(--help-text); text-decoration: underline; }
.help summary { cursor: pointer; padding: 10px 12px; display: flex; gap: 8px; align-items: center;
  list-style: none; font-weight: 600; }
.help summary::-webkit-details-marker { display: none; }
.help summary::after { content: "▾"; margin-left: auto; transition: transform .2s; }
.help[open] summary::after { transform: rotate(180deg); }
.help .help-body { padding: 0 14px 12px 40px; }
.help ol, .help ul { margin: 4px 0; padding-left: 18px; }
.help li { margin: 3px 0; }
.help code { background: rgba(127,127,127,.18); color: inherit; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); border-radius: 11px; padding: 9px 14px; font: inherit; font-weight: 600;
  cursor: pointer; min-height: 42px; white-space: nowrap; transition: background-color .15s, border-color .15s;
}
.btn:hover { border-color: var(--input-border); background: var(--hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.green { background: var(--green-solid); border-color: var(--green-solid); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red-soft); }
.btn.danger.solid { background: var(--red-solid); color: #fff; border-color: var(--red-solid); }
.btn.sm { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
button.link { background: none; border: 0; color: var(--brand-text); font: inherit; cursor: pointer; padding: 0; }

/* ---------- Kartalar ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
  margin-bottom: 14px; }
.card > h2 { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 14px 0; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
@media (min-width: 760px) { .grid.c2 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: repeat(3, 1fr); } }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: block;
  color: var(--text); min-width: 0; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .value small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat .foot { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.brand { background: var(--brand); color: var(--on-brand); }
.stat.brand .label, .stat.brand .foot, .stat.brand small { color: rgba(255,255,255,.9) !important; }

/* Tez harakatlar (bosh sahifa) */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.quick a { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 12px 4px; font-size: 12px; color: var(--text); text-align: center;
  font-weight: 600; line-height: 1.2; }
.quick a span.ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text); }
.quick a:nth-child(2) span.ic { background: var(--green-soft); color: var(--green); }
.quick a:nth-child(3) span.ic { background: var(--orange-soft); color: var(--orange); }
.quick a:nth-child(4) span.ic { background: var(--blue-soft); color: var(--blue); }
@media (min-width: 760px) { .quick { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 759px) { .hide-sm { display: none !important; } }

/* ---------- Ro'yxat (telefon uchun qulay) ---------- */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.list .li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line);
  color: var(--text); }
.list .li:first-child { border-top: 0; }
a.li:hover { background: var(--hover); }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.li .s { font-size: 12.5px; color: var(--muted); }
.li .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li .v small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.li .ava { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand-text); font-weight: 700; }
.li .ava.g { background: var(--green-soft); color: var(--green); }
.li .ava.o { background: var(--orange-soft); color: var(--orange); }
.li .ava.b { background: var(--blue-soft); color: var(--blue); }
.li.deleted { opacity: .6; }
.li.unread { background: var(--row-has); }
.list-head { padding: 10px 14px; background: var(--surface-2); font-size: 12px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; }

/* ---------- Jadval ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 9px 10px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.table .num, .table th.num { text-align: right; }

/* ---------- Belgilar ---------- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- Formalar ---------- */
.form { max-width: 720px; }
.field { margin-bottom: 12px; }
.field > label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--label); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--input-border); border-radius: 11px;
  background: var(--card); font: inherit; font-size: 16px; color: var(--text);
}
.input::placeholder { color: var(--muted); opacity: .85; }
textarea.input { min-height: 70px; resize: vertical; }
.input:focus { outline: 2px solid rgba(212,46,18,.35); border-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .row3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.seg { display: flex; background: var(--surface-2); padding: 3px; border-radius: 12px; gap: 3px; border: 1px solid var(--line); }
.seg label { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; cursor: pointer; font-weight: 600;
  font-size: 14px; color: var(--muted); }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--card); color: var(--brand-text); box-shadow: var(--shadow); }
.reason-box { background: var(--orange-soft); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.reason-box label { color: var(--orange) !important; }

/* Parol maydoni: ko'rsatish / yashirish tugmasi bilan */
.pwd { position: relative; }
.pwd .input { padding-right: 52px; }
.pwd-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 38px;
  border: 0; background: transparent; color: var(--muted); border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.pwd-toggle:hover, .pwd-toggle:focus-visible { color: var(--text); background: var(--hover); }
.pwd-toggle svg { width: 22px; height: 22px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters .input { width: auto; min-height: 40px; font-size: 14px; padding: 7px 10px; }
.filters .btn { min-height: 40px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 38px; }

/* ---------- Mahsulot tanlash ro'yxati (yuk chiqarish, kirim) ---------- */
.pick-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.pick-tools .search { flex: 1; min-width: 180px; }
.pick { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.pick-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 12px;
  border-top: 1px solid var(--line); align-items: center; }
.pick-row:first-child { border-top: 0; }
.pick-row.has { background: var(--row-has); box-shadow: inset 4px 0 0 var(--brand); }
.pick-row.over { background: var(--red-soft); }
.pick-row .name { font-weight: 600; }
.pick-row .meta { font-size: 12.5px; color: var(--muted); }
.pick-row .meta b { color: var(--text); font-weight: 600; }
.pick-row .meta .low { color: var(--red); font-weight: 700; }
.pick-row .inputs { display: flex; gap: 6px; align-items: center; }
.pick-row .inputs .input { width: 96px; min-height: 42px; text-align: right; padding: 8px; font-weight: 600; }
.pick-row .inputs .input.price { width: 110px; font-weight: 400; }
.pick-row .unit { font-size: 12px; color: var(--muted); min-width: 30px; }
.pick-row .rowsum { grid-column: 1 / -1; text-align: right; font-size: 13px; color: var(--muted); display: none; }
.pick-row.has .rowsum { display: block; }
.pick-row .rowsum b { color: var(--text); }
.pick-row .err { grid-column: 1 / -1; color: var(--red); font-size: 12.5px; font-weight: 700; display: none; }
.pick-row.over .err { display: block; }
@media (min-width: 760px) {
  .pick-row { grid-template-columns: 1fr auto 150px; }
  .pick-row .rowsum { grid-column: auto; display: block; }
  .pick-row .err { grid-column: 1 / -1; }
}
.pick.only-selected .pick-row:not(.has) { display: none; }

/* Pastki jami paneli */
.totalbar {
  position: sticky; bottom: calc(70px + var(--safe-b)); z-index: 15; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; align-items: center; gap: 12px; margin-top: 6px;
  border: 1px solid var(--line);
}
@media (min-width: 960px) { .totalbar { bottom: 12px; } }
.totalbar .tot { flex: 1; }
.totalbar .tot .l { font-size: 12px; color: var(--muted); }
.totalbar .tot .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.totalbar .tot .c { font-size: 12px; color: var(--muted); }

/* ---------- Hujjat ko'rinishi ---------- */
.doc-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.doc-head .k { font-size: 12px; color: var(--muted); }
.doc-head .v { font-weight: 600; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.cheque-img { max-width: 100%; width: 360px; border-radius: 10px; box-shadow: var(--shadow); background: #fff; }
.deleted-banner { background: var(--red-soft); color: var(--red); padding: 10px 14px; border-radius: 12px;
  margin-bottom: 12px; font-weight: 700; }

/* ---------- Bildirishnomalar (toast) ---------- */
.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(94vw, 520px);
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--toast-bg); color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: 0 6px 22px rgba(0,0,0,.25);
  font-weight: 500; transition: opacity .4s, transform .4s; pointer-events: auto; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.toast.success { background: var(--green-solid); }
.toast.error { background: var(--red-solid); }
.toast .tt { font-weight: 700; display: block; }
.toast .tb { font-size: 13px; opacity: .95; }
.toast svg { width: 22px; height: 22px; margin-top: 1px; }
.toast.hide { opacity: 0; transform: translateY(-10px); }

/* ---------- Grafiklar ---------- */
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }
.chart-box.round { height: 260px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0;
  justify-content: flex-end; font-size: 11px; color: var(--muted); }
.bars .bar i { display: block; width: 100%; max-width: 42px; background: var(--brand); border-radius: 6px 6px 2px 2px;
  min-height: 3px; opacity: .8; }
.bars .bar.today i { opacity: 1; }
.bars .bar b { font-size: 9.5px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; max-width: 100%; }
@media (max-width: 759px) { .bars .bar b { display: none; } }

/* ---------- Menyu sahifasi (telefon) ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
@media (min-width: 760px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }
.menu-grid a { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; color: var(--text);
  display: flex; flex-direction: column; gap: 8px; font-weight: 600; }
.menu-grid a svg { width: 26px; height: 26px; color: var(--brand-text); }
.menu-grid a small { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.3; }
.menu-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 2px 8px; font-weight: 700; }

/* Bo'sh holat */
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .6; display: block; margin: 0 auto 8px; }

/* Kirish sahifasi */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(165deg, var(--brand) 0%, var(--brand-hover) 42%, var(--bg) 42.1%); }
.login-card { width: min(100%, 390px); background: var(--card); border-radius: 22px; padding: 22px 22px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18); color: var(--text); }
.login-logo { display: block; width: 210px; max-width: 70%; height: auto; margin: 0 auto 10px; }
.login-card h1 { text-align: center; font-size: 19px; }
.login-tools { display: flex; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.login-tools .script-switch, .login-tools .icon-btn { background: var(--surface-2); border: 1px solid var(--line); --topbar-text: var(--text); }
.login-tools .script-switch a { color: var(--muted); }
.login-tools .script-switch a.on { background: var(--brand); color: #fff; }

/* O'rnatish tugmasi */
.install-btn { position: fixed; right: 14px; bottom: calc(86px + var(--safe-b)); z-index: 40; border: 0;
  background: var(--toast-bg); color: #fff; border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 600;
  display: flex; gap: 6px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); cursor: pointer; }
@media (min-width: 960px) { .install-btn { bottom: 20px; } }

/* Audit */
pre.diff { background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 10px; font-size: 12px; overflow-x: auto; max-height: 260px; }

/* Harakatni kamaytirish sozlamasi */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Chop etish — har doim yorug' */
@media print {
  :root { --bg: #fff; --card: #fff; --text: #000; --muted: #444; }
  .sidebar, .topbar, .bottombar, .doc-actions, .help, .install-btn, .toasts { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; }
}

/* Excel'ga yuklab olish tugmasi qatori */
.xl-row { display: flex; justify-content: flex-end; margin: 0 0 10px; }
