/* UzbekBilim — базовые стили. Цвета меняются в :root */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7380;
  --line: #e3e6eb;
  --brand: #1877C9;       /* основной цвет (синий, как шапочка в логотипе) */
  --brand-green: #2E9E4F; /* зелёный, как листья в логотипе */
  --brand-dark: #0E4F8C;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 1rem; }
h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.muted { color: var(--muted); margin: 0; }

/* Шапка */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar__in { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; color: #12304A; white-space: nowrap; }
.logo img { display: block; width: 38px; height: 38px; }
.logo b { color: var(--brand-green); font-weight: inherit; margin-left: .22em; }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 16px; flex: 1; }
.nav a { color: var(--text); }
.langs { display: flex; gap: 4px; }
.langs a { padding: 4px 8px; border-radius: 6px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.langs a.is-on { background: var(--brand); color: #fff; }
.langs a:hover { text-decoration: none; }

/* Кнопки */
.btn { display: inline-block; padding: 12px 22px; border-radius: 10px; border: 1px solid var(--line);
       background: var(--card); color: var(--text); font-weight: 600; cursor: pointer; font-size: 1rem; }
.btn:hover { text-decoration: none; border-color: var(--brand); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }

/* Главная */
.hero { padding: 40px 0 24px; max-width: 640px; }
.hero h1 { font-size: 2.4rem; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 24px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 640px; margin-top: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .9rem; }

/* Карточки */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card--plan.is-best { border: 2px solid var(--brand); }
.price { font-size: 1.8rem; font-weight: 800; margin: 6px 0; }
.price small { font-size: .9rem; color: var(--muted); font-weight: 600; }

/* Вкладки направлений */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: .92rem; }
.tab.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab:hover { text-decoration: none; }

/* Сообщения */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: #e9f6f3; border: 1px solid #BBD7F2; }
.flash--error { background: #fdeeee; border-color: #f3c4c4; }

.footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .9rem; background: var(--card); }

@media (max-width: 600px) {
  h1, .hero h1 { font-size: 1.6rem; }
  .nav { gap: 12px; font-size: .95rem; }
  .topbar__in { gap: 12px; }
}

/* Пользователь в шапке */
.userbox { display: flex; align-items: center; gap: 12px; font-size: .95rem; }
.userbox__name { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.btn--sm { padding: 7px 14px; font-size: .9rem; }
.btn--wide { width: 100%; }

/* Формы */
.auth { max-width: 420px; margin: 0 auto; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px;
        background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: .92rem; }
.field input, .field select {
  font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.field.has-err input, .field.has-err select { border-color: #d33; }
.field__err { color: #c22; font-size: .88rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.auth__alt { text-align: center; margin-top: 16px; line-height: 1.9; }

@media (max-width: 600px) {
  .topbar__in { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .nav { order: 3; width: 100%; }
  .userbox__name { display: none; }
}

/* ---------- Тест ---------- */
.crumbs { color: var(--muted); font-size: .9rem; margin: 0 0 6px; }
.card { display: flex; flex-direction: column; }
.card__btn { margin-top: 14px; align-self: flex-start; }
.flash--warn { background: #fff7e6; border-color: #f2d9a6; }
.flash .btn { margin-left: 10px; }

.setup { max-width: 560px; }
.choice { border: 0; padding: 0; margin: 0; }
.choice legend { font-weight: 700; margin-bottom: 8px; }
.choice__item { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.choice__item:has(input:checked) { border-color: var(--brand); background: #EAF3FC; }
.choice__item input { margin-top: 4px; }
.choice__item small { display: block; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill input { position: absolute; opacity: 0; }
.pill span { display: inline-block; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: #fff; }
.pill input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.test { max-width: 760px; margin: 0 auto; }
.test__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.test__subj { font-weight: 700; font-size: 1.1rem; }
.test__meta { display: flex; gap: 14px; align-items: center; font-weight: 600; }
.timer { font-variant-numeric: tabular-nums; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.timer.is-low { color: #c22; border-color: #f3c4c4; }
.test__bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.test__bar div { height: 100%; width: 0; background: var(--brand); transition: width .3s; }

.qcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.qcard.is-ok { border-left: 4px solid #2a9d5c; }
.qcard.is-bad { border-left: 4px solid #d33; }
.qcard__num { color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.qcard__text { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; white-space: pre-line; overflow-wrap: anywhere; }
.qcard__report { margin-top: 14px; font-size: .85rem; color: var(--muted); }

.opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; font: inherit; color: var(--text);
       background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; overflow-wrap: anywhere; }
button.opt:hover:not(:disabled) { border-color: var(--brand); }
.opt:disabled { cursor: default; }
.opt__l { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.opt.is-chosen { border-color: var(--brand); background: #EAF3FC; }
.opt.is-correct { border-color: #2a9d5c; background: #e8f6ee; }
.opt.is-wrong { border-color: #d33; background: #fdeeee; }
.opts--static .opt { cursor: default; }
.verdict { margin-top: 12px; font-weight: 700; }
.verdict.is-ok { color: #1f7a47; }
.verdict.is-bad { color: #c22; }

.test__nav { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.test__nav .btn:disabled { opacity: .4; cursor: default; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; margin-bottom: 18px; }
.qgrid__b { font: inherit; font-size: .85rem; padding: 7px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.qgrid__b.is-done { background: #EAF3FC; border-color: #BBD7F2; }
.qgrid__b.is-ok { background: #e8f6ee; border-color: #9fd6b5; }
.qgrid__b.is-bad { background: #fdeeee; border-color: #f3c4c4; }
.qgrid__b.is-cur { outline: 2px solid var(--brand); }

/* Результат */
.result { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.result__grade { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: #fff; }
.result__grade.g5 { background: #1f9d55; } .result__grade.g4 { background: #3d8bd9; }
.result__grade.g3 { background: #e0a100; } .result__grade.g2 { background: #d33; }
.result__pct { font-size: 1.6rem; font-weight: 800; }
.result__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) { .result__actions { margin-left: 0; width: 100%; } .qcard { padding: 16px; } }
.test__meta { white-space: nowrap; }
@media (max-width: 600px) { .userbox { margin-left: auto; } }

/* ---------- Кабинет ---------- */
h2 { font-size: 1.25rem; margin: 28px 0 12px; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.cab-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cab-head h1 { margin: 0; }
.subbox { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
          background: #fff7e6; border: 1px solid #f2d9a6; border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.subbox--on { background: #e9f6f3; border-color: #BBD7F2; }
.stats--4 { max-width: none; grid-template-columns: repeat(3, 1fr); }
.empty { text-align: center; align-items: center; padding: 32px; margin-top: 18px; }
.subjstats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.subjstat { gap: 8px; }
.subjstat__top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.subjstat__btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .85rem; background: var(--bg); white-space: nowrap; }
.b-ok { background: #e8f6ee; color: #1f7a47; }
.b-mid { background: #fff4d6; color: #8a6100; }
.b-bad { background: #fdeeee; color: #b42323; }
.cover { display: flex; flex-direction: column; gap: 4px; }
.cover__bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.cover__bar div { height: 100%; background: var(--brand); }
.weak { list-style: none; margin: 0; padding: 0; }
.weak li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.weak li:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table th { font-size: .82rem; color: var(--muted); font-weight: 600; background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.auth .form h3 { margin: 0; }
.auth .form + .form { margin-top: 18px; }
a.userbox__name { color: var(--text); }
@media (max-width: 600px) { .stats--4 { grid-template-columns: 1fr 1fr 1fr; } .stat b { font-size: 1.2rem; } .nav { flex-wrap: wrap; } }
@media (max-width: 600px) { .nav { flex: 1 1 100%; order: 3; } }

/* ---------- Админка ---------- */
.nav__admin { color: #b45309 !important; font-weight: 600; }
.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.admin-nav__title { margin-right: 10px; }
.admin-nav a { padding: 6px 12px; border-radius: 8px; color: var(--text); }
.admin-nav a.is-on { background: var(--text); color: #fff; }
.admin-nav a:hover { text-decoration: none; background: var(--line); }
.admin-nav a.is-on:hover { background: var(--text); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: #d33; color: #fff; font-size: .75rem; text-align: center; }
.admin-stats { max-width: none; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.admin-cols--wide { grid-template-columns: 3fr 2fr; }
.admin-cols h2 { margin-top: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.filters input[name=q] { min-width: 260px; flex: 1; }
.row-muted td { opacity: .55; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }
.form--flat { border: 0; padding: 0; margin-top: 8px; }
.btn--danger { color: #b42323; border-color: #f3c4c4; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.15rem; letter-spacing: .05em; }
.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.form textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; width: 100%; }
.optrow { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.optrow input[type=radio] { width: 20px; height: 20px; flex: none; }
.optrow input:not([type=radio]) { flex: 1; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; }
.optrow:has(input[type=radio]:checked) input:not([type=radio]) { border-color: #2a9d5c; background: #e8f6ee; }
.report { margin-bottom: 10px; gap: 6px; }
.report.is-new { border-left: 4px solid #e0a100; }
.report__head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.report__q { font-weight: 600; }
.report__msg { background: #fff7e6; border-radius: 8px; padding: 8px 12px; }
.report__btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.text-bad { color: #b42323; }
.card h3 { margin-bottom: 10px; }
.card .inline + .inline { margin-left: 6px; }
@media (max-width: 800px) { .admin-cols, .admin-cols--wide { grid-template-columns: 1fr; } .filters input[name=q] { min-width: 0; } }

/* Безопасность (админка) */
.stat--bad { border-color: #f1b5b5; background: #fff6f6; }
.stat--bad b { color: #b42323; }

/* «Глазок» в поле пароля */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-eye { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.pw-eye:hover { color: var(--text); background: var(--bg); }
.pw-eye:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pw-eye[aria-pressed="true"] { color: var(--brand); }
