/* =================================================================
   SIMKARTA CRM — dizayn tizimi
   Ink navy sirtlar · latun (brass) chiziqlar · jade harakat rangi
   Operator ranglari faqat ma'lumot sifatida ishlatiladi.
   ================================================================= */

/* ---------- Tokenlar ---------- */
:root {
  --r-xs: 6px;  --r-sm: 9px;  --r-md: 13px; --r-lg: 18px; --r-xl: 24px; --r-full: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 22px; --sp-6: 30px; --sp-7: 42px;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --sidebar-w: 258px;
  --topbar-h: 68px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --dur: .18s;

  /* Operator ranglari — o'zgarmas */
  --op-ucell: #6A2383;
  --op-beeline: #FFC91A;
  --op-uzmobile: #3D6394;
  --op-mobiuz: #E30613;
}

html[data-theme="dark"] {
  --bg: #0A0E14;
  --bg-grad-1: #10202C;
  --bg-grad-2: #0A0E14;
  --surface: #111823;
  --surface-2: #161F2C;
  --surface-3: #1C2735;
  --line: #22303F;
  --line-soft: #1A2531;
  --text: #E9EFF6;
  --text-2: #B7C4D3;
  --muted: #7F8FA2;
  --faint: #5A697B;
  --accent: #17A07A;
  --accent-2: #24C795;
  --accent-ink: #04150F;
  --accent-soft: rgba(23,160,122,.14);
  --brass: #BC9C58;
  --brass-soft: rgba(188,156,88,.16);
  --ok: #24C795;
  --ok-soft: rgba(36,199,149,.14);
  --danger: #E5484D;
  --danger-soft: rgba(229,72,77,.14);
  --warn: #E0A23A;
  --warn-soft: rgba(224,162,58,.14);
  --info: #4E9BE6;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 12px 32px -12px rgba(0,0,0,.7);
  --shadow-3: 0 28px 70px -20px rgba(0,0,0,.85);
  --overlay: rgba(5,8,12,.72);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #EEF1F5;
  --bg-grad-1: #DDE6EC;
  --bg-grad-2: #EEF1F5;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --surface-3: #EDF1F6;
  --line: #DCE3EB;
  --line-soft: #E8EDF3;
  --text: #101A25;
  --text-2: #35485C;
  --muted: #5E7186;
  --faint: #8698AB;
  --accent: #0E8A67;
  --accent-2: #12A47C;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(14,138,103,.11);
  --brass: #8B6E2E;
  --brass-soft: rgba(139,110,46,.12);
  --ok: #0E8A67;
  --ok-soft: rgba(14,138,103,.11);
  --danger: #CC2F35;
  --danger-soft: rgba(204,47,53,.1);
  --warn: #A9701A;
  --warn-soft: rgba(169,112,26,.12);
  --info: #1F6FBE;
  --shadow-1: 0 1px 2px rgba(16,26,37,.06);
  --shadow-2: 0 10px 28px -14px rgba(16,26,37,.28);
  --shadow-3: 0 24px 60px -20px rgba(16,26,37,.32);
  --overlay: rgba(20,28,38,.42);
  color-scheme: light;
}

/* ---------- Asos ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.018em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Raqamlar — har doim monoshirinali va tabular.
   Bu ilovaning mazmuni raqamlar: telefon, son, sana. */
.mono, .num, td.num, .metric-value, .phone {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -.01em;
}

.eyebrow {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brass);
}

/* Skroll */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 20px; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); }
*::-webkit-scrollbar-track { background: transparent; }

/* Ikonka */
.ic {
  width: 19px; height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 24px; height: 24px; }

[hidden] { display: none !important; }

/* =================================================================
   YUKLANISH
   ================================================================= */
.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 200;
}
.spinner {
  width: 30px; height: 30px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =================================================================
   KIRISH EKRANI
   ================================================================= */
.login-screen { position: fixed; inset: 0; overflow: auto; }

.login-bg {
  position: fixed; inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120ch 80ch at 70% -20%, var(--bg-grad-1), transparent 60%),
    var(--bg-grad-2);
}

/* Sekin suzuvchi rangli dog'lar */
.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: .5;
  will-change: transform;
}
.aurora.b1 {
  width: 46vw; height: 46vw; min-width: 320px; min-height: 320px;
  top: -14%; left: 52%;
  background: radial-gradient(circle at 35% 35%, var(--accent), transparent 68%);
  animation: float1 22s ease-in-out infinite;
}
.aurora.b2 {
  width: 40vw; height: 40vw; min-width: 280px; min-height: 280px;
  bottom: -18%; left: -8%;
  background: radial-gradient(circle at 60% 40%, var(--brass), transparent 66%);
  opacity: .38;
  animation: float2 27s ease-in-out infinite;
}
.aurora.b3 {
  width: 32vw; height: 32vw; min-width: 220px; min-height: 220px;
  top: 44%; right: -10%;
  background: radial-gradient(circle at 50% 50%, #6A2383, transparent 68%);
  opacity: .3;
  animation: float3 31s ease-in-out infinite;
}
@keyframes float1 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(-6vw, 5vh, 0) scale(1.12); }
}
@keyframes float2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(7vw, -6vh, 0) scale(1.08); }
}
@keyframes float3 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(-5vw, -7vh, 0) scale(1.15); }
}

