/* ============================================================
   LiveImg — Design System v2
   Haqiqiy cloud konsoli uslubi (Cloudflare / Vercel / Linear ruhida).
   Dark va Light rejimlar bitta token to'plami orqali boshqariladi.
   Tashqi shrift yoki CDN ishlatilmaydi — hammasi o'zimizniki.
   ============================================================ */

/* ---------- 1. TOKENS: DARK (default) ---------- */
:root,
[data-theme="dark"] {
  --bg:            #0a0c10;
  --bg-subtle:     #0e1117;
  --surface:       #12161f;
  --surface-2:     #171c27;
  --surface-3:     #1d2432;
  --border:        #232a39;
  --border-strong: #2f3849;

  --fg:            #e8edf5;
  --fg-muted:      #9aa6bd;
  --fg-subtle:     #6b7689;

  --brand:         #4f7cf7;
  --brand-hover:   #6b92ff;
  --brand-fg:      #ffffff;
  --brand-subtle:  rgba(79, 124, 247, 0.12);
  --brand-border:  rgba(79, 124, 247, 0.35);
  --brand-grad:    linear-gradient(135deg, #4f7cf7 0%, #22d3ee 100%);

  --success:       #34d399;
  --success-subtle:rgba(52, 211, 153, 0.12);
  --warning:       #fbbf24;
  --warning-subtle:rgba(251, 191, 36, 0.12);
  --danger:        #f87171;
  --danger-subtle: rgba(248, 113, 113, 0.12);
  --info:          #38bdf8;
  --info-subtle:   rgba(56, 189, 248, 0.12);

  --code-bg:       #080a0f;
  --code-fg:       #cbd7ea;
  --syn-key:       #c792ea;
  --syn-str:       #a5e075;
  --syn-num:       #f78c6c;
  --syn-com:       #5c6784;
  --syn-fn:        #82aaff;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
  --overlay:   rgba(6, 8, 12, .72);
}

/* ---------- 2. TOKENS: LIGHT ---------- */
[data-theme="light"] {
  --bg:            #fbfcfe;
  --bg-subtle:     #f4f6fa;
  --surface:       #ffffff;
  --surface-2:     #f7f9fc;
  --surface-3:     #eef2f8;
  --border:        #e2e8f2;
  --border-strong: #cdd6e4;

  --fg:            #101623;
  --fg-muted:      #5b6577;
  --fg-subtle:     #8a94a6;

  --brand:         #2f5fe0;
  --brand-hover:   #244fc4;
  --brand-fg:      #ffffff;
  --brand-subtle:  rgba(47, 95, 224, 0.08);
  --brand-border:  rgba(47, 95, 224, 0.28);
  --brand-grad:    linear-gradient(135deg, #2f5fe0 0%, #0891b2 100%);

  --success:       #0f9d6e;
  --success-subtle:rgba(15, 157, 110, 0.10);
  --warning:       #b45309;
  --warning-subtle:rgba(180, 83, 9, 0.10);
  --danger:        #d93a3a;
  --danger-subtle: rgba(217, 58, 58, 0.10);
  --info:          #0284c7;
  --info-subtle:   rgba(2, 132, 199, 0.10);

  --code-bg:       #f7f9fc;
  --code-fg:       #1e2836;
  --syn-key:       #8b3fd6;
  --syn-str:       #0a7a4a;
  --syn-num:       #b45309;
  --syn-com:       #8a94a6;
  --syn-fn:        #2f5fe0;

  --shadow-sm: 0 1px 2px rgba(16,22,35,.06);
  --shadow-md: 0 4px 16px rgba(16,22,35,.08);
  --shadow-lg: 0 16px 48px rgba(16,22,35,.12);
  --overlay:   rgba(16, 22, 35, .45);
}

/* ---------- 3. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .18s ease, color .18s ease;
}

/* Tema almashganda hamma element silliq o'tsin, lekin animatsiyalarni buzmasin */
.theme-transition, .theme-transition * {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease !important;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.018em; line-height: 1.3; }
p { margin: 0 0 14px; color: var(--fg-muted); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0 0 14px; padding-left: 20px; color: var(--fg-muted); }
li { margin: 4px 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

::selection { background: var(--brand-subtle); color: var(--fg); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--fg-subtle); }

/* Fokus — klaviatura bilan navigatsiya uchun */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* Sahifa paydo bo'lishi */
@keyframes pageIn { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.content > * { animation: pageIn .28s ease both; }
.content > *:nth-child(2) { animation-delay: .03s }
.content > *:nth-child(3) { animation-delay: .06s }
.content > *:nth-child(4) { animation-delay: .09s }

/* ---------- 4. LAYOUT ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px; flex: 0 0 252px;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  padding: 18px 12px 40px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  transition: margin-left .24s cubic-bezier(.2,.9,.3,1),
              border-color .24s ease;
  z-index: 50;
}
/* Desktop: yopiq (collapse) holat — kenglik 0 ga siqiladi */
@media (min-width: 861px) {
  .app.nav-collapsed .sidebar {
    margin-left: -252px;
    border-right-color: transparent;
  }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.content { flex: 1; width: 100%; max-width: 940px; margin: 0 auto; padding: 34px 40px 120px; }
.content.wide { max-width: 1240px; }

/* ---------- 5. BRAND / LOGO ---------- */
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px; font-weight: 680; font-size: 15.5px;
  color: var(--fg); letter-spacing: -0.02em;
  min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px; overflow: hidden;
  box-shadow: 0 2px 12px var(--brand-subtle);
}
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-tag {
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-subtle);
  border: 1px solid var(--brand-border); border-radius: 5px; padding: 1px 5px;
  flex: 0 0 auto;
}

/* ---------- 6. NAV ---------- */
.nav-group {
  font-size: 10.5px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-subtle); padding: 16px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 7px;
  color: var(--fg-muted); font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
  min-width: 0;
}
.nav-link:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.nav-link.active { background: var(--brand-subtle); color: var(--brand); font-weight: 600; }
.nav-link svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .85; }
.nav-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 7. TOPBAR ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.topbar-title { font-size: 14px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }

.menu-btn { display: inline-flex; }

/* Tizim holati piluli (jonli) */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px; flex: 0 0 auto;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--fg-muted);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.status-pill.ok .dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-subtle); }
.status-pill.ok { color: var(--success); border-color: transparent; background: var(--success-subtle); }
.status-pill.warn .dot { background: var(--warning); }
.status-pill.warn { color: var(--warning); background: var(--warning-subtle); border-color: transparent; }
.status-pill.err .dot { background: var(--danger); }
.status-pill.err { color: var(--danger); background: var(--danger-subtle); border-color: transparent; }
.status-pill.unknown .dot { background: var(--fg-subtle); }

/* ---------- 8. BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  max-width: 100%; overflow: hidden;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--fg);
  font-size: 13.5px; font-weight: 550; font-family: inherit;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .13s, border-color .13s, transform .08s, opacity .13s;
}
.btn > span { overflow: hidden; text-overflow: ellipsis; }
.btn:hover { background: var(--surface-3); border-color: var(--fg-subtle); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.loading { opacity: .55; cursor: not-allowed; transform: none; pointer-events: none; }
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }

.btn-primary {
  background: var(--brand-grad); border-color: transparent; color: var(--brand-fg);
  box-shadow: 0 1px 4px var(--brand-subtle), inset 0 1px 0 rgba(255,255,255,.14);
}
.btn-primary:hover { background: var(--brand-grad); filter: brightness(1.08); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: var(--border-strong); background: transparent; }
.btn-danger:hover { background: var(--danger-subtle); border-color: var(--danger); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { width: 34px; padding: 0; flex: 0 0 34px; }
.btn-icon.btn-sm { width: 28px; flex: 0 0 28px; }

/* Loading spinner — tugmalar va dropzone uchun */
.spin {
  display: inline-block;
  width: 14px; height: 14px; flex: 0 0 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: rot .7s linear infinite;
  vertical-align: -2px;
}
@keyframes rot { to { transform: rotate(360deg) } }

/* ---------- 9. SEGMENTED CONTROL (tema / til) ---------- */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px; flex: 0 0 auto;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px;
}
.segmented button {
  display: grid; place-items: center;
  width: 30px; height: 28px; padding: 0;
  border: none; border-radius: 7px; background: transparent;
  color: var(--fg-subtle); cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: inherit;
  transition: background .13s, color .13s;
  flex: 0 0 auto;
}
.segmented button:hover { color: var(--fg); background: var(--surface-3); }
.segmented button[aria-pressed="true"] {
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm);
}
.segmented button svg { width: 15px; height: 15px; }
.segmented.lang button { width: auto; padding: 0 9px; letter-spacing: .03em; }

