/* Talab monitoringi — styles. Tokens and controls follow the dashboard (public/app.css): light, Inter, white panels on a
   cool grey canvas, one blue brand. Meaning colours only for meaning: red = out of stock / delete, amber = low, green = ok. */
@import url('/fonts/fonts.css');

:root {
  color-scheme: light;
  --canvas: #f3f5f9; --surface: #ffffff; --surface-2: #f8fafc; --row-hover: #f5f8fd; --track: #e8ecf3;
  --border: #e3e8f0; --border-strong: #cbd4e1; --grid: #edf1f7;
  --ink: #131c33; --ink-2: #56627b; --muted: #8590a5;
  --brand: #0054c8; --brand-hover: #0044a6; --brand-soft: #e7effc; --brand-ink: #0044a6;
  --gold: #d97706; --gold-ink: #94560a; --gold-soft: #fff3dc;
  --pos: #0d7a4d; --pos-soft: #e3f6ec; --neg: #c0291b; --neg-soft: #fdecea;
  --s1: #2f6fe4; --s2: #10b981; --s3: #d97706;
  --scrim: rgba(19, 28, 51, .45);
  --shadow-sm: 0 1px 2px rgb(19 28 51 / 6%);
  --shadow-card: 0 1px 2px rgb(19 28 51 / 5%), 0 6px 18px rgb(19 28 51 / 6%);
  --shadow-md: 0 12px 32px rgb(13 23 56 / 16%);
  --shadow-xl: 0 24px 60px rgb(13 23 56 / 28%);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --font: Inter, "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-lg: 16px; --r: 12px; --r-sm: 8px; --r-xs: 6px;
  --gutter: clamp(1rem, 2.5vw, 2rem);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font-family: var(--font); background: var(--canvas); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: 'cv11'; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.num, .n { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); }
.neg { color: var(--neg); } .pos { color: var(--pos); }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; background: var(--surface-2); color: var(--muted); font: 600 11.5px/1 var(--font); }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 50; background: rgb(255 255 255 / 92%); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.top-in { max-width: 88rem; margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1.2; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 2px; width: fit-content; max-width: 100%; padding: 4px; border-radius: var(--r); background: var(--track); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 32px; padding: 0 13px; border-radius: 9px; border: 0; background: none;
  color: var(--ink-2); font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected='true'] { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); }