/* Nozik to'r */
.aurora-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(80ch 60ch at 50% 42%, #000, transparent 78%);
  -webkit-mask-image: radial-gradient(80ch 60ch at 50% 42%, #000, transparent 78%);
  opacity: .45;
}

/* Yuqoridan tushuvchi yorug'lik nuri */
.aurora-beam {
  position: absolute; top: -30%; left: 50%;
  width: 62vw; height: 90vh;
  transform: translateX(-50%) rotate(14deg);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 12%, transparent),
    transparent 62%);
  filter: blur(46px);
  opacity: .55;
  pointer-events: none;
}

:root[data-theme="light"] .aurora { opacity: .3; }
:root[data-theme="light"] .aurora-beam { opacity: .35; }

.login-wrap {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
}

/* Keng ekranda ikki panel */
@media (min-width: 1000px) {
  .login-wrap {
    grid-template-columns: minmax(0, 1fr) 424px;
    gap: 64px;
    align-items: center;
    justify-content: center;
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--sp-6) var(--sp-5);
  }
}

/* --- Chap panel --- */
.login-hero {
  display: none;
  max-width: 520px;
  animation: heroIn .6s var(--ease) both;
}
@media (min-width: 1000px) { .login-hero { display: block; } }
@keyframes heroIn { from { opacity: 0; transform: translateY(16px); } }

.hero-title {
  margin: 30px 0 14px;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -.02em;
  font-weight: 700;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent-2), var(--brass));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 430px;
}

.hero-points {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 13px;
}
.hero-points li {
  display: flex; align-items: center; gap: 12px;
  font-size: 13.8px;
  color: var(--text-2);
  opacity: 0;
  animation: pointIn .5s var(--ease) forwards;
}
.hero-points li:nth-child(1) { animation-delay: .12s; }
.hero-points li:nth-child(2) { animation-delay: .2s; }
.hero-points li:nth-child(3) { animation-delay: .28s; }
.hero-points li:nth-child(4) { animation-delay: .36s; }
@keyframes pointIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.hero-points .ic {
  width: 34px; height: 34px;
  padding: 8px;
  flex: none;
  border-radius: var(--r-sm);
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}

.hero-ops { margin-top: 34px; padding-top: 22px; border-top: 1px dashed var(--line); }
.hero-ops-row { display: flex; gap: 10px; margin-top: 12px; }
.hero-op {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  transition: transform var(--dur), border-color var(--dur);
}
.hero-op:hover { transform: translateY(-3px); border-color: var(--brass); }
.hero-op img { width: 26px; height: 26px; object-fit: contain; }

/* Faqat tor ekranda ko'rinadigan elementlar */
.only-narrow { display: flex; }
@media (min-width: 1000px) { .only-narrow { display: none !important; } }

.login-card {
  position: relative;
  width: 100%;
  max-width: 424px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  border-radius: 22px;
  padding: 34px 32px 26px;
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 10%, transparent) inset,
    0 28px 70px -22px rgba(0, 0, 0, .55),
    0 2px 10px -4px rgba(0, 0, 0, .35);
  overflow: hidden;
  animation: rise .55s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } }

/* Yuqori qirradagi yaltirash */
.card-sheen {
  position: absolute; top: 0; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--brass) 75%, transparent), transparent);
  pointer-events: none;
}
.login-card::after {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--brass) 34%, transparent),
    transparent 42%, transparent 62%,
    color-mix(in srgb, var(--accent) 26%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: var(--r-md);
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
}
.brand-lockup.sm .brand-mark { width: 36px; height: 36px; border-radius: var(--r-sm); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 700; letter-spacing: .1em; }
.brand-text i {
  font-style: normal; font-size: 11px; color: var(--muted);
  letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.login-title { margin: 24px 0 5px; font-size: 26px; letter-spacing: -.01em; }
.login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
@media (min-width: 1000px) { .login-title { margin-top: 0; } }

.login-ops {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px dashed var(--line);
  justify-content: center;
}
.login-ops-row {
  display: flex; align-items: center; justify-content: center;
  gap: 18px; margin-top: 12px; flex-wrap: wrap;
}
.login-ops-row img {
  width: 26px; height: 26px;
  object-fit: contain; opacity: .95;
}
:root[data-theme="dark"] .login-ops-row img { filter: brightness(1.12); }

.login-foot {
  display: flex; align-items: center; gap: 7px; justify-content: center;
  margin-top: 18px; font-size: 11.5px; color: var(--faint);
}
.login-foot .ic { width: 14px; height: 14px; }

/* =================================================================
   MAYDONLAR (form)
   ================================================================= */
.field { display: block; margin-bottom: 15px; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  letter-spacing: .01em;
}
.field-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 11px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur);
}
.field-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
  background: var(--surface);
}
.field-box input, .field-box select, .field-box textarea {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: none;
  padding: 11px 0; font-size: 14.5px;
}
.field-box textarea { resize: vertical; min-height: 74px; padding: 11px 0; }
.field-box select { cursor: pointer; padding-right: 4px; }
.field-ic { color: var(--faint); }
.field-box:focus-within .field-ic { color: var(--accent-2); }
.field-btn {
  background: none; border: 0; cursor: pointer;
  color: var(--faint); padding: 5px; display: grid; place-items: center;
  border-radius: var(--r-xs);
}
.field-btn:hover { color: var(--text); background: var(--surface-3); }
.field-hint { display: block; margin-top: 5px; font-size: 11.5px; color: var(--faint); }
.field-error { color: var(--danger); }
.field.invalid .field-box { border-color: var(--danger); }

input[type="date"], input[type="number"] { font-family: var(--font-mono); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select option { background: var(--surface); color: var(--text); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
@media (max-width: 560px) { .field-row, .field-row-3 { grid-template-columns: 1fr; } }

/* Switch */
.switch { display: flex; align-items: center; gap: 11px; cursor: pointer; padding: 9px 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 40px; height: 23px; border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid var(--line);
  position: relative; transition: background var(--dur) var(--ease), border-color var(--dur);
  flex: 0 0 auto;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--faint);
  transition: transform var(--dur) var(--ease), background var(--dur);
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(17px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3.5px var(--accent-soft); }
.switch-text b { display: block; font-size: 13.5px; font-weight: 600; }
.switch-text i { font-style: normal; font-size: 11.5px; color: var(--muted); }

/* =================================================================
   TUGMALAR
   ================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9.5px 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur), transform .08s var(--ease), opacity var(--dur);
}
.btn:hover { background: var(--surface-3); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ic { width: 17px; height: 17px; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 75%, transparent);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.btn-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 42%, transparent); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-lg { padding: 13px 20px; font-size: 15px; border-radius: var(--r-md); }
.btn-block { width: 100%; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur), background var(--dur), border-color var(--dur);
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--faint); }
.icon-btn.sm { width: 31px; height: 31px; border-radius: var(--r-xs); }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

.btn-spin { animation: spin .8s linear infinite; }

/* =================================================================
   ILOVA KARKASI
   ================================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 60;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}
.sidebar-close { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 14px 11px; }
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  padding: 13px 10px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; color: var(--faint);
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 9.5px 11px;
  margin-bottom: 2px;
  border: 0; background: none;
  color: var(--text-2);
  border-radius: var(--r-sm);
  font-size: 13.8px; font-weight: 550;
  cursor: pointer; text-align: left;
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item .ic { color: var(--faint); transition: color var(--dur); }
.nav-item:hover .ic { color: var(--text-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 650; }
.nav-item.active .ic { color: var(--accent-2); }
.nav-item.active::before {
  content: ''; position: absolute; left: -11px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px;
  padding: 1.5px 7px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--muted);
}
.nav-item.active .nav-badge { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--accent-2); }

.sidebar-foot { padding: 11px; border-top: 1px solid var(--line-soft); flex: 0 0 auto; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 9px;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--r-sm); cursor: pointer; text-align: left;
  transition: background var(--dur), border-color var(--dur);
}
.user-chip:hover { background: var(--surface-3); border-color: var(--faint); }
.user-chip .ic { color: var(--faint); margin-left: auto; width: 16px; height: 16px; }
.user-chip-text { min-width: 0; }
.user-chip-text b { display: block; font-size: 13px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-text i { font-style: normal; font-size: 11px; color: var(--muted); }

.avatar {
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-3) center/cover no-repeat;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: var(--brass);
  overflow: hidden;
}
.avatar.lg { width: 74px; height: 74px; font-size: 25px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }

.scrim {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: 55; opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
  backdrop-filter: blur(2px);
}
body.nav-open .scrim { opacity: 1; pointer-events: auto; }

.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 19px; }
.topbar-title p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }

.content { padding: var(--sp-5); flex: 1; max-width: 1560px; width: 100%; }
.content:focus { outline: none; }

.tabbar { display: none; }
.only-mobile { display: none; }

/* =================================================================
   KARTALAR / TARKIB BLOKLARI
   ================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { font-size: 15px; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: var(--sp-4); }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-sale { grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); }
.g-main { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
@media (max-width: 1180px) { .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-main, .g-sale { grid-template-columns: 1fr; } }
@media (max-width: 900px)  { .g-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px)  { .g-2, .g-4 { grid-template-columns: 1fr; } }

.section { margin-bottom: var(--sp-5); }
.section-head { display: flex; align-items: flex-end; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.section-head h2 { font-size: 16px; }
.section-head .spacer { flex: 1; }

/* =================================================================
   METRIKA KARTALARI
   ================================================================= */
.metric {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 17px 18px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.metric::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--brass), transparent 72%);
  opacity: .55;
}
.metric-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.metric-icon {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted);
}
.metric-label { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.metric-value { font-size: 30px; font-weight: 680; line-height: 1; }
.metric-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 11.5px; color: var(--faint); }
.metric-foot .ic { width: 14px; height: 14px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-family: var(--font-mono); }
.delta.up { color: var(--accent-2); }
.delta.down { color: var(--danger); }

