/* =====================================================================
   OZON — komponentlar
   Har komponentning JS tomoni: js/ui/*.js (DESIGN.md'da imzolari bor).
   Tonlar: .tone-ok | .tone-warn | .tone-crit | .tone-info | .tone-neutral | .tone-brand
   ===================================================================== */

/* ---------- Ton o'zgaruvchilari ------------------------------------------ */
.tone-ok      { --t: var(--ok);      --t-ink: var(--ok-ink);      --t-soft: var(--ok-soft);      --t-line: var(--ok-line); }
.tone-warn    { --t: var(--warn);    --t-ink: var(--warn-ink);    --t-soft: var(--warn-soft);    --t-line: var(--warn-line); }
.tone-crit    { --t: var(--crit);    --t-ink: var(--crit-ink);    --t-soft: var(--crit-soft);    --t-line: var(--crit-line); }
.tone-info    { --t: var(--info);    --t-ink: var(--info-ink);    --t-soft: var(--info-soft);    --t-line: var(--info-line); }
.tone-neutral { --t: var(--neutral); --t-ink: var(--neutral-ink); --t-soft: var(--neutral-soft); --t-line: var(--neutral-line); }
.tone-brand   { --t: var(--brand);   --t-ink: var(--brand-ink);   --t-soft: var(--brand-soft);   --t-line: var(--brand-line); }

/* ======================================================================
   Tugmalar
   ====================================================================== */
.btn {
  --btn-h: 40px;
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 18px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap;
  user-select: none; -webkit-user-select: none;
  transition: transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), opacity var(--dur-2);
}
.btn:active:not(:disabled) { transform: scale(.965); transition-duration: var(--dur-1); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; }
.btn .ic { margin: 0 -2px; }
.btn-sm { --btn-h: 32px; padding: 0 13px; font-size: 13px; gap: 6px; }
.btn-lg { --btn-h: 50px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon-only { width: var(--btn-h); padding: 0; }

.btn-primary {
  color: var(--on-brand);
  background: var(--brand-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), inset 0 -1px 0 rgba(0, 0, 0, .12), inset 0 0 0 1px rgba(120, 0, 30, .25), 0 1px 2px rgba(120, 8, 36, .3), 0 10px 22px -10px var(--brand-glow);
}
.btn-primary::before {
  content: ""; position: absolute; inset: 1px 1px 50% 1px; z-index: -1; border-radius: var(--r-pill) var(--r-pill) 40% 40% / var(--r-pill) var(--r-pill) 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .30), rgba(255, 255, 255, 0));
  pointer-events: none;
}
@media (hover: hover) { .btn-primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(0, 0, 0, .12), inset 0 0 0 1px rgba(120, 0, 30, .25), 0 2px 4px rgba(120, 8, 36, .3), 0 14px 30px -10px var(--brand-glow); filter: brightness(1.05); } }

.btn-glass {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .52));
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  backdrop-filter: blur(14px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 0 1px rgba(255, 255, 255, .55), 0 0 0 .5px var(--line-2), 0 4px 12px -6px rgba(110, 14, 44, .18);
}
@media (hover: hover) { .btn-glass:hover:not(:disabled) { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .66)); } }
.btn-soft { color: var(--brand-ink); background: var(--brand-soft); }
@media (hover: hover) { .btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 16%, transparent); } }
.btn-ghost { color: var(--ink-2); background: transparent; }
@media (hover: hover) { .btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); } }
.btn-ghost:active:not(:disabled) { background: var(--press); }
.btn-danger { color: #fff; background: linear-gradient(180deg, #EA4A2A, #C9301A); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 8px 20px -10px rgba(226, 64, 31, .6); }
.btn-link { height: auto; padding: 0; color: var(--brand-ink); border-radius: 4px; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > .o3-loader { position: absolute; inset: 0; margin: auto; color: var(--on-brand); }
.btn-glass.is-loading > .o3-loader, .btn-ghost.is-loading > .o3-loader, .btn-soft.is-loading > .o3-loader { color: var(--brand); }

/* Ikonka tugmasi */
.icon-btn {
  --ib: 40px;
  position: relative;
  display: inline-grid; place-items: center;
  width: var(--ib); height: var(--ib); border-radius: 50%;
  color: var(--ink-2);
  transition: background var(--dur-2) var(--ease-out), color var(--dur-2), transform var(--dur-2) var(--ease-spring);
}
@media (hover: hover) { .icon-btn:hover { background: var(--hover); color: var(--ink); } }
.icon-btn:active { transform: scale(.9); background: var(--press); }
.icon-btn-sm { --ib: 32px; }
.icon-btn-lg { --ib: 48px; }
.icon-btn.is-glass { background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .45)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 .5px var(--line-2), 0 4px 12px -6px rgba(110, 14, 44, .2); }
.icon-btn .dot-badge { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--bg-2); }

