/* DRG baza — yengil dizayn: oq fon, qora matn, qizil urg'u */
:root {
  --red: #E30613; --red-d: #B8050F; --red-soft: #FDECEC;
  --ink: #0E0E10; --ink-2: #3A3A40; --muted: #7A7A82; --line: #E9E9EC; --line-2: #F2F2F4;
  --bg: #F7F7F8; --card: #FFFFFF;
  --green: #0F9D58; --green-soft: #E7F6EE; --amber: #C77700; --amber-soft: #FFF4E0; --blue: #2563EB; --blue-soft: #EAF1FE;
  --r: 10px; --sh: 0 1px 2px rgba(14,14,16,.04), 0 1px 1px rgba(14,14,16,.03);
  --side: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.red { color: var(--red); }
.hidden { display: none !important; }

.boot-spinner, .spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite; margin: 80px auto; }
.spinner { margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Kirish ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: #fff; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box img { height: 44px; display: block; margin: 0 0 28px; }
.auth-box h1 { margin-bottom: 4px; }
.auth-box p { margin: 0 0 22px; }
.auth-box .btn { width: 100%; justify-content: center; height: 42px; margin-top: 6px; }

/* ---------- Karkas ---------- */
.layout { display: flex; min-height: 100vh; }
.side { width: var(--side); background: #fff; border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 30; transition: transform .2s; }
.side-logo { padding: 20px 20px 16px; }
.side-logo img { height: 30px; display: block; }
.side-logo .co { font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .08em; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav-group { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; margin-bottom: 1px; }
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--line-2); color: var(--ink); }
.nav a.on { background: var(--ink); color: #fff; }
.nav a.on svg { color: var(--red); }
.nav a .cnt { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 0 6px; line-height: 18px; }
.side-user { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.main { flex: 1; margin-left: var(--side); min-width: 0; display: flex; flex-direction: column; }
.top { height: 60px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.top h1 { flex: 1; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .burger { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.overlay { display: none; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

/* ---------- Bildirishnoma ---------- */
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; box-sizing: content-box; }
.notif-pop { position: absolute; right: 16px; top: 54px; width: 380px; max-width: calc(100vw - 32px); max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.12); z-index: 40; }
.notif-pop .hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.notif-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.notif-item:hover { background: var(--line-2); }
.notif-item.unread { background: var(--red-soft); }
.notif-item .t { font-size: 13px; }
.notif-item .d { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- Komponentlar ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.card-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-hd h2 { flex: 1; }
.card-bd { padding: 16px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.sp { flex: 1; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--line-2); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-d); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #2a2a2e; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--red); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 30px; }
.btn:disabled { opacity: .5; cursor: default; }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.inp, select.inp, textarea.inp { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.inp { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
.inp:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(14,14,16,.06); }
.inp.sm { height: 32px; font-size: 13px; padding: 0 8px; }
.inp.num { text-align: right; }
.inp:disabled { background: var(--line-2); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; }
.tabs a.on { color: var(--ink); border-color: var(--red); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 5px 11px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCFCFD; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #FAFAFB; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: #FCFCFD; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.dark { background: var(--ink); color: #fff; }

.kpi { padding: 16px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.accent .l, .kpi.accent .s { color: #A9A9B0; }

.eff { font-weight: 700; font-variant-numeric: tabular-nums; }
.eff.lo { color: var(--red); } .eff.mid { color: var(--amber); } .eff.hi { color: var(--green); }
.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.bar.red i { background: var(--red); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; color: var(--line); display: block; margin: 0 auto 8px; }

/* ---------- Hisobot ---------- */
.check-card { display: flex; align-items: center; gap: 20px; padding: 18px; flex-wrap: wrap; }
.check-card .time { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.check-btn { height: 46px; padding: 0 22px; font-size: 15px; font-weight: 600; border-radius: 10px; }
.f > .check-btn { width: 100%; justify-content: center; margin-top: 18px; }
.date-nav { display: inline-flex; align-items: center; gap: 4px; }
.date-nav .inp { width: 150px; }
.items .qty { width: 90px; }
.items .cmt { min-width: 160px; }
.items [data-f="title"] { min-width: 200px; }
.src { font-size: 11px; color: var(--muted); }
.sumbar { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); border-top: 1px solid var(--line); }
.sumbar > div { padding: 12px 16px; border-right: 1px solid var(--line-2); }
.sumbar > div:last-child { border-right: 0; }
.sumbar .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sumbar .v { font-size: 16px; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.save-bar { position: sticky; bottom: 0; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 12px 24px; margin: 16px -24px -24px; display: flex; gap: 10px; align-items: center; justify-content: flex-end; z-index: 5; }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--line); }
.st-working { background: var(--green); } .st-left { background: var(--ink); } .st-absent { background: var(--red); } .st-dayoff { background: var(--line); }

/* ---------- Tiketlar ---------- */
.tk { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; align-items: flex-start; }
.tk:hover { background: #FAFAFB; }
.tk:last-child { border-bottom: 0; }
.tk .id { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 36px; padding-top: 2px; }
.tk .body { flex: 1; min-width: 0; }
.tk .t { font-weight: 600; }
.tk .m { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tk .m svg { width: 12px; height: 12px; vertical-align: -1px; }
.tk .r { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.overdue { color: var(--red); font-weight: 600; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.comment:last-child { border-bottom: 0; }
.comment .c-b { flex: 1; white-space: pre-wrap; word-break: break-word; }
.comment .c-h { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.comment .c-h b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.prewrap { white-space: pre-wrap; word-break: break-word; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(14,14,16,.4); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; animation: fade .12s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.2); animation: pop .15s; }
.modal.wide { max-width: 860px; }
.modal-hd { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-hd h2 { flex: 1; }
.modal-bd { padding: 20px; }
.modal-ft { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #FCFCFD; border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 360px; font-size: 13px; animation: pop .15s; cursor: pointer; }
.toast.err { background: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 10px; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; background: #fff; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; font-size: 15px; line-height: 1; }
.list-box { border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow: auto; padding: 6px 10px; }
.list-box .check { display: flex; padding: 4px 0; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { position: relative; }
.days input { position: absolute; opacity: 0; }
.days span { display: grid; place-items: center; width: 42px; height: 36px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 13px; }
.days input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Moslashuvchan ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  .side { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.15); }
  body.nav-open .side { transform: none; }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
  .main { margin-left: 0; }
  .top .burger { display: inline-flex; }
  .top { padding: 0 12px; }
  .content { padding: 16px; }
  .save-bar { margin: 16px -16px -16px; padding: 12px 16px; }
  .g2, .g3 { grid-template-columns: minmax(0,1fr); }
  .sumbar { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .sumbar > div { border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sumbar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpi .v { font-size: 20px; }
  .check-card { gap: 12px; }
}
@media print { .side, .top, .save-bar, .btn { display: none !important; } .main { margin: 0; } }