.metric.accent .metric-icon { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-2); }
.metric.accent::after { background: linear-gradient(90deg, var(--accent), transparent 72%); opacity: .8; }

/* =================================================================
   OPERATOR ELEMENTLARI
   ================================================================= */
.op-logo { width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto; object-fit: contain; }
.op-logo.sm { width: 22px; height: 22px; border-radius: 6px; }
.op-logo.lg { width: 42px; height: 42px; border-radius: 11px; }

.op-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600;
}
.op-chip img { width: 20px; height: 20px; border-radius: 5.5px; }

.op-card {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative; overflow: hidden;
  transition: border-color var(--dur), transform var(--dur) var(--ease);
}
.op-card:hover { transform: translateY(-1px); }
.op-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--op-color, var(--line));
}
.op-card-body { flex: 1; min-width: 0; }
.op-card-body b { display: block; font-size: 13.5px; }
.op-card-body i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.op-card-num { font-size: 21px; font-weight: 680; }

/* Prefiks xaritasi — telefon maydoni ostidagi ma'lumot chizig'i */
.prefix-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 11px; }
.prefix-cell {
  padding: 8px 9px;
  border: 1px dashed var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  transition: all var(--dur) var(--ease);
  opacity: .62;
}
.prefix-cell b {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.prefix-cell b img { width: 14px; height: 14px; border-radius: 4px; }
.prefix-cell span {
  display: block; margin-top: 3px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--faint);
}
.prefix-cell.on {
  opacity: 1;
  border-style: solid;
  border-color: var(--op-color);
  background: color-mix(in srgb, var(--op-color) 12%, var(--surface));
}
.prefix-cell.on b { color: var(--text); }
.prefix-cell.on span { color: var(--text-2); }

/* =================================================================
   IMZO ELEMENTI — telefon raqami kiritish konsoli
   ================================================================= */
.phone-console {
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 3px;
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease), background .22s;
  position: relative;
}
.phone-console:focus-within {
  background: var(--surface);
  border-color: var(--op-color, var(--accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--op-color, var(--accent)) 16%, transparent);
}
.phone-console.detected { border-color: var(--op-color); }

.phone-row { display: flex; align-items: center; gap: 10px; padding: 8px 11px; }

.phone-prefix {
  display: flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 21px; font-weight: 600;
  color: var(--brass);
  letter-spacing: .01em;
  user-select: none;
  padding-right: 10px;
  border-right: 1px solid var(--line);
  flex: 0 0 auto;
}

.phone-input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: none;
  font-family: var(--font-mono);
  font-size: 21px; font-weight: 600;
  letter-spacing: .06em;
  padding: 4px 0;
  color: var(--text);
}
.phone-input::placeholder { color: var(--faint); letter-spacing: .06em; font-weight: 500; }
.phone-input::-webkit-outer-spin-button, .phone-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.phone-badge {
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto;
  padding: 5px 11px 5px 5px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--op-color) 14%, var(--surface-3));
  border: 1px solid color-mix(in srgb, var(--op-color) 40%, transparent);
  font-size: 12.5px; font-weight: 650;
  animation: pop .26s var(--ease) both;
}
.phone-badge img { width: 24px; height: 24px; border-radius: 7px; }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateX(6px); } }

.phone-status {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px 9px;
  font-size: 12px; color: var(--muted);
  min-height: 30px;
}
.phone-status .ic { width: 15px; height: 15px; }
.phone-status.ok { color: var(--accent-2); }
.phone-status.err { color: var(--danger); }