/* Qorong'i mavzuda glass tugmalar */
html[data-theme="dark"] .btn-glass, html[data-theme="dark"] .icon-btn.is-glass { background: linear-gradient(180deg, rgba(255, 230, 236, .12), rgba(255, 230, 236, .05)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px rgba(255, 255, 255, .06), 0 4px 14px -6px rgba(0, 0, 0, .5); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .btn-glass, html:not([data-theme="light"]) .icon-btn.is-glass { background: linear-gradient(180deg, rgba(255, 230, 236, .12), rgba(255, 230, 236, .05)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px rgba(255, 255, 255, .06), 0 4px 14px -6px rgba(0, 0, 0, .5); }
}

/* ======================================================================
   Badge, pill, chip, kbd, dot
   ====================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--t-ink, var(--ink-2));
  background: var(--t-soft, var(--fill-2));
  box-shadow: inset 0 0 0 1px var(--t-line, var(--line));
}
.badge .ic { margin-left: -1px; }
.badge-lg { height: 28px; padding: 0 11px; font-size: var(--fs-sm); gap: 6px; }
.badge-solid { color: #fff; background: var(--t, var(--ink-2)); box-shadow: none; }
.badge-plain { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); }
.badge-mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 650; white-space: nowrap;
  color: var(--t-ink); background: var(--t-soft); box-shadow: inset 0 0 0 1px var(--t-line);
}
.status-pill.is-sm { height: 22px; padding: 0 8px 0 6px; font-size: var(--fs-2xs); gap: 4px; }

.stat-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px 0 10px;
  border-radius: var(--r-pill);
  background: var(--glass-inner-fill);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, .5);
  font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap;
}
.stat-pill .ic { color: var(--t-ink, var(--brand-ink)); }
.stat-pill b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.demo-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .04em; white-space: nowrap;
  color: var(--brand-ink);
  background: repeating-linear-gradient(135deg, var(--brand-softer) 0 6px, transparent 6px 12px), var(--brand-softer);
  box-shadow: inset 0 0 0 1px var(--brand-line);
}
.demo-pill b { font-weight: 800; letter-spacing: .08em; }
.demo-pill.is-sm { height: 20px; padding: 0 7px; gap: 4px; font-size: 9.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); white-space: nowrap;
  background: var(--glass-inner-fill);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background var(--dur-2), color var(--dur-2), box-shadow var(--dur-2), transform var(--dur-2) var(--ease-spring);
}
.chip .chip-count { font-size: var(--fs-2xs); font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (hover: hover) { button.chip:hover, a.chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); } }
button.chip:active, a.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"], .chip.is-active {
  color: var(--on-brand); background: var(--brand-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 14px -8px var(--brand-glow);
}
.chip[aria-pressed="true"] .chip-count, .chip.is-active .chip-count { color: rgba(255, 255, 255, .85); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-row.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.chip-row.scroll::-webkit-scrollbar { display: none; }

.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 7px; font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--ink-3);
  background: var(--fill-1); box-shadow: inset 0 0 0 1px var(--line-2), inset 0 -1px 0 var(--line-2);
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--t, var(--neutral)); flex: none; }
.dot.is-pulse { box-shadow: 0 0 0 0 var(--t); animation: dot-pulse 2s var(--ease-out) infinite; }
@keyframes dot-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--t) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

.dept-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 10px 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); white-space: nowrap;
  background: var(--fill-1); box-shadow: inset 0 0 0 1px var(--line);
}
.dept-chip .dot { background: var(--dc, var(--neutral)); }
a.dept-chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

.branch-chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 30px; padding: 3px 12px 3px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink); white-space: nowrap;
  background: var(--glass-inner-fill); box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: box-shadow var(--dur-2), transform var(--dur-2) var(--ease-spring);
}
.branch-chip .branch-chip-ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); }
.branch-chip .branch-chip-sub { font-weight: 500; color: var(--ink-3); font-size: var(--fs-xs); }
a.branch-chip:hover { box-shadow: inset 0 0 0 1px var(--brand-line); }
a.branch-chip:active { transform: scale(.97); }
.branch-chip .badge { height: 18px; padding: 0 6px; font-size: 10px; }

/* ======================================================================
   Karta
   ====================================================================== */
.card { padding: var(--card-pad, 22px); min-width: 0; }
.card-sm { --card-pad: 16px; }
.card-lg { --card-pad: 28px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; min-width: 0; }
.card-head:last-child { margin-bottom: 0; }
.card-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-title { font-size: var(--fs-md); font-weight: 700; letter-spacing: var(--tracking-tight); line-height: 1.3; color: var(--ink); }
.card-sub { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.45; }
.card-actions { display: flex; align-items: center; gap: 6px; flex: none; margin: -4px -6px -4px 0; }
.card-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink-3); }
a.card-link-overlay::after { content: ""; position: absolute; inset: 0; z-index: 4; border-radius: inherit; }

.icon-tile {
  --tile: var(--brand);
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 12px;
  color: var(--tile);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tile) 18%, transparent), color-mix(in srgb, var(--tile) 8%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tile) 20%, transparent), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.icon-tile.is-lg { width: 52px; height: 52px; border-radius: 16px; }
.icon-tile.is-sm { width: 30px; height: 30px; border-radius: 10px; }
.icon-tile.is-solid { color: #fff; background: linear-gradient(150deg, color-mix(in srgb, var(--tile) 82%, #fff), var(--tile) 55%, color-mix(in srgb, var(--tile) 80%, #000)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 14px -6px color-mix(in srgb, var(--tile) 60%, transparent); }

/* ======================================================================
   Sahifa sarlavhasi
   ====================================================================== */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 24px; margin-bottom: 28px; }
