/* STUDYFOODLEX.UZ — dizayn tizimi
   Layout: chap tomonda ixcham navigatsiya paneli + keng ish maydoni; ommaviy sahifalar markaziy ustunda.
   Rang: oziq-ovqat laboratoriyasi — chuqur zaytun-yashil (asosiy), za'faron (urg'u), yashilga moyil neytrallar. */
:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --line: #dde4da;
  --line-strong: #c5d0c1;
  --fg: #17221b;
  --muted: #5b6b60;
  --faint: #8a988e;
  --brand: #1f6b4f;
  --brand-strong: #154d39;
  --brand-soft: #e3f0e8;
  --accent: #d98a1c;
  --accent-soft: #fbefd9;
  --ok: #1f8a4c;
  --ok-soft: #e1f4e7;
  --warn: #b7700a;
  --warn-soft: #fdf1dc;
  --bad: #c0392b;
  --bad-soft: #fbe6e3;
  --info: #2563a8;
  --info-soft: #e3edf9;
  --shadow: 0 1px 2px rgba(23, 34, 27, .05), 0 4px 16px rgba(23, 34, 27, .05);
  --shadow-lg: 0 10px 40px rgba(23, 34, 27, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sidebar-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1512; --surface: #161e19; --surface-2: #1c2620; --line: #26332b; --line-strong: #34443a;
    --fg: #e6ede8; --muted: #9db0a3; --faint: #6f8276;
    --brand: #4fbf8e; --brand-strong: #7ad6ac; --brand-soft: #173326;
    --accent: #f0a640; --accent-soft: #3a2a12;
    --ok: #4cc47f; --ok-soft: #15301f; --warn: #e9a23b; --warn-soft: #362812;
    --bad: #f07466; --bad-soft: #3a1b18; --info: #6ea8ec; --info-soft: #172a40;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1512; --surface: #161e19; --surface-2: #1c2620; --line: #26332b; --line-strong: #34443a;
  --fg: #e6ede8; --muted: #9db0a3; --faint: #6f8276;
  --brand: #4fbf8e; --brand-strong: #7ad6ac; --brand-soft: #173326;
  --accent: #f0a640; --accent-soft: #3a2a12;
  --ok: #4cc47f; --ok-soft: #15301f; --warn: #e9a23b; --warn-soft: #362812;
  --bad: #f07466; --bad-soft: #3a1b18; --info: #6ea8ec; --info-soft: #172a40;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* ------------------------------------------------------------ asos */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font-body); }
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono, code, kbd { font-family: var(--font-mono); font-size: .88em; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------ tugmalar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: .5rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font: 600 .92rem/1 var(--font-body); cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--surface); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); border-color: var(--line-strong); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.btn-soft:hover { background: var(--brand-soft); color: var(--brand-strong); filter: brightness(.97); border-color: transparent; }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1d1406; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 85%, #000); border-color: transparent; color: #1d1406; }
.btn-sm { min-height: 32px; padding: .35rem .7rem; font-size: .84rem; }
.btn-icon { min-height: 32px; width: 32px; padding: 0; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
form.inline { display: inline; }

/* ------------------------------------------------------------ formalar */
.field { display: grid; gap: .35rem; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .86rem; color: var(--fg); }
.hint { font-size: .8rem; color: var(--muted); }
.input, .select, .textarea, input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; min-height: 42px; padding: .55rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
input[type=file] { font: inherit; font-size: .88rem; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: 600 .85rem var(--font-body); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--fg); padding: .45rem .8rem; border-radius: 6px; margin-right: .6rem; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-stack { display: grid; gap: 1rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding-top: .25rem; }
.span-all { grid-column: 1 / -1; }

/* ------------------------------------------------------------ app qobig'i */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.1rem .85rem; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .65rem; padding: .2rem .4rem; color: var(--fg); text-decoration: none !important; }
.brand img { width: 38px; height: 38px; border-radius: 9px; object-fit: contain; background: var(--surface-2); }
.brand-name { font: 700 1.05rem/1.1 var(--font-display); letter-spacing: -.01em; color: var(--fg); }
.brand-sub { font-size: .72rem; color: var(--muted); }
.nav { display: grid; gap: 2px; }
.nav-title { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: .8rem .65rem .3rem; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 550; font-size: .92rem; text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 650; }
.nav a .count { margin-left: auto; font-size: .72rem; background: var(--surface-2); padding: 1px 7px; border-radius: 99px; color: var(--muted); }
.sidebar-foot { margin-top: auto; display: grid; gap: .5rem; }
.me { display: flex; align-items: center; gap: .6rem; padding: .55rem; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.me > div { min-width: 0; }
.me-name { font-weight: 650; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: .74rem; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--brand); color: var(--surface); font: 700 .8rem var(--font-display); }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.75rem; min-height: 60px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .crumbs { display: flex; align-items: center; gap: .4rem; font-size: .88rem; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs strong { color: var(--fg); overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 1.75rem; width: 100%; max-width: 1240px; display: grid; gap: 1.5rem; align-content: start; }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; }
.page-head > div:first-child { min-width: 0; display: grid; gap: .3rem; }
.page-head p { color: var(--muted); max-width: 70ch; }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(82vw, 300px); z-index: 50; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); padding-top: calc(1.1rem + env(safe-area-inset-top, 0px)); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: .6rem 1rem; }
  .content { padding: 1.1rem 1rem 2rem; gap: 1.1rem; }
  h1 { font-size: 1.45rem; }
}