/* =================================================================
   JADVAL
   ================================================================= */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.4px; }
table.tbl th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: var(--faint);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.tbl tbody tr { transition: background var(--dur); }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.num, table.tbl th.num { text-align: right; }
table.tbl td.actions { text-align: right; white-space: nowrap; }
table.tbl td.actions .icon-btn { display: inline-grid; margin-left: 4px; }
.cell-main { font-weight: 600; }
.cell-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.cell-user { display: flex; align-items: center; gap: 9px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 650;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--line);
}
.badge .ic { width: 13px; height: 13px; }
.badge-ok { background: var(--accent-soft); color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.badge-brass { background: var(--brass-soft); color: var(--brass); border-color: color-mix(in srgb, var(--brass) 34%, transparent); }

/* =================================================================
   FILTR PANELI
   ================================================================= */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
}
.filter { display: flex; flex-direction: column; gap: 5px; min-width: 132px; }
.filter > span { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.filter select, .filter input {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-xs); padding: 8px 10px; font-size: 13px;
  outline: none; min-width: 0;
}
.filter select:focus, .filter input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter.grow { flex: 1; min-width: 190px; }
.filters .spacer { flex: 1; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2.5px; gap: 2px; }
.seg button {
  border: 0; background: none; cursor: pointer;
  padding: 6px 12px; border-radius: var(--r-xs);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: background var(--dur), color var(--dur);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* =================================================================
   BO'SH HOLAT / OGOHLANTIRISH
   ================================================================= */
.empty { padding: 46px 22px; text-align: center; }
.empty-icon {
  display: grid; place-items: center;
  width: 54px; height: 54px; margin: 0 auto 14px;
  border-radius: var(--r-md);
  background: var(--surface-2); border: 1px dashed var(--line);
  color: var(--faint);
}
.empty h3 { font-size: 15px; margin-bottom: 5px; }
.empty p { font-size: 13px; color: var(--muted); max-width: 380px; margin: 0 auto 16px; }

.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: var(--sp-3);
}
.alert .ic { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 32%, transparent); color: var(--danger); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 32%, transparent); color: var(--warn); }
.alert-ok { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--accent-2); }
.alert-info { background: var(--surface-2); color: var(--text-2); }

/* =================================================================
   MODAL
   ================================================================= */
.modal-host {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: var(--sp-4);
  background: var(--overlay);
  backdrop-filter: blur(4px);
  animation: fade .16s var(--ease);
  overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: rise .22s var(--ease) both;
  margin: auto;
}
.modal.wide { max-width: 720px; }
.modal-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 18px; max-height: min(66vh, 640px); overflow-y: auto; }
.modal-foot {
  display: flex; gap: var(--sp-2); justify-content: flex-end;
  padding: 14px 18px; border-top: 1px solid var(--line-soft);
}
.modal-foot .spacer { flex: 1; }

/* =================================================================
   TOAST
   ================================================================= */
.toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px;
  max-width: min(370px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  font-size: 13.2px;
  animation: slidein .26s var(--ease) both;
  pointer-events: auto;
}
@keyframes slidein { from { opacity: 0; transform: translateX(18px); } }
.toast.out { animation: slideout .2s var(--ease) forwards; }
@keyframes slideout { to { opacity: 0; transform: translateX(18px); } }
.toast b { display: block; font-size: 13.2px; margin-bottom: 1px; }
.toast span { color: var(--muted); font-size: 12.3px; }
.toast .ic { width: 18px; height: 18px; flex: 0 0 auto; }
.toast.ok { border-left-color: var(--accent); }
.toast.ok .ic { color: var(--accent-2); }
.toast.err { border-left-color: var(--danger); }
.toast.err .ic { color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.warn .ic { color: var(--warn); }
.toast.info .ic { color: var(--info); }

/* =================================================================
   DIAGRAMMALAR
   ================================================================= */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-text { fill: var(--faint); font-size: 10.5px; font-family: var(--font-mono); }
.chart .area-path { opacity: .16; }
.chart .line-path { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.bar-row { display: flex; align-items: center; gap: 11px; padding: 8px 0; }
.bar-row .bar-label { width: 96px; flex: 0 0 auto; font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.bar-row .bar-label img { width: 18px; height: 18px; border-radius: 5px; }
.bar-track {
  flex: 1; min-width: 0;
  display: block;
  height: 9px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
/* MUHIM: span inline bo'lgani uchun width/height qo'llanmasdi */
.bar-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: var(--r-full);
  background: var(--accent);
  transition: width .5s var(--ease);
}
.bar-fill.zero { min-width: 0; }
.bar-val { width: 62px; text-align: right; font-family: var(--font-mono); font-size: 12.5px; font-weight: 620; flex: 0 0 auto; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-center { font-family: var(--font-mono); }

/* =================================================================
   RO'YXAT ELEMENTLARI
   ================================================================= */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.feed-item:last-child { border-bottom: 0; }
.feed-body { flex: 1; min-width: 0; }
.feed-body b { display: block; font-size: 13.2px; font-weight: 620; }
.feed-body span { font-size: 11.8px; color: var(--muted); }
.feed-time { font-size: 11.5px; color: var(--faint); font-family: var(--font-mono); flex: 0 0 auto; }

.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.2px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 13px 16px; border-top: 1px solid var(--line-soft); }
.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-btns { display: flex; gap: 6px; }

.code-box {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--brass);
  border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 15px; font-weight: 600;
  color: var(--brass);
  word-break: break-all;
}
.code-box .spacer { flex: 1; }

.avatar-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--r-xs);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* =================================================================
   MOBIL
   ================================================================= */
@media (max-width: 940px) {
  .only-mobile { display: grid; }
  .hide-sm { display: none; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .24s var(--ease);
    box-shadow: var(--shadow-3);
  }
  body.nav-open .sidebar { transform: none; }
  .sidebar-close { display: grid; }
  .main { margin-left: 0; }

  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  .topbar-title h1 { font-size: 16.5px; }
  .topbar-title p { display: none; }
  .content { padding: var(--sp-4) var(--sp-4) 84px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-auto-flow: column;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: 0; background: none; cursor: pointer;
    padding: 6px 2px; color: var(--faint);
    font-size: 10px; font-weight: 600;
    border-radius: var(--r-xs);
  }
  .tab .ic { width: 21px; height: 21px; }
  .tab.active { color: var(--accent-2); }

  .toast-host { right: 12px; left: 12px; bottom: 82px; max-width: none; }
  .metric-value { font-size: 26px; }
  .filters { padding: 11px 12px; }
  .filter { min-width: 118px; flex: 1; }
  .phone-prefix, .phone-input { font-size: 18px; }
  .prefix-map { grid-template-columns: repeat(2, 1fr); }
  .modal-body { max-height: 70vh; }
  table.tbl th, table.tbl td { padding: 10px 11px; }
}

@media (max-width: 460px) {
  .content { padding: var(--sp-3) var(--sp-3) 84px; }
  .login-card { padding: 26px 20px 20px; }
  .bar-row .bar-label { width: 78px; }
}

/* Harakatni kamaytirish */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Chop etish */
@media print {
  .sidebar, .topbar, .tabbar, .filters, .toast-host { display: none !important; }
  .main { margin: 0; }
  .card { break-inside: avoid; border-color: #ccc; }
}

/* =================================================================
   YANGI ELEMENTLAR
   ================================================================= */

/* Telegram nishoni */
.tg-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 6px; vertical-align: middle;
  color: #2AABEE;
}
.tg-badge .ic { width: 15px; height: 15px; }
.tg-badge span { font-size: 11px; font-weight: 600; }

/* Operator nishonlari to'plami (taqsimot qatorida) */
.op-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.op-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 12px;
}
.op-pill img { width: 17px; height: 17px; object-fit: contain; border-radius: 4px; }
.op-pill b { font-weight: 650; }

/* Bosiladigan jadval qatorlari */
.tbl-click tbody tr { cursor: pointer; }
.tbl-click tbody tr:hover { background: var(--surface-2); }
.tbl-click tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Partiya tafsiloti */
.batch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.batch-cell {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface-2);
  transition: border-color var(--dur), background var(--dur);
}
.batch-cell.on { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--surface); }
.batch-cell img { width: 26px; height: 26px; object-fit: contain; border-radius: 6px; flex: none; }
.batch-op { font-size: 12.5px; color: var(--text-2); flex: 1; min-width: 0; }
.batch-cell input {
  width: 72px; flex: none; text-align: right;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 14px; font-weight: 650;
}
.batch-cell input:focus { outline: none; border-color: var(--accent); }
.batch-qty { font-size: 17px; }
.batch-total {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding: 11px 13px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  font-size: 13px;
}
.batch-total b { font-size: 16px; }

/* Ichki select (karta sarlavhasida) */
.inline-select {
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  max-width: 180px;
}

/* Uzun matnni qisqartirish */
td.ellip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Maydon tekshiruvi */
.field-hint.is-bad { color: var(--danger); }
.field-hint.is-good { color: var(--ok); }
.field.has-error .field-box { border-color: var(--danger); }

/* =================================================================
   MOSLASHUVCHAN JOYLASHUV — planshet va telefon
   ================================================================= */