.page-header-main { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.page-crumbs { margin-bottom: 2px; }
@media (min-width: 900px) { .page-crumbs { display: none; } } /* desktop: breadcrumbs topbar'da */
.page-header-title-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-title { font-size: var(--fs-4xl); font-weight: 800; letter-spacing: var(--tracking-display); line-height: 1.05; color: var(--ink); }
.page-subtitle { font-size: var(--fs-md); line-height: 1.55; color: var(--ink-2); max-width: 70ch; text-wrap: pretty; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-header-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.page-header.is-hero .page-title { font-size: var(--fs-display); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: var(--fs-xl); font-weight: 750; letter-spacing: var(--tracking-title); }
.section-sub { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 2px; }

/* ======================================================================
   Breadcrumbs
   ====================================================================== */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: var(--fs-sm); color: var(--ink-3); min-width: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.crumbs a { border-radius: 6px; padding: 1px 3px; margin: 0 -3px; }
.crumbs a:hover { color: var(--ink); background: var(--hover); }
.crumbs .ic { color: var(--ink-4); }
.crumbs [aria-current="page"] { color: var(--ink-2); font-weight: 600; }
.topbar-crumbs .crumbs { flex-wrap: nowrap; overflow: hidden; }
.topbar-crumbs .crumbs li:last-child { overflow: hidden; }
.topbar-crumbs .crumbs li:last-child span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ======================================================================
   KPI plitkasi
   ====================================================================== */
.kpi { --card-pad: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 152px; }
.kpi-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kpi-label { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.kpi-value-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.kpi-value { font-size: clamp(26px, 1.4vw + 16px, 34px); font-weight: 750; letter-spacing: -0.03em; line-height: 1; color: var(--ink); }
.kpi-unit { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); }
.kpi-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; min-width: 0; }
.kpi-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.kpi-target { font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-target b { color: var(--ink-2); font-weight: 600; }
.kpi-spark { flex: none; margin-bottom: 2px; }
.kpi.is-hero { --card-pad: 26px; min-height: 220px; }
.kpi.is-hero .kpi-value { font-size: clamp(44px, 3vw + 24px, 64px); letter-spacing: -0.04em; }
.delta {
  display: inline-flex; align-items: center; gap: 3px;
  height: 22px; padding: 0 7px 0 5px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--t-ink, var(--ink-2)); background: var(--t-soft, var(--fill-2));
}

/* ======================================================================
   Avatar
   ====================================================================== */
.avatar {
  --av: 40px; --av-c: var(--brand);
  position: relative; flex: none;
  display: inline-grid; place-items: center;
  width: var(--av); height: var(--av);
  border-radius: calc(var(--av) * .32);
  font-size: calc(var(--av) * .36); font-weight: 750; letter-spacing: -0.02em; line-height: 1;
  color: #fff;
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0) 55%),
    linear-gradient(150deg, color-mix(in srgb, var(--av-c) 78%, #fff) 0%, var(--av-c) 52%, color-mix(in srgb, var(--av-c) 72%, #000) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 6px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .08), 0 6px 14px -8px color-mix(in srgb, var(--av-c) 70%, transparent);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
  user-select: none;
}
.avatar.is-round { border-radius: 50%; }
.avatar.is-xs { --av: 24px; } .avatar.is-sm { --av: 32px; } .avatar.is-md { --av: 40px; } .avatar.is-lg { --av: 56px; } .avatar.is-xl { --av: 76px; }
.avatar.is-planned { --av-c: var(--dept-planned); filter: grayscale(.4); opacity: .85; }
.avatar .avatar-badge { position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--bg-2); color: var(--brand-ink); box-shadow: 0 0 0 1.5px var(--bg-2), 0 1px 3px rgba(0, 0, 0, .2); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg-2); }
.avatar-stack .avatar + .avatar { margin-left: calc(var(--av) * -.28); }

/* ======================================================================
   Agent kartasi
   ====================================================================== */
.agent-card { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px; text-align: left; color: inherit; min-width: 0; }
.agent-card-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.agent-card-name { font-size: var(--fs-md); font-weight: 700; letter-spacing: var(--tracking-tight); color: var(--ink); display: flex; align-items: center; gap: 6px; min-width: 0; }
.agent-card-title { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.35; }
.agent-card-role { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.45; }
.agent-card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.agent-card-handle { flex: 1 1 90px; min-width: 0; text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-card .chev { margin-left: auto; color: var(--ink-4); transition: transform var(--dur-2) var(--ease-spring), color var(--dur-2); }
@media (hover: hover) { .agent-card:hover .chev { transform: translateX(3px); color: var(--brand-ink); } }

.agent-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-md); text-align: left; color: inherit;
  transition: background var(--dur-2);
}
@media (hover: hover) { .agent-row:hover { background: var(--hover); } }
.agent-row:active { background: var(--press); }
.agent-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.agent-row-name { font-weight: 650; font-size: 14px; color: var(--ink); }
.agent-row-sub { font-size: var(--fs-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ======================================================================
   Overlay: modal, drawer, sheet (<dialog>)
   ====================================================================== */
dialog.ov {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--ink);
  overflow: hidden;
}
dialog.ov::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(5px) saturate(120%); backdrop-filter: blur(5px) saturate(120%); animation: fade-in var(--dur-3) var(--ease-out) both; }
dialog.ov.is-closing::backdrop { animation: fade-out var(--dur-2) var(--ease-in-out) both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

.ov-panel { display: flex; flex-direction: column; overflow: hidden; outline: none; }
.ov-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 12px 24px; flex: none; }
.ov-head-text { flex: 1; min-width: 0; }
.ov-title { font-size: var(--fs-xl); font-weight: 750; letter-spacing: var(--tracking-title); line-height: 1.2; }
.ov-sub { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 3px; }
.ov-close { margin: -4px -6px 0 0; }
.ov-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 24px 24px; }
.ov-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--line); flex: none; }