/* ------------------------------------------------------------ kartalar va bloklar */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 1rem; }
.card-body { padding: 1.25rem; display: grid; gap: 1rem; }
.card-foot { padding: .85rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.split { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); align-items: start; }
@media (max-width: 1080px) { .split { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* statistik qatorlar */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 1rem 1.15rem; display: grid; gap: .15rem; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; display: flex; gap: .4rem; align-items: center; }
.stat-value { font: 700 1.65rem/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.stat-note { font-size: .78rem; color: var(--faint); }

/* nishonlar */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge-accent { background: var(--accent-soft); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* progress */
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .4s ease; }
.progress.accent > span { background: var(--accent); }
.ring { --p: 0; --size: 64px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring::before { content: attr(data-label); width: calc(var(--size) - 12px); height: calc(var(--size) - 12px); border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 700 .9rem var(--font-display); font-variant-numeric: tabular-nums; }

/* jadvallar */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: .7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn-row { justify-content: flex-end; flex-wrap: nowrap; }
.cell-title { font-weight: 600; color: var(--fg); }
.cell-sub { font-size: .8rem; color: var(--muted); }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: var(--ok); } .score.mid { color: var(--warn); } .score.low { color: var(--bad); }

/* ro'yxatlar */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); min-width: 0; color: var(--fg); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; color: var(--fg); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow-wrap: anywhere; }
.list-item .sub { font-size: .82rem; color: var(--muted); }
.list-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand-strong); font: 700 .85rem var(--font-display); }
.list-icon.done { background: var(--ok-soft); color: var(--ok); }
.list-icon.accent { background: var(--accent-soft); color: var(--warn); }

/* bo'sh holat */
.empty { text-align: center; padding: 2.5rem 1.25rem; display: grid; gap: .6rem; justify-items: center; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; color: var(--faint); }
.empty h3 { color: var(--fg); }

/* flash xabarlar */
.flashes { display: grid; gap: .5rem; }
.flash { display: flex; gap: .65rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .92rem; border: 1px solid transparent; animation: flash-in .25s ease; }
.flash .icon { margin-top: 2px; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.flash-warning { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.flash span { color: var(--fg); overflow-wrap: anywhere; }
.flash-close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } }

/* tablar va filtrlar */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .65rem .95rem; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--brand-strong); border-color: var(--brand); }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.filters .field { flex: 1 1 180px; }
.filters .field.narrow { flex: 0 1 180px; }
.pager { display: flex; gap: .35rem; justify-content: center; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: .88rem; color: var(--fg); text-decoration: none; padding: 0 .5rem; }
.pager .current { background: var(--brand); border-color: var(--brand); color: var(--surface); font-weight: 700; }

/* dialog (tasdiqlash) */
dialog.confirm { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); box-shadow: var(--shadow-lg); }
dialog.confirm::backdrop { background: rgba(10, 20, 14, .45); }
dialog.confirm .body { padding: 1.25rem; display: grid; gap: .5rem; }
dialog.confirm .foot { padding: .85rem 1.25rem; display: flex; gap: .5rem; justify-content: flex-end; background: var(--surface-2); border-top: 1px solid var(--line); }
details.disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; font-weight: 600; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary.card-head { justify-content: flex-start; }
details.disclosure > summary::before { content: "›"; font-size: 1.2rem; transition: transform .15s; color: var(--muted); }
details.disclosure[open] > summary::before { transform: rotate(90deg); }

