/* Elita — ota-onalar portali (mobilga mo'ljallangan) */
body.portal { --pbg: #f4f5fb; background: var(--pbg); padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
:root[data-theme="dark"] body.portal { --pbg: var(--bg); }
.portal-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--pbg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
.portal-brand { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.portal-brand:hover { color: var(--text); }
.portal-logo { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center; font-size: 22px; color: #fff; background: linear-gradient(145deg, #5b5bf0, #4338ca); box-shadow: 0 10px 22px -10px rgba(67,56,202,.85); }
.portal-brand b { display: block; font-size: 16px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.portal-brand small { display: block; font-size: 12.5px; color: var(--text-muted); }
.top-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 4px 14px -8px rgba(17,29,51,.25); font-size: 19px; }
.top-btn:hover { color: var(--primary); }
.top-btn .dot-badge { top: 8px; right: 9px; min-width: 10px; width: 10px; height: 10px; padding: 0; font-size: 0; border: 2px solid var(--surface); }
.portal-main { max-width: 720px; margin: 0 auto; padding: 6px 16px 24px; }
.portal-h1 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 14px; }
.portal-h2 { font-size: 15px; font-weight: 700; margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }

.portal-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; gap: 4px; background: var(--surface); border-top: 1px solid var(--border); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 24px -14px rgba(17,29,51,.25); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.portal-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 7px 2px; border-radius: 16px; max-width: 120px; min-width: 0; }
.portal-tabbar a span:not(.dot-badge) { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-tabbar a .bi { font-size: 21px; line-height: 1; }
.portal-tabbar a.is-active { color: var(--primary); background: var(--primary-soft); }
@media (min-width: 760px) { .portal-tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 560px; bottom: 12px; border: 1px solid var(--border); border-radius: 22px; } }

.portal-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: none; }
.portal-tabs::-webkit-scrollbar { display: none; }
.portal-tabs a { flex: 0 0 auto; padding: 7px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; font-weight: 600; }
.portal-tabs a.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

.child-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; color: var(--text); }
.child-card:hover { color: var(--text); border-color: var(--ink-300); }
.child-card__head { display: flex; align-items: center; gap: 12px; }
.child-card__head b { display: block; font-size: 16px; }
.child-card__head small { color: var(--text-muted); }
.child-card__today { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.child-card__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.child-card__stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.child-card__stats small { display: block; font-size: 11.5px; color: var(--text-muted); }
.child-card__stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.child-card__grades { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 12px; font-size: 12px; color: var(--text-muted); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--text-muted); }
.pill--green { background: var(--green-100); color: var(--green-600); }
.pill--red { background: var(--red-100); color: var(--red-600); }
.pill--amber { background: var(--amber-100); color: #a35f05; }

.att-cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.att-cal th { text-align: center; font-size: 11.5px; color: var(--text-muted); font-weight: 600; padding: 6px 0 2px; }
.att-cal td { text-align: center; height: 40px; border-radius: 10px; background: var(--surface-2); font-weight: 600; font-size: 13px; }
.att-cal td.is-out { background: transparent; color: var(--ink-300); }
.att-cal td.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.att-cal td.st-present { background: var(--green-100); color: var(--green-600); }
.att-cal td.st-late { background: var(--amber-100); color: #a35f05; }
.att-cal td.st-absent { background: var(--red-100); color: var(--red-600); }
.att-cal td.st-excused { background: var(--blue-100); color: var(--blue-600); }

.portal-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(80% 60% at 50% 0%, var(--brand-50), transparent), var(--bg); }
.portal-login__box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 28px 24px; }
.portal-login .brand-mark { display: grid; }
body.portal:has(.portal-login) { padding-bottom: 0; }

/* --- Onlayn test --- */
.take .portal-main { padding-bottom: 32px; }
.timer { font-weight: 800; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.12); color: #fff; padding: 6px 12px; border-radius: 999px; }
.timer.is-low { background: var(--red-600); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .7; } }
.q-nav { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; background: var(--bg); margin-bottom: 8px; }
.q-nav a { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.q-nav a.is-done { background: var(--primary); border-color: var(--primary); color: #fff; }
.q-card { scroll-margin-top: 64px; border: 1px solid var(--border); }
.q-card--ok { border-left: 4px solid var(--green-600); }
.q-card--bad { border-left: 4px solid var(--red-600); }
.q-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.q-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.q-option .form-check-input { margin-top: 3px; flex: 0 0 auto; }
.q-img { max-width: 100%; max-height: 320px; border-radius: 8px; }
.q-status { display: block; min-height: 1.2em; margin-top: 4px; }
.q-review { list-style: none; padding: 0; margin: 0; }
.q-review li { padding: 6px 10px; border-radius: 8px; margin-bottom: 4px; }
.q-review li.is-correct { background: var(--green-100); color: var(--green-600); font-weight: 600; }
.q-review li.is-selected:not(.is-correct) { background: var(--red-100); color: var(--red-600); }
.code-input { font-family: ui-monospace, monospace; letter-spacing: 4px; text-transform: uppercase; font-weight: 700; }

/* --- Bosh sahifa (mobil dizayn) ---------------------------------------------------------- */
body.portal { --t-violet: #7c3aed; --t-violet-bg: #f1ebfe; --t-green: #12a06b; --t-green-bg: #e3f6ee; --t-blue: #2f6bf0; --t-blue-bg: #e6eefe;
  --t-amber: #e8930c; --t-amber-bg: #fdf1dd; --t-red: #e0384e; --t-red-bg: #fde8eb; --card-shadow: 0 1px 2px rgba(17,29,51,.04), 0 10px 24px -14px rgba(17,29,51,.18); }
:root[data-theme="dark"] body.portal { --t-violet: #a78bfa; --t-violet-bg: rgba(167,139,250,.14); --t-green: #34d399; --t-green-bg: rgba(52,211,153,.13);
  --t-blue: #7aa5ff; --t-blue-bg: rgba(122,165,255,.14); --t-amber: #fbbf24; --t-amber-bg: rgba(251,191,36,.13); --t-red: #fb7185; --t-red-bg: rgba(251,113,133,.14); --card-shadow: none; }
.portal .tone-violet { background: var(--t-violet-bg); color: var(--t-violet); }
.portal .tone-green { background: var(--t-green-bg); color: var(--t-green); }
.portal .tone-blue { background: var(--t-blue-bg); color: var(--t-blue); }
.portal .tone-amber { background: var(--t-amber-bg); color: var(--t-amber); }
.portal .tone-red { background: var(--t-red-bg); color: var(--t-red); }
.portal .tone-muted { background: var(--surface-2); color: var(--text-muted); }

.kid-switch { display: flex; gap: 8px; overflow-x: auto; margin: 2px 0 12px; scrollbar-width: none; }
.kid-switch::-webkit-scrollbar { display: none; }
.kid-switch a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 14px; }
.kid-switch__av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--t-violet-bg); color: var(--t-violet); }
.kid-switch a.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.kid-switch a.is-active .kid-switch__av { background: rgba(255,255,255,.22); color: #fff; }

.hero-card, .panel, .kpi, .ann-card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.hero-card { border-radius: 24px; padding: 16px; margin-bottom: 14px; }
.hero-card__head { display: flex; align-items: center; gap: 16px; color: var(--text); }
.hero-card__head:hover { color: var(--text); }
.hero-card__head > .bi { color: var(--text-muted); font-size: 18px; }
.hero-card__av { width: 76px; height: 76px; flex: 0 0 auto; border-radius: 22px; display: grid; place-items: center; overflow: hidden; font-size: 26px; font-weight: 800; color: var(--primary); background: var(--t-violet-bg); }
.hero-card__av img { width: 100%; height: 100%; object-fit: cover; }
.hero-card__who { flex: 1; min-width: 0; }
.hero-card__who b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.015em; line-height: 1.2; }
.hero-card__who small { display: block; margin-top: 4px; font-size: 14px; color: var(--text-muted); }
.today-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 14px; border-radius: 14px; font-weight: 700; font-size: 14.5px; background: var(--surface-2); color: var(--text-muted); }
.today-bar .bi:first-child { font-size: 18px; }
.today-bar--green { background: var(--t-green-bg); color: var(--t-green); }
.today-bar--red { background: var(--t-red-bg); color: var(--t-red); }
.today-bar--amber { background: var(--t-amber-bg); color: var(--t-amber); }
.today-bar:hover { filter: brightness(.98); }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.kpi-grid--no-balance .kpi:nth-child(3) { grid-column: 1 / -1; }
.kpi { position: relative; display: flex; align-items: flex-start; gap: 10px; min-height: 118px; padding: 14px; border-radius: 20px; color: var(--text); overflow: hidden; }
.kpi:hover { color: var(--text); }
.kpi__icon { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center; font-size: 21px; }
.kpi__body { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; }
.kpi__body small { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.kpi__body b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi__unit { font-size: 13px; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.kpi__money { font-size: 21px !important; white-space: nowrap; }
.kpi__go { position: absolute; right: 12px; top: 16px; color: var(--text-muted); }
.kpi__spark { position: absolute; right: 0; bottom: 10px; width: 52%; height: 54px; }
.delta { font-style: normal; font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-top: 6px; display: inline-flex; align-items: center; gap: 2px; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); width: max-content; }
.delta--up { color: var(--t-green); background: var(--t-green-bg); }
.delta--down { color: var(--t-red); background: var(--t-red-bg); }
.kpi--violet .kpi__icon { background: var(--t-violet-bg); color: var(--t-violet); }
.kpi--violet .kpi__spark { color: var(--t-violet); }
.kpi--green .kpi__icon { background: var(--t-green-bg); color: var(--t-green); }
.kpi--green .kpi__spark { color: var(--t-green); }
.kpi--blue { background: linear-gradient(160deg, var(--t-blue-bg), var(--surface) 70%); }
.kpi--blue .kpi__icon { background: var(--t-blue-bg); color: var(--t-blue); }
.kpi--red { background: linear-gradient(160deg, var(--t-red-bg), var(--surface) 75%); border-color: color-mix(in srgb, var(--t-red) 22%, var(--border)); }
.kpi--red .kpi__icon { background: var(--t-red-bg); color: var(--t-red); }
.kpi--red .kpi__money { color: var(--t-red); }
.kpi--green .kpi__money { color: var(--t-green); }

.panel { border-radius: 24px; padding: 14px 14px 10px; margin-bottom: 18px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 2px 10px; }
.panel__head h2, .ann-block__head h2 { min-width: 0; display: flex; align-items: center; gap: 10px; margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.panel__head h2 .bi, .ann-block__head h2 .bi { color: var(--primary); font-size: 21px; }
.chip-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 14px; }
.panel__empty { color: var(--text-muted); margin: 6px 4px 10px; font-size: 14px; }
.subj-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(56px, 26%) 44px 14px; align-items: center; gap: 12px; padding: 6px; margin-bottom: 4px; border-radius: 14px; color: var(--text); }
.subj-row:hover { color: var(--text); background: var(--surface-2); }
.subj-row__icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; }
.subj-row__name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subj-row__bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.subj-row__bar span { display: block; height: 100%; border-radius: 99px; }
.fill-green { background: var(--t-green); } .fill-blue { background: var(--t-blue); } .fill-amber { background: var(--t-amber); }
.fill-red { background: var(--t-red); } .fill-muted { background: var(--ink-300); }
.subj-row__grade { height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.subj-row__go { color: var(--text-muted); font-size: 13px; }

.ann-block { margin-bottom: 8px; }
.ann-block__head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 12px; }
.ann-block__head a { font-weight: 600; font-size: 15px; }
.ann-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 78%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: none; }
.ann-scroll::-webkit-scrollbar { display: none; }
.ann-card { scroll-snap-align: start; position: relative; display: flex; gap: 12px; padding: 14px 26px 14px 12px; border-radius: 20px; color: var(--text); min-height: 118px; }
.ann-card:hover { color: var(--text); }
.ann-card__icon { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 13px; display: grid; place-items: center; font-size: 20px; }
.ann-card__body { min-width: 0; display: flex; flex-direction: column; }
.ann-card__body b { font-size: 15px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ann-card__body small { color: var(--text-muted); margin: 4px 0; }
.ann-card__body span { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ann-card__go { position: absolute; right: 10px; top: 16px; color: var(--text-muted); }

@media (max-width: 380px) {
  .kpi { min-height: 108px; padding: 12px; gap: 8px; }
  .kpi__icon { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; }
  .kpi__body b { font-size: 22px; }
  .kpi__money { font-size: 17px !important; }
  .hero-card__av { width: 60px; height: 60px; font-size: 21px; border-radius: 18px; }
  .hero-card__who b { font-size: 17px; }
  .subj-row { grid-template-columns: 38px minmax(0, 1fr) 48px 40px 12px; gap: 8px; }
}
@media (min-width: 560px) { .ann-scroll { grid-auto-columns: calc(50% - 6px); } }
.kpi__body { flex: 1; }
.kpi__body small { padding-right: 14px; }
/* Tor kartada (telefon) belgi tepada, matn ostida — katta summa ham sig'adi */
@media (max-width: 459px) {
  .kpi { flex-direction: column; gap: 10px; }
  .kpi__spark { width: 46%; height: 34px; bottom: 16px; }
  .kpi__money { font-size: 20px !important; }
}
@media (max-width: 459px) { .panel__head h2, .ann-block__head h2 { font-size: 16.5px; gap: 8px; } .chip-link { font-size: 13px; padding: 5px 10px; flex: 0 0 auto; } }
:root[data-theme="dark"] body.portal .chip-link, :root[data-theme="dark"] .portal-tabbar a.is-active,
:root[data-theme="dark"] body.portal .panel__head h2 .bi, :root[data-theme="dark"] body.portal .ann-block__head h2 .bi,
:root[data-theme="dark"] body.portal .ann-block__head a, :root[data-theme="dark"] body.portal .hero-card__av { color: #a5b4fc; }
:root[data-theme="dark"] .portal-tabbar a.is-active, :root[data-theme="dark"] body.portal .chip-link { background: rgba(129,140,248,.16); }
@media (max-width: 380px) {
  .kpi__spark { height: 26px !important; bottom: 12px !important; width: 42% !important; }
  .portal-brand b { font-size: 15px; }
  .portal-logo { width: 42px; height: 42px; font-size: 20px; }
  .top-btn { width: 40px; height: 40px; }
  .portal-tabbar a { font-size: 11px; }
}
.hw-grade { display: inline-grid; place-items: center; min-width: 28px; height: 28px; margin-left: 6px; border-radius: 8px; background: var(--brand-100); color: var(--brand-600); font-weight: 800; }