/* Modal (markazda) */
dialog.ov-modal[open] { display: grid; place-items: center; padding: 16px; }
.ov-modal .ov-panel { width: min(var(--ov-w, 560px), 100%); max-height: min(86dvh, 860px); animation: modal-in 360ms var(--ease-spring) both; }
.ov-modal.is-closing .ov-panel { animation: modal-out 180ms var(--ease-in-out) both; }
.ov-modal.is-sm { --ov-w: 420px; } .ov-modal.is-lg { --ov-w: 760px; } .ov-modal.is-xl { --ov-w: 980px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* Drawer (o'ngdan) */
.ov-drawer .ov-panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px;
  width: min(var(--ov-w, 600px), calc(100% - 24px));
  animation: drawer-in 440ms var(--ease-spring-soft) both;
}
.ov-drawer.is-wide { --ov-w: 760px; }
.ov-drawer.is-closing .ov-panel { animation: drawer-out 200ms var(--ease-in-out) both; }
@keyframes drawer-in { from { opacity: .4; transform: translateX(calc(100% + 24px)); } to { opacity: 1; transform: none; } }
@keyframes drawer-out { to { opacity: 0; transform: translateX(40px); } }

/* Sheet (pastdan) */
.ov-sheet .ov-panel {
  position: absolute; left: 50%; bottom: 0;
  width: min(var(--ov-w, 640px), 100%);
  max-height: min(88dvh, 900px);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  --g-radius: 30px 30px 0 0;
  transform: translateX(-50%);
  animation: sheet-in 440ms var(--ease-spring-soft) both;
}
.ov-sheet.is-closing .ov-panel { animation: sheet-out 200ms var(--ease-in-out) both; }
@keyframes sheet-in { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes sheet-out { to { transform: translate(-50%, 100%); } }
.ov-grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.ov-sheet .ov-head { padding-top: 10px; }

@media (max-width: 899px) {
  .ov-drawer .ov-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    height: min(94dvh, 100%);
    --g-radius: 30px 30px 0 0;
    animation: drawer-up 440ms var(--ease-spring-soft) both;
  }
  .ov-drawer.is-closing .ov-panel { animation: drawer-down 200ms var(--ease-in-out) both; }
  .ov-drawer .ov-grabber { display: block; }
  .ov-head { padding: 14px 14px 10px 18px; }
  .ov-body { padding: 4px 18px calc(24px + var(--safe-bottom)); }
}
@media (min-width: 900px) { .ov-drawer .ov-grabber { display: none; } }
@keyframes drawer-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes drawer-down { to { transform: translateY(100%); } }

/* ======================================================================
   Toast
   ====================================================================== */
.toasts {
  position: fixed; z-index: var(--z-toast);
  left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
  pointer-events: none; width: min(460px, calc(100% - 24px));
}
@media (max-width: 899px) { .toasts { bottom: calc(var(--tabbar-h) + 22px + var(--safe-bottom)); } }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  max-width: 100%; min-height: 46px; padding: 10px 16px 10px 12px;
  --g-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
  animation: toast-in 420ms var(--ease-spring) both;
}
.toast .toast-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--t-ink); background: var(--t-soft); flex: none; }
.toast.is-leaving { animation: toast-out 200ms var(--ease-in-out) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* ======================================================================
   Tooltip
   ====================================================================== */
.tip {
  position: fixed; z-index: var(--z-tooltip); left: 0; top: 0;
  max-width: 280px; padding: 7px 11px;
  --g-radius: 12px;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.4; color: var(--ink);
  pointer-events: none; white-space: pre-line;
  opacity: 0; transform: translate(var(--tx, 0), var(--ty, 0)) scale(.96);
  transition: opacity var(--dur-1) var(--ease-out), transform var(--dur-2) var(--ease-spring);
}
.tip.is-on { opacity: 1; transform: translate(var(--tx, 0), var(--ty, 0)); }

/* ======================================================================
   Popover / menyu
   ====================================================================== */
.menu {
  position: fixed; z-index: var(--z-popover);
  min-width: 248px; max-width: min(340px, calc(100vw - 24px));
  padding: 6px;
  --g-radius: 20px;
  animation: menu-in 260ms var(--ease-spring) both;
  transform-origin: var(--origin, top right);
}
.menu.is-closing { animation: menu-out 140ms var(--ease-in-out) both; }
@keyframes menu-in { from { opacity: 0; transform: scale(.94) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes menu-out { to { opacity: 0; transform: scale(.96); } }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 8px; }
.menu-label { padding: 8px 12px 4px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3); }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  min-height: 40px; padding: 8px 12px; border-radius: 13px;
  font-size: 14px; font-weight: 550; color: var(--ink); text-align: left;
  transition: background var(--dur-1);
}
.menu-item .ic { color: var(--ink-3); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-item:active { background: var(--press); }
.menu-item.is-danger { color: var(--crit-ink); } .menu-item.is-danger .ic { color: var(--crit-ink); }
.menu-item .menu-trail { margin-left: auto; color: var(--ink-3); font-size: var(--fs-xs); }
.menu .segmented { margin: 4px 6px 6px; }

/* ======================================================================
   Tabs (chiziqli) va segmented control (sirpanuvchi "lens")
   ====================================================================== */
.tabs { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  height: 42px; padding: 0 12px; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--ink-3);
  transition: color var(--dur-2);
}
.tab:hover { color: var(--ink); }
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 3px 3px 0 0; background: var(--brand); transform: scaleX(0); transition: transform var(--dur-3) var(--ease-spring); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .tab-count { font-size: var(--fs-2xs); font-weight: 700; color: var(--ink-3); background: var(--fill-2); border-radius: var(--r-pill); padding: 2px 6px; font-variant-numeric: tabular-nums; }
.tab-panel[hidden] { display: none; }
.tab-panel { animation: rise-in 360ms var(--ease-out) both; padding-top: 18px; }

.segmented {
  --n: 2; --i: 0;
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; border-radius: var(--r-pill);
  background: var(--fill-2); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 2px rgba(0, 0, 0, .04);
  isolation: isolate;
}
.segmented.is-block { display: grid; width: 100%; }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 6px) / var(--n));
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 255, 255, .82));
  box-shadow: inset 0 1px 0 #fff, 0 0 0 .5px rgba(80, 10, 30, .1), 0 3px 8px -2px rgba(80, 10, 30, .16), 0 1px 2px rgba(80, 10, 30, .08);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 420ms var(--ease-spring);
}
.seg-btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; color: var(--ink-3); white-space: nowrap;
  transition: color var(--dur-2);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-checked="true"] { color: var(--ink); }
.segmented.is-sm .seg-btn { height: 26px; padding: 0 10px; font-size: 12px; }
html[data-theme="dark"] .seg-thumb { background: linear-gradient(180deg, rgba(255, 230, 236, .22), rgba(255, 230, 236, .12)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 8px rgba(0, 0, 0, .4); }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .seg-thumb { background: linear-gradient(180deg, rgba(255, 230, 236, .22), rgba(255, 230, 236, .12)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 8px rgba(0, 0, 0, .4); } }

/* ======================================================================
   Formalar
   ====================================================================== */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); }
.field-hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--crit-ink); }
.input {
  width: 100%; height: 48px; padding: 0 16px;
  border: 0; border-radius: 15px;
  font-size: 16px; color: var(--ink);
  background: var(--glass-inner-fill);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 2px rgba(60, 10, 25, .05);
  transition: box-shadow var(--dur-2) var(--ease-out), background var(--dur-2);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--ink-3); opacity: .8; }
.input:hover { box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 2px rgba(60, 10, 25, .05); }
.input:focus, .input:focus-visible { outline: none; box-shadow: inset 0 0 0 1.5px var(--brand), 0 0 0 4px var(--brand-soft); background: var(--bg-2); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--crit), 0 0 0 4px var(--crit-soft); }
.input-sm { height: 38px; font-size: 14px; border-radius: 12px; }
textarea.input { height: auto; min-height: 96px; padding: 12px 16px; line-height: 1.5; resize: vertical; }
select.input { padding-right: 40px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23866' stroke-width='2' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 52px; }
.input-wrap .input-lead { position: absolute; left: 14px; color: var(--ink-3); pointer-events: none; }
.input-wrap .input-lead ~ .input { padding-left: 44px; }
.input-wrap .input-trail { position: absolute; right: 4px; }

.search {
  position: relative; display: flex; align-items: center; min-width: 0;
  height: 42px; border-radius: var(--r-pill);
  background: var(--glass-inner-fill);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: box-shadow var(--dur-2);
}
.search:focus-within { box-shadow: inset 0 0 0 1.5px var(--brand), 0 0 0 4px var(--brand-soft); }
.search > .ic { position: absolute; left: 14px; color: var(--ink-3); pointer-events: none; }
.search input:focus-visible, .pal-input:focus-visible { outline: none; box-shadow: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; padding: 0 40px 0 42px; font-size: 15px; outline: none; }
.search input::placeholder { color: var(--ink-3); opacity: .85; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .search-clear { position: absolute; right: 5px; }
.search input:placeholder-shown ~ .search-clear { display: none; }

/* Topbar qidiruv tugmasi */
.search-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; min-width: 240px; padding: 0 8px 0 14px; border-radius: var(--r-pill);
  font-size: 14px; color: var(--ink-3);
  background: var(--glass-inner-fill);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: box-shadow var(--dur-2), color var(--dur-2), transform var(--dur-2) var(--ease-spring);
}
.search-trigger:hover { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.search-trigger:active { transform: scale(.98); }
.search-trigger .kbd { margin-left: auto; }
@media (max-width: 1199px) { .search-trigger { min-width: 0; width: 40px; padding: 0; justify-content: center; } .search-trigger > span, .search-trigger .kbd { display: none; } }

/* Parol kuchi */
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pw-meter i { height: 5px; border-radius: 3px; background: var(--fill-3); transition: background var(--dur-3) var(--ease-out); }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--crit); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: var(--ok); }
.pw-meter[data-score="4"] i { background: var(--ok); }
.pw-hint { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--ink-3); }
.pw-hint b { color: var(--ink-2); }
.pw-rules { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--ink-3); }
.pw-rules li { display: flex; align-items: center; gap: 6px; list-style: none; }
.pw-rules li.is-ok { color: var(--ok-ink); }

.form-error {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 14px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--crit-ink); background: var(--crit-soft); box-shadow: inset 0 0 0 1px var(--crit-line);
  animation: shake 420ms var(--ease-out);
}
.form-error.is-warn { color: var(--warn-ink); background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn-line); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ======================================================================
   Jadval
   ====================================================================== */
.table-wrap { position: relative; overflow-x: auto; border-radius: var(--r-md); -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: 14px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 14px; text-align: left; white-space: nowrap;
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--line-2);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.strong, .table .cell-strong { color: var(--ink); font-weight: 600; }
.table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .is-center { text-align: center; }
.table .is-nowrap { white-space: nowrap; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr.is-clickable { cursor: pointer; }
@media (hover: hover) { .table tbody tr:hover { background: var(--hover); } }
.table.is-dense td { padding: 9px 12px; } .table.is-dense th { padding: 8px 12px; }
.table tbody tr:first-child td:first-child { border-top-left-radius: 12px; }
@media (max-width: 699px) {
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile, .table.stack-mobile tbody, .table.stack-mobile tr, .table.stack-mobile td { display: block; width: 100%; }
  .table.stack-mobile tr { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .table.stack-mobile tr:last-child { border-bottom: 0; }
  .table.stack-mobile td { display: flex; justify-content: space-between; gap: 16px; padding: 5px 8px; border: 0; text-align: right; }
  .table.stack-mobile td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
  .table.stack-mobile td[data-label=""]::before { display: none; }
  .table.stack-mobile td.is-primary { justify-content: flex-start; text-align: left; font-weight: 650; color: var(--ink); }
  .table.stack-mobile td.is-primary::before { display: none; }
}

/* ======================================================================
   Ro'yxat, KV, callout, progress, timeline
   ====================================================================== */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item-title { font-weight: 600; color: var(--ink); font-size: 14px; line-height: 1.4; }
.list-item-sub { font-size: var(--fs-xs); color: var(--ink-3); }
a.list-item, button.list-item { width: 100%; text-align: left; border-radius: 12px; padding-left: 10px; padding-right: 10px; transition: background var(--dur-1); }
a.list-item:hover, button.list-item:hover { background: var(--hover); }

.bullets { display: flex; flex-direction: column; gap: 8px; list-style: none; }
.bullets li { position: relative; padding-left: 18px; color: var(--ink-2); line-height: 1.5; font-size: 14px; }
.bullets li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--t, var(--brand)); opacity: .8; }