.page { max-width: 88rem; margin: 0 auto; padding: 20px var(--gutter) 64px; display: flex; flex-direction: column; gap: 16px; }
.view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page-title { font-size: 22px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
.page-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid transparent; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .16s var(--ease-out); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { color: #fff; background: var(--brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a32216; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-icon { width: 30px; padding: 0; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent;
  animation: spin .7s linear infinite; }
.btn-secondary.busy::after { border-color: var(--brand) var(--brand) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.seg { display: inline-flex; align-items: center; background: var(--track); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 7px; border: 0;
  background: none; color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.seg > button:hover { color: var(--ink); }
.seg > button[aria-pressed='true'] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.select, .input, .textarea { height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: #fff; color: var(--ink);
  font-size: 13.5px; min-width: 0; transition: border-color .15s ease, box-shadow .15s ease; }
.input, .textarea { width: 100%; }
.textarea { height: auto; min-height: 72px; padding: 8px 11px; resize: vertical; line-height: 1.45; }
.input.num { text-align: right; }
.select:hover, .input:hover, .textarea:hover { border-color: var(--muted); }
.select:focus, .input:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.invalid { border-color: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); }
.field .star { color: var(--neg); font-weight: 600; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }

/* ---------- panels, stats, KPI ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-card); min-width: 0; }
.panel-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.panel-title { font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.panel-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.panel-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.panel-body { padding: 14px 20px 20px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 18px; }
.stat dt { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.stat dd { margin: 4px 0 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .k-label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.kpi .k-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.kpi .k-value.name { font-size: 16.5px; line-height: 1.3; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* ---------- search ---------- */
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 16px 20px 0; }
.search { position: relative; flex: 1 1 340px; min-width: 0; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { height: 44px; padding-left: 38px; padding-right: 40px; font-size: 15px; border-radius: 10px; }
.search kbd { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search .input:focus ~ kbd, .search .input:not(:placeholder-shown) ~ kbd { display: none; }
.toolbar .seller { min-width: 190px; }
.toolbar .seller .select, .toolbar .btn { height: 44px; }
.filters { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; padding: 12px 20px 12px; border-bottom: 1px solid var(--border); }
.filters .select { max-width: 280px; }
.filters .count { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.results { min-height: 120px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 110px 140px auto; align-items: center; gap: 6px 16px; padding: 11px 20px;
  border-bottom: 1px solid var(--border); }
.row:hover { background: var(--row-hover); }
.row:last-child { border-bottom: 0; }
.r-name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; line-height: 1.35; }
.r-name mark { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.r-new { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 650; color: var(--gold-ink); background: var(--gold-soft); border-radius: 5px; padding: 1px 6px; vertical-align: 1px; }
.r-meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.r-meta .sku { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.r-price { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-price.none { color: var(--muted); font-weight: 500; }
.r-stock { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.out { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }
.dot.low { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.dot.ok { background: var(--s2); box-shadow: 0 0 0 3px var(--pos-soft); }
.r-req { white-space: nowrap; }
.req { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12.5px; font-weight: 650;
  background: var(--brand-soft); color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.req.zero { background: transparent; color: var(--muted); font-weight: 500; padding: 0; }
.req.bump { animation: bump .45s var(--ease-out); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1); } }
.r-act { display: flex; gap: 6px; justify-content: flex-end; }
.more { display: flex; justify-content: center; padding: 12px; }
.more:empty { display: none; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty b { color: var(--ink-2); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; position: relative; }
.table-wrap.scroll { max-height: 560px; overflow-y: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; white-space: nowrap; padding: 9px 12px; background: var(--surface-2);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--ink-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--row-hover); }
.table .n { text-align: right; white-space: nowrap; }
.table td.strong { color: var(--ink); font-weight: 600; }
.table td.wrap { min-width: 180px; max-width: 360px; overflow-wrap: anywhere; }
.table td.note { min-width: 140px; max-width: 260px; overflow-wrap: anywhere; font-size: 12.5px; }
.table .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.table-foot { display: flex; gap: 10px; align-items: center; padding: 10px 20px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); flex-wrap: wrap; }
.status { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
button.status { cursor: pointer; transition: box-shadow .15s ease; }
button.status:hover { box-shadow: 0 0 0 2px var(--border-strong); }
button.status:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.status.kutilmoqda { color: var(--gold-ink); background: var(--gold-soft); }
.status.buyurtma { color: var(--brand-ink); background: var(--brand-soft); }
.status.keldi { color: var(--pos); background: var(--pos-soft); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-xs); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { color: var(--pos); background: var(--pos-soft); }
.badge.warn { color: var(--gold-ink); background: var(--gold-soft); }
.badge.bad { color: var(--neg); background: var(--neg-soft); }
.badge.neutral { color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); }
.badge.plain::before { display: none; }

/* ---------- analysis ---------- */
.range { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.range .input { width: 150px; }
.chart-box { position: relative; height: 340px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13.5px; }

/* ---------- settings ---------- */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; color: var(--ink); font-weight: 550; overflow-wrap: anywhere; }
.kv dd .sub { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.people { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); }
.people li:last-child { border-bottom: 0; }
.people .p-name { flex: 1; min-width: 0; font-weight: 550; overflow-wrap: anywhere; }
.people li.off .p-name { color: var(--muted); text-decoration: line-through; }
.add-row { display: flex; gap: 8px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); background: var(--brand-soft); color: var(--ink-2); font-size: 13px; }
.notice.warn { background: var(--gold-soft); color: var(--gold-ink); }
.notice.bad { background: var(--neg-soft); color: var(--neg); }
.notice b { color: var(--ink); }
.help-list { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; }
.help-list code { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.import-result { margin-top: 12px; }
.import-result ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }

/* ---------- toast, dialog ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; max-width: min(420px, calc(100vw - 32px)); background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 500;
  padding: 11px 15px; border-radius: var(--r); box-shadow: var(--shadow-md); transition: opacity .2s ease, transform .22s var(--ease-out); pointer-events: auto; }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }
.toast.leave { opacity: 0; transform: translateY(6px); }
.toast.ok .ic { color: #6ee7b7; }
.toast.err { background: var(--neg); }
.dialog-back { position: fixed; inset: 0; background: var(--scrim); z-index: 100; display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-xl); width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; }
.dialog-head { display: flex; gap: 12px; align-items: flex-start; padding: 20px 22px 0; }
.dialog-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.dialog-head .x { margin-left: auto; margin-top: -4px; }
.dialog-sub { margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.dialog-body { padding: 16px 22px 4px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }
.dialog-err { margin: 10px 0 0; color: var(--neg); font-size: 13px; }
.prod-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); margin-bottom: 14px; font-size: 13px; }
.prod-card .r-stock { justify-content: flex-end; }

/* ---------- login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); padding: 28px 28px 26px; }
.auth-brand { margin: 0 0 22px; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-sub { margin: 6px 0 20px; color: var(--ink-2); font-size: 13.5px; }
.auth-error { margin: 10px 0 0; color: var(--neg); font-size: 13px; }
.auth-submit { width: 100%; margin-top: 18px; height: 40px; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .top-in { gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat dd { font-size: 19px; }
  .toolbar { padding: 14px 14px 0; }
  .toolbar .seller, .toolbar .btn { flex: 1 1 auto; }
  .filters { padding: 10px 14px; }
  .filters .count { margin-left: 0; width: 100%; }
  .row { grid-template-columns: auto auto minmax(0, 1fr); gap: 8px 14px; padding: 12px 14px; }
  .r-main { grid-column: 1 / -1; }
  .r-price { text-align: left; }
  .r-req { justify-self: end; }
  .search kbd { display: none; }
  .filters .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .filters .seg::-webkit-scrollbar { display: none; }
  .filters .select { max-width: 100%; flex: 1; }
  .r-act { grid-column: 1 / -1; justify-content: stretch; }
  .r-act .btn { flex: 1; height: 38px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .panel-head { padding: 14px 14px 0; }
  .panel-body { padding: 12px 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