/* kurs kartalari */
.course-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; color: var(--fg); text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
a.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--fg); }
.course-cover { aspect-ratio: 16 / 7; max-width: 100%; background: linear-gradient(135deg, #24795a 0%, #123f2f 100%); position: relative; overflow: hidden; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover .cover-mark { position: absolute; right: -10px; bottom: -22px; font: 800 5.5rem/1 var(--font-display); color: rgba(255,255,255,.12); letter-spacing: -.04em; }
.course-cover .cover-level { position: absolute; left: 1rem; top: 1rem; }
.course-body { padding: 1.1rem 1.25rem 1.25rem; display: grid; gap: .65rem; align-content: start; }
.course-body p { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: var(--muted); }
.meta span { display: inline-flex; gap: .35rem; align-items: center; }

/* dars ko'rish */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
@media (max-width: 1080px) { .lesson-layout { grid-template-columns: minmax(0, 1fr); } }
.viewer { background: var(--surface-2); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.viewer iframe, .viewer video { width: 100%; border: 0; display: block; background: var(--surface-2); }
.viewer iframe.pdf { height: min(80vh, 900px); }
.video-box { aspect-ratio: 16 / 9; max-width: 100%; }
.video-box iframe { width: 100%; height: 100%; }
.prose { max-width: 72ch; font-size: 1rem; line-height: 1.7; display: grid; gap: .9rem; overflow-wrap: anywhere; }
.prose h2, .prose h3 { margin-top: .5rem; }
.toc { position: sticky; top: 76px; }
.toc a { display: flex; gap: .65rem; align-items: center; padding: .55rem 1rem; color: var(--muted); font-size: .88rem; border-left: 3px solid transparent; text-decoration: none; }
.toc a:hover { background: var(--surface-2); color: var(--fg); }
.toc a.current { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); font-weight: 650; }
.toc .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font: 700 .72rem var(--font-mono); flex: none; }
.toc a.done .n { background: var(--ok); color: var(--surface); }

/* test topshirish */
.quiz-bar { position: sticky; top: 60px; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .75rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); flex-wrap: wrap; }
.quiz-bar .grow { flex: 1 1 200px; display: grid; gap: .3rem; }
.timer { font: 700 1.2rem var(--font-mono); font-variant-numeric: tabular-nums; padding: .3rem .75rem; border-radius: 8px; background: var(--surface-2); }
.timer.low { background: var(--bad-soft); color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.qcard { padding: 1.35rem; display: grid; gap: 1rem; scroll-margin-top: 140px; }
.qhead { display: flex; gap: .85rem; align-items: flex-start; }
.qnum { font: 700 .8rem var(--font-mono); background: var(--brand-soft); color: var(--brand-strong); border-radius: 8px; padding: .35rem .55rem; flex: none; }
.qtext { font-size: 1.04rem; font-weight: 550; line-height: 1.5; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.choices { display: grid; gap: .5rem; }
.choice { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .9rem; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.choice:hover { border-color: var(--line-strong); background: var(--surface-2); }
.choice input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice .letter { font: 700 .78rem var(--font-mono); color: var(--muted); width: 1.2rem; flex: none; margin-top: 2px; }
.match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.match-row:last-child { border-bottom: 0; }
.match-left { font-weight: 600; }
@media (max-width: 640px) { .match-row { grid-template-columns: minmax(0, 1fr); gap: .35rem; } }
.qnav { display: flex; flex-wrap: wrap; gap: .35rem; }
.qnav a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); font: 600 .8rem var(--font-mono); color: var(--muted); text-decoration: none; background: var(--surface); }
.qnav a.answered { background: var(--brand); border-color: var(--brand); color: var(--surface); }
.review-item { border-left: 4px solid var(--line); }
.review-item.ok { border-left-color: var(--ok); }
.review-item.bad { border-left-color: var(--bad); }
.answer-line { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: .5rem; font-size: .92rem; }
@media (max-width: 640px) { .answer-line { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* natija bloki */
.result-hero { display: flex; gap: 1.5rem; align-items: center; padding: 1.5rem; flex-wrap: wrap; }
.result-hero .ring { --size: 120px; }
.result-hero .ring::before { font-size: 1.6rem; width: calc(var(--size) - 18px); height: calc(var(--size) - 18px); }
.ring.bad { background: conic-gradient(var(--bad) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring.ok { background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-2) 0); }

/* savol muharriri */
.opt-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
.opt-row.matching { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; }
.opt-row .correct-toggle { display: grid; place-items: center; width: 40px; height: 42px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.opt-row .correct-toggle input { width: 18px; height: 18px; accent-color: var(--ok); }
.opt-row .correct-toggle:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); }
.type-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.type-pick label { display: flex; gap: .5rem; align-items: center; padding: .65rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .88rem; font-weight: 600; }
.type-pick label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.type-pick input { accent-color: var(--brand); }
.q-item { display: grid; gap: .65rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); scroll-margin-top: 80px; }
.q-item:last-child { border-bottom: 0; }
.q-item .opts { display: grid; gap: .25rem; padding-left: 2.6rem; font-size: .9rem; }
.q-item .opt { display: flex; gap: .45rem; align-items: baseline; color: var(--muted); }
.q-item .opt.correct { color: var(--ok); font-weight: 600; }
pre.sample { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; font: .82rem/1.6 var(--font-mono); white-space: pre-wrap; overflow-x: auto; margin: 0; color: var(--fg); }

/* lug'at */
.letters { display: flex; flex-wrap: wrap; gap: .3rem; }
.letters a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; font: 700 .85rem var(--font-display); color: var(--muted); background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.letters a.active, .letters a:hover { background: var(--brand); color: var(--surface); border-color: var(--brand); }
.term { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: grid; gap: .3rem; }
.term:last-child { border-bottom: 0; }
.term-head { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: baseline; }
.term-name { font: 650 1.05rem var(--font-display); }
.term-tr { color: var(--brand-strong); font-weight: 600; }
.term-def { color: var(--muted); font-size: .93rem; max-width: 80ch; }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

/* mini diagramma */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: .5rem; }
.bars .bar { flex: 1; min-width: 6px; background: var(--brand); border-radius: 4px 4px 0 0; position: relative; opacity: .85; }
.bars .bar:hover { opacity: 1; }
.bars .bar span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font: 600 .68rem var(--font-mono); color: var(--muted); padding-bottom: 2px; }
.bars-axis { display: flex; gap: 4px; font: .66rem var(--font-mono); color: var(--faint); }
.bars-axis span { flex: 1; text-align: center; min-width: 6px; overflow: hidden; }

