/* ALCANA PRINT — veb-panel. Ranglar saytdagidek (yashil aksent); Telegram ichida — Telegram mavzusiga moslashadi. */
:root {
  --accent: #12a150;
  --accent-fill: #0e8340;   /* tugma foni: oq matn bilan 4.8:1 (WCAG AA) */
  --on-accent: #ffffff;
  --accent-ink: #0c7d3d;
  --accent-soft: #e3f4ea;
  --bg: #eef2f0;
  --card: #ffffff;
  --tile: #f6f8f7;
  --line: #e2e8e5;
  --text: #0b0f0d;
  --muted: #5b6661;
  --danger: #c62f2f;
  --danger-fill: #c62f2f;
  --danger-soft: #fbe9e9;
  --warn: #9a5c00;
  --warn-soft: #fff2dc;
  --info: #1e63c9;
  --info-soft: #e5eefc;
  --violet: #6b45c9;
  --violet-soft: #efe9fc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 6px 18px rgba(16, 24, 20, .05);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #2fbf6e; --accent-fill: #2fbf6e; --on-accent: #04140b; --accent-ink: #3ad384; --accent-soft: #11291c; --danger-fill: #c93636;
    --bg: #060807; --card: #0f1311; --tile: #161b18; --line: #232b27; --text: #f1f5f3; --muted: #9aa6a0;
    --danger: #ef6b6b; --danger-soft: #2c1414; --warn: #e5a23c; --warn-soft: #2b2010; --info: #6ea2f2; --info-soft: #121e33;
    --violet: #a68af0; --violet-soft: #1d1630;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --accent: #2fbf6e; --accent-fill: #2fbf6e; --on-accent: #04140b; --accent-ink: #3ad384; --accent-soft: #11291c; --danger-fill: #c93636;
  --bg: #060807; --card: #0f1311; --tile: #161b18; --line: #232b27; --text: #f1f5f3; --muted: #9aa6a0;
  --danger: #ef6b6b; --danger-soft: #2c1414; --warn: #e5a23c; --warn-soft: #2b2010; --info: #6ea2f2; --info-soft: #121e33;
  --violet: #a68af0; --violet-soft: #1d1630;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3, h2.h3 { font-size: 15px; font-weight: 650; }   /* kartadagi kichik sarlavha: h2 (tartib uchun), ko'rinishi h3 */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* --- ishga tushish --- */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 6px; }
.boot-mark { font-weight: 800; letter-spacing: .14em; color: var(--accent-ink); }
.boot-sub { color: var(--muted); font-size: 14px; }

/* --- sahifa --- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; }
.brand b { letter-spacing: .12em; font-size: 13px; color: var(--accent-ink); }
.brand span { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 12px; border-radius: 999px; color: var(--muted); white-space: nowrap; font-weight: 550; font-size: 14px;
}
.nav a:hover { background: var(--tile); text-decoration: none; color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); }
@media (min-width: 901px) {   /* kompyuterda menyu sig'masa — ikkinchi qatorga o'tadi (yashirin aylantirish o'rniga) */
  .nav { flex-wrap: wrap; overflow: visible; row-gap: 2px; }
  .nav a { padding: 6px 10px; }
}
.nav-group { display: none; }
@media (max-width: 900px) {   /* telefonda menyu yonga suriladi — chetlari xira bo'lib, davomi borligini ko'rsatadi */
  .nav { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%);
         mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent 100%); padding: 0 10px; scroll-padding: 0 24px; }
}
.nav a .count { margin-left: 6px; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--danger-fill); color: #fff;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.offscreen { position: fixed; left: -9999px; opacity: 0; }
.audit-row td { font-size: 13px; }
.audit-row .act { white-space: nowrap; }
.audit-row.denied td { background: var(--danger-soft); }
.bonus-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.theme-btn { font-size: 16px; line-height: 1; padding: 6px 8px; }
.who .name { font-weight: 600; font-size: 14px; }
main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* --- kartalar va panjaralar --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid > .card + .card, .stack > .card + .card, .detail > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid.kpi { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }   /* tor telefonda ham sig'adi */
.kpi-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi-tile .label { color: var(--muted); font-size: 13px; }
.kpi-tile .value { font-size: 26px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-tile .value.long { font-size: 21px; }
.kpi-tile .value .unit { display: inline-block; font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi-tile .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* --- tugmalar va maydonlar --- */
.btn {
  border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.danger-fill { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.danger-zone { border: 1px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 6px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.seg { display: inline-flex; background: var(--tile); border: 1px solid var(--line); border-radius: 999px; padding: 3px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], input[type="datetime-local"], select, textarea {
  border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-sm); padding: 8px 10px; width: 100%;
  outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 84px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 550; }
label.field > span { color: var(--muted); }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 11px; font-size: 13px;
  cursor: pointer; font-weight: 550; display: inline-flex; gap: 6px; align-items: center; color: var(--text);
}
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chip.alert .count { color: var(--danger); font-weight: 700; }

/* --- jadvallar va ro'yxatlar --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.mono { white-space: nowrap; }   /* telefon, summa, sana — bir qatorda (jadval yonga suriladi) */
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--tile); }
.list { display: flex; flex-direction: column; }
.item {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; align-items: center;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--tile); }
.item .no { font-weight: 750; font-variant-numeric: tabular-nums; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item .side { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--tile); color: var(--muted); }
.badge.new, .badge.reopened { background: var(--info-soft); color: var(--info); }
.badge.accepted, .badge.in_progress { background: var(--accent-soft); color: var(--accent-ink); }
.badge.waiting_customer, .badge.cancel_requested { background: var(--warn-soft); color: var(--warn); }
.badge.production { background: var(--violet-soft); color: var(--violet); }
.badge.done { background: var(--accent-soft); color: var(--accent-ink); }
.badge.cancelled { background: var(--tile); color: var(--muted); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.pri { font-size: 12px; font-weight: 700; }
.pri.P1 { color: var(--danger); } .pri.P2 { color: var(--warn); } .pri.P3 { color: var(--accent-ink); }
.empty { padding: 28px 10px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 12px; }

/* --- grafiklar --- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 6px; height: 100%; }
.bars .fill { width: 100%; max-width: 34px; background: var(--accent); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.bars .fill.zero { background: var(--line); }
.bars .lbl { font-size: 10px; color: var(--muted); white-space: nowrap; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 40px; gap: 8px; align-items: center; font-size: 13px; }
.hbar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* to'liq nomi — title'da */
.hbar .track { background: var(--tile); border-radius: 999px; height: 9px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter { background: var(--tile); border-radius: 999px; height: 8px; overflow: hidden; min-width: 120px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.hbar .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* --- ariza sahifasi --- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.detail aside { position: sticky; top: 74px; }
.kv { margin: 0; display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px -4px 12px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 12px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; background: var(--tile); border: 1px solid var(--line); }
.msg.out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.msg.note { align-self: center; background: var(--warn-soft); border-color: transparent; max-width: 92%; }
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.msg .tr-btn { padding: 0 4px; margin-left: 4px; font-size: 12px; line-height: 1.2; }
.tr { margin-top: 6px; padding: 6px 9px; border-radius: 10px; background: var(--accent-soft, var(--tile)); font-size: 13px; white-space: pre-wrap; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg.deleted .body { text-decoration: line-through; opacity: .6; }
.composer { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; }
.timeline time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.file { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; font-size: 12px; text-align: center; cursor: pointer; background: var(--tile); }
.file img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 4px; }

/* --- narx kalkulyatori --- */
.qlines { display: flex; flex-direction: column; gap: 8px; }
.qline { display: grid; grid-template-columns: minmax(0, 1fr) 84px minmax(0, 140px) minmax(0, 120px) 40px; gap: 8px; align-items: start; }
.qline.head { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.qline:not(.head) { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.qname { display: flex; flex-direction: column; gap: 4px; }
.qsum { padding: 8px 0; text-align: right; font-weight: 650; }
.qtotal { display: flex; flex-direction: column; gap: 6px; }
.qrow { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.qrow > :last-child { white-space: nowrap; }
.qrow.disc { color: var(--accent-ink); }
.qrow.pay { margin-top: 6px; padding: 12px 14px; background: var(--accent-fill); color: var(--on-accent); border-radius: var(--radius-sm); font-size: 16px; }
.qrow.bank { padding: 10px 14px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-sm); }
.qalert-inline { border-left: 4px solid var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.qstatus { display: flex; flex-direction: column; gap: 10px; }
.qalert { border-left: 4px solid var(--warn); background: var(--warn-soft); margin-bottom: 14px; }
.qalert .body { white-space: pre-wrap; margin: 6px 0; }
@media (max-width: 640px) {
  .qline { grid-template-columns: 1fr 1fr; }
  .qline.head { display: none; }
  .qline .qname { grid-column: 1 / -1; }
  .qline .qsum { text-align: left; }
}

.hours { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.hours .chip { justify-content: center; padding: 5px 0; font-variant-numeric: tabular-nums; }

/* --- dizayn --- */
.design-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.design-item .feedback { background: var(--warn-soft); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.card-inset { background: var(--tile); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 12px; }
input[type="file"] { font-size: 14px; }

/* --- matnlar --- */
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
.keys { max-height: 70vh; overflow-y: auto; }
.key { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.key:hover { background: var(--tile); }
.key.on { background: var(--accent-soft); }
.key code { font-size: 12px; color: var(--accent-ink); }
.key .prev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); display: inline-block; margin-left: 6px; vertical-align: middle; }
code.var { background: var(--tile); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.orig { font-size: 12px; color: var(--muted); white-space: pre-wrap; background: var(--tile); border-radius: 8px; padding: 6px 8px; }

/* --- kirish --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { max-width: 400px; width: 100%; text-align: center; padding: 28px 22px; }
.login .mark { font-weight: 800; letter-spacing: .16em; color: var(--accent-ink); font-size: 14px; }
.code { font-size: 40px; font-weight: 800; letter-spacing: .25em; margin: 10px 0 4px; font-variant-numeric: tabular-nums; }

/* --- xabarnomalar --- */
#toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(92vw, 420px); }
.toast { background: var(--text); color: var(--card); padding: 10px 14px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); }
.toast.err { background: var(--danger-fill); color: #fff; }

@media (max-width: 760px) {
  .topbar-in { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .who { margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -4px; }
}
@media (max-width: 900px) {
  .detail, .split { grid-template-columns: minmax(0, 1fr); }
  .detail aside { position: static; }
  .who .name { display: none; }
}
@media (max-width: 560px) {
  main { padding: 12px 12px 60px; }
  .item { grid-template-columns: 56px 1fr; }
  .item .side { grid-column: 2; flex-direction: row; justify-content: flex-start; flex-wrap: wrap; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dt { margin-top: 8px; }
  .hbar { grid-template-columns: 1fr 32px; row-gap: 3px; }   /* telefonda nomi to'liq — chiziq ustida */
  .hbar > span:first-child { grid-column: 1 / -1; white-space: normal; }
  .brand span { display: none; }
}
.row > select { width: auto; flex: 1 1 80px; }
.card-head .badge { white-space: normal; }

/* --- 2-bosqich: to'lov, mijoz tarixi, belgilar --- */
.badge.waiting { background: var(--info-soft, #e8f0fd); color: var(--info, #2f5fb3); }
.danger-text { color: var(--danger); font-weight: 600; }
.hints { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.chip.sm { padding: 3px 9px; font-size: 12px; }
.chip.ok { border-color: var(--accent); }
.other-req { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.other-req:hover { background: var(--tile); text-decoration: none; }
.other-req .small:last-child { grid-column: 1 / -1; color: var(--text); }
.card-inset .row input { max-width: 220px; }

/* --- qulaylik: ekran o'quvchi, klaviatura, sensorli ekran, harakatni kamaytirish --- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
a:focus-visible, button:focus-visible, .chip:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-fill); width: 18px; height: 18px; }
@media (pointer: coarse) {   /* barmoq bilan bosiladigan tugmalar — kamida ~40 px */
  .btn, .seg button, .tabs button, .nav a { min-height: 40px; }
  .btn.sm, .chip { min-height: 36px; }
  .btn.ghost.sm, .theme-btn { min-width: 40px; justify-content: center; }
  select, input[type="text"], input[type="search"], input[type="number"], input[type="password"], input[type="datetime-local"] { min-height: 42px; }
  .pager .btn { min-width: 44px; justify-content: center; }
}
@media (pointer: coarse) {   /* jadvaldagi va «← orqaga» havolalar — bosish oson bo'lsin */
  td a, a.small, .kv dd a { display: inline-block; padding: 6px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* --- katta ekran: menyu chap ustunda, guruhlar bilan --- */
@media (min-width: 1200px) {
  .shell { padding-left: 236px; }
  .shell .topbar { position: fixed; inset: 0 auto 0 0; width: 236px; border-bottom: 0; border-right: 1px solid var(--line);
    background: var(--card); backdrop-filter: none; overflow-y: auto; }
  .shell .topbar-in { flex-direction: column; align-items: stretch; height: 100%; max-width: none; padding: 20px 14px 16px; gap: 18px; }
  .shell .brand { padding: 0 10px; }
  .shell .nav { flex-direction: column; flex-wrap: nowrap; overflow: visible; flex: 1 0 auto; gap: 2px; row-gap: 2px; }
  .shell .nav a { display: flex; align-items: center; justify-content: space-between; border-radius: 10px; padding: 8px 12px; }
  .shell .nav-group { display: block; margin: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted); }
  .shell .nav-group:first-child { margin-top: 0; }
  .shell .who { flex-wrap: wrap; white-space: normal; gap: 6px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
  .shell .who .name { flex-basis: 100%; }
  .shell main { padding-top: 24px; }
  .detail aside { top: 18px; }
}

/* --- 📐 TZ yordamchisi --- */
.tz-fields { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tz-note { cursor: default; max-width: 100%; }
.tz-note > span { overflow-wrap: anywhere; }
.chip .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.chip .x:hover { color: var(--danger); }
.tz-snip { padding: 0 4px 0 0; gap: 0; background: var(--tile); }
.tz-snip .add { border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 3px 6px 3px 9px; font: inherit; text-align: left; overflow-wrap: anywhere; }
.tz-lib { max-height: 168px; overflow-y: auto; }
.tz-add input { flex: 1 1 220px; }
.tz-choice { align-items: center; flex-wrap: wrap; }
.tz-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tz-thumbs figure { margin: 0; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; }
.tz-thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--tile); border-radius: 6px; }
.tz-actions { justify-content: flex-end; }

/* --- 🗓 ish rejasi --- */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cal-month-card { padding: 10px; }
.cal-wd { background: var(--tile); padding: 6px 2px; font-size: 12px; font-weight: 650; color: var(--muted); text-align: center; }
.cal-cell { background: var(--card); min-height: 104px; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-cell:hover { background: var(--tile); }
.cal-cell.other { background: var(--tile); }
.cal-cell.other .cal-num { color: var(--muted); }
.cal-num { font: inherit; font-size: 12px; font-weight: 700; min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 999px;
  align-self: flex-start; border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 0 4px; }
.cal-cell.today .cal-num { background: var(--accent-fill); color: var(--on-accent, #fff); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-task { --k: var(--muted); --k-soft: var(--tile); display: flex; gap: 4px; align-items: baseline; width: 100%; text-align: left; border: 0;
  border-left: 3px solid var(--k); background: var(--k-soft); color: var(--text); border-radius: 6px; padding: 2px 5px; font: inherit;
  font-size: 12px; line-height: 1.3; cursor: pointer; overflow: hidden; min-width: 0; }
.cal-task .t-time { font-variant-numeric: tabular-nums; font-weight: 650; flex: none; }
.cal-task .t-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-task .t-who { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal-task.k-production { --k: var(--violet); --k-soft: var(--violet-soft); }
.cal-task.k-install { --k: var(--accent); --k-soft: var(--accent-soft); }
.cal-task.k-delivery { --k: var(--info); --k-soft: var(--info-soft); }
.cal-task.k-measure { --k: var(--warn); --k-soft: var(--warn-soft); }
.cal-task.s-planned { box-shadow: inset 0 0 0 1px var(--danger); }      /* hali qabul qilinmagan — qizil chegara */
.cal-task.s-done { --k: var(--line); --k-soft: var(--tile); }          /* bajarilgan — kulrang, nomi ustidan chizilgan */
.cal-task.s-done .t-title { text-decoration: line-through; }
.cal-task.urgent .t-time::before { content: "⚡"; }
.cal-scroll { overflow-x: auto; padding: 0; }
.cal-grid { display: grid; min-width: min-content; }
.cal-corner, .cal-colhead { background: var(--card); border-bottom: 1px solid var(--line); padding: 8px 6px; font-size: 12px; font-weight: 650; text-align: center; }
.cal-colhead { border-left: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-colhead.today { color: var(--accent-ink); background: var(--accent-soft); }
.cal-hours { position: relative; }
.cal-hour { position: absolute; right: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; transform: translateY(-50%); }
.cal-hour:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 1; pointer-events: none; }
.cal-col .cal-task { position: absolute; flex-direction: column; align-items: stretch; gap: 0; padding: 3px 5px; z-index: 2; }
.cal-col .cal-task .t-title { white-space: normal; overflow-wrap: anywhere; }
.cal-col .cal-task .t-time { font-size: 11px; }
.cal-month .cal-task .t-who { display: none; }                       /* kim — oynada va maslahatda (joy tor) */
.cal-month .cal-task { flex-wrap: wrap; }
.cal-month .cal-task .t-title { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; }
.mine-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.mine-item.is-new { border-color: var(--danger); background: var(--danger-soft); }
.mine-item.urgent { border-left: 4px solid var(--danger); }
.link-btn { border: 0; background: none; padding: 0; color: var(--text); font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
.link-btn:hover { color: var(--accent-ink); text-decoration: underline; }
.task-dialog { border: 0; border-radius: var(--radius); padding: 18px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  overflow-y: auto; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.task-dialog::backdrop { background: rgba(0, 0, 0, .45); }
@media (max-width: 560px) {
  .cal-month-card { padding: 4px; }
  .cal-cell { min-height: 64px; padding: 2px; }
  .cal-month .cal-task { padding: 1px 3px; font-size: 11px; }
  .cal-month .cal-task .t-title, .cal-month .cal-task .t-who { display: none; }
}
