/* Dizayn tokenlari — Texnikum ERP (app/globals.css, components/ui.tsx) bilan bir xil */
:root {
  --ink: #0B1A33; --ink2: #3A4660; --mute: #5B6680; --mute2: #94A0B4;
  --line: #E4E8F0; --line2: #EEF1F6; --line3: #DCE2EC;
  --soft: #F8FAFC; --soft2: #F4F6FA; --bg: #EAEBED;
  --blue: #2176E5; --blue-h: #1A64C8; --blue-l: #E8F1FC;
  --green: #16A34A; --green-d: #15803D; --green-l: #E7F6EC;
  --red: #DC2626; --red-d: #B91C1C; --red-l: #FDECEC; --red-b: #F7CFCF;
  --amber: #F59E0B; --amber-d: #B45309; --amber-l: #FEF4E6;
  --side: #20262E; --side2: #262D37; --side-on: #333D4A;
  --shadow: 0 1px 2px rgba(11, 26, 51, .06);
  --pop: 0 16px 40px -12px rgba(11, 26, 51, .35);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "PT Sans", "Manrope", system-ui, sans-serif; font-size: 14px;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: #1D4ED8; }
input, select, textarea, button { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--mute2); }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
.ic { flex: none; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--mute); }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 230px; flex: none; background: var(--side); display: flex; flex-direction: column;
  padding: 20px 12px; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 16px; }
.brand-logo { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--blue);
  display: flex; align-items: center; justify-content: center; color: #fff; }
.brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.brand-sub { font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,.55); }
.side-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: rgba(255,255,255,.7); font-size: 14px; font-weight: 500;
}
.side-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-item.on { background: var(--side-on); color: #fff; font-weight: 700; }
.side-item .badge { margin-left: auto; }
.side-gap { height: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.08); margin-top: auto; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: #fff; color: var(--blue);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.side-user .u-name { font-size: 13px; font-weight: 700; color: #fff; }
.side-user .u-role { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.55); }
.side-user form { margin-left: auto; }
.side-user button { background: none; border: none; color: rgba(255,255,255,.6); padding: 4px; display: flex; border-radius: 8px; }
.side-user button:hover { color: #fff; background: rgba(255,255,255,.1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 16px 28px; background: #fff;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar h1 { font-size: 21px; font-weight: 700; margin: 0; color: var(--ink); }
.topbar .date { font-size: 13px; font-weight: 600; color: var(--mute); }
.topbar .grow { flex: 1; }
.burger { display: none; width: 38px; height: 38px; border-radius: 11px; background: var(--soft2);
  align-items: center; justify-content: center; border: none; color: var(--ink); }
.content { padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; flex: 1; }

/* ---------- komponentlar ---------- */
.card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.card-body { padding: 18px; }

.btn { height: 40px; padding: 0 15px; border-radius: 11px; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; flex: none;
  border: none; background: var(--blue); color: #fff; text-decoration: none; }
.btn:hover { background: var(--blue-h); color: #fff; }
.btn:active { transform: scale(.98); }
.btn.lg { height: 44px; border-radius: 13px; font-size: 14px; }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 10px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn.outline { background: #fff; color: var(--blue); border: 1.5px solid var(--line3); }
.btn.outline:hover { border-color: var(--blue); }
.btn.outline-mute { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.outline-mute:hover { border-color: var(--blue); }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-d); }
.btn.danger-outline { background: #fff; color: var(--red); border: 1.5px solid var(--red-b); }
.btn.danger-outline:hover { background: var(--red-l); }
.btn.soft { background: var(--soft2); color: var(--ink); }
.btn.soft:hover { background: var(--line); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--blue-l); color: var(--blue); }
.pill.green { background: var(--green-l); color: var(--green-d); }
.pill.red { background: var(--red-l); color: var(--red-d); }
.pill.amber { background: var(--amber-l); color: var(--amber-d); }
.pill.gray { background: var(--soft2); color: var(--mute); }
.badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label, .label { font-size: 12px; font-weight: 700; color: var(--mute); letter-spacing: .02em; }
.field .hint { font-size: 11.5px; font-weight: 600; color: var(--mute); }
.input { height: 44px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--soft);
  padding: 0 13px; font-size: 14px; font-weight: 600; color: var(--ink); outline: none; width: 100%; min-width: 0; }
.input:focus, .select:focus { border-color: var(--blue); background: #fff; }
textarea.input { height: auto; padding: 10px 13px; min-height: 90px; resize: vertical; }
.select { height: 38px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff; padding: 0 12px;
  font-size: 13px; font-weight: 700; color: var(--ink); outline: none; cursor: pointer; max-width: 260px; }
.select.full { height: 44px; max-width: none; width: 100%; background: var(--soft); font-weight: 600; font-size: 14px; }
.search { display: flex; align-items: center; gap: 9px; background: #fff; border-radius: 12px; padding: 0 13px;
  height: 40px; border: 1.5px solid var(--line); flex: 1; max-width: 360px; min-width: 180px; color: var(--mute); }
.search input { flex: 1; border: none; outline: none; font-size: 13.5px; font-weight: 600; color: var(--ink);
  background: transparent; min-width: 0; }
.search:focus-within { border-color: var(--blue); }
.check-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 11px;
  border: 1.5px solid var(--line); background: #fff; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; user-select: none; }
.check-chip:has(input:checked) { border-color: var(--blue); background: var(--blue-l); color: var(--blue); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; margin: 0; }

.error-note { background: #FDF2F2; border: 1.5px solid var(--red-b); border-radius: 12px; padding: 10px 13px;
  font-size: 13px; font-weight: 600; color: var(--red-d); }
.info-note { background: var(--blue-l); border-radius: 12px; padding: 10px 13px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.empty { padding: 28px 20px; text-align: center; font-size: 13px; font-weight: 600; color: var(--mute2); }

/* toolbar — skrollda tepada qotadi */
.page-toolbar { position: sticky; top: 0; z-index: 8; background: var(--bg); margin: -12px -28px -6px; padding: 12px 28px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-toolbar .grow { flex: 1; }

/* ---------- jadval ---------- */
.tbl-wrap { background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 980px; }
.tbl th { position: sticky; top: 0; background: var(--soft); border-bottom: 1px solid var(--line); padding: 13px 10px;
  font-size: 12px; font-weight: 700; color: var(--mute); letter-spacing: .03em; text-align: left; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; font-size: 13.5px; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl tbody tr:hover { background: var(--soft); }
.tbl tr.off td { color: var(--mute2); }
.tbl tr.off .thumb { opacity: .5; }
.tbl .num, .tbl th.num { text-align: right; }
.tbl .p-name { font-weight: 700; color: var(--ink); max-width: 360px; }
.tbl .p-sub { font-size: 11.5px; font-weight: 600; color: var(--mute); }
.thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--soft2); display: block; border: 1px solid var(--line2); }
.thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--mute2); }
.neg { color: var(--red-d); }

/* inline tahrir katagi */
.cell-input { width: 100%; min-width: 70px; height: 32px; border: 1.5px solid transparent; border-radius: 8px; background: transparent;
  padding: 0 8px; font-size: 13.5px; font-weight: 700; color: var(--ink); outline: none; text-align: right; font-variant-numeric: tabular-nums; }
.cell-input.left { text-align: left; font-weight: 600; }
.cell-input.neg { color: var(--red-d); }
.cell-input:hover { border-color: var(--line); background: #fff; }
.cell-input:focus { border-color: var(--blue); background: #fff; }
.cell-input.empty-val::placeholder { color: var(--amber-d); font-weight: 700; }
.cell-input.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { background: var(--green-l); border-color: var(--green); } 100% { background: transparent; } }
.cell-input[readonly] { pointer-events: none; }

.pager { display: flex; align-items: center; gap: 6px; padding: 12px 20px; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--mute); flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; }
.pager a, .pager span.cur { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 9px; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; color: var(--ink); background: var(--soft2); }
.pager a:hover { background: var(--line); }
.pager span.cur { background: var(--blue); color: #fff; }

.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--side);
  color: #fff; font-size: 13px; font-weight: 700; flex-wrap: wrap; }
.bulkbar .select, .bulkbar .input { height: 34px; background: #fff; }
.bulkbar .input { width: 120px; font-size: 13px; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(11,26,51,.45); z-index: 60; display: flex; align-items: center;
  justify-content: center; padding: 24px; animation: fadein .12s ease; }
.modal { width: 560px; max-width: 100%; max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px;
  box-shadow: 0 40px 80px -20px rgba(11,26,51,.5); padding: 22px; display: flex; flex-direction: column; gap: 15px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-title { font-size: 17px; font-weight: 700; }
.close-x { width: 34px; height: 34px; flex: none; border-radius: 11px; background: var(--soft2); display: flex;
  align-items: center; justify-content: center; cursor: pointer; border: none; color: var(--ink); }
.close-x:hover { background: var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.span2 { grid-column: span 2; }
.img-pick { display: flex; align-items: center; gap: 12px; }
.img-pick img, .img-pick .ph { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: var(--soft2);
  display: flex; align-items: center; justify-content: center; color: var(--mute2); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 8px; background: var(--side); color: #fff; padding: 11px 15px; border-radius: 12px;
  font-size: 13px; font-weight: 700; box-shadow: var(--pop); animation: fadein .15s ease; }
.toast.error { background: var(--red-d); }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 18px; display: flex; gap: 14px; align-items: center; }
.stat-ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none;
  background: var(--blue-l); color: var(--blue); }
.stat-ic.amber { background: var(--amber-l); color: var(--amber-d); }
.stat-ic.green { background: var(--green-l); color: var(--green-d); }
.stat-label { font-size: 12.5px; font-weight: 700; color: var(--mute); }
.stat-val { font-size: 24px; font-weight: 700; margin-top: 2px; }
.stat-sub { font-size: 12px; font-weight: 600; color: var(--mute2); }

/* ---------- import ---------- */
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--mute); }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--soft2); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.step.on { color: var(--ink); } .step.on .n { background: var(--blue); color: #fff; }
.step.done .n { background: var(--green); color: #fff; }
.dropzone { border: 2px dashed var(--line3); border-radius: 14px; padding: 30px; text-align: center; background: var(--soft);
  display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-l); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.modes { display: flex; gap: 8px; flex-wrap: wrap; }
.mode { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 11px; border: 1.5px solid var(--line);
  font-size: 13px; font-weight: 700; cursor: pointer; background: #fff; }
.mode:has(input:checked) { border-color: var(--blue); background: var(--blue-l); color: var(--blue); }
.sum-row { display: flex; gap: 10px; flex-wrap: wrap; }
.diff-old { color: var(--mute2); text-decoration: line-through; }
.diff-new { color: var(--green-d); font-weight: 700; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 400px; max-width: 100%; padding: 30px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- moslashuvchan ---------- */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .side { display: none; }
  .side.open { display: flex; position: fixed; left: 0; top: 0; z-index: 80; }
  .burger { display: flex; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .page-toolbar { margin: -10px -16px; padding: 10px 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .hide-sm { display: none !important; }
}
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }
