/* ==========================================================================
   Blok Test: dizayn tizimi (app.css)
   --------------------------------------------------------------------------
   Qatlamlar (cascade layers): reset < tokens < base < components < layout < utilities.
   (layout = qobiq va kontekst qoidalari hamda moslashuvchanlik: komponentlardan ustun turadi.)
   Sahifa CSS fayllari (static/css/pages/<bo'lim>.css) qatlamsiz yoziladi va shuning uchun
   har doim shu fayldagi qoidalardan ustun turadi: !important kerak emas.
   Hujjat: static/DESIGN.md.  Bu faylni faqat dizayn tizimi muallifi tahrirlaydi.
   ========================================================================== */
@layer reset, tokens, base, components, layout, utilities;

/* ==========================================================================
   1. RESET
   ========================================================================== */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { margin: 0; }
  [hidden] { display: none !important; }
  img, video, canvas { max-width: 100%; height: auto; }
  button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
  button { cursor: pointer; }
  table { border-collapse: collapse; }
  summary { cursor: pointer; }
  dialog { color: inherit; }
}

/* ==========================================================================
   2. TOKENLAR VA MAVZULAR
   ========================================================================== */
@layer tokens {
  :root {
    /* Shriftlar: Manrope (Google Fonts) bo'lmasa - tizim shriftlari */
    --font-sans: "Manrope", "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    --font-display: "Manrope", "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;

    /* Tipografiya shkalasi */
    --fs-2xs: .6875rem;   /* 11 */
    --fs-xs: .75rem;      /* 12 */
    --fs-sm: .8125rem;    /* 13 */
    --fs-md: .875rem;     /* 14 */
    --fs-base: .9375rem;  /* 15 */
    --fs-lg: 1.0625rem;   /* 17 */
    --fs-xl: 1.25rem;     /* 20 */
    --fs-2xl: clamp(1.5rem, 1.22rem + 1vw, 1.95rem);
    --fs-3xl: clamp(2.1rem, 1.35rem + 3vw, 3.6rem);
    --lh: 1.55;
    --lh-tight: 1.2;

    /* Oraliqlar (4px qadam) */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
    --sp-7: 32px; --sp-8: 40px; --sp-9: 48px; --sp-10: 64px;

    /* Radiuslar: ierarxiya bo'yicha */
    --r-xs: 6px; --r-sm: 10px; --r: 12px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;

    /* Joylashuv */
    --sidebar-w: 272px;
    --sidebar-mini-w: 80px;
    --appbar-h: 64px;
    --content-max: 1320px;
    --gutter: clamp(16px, 2.6vw, 32px);

    /* Harakat */
    --ease: cubic-bezier(.2, .8, .2, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --dur-fast: .12s; --dur: .2s; --dur-slow: .35s;

    /* Qatlam tartibi */
    --z-sticky: 20; --z-appbar: 30; --z-sidebar: 40; --z-overlay: 45; --z-drawer: 50;
    --z-dropdown: 60; --z-modal: 80; --z-toast: 90; --z-tooltip: 100; --z-progress: 110;

    /* Brend */
    --indigo: #4f46e5; --violet: #8b5cf6; --cyan: #06b6d4;
    --grad-brand: linear-gradient(135deg, #4f46e5 0%, #7c3aed 58%, #0891b2 118%);
    --grad-accent: linear-gradient(90deg, #6366f1 0%, #a855f7 55%, #22d3ee 100%);
    --grad-bubble: linear-gradient(140deg, #5b54ee 0%, #8b5cf6 70%, #a78bfa 100%);
    --grad-btn: linear-gradient(135deg, #5046e6 0%, #6d3fe9 60%, #7c3aed 100%);

    /* Belgilar (mask uchun) */
    --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
    --i-success: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
    --i-warning: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
    --i-error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E");
    --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    --i-sort: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
    --i-sort-asc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 14 5-5 5 5'/%3E%3C/svg%3E");
    --i-sort-desc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  }

  /* --- Yorug' mavzu (standart) --- */
  :root, [data-theme="light"] {
    color-scheme: light;
    --bg: #f4f5fa;
    --bg-tint-1: rgba(99, 102, 241, .10);
    --bg-tint-2: rgba(168, 85, 247, .08);
    --bg-tint-3: rgba(34, 211, 238, .08);
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --surface-3: #eff1f8;
    --surface-sunken: #eceef6;
    --surface-glass: rgba(246, 247, 252, .74);
    --glass-bg: rgba(255, 255, 255, .72);
    --glass-border: rgba(255, 255, 255, .85);
    --sidebar-bg: rgba(255, 255, 255, .82);
    --border: #e3e6f0;
    --border-strong: #cdd2e3;
    --text: #141833;
    --text-2: #343a5d;
    --muted: #5d6485;
    --faint: #656b8a;   /* matn uchun ham: oq va --surface-3 ustida >= 4.5:1 */
    --brand: #4f46e5;
    --brand-hover: #4338ca;
    --brand-text: #4338ca;
    --brand-soft: #eef0ff;
    --brand-soft-2: #e1e4ff;
    --on-brand: #ffffff;
    --ring: rgba(79, 70, 229, .72);   /* fokus halqasi: fon bilan >= 3:1 */
    --ring-soft: rgba(99, 102, 241, .16);
    --success: #047857; --success-bg: #e9f8f1; --success-border: #b6e6d1; --success-solid: #059669;
    --success-strong: #047857; --success-strong-hover: #065f46;   /* oq matnli to'q yashil fon (tugma, raqam) */
    --warning: #9a4a06; --warning-bg: #fff6e8; --warning-border: #f5d6a1; --warning-solid: #f59e0b;
    --danger: #be123c;  --danger-bg: #fff1f3;  --danger-border: #fbc8d2;  --danger-solid: #e11d48;
    --info: #3730a3;    --info-bg: #eef1ff;    --info-border: #d0d6ff;    --info-solid: #6366f1;
    --row-hover: #f7f8fd;
    --bubble-border: #c9cee2;
    --bubble-ring: rgba(79, 70, 229, .11);
    --overlay: rgba(16, 19, 44, .42);
    --tooltip-bg: #141833; --tooltip-fg: #ffffff;
    --grid-line: #e8eaf3;
    --chart-1: #6366f1; --chart-2: #a855f7; --chart-3: #06b6d4; --chart-4: #10b981; --chart-5: #f59e0b; --chart-6: #f43f5e;
    --shadow-xs: 0 1px 2px rgba(22, 26, 64, .06);
    --shadow-sm: 0 1px 2px rgba(22, 26, 64, .05), 0 3px 10px -4px rgba(22, 26, 64, .08);
    --shadow-md: 0 1px 2px rgba(22, 26, 64, .04), 0 12px 32px -14px rgba(40, 44, 120, .22);
    --shadow-lg: 0 28px 64px -24px rgba(30, 32, 100, .38), 0 4px 14px rgba(22, 26, 64, .08);
    --shadow-brand: 0 6px 18px -6px rgba(79, 70, 229, .55);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6485' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }

  /* --- Qorong'i mavzu --- */
  [data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0d1a;
    --bg-tint-1: rgba(99, 102, 241, .18);
    --bg-tint-2: rgba(168, 85, 247, .12);
    --bg-tint-3: rgba(34, 211, 238, .08);
    --surface: #11152a;
    --surface-2: #151a31;
    --surface-3: #1c2242;
    --surface-sunken: #0d1124;
    --surface-glass: rgba(12, 15, 30, .72);
    --glass-bg: rgba(17, 21, 42, .66);
    --glass-border: rgba(255, 255, 255, .09);
    --sidebar-bg: rgba(14, 17, 34, .86);
    --border: #242b4b;
    --border-strong: #333b63;
    --text: #e9ebf8;
    --text-2: #c3c8e6;
    --muted: #9aa1c6;
    --faint: #838aae;
    --brand: #6d6af7;
    --brand-hover: #7f7cf9;
    --brand-text: #a7b1ff;
    --brand-soft: rgba(99, 102, 241, .16);
    --brand-soft-2: rgba(99, 102, 241, .28);
    --on-brand: #ffffff;
    --ring: rgba(129, 140, 248, .72);
    --ring-soft: rgba(129, 140, 248, .22);
    --success: #4ade9f; --success-bg: rgba(16, 185, 129, .12); --success-border: rgba(52, 211, 153, .3); --success-solid: #059669;
    --success-strong: #047857; --success-strong-hover: #065f46;
    --warning: #fcc15a; --warning-bg: rgba(245, 158, 11, .12); --warning-border: rgba(251, 191, 36, .3); --warning-solid: #f59e0b;
    --danger: #fb8a9f;  --danger-bg: rgba(244, 63, 94, .13);  --danger-border: rgba(251, 113, 133, .34); --danger-solid: #e11d48;
    --info: #b3bcff;    --info-bg: rgba(99, 102, 241, .15);   --info-border: rgba(129, 140, 248, .34);  --info-solid: #6366f1;
    --row-hover: #161b35;
    --bubble-border: #3a4270;
    --bubble-ring: rgba(165, 180, 252, .10);
    --overlay: rgba(3, 5, 14, .66);
    --tooltip-bg: #e9ebf8; --tooltip-fg: #0f1226;
    --grid-line: #21284a;
    --chart-1: #818cf8; --chart-2: #c084fc; --chart-3: #22d3ee; --chart-4: #34d399; --chart-5: #fbbf24; --chart-6: #fb7185;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 12px -4px rgba(0, 0, 0, .45);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 36px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .8), 0 4px 14px rgba(0, 0, 0, .4);
    --shadow-brand: 0 8px 22px -8px rgba(99, 102, 241, .7);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa1c6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }

  /* JS o'chiq bo'lsa: tizim sozlamasiga amal qilamiz */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.js) {
      color-scheme: dark;
      --bg: #0a0d1a; --surface: #11152a; --surface-2: #151a31; --surface-3: #1c2242; --surface-sunken: #0d1124;
      --surface-glass: rgba(12, 15, 30, .72); --glass-bg: rgba(17, 21, 42, .66); --glass-border: rgba(255, 255, 255, .09);
      --sidebar-bg: rgba(14, 17, 34, .86); --border: #242b4b; --border-strong: #333b63;
      --text: #e9ebf8; --text-2: #c3c8e6; --muted: #9aa1c6; --faint: #838aae;
      --ring: rgba(129, 140, 248, .72); --ring-soft: rgba(129, 140, 248, .22);
      --brand: #6d6af7; --brand-text: #a7b1ff; --brand-soft: rgba(99, 102, 241, .16); --brand-soft-2: rgba(99, 102, 241, .28);
      --success: #4ade9f; --success-bg: rgba(16, 185, 129, .12); --success-border: rgba(52, 211, 153, .3);
      --warning: #fcc15a; --warning-bg: rgba(245, 158, 11, .12); --warning-border: rgba(251, 191, 36, .3);
      --danger: #fb8a9f; --danger-bg: rgba(244, 63, 94, .13); --danger-border: rgba(251, 113, 133, .34);
      --info: #b3bcff; --info-bg: rgba(99, 102, 241, .15); --info-border: rgba(129, 140, 248, .34);
      --row-hover: #161b35; --bubble-border: #3a4270; --grid-line: #21284a;
    }
  }
}

/* ==========================================================================
   3. ASOS (tipografiya, havolalar, fokus)
   ========================================================================== */
@layer base {
  html { scroll-padding-top: calc(var(--appbar-h) + 16px); }
  body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    font-weight: 500;
    line-height: var(--lh);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "tnum" 0;
    min-height: 100vh;
  }
  body.has-shell {
    background:
      radial-gradient(900px 380px at 78% -140px, var(--bg-tint-2), transparent 70%),
      radial-gradient(720px 320px at 22% -120px, var(--bg-tint-1), transparent 70%),
      radial-gradient(600px 300px at 100% 30%, var(--bg-tint-3), transparent 70%),
      var(--bg);
    background-attachment: fixed;
  }
  h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); line-height: var(--lh-tight); letter-spacing: -.02em; text-wrap: balance; }
  h1 { font-size: var(--fs-2xl); font-weight: 800; margin: 0 0 var(--sp-4); letter-spacing: -.028em; }
  h2 { font-size: 1.1875rem; font-weight: 750; margin: var(--sp-6) 0 var(--sp-3); }
  h3 { font-size: 1rem; font-weight: 700; margin: var(--sp-4) 0 var(--sp-2); letter-spacing: -.01em; }
  h4 { font-size: var(--fs-md); font-weight: 700; margin: var(--sp-3) 0 var(--sp-2); }
  p { margin: 0 0 var(--sp-3); }
  ol, ul { margin: 0 0 var(--sp-3); padding-left: 1.3em; }
  li + li { margin-top: 4px; }
  b, strong { font-weight: 700; }
  a { color: var(--brand-text); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
  a:hover { text-decoration: underline; }
  code, kbd, samp, pre, .mono { font-family: var(--font-mono); }
  code { font-size: .88em; padding: .12em .4em; border-radius: var(--r-xs); background: var(--surface-3); color: var(--text); }
  pre { font-size: var(--fs-sm); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); overflow: auto; }
  pre code { background: none; padding: 0; }
  kbd {
    display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
    font: 600 var(--fs-2xs)/1 var(--font-mono); color: var(--muted); background: var(--surface);
    border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px;
  }
  hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
  small { font-size: var(--fs-sm); }
  ::selection { background: rgba(99, 102, 241, .24); }
  :focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
  :focus:not(:focus-visible) { outline: none; }

  .icon { width: 1.25em; height: 1.25em; flex-shrink: 0; display: inline-block; vertical-align: -.25em; stroke-width: 1.85; }
  .icon-sprite { position: absolute; }

  /* Mavzu almashganda ranglar silliq o'zgaradi */
  .theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
    transition: background-color .3s ease, border-color .3s ease, color .3s ease, fill .3s ease, box-shadow .3s ease !important;
  }
  .skip-link {
    position: fixed; left: 12px; top: -60px; z-index: var(--z-progress); padding: 10px 16px; border-radius: var(--r);
    background: var(--text); color: var(--bg); font-weight: 700; transition: top var(--dur) var(--ease);
  }
  .skip-link:focus { top: 12px; text-decoration: none; }
}

/* ==========================================================================
   4. JOYLASHUV: ilova qobig'i (sidebar + appbar) va ochiq qobiq
   ========================================================================== */
@layer layout {
  /* --- Ilova qobig'i --- */
  .app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
  }
  .sidebar-mini .app { grid-template-columns: var(--sidebar-mini-w) minmax(0, 1fr); }
  .app-body { min-width: 0; display: flex; flex-direction: column; }

  .sidebar {
    position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: var(--z-sidebar);
    display: flex; flex-direction: column; gap: var(--sp-4);
    padding: 18px 14px 14px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin;
  }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px; min-height: 40px; }
  .brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none !important; min-width: 0; }
  .brand-mark { flex-shrink: 0; border-radius: 10px; box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7); }
  .wordmark { display: flex; flex-direction: column; font-family: var(--font-display); font-weight: 800; font-size: 1.125rem; letter-spacing: -.03em; line-height: 1.1; white-space: nowrap; }
  .wordmark small { font-size: var(--fs-2xs); font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
  .drawer-close { display: none; }

  .sidebar-center {
    display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border);
  }
  .sidebar-center-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .sidebar-center-meta strong { font-size: var(--fs-md); font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-center-meta span { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }

  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav-link {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 42px; padding: 9px 12px; border-radius: var(--r);
    color: var(--text-2); font-weight: 600; font-size: var(--fs-md); line-height: 1.25;
    text-decoration: none !important; border: 0; background: none; text-align: left;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  }
  .nav-link .icon { width: 20px; height: 20px; color: var(--muted); transition: color var(--dur-fast), transform var(--dur) var(--ease-spring); }
  .nav-link:hover { background: var(--surface-3); color: var(--text); }
  .nav-link:hover .icon { color: var(--text); }
  .nav-link.is-active { background: linear-gradient(90deg, var(--brand-soft-2), var(--brand-soft) 70%); color: var(--brand-text); font-weight: 700; }
  .nav-link.is-active .icon { color: var(--brand-text); }
  .nav-link.is-active::before {
    content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0;
    background: var(--grad-accent);
  }
  .nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-sep { height: 1px; background: var(--border); margin: 8px 10px; }
  .sidebar-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
  .sidebar-collapse { color: var(--muted); font-size: var(--fs-sm); }
  .sidebar-collapse .icon { transition: transform var(--dur-slow) var(--ease); }

  /* Yig'ilgan (mini) rejim - faqat keng ekranlarda */
  @media (min-width: 961px) {
    .sidebar-mini .sidebar { padding-inline: 12px; align-items: stretch; overflow: visible; }
    /* Faqat menyu ichida: <html class="sidebar-mini"> ochiq sahifalarda ham bor (logotip matni yo'qolmasin) */
    .sidebar-mini .sidebar .wordmark, .sidebar-mini .nav-text, .sidebar-mini .sidebar-center-meta { display: none; }
    .sidebar-mini .sidebar-head { justify-content: center; padding: 0; }
    .sidebar-mini .sidebar-center { justify-content: center; padding: 8px 0; background: none; border-color: transparent; }
    .sidebar-mini .nav-link { justify-content: center; padding: 10px; }
    .sidebar-mini .nav-link.is-active::before { left: -12px; }
    .sidebar-mini .sidebar-collapse .icon { transform: rotate(180deg); }
    html:not(.sidebar-mini) .sidebar [data-tooltip]::after { content: none; }
  }

  /* --- Yuqori panel (appbar) --- */
  .appbar {
    position: sticky; top: 0; z-index: var(--z-appbar);
    display: flex; align-items: center; gap: 12px;
    height: var(--appbar-h); padding: 0 var(--gutter);
    background: var(--surface-glass);
    backdrop-filter: blur(16px) saturate(170%);
    -webkit-backdrop-filter: blur(16px) saturate(170%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 30px -22px rgba(20, 24, 70, .45);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }
  /* JS bor bo'lsa: sahifa tepasida shaffof, pastga aylantirilganda "shisha" */
  .js .appbar:not(.is-scrolled) { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom-color: transparent; box-shadow: none; }
  .appbar-menu { display: none; }
  .appbar-context { position: relative; flex: 1; min-width: 0; height: 40px; }
  .appbar-crumbs, .appbar-title {
    position: absolute; inset: 0; display: flex; align-items: center; gap: 8px; min-width: 0;
    transition: opacity var(--dur) var(--ease), transform var(--dur-slow) var(--ease);
  }
  .appbar-crumbs { font-size: var(--fs-md); font-weight: 650; color: var(--muted); white-space: nowrap; overflow: hidden; }
  .appbar-crumbs a { color: var(--muted); }
  .appbar-crumbs a:hover { color: var(--text); text-decoration: none; }
  .appbar-crumbs > span:last-child, .appbar-crumbs > a:last-child:not(.crumb-home) { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
  .crumb-home { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; }
  .crumb-home:hover { background: var(--surface-3); }
  .crumb-home .icon { width: 19px; height: 19px; }
  .crumb-sep { color: var(--faint); }
  .appbar-title {
    opacity: 0; transform: translateY(12px); pointer-events: none;
    font-family: var(--font-display); font-weight: 800; font-size: 1.0625rem; letter-spacing: -.02em; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 40px;
  }
  .appbar.show-title .appbar-crumbs { opacity: 0; transform: translateY(-12px); pointer-events: none; }
  .appbar.show-title .appbar-title { opacity: 1; transform: none; }
  .appbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

  .appbar-search {
    display: inline-flex; align-items: center; gap: 10px; height: 40px; min-width: 250px; padding: 0 8px 0 12px;
    border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
    color: var(--muted); font-size: var(--fs-md); font-weight: 550; box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast), color var(--dur-fast);
  }
  .appbar-search:hover { border-color: var(--border-strong); color: var(--text-2); box-shadow: var(--shadow-sm); }
  .appbar-search .icon { width: 18px; height: 18px; }
  .appbar-search-text { flex: 1; text-align: left; }
  .theme-toggle { color: var(--text-2); }
  [data-theme="dark"] .theme-icon-light, [data-theme="light"] .theme-icon-dark { display: none; }

  .user-chip {
    display: flex; align-items: center; gap: 9px; list-style: none; padding: 4px 10px 4px 4px; border-radius: var(--r-pill);
    border: 1px solid transparent; transition: background var(--dur-fast), border-color var(--dur-fast); min-height: 42px;
  }
  .user-chip::-webkit-details-marker { display: none; }
  .user-chip:hover, .dropdown[open] > .user-chip { background: var(--surface); border-color: var(--border); }
  .user-chip-text { display: flex; flex-direction: column; line-height: 1.2; max-width: 160px; }
  .user-chip-text strong { font-size: var(--fs-sm); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-chip-text small { font-size: var(--fs-2xs); color: var(--muted); font-weight: 600; }
  .user-chip-caret { width: 16px; height: 16px; color: var(--muted); transition: transform var(--dur) var(--ease); }
  .dropdown[open] > .user-chip .user-chip-caret { transform: rotate(180deg); }

  /* --- Asosiy maydon --- */
  .app-main {
    width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter)); margin: 0 auto;
    padding: 12px var(--gutter) 64px; outline: none; flex: 1; min-width: 0;
    overflow-x: clip;   /* xavfsizlik: sahifa hech qachon gorizontal aylanmasin (keng jadval - .table-wrap ichida) */
  }
  .card, .stat { min-width: 0; }
  .app-overlay { display: none; }

  /* --- Sahifa sarlavhasi --- */
  .page-header, .topbar {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 14px 24px; margin: 6px 0 24px;
  }
  .topbar { align-items: center; margin: 0 0 20px; }
  .page-header h1, .topbar h1, .topbar h2 { margin: 0; }
  .page-heading { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
  .page-heading > div { min-width: 0; }
  .page-icon {
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
    background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand);
  }
  .page-icon .icon { width: 24px; height: 24px; }
  .page-subtitle { color: var(--muted); margin: 6px 0 0; max-width: 72ch; font-size: var(--fs-base); }
  .page-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: var(--fs-md); margin-top: 8px; }
  .page-meta > * { display: inline-flex; align-items: center; gap: 6px; }
  .page-meta .icon { width: 16px; height: 16px; }
  .page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .card .topbar { margin-bottom: 14px; gap: 10px 16px; }
  .card .topbar h2 { font-size: 1.0625rem; }

  .breadcrumbs {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    font-size: var(--fs-sm); color: var(--faint); font-weight: 600; margin: 0 0 8px;
  }
  .breadcrumbs a { color: var(--muted); }
  .breadcrumbs a:hover { color: var(--brand-text); }
  .breadcrumbs .sep, .breadcrumbs .crumb-sep { color: var(--faint); }

  /* --- Qatlamli ro'yxat primitivlari --- */
  .section { margin-block: var(--sp-7); }
  .section:first-child { margin-top: 0; }
  .section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 var(--sp-3); }
  .section-title h2 { margin: 0; font-size: var(--fs-lg); }
  .stack { display: flex; flex-direction: column; gap: var(--stack-gap, 16px); }
  .stack-sm { --stack-gap: 8px; }
  .stack-lg { --stack-gap: 24px; }
  .cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, 8px); }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 20px; align-items: start; }
  .split-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky-aside { position: sticky; top: calc(var(--appbar-h) + 16px); }

  .grid { display: grid; gap: 16px; margin-bottom: 18px; }
  .grid:last-child { margin-bottom: 0; }
  .grid > .form-row { margin-bottom: 2px; }
  /* N ustun, ammo har biri --min dan torayganda kamroq ustun (sahifa torayganda o'z-o'zidan) */
  .grid-2, .grid-3, .grid-4, .grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(max(var(--min), calc((100% - (var(--cols) - 1) * 16px) / var(--cols))), 1fr));
  }
  .grid-2 { --cols: 2; --min: 360px; }
  .auth-card .grid-2, .form-grid .grid-2 { --min: 240px; }
  .grid-3 { --cols: 3; --min: 240px; }
  .grid-4 { --cols: 4; --min: 150px; }
  .grid-auto { --cols: 12; --min: 240px; }
  /* Forma maydonlari: ko'pi bilan --fg-cols (2) ustun, har biri >= --fg-min. auto-fit: bo'sh ustun qolmaydi,
     2 ta maydon kartaning butun kengligini egallaydi (auto-fill 1024 da 3-ustunni bo'sh qoldirardi). */
  .form-grid {
    --fg-cols: 2; --fg-min: 240px; display: grid; gap: 0 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, max(var(--fg-min), calc((100% - (var(--fg-cols) - 1) * 16px) / var(--fg-cols)))), 1fr));
  }
  .form-grid .span-all { grid-column: 1 / -1; }

  /* --- Ochiq qobiq (landing / kirish) --- */
  .public { position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
  .public-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); pointer-events: none; }
  .public-bg::before {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(circle, transparent 0 5px, var(--bubble-ring) 5.6px 6.8px, transparent 7.4px);
    background-size: 28px 28px; background-position: 14px 14px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 10%, transparent 75%);
            mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 10%, transparent 75%);
  }
  .public-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, var(--bg) 100%); }
  .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform; }
  .blob-1 { width: 560px; height: 560px; left: -160px; top: -220px; background: #6366f1; animation: blob-drift 26s var(--ease) infinite alternate; }
  .blob-2 { width: 480px; height: 480px; right: -140px; top: -120px; background: #22d3ee; opacity: .42; animation: blob-drift 30s var(--ease) infinite alternate-reverse; }
  .blob-3 { width: 620px; height: 620px; right: 12%; top: 48%; background: #a855f7; opacity: .34; animation: blob-drift 34s var(--ease) infinite alternate; }
  [data-theme="dark"] .blob { opacity: .32; }
  [data-theme="dark"] .blob-2 { opacity: .22; }
  @keyframes blob-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(60px, 40px, 0) scale(1.08); } }

  .public-nav {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; max-width: 1200px; margin: 0 auto; padding: 18px clamp(16px, 4vw, 40px);
  }
  .public-nav .wordmark { font-size: 1.1875rem; }
  /* Ochiq sahifalarda shior rangli "blob" fonida turadi: --muted yetmaydi (2.6:1), --text-2 >= 4.5:1 */
  .public-nav .wordmark small { color: var(--text-2); }
  .public-links { display: flex; align-items: center; gap: 6px; }
  .public-main { flex: 1; width: 100%; outline: none; }
  .public-main > .flash-messages { max-width: 520px; margin: 0 auto; padding: 0 16px; }
  .public-footer { text-align: center; color: var(--muted); font-size: var(--fs-sm); padding: 24px 16px 32px; }

  .public .card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    box-shadow: var(--shadow-lg);
  }
  .auth-wrap { min-height: calc(100vh - 170px); min-height: calc(100dvh - 170px); display: grid; place-items: center; padding: 12px 16px 40px; }
  .auth-card { position: relative; width: 100%; max-width: 460px; padding: clamp(24px, 4vw, 40px); border-radius: var(--r-xl); }
  .auth-card.wide { max-width: 760px; }
  .auth-card::before {
    content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
    background: linear-gradient(140deg, rgba(99, 102, 241, .7), rgba(168, 85, 247, .15) 40%, rgba(34, 211, 238, .55));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
  }
  .auth-card h1 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); margin-bottom: 10px; }
  .auth-card h3 { font-size: var(--fs-md); color: var(--muted); font-weight: 700; margin: 22px 0 12px; }
  .auth-card .btn-row { margin-top: 8px; }
  .auth-card .btn-primary { min-width: 140px; }

  .hero { text-align: center; padding: clamp(32px, 7vw, 88px) 20px clamp(28px, 4vw, 48px); max-width: 920px; margin: 0 auto; }
  .hero h1 { font-size: var(--fs-3xl); line-height: 1.06; letter-spacing: -.04em; font-weight: 800; margin-bottom: 20px; }
  .hero p { color: var(--text-2); font-size: clamp(1rem, .95rem + .3vw, 1.1875rem); max-width: 640px; margin: 0 auto 28px; line-height: 1.6; }
  .hero .btn { --btn-h: 48px; padding: 0 22px; font-size: var(--fs-base); border-radius: var(--r-md); }
}

/* ==========================================================================
   5. KOMPONENTLAR
   ========================================================================== */
@layer components {
  /* --- Karta --- */
  .card {
    position: relative;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); padding: 20px 22px; margin-bottom: 18px;
  }
  .grid > .card, .grid > .stat, .stack > .card { margin-bottom: 0; }
  .card > h2:first-child, .card > h3:first-child, .card > .topbar:first-child h2 { margin-top: 0; }
  .card > h2:first-child { font-size: 1.0625rem; }
  .card > :last-child { margin-bottom: 0; }
  .card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: -2px 0 16px; }
  .card-header > :first-child { min-width: 0; }
  .card-title { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 750; letter-spacing: -.015em; margin: 0; display: flex; align-items: center; gap: 10px; }
  .card-title .icon { color: var(--brand-text); width: 20px; height: 20px; }
  .card-subtitle { color: var(--muted); font-size: var(--fs-md); margin: 2px 0 0; }
  .card:has(> .card-footer) { display: flex; flex-direction: column; }
  .card > :has(+ .card-footer) { margin-bottom: 16px; }
  .card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: auto -22px -20px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .card-flush { padding: 0; overflow: hidden; }
  .card-flush > .card-header { padding: 18px 22px 0; }
  .card-flush > .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
  .card-flush > .card-footer { margin: auto 0 0; }   /* paddingsiz kartada manfiy margin kerak emas */
  .card-glass { background: var(--glass-bg); border-color: var(--glass-border); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); }
  .card-interactive { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur); }
  .card-interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
  .card-accent { border-color: transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad-accent) border-box; border: 1.5px solid transparent; }
  .card-muted { background: var(--surface-2); box-shadow: none; }
  .card-link { position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
  .card-link:focus-visible { outline-offset: 3px; }

  /* Ketma-ket qadamlar kartasi (1, 2, 3 ...) */
  .step-card { display: flex; flex-direction: column; gap: 6px; }
  .step-num {
    display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    font: 800 var(--fs-sm)/1 var(--font-display); color: var(--brand-text); background: var(--brand-soft);
    border: 1.5px solid var(--brand-soft-2);
  }
  .step-card.is-done .step-num { background: var(--success-strong); border-color: transparent; color: #fff; }

  /* --- Statistika --- */
  .stat {
    position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 18px 20px; box-shadow: var(--shadow-sm);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }
  .stat::after {
    content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
    background: radial-gradient(circle, var(--stat-glow, var(--brand-soft-2)), transparent 70%); pointer-events: none; opacity: .9;
  }
  .stat .value {
    font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 1.3rem + 1vw, 2.15rem);
    letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text);
  }
  .stat .label { color: var(--muted); font-size: var(--fs-md); font-weight: 600; }
  .stat .label a { color: inherit; }
  .stat .label a::after { content: ""; position: absolute; inset: 0; }
  .stat-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
  .stat-icon {
    position: relative; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; margin-bottom: 12px;
    color: var(--stat-fg, var(--brand-text)); background: var(--stat-bg, var(--brand-soft));
  }
  .stat-icon .icon { width: 21px; height: 21px; }
  .stat-hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
  .stat-brand  { --stat-fg: var(--brand-text); --stat-bg: var(--brand-soft); --stat-glow: rgba(99, 102, 241, .16); }
  .stat-violet { --stat-fg: #7c3aed; --stat-bg: rgba(139, 92, 246, .12); --stat-glow: rgba(168, 85, 247, .16); }
  .stat-cyan   { --stat-fg: #0e7490; --stat-bg: rgba(6, 182, 212, .12); --stat-glow: rgba(34, 211, 238, .18); }
  .stat-success { --stat-fg: var(--success); --stat-bg: var(--success-bg); --stat-glow: rgba(16, 185, 129, .15); }
  .stat-warning { --stat-fg: var(--warning); --stat-bg: var(--warning-bg); --stat-glow: rgba(245, 158, 11, .16); }
  .stat-danger  { --stat-fg: var(--danger); --stat-bg: var(--danger-bg); --stat-glow: rgba(244, 63, 94, .15); }
  [data-theme="dark"] .stat-violet { --stat-fg: #c4b5fd; }
  [data-theme="dark"] .stat-cyan { --stat-fg: #67e8f9; }

  /* --- Tugmalar --- */
  .btn {
    --btn-h: 40px;
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--btn-h); padding: 0 16px; border-radius: var(--r);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font-family: var(--font-sans); font-weight: 650; font-size: var(--fs-md); line-height: 1.2; letter-spacing: -.005em;
    text-decoration: none !important; white-space: nowrap; cursor: pointer; user-select: none; vertical-align: middle;
    box-shadow: var(--shadow-xs);
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast),
                box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), filter var(--dur);
  }
  .btn:hover { background: var(--surface-2); border-color: var(--faint); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
  .btn:active { transform: translateY(0) scale(.98); box-shadow: var(--shadow-xs); }
  .btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
  .btn .icon { width: 18px; height: 18px; stroke-width: 2; }
  .btn-primary { background: var(--grad-btn); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .2); }
  .btn-primary:hover { background: var(--grad-btn); border-color: transparent; filter: brightness(1.08) saturate(1.05); box-shadow: 0 10px 26px -8px rgba(79, 70, 229, .7), inset 0 1px 0 rgba(255, 255, 255, .2); }
  .btn-danger { color: var(--danger); border-color: var(--danger-border); background: var(--surface); }
  .btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
  .btn-danger-solid { background: var(--danger-solid); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -6px rgba(225, 29, 72, .6); }
  .btn-danger-solid:hover { background: #be123c; border-color: transparent; }
  .btn-success { background: var(--success-strong); color: #fff; border-color: transparent; }
  .btn-success:hover { background: var(--success-strong-hover); border-color: transparent; }
  .btn-soft { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; box-shadow: none; }
  .btn-soft:hover { background: var(--brand-soft-2); border-color: transparent; }
  .btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
  .btn-ghost:hover { background: var(--surface-3); border-color: transparent; box-shadow: none; color: var(--text); transform: none; }
  .btn-link { background: none; border: 0; box-shadow: none; color: var(--brand-text); padding: 0; min-height: 0; }
  .btn-link:hover { background: none; text-decoration: underline !important; transform: none; box-shadow: none; }
  .btn-sm { --btn-h: 32px; padding: 0 11px; font-size: var(--fs-sm); border-radius: var(--r-sm); gap: 6px; }
  .btn-sm .icon { width: 16px; height: 16px; }
  .btn-lg { --btn-h: 48px; padding: 0 22px; font-size: var(--fs-base); border-radius: var(--r-md); }
  .btn-icon { width: var(--btn-h); padding: 0; flex-shrink: 0; }
  .btn-icon .icon { width: 20px; height: 20px; }
  .btn-sm.btn-icon .icon { width: 17px; height: 17px; }
  .btn-block { display: flex; width: 100%; }
  .btn[disabled], .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; box-shadow: none; transform: none; }
  /* Yuklanish holati: matn faqat ko'zdan yashiriladi (shaffof rang / opacity), ekran o'quvchi uchun nom saqlanadi.
     visibility/display ishlatilmaydi: ular tugma nomini accessibility daraxtidan olib tashlaydi. */
  .btn.is-loading { color: transparent !important; pointer-events: none; }
  .btn.is-loading > * { opacity: 0; }
  .btn.is-loading::before {
    content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border-radius: 50%; border: 2.2px solid var(--spinner, var(--text)); border-right-color: transparent;
    animation: spin .7s linear infinite;
  }
  .btn-primary.is-loading, .btn-danger-solid.is-loading, .btn-success.is-loading { --spinner: #fff; }
  .btn-danger.is-loading { --spinner: var(--danger); }
  .btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .btn-row > form { display: inline-flex; margin: 0; }
  .btn-group { display: inline-flex; }
  .btn-group > .btn { border-radius: 0; }
  .btn-group > .btn + .btn { margin-left: -1px; }
  .btn-group > .btn:first-child { border-radius: var(--r) 0 0 var(--r); }
  .btn-group > .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
  form.inline { display: inline; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; vertical-align: -.2em; }
  .spinner-lg { width: 32px; height: 32px; border-width: 3px; }

  /* --- Formalar --- */
  .form-row { margin-bottom: 18px; position: relative; }
  .form-row > label, .field-label {
    display: flex; align-items: baseline; gap: 3px; flex-wrap: wrap;
    font-weight: 650; font-size: var(--fs-md); color: var(--text); margin-bottom: 7px;
  }
  .req { color: var(--danger); font-weight: 700; }
  .form-row .help, .help { color: var(--muted); font-size: var(--fs-sm); margin-top: 7px; line-height: 1.45; }
  .form-row .errors, .errorlist, .field-hint.is-error {
    list-style: none; padding: 0; margin: 7px 0 0; color: var(--danger); font-size: var(--fs-sm); font-weight: 650;
  }
  .form-row .errors li, .errorlist li { display: flex; gap: 6px; align-items: flex-start; margin: 0; }
  .form-row .errors li::before, .errorlist li::before, .field-hint.is-error::before {
    content: ""; flex-shrink: 0; width: 15px; height: 15px; margin-top: 2px; background: currentColor;
    -webkit-mask: var(--i-error) center / contain no-repeat; mask: var(--i-error) center / contain no-repeat;
  }
  .field-hint { display: flex; gap: 6px; font-size: var(--fs-sm); margin-top: 7px; }
  .field-hint.is-ok { color: var(--success); font-weight: 600; }

  input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
  input[type=datetime-local], input[type=time], input[type=tel], input[type=url], input[type=search],
  input:not([type]), select, textarea, .input {
    display: block; width: 100%; min-height: 42px; padding: 9px 13px;
    border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); color: var(--text);
    font-size: var(--fs-base); line-height: 1.4; font-family: inherit;
    box-shadow: inset 0 1px 1px rgba(20, 24, 60, .03);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast);
  }
  input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--faint); }
  input:focus, select:focus, textarea:focus, .input:focus-within {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring-soft);
  }
  input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
  input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
  .is-invalid, [aria-invalid="true"], .has-error input:not([type=checkbox]):not([type=radio]), .has-error select, .has-error textarea { border-color: var(--danger) !important; }
  .is-invalid:focus, [aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(225, 29, 72, .15); }
  .is-valid { border-color: var(--success-solid) !important; }
  select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; cursor: pointer; }
  select[multiple], select[size]:not([size="1"]) { background-image: none; padding-right: 13px; }
  textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
  textarea.answers {
    font-family: var(--font-mono); font-size: var(--fs-md); letter-spacing: .12em; min-height: 84px; line-height: 1.8;
    word-break: break-all;
  }
  input[type=number] { font-variant-numeric: tabular-nums; }
  .input-lg { min-height: 50px; font-size: var(--fs-lg); border-radius: var(--r-md); }
  .input-sm { min-height: 34px; padding: 5px 10px; font-size: var(--fs-md); border-radius: var(--r-sm); }

  /* Belgilash katakchasi va radio */
  input[type=checkbox], input[type=radio] {
    appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 20px; height: 20px; margin: 0; display: inline-grid; place-items: center;
    border: 1.5px solid var(--bubble-border); background: var(--surface); border-radius: 6px; vertical-align: -.3em; cursor: pointer;
    transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
  }
  input[type=radio] { border-radius: 50%; }
  input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--brand); }
  input[type=checkbox]:checked { background: var(--grad-bubble); border-color: transparent; background-image: var(--i-check), var(--grad-bubble); background-size: 14px, cover; background-position: center; background-repeat: no-repeat; }
  input[type=radio]:checked { border-color: var(--brand); background: radial-gradient(circle, var(--brand) 0 4.5px, transparent 5px), var(--surface); }
  input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
  .form-row > label:has(> input[type=checkbox]), .form-row > label:has(> input[type=radio]), label.check {
    display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer;
  }

  /* Almashtirgich (switch): <label class="switch"><input type="checkbox"><span class="switch-track"></span><span>Matn</span></label> */
  .switch { display: inline-flex !important; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; position: relative; margin-bottom: 0 !important; }
  .switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
  .switch-track {
    position: relative; flex-shrink: 0; width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong);
    transition: background var(--dur) var(--ease);
  }
  .switch-track::after {
    content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
    box-shadow: 0 2px 6px rgba(15, 18, 40, .25); transition: transform var(--dur) var(--ease-spring);
  }
  .switch input:checked + .switch-track { background: var(--grad-bubble); }
  .switch input:checked + .switch-track::after { transform: translateX(18px); }
  .switch input:focus-visible + .switch-track { outline: 3px solid var(--ring); outline-offset: 2px; }
  .switch:not(:has(.switch-track)) input { position: static; opacity: 1; width: 20px; height: 20px; }
  .check-label { line-height: 1.35; }

  input[type=file] { font-size: var(--fs-md); color: var(--muted); max-width: 100%; }
  input[type=file]::file-selector-button {
    margin-right: 12px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: 650 var(--fs-sm) var(--font-sans); cursor: pointer;
  }

  /* Ichki belgi / tugmali maydon */
  .input-affix { position: relative; display: block; }
  .input-affix > input { padding-right: 46px; }
  .input-affix > .icon:first-child { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 18px; height: 18px; pointer-events: none; }
  .input-affix > .icon:first-child + input { padding-left: 40px; }
  .input-affix-btn {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 9px; border: 0; background: none; color: var(--muted);
  }
  .input-affix-btn:hover { background: var(--surface-3); color: var(--text); }
  .input-affix-btn .icon { width: 18px; height: 18px; }
  .input-group { display: flex; }
  .input-group > * { border-radius: 0 !important; }
  .input-group > :first-child { border-radius: var(--r) 0 0 var(--r) !important; }
  .input-group > :last-child { border-radius: 0 var(--r) var(--r) 0 !important; }
  .input-group > * + * { margin-left: -1px; }
  .input-group > .btn { min-height: 42px; box-shadow: none; }
  .input-group-text { display: flex; align-items: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--muted); font-size: var(--fs-md); white-space: nowrap; }

  /* Suzuvchi yorliq: <div class="form-row field-float"><input placeholder=" "><label>..</label></div> */
  .field-float { position: relative; }
  .field-float > input, .field-float > textarea { min-height: 54px; padding: 22px 13px 7px; }
  .field-float > label {
    position: absolute; left: 14px; top: 16px; margin: 0; font-weight: 550; color: var(--muted); pointer-events: none;
    transform-origin: left top; transition: transform var(--dur) var(--ease), color var(--dur);
  }
  .field-float > input:focus + label, .field-float > input:not(:placeholder-shown) + label,
  .field-float > textarea:focus + label, .field-float > textarea:not(:placeholder-shown) + label {
    transform: translateY(-9px) scale(.78); color: var(--brand-text); font-weight: 700;
  }
  .field-float > input:not(:focus):not(:placeholder-shown) + label { color: var(--muted); }

  .fieldset { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px 4px; margin: 0 0 18px; }
  .fieldset > legend { padding: 0 6px; margin-left: -6px; font-weight: 750; font-size: var(--fs-md); }
  .form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 6px; }
  .form-actions-sticky {
    position: sticky; bottom: 0; z-index: var(--z-sticky); margin: 0 calc(-1 * var(--gutter)); padding: 12px var(--gutter);
    background: var(--surface-glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  }

  /* --- Ogohlantirishlar --- */
  .alert {
    position: relative; padding: 12px 16px 12px 46px; margin-bottom: 16px; border-radius: var(--r-md);
    border: 1px solid var(--alert-border, var(--border)); background: var(--alert-bg, var(--surface-2)); color: var(--alert-fg, var(--text));
    font-size: var(--fs-md); line-height: 1.5;
  }
  .alert::before {
    content: ""; position: absolute; left: 15px; top: 13px; width: 20px; height: 20px; background: currentColor;
    -webkit-mask: var(--alert-icon, var(--i-info)) center / contain no-repeat; mask: var(--alert-icon, var(--i-info)) center / contain no-repeat;
  }
  .alert a { color: inherit; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; }
  .alert b, .alert strong { font-weight: 750; }
  .alert .small { margin-top: 4px; opacity: .88; }
  .alert-title { display: block; font-weight: 750; margin-bottom: 2px; }
  .alert-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .alert-success { --alert-bg: var(--success-bg); --alert-fg: var(--success); --alert-border: var(--success-border); --alert-icon: var(--i-success); }
  .alert-warning { --alert-bg: var(--warning-bg); --alert-fg: var(--warning); --alert-border: var(--warning-border); --alert-icon: var(--i-warning); }
  .alert-error, .alert-danger { --alert-bg: var(--danger-bg); --alert-fg: var(--danger); --alert-border: var(--danger-border); --alert-icon: var(--i-error); }
  .alert-info, .alert-debug { --alert-bg: var(--info-bg); --alert-fg: var(--info); --alert-border: var(--info-border); --alert-icon: var(--i-info); }
  .alert-plain::before { content: none; }
  .alert-plain { padding-left: 16px; }
  .flash-messages { margin-bottom: 8px; }
  .js .flash-messages { visibility: hidden; max-height: 0; overflow: hidden; margin: 0; animation: flash-fallback 0s linear 2.5s forwards; }
  @keyframes flash-fallback { to { visibility: visible; max-height: 100vh; overflow: visible; margin-bottom: 8px; } }

  /* --- Belgilar (badge) va chiplar --- */
  .badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill);
    font-size: var(--fs-xs); font-weight: 700; line-height: 1.35; white-space: nowrap; vertical-align: middle;
    background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
  }
  .badge .icon { width: 13px; height: 13px; }
  .badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
  .badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
  .badge-danger, .badge-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
  .badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
  .badge-brand { background: var(--grad-btn); color: #fff; }
  .badge-outline { background: transparent; border-color: var(--border-strong); color: var(--muted); }
  .badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .badge-pulse::before { animation: pulse 1.6s ease-out infinite; }
  @keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 80%, 100% { box-shadow: 0 0 0 6px transparent; } }
  .chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: var(--r-pill);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); font-weight: 650;
    text-decoration: none !important; cursor: pointer; transition: all var(--dur-fast); white-space: nowrap; flex-shrink: 0;
  }
  .chip:hover { border-color: var(--brand); color: var(--brand-text); }
  .chip.is-active, .chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-text); }
  .chip .count { font-size: var(--fs-2xs); padding: 1px 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }

  /* --- Avatar --- */
  .avatar {
    --size: 36px; display: inline-grid; place-items: center; flex-shrink: 0; width: var(--size); height: var(--size);
    border-radius: 50%; color: #fff; background: var(--av, var(--grad-brand));
    font: 800 calc(var(--size) * .36)/1 var(--font-display); letter-spacing: .02em; text-transform: uppercase;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  }
  .avatar-xs { --size: 22px; } .avatar-sm { --size: 30px; } .avatar-md { --size: 38px; } .avatar-lg { --size: 46px; } .avatar-xl { --size: 64px; }
  .avatar-square { border-radius: 30%; }
  .av-0 { --av: linear-gradient(135deg, #6366f1, #8b5cf6); }
  .av-1 { --av: linear-gradient(135deg, #0ea5e9, #6366f1); }
  .av-2 { --av: linear-gradient(135deg, #14b8a6, #0ea5e9); }
  .av-3 { --av: linear-gradient(135deg, #a855f7, #ec4899); }
  .av-4 { --av: linear-gradient(135deg, #f59e0b, #ef4444); }
  .av-5 { --av: linear-gradient(135deg, #10b981, #14b8a6); }
  .av-6 { --av: linear-gradient(135deg, #8b5cf6, #06b6d4); }
  .av-7 { --av: linear-gradient(135deg, #ec4899, #f97316); }
  .person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
  .person-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .person-sub { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }

  /* --- Kod katakchalari (titul varaqdagi 7 ustun) --- */
  .code-cells { display: inline-flex; gap: 3px; font-family: var(--font-mono); font-weight: 700; vertical-align: middle; }
  .code-cells > span {
    display: inline-grid; place-items: center; width: 1.55em; height: 1.9em; border-radius: 6px;
    border: 1.5px solid var(--bubble-border); background: var(--surface); color: var(--text); font-size: 1em;
  }
  .code-cells-sm { font-size: var(--fs-xs); gap: 2px; }
  .code-cells-sm > span { border-radius: 4px; border-width: 1px; }
  .code-cells-lg { font-size: 1.35rem; gap: 5px; }
  .code-cells-lg > span { border-radius: 9px; border-width: 2px; }
  .code-cells[data-copy] { cursor: copy; }
  .code-cells[data-copy]:hover > span { border-color: var(--brand); }
  .code-id { font-family: var(--font-mono); font-weight: 700; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
  .answers-inline { font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: .06em; color: var(--text-2); word-break: break-all; }

  /* --- Progress chiziq va halqa --- */
  .progress { position: relative; height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
  .progress > div, .progress-bar { height: 100%; width: 0; background: var(--grad-accent); border-radius: inherit; transition: width .6s var(--ease); }
  .progress-sm { height: 5px; } .progress-lg { height: 12px; }
  .progress-success > div { background: var(--success-solid); }
  .progress-warning > div { background: var(--warning-solid); }
  .progress-danger > div { background: var(--danger-solid); }
  .progress-striped > div, .progress.is-active > div {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, .22) 25%, transparent 25% 50%, rgba(255, 255, 255, .22) 50% 75%, transparent 75%), var(--grad-accent);
    background-size: 18px 18px, 100% 100%; animation: stripes 1s linear infinite;
  }
  .progress.is-indeterminate > div { width: 36% !important; animation: indeterminate 1.3s var(--ease) infinite; }
  @keyframes stripes { to { background-position: 18px 0, 0 0; } }
  @keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
  .progress-labeled { display: flex; align-items: center; gap: 10px; }
  .progress-labeled .progress { flex: 1; }
  .progress-labeled .progress-value { font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }

  .ring { --size: 56px; --stroke: 4; position: relative; display: inline-grid; place-items: center; width: var(--size); height: var(--size); flex-shrink: 0; }
  .ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
  .ring circle { fill: none; stroke-width: var(--stroke); }
  .ring-track { stroke: var(--surface-3); }
  .ring-value { stroke: var(--ring-color, var(--brand)); stroke-linecap: round; transition: stroke-dasharray 1s var(--ease); }
  .ring-brand { --ring-color: #6d5ff3; }
  .ring-success { --ring-color: var(--success-solid); }
  .ring-warning { --ring-color: var(--warning-solid); }
  .ring-danger { --ring-color: var(--danger-solid); }
  .ring-cyan { --ring-color: #06b6d4; }
  .ring-label { position: relative; font: 800 calc(var(--size) * .24)/1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

  /* --- Bo'sh holat --- */
  .empty { text-align: center; color: var(--muted); padding: 36px 16px; }
  .card.empty { padding: 44px 20px; }
  .card.empty p { font-size: var(--fs-lg); color: var(--text-2); font-weight: 600; }
  .empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 20px; }
  .empty-state-sm { padding: 24px 16px; }
  .empty-art {
    position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; margin-bottom: 10px;
    background: var(--brand-soft); color: var(--brand-text);
  }
  .empty-art::before, .empty-art::after { content: ""; position: absolute; border-radius: 50%; border: 1.5px dashed var(--brand-soft-2); }
  .empty-art::before { inset: -10px; border-radius: 26px; }
  .empty-art::after { width: 12px; height: 12px; right: -16px; top: -6px; background: var(--brand-soft-2); border: 0; }
  .empty-art .icon { width: 28px; height: 28px; }
  .empty-state-sm .empty-art { width: 48px; height: 48px; border-radius: 15px; }
  .empty-state-sm .empty-art .icon { width: 22px; height: 22px; }
  .empty-title { margin: 0; font-size: var(--fs-lg); }
  .empty-text { color: var(--muted); max-width: 46ch; margin: 0 0 10px; }

  /* --- Jadvallar --- */
  table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); background: transparent; }
  th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
  thead th {
    background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .01em;
    white-space: nowrap; border-bottom-color: var(--border);
  }
  tbody tr { transition: background var(--dur-fast); }
  tbody tr:hover > td { background: var(--row-hover); }
  tbody tr:last-child > td, table:not(:has(tbody)) tr:last-child > td { border-bottom: 0; }
  td.num, th.num, .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
  tr.muted > td { color: var(--muted); }
  tr.is-selected > td { background: var(--brand-soft); }
  tr[data-href] { cursor: pointer; }
  td > .btn-sm + .btn-sm, td > .btn-sm + form, td > form + .btn-sm { margin-left: 4px; }
  .card > table { margin: -4px 0; }
  .card > table td:not(.nowrap):not(.num), .card > table th:not(.nowrap):not(.num) { overflow-wrap: anywhere; }
  .card > table td:first-child, .card > table th:first-child { padding-left: 0; }
  .card > table td:last-child, .card > table th:last-child { padding-right: 0; }
  .table-wrap {
    overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
    box-shadow: var(--shadow-sm); margin-bottom: 18px;
    background:
      linear-gradient(to right, var(--surface) 30%, transparent) left center / 40px 100% no-repeat local,
      linear-gradient(to left, var(--surface) 30%, transparent) right center / 40px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(20, 24, 60, .14), transparent) left center / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(20, 24, 60, .14), transparent) right center / 12px 100% no-repeat scroll,
      var(--surface);
    scrollbar-width: thin;
  }
  .card .table-wrap { box-shadow: none; border-radius: var(--r-md); margin-bottom: 12px; }
  .card .table-wrap:last-child { margin-bottom: 0; }
  .table-wrap > table { border: 0; }
  .table-wrap thead th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
  .table-wrap thead th:last-child { border-top-right-radius: calc(var(--r-lg) - 1px); }
  .table-scroll { max-height: min(70vh, 720px); overflow: auto; }
  .table-scroll thead th { position: sticky; top: 0; z-index: 1; }
  .table-compact th, .table-compact td { padding: 8px 10px; }
  .table-toolbar { display: flex; align-items: center; gap: 10px 12px; margin-bottom: 12px; }
  .table-toolbar .search { flex: 1 1 260px; min-width: 180px; max-width: 360px; }
  .card-header > .table-toolbar { margin-left: auto; margin-bottom: 0; }
  .table-count { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
  .table-empty-row > td { text-align: center; color: var(--muted); padding: 32px 16px !important; background: none !important; }
  th[data-sort-key], th.is-sortable { padding: 0; }
  .th-sort {
    display: flex; align-items: center; gap: 4px; width: 100%; padding: 12px 14px; border: 0; background: none;
    font: inherit; color: inherit; text-align: inherit; cursor: pointer; letter-spacing: inherit; white-space: nowrap;
  }
  th.num .th-sort { justify-content: flex-end; }
  .th-sort::after {
    content: ""; width: 13px; height: 13px; flex-shrink: 0; background: currentColor; opacity: .35;
    -webkit-mask: var(--i-sort) center / contain no-repeat; mask: var(--i-sort) center / contain no-repeat;
  }
  .th-sort:hover { color: var(--text); }
  th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--brand-text); }
  th[aria-sort="ascending"] .th-sort::after { opacity: 1; -webkit-mask-image: var(--i-sort-asc); mask-image: var(--i-sort-asc); }
  th[aria-sort="descending"] .th-sort::after { opacity: 1; -webkit-mask-image: var(--i-sort-desc); mask-image: var(--i-sort-desc); }
  mark, .mark { background: rgba(250, 204, 21, .35); color: inherit; border-radius: 3px; padding: 0 1px; }

  /* --- Qidiruv maydoni --- */
  .search { position: relative; display: block; }
  .search > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
  .search > input { padding-left: 40px; min-height: 40px; }
  .search > kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }

  /* --- Tablar --- */
  .tab-list {
    display: inline-flex; gap: 4px; padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
    background: var(--surface-3); border-radius: var(--r-md); margin-bottom: 16px;
  }
  .tab-list::-webkit-scrollbar { display: none; }
  .tab {
    display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--r-sm);
    background: transparent; color: var(--muted); font-weight: 650; font-size: var(--fs-md); white-space: nowrap; text-decoration: none !important;
    transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
  }
  .tab .icon { width: 17px; height: 17px; }
  .tab:hover { color: var(--text); }
  .tab[aria-selected="true"], .tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
  .tab .badge { padding: 1px 7px; }
  .tabs-line .tab-list { background: none; padding: 0; border-radius: 0; border-bottom: 1px solid var(--border); display: flex; gap: 18px; }
  .tabs-line .tab { padding: 0 2px; border-radius: 0; min-height: 42px; box-shadow: none !important; background: none !important; position: relative; }
  .tabs-line .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--grad-accent); }
  .js [data-tabs] .tab-panel:not(.is-active) { display: none; }

  /* --- Yig'iladigan bo'lim --- */
  details.collapse { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); margin-bottom: 12px; }
  details.collapse > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; padding: 14px 16px;
    font-weight: 700; border-radius: var(--r-md);
  }
  details.collapse > summary::-webkit-details-marker { display: none; }
  details.collapse > summary::after {
    content: ""; width: 18px; height: 18px; flex-shrink: 0; background: var(--muted); transition: transform var(--dur) var(--ease);
    -webkit-mask: var(--select-arrow) center / contain no-repeat; mask: var(--select-arrow) center / contain no-repeat;
  }
  details.collapse[open] > summary::after { transform: rotate(180deg); }
  details.collapse > summary:hover { background: var(--surface-2); }
  details.collapse > .collapse-body { padding: 0 16px 16px; }
  details.collapse[open] > .collapse-body { animation: fade-down var(--dur-slow) var(--ease); }

  /* --- Tushadigan menyu (details asosida, JS bo'lmasa ham ishlaydi) --- */
  .dropdown { position: relative; display: inline-block; }
  .dropdown > summary { list-style: none; }
  .dropdown > summary::-webkit-details-marker { display: none; }
  .menu {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: var(--z-dropdown); min-width: 230px; max-width: min(320px, calc(100vw - 24px));
    padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    box-shadow: var(--shadow-lg); animation: pop-in .16s var(--ease);
  }
  .menu-end { left: auto; right: 0; transform-origin: top right; }
  .menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
    background: none; color: var(--text); font-size: var(--fs-md); font-weight: 600; text-align: left; text-decoration: none !important; cursor: pointer;
  }
  .menu-item .icon { width: 18px; height: 18px; color: var(--muted); }
  .menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
  .menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }   /* klaviatura: fon farqi yetarli emas (1.1:1) */
  .menu-item.is-danger, .menu-item.is-danger .icon { color: var(--danger); }
  .menu-item.is-danger:hover { background: var(--danger-bg); }
  .menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
  .menu-label { padding: 6px 10px 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
  .menu-header { display: flex; align-items: center; gap: 12px; padding: 10px; }
  .menu-header > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .menu-header strong { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* faqat matn bloki: {% avatar %} ham <span>, uning oq harflari va o'lchami saqlansin */
  .menu-header > div > span { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu form { margin: 0; }
  .theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 2px 4px 4px; background: var(--surface-3); border-radius: var(--r-sm); }
  .theme-switch button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border: 0; border-radius: 8px;
    background: none; color: var(--muted); font-size: var(--fs-2xs); font-weight: 700;
  }
  .theme-switch button .icon { width: 17px; height: 17px; }
  .theme-switch button:hover { color: var(--text); }
  .theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-xs); }
  @keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
  @keyframes fade-down { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

  /* --- Modal oyna (<dialog class="modal">) --- */
  dialog.modal {
    width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border);
    border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: auto;
  }
  dialog.modal-lg { width: min(760px, calc(100vw - 32px)); }
  dialog.modal::backdrop, dialog.cmdk::backdrop { background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
  dialog.modal[open] { animation: modal-in .24s var(--ease); }
  dialog.modal[open]::backdrop { animation: fade-in .2s var(--ease); }
  .modal-header { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px 8px; }
  .modal-header h2, .modal-title { margin: 0; font-size: var(--fs-lg); font-weight: 800; }
  .modal-close { margin-left: auto; margin-top: -6px; margin-right: -8px; }
  .modal-body { padding: 8px 24px 18px; color: var(--text-2); }
  .modal-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 24px 20px; }
  .modal-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; background: var(--brand-soft); color: var(--brand-text); }
  .modal-icon .icon { width: 22px; height: 22px; }
  .modal-danger .modal-icon { background: var(--danger-bg); color: var(--danger); }
  @keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  body.has-modal { overflow: hidden; }

  /* --- Bildirishnomalar (toast) --- */
  /* --toast-lift: pastga yopishgan amallar qatori (.form-actions-sticky, [data-toast-avoid]) balandligi -
     app.js (ToastDock) o'lchab qo'yadi, shuning uchun toast "Saqlash" kabi asosiy tugmalarni hech qachon yopmaydi. */
  .toast-region {
    position: fixed; z-index: var(--z-toast); right: 20px; bottom: calc(20px + var(--toast-lift, 0px)); width: min(400px, calc(100vw - 32px));
    display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none;
    transition: bottom var(--dur) var(--ease);
  }
  .toast {
    --tone: var(--brand); --tone-bg: var(--brand-soft);
    position: relative; overflow: hidden; pointer-events: auto; display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 12px 14px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); animation: toast-in .42s var(--ease-spring);
  }
  .toast-success { --tone: var(--success); --tone-bg: var(--success-bg); }
  .toast-warning { --tone: var(--warning); --tone-bg: var(--warning-bg); }
  .toast-error { --tone: var(--danger); --tone-bg: var(--danger-bg); }
  .toast-info { --tone: var(--info); --tone-bg: var(--info-bg); }
  .toast-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; color: var(--tone); background: var(--tone-bg); }
  .toast-icon .icon { width: 18px; height: 18px; }
  .toast-body { flex: 1; min-width: 0; padding-top: 5px; font-size: var(--fs-md); font-weight: 600; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
  .toast-close { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); flex-shrink: 0; }
  .toast-close:hover { background: var(--surface-3); color: var(--text); }
  .toast-close .icon { width: 16px; height: 16px; }
  .toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tone); opacity: .55; transform-origin: left; animation: toast-timer linear forwards; }
  .toast:hover .toast-timer, .toast:focus-within .toast-timer, .toast.is-paused .toast-timer { animation-play-state: paused; }
  .toast.is-leaving { animation: toast-out .22s var(--ease) forwards; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
  @keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
  @keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

  /* --- Maslahat (tooltip): data-tooltip="Matn" [data-tooltip-pos="right|bottom|left"] --- */
  [data-tooltip] { position: relative; }
  [data-tooltip]::after {
    content: attr(data-tooltip); position: absolute; z-index: var(--z-tooltip); left: 50%; bottom: calc(100% + 8px);
    transform: translate(-50%, 4px); padding: 6px 10px; border-radius: 8px; background: var(--tooltip-bg); color: var(--tooltip-fg);
    font: 650 var(--fs-xs)/1.35 var(--font-sans); letter-spacing: 0; text-transform: none; white-space: nowrap; max-width: 280px;
    box-shadow: var(--shadow-md); opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility 0s linear var(--dur-fast);
  }
  [data-tooltip]:hover::after, [data-tooltip]:focus-visible::after {
    opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: .25s, .25s, 0s;
  }
  [data-tooltip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
  [data-tooltip-pos="right"]::after { left: calc(100% + 12px); bottom: auto; top: 50%; transform: translate(-4px, -50%); }
  [data-tooltip-pos="right"]:hover::after, [data-tooltip-pos="right"]:focus-visible::after { transform: translate(0, -50%); }
  [data-tooltip-pos="left"]::after { left: auto; right: calc(100% + 12px); bottom: auto; top: 50%; transform: translate(4px, -50%); }
  [data-tooltip-pos="left"]:hover::after, [data-tooltip-pos="left"]:focus-visible::after { transform: translate(0, -50%); }
  [data-tooltip-pos="bottom"]:hover::after, [data-tooltip-pos="bottom"]:focus-visible::after { transform: translate(-50%, 0); }
  @media (hover: none) { [data-tooltip]::after { content: none; } }

  /* --- Buyruqlar paneli (Ctrl+K) --- */
  dialog.cmdk {
    width: min(640px, calc(100vw - 24px)); max-height: min(560px, calc(100dvh - 24px)); margin: max(10vh, 12px) auto auto; padding: 0;
    border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
    overflow: hidden; flex-direction: column;
  }
  dialog.cmdk[open] { display: flex; animation: modal-in .2s var(--ease); }
  .cmdk-search { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .cmdk-search > .icon { width: 20px; height: 20px; color: var(--brand-text); }
  .cmdk-search:focus-within { box-shadow: inset 0 -2px 0 var(--brand); }   /* qidiruv maydonida fokus belgisi */
  .cmdk-search input { flex: 1; border: 0 !important; box-shadow: none !important; background: none; padding: 6px 0; min-height: 36px; font-size: var(--fs-lg); font-weight: 550; }
  .cmdk-list { flex: 1; overflow-y: auto; padding: 8px; scroll-padding: 8px; }
  .cmdk-group { padding: 10px 10px 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
  .cmdk-item {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 8px 10px; border-radius: var(--r);
    color: var(--text); font-weight: 600; font-size: var(--fs-md); text-decoration: none !important; cursor: pointer; border: 0; background: none; text-align: left;
  }
  .cmdk-item-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
  .cmdk-item-icon .icon { width: 17px; height: 17px; }
  .cmdk-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cmdk-item-hint { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; white-space: nowrap; }
  .cmdk-item-enter { display: none; width: 16px; height: 16px; color: var(--brand-text); }
  .cmdk-item[aria-selected="true"] { background: var(--brand-soft); }
  .cmdk-item[aria-selected="true"] .cmdk-item-icon { background: var(--grad-btn); color: #fff; }
  .cmdk-item[aria-selected="true"] .cmdk-item-enter { display: block; }
  .cmdk-empty { padding: 36px 16px; text-align: center; color: var(--muted); }
  .cmdk-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
  .cmdk-foot span { display: inline-flex; align-items: center; gap: 4px; }

  /* --- Fayl tashlash maydoni (dropzone) --- */
  .dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 200px; padding: 28px 20px; text-align: center; border-radius: var(--r-lg);
    border: 2px dashed var(--border-strong);
    background-color: var(--surface-2);
    isolation: isolate;
    transition: border-color var(--dur) var(--ease), background-color var(--dur), transform var(--dur) var(--ease), box-shadow var(--dur);
  }
  .dropzone::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
    background: radial-gradient(circle, transparent 0 4px, var(--bubble-ring) 4.5px 5.5px, transparent 6px) 0 0 / 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse 55% 75% at 50% 50%, transparent 35%, #000 100%);
            mask-image: radial-gradient(ellipse 55% 75% at 50% 50%, transparent 35%, #000 100%);
  }
  .dropzone-sm { min-height: 140px; padding: 20px 16px; }
  .dropzone:hover { border-color: var(--brand); }
  .dropzone.is-dragover { border-color: var(--brand); border-style: solid; background-color: var(--brand-soft); transform: scale(1.01); box-shadow: 0 0 0 6px var(--ring-soft); }
  .dropzone:focus-within { outline: 3px solid var(--ring); outline-offset: 2px; }
  .dropzone-input { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; cursor: pointer; z-index: 1; }
  .dropzone-body { display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
  .dropzone-icon {
    display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; margin-bottom: 6px;
    background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand); transition: transform var(--dur-slow) var(--ease-spring);
  }
  .dropzone-sm .dropzone-icon { width: 46px; height: 46px; border-radius: 14px; }
  .dropzone-icon .icon { width: 26px; height: 26px; }
  .dropzone.is-dragover .dropzone-icon { transform: translateY(-4px) scale(1.06); }
  .dropzone-title { font-weight: 700; color: var(--text); font-size: var(--fs-base); }
  .dropzone-title u { color: var(--brand-text); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
  .dropzone-hint { font-size: var(--fs-sm); color: var(--muted); }
  .dropzone-file {
    position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; width: 100%; max-width: 520px; padding: 12px;
    border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); text-align: left;
  }
  .dropzone-file-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); flex-shrink: 0; }
  .dropzone-file-icon .icon { width: 22px; height: 22px; }
  .dropzone-file-meta { flex: 1; min-width: 0; }
  .dropzone-file-name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dropzone-file-size { font-size: var(--fs-sm); color: var(--muted); }
  .dropzone.has-file { min-height: 0; border-style: solid; border-color: var(--success-border); background-color: var(--success-bg); }
  .dropzone.has-file .dropzone-body { display: none; }
  .dropzone.has-file .dropzone-input { pointer-events: none; }
  .dropzone.is-invalid { border-color: var(--danger); background-color: var(--danger-bg); }
  .dropzone-error { position: relative; z-index: 2; color: var(--danger); font-weight: 650; font-size: var(--fs-sm); }

  .upload-progress { padding: 16px 18px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); margin: 16px 0; }
  .upload-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-weight: 700; }
  .upload-progress-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; display: flex; align-items: center; gap: 8px; }
  .upload-progress-pct { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
  .upload-progress-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 8px; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
  .upload-progress.is-done .progress > div { background: var(--success-solid); }
  .upload-progress.is-error { border-color: var(--danger-border); background: var(--danger-bg); }

  /* --- Javoblar kaliti tahrirlagichi (data-answer-key) --- */
  .answer-key { --bubble: 30px; }
  .ak-toolbar {
    position: sticky; top: calc(var(--appbar-h) + 8px); z-index: var(--z-sticky);
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 10px 14px; margin-bottom: 16px;
    border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-glass);
    backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%); box-shadow: var(--shadow-sm);
  }
  .ak-summary { display: flex; align-items: center; gap: 12px; }
  .ak-summary .ring { --size: 46px; }
  .ak-summary-text { display: flex; flex-direction: column; line-height: 1.25; }
  .ak-summary-text strong { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
  .ak-summary-text span { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
  .ak-summary-text .is-bad { color: var(--danger); }
  .ak-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
  .ak-chip {
    display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border-radius: var(--r-pill);
    border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--fs-sm); font-weight: 650; color: var(--text-2);
  }
  .ak-chip b { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
  .ak-chip:hover { border-color: var(--brand); }
  .ak-chip.is-complete { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
  .ak-chip.is-complete b { color: var(--success); }
  .ak-chip .icon { width: 15px; height: 15px; }
  .ak-actions { display: flex; gap: 6px; }
  .ak-blocks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .ak-block { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 12px 10px 10px; box-shadow: var(--shadow-xs); scroll-margin-top: calc(var(--appbar-h) + 90px); }
  .ak-block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 10px; }
  .ak-block-title { font-weight: 750; font-size: var(--fs-md); }
  .ak-block-count { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
  .ak-block .progress { margin: 0 6px 10px; }
  .ak-letters, .ak-q { display: grid; grid-template-columns: 30px repeat(5, var(--bubble)); gap: 6px; align-items: center; justify-content: start; }
  .ak-letters { padding: 0 6px 4px; font: 700 var(--fs-2xs) var(--font-mono); color: var(--faint); text-align: center; }
  .ak-q { padding: 2px 6px; border-radius: 10px; outline: none; transition: background var(--dur-fast); }
  .ak-q.ak-gap { margin-top: 7px; }
  .ak-q:hover { background: var(--surface-2); }
  .ak-q.is-current { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand); }
  .ak-q:focus-visible { box-shadow: inset 0 0 0 2px var(--brand), 0 0 0 3px var(--ring-soft); }
  .ak-n { font: 600 var(--fs-sm) var(--font-mono); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; padding-right: 2px; }
  .ak-q.is-filled .ak-n { color: var(--text); }
  .ak-q.is-invalid .ak-n, .ak-q.is-missing .ak-n { color: var(--danger); }
  .ak-q.is-missing { background: var(--danger-bg); }
  .ak-b {
    display: grid; place-items: center; width: var(--bubble); height: var(--bubble); padding: 0; border-radius: 50%;
    border: 1.5px solid var(--bubble-border); background: var(--surface); color: var(--muted);
    font: 700 var(--fs-xs)/1 var(--font-mono); cursor: pointer;
    transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
  }
  .ak-b:hover { border-color: var(--brand); color: var(--brand-text); }
  .ak-b[aria-checked="true"] { background: var(--grad-bubble); border-color: transparent; color: #fff; transform: scale(1.07); box-shadow: 0 3px 10px -3px rgba(79, 70, 229, .65); }
  .ak-b.ak-cancel { border-style: dashed; }
  .ak-b.ak-cancel[aria-checked="true"] { background: var(--warning-solid); color: #3b1d00; box-shadow: 0 3px 10px -3px rgba(245, 158, 11, .6); border-style: solid; }
  .ak-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--fs-xs); color: var(--muted); margin-top: 12px; }
  .ak-hint span { display: inline-flex; align-items: center; gap: 4px; }
  .answer-key.is-pop .ak-q.is-just-set .ak-b[aria-checked="true"] { animation: bubble-pop .3s var(--ease-spring); }
  @keyframes bubble-pop { 0% { transform: scale(.6); } 100% { transform: scale(1.07); } }

  /* Eski javoblar jadvali (school/set_form.html: .answer-grid .q .n) - doirachalar ko'rinishida */
  .answer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 24px; }
  .answer-grid .q { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 10px; font-family: var(--font-mono); font-size: var(--fs-sm); }
  .answer-grid .q:hover { background: var(--surface-2); }
  .answer-grid .q span.n { width: 28px; text-align: right; color: var(--muted); font-weight: 600; flex-shrink: 0; }
  .answer-grid label {
    position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid var(--bubble-border); background: var(--surface); color: var(--muted); font-weight: 700; font-size: var(--fs-xs);
    cursor: pointer; transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast), border-color var(--dur-fast);
  }
  .answer-grid label:hover { border-color: var(--brand); color: var(--brand-text); }
  .answer-grid label input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
  .answer-grid label:has(input:checked) { background: var(--grad-bubble); color: #fff; border-color: transparent; transform: scale(1.06); box-shadow: 0 3px 10px -3px rgba(79, 70, 229, .6); }
  .answer-grid label:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
  #answers-count { font-weight: 700; margin-top: -6px; }

  /* --- Diagrammalar (data-chart) --- */
  .chart { position: relative; width: 100%; }
  .chart svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); }
  .chart-grid line { stroke: var(--grid-line); stroke-width: 1; }
  .chart-axis text, .chart-label { fill: var(--muted); font-size: 11px; font-weight: 600; }
  .chart-value { fill: var(--text-2); font-size: 11px; font-weight: 700; }
  .chart-bar { transition: opacity var(--dur-fast), filter var(--dur-fast); transform-box: fill-box; transform-origin: 50% 100%; animation: bar-grow .6s var(--ease) both; }
  .chart-bar-h { transform-origin: 0 50%; animation-name: bar-grow-h; }
  @keyframes bar-grow { from { transform: scaleY(0); } }
  @keyframes bar-grow-h { from { transform: scaleX(0); } }
  .chart-bar:hover { filter: brightness(1.12); }
  .chart-donut-center { fill: var(--text); font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
  .chart-donut-sub { fill: var(--muted); font-weight: 600; }
  .chart-tooltip {
    position: absolute; z-index: 5; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--tooltip-bg); color: var(--tooltip-fg);
    font-size: var(--fs-xs); font-weight: 650; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: var(--shadow-md);
  }
  .chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
  .chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
  .chart-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
  .chart-legend b { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
  .chart-donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
  .chart-donut-wrap svg { width: 168px; flex-shrink: 0; }
  .chart-donut-wrap .chart-legend { flex-direction: column; margin: 0; }

  /* --- Qadamlar ro'yxati (ketma-ketlik) --- */
  .steps { list-style: none; padding: 0; margin: 0; counter-reset: step; display: flex; flex-direction: column; gap: 0; }
  .steps > li { position: relative; counter-increment: step; padding: 0 0 18px 46px; margin: 0; min-height: 34px; }
  .steps > li::before {
    content: counter(step); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    font: 800 var(--fs-sm)/1 var(--font-display); color: var(--brand-text); background: var(--brand-soft); border: 1.5px solid var(--brand-soft-2);
  }
  .steps > li:not(:last-child)::after { content: ""; position: absolute; left: 14.5px; top: 32px; bottom: 2px; width: 1.5px; background: linear-gradient(var(--brand-soft-2), transparent); }
  .steps > li:last-child { padding-bottom: 0; }
  .steps > li.is-done::before { content: ""; background: var(--success-solid) var(--i-check) center / 15px no-repeat; border-color: transparent; }

  /* --- Kalit-qiymat ro'yxati --- */
  dl.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 10px 18px; margin: 0; font-size: var(--fs-md); }
  dl.kv dt { color: var(--muted); font-weight: 600; }
  dl.kv dd { margin: 0; font-weight: 650; min-width: 0; overflow-wrap: anywhere; }

  /* --- Ro'yxat --- */
  .list { list-style: none; padding: 0; margin: 0; }
  .list > li, .list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); margin: 0; }
  .list > li:last-child { border-bottom: 0; }
  .list-item-main { flex: 1; min-width: 0; }
  .list-item-title { font-weight: 700; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list-item-sub { font-size: var(--fs-sm); color: var(--muted); }

  /* --- Sahifalash --- */
  .pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 18px 0 4px; }
  .pagination-pages { display: flex; gap: 4px; }
  .page-num {
    display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--r-sm);
    font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); text-decoration: none !important;
  }
  .page-num:hover { background: var(--surface-3); }
  .page-num.is-current { background: var(--grad-btn); color: #fff; box-shadow: var(--shadow-brand); }
  .page-gap { display: inline-grid; place-items: center; min-width: 20px; color: var(--muted); }

  /* --- Skelet va navigatsiya chizig'i --- */
  .skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; min-height: 14px; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .nav-progress {
    position: fixed; left: 0; top: 0; z-index: var(--z-progress); height: 3px; width: 100%; background: var(--grad-accent);
    transform: scaleX(0); transform-origin: left; opacity: 0; pointer-events: none;
  }
  .nav-progress.is-active { opacity: 1; animation: nav-progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
  @keyframes nav-progress { 0% { transform: scaleX(0); } 20% { transform: scaleX(.45); } 100% { transform: scaleX(.92); } }

  /* --- Nusxa olish tugmasi holati --- */
  [data-copy].is-copied { color: var(--success) !important; }

  /* --- Landing komponentlari (sahifa mualliflari uchun) --- */
  .landing-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(28px, 5vw, 64px); align-items: center; max-width: 1200px; margin: 0 auto; padding: clamp(24px, 6vw, 72px) clamp(16px, 4vw, 40px); }
  .landing-title { font-size: var(--fs-3xl); line-height: 1.05; letter-spacing: -.045em; font-weight: 800; margin: 0 0 20px; }
  .landing-lead { font-size: clamp(1rem, .95rem + .35vw, 1.2rem); color: var(--text-2); max-width: 56ch; line-height: 1.6; margin: 0 0 28px; }
  .landing-cta { display: flex; flex-wrap: wrap; gap: 10px; }
  .feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 16px; max-width: 1200px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 48px; }
  .feature { padding: 22px; }
  .feature-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--grad-brand); color: #fff; margin-bottom: 14px; box-shadow: var(--shadow-brand); }
  .feature-icon .icon { width: 22px; height: 22px; }
  .feature h3 { margin: 0 0 6px; font-size: var(--fs-lg); }
  .feature p { color: var(--muted); margin: 0; font-size: var(--fs-md); }

  /* Jonli titul varaq tasviri (includes/sheet_illustration.html) */
  .sheet-demo { position: relative; width: min(100%, 400px); margin: 0 auto; padding: 18px 26px 44px 0; }
  .sheet-card {
    position: relative; padding: 20px 22px 22px; border-radius: 22px; background: var(--glass-bg); border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); box-shadow: var(--shadow-lg);
    transform: rotate(-2.5deg);
  }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
  .sheet-title { font-weight: 800; font-size: var(--fs-md); }
  .sheet-letters, .sheet-row { display: grid; grid-template-columns: 26px repeat(4, 26px); gap: 12px; align-items: center; }
  .sheet-letters { font: 700 var(--fs-2xs) var(--font-mono); color: var(--faint); text-align: center; margin-bottom: 6px; }
  .sheet-row { padding: 5px 0; }
  .sheet-n { font: 600 var(--fs-xs) var(--font-mono); color: var(--muted); text-align: right; }
  .sheet-row i { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--bubble-border); display: block; }
  .sheet-row i.on { background: var(--grad-bubble); border-color: transparent; animation: bubble-fill .45s var(--ease-spring) both; animation-delay: calc(var(--r, 0) * .22s + .5s); }
  .sheet-row:nth-child(2) { --r: 1; } .sheet-row:nth-child(3) { --r: 2; } .sheet-row:nth-child(4) { --r: 3; }
  .sheet-row:nth-child(5) { --r: 4; } .sheet-row:nth-child(6) { --r: 5; } .sheet-row:nth-child(7) { --r: 6; }
  @keyframes bubble-fill { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet-score {
    position: absolute; right: 0; top: 34%; display: flex; flex-direction: column; align-items: center; padding: 14px 18px; border-radius: 18px;
    background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand), var(--shadow-lg); animation: rise-in .6s var(--ease-spring) 2.2s both;
  }
  .sheet-score-value { font: 800 1.7rem/1 var(--font-display); letter-spacing: -.03em; }
  .sheet-score-label { font-size: var(--fs-xs); font-weight: 700; opacity: .85; margin-top: 4px; }
  .sheet-toast {
    position: absolute; left: 8%; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 700;
    animation: rise-in .6s var(--ease-spring) 2.8s both;
  }
  .sheet-toast .icon { color: #0ea5e9; width: 18px; height: 18px; }
  @keyframes rise-in { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
}

/* ==========================================================================
   6. YORDAMCHI KLASSLAR
   ========================================================================== */
@layer utilities {
  .muted { color: var(--muted); }
  .faint { color: var(--faint); }
  .small { font-size: var(--fs-sm); }
  .xsmall { font-size: var(--fs-xs); }
  .large { font-size: var(--fs-lg); }
  .right { text-align: right; }
  .center { text-align: center; }
  .nowrap { white-space: nowrap; }
  .mono { font-family: var(--font-mono); }
  .tabular { font-variant-numeric: tabular-nums; }
  .bold { font-weight: 700; }
  .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .text-brand { color: var(--brand-text); }
  .text-success { color: var(--success); }
  .text-warning { color: var(--warning); }
  .text-danger { color: var(--danger); }
  .text-gradient { background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .flex { display: flex; } .inline-flex { display: inline-flex; } .flex-wrap { flex-wrap: wrap; } .flex-col { flex-direction: column; }
  .items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
  .justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
  .flex-1 { flex: 1 1 0; min-width: 0; } .shrink-0 { flex-shrink: 0; }
  .gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
  .m-0 { margin: 0; }
  .mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 40px; }
  .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
  .ml-auto { margin-left: auto; }
  .p-0 { padding: 0; }
  .w-full { width: 100%; }
  .max-w-sm { max-width: 480px; } .max-w-md { max-width: 680px; } .max-w-lg { max-width: 880px; }
  .sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .show-sm { display: none !important; }
  .no-js-only { }
  .js .no-js-only { display: none !important; }
}

/* ==========================================================================
   7. MOSLASHUVCHANLIK (1440 / 1024 / 768 / 390)
   ========================================================================== */
@layer layout {

@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .sticky-aside { position: static; }
  .ak-blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appbar-search { min-width: 0; }
  .appbar-search-text { display: none; }
  .appbar-search .appbar-search-kbd { display: none; }
  .appbar-search { width: 40px; justify-content: center; padding: 0; }
}
@media (max-width: 1100px) {
  .answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Off-canvas menyu */
@media (max-width: 960px) {
  .app, .sidebar-mini .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 304px); height: 100%; z-index: var(--z-drawer);
    background: var(--surface); transform: translateX(-104%); visibility: hidden; box-shadow: none;
    transition: transform .32s var(--ease), visibility 0s linear .32s, box-shadow .32s;
  }
  .drawer-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform .32s var(--ease), visibility 0s, box-shadow .32s; }
  .drawer-close { display: inline-flex; }
  .sidebar-foot { display: none; }
  .sidebar [data-tooltip]::after { content: none; }
  .app-overlay {
    display: block; position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--overlay);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility 0s linear .3s;
  }
  .drawer-open .app-overlay { opacity: 1; visibility: visible; transition: opacity .3s var(--ease); }
  .drawer-open body { overflow: hidden; }
  .appbar-menu { display: inline-flex; margin-left: -6px; }
  .user-chip-text, .user-chip-caret { display: none; }
  .user-chip { padding: 4px; }
}

@media (max-width: 720px) {
  :root { --appbar-h: 58px; }
  h1 { font-size: 1.5rem; }
  .card { padding: 16px; border-radius: var(--r-md); }
  .card-footer { margin: auto -16px -16px; padding: 12px 16px; border-radius: 0 0 var(--r-md) var(--r-md); }
  /* layout qatlami components dan keyin keladi: .card-flush qoidalarini shu yerda takrorlaymiz */
  .card-flush { padding: 0; }
  .card-flush > .card-footer { margin: auto 0 0; }
  .card-flush > .card-header { padding: 16px 16px 0; }
  .stat { padding: 14px 16px; border-radius: var(--r-md); }
  .stat-icon { width: 34px; height: 34px; margin-bottom: 8px; border-radius: 10px; }
  .stat-icon .icon { width: 18px; height: 18px; }
  .page-header, .topbar { gap: 12px; }
  .page-actions, .topbar > .btn-row { width: 100%; }
  .page-icon { width: 42px; height: 42px; border-radius: 12px; }
  .ak-blocks { grid-template-columns: minmax(0, 1fr); }
  .answer-key { --bubble: 38px; }
  .ak-q, .ak-letters { gap: 7px; grid-template-columns: 32px repeat(5, var(--bubble)); }
  .ak-toolbar { top: calc(var(--appbar-h) + 4px); padding: 8px 10px; gap: 8px 12px; }
  .table-toolbar { flex-wrap: wrap; }
  .table-toolbar .search { max-width: none; }
  .card-header > .table-toolbar { margin-left: 0; width: 100%; }
  .ak-chips { order: 3; flex-basis: 100%; }
  .ak-chip { min-height: 30px; padding: 0 10px; }
  .answer-grid { grid-template-columns: minmax(0, 1fr); }
  .answer-grid label { width: 38px; height: 38px; font-size: var(--fs-sm); }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 10px; }
  .toast-region { left: 12px; right: 12px; bottom: calc(12px + var(--toast-lift, 0px)); width: auto; }
  dialog.modal { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; }
  dialog.modal[open] { animation: sheet-up .3s var(--ease); }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
  dialog.cmdk { margin-top: 12px; max-height: calc(100dvh - 24px); }
  .hide-sm { display: none !important; }
  .show-sm { display: inline-flex !important; }
  .landing-hero { grid-template-columns: minmax(0, 1fr); }
  .form-actions-sticky .btn { flex: 1; }
  .public-nav .wordmark small { display: none; }
  .public-links .btn { padding: 0 12px; }
  .public-links .btn-ghost > span { display: none; }
  .public-links .btn-ghost:not(.btn-icon) { width: var(--btn-h); padding: 0; }

  /* Jadval -> kartalar (opt-in): <table class="table-stack"> */
  table.table-stack thead { display: none; }
  table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td { display: block; width: 100%; }
  table.table-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.table-stack tbody tr:last-child { border-bottom: 0; }
  table.table-stack td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  table.table-stack td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-sm); font-weight: 600; text-align: left; flex-shrink: 0; }
  table.table-stack td:not([data-label])::before, table.table-stack td[data-label=""]::before { content: none; }
  table.table-stack td[data-label=""], table.table-stack td:not([data-label]) { justify-content: flex-start; text-align: left; }
  table.table-stack td.num { white-space: normal; }
  table.table-stack tbody tr:hover > td { background: none; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

@media (max-width: 420px) {
  .grid-4 { --min: 140px; }
  .btn-row > .btn, .page-actions > .btn { flex: 1 1 auto; }
  .topbar > .btn, .topbar > a.btn { width: 100%; }
}
/* Ochiq sahifa navbari telefonda: "Blok Test" yozuvi tugmalarga yaqinlashib, mavzu tugmasi logotipning bir
   qismidek ko'rinadi (414 da 22px, 390 da tegib turadi). Joy yetmaydigan holatda faqat belgi qoladi (havolaning
   aria-label'i nomni aytadi), tugmalar esa bitta guruh bo'lib o'ngda, har sahifada bir xil 6px oraliq bilan turadi:
   3 ta boshqaruv (mavzu + Kirish + Ro'yxatdan o'tish) <= 480px; mavzu + Ro'yxatdan o'tish (kirish sahifasi) <= 380px. */
@media (max-width: 480px) {
  .public-nav:has(.public-links > :nth-child(3)) .wordmark { display: none; }
}
@media (max-width: 380px) {
  .public-nav:has(.public-links > .btn-primary) .wordmark { display: none; }
}
/* Buyruqlar paneli 320px da: qisqa placeholder ham (app.js fitPlaceholder) sig'sin; 16px - iOS kattalashtirmaydi */
@media (max-width: 350px) {
  .cmdk-search input { font-size: 1rem; }
}

/* Sensorli ekranlar: bosish maydoni >= 40px */
@media (pointer: coarse) {
  .btn { --btn-h: 44px; }
  .btn-sm { --btn-h: 40px; }
  .menu-item { min-height: 44px; }
  .tab { min-height: 40px; }
  .page-num { min-width: 40px; height: 40px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .answer-key { --bubble: 38px; }
}

/* Harakatni kamaytirish */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .blob { animation: none !important; }
  .nav-progress { display: none; }
}

/* Chop etish */
@media print {
  @page { margin: 14mm; }
  :root, [data-theme="dark"] { color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #f1f1f4; --text: #000; --text-2: #222; --muted: #555; --border: #cfd2dc; --border-strong: #b7bbc8; --bubble-border: #9aa0b4; }
  body, body.has-shell { background: #fff !important; color: #000; font-size: 11pt; }
  .sidebar, .appbar, .app-overlay, .toast-region, .nav-progress, .skip-link, .no-print, .cmdk, .flash-messages, .btn, .btn-row form, .ak-toolbar, .public-nav, .public-bg, .public-footer { display: none !important; }
  .app { display: block; }
  .app-main, .main { padding: 0 !important; max-width: none; }
  .card, .table-wrap, .stat { box-shadow: none !important; border-color: #cfd2dc; break-inside: avoid; background: #fff !important; }
  thead th { background: #f1f1f4 !important; }
  tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .code-cells > span { border-color: #666; }
}
}
