/* drap.uz brendi: Grafit #0E1012 · Oltin #D4AF6A · Fil suyagi #F2F0EB · Unbounded 600 / Inter */
:root {
  --grafit: #0E1012; --oltin: #D4AF6A; --ivory: #F2F0EB;
  --bg: #F4F3EF; --panel: #fff; --text: #16181B; --muted: #6E6A62; --line: #E6E3DB; --line2: #F0EEE8;
  --accent: #8A6A2B; --accent-weak: #F8F1E2; --good: #1F7A45; --good-weak: #EBF6EF;
  --bad: #B42318; --bad-weak: #FDF0EE; --warn: #8A5A00; --warn-weak: #FFF7E0;
  --gold: #8A6A2B; --gold-weak: #FBF5E8; --gold-line: #EAD7AE;
  --nav: var(--grafit); --nav-text: #A9A59C;
  --r: 10px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --display: "Unbounded", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14.5px/1.45 var(--font); color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- menyu ---------- */
nav.side { width: 214px; flex: none; background: var(--nav); color: var(--nav-text); padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
nav.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; text-decoration: none; }
nav.side .brand img { width: 26px; height: auto; }
nav.side .brand .name { font-family: var(--display); font-weight: 600; font-size: 19px; color: var(--ivory); letter-spacing: -.3px; line-height: 1; }
nav.side .brand .name span { color: var(--oltin); }
nav.side .brand .sub { display: block; font-family: var(--font); font-size: 8.5px; letter-spacing: 1.6px; color: #8F8B82; margin-top: 4px; font-weight: 600; }
nav.side .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #6F6B63; padding: 14px 10px 6px; font-weight: 600; }
nav.side a { display: block; color: #DAD7CF; padding: 7px 10px; border-radius: 7px; margin-bottom: 1px; }
nav.side a:hover { background: #1C1F23; text-decoration: none; color: #fff; }
nav.side a.on { background: var(--oltin); color: var(--grafit); font-weight: 600; }
nav.side .bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid #22262B; }

/* ---------- sahifa ---------- */
main { flex: 1; padding: 24px 32px 60px; min-width: 0; max-width: 1320px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font-family: var(--display); font-size: 21px; margin: 0; font-weight: 600; letter-spacing: -.3px; }
h2 { font-size: 15px; margin: 0 0 14px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
h2 .sub { font-weight: 400; color: var(--muted); font-size: 13px; }
h2 .right { margin-left: auto; font-weight: 400; font-size: 13px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin: 4px 0 8px; font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush h2 { padding: 16px 20px 0; }
.cols { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; align-items: start; }
.cols > .panel { margin-bottom: 0; }
.cols + .panel, .cols + .cols { margin-top: 18px; }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

/* ---------- ko'rsatkichlar ---------- */
.stats { display: grid; gap: 12px; margin-bottom: 18px; }
.s2 { grid-template-columns: repeat(2, 1fr); } .s3 { grid-template-columns: repeat(3, 1fr); }
.s4 { grid-template-columns: repeat(4, 1fr); } .s5 { grid-template-columns: repeat(5, 1fr); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 16px; min-width: 0; }
.stat .k { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 20px; font-weight: 650; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.good .v { color: var(--good); } .stat.bad .v { color: var(--bad); } .stat.acc .v { color: var(--accent); }
.stat.gold { background: var(--gold-weak); border-color: var(--gold-line); }
.stat.gold .v { color: var(--gold); }
.stat.main { border-color: var(--grafit); background: var(--grafit); }
.stat.main .k, .stat.main .s { color: #A9A59C; }
.stat.main .v { color: var(--oltin) !important; }

/* ---------- jadval ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f9fafb; border-bottom: 1px solid var(--line); white-space: nowrap; }
.panel.flush table th:first-child, .panel.flush table td:first-child { padding-left: 20px; }
.panel.flush table th:last-child, .panel.flush table td:last-child { padding-right: 20px; }
td.n, th.n { text-align: right; white-space: nowrap; }
td.nw { white-space: nowrap; }
tbody tr:hover td { background: #fafbff; }
tfoot td { font-weight: 650; background: #f9fafb; border-top: 1px solid var(--line); }
tr.empty td { color: var(--muted); text-align: center; padding: 22px; }
.neg { color: var(--bad); } .pos { color: var(--good); } .muted { color: var(--muted); }
.act { white-space: nowrap; text-align: right; }
.act a { font-size: 13px; }

/* ---------- forma ---------- */
.form { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; align-items: end; }
.form > * { min-width: 0; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; }
.c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; width: 100%; min-width: 0; height: 38px; }
input[type=checkbox], input[type=radio] { width: auto; height: auto; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-weak); border-color: var(--accent); }
.withbtn { display: flex; gap: 6px; }
.withbtn input { flex: 1; }
.form .actions { grid-column: span 12; display: flex; align-items: center; gap: 12px; }
button, .btn { font: inherit; font-weight: 600; height: 38px; padding: 0 16px; border-radius: 7px; border: 1px solid var(--grafit); background: var(--grafit); color: var(--ivory); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
button:hover, .btn:hover { background: #24282E; text-decoration: none; }
button.ghost, .btn.ghost { background: #fff; color: var(--text); border-color: #D9D4C7; }
button.ghost:hover, .btn.ghost:hover { background: var(--gold-weak); border-color: var(--oltin); }
button.danger { background: #fff; border-color: #fecaca; color: var(--bad); }
button.small, .btn.small { height: 30px; padding: 0 11px; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid #d1d5db; border-radius: 7px; overflow: hidden; height: 38px; }
.seg label { flex-direction: row; align-items: center; gap: 6px; padding: 0 14px; cursor: pointer; color: var(--text); font-size: 14px; border-right: 1px solid #d1d5db; }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--grafit); color: var(--ivory); font-weight: 600; }
.seg label.gold:has(input:checked) { background: var(--gold-weak); color: var(--gold); }

/* ---------- xabar va boshqalar ---------- */
.msg { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.msg.ok { background: var(--good-weak); color: var(--good); border-color: #bbf7d0; }
.msg.err { background: var(--bad-weak); color: var(--bad); border-color: #fecaca; }
.msg.warn { background: var(--warn-weak); color: var(--warn); border-color: #fde68a; }
.preview { grid-column: span 12; padding: 10px 14px; background: var(--accent-weak); border-radius: 8px; font-size: 13.5px; line-height: 1.6; }
.preview:empty { display: none; }
.period { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.period a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 20px; background: #fff; color: var(--text); font-size: 13px; }
.period a:hover { text-decoration: none; border-color: var(--oltin); }
.period a.on { background: var(--grafit); border-color: var(--grafit); color: var(--ivory); }
.period form { display: flex; gap: 6px; align-items: center; margin-left: 6px; }
.period input { height: 30px; padding: 3px 7px; font-size: 13px; width: 135px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; background: #f3f4f6; color: #374151; white-space: nowrap; }
.tag.transfer { background: #eff4ff; color: #1d4ed8; } .tag.sale { background: #ecfdf3; color: #15803d; }
.tag.collection { background: #fffbeb; color: #92400e; } .tag.expense { background: #fef2f2; color: #b91c1c; }
.tag.branch_return, .tag.customer_return { background: #f5f3ff; color: #6d28d9; }
.tag.f2 { background: var(--gold-weak); color: var(--gold); }
.rollrow { display: grid; grid-template-columns: 110px 1fr 130px 110px 40px; gap: 10px; margin-bottom: 10px; align-items: end; }
.rollrow .rm { height: 38px; background: #fff; color: var(--muted); border-color: #e5e7eb; padding: 0; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.batch { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.batch > summary { padding: 11px 14px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.batch > summary::before { content: "▸"; color: var(--muted); }
.batch[open] > summary::before { content: "▾"; }
.batch > summary b { font-weight: 600; }
.batch .inner { padding: 4px 14px 14px; border-top: 1px solid var(--line2); }
.inline { display: inline; }
.pop { position: relative; display: inline-block; }
.pop > summary { color: var(--accent); font-size: 13px; }
.pop .box { position: absolute; right: 0; top: 24px; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.08); width: 300px; }
.pop .box .form { grid-template-columns: 1fr 1fr; }
.pop .box .form .c12 { grid-column: span 2; }
table input, table select { height: 32px; padding: 4px 8px; }

/* ---------- kirish sahifasi ---------- */
body.auth { align-items: center; justify-content: center; padding: 16px; background: var(--grafit); flex-direction: column; }
.auth-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.auth-brand img { width: 44px; }
.auth-brand .name { font-family: var(--display); font-weight: 600; font-size: 34px; color: var(--ivory); letter-spacing: -.6px; line-height: 1; }
.auth-brand .name span { color: var(--oltin); }
.auth-brand .sub { font-size: 10px; letter-spacing: 2.4px; color: #A9A59C; font-weight: 600; margin-top: 7px; }
.auth-box { background: var(--panel); border-radius: 14px; padding: 26px 24px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.auth-box h1 { font-size: 18px; }
.auth-box button { background: var(--oltin); border-color: var(--oltin); color: var(--grafit); }
.auth-box button:hover { background: #DDBD80; }
.user-line { font-size: 12.5px; color: #8F8B82; padding: 8px 10px 0; }
.user-line a { display: inline; padding: 0; color: var(--oltin); }

@media (max-width: 1100px) {
  .s5 { grid-template-columns: repeat(3, 1fr); } .s4 { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .c2, .c3 { grid-column: span 4; } .c4, .c5 { grid-column: span 6; } .c6, .c8 { grid-column: span 12; }
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  nav.side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 8px; }
  nav.side .brand, nav.side .grp { display: none; }
  nav.side .bottom { margin: 0; padding: 0; border: 0; }
  main { padding: 16px; }
  .s2, .s3, .s4, .s5 { grid-template-columns: repeat(2, 1fr); }
  .form > * { grid-column: span 12 !important; }
  .rollrow { grid-template-columns: 1fr 1fr; }
}