/* ---------- 10. CARDS & PANELS ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px; margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  flex-wrap: wrap; min-width: 0;
}
.card-head h3 { font-size: 15px; }
.card-head .btn { margin-left: auto; }
.card-title { font-size: 15px; font-weight: 620; margin-bottom: 4px; }
.card-desc { font-size: 13.5px; color: var(--fg-muted); margin: 0; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Stat kartochka */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 15px 17px; min-width: 0;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.stat:hover { border-color: var(--border-strong); }
.stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--fg-subtle); margin-bottom: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-value { font-size: 23px; font-weight: 680; letter-spacing: -0.02em; color: var(--fg); line-height: 1.15; word-break: break-word; }
.stat-sub { font-size: 12.5px; color: var(--fg-subtle); margin-top: 3px; }

/* Progress bar (kvota) */
.meter { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--brand-grad); transition: width .4s ease; }
.meter.warn > span { background: var(--warning); }
.meter.danger > span { background: var(--danger); }

/* ---------- 11. BADGES ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--fg-muted);
  max-width: 100%; white-space: nowrap;
}
.badge.ok      { color: var(--success); background: var(--success-subtle); border-color: transparent; }
.badge.warn    { color: var(--warning); background: var(--warning-subtle); border-color: transparent; }
.badge.err     { color: var(--danger);  background: var(--danger-subtle);  border-color: transparent; }
.badge.info    { color: var(--info);    background: var(--info-subtle);    border-color: transparent; }
.badge.brand   { color: var(--brand);   background: var(--brand-subtle);   border-color: transparent; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.dot.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* HTTP metod belgilari */
.method {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 5px; text-transform: uppercase;
}
.method.get    { color: var(--success); background: var(--success-subtle); }
.method.post   { color: var(--brand);   background: var(--brand-subtle); }
.method.put    { color: var(--warning); background: var(--warning-subtle); }
.method.delete { color: var(--danger);  background: var(--danger-subtle); }

/* ---------- 12. FORMS ---------- */
.field { margin-bottom: 14px; min-width: 0; }
.label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--fg-muted); margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  background: var(--bg-subtle); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 13.5px; font-family: inherit;
  transition: border-color .13s, box-shadow .13s;
  min-width: 0;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-subtle) 50%),
                   linear-gradient(135deg, var(--fg-subtle) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
  cursor: pointer;
}
.textarea { height: auto; padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.6; }
.input::placeholder { color: var(--fg-subtle); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-subtle);
}
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.hint { font-size: 12px; color: var(--fg-subtle); margin-top: 5px; }
.row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; min-width: 0; }
.row > .input, .row > .select { flex: 1 1 160px; }

/* Fayl tashlash maydoni */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  padding: 30px 20px; text-align: center; cursor: pointer;
  background: var(--bg-subtle); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-subtle); }
.dropzone svg { width: 26px; height: 26px; color: var(--fg-subtle); margin-bottom: 8px; }
.dropzone-title { font-size: 14px; font-weight: 600; color: var(--fg); margin-bottom: 3px; word-break: break-all; }
.dropzone-hint { font-size: 12.5px; color: var(--fg-subtle); }

/* ---------- 13. TABLES ---------- */
.table-wrap {
  border: 1px solid var(--border); border-radius: 11px;
  overflow: hidden; overflow-x: auto; background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-subtle); white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--fg-muted); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td strong, td .mono { color: var(--fg); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
td .row { gap: 6px; }
td .btn { max-width: 100%; }

/* ---------- 14. CODE ---------- */
code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .88em; padding: 1.5px 5px; border-radius: 5px;
  background: var(--surface-3); color: var(--fg); border: 1px solid var(--border);
}
pre {
  margin: 0; padding: 15px 17px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-fg);
  border: 1px solid var(--border); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.8px; line-height: 1.62;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }
.tok-key { color: var(--syn-key); }
.tok-str { color: var(--syn-str); }
.tok-num { color: var(--syn-num); }
.tok-com { color: var(--syn-com); font-style: italic; }
.tok-fn  { color: var(--syn-fn); }

.code-block { position: relative; margin: 14px 0; }
.code-block .copy {
  position: absolute; top: 8px; right: 8px; opacity: 0;
  transition: opacity .13s;
}
.code-block:hover .copy { opacity: 1; }
.code-block .copy.done { opacity: 1; color: var(--success); border-color: var(--success); }

/* Kod tablari */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 16px 0 0; overflow-x: auto; }
.tabs button {
  padding: 8px 14px; border: none; background: transparent;
  color: var(--fg-subtle); font-size: 13px; font-weight: 550; font-family: inherit;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .13s, border-color .13s; white-space: nowrap;
}
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tabpanel { display: none; }
.tabpanel[data-active] { display: block; }
.tabpanel pre { border-radius: 0 0 10px 10px; border-top: none; }