.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 10px 18px; font-size: 14px; }
.kv dt { color: var(--ink-3); font-weight: 500; }
.kv dd { color: var(--ink); font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 559px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

.callout {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--t-soft, var(--fill-1)); box-shadow: inset 0 0 0 1px var(--t-line, var(--line));
  color: var(--ink-2); font-size: 14px; line-height: 1.5;
}
.callout > .ic { color: var(--t-ink, var(--ink-3)); margin-top: 1px; }
.callout-title { font-weight: 700; color: var(--ink); margin-bottom: 2px; }

.progress { position: relative; height: 8px; border-radius: 6px; background: var(--chart-track); overflow: hidden; }
.progress > i { position: absolute; inset: 0 auto 0 0; width: var(--v, 0%); border-radius: inherit; background: var(--t, var(--brand)); transition: width 700ms var(--ease-out); }
.progress.is-lg { height: 12px; }

.timeline { position: relative; display: flex; flex-direction: column; gap: 18px; padding-left: 26px; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--line-2); }
.timeline > li { position: relative; }
.timeline > li::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg-2); box-shadow: inset 0 0 0 2.5px var(--t, var(--neutral)); }
.timeline > li.is-done::before { background: var(--t, var(--ok)); box-shadow: inset 0 0 0 2.5px var(--t, var(--ok)), 0 0 0 3px var(--ok-soft); }
.timeline > li.is-current::before { box-shadow: inset 0 0 0 2.5px var(--brand), 0 0 0 4px var(--brand-soft); }

/* ======================================================================
   Bo'sh holat, skeleton, loader
   ====================================================================== */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 44px 20px; }
.empty-art { position: relative; width: 84px; height: 84px; margin-bottom: 6px; color: var(--brand); }
.empty-art .icon-tile { position: absolute; right: -6px; bottom: -6px; }
.empty-title { font-size: var(--fs-lg); font-weight: 700; color: var(--ink); letter-spacing: var(--tracking-tight); }
.empty-text { max-width: 44ch; font-size: 14px; color: var(--ink-3); line-height: 1.55; }
.empty .btn { margin-top: 8px; }

.skel {
  position: relative; overflow: hidden; border-radius: 10px;
  background: var(--fill-2);
}
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.4s var(--ease-in-out) infinite;
}
html[data-theme="dark"] .skel::after { background: linear-gradient(100deg, transparent 20%, rgba(255, 220, 230, .07) 50%, transparent 80%); }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .skel::after { background: linear-gradient(100deg, transparent 20%, rgba(255, 220, 230, .07) 50%, transparent 80%); } }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 12px; border-radius: 6px; }
.skel-title { height: 22px; width: 46%; border-radius: 8px; }
.skel-circle { border-radius: 50%; }
.skel-block { height: 120px; border-radius: 16px; }

/* O3 loader — logotipdagi uchta nuqta diagonal bo'ylab "oqadi" */
.o3-loader { --o3: 22px; position: relative; display: inline-block; width: var(--o3); height: var(--o3); color: var(--brand); flex: none; }
.o3-loader i { position: absolute; display: block; border-radius: 50%; background: currentColor; animation: o3-flow 1.15s var(--ease-in-out) infinite; }
.o3-loader i:nth-child(1) { width: 26%; height: 26%; left: 4%; top: 4%; }
.o3-loader i:nth-child(2) { width: 34%; height: 34%; left: 30%; top: 30%; animation-delay: .14s; }
.o3-loader i:nth-child(3) { width: 32%; height: 32%; left: 64%; top: 64%; animation-delay: .28s; }
.o3-loader--sm { --o3: 16px; } .o3-loader--lg { --o3: 44px; } .o3-loader--xl { --o3: 72px; }
@keyframes o3-flow {
  0%, 100% { transform: translate(0, 0) scale(.72); opacity: .35; }
  40% { transform: translate(18%, 18%) scale(1.08); opacity: 1; }
  70% { transform: translate(6%, 6%) scale(.9); opacity: .7; }
}
@media (prefers-reduced-motion: reduce) { .o3-loader i { animation: o3-breathe 1.6s ease-in-out infinite !important; animation-duration: 1.6s !important; animation-iteration-count: infinite !important; } }
@keyframes o3-breathe { 50% { opacity: .45; } }

/* ======================================================================
   Grafiklar
   ====================================================================== */
.chart { position: relative; width: 100%; min-width: 0; color: var(--ink-3); }
.chart svg { overflow: visible; }
.chart-plot { position: relative; }
.chart-plot > svg { width: 100%; height: 100%; }
.chart-grid line { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-ylabels { position: absolute; left: 0; top: 0; bottom: 0; width: 44px; pointer-events: none; }
.chart-ylabels span, .chart-xlabels span { position: absolute; font-size: 11px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-ylabels span { right: 8px; transform: translateY(-50%); }
.chart-xlabels { position: relative; height: 22px; margin-top: 6px; }
.chart-xlabels span { top: 0; transform: translateX(-50%); }
.chart-xlabels span.is-first { transform: none; } .chart-xlabels span.is-last { transform: translateX(-100%); }
.chart-hits { position: absolute; inset: 0; display: flex; }
.chart-hit { flex: 1; position: relative; outline: none; }
.chart-hit::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line-strong); opacity: 0; transition: opacity var(--dur-1); }
.chart-hit:hover::before, .chart-hit:focus-visible::before { opacity: 1; }
.chart-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--c, var(--brand)); box-shadow: 0 0 0 2px var(--chart-surface), 0 2px 6px rgba(0, 0, 0, .2); pointer-events: none; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: var(--fs-xs); color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

.spark { display: block; overflow: visible; }

.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.hbar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { position: relative; height: 12px; border-radius: 0 4px 4px 0; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--v); min-width: 2px; border-radius: 0 4px 4px 0; background: var(--c, var(--brand)); transition: width 700ms var(--ease-out); }
.hbar-value { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

.vbars { display: flex; align-items: flex-end; gap: 2px; height: var(--h, 160px); padding-top: 18px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; outline: none; }
.vbar-col { width: min(24px, 70%); height: var(--v); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--c, var(--brand)); transition: height 700ms var(--ease-out), filter var(--dur-1); }
.vbar:hover .vbar-col, .vbar:focus-visible .vbar-col { filter: brightness(1.12); }
.vbar-labels { display: flex; gap: 2px; margin-top: 6px; }
.vbar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbars-base { height: 1px; background: var(--line-2); }