/* ------------------------------------------------------------ ommaviy sahifalar */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding-inline: 1.25rem; }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 66px; }
.site-nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.site-nav a:not(.btn) { padding: .5rem .8rem; color: var(--muted); font-weight: 600; font-size: .92rem; border-radius: 8px; text-decoration: none; }
.site-nav a:not(.btn):hover, .site-nav a.active { color: var(--fg); background: var(--surface-2); }
@media (max-width: 760px) { .site-nav a.hide-sm { display: none; } }
.hero { padding-block: 4.5rem 3.5rem; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 3rem; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; } .hero { padding-block: 2.5rem 2rem; } }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.hero h1 em { font-style: normal; color: var(--brand); position: relative; white-space: nowrap; }
.hero h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: .06em; height: .18em; background: var(--accent); opacity: .45; z-index: -1; border-radius: 2px; }
.hero .lead { font-size: 1.12rem; color: var(--muted); max-width: 58ch; margin-top: 1.1rem; }
.hero .btn-row { margin-top: 1.75rem; }
.hero .btn { min-height: 48px; padding: .7rem 1.3rem; font-size: 1rem; }
/* bosh sahifadagi "oziq-ovqat yorlig'i" kartasi */
.label-card { background: var(--surface); border: 2px solid var(--fg); border-radius: 6px; padding: .9rem 1rem 1rem; font-family: var(--font-body); box-shadow: 8px 8px 0 var(--brand-soft); max-width: 380px; justify-self: end; width: 100%; }
@media (max-width: 900px) { .label-card { justify-self: start; } }
.label-card h3 { font: 800 1.6rem/1 var(--font-display); letter-spacing: -.02em; border-bottom: 1px solid var(--fg); padding-bottom: .35rem; }
.label-card .serving { font-size: .82rem; border-bottom: 8px solid var(--fg); padding: .3rem 0 .45rem; }
.label-card .lrow { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line-strong); padding: .32rem 0; font-size: .92rem; font-variant-numeric: tabular-nums; }
.label-card .lrow.big { font-weight: 800; font-size: 1.05rem; border-bottom: 4px solid var(--fg); }
.label-card .lrow.sub { padding-left: 1rem; color: var(--muted); }
.label-card .note { font-size: .74rem; color: var(--muted); padding-top: .5rem; line-height: 1.4; }
.section { padding-block: 3rem; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.section-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 750; letter-spacing: -.02em; }
.section-head p { color: var(--muted); margin-top: .35rem; max-width: 60ch; }
.feature { padding: 1.4rem; display: grid; gap: .6rem; align-content: start; }
.feature .ficon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.feature p { color: var(--muted); font-size: .92rem; }
.steps { counter-reset: step; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.step { background: var(--surface); padding: 1.35rem; display: grid; gap: .45rem; align-content: start; }
.step::before { counter-increment: step; content: counter(step, decimal-leading-zero); font: 700 .8rem var(--font-mono); color: var(--accent); }
.step p { color: var(--muted); font-size: .9rem; }
.news-card { overflow: hidden; display: grid; grid-template-rows: auto 1fr; color: var(--fg); text-decoration: none !important; }
a.news-card:hover { color: var(--fg); box-shadow: var(--shadow-lg); }
.news-img { aspect-ratio: 16 / 9; max-width: 100%; background: var(--surface-2); display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.news-img img { width: 100%; height: 100%; object-fit: cover; }
.news-body { padding: 1.1rem 1.2rem 1.25rem; display: grid; gap: .45rem; align-content: start; }
.news-body p { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.article { max-width: 760px; margin: 0 auto; display: grid; gap: 1.25rem; }
.article .cover { border-radius: var(--radius); overflow: hidden; }
.site-footer { border-top: 1px solid var(--line); padding-block: 2rem; margin-top: 2rem; color: var(--muted); font-size: .88rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--brand-strong); color: #eaf5ef; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; position: relative; overflow: hidden; }
.auth-side h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; color: #fff; max-width: 16ch; }
.auth-side p { color: #b9d9c8; max-width: 42ch; }
.auth-side .brand-name, .auth-side .brand-sub { color: #fff; }
.auth-side .quote { font-family: var(--font-mono); font-size: .8rem; color: #9cc9b1; border-left: 2px solid var(--accent); padding-left: .8rem; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 1.4rem; }
@media (max-width: 860px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-side { display: none; } }

/* xato sahifasi */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 2rem 1rem; }
.error-code { font: 800 5rem/1 var(--font-display); color: var(--brand); letter-spacing: -.04em; }

/* sertifikat (chop etish) */
.cert-page { background: var(--surface-2); min-height: 100vh; padding: 2rem 1rem; display: grid; place-items: center; gap: 1rem; }
.certificate { width: min(1000px, 100%); aspect-ratio: 1.414; max-width: 100%; background: #fffdf8; color: #1b2a20; position: relative; padding: 5% 7%; display: flex; flex-direction: column; justify-content: space-between; text-align: center; box-shadow: var(--shadow-lg); border: 14px solid #1f6b4f; outline: 2px solid #d98a1c; outline-offset: -26px; }
.certificate .c-top { display: grid; gap: .4rem; justify-items: center; }
.certificate .c-title { font: 800 clamp(1.4rem, 4.5vw, 3rem)/1 var(--font-display); letter-spacing: .14em; color: #1f6b4f; }
.certificate .c-sub { font-size: clamp(.7rem, 1.5vw, .95rem); letter-spacing: .25em; text-transform: uppercase; color: #6b5a3a; }
.certificate .c-name { font: 700 clamp(1.3rem, 4vw, 2.6rem) var(--font-display); border-bottom: 2px solid #d98a1c; display: inline-block; padding: 0 1.5rem .3rem; }
.certificate .c-course { font: 600 clamp(.9rem, 2.2vw, 1.35rem) var(--font-display); color: #1f6b4f; }
.certificate .c-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; font-size: clamp(.6rem, 1.3vw, .85rem); text-align: left; }
.certificate .c-code { font-family: var(--font-mono); }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body { background: #fff; }
  .no-print { display: none !important; }
  .cert-page { padding: 0; background: #fff; min-height: auto; }
  .certificate { box-shadow: none; width: 100%; }
}

/* til tanlash */
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; flex: none; background: var(--surface); }
.lang-switch a { padding: .32rem .6rem; font: 700 .74rem var(--font-mono); color: var(--muted); text-decoration: none !important; letter-spacing: .04em; }
.lang-switch a + a { border-left: 1px solid var(--line-strong); }
.lang-switch a:hover { background: var(--surface-2); color: var(--fg); }
.lang-switch a.active { background: var(--brand); color: var(--surface); }
.en-block { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .8rem 1rem; display: grid; gap: .8rem; }
.en-block[open] { background: var(--surface-2); }
.en-block > summary { font-size: .9rem; }

/* Tor ekranlarda sayt sarlavhasi sig'ishi uchun */
@media (max-width: 520px) {
  .site-header .wrap { gap: .5rem; }
  .site-header .brand { min-width: 0; flex: 1 1 auto; }
  .site-header .brand img { width: 30px; height: 30px; }
  .site-header .brand-name { font-size: .84rem; }
  .site-header .brand-sub { display: none; }
  .site-nav { gap: .35rem; flex: none; }
  .site-nav .btn-icon { display: none; }
  .site-nav .btn { padding-inline: .7rem; }
  .lang-switch a { padding: .3rem .45rem; }
}