/* ---- Planshet: 941–1180 px ---- */
@media (max-width: 1180px) and (min-width: 941px) {
  .sidebar { width: 216px; }
  .main { margin-left: 216px; }
  .filters { gap: 10px; }
  .filter { min-width: 132px; }
  .batch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Planshet (vertikal) va telefon: ≤940 px ---- */
@media (max-width: 940px) {
  /* Sarlavha ustunlarni siqmasin — gorizontal aylantirish + birinchi ustun qotib turadi */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.tbl { min-width: 100%; }
  table.tbl th:first-child,
  table.tbl td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--surface);
    box-shadow: 6px 0 8px -8px rgba(0, 0, 0, .45);
  }
  .tbl-click tbody tr:hover td:first-child { background: var(--surface-2); }

  /* Filtrlar o'raladi, tugmalar esa oxirgi qatorga tushadi — hech narsa yashirilmaydi */
  .filters {
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 10px;
  }
  .filters .filter { flex: 1 1 44%; min-width: 140px; }
  .filters .filter.grow { flex: 1 1 100%; }
  .filters .spacer { display: none; }
  .filters .btn {
    flex: 1 1 auto; order: 99;
    justify-content: center;
    min-width: 128px;
  }

  /* Modal — pastdan chiqadigan varaq */
  .modal-host { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%; max-width: none;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 92vh;
    animation: sheetUp .28s var(--ease) both;
  }
  .modal-body { max-height: calc(92vh - 152px); }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  @keyframes sheetUp { from { transform: translateY(26px); opacity: .6; } }

  /* Modal ichidagi tugmalar to'liq kenglikda */
  .modal-foot { flex-wrap: wrap; row-gap: 8px; }
  .modal-foot .btn { flex: 1 1 40%; justify-content: center; min-width: 120px; }
  .modal-foot .spacer { display: none; }

  .card-head { flex-wrap: wrap; row-gap: 8px; }
  .inline-select { max-width: 100%; flex: 1; }
  td.ellip { max-width: 140px; }
}

/* ---- Telefon: ≤640 px ---- */
@media (max-width: 640px) {
  .topbar { position: sticky; top: 0; z-index: 40; }
  /* Faqat ikkilamchi tugmalar ixchamlashadi, asosiysi to'liq ko'rinadi */
  .topbar-actions .btn:not(.btn-primary) span { display: none; }
  .topbar-actions .btn:not(.btn-primary) { padding: 0 11px; }

  .metric { padding: 14px; }
  .metric-value { font-size: 24px; }
  .metric-foot { font-size: 11px; }

  .batch-grid { grid-template-columns: 1fr; }
  .batch-cell input { width: 88px; }

  .op-stack { gap: 5px; }
  .op-pill { padding: 2px 7px 2px 3px; font-size: 11.5px; }
  .op-pill img { width: 15px; height: 15px; }

  .card-head h2 { font-size: 15px; }
  .chart-legend { flex-direction: column; gap: 8px; }
  .donut-wrap { flex-direction: column; align-items: center; gap: 14px; }

  .filters .btn { flex: 1 1 100%; }

  .feed-time { display: none; }
  .avatar-edit { flex-direction: column; align-items: flex-start; }
}

/* ---- Kichik telefon: ≤400 px ---- */
@media (max-width: 400px) {
  .content { padding: 12px 12px 88px; }
  .tab span { font-size: 9.5px; }
  .phone-prefix, .phone-input { font-size: 17px; }
  .prefix-map { grid-template-columns: 1fr 1fr; gap: 6px; }
}

/* ---- Barmoq bilan bosish uchun kattaroq nishonlar ---- */
@media (pointer: coarse) {
  .icon-btn { min-width: 38px; min-height: 38px; }
  .icon-btn.sm { min-width: 34px; min-height: 34px; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 36px; }
  select, input, textarea { font-size: 16px; } /* iOS avtomatik kattalashtirmasin */
  .nav-item { padding-top: 11px; padding-bottom: 11px; }
}

/* ---- Landshaft rejimida past ekran ---- */
@media (max-height: 520px) and (orientation: landscape) {
  .login-card { padding: 20px 22px 16px; }
  .login-title { margin-top: 16px; font-size: 21px; }
  .login-ops { display: none; }
}

/* Kirish tugmasi — muvaffaqiyat holati */
#login-submit { transition: background var(--dur), border-color var(--dur), color var(--dur); }
#login-submit.is-ok {
  background: var(--ok) !important;
  border-color: var(--ok) !important;
  color: #04150f !important;
}