.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-center { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1; }
.ring-value { font-weight: 800; letter-spacing: -0.04em; color: var(--ink); }
.ring-label { margin-top: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3); }
.ring-track { fill: none; stroke: var(--chart-track); }
.ring-arc { fill: none; stroke-linecap: round; animation: ring-draw 1.2s var(--ease-out) both; }
@keyframes ring-draw { from { stroke-dashoffset: var(--len); } }

.bullet { display: flex; flex-direction: column; gap: 6px; }
.bullet-head { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); }
.bullet-label { color: var(--ink-2); font-weight: 550; }
.bullet-value { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.bullet-track { position: relative; height: 10px; border-radius: 0 4px 4px 0; background: var(--chart-track); }
.bullet-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--v); border-radius: 0 4px 4px 0; background: var(--c, var(--brand)); transition: width 700ms var(--ease-out); }
.bullet-target { position: absolute; top: -4px; bottom: -4px; left: var(--tg); width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--chart-surface); }
.bullet-foot { display: flex; justify-content: space-between; font-size: var(--fs-2xs); color: var(--ink-3); }

.donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); min-width: 0; }
.donut-legend li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; list-style: none; color: var(--ink-2); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.donut-legend b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; }
.donut-seg { fill: none; transition: stroke-width var(--dur-2) var(--ease-spring); }
.donut-seg:hover { stroke-width: var(--sw-hover); }

/* ======================================================================
   Agent javobi (HOLAT / FAKT / SABAB / TA'SIR / TAVSIYA / OWNER / MUDDAT / MANBA / CONFIDENCE)
   ====================================================================== */
.answer { display: flex; flex-direction: column; gap: 0; border-radius: var(--r-md); overflow: hidden; }
.answer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--fill-1); border-bottom: 1px solid var(--line); }
.answer-row { display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.answer-row:last-child { border-bottom: 0; }
.answer-key { font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); padding-top: 3px; }
.answer-val { min-width: 0; color: var(--ink); }
.answer-steps { display: flex; flex-direction: column; gap: 8px; list-style: none; counter-reset: step; }
.answer-steps li { position: relative; padding-left: 30px; counter-increment: step; }
.answer-steps li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--brand-ink); background: var(--brand-soft); }
.answer-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.answer-meta .answer-row { grid-template-columns: 1fr; gap: 3px; }
.answer-meta .answer-row:nth-child(odd) { border-right: 1px solid var(--line); }
@media (max-width: 559px) { .answer-row { grid-template-columns: 1fr; gap: 4px; } .answer-meta { grid-template-columns: 1fr; } .answer-meta .answer-row:nth-child(odd) { border-right: 0; } }

/* ======================================================================
   Agent drawer
   ====================================================================== */