/* ---------- 15. ENDPOINT ---------- */
.endpoint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; margin: 22px 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.endpoint .path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px; color: var(--fg); font-weight: 550;
  min-width: 0; overflow-wrap: anywhere;
}
.endpoint .auth-tag {
  margin-left: auto; font-size: 11px; color: var(--fg-subtle);
  border: 1px dashed var(--border-strong); border-radius: 5px; padding: 2px 7px;
  white-space: nowrap;
}

/* ---------- 16. CALLOUTS ---------- */
.callout {
  display: flex; gap: 11px; padding: 13px 15px; margin: 16px 0;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 13.5px; color: var(--fg-muted);
  border-left: 3px solid var(--brand);
  min-width: 0;
}
.callout svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 2px; color: var(--brand); }
.callout strong { color: var(--fg); }
.callout.warn   { border-left-color: var(--warning); background: var(--warning-subtle); }
.callout.warn svg { color: var(--warning); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-subtle); }
.callout.danger svg { color: var(--danger); }
.callout.ok     { border-left-color: var(--success); background: var(--success-subtle); }
.callout.ok svg { color: var(--success); }

/* ---------- 17. HERO ---------- */
.hero {
  padding: 10px 0 28px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(600px 220px at 12% 0%, var(--brand-subtle), transparent 70%),
    radial-gradient(500px 200px at 85% 10%, rgba(34, 211, 238, .07), transparent 70%);
  border-radius: 0 0 14px 14px;
}
.hero h1 { font-size: 33px; letter-spacing: -0.032em; margin-bottom: 10px; }
.hero .lead { font-size: 16.5px; color: var(--fg-muted); max-width: 660px; margin-bottom: 18px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }

/* Bo'lim sarlavhasi — nozik accent */
h2 { font-size: 22px; margin: 42px 0 14px; position: relative; padding-left: 14px; scroll-margin-top: 76px; }
h2::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 3px; background: var(--brand-grad);
}
h3 { scroll-margin-top: 76px; }

/* ---------- 18. PRICING ---------- */
.plan {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 20px; position: relative; display: flex; flex-direction: column;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  min-width: 0;
}
.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.plan.featured {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand-border), var(--shadow-md);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(160deg, rgba(79,124,247,.16), rgba(34,211,238,.10)) border-box;
}
.plan.featured:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px var(--brand), var(--shadow-lg); }
.plan-flag {
  position: absolute; top: -10px; left: 20px;
  background: var(--brand-grad); color: var(--brand-fg);
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 10px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.plan h4 { font-size: 16px; margin-bottom: 3px; }
.plan .price { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin: 10px 0 2px; }
.plan .price span { font-size: 13px; font-weight: 500; color: var(--fg-subtle); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 0; font-size: 13.5px; }
.plan li { display: flex; gap: 8px; align-items: flex-start; margin: 7px 0; }
.plan li svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 4px; color: var(--success); }

/* ---------- 19. IMAGE GALLERY ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.tile {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface); transition: border-color .14s, transform .14s, box-shadow .14s;
  min-width: 0;
}
.tile:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile-img { position: relative; aspect-ratio: 1; background: var(--surface-3); overflow: hidden; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .45s ease; }
.tile-img img.lqip { filter: blur(9px) saturate(1.1); transform: scale(1.06); }
.tile-meta { padding: 9px 11px 11px; min-width: 0; }
.tile-name {
  font-size: 12.5px; font-weight: 570; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-sub { font-size: 11.5px; color: var(--fg-subtle); margin-top: 2px; }
/* Galereya tile'lari ichidagi tugmalar: box'dan CHIQMASIN */
.tile-meta .row { gap: 6px; margin-top: 9px; }
.tile-meta .row .btn {
  flex: 1 1 0; min-width: 0; height: 27px; padding: 0 8px;
  font-size: 11.5px; border-radius: 6px;
}
.tile-meta .row .btn-icon { flex: 0 0 27px; width: 27px; }

/* ---------- 20. TOAST ---------- */
.toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 250px; max-width: 380px; padding: 11px 15px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 9px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; color: var(--fg); pointer-events: auto;
  animation: toastIn .22s cubic-bezier(.2,.9,.3,1);
}
.toast.ok   { border-left-color: var(--success); }
.toast.err  { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast.out  { animation: toastOut .18s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateX(22px) } to { opacity:1; transform:none } }
@keyframes toastOut { to { opacity:0; transform: translateX(22px) } }

/* ---------- 21. SKELETON / EMPTY ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 7px;
}
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

.empty { text-align: center; padding: 44px 20px; color: var(--fg-subtle); }
.empty svg { width: 34px; height: 34px; margin-bottom: 11px; opacity: .5; }
.empty-title { font-size: 14.5px; font-weight: 600; color: var(--fg-muted); margin-bottom: 4px; }
.empty-desc { font-size: 13px; }

/* ---------- 22. OUTPUT (playground) ---------- */
.output {
  margin-top: 12px; padding: 13px 15px; display: none;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.4px; line-height: 1.6; color: var(--code-fg);
  white-space: pre-wrap; word-break: break-word; max-height: 330px; overflow: auto;
}
.output.show { display: block; }
.status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12.5px; }

/* ---------- 23. FOOTER ---------- */
.footer {
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--border);
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  font-size: 13px; color: var(--fg-subtle);
}
.footer .sep { opacity: .4; }

/* ---------- 24. TOC (o'ng ustun) ---------- */
.toc {
  position: sticky; top: 76px; align-self: start;
  width: 178px; flex: 0 0 178px; padding: 4px 0 40px;
  font-size: 12.5px; max-height: calc(100vh - 96px); overflow-y: auto;
}
.toc-title {
  font-size: 10.5px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg-subtle); margin-bottom: 9px;
}
.toc a { display: block; padding: 3.5px 0 3.5px 11px; color: var(--fg-subtle); border-left: 2px solid var(--border); }
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 560; }
.docs-layout { display: flex; gap: 34px; align-items: flex-start; }
.docs-body { flex: 1; min-width: 0; }

/* ---------- 25. ADMIN PANEL ---------- */
.ad-kpis { margin-top: 20px; }
.ad-tabs { margin-top: 26px; }
.ad-tabpanel { display: none; }
.ad-tabpanel[data-active] { display: block; animation: pageIn .2s ease both; }

/* Foydalanuvchi avatar */
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  object-fit: cover; border: 1px solid var(--border);
  background: var(--surface-3);
}
.avatar-fallback {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  background: var(--brand-grad); color: #fff;
  font-size: 11px; font-weight: 700;
}
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-cell .meta { min-width: 0; }
.user-cell .mail { font-size: 13px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.user-cell .sub { font-size: 11.5px; color: var(--fg-subtle); }

.usage-cell { min-width: 120px; }
.usage-cell .meter { margin-top: 6px; }
.usage-cell .u-row { font-size: 11.5px; color: var(--fg-subtle); }

/* Custom limitlar formasini kengaytirilgan qatori */
.ad-custom-row td { background: var(--surface-2) !important; }
.ad-custom-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px 4px 4px; }
.ad-custom-form .field { margin-bottom: 0; }
.ad-custom-form .field .label { margin-bottom: 4px; }
.ad-custom-form .actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

/* Bar chart (admin analitika) */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 10px 4px 0; }
.bars .bar-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar {
  width: 100%; max-width: 42px; border-radius: 5px 5px 2px 2px;
  background: var(--brand-grad); min-height: 2px;
  transition: height .5s cubic-bezier(.2,.9,.3,1);
  position: relative;
}
.bars .bar:hover { filter: brightness(1.15); }
.bars .bar-val { font-size: 10.5px; color: var(--fg-subtle); white-space: nowrap; }
.bars .bar-label { font-size: 10px; color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Tier jadvali (admin system) */
.tier-tbl td .val { font-weight: 650; color: var(--fg); }

/* ---------- 26. RESPONSIVE ---------- */
@media (max-width: 1180px) { .toc { display: none; } }

@media (max-width: 1100px) {
  .btn-console-open { display: none; }
}

@media (max-width: 980px) {
  .topbar-title { display: none; }
  .status-pill .status-pill-text { display: none; }
  .status-pill { padding: 0 9px; }
}

@media (max-width: 860px) {
  /* Mobil: sidebar — drawer (transform), margin siqish ishlamasi */
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 90;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.9,.3,1), margin-left .24s;
    box-shadow: var(--shadow-lg);
    margin-left: 0 !important;
  }
  .sidebar.open { transform: none; }
  .content { padding: 22px 18px 90px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .hero h1 { font-size: 26px; }
  .hero .lead { font-size: 15px; }
  .segmented.lang { display: none; }
  .backdrop {
    position: fixed; inset: 0; z-index: 80; background: var(--overlay);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .backdrop.show { opacity: 1; pointer-events: auto; }
  .ad-custom-form { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 27. PRINT ---------- */
@media print {
  .sidebar, .topbar, .toc, .toasts, .copy { display: none !important; }
  .content { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
}