/* Xato bo'lganda kartani silkitish */
.login-card.shake { animation: cardShake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes cardShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* =================================================================
   STATISTIKA — operator brendlariga hamohang
   ================================================================= */
.opstat {
  position: relative;
  padding: 15px 16px 12px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--op-color) 11%, transparent), transparent 62%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--op-color) 26%, var(--line));
  overflow: hidden;
  transition: transform var(--dur), box-shadow var(--dur);
}
.opstat:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -18px color-mix(in srgb, var(--op-color) 80%, transparent); }
.opstat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--op-color), color-mix(in srgb, var(--op-color) 30%, transparent));
}

.opstat-head { display: flex; align-items: center; gap: 10px; }
.opstat-head img { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; flex: none; }
.opstat-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.opstat-name b { font-size: 13.5px; font-weight: 700; }
.opstat-name i {
  font-style: normal; font-size: 10.5px; color: var(--faint);
  font-family: var(--font-mono); letter-spacing: .03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.opstat-body { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
.opstat-num {
  font-size: 27px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.opstat-share {
  font-size: 12px; font-weight: 650;
  padding: 2px 7px; border-radius: 999px;
  color: var(--op-color);
  background: color-mix(in srgb, var(--op-color) 15%, transparent);
}

.opstat-bar {
  height: 5px; margin-top: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--op-color) 12%, var(--surface-2));
  overflow: hidden;
}
.opstat-bar i {
  display: block; height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--op-color) 70%, transparent), var(--op-color));
  transition: width .6s var(--ease);
}

.opstat-spark { margin-top: 8px; height: 34px; opacity: .9; }
.opstat-spark .spark { width: 100%; height: 34px; display: block; }

/* Jadval sarlavhalarida operator ranglari */
th.op-th { white-space: nowrap; }
th.op-th img { width: 15px; height: 15px; object-fit: contain; vertical-align: -3px; margin-right: 5px; }
th.op-th span { color: var(--op-color); }
td.op-td { color: var(--text-2); }
td.op-td:not(:empty) { border-bottom-color: var(--line-soft); }

/* =================================================================
   PREFIKSLAR BOSHQARUVI
   ================================================================= */
.pref-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.pref-col {
  padding: 13px 14px;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--op-color) 24%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--op-color) 8%, transparent), transparent 60%),
    var(--surface-2);
}
.pref-col-head { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.pref-col-head img { width: 24px; height: 24px; object-fit: contain; border-radius: 6px; }
.pref-col-head b { font-size: 13.5px; flex: 1; }
.pref-count {
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  color: var(--op-color);
  background: color-mix(in srgb, var(--op-color) 15%, transparent);
}
.pref-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.pref-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 5px 4px 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--op-color) 32%, var(--line));
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.pref-chip b { font-weight: 700; color: var(--text); }
.pref-x {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border: 0; border-radius: 50%;
  background: none; color: var(--faint);
  cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.pref-x:hover { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pref-x .ic { width: 13px; height: 13px; }
.pref-add {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--op-color) 45%, var(--line));
  background: none; color: var(--op-color);
  cursor: pointer;
  transition: background var(--dur), transform var(--dur);
}
.pref-add:hover { background: color-mix(in srgb, var(--op-color) 14%, transparent); transform: scale(1.06); }
.pref-add .ic { width: 15px; height: 15px; }
.pref-empty { font-size: 12px; color: var(--faint); align-self: center; }

.pref-preview {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px dashed var(--line);
}
.pref-preview span { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.pref-preview b { font-size: 17px; letter-spacing: .06em; }
.pref-preview i { font-style: normal; color: var(--accent-2); font-weight: 700; }

/* =================================================================
   MOBIL: tezkor sotuv tugmasi doim ko'rinib tursin
   ================================================================= */
@media (max-width: 940px) {
  /* Yuqoridagi tor tugma o'rniga pastda suzuvchi tugma */
  #quick-sale-btn {
    position: fixed;
    right: 16px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 55;
    width: auto; height: 52px;
    padding: 0 20px 0 17px;
    border-radius: 999px;
    box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--accent) 70%, transparent),
                0 2px 8px rgba(0, 0, 0, .3);
    animation: fabIn .3s var(--ease) both;
  }
  #quick-sale-btn .ic { width: 20px; height: 20px; }
  #quick-sale-btn span { display: inline !important; font-size: 13.5px; }
  @keyframes fabIn { from { opacity: 0; transform: translateY(12px) scale(.9); } }
}

@media (max-width: 400px) {
  #quick-sale-btn { padding: 0 16px 0 14px; height: 48px; }
  #quick-sale-btn span { font-size: 12.5px; }
}

/* Hech qanday tugma ekrandan chiqib ketmasin */
.btn { max-width: 100%; }
.card-head { min-width: 0; }
.filters { min-width: 0; }