.agent-hero { position: relative; display: flex; align-items: center; gap: 16px; padding: 4px 0 18px; }
.agent-hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.agent-hero-name { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: var(--tracking-title); line-height: 1.1; }
.agent-hero-title { font-size: 14px; color: var(--ink-2); }
.agent-hero-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ov-drawer .ov-panel.has-wash::before { display: none; }
.agent-wash { position: absolute; inset: 0 0 auto 0; height: 220px; z-index: -1; pointer-events: none; background: radial-gradient(90% 100% at 10% 0%, color-mix(in srgb, var(--av-c, var(--brand)) 22%, transparent), transparent 70%); }
.drawer-section { padding: 18px 0; border-top: 1px solid var(--line); }
.drawer-section:first-of-type { border-top: 0; }
.drawer-section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: var(--fs-2xs); font-weight: 800; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3); }
.drawer-section-title .ic { color: var(--brand-ink); }
.mission { position: relative; padding: 14px 16px 14px 18px; border-radius: var(--r-md); font-size: var(--fs-md); line-height: 1.55; font-weight: 550; color: var(--ink); background: var(--brand-softer); box-shadow: inset 3px 0 0 var(--brand); }
.passport { display: flex; flex-direction: column; border-radius: var(--r-md); overflow: hidden; }
.passport-row { display: grid; grid-template-columns: 128px 1fr auto; align-items: center; gap: 12px; padding: 10px 6px 10px 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.passport-row:last-child { border-bottom: 0; }
.passport-key { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.passport-val { min-width: 0; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; line-height: 1.45; }
.passport-val.mono { font-size: 13px; }
@media (max-width: 559px) { .passport-row { grid-template-columns: 1fr auto; } .passport-key { grid-column: 1 / -1; } }
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 559px) { .io-grid { grid-template-columns: 1fr; } }
.io-box { padding: 14px 16px; }
.io-box .eyebrow { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-tag { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); background: var(--fill-2); box-shadow: inset 0 0 0 1px var(--line); }
.cmd-list { display: flex; flex-direction: column; }
.cmd-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cmd-row:last-child { border-bottom: 0; }
.cmd-row code { flex: none; min-width: 96px; font-size: 13px; font-weight: 600; color: var(--brand-ink); }
.cmd-row span { color: var(--ink-2); }
.copy-btn { color: var(--ink-3); }
.copy-btn.is-done { color: var(--ok-ink); }

/* ======================================================================
   Buyruqlar palitrasi (⌘K)
   ====================================================================== */
dialog.ov-palette[open] { display: flex; justify-content: center; align-items: flex-start; padding: max(10vh, 24px) 16px 16px; }
.ov-palette .ov-body { padding: 0; }
.ov-palette .ov-foot { padding: 0; border-top: 0; }
.ov-palette .ov-panel { width: min(680px, 100%); max-height: min(72dvh, 640px); --g-radius: 26px; animation: modal-in 340ms var(--ease-spring) both; }
.ov-palette.is-closing .ov-panel { animation: modal-out 160ms var(--ease-in-out) both; }
.pal-input-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 20px; border-bottom: 1px solid var(--line); flex: none; }
.pal-input-row > .ic { color: var(--brand-ink); }
.pal-input { flex: 1; min-width: 0; height: 58px; border: 0; background: transparent; outline: none; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.pal-input::placeholder { color: var(--ink-3); }
.pal-results { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; scroll-padding: 8px; }
.pal-group { padding: 10px 12px 6px; font-size: var(--fs-2xs); font-weight: 800; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3); }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 7px 12px; border-radius: 14px; text-align: left; color: var(--ink); }
.pal-item[aria-selected="true"] { background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); }
.pal-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pal-item-label { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item-sub { font-size: var(--fs-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item mark { background: none; color: var(--brand-ink); font-weight: 750; }
.pal-item .pal-enter { opacity: 0; color: var(--brand-ink); transition: opacity var(--dur-1); }
.pal-item[aria-selected="true"] .pal-enter { opacity: 1; }
.pal-foot { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); flex: none; }
.pal-foot span { display: inline-flex; align-items: center; gap: 6px; }
.pal-empty { padding: 36px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }
@media (max-width: 559px) { .pal-foot { display: none; } dialog.ov-palette[open] { padding-top: calc(10px + var(--safe-top)); } }

/* ======================================================================
   Login
   ====================================================================== */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: 1fr auto; justify-items: center;
  padding: calc(24px + var(--safe-top)) 16px calc(20px + var(--safe-bottom));
}
.login-center { display: grid; place-items: center; width: 100%; }
.login-card {
  width: min(432px, 100%);
  --g-radius: 34px;
  padding: 40px 34px 30px;
  display: flex; flex-direction: column; gap: 22px;
  animation: login-in 760ms var(--ease-spring-soft) both;
}
@keyframes login-in { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.login-logo { width: 92px; height: auto; color: var(--brand); filter: drop-shadow(0 10px 22px var(--brand-glow)); }
html[data-theme="dark"] .login-logo { color: #fff; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .login-logo { color: #fff; } }
.login-title { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.login-sub { font-size: 15px; color: var(--ink-3); margin-top: 6px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-foot { text-align: center; font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.5; max-width: 420px; animation: rise-in 900ms 200ms var(--ease-out) both; }
.login-foot b { color: var(--brand-ink); font-weight: 700; }
.login-secure { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--fs-xs); color: var(--ink-3); }
.login-card .segmented { align-self: center; }
@media (max-width: 479px) { .login-card { padding: 30px 22px 24px; --g-radius: 28px; } .login-title { font-size: 26px; } }

/* ======================================================================
   Brend belgilari
   ====================================================================== */
.brand-mark, .brand-wordmark, .brand-logo { display: block; }

/* ======================================================================
   Yordamchi: DEMO banner, xatolik sahifasi
   ====================================================================== */
.demo-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--ink-2); background: repeating-linear-gradient(135deg, var(--brand-softer) 0 10px, transparent 10px 20px); box-shadow: inset 0 0 0 1px var(--brand-line); }
.demo-banner .ic { color: var(--brand-ink); }
.fatal { min-height: 70vh; display: grid; place-items: center; padding: 24px; }
.fatal .glass { max-width: 460px; }

/* Swatch (style guide) */
.swatch { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.swatch-chip { height: 64px; border-radius: 16px; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), inset 0 1px 0 rgba(255, 255, 255, .3); }
.swatch-name { font-size: var(--fs-sm); font-weight: 650; }
.swatch-val { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-mono); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.icon-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 10px; border-radius: 14px; color: var(--ink-2); font-size: 11px; text-align: center; }
.icon-cell:hover { background: var(--hover); color: var(--ink); }
.icon-cell span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }

/* ======================================================================
   Topbar: foydalanuvchi tugmasi
   ====================================================================== */
.user-btn {
  display: inline-flex; align-items: center; gap: 9px;
  height: 42px; padding: 3px 10px 3px 3px; border-radius: var(--r-pill);
  color: var(--ink); text-align: left;
  transition: background var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-spring);
}
@media (hover: hover) { .user-btn:hover { background: var(--hover); } }
.user-btn:active { transform: scale(.97); }
.user-btn[aria-expanded="true"] { background: var(--press); }
.user-btn-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.user-btn-name { font-size: 13px; font-weight: 650; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn-role { font-size: 11px; color: var(--ink-3); }
@media (max-width: 899px) { .user-btn { padding: 3px; height: 40px; } }

/* ======================================================================
   Teginish maydoni (pointer: coarse) — kichik boshqaruvlar vizual o'lchamini
   saqlagan holda ≥ 40×40px bosiladigan maydon oladi. :where() → 0 spetsifiklik,
   sahifa o'z inset qoidasini bersa, o'shasi ustun. Glass elementlar chetlab
   o'tiladi (ularning ::after'i — yaltirash uchun band).
   ====================================================================== */
@media (pointer: coarse) {
  :where(.chip, .seg-btn, .btn-sm, .btn-link, .icon-btn-sm, a.dept-chip, a.branch-chip, a.badge, .crumbs a):where(:not(.glass, .glass-thin, .glass-thick, .glass-tint)) { position: relative; }
  :where(.chip, .seg-btn, .btn-sm, .btn-link, .icon-btn-sm, a.dept-chip, a.branch-chip, a.badge, .crumbs a):where(:not(.glass, .glass-thin, .glass-thick, .glass-tint))::after {
    content: ""; position: absolute;
    top: min(0px, calc((100% - 40px) / 2)); bottom: min(0px, calc((100% - 40px) / 2));
    left: min(0px, calc((100% - 40px) / 2)); right: min(0px, calc((100% - 40px) / 2));
    border-radius: inherit;
  }
}
