/* ===================================================================
   SafeStudy — Ota-ona kabineti (/ota) uslublari.

   Ilgari bu blok `ota.html` ichida turardi. U yerdan chiqarilishining
   ikki sababi bor:
     1) Sahifaning o'zi `no-cache` bilan beriladi (ota-ona har doim eng
        so'nggi holatni ko'rishi kerak), demak ichki uslub ham har safar
        qaytadan yuklanardi. Alohida fayl bir yil keshlanadi.
     2) Content-Security-Policy ichki `<style>` ga `unsafe-inline`
        talab qilardi — bu esa himoyani deyarli bekor qiladi.
   =================================================================== */

    /* ==================================================================
       OTA-ONA KABINETI — PROFESSIONAL & PREMIUM DIZAYN TIZIMI
       ================================================================== */
    .num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

    body {
        background: var(--bg-body);
        min-height: 100vh;
        color: var(--text-primary);
    }
    .hide { display: none !important; }

    /* Ikonkalar `icons.js` orqali SVG ga aylanadi. SVG shrift glifi bilan
       bir xil o'lchamda bo'lishi uchun 1em — har joydagi font-size
       (.ds-emo, .fp-done-ico va h.k.) avvalgidek ishlayveradi. */
    .material-symbols-rounded > .ss-svg-icon { width: 1em; height: 1em; }

    /* ---- YUQORI PANEL (PREMIUM HEADER) ---- */
    .top {
        position: sticky; top: 0; z-index: 50;
        background: var(--bg-nav);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: 2px solid var(--border-hairline);
        padding-top: env(safe-area-inset-top, 0px);
        transition: background var(--dur-normal, .24s) ease;
    }
    .top-in {
        max-width: 1140px; margin: 0 auto; padding: 11px 20px;
        display: flex; align-items: center; gap: 14px;
    }
    .brand {
        display: flex; align-items: center; gap: 12px;
        text-decoration: none; min-width: 0;
    }
    .brand img { height: 34px; width: auto; display: block; }
    html.theme-light .brand img {
        filter: drop-shadow(0 0 1px var(--edge));
    }
    .brand-text-group { display: flex; flex-direction: column; gap: 2px; }
    .brand-main {
        font-size: 15px; font-weight: 800; color: var(--text-primary);
        letter-spacing: -.02em; line-height: 1.15;
    }
    .brand-badge {
        font-size: 12px; font-weight: 700; color: var(--accent-blue-text);
        text-transform: uppercase; letter-spacing: .08em;
    }
    .top-sep { flex: 1 1 auto; }
    .top-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

    .top-link-btn {
        display: inline-flex; align-items: center; gap: 6px;
        min-height: 40px; box-sizing: border-box; /* belgi tugmalari bilan bir xil balandlik */
        padding: 7px 13px; font-size: 12.5px; font-weight: 700;
        border-radius: var(--radius-md); text-decoration: none;
        border: 2px solid var(--border-subtle);
        background: var(--bg-surface); color: var(--text-secondary);
        transition: all var(--dur-quick, .16s) ease;
    }
    .top-link-btn:hover {
        border-color: var(--border-strong);
        background: var(--bg-surface-elevated);
        color: var(--text-primary);
    }
    .top-link-btn.tg-btn {
        background: var(--primary-soft);
        border-color: var(--primary);
        color: var(--primary-text);
    }
    html:not(.theme-light) .top-link-btn.tg-btn {
        color: var(--primary-text);
    }
    .top-link-btn.tg-btn:hover {
        background: var(--primary-soft);
        border-color: var(--primary);
    }

    .ico-btn {
        width: 40px; height: 40px; flex-shrink: 0;
        display: grid; place-items: center;
        border-radius: var(--radius-md);
        border: 2px solid var(--border-subtle);
        background: var(--bg-surface);
        color: var(--text-secondary);
        font-size: 16px; cursor: pointer; font-family: inherit;
        transition: border-color var(--dur-quick, .16s) ease, background var(--dur-quick, .16s) ease;
    }
    .ico-btn:hover { border-color: var(--border-strong); background: var(--bg-surface-elevated); }
    .ico-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

    .shell {
        width: 100%; max-width: 1140px; margin: 0 auto;
        padding: 24px 20px calc(64px + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
    }

    /* ---- KIRISH OYNASI ---- */
    .auth-wrap {
        display: grid; place-items: center;
        min-height: calc(100vh - 65px - env(safe-area-inset-top, 0px));
        padding: 24px 0 48px;
    }
    .auth {
        width: 100%; max-width: 440px;
        background: var(--surface);
        border: var(--stroke-line) solid var(--outline);
        border-radius: var(--radius-xl);
        padding: 36px 32px 30px;
        box-shadow: var(--sticker-lg);
        position: relative;
    }
    .auth-mark {
        width: 58px; height: 58px; margin: 0 auto 20px;
        border-radius: 18px; display: grid; place-items: center;
        background: var(--primary);
        color: var(--on-primary);
        border: var(--stroke-line) solid var(--edge);
        box-shadow: var(--sticker-sm);
    }
    .auth-mark svg { width: 30px; height: 30px; display: block; }
    .auth h1, .auth h2 { font-size: 22px; line-height: 1.25; text-align: center; margin: 0 0 8px; }
    .auth-sub {
        text-align: center; color: var(--text-muted);
        font-size: 13.5px; line-height: 1.6; margin: 0 0 24px;
    }
    .auth-sub b { color: var(--text-secondary); font-family: var(--font-display); font-weight: 700; }
    .auth-note {
        font-size: 12.5px; color: var(--text-muted);
        line-height: 1.65; margin: 18px 0 0; text-align: center;
    }
    .auth-note a { color: var(--accent-blue-text); font-weight: 700; text-decoration: none; }
    .auth-note a:hover { text-decoration: underline; }

    .auth-features-preview {
        display: grid; gap: 8px; margin-top: 24px; padding-top: 20px;
        border-top: 2px dashed var(--border-hairline);
    }
    .af-item {
        display: flex; align-items: center; gap: 9px;
        font-size: 12px; color: var(--text-muted); line-height: 1.4;
    }
    .af-item i { font-style: normal; font-size: 14px; }

    .field { margin-bottom: 18px; }
    .field > label {
        display: block; font-size: 12.5px; font-weight: 700;
        color: var(--text-secondary); margin-bottom: 8px;
    }
    .field input { width: 100%; box-sizing: border-box; }
    /* Hamma forma maydonlari (parol, matn, PIN/raqam): telefon maydoni
       bilan bir xil balandlik (48px) va 2px kontur — DS forma qoidasi.
       Ilgari faqat parol/matn qamrab olinardi, PIN oynasidagi "tel"
       maydon esa 19px yassi bo'lib qolardi. */
    /* :where — past aniqlik: .tel-box / .pwd-box ichidagi maydonlar o'z
       uslubini (kontursiz, mono shrift) saqlab qoladi. */
    .field :where(input:not(.otp-real):not([type="checkbox"]):not([type="radio"])) {
        min-height: 48px; padding: 12px 14px;
        font-family: var(--font-sans); font-size: 16px; font-weight: 700;
        color: var(--ink);
        background: var(--field);
        border: var(--stroke-line) solid var(--line-strong); border-radius: var(--radius-md);
    }
    .field :where(input:not(.otp-real))::placeholder { color: var(--ink-subtle); font-weight: 600; }
    .field input[inputmode="numeric"] {
        font-family: var(--font-mono); font-size: 20px; letter-spacing: .3em; text-align: center;
    }
    .field input[inputmode="numeric"]::placeholder { letter-spacing: .3em; }
    .field :where(input:not(.otp-real)):focus {
        outline: none; background: var(--surface); border-color: var(--grape); box-shadow: 0 0 0 4px var(--grape-soft);
    }
    .btn-full { width: 100%; }

    .tel-box {
        display: flex; align-items: stretch;
        border: 2px solid var(--border-subtle);
        border-radius: var(--radius-md);
        background: var(--bg-body);
        overflow: hidden;
        transition: border-color var(--dur-quick, .16s) ease, box-shadow var(--dur-quick, .16s) ease;
    }
    /* Parol maydoni: ko'rsatish tugmasi bilan */
    .pwd-box {
        display: flex; align-items: stretch;
        border: 2px solid var(--border-subtle);
        border-radius: var(--radius-md);
        background: var(--bg-body);
        overflow: hidden;
    }
    .pwd-box:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-soft); }
    .pwd-box input { flex: 1; min-width: 0; min-height: 44px; border: 0 !important; box-shadow: none !important; background: transparent !important; border-radius: 0 !important; }
    .pwd-eye {
        display: grid; place-items: center; width: 48px; flex-shrink: 0;
        background: transparent; border: 0; border-left: 2px solid var(--border-subtle);
        color: var(--ink-muted); cursor: pointer;
    }
    .pwd-eye:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
    .pwd-rules { list-style: none; margin: -4px 0 14px; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-muted); align-items: center; }
    .pwd-rules li { display: inline-flex; align-items: center; gap: 6px; }
    .pwd-rules li::before {
        content: "";
        display: inline-block;
        width: 10px;
        height: 10px;
        border: 2px solid currentColor;
        border-radius: 50%;
    }
    .pwd-rules li.ok { color: var(--success-text); font-weight: 700; }
    .pwd-rules li.ok::before {
        content: "";
        width: 10px;
        height: 6px;
        border: none;
        border-left: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        border-radius: 0;
        transform: rotate(-45deg);
        margin-bottom: 3px;
    }
    .tel-box:focus-within {
        border-color: var(--border-focus);
        box-shadow: 0 0 0 3px var(--primary-soft);
    }
    .tel-pre {
        display: grid; place-items: center; padding: 0 13px;
        font-family: var(--font-mono); font-size: 15px; font-weight: 700;
        color: var(--text-muted); background: var(--bg-surface-elevated);
        border-right: 2px solid var(--border-hairline); user-select: none;
    }
    .tel-box input {
        flex: 1 1 auto; min-width: 0;
        border: none !important; background: transparent !important;
        box-shadow:none !important; outline: none !important;
        padding: 14px 14px !important;
        font-family: var(--font-mono); font-size: 16px; font-weight: 700;
        letter-spacing: .06em; color: var(--text-primary);
    }

    .otp { position: relative; }
    .otp-real {
        position: absolute; inset: 0; width: 100%; height: 100%;
        opacity: 0; border: none; padding: 0; margin: 0;
        font-size: 16px; cursor: text; z-index: 2;
    }
    .otp-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
    .otp-cells i {
        height: 56px; border-radius: var(--radius-md);
        border: 2px solid var(--line-strong);
        background: var(--field);
        display: grid; place-items: center;
        font-family: var(--font-mono); font-size: 22px; font-weight: 700;
        font-style: normal; color: var(--text-primary);
        transition: border-color .14s ease, background .14s ease;
    }
    .otp-cells i.on { border-color: var(--border-focus); background: var(--bg-surface-elevated); }
    .otp-cells i.cur { border-color: var(--border-focus); box-shadow:0 0 0 3px var(--primary-soft); }
    .otp-cells i.cur::after {
        content: ''; width: 2px; height: 24px;
        background: var(--accent-blue); border-radius: 2px;
        animation: caret 1.05s steps(1, end) infinite;
    }
    @keyframes caret { 0%, 45% { opacity: 1; } 46%, 100% { opacity: 0; } }
    .otp.bad .otp-cells i { border-color: var(--danger); background: var(--danger-soft); }

    .link-btn {
        background: none; border: none; padding: 9px; width: 100%;
        font-family: inherit; font-size: 13px; font-weight: 700;
        color: var(--text-muted); cursor: pointer; border-radius: var(--radius-sm);
    }
    .link-btn:hover:not(:disabled) { color: var(--text-primary); }
    .link-btn:disabled { opacity: .55; cursor: default; }

    /* ---- BOSHQARUV PANELI: ASOSIY BLOKLAR ---- */
    .pbar {
        display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
        background: var(--bg-surface);
        border: 2px solid var(--border-subtle);
        border-radius: var(--radius-lg);
        padding: 18px 22px; margin-bottom: 16px;
    }
    .pbar-who { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 auto; }
    .av {
        width: 48px; height: 48px; flex-shrink: 0;
        border-radius: var(--radius-full); display: grid; place-items: center;
        font-size: 22px; background: var(--bg-surface-elevated);
        border: 2px solid var(--border-hairline);
    }
    .pbar-name { font-size: 17px; font-weight: 800; line-height: 1.3; }
    .pbar-phone {
        font-size: 13px; color: var(--text-muted); margin-top: 3px;
        font-family: var(--font-display); letter-spacing: .01em;
    }
    .pbar-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

    /* Umumiy ko'rsatkichlar kartalari */
    .sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
    .sum-card {
        background: var(--bg-surface); border: 2px solid var(--border-subtle);
        border-radius: var(--radius-lg); padding: 16px 18px;
        position: relative; overflow: hidden;
    }
    .sum-card b { display: block; font-size: 22px; font-weight: 800; line-height: 1.15; }
    .sum-card span {
        display: block; margin-top: 5px; font-size: 11px; font-weight: 700;
        color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
    }
    .sum-card.hot { background: var(--sun-soft); }
    .sum-card.hot b { color: var(--sun-text); }
    .sum-card.tg-card { border-color: var(--primary); background: var(--primary-soft); }
    .sum-card.tg-card b { font-size: 16px; color: var(--primary-text); }
    html:not(.theme-light) .sum-card.tg-card b { color: var(--primary-text); }

    /* TEZKOR REJIMLAR PANELI (SMART QUICK MODES) */
    .quick-modes {
        background: var(--bg-surface);
        border: 2px solid var(--border-subtle);
        border-radius: var(--radius-lg);
        padding: 16px 20px; margin-bottom: 22px;
        display: flex; align-items: center; justify-content: space-between;
        gap: 16px; flex-wrap: wrap;
    }
    .qm-info { display: flex; align-items: center; gap: 12px; }
    .qm-icon {
        width: 38px; height: 38px; border-radius: 10px;
        background: var(--wash-blue); color: var(--accent-blue-text);
        display: grid; place-items: center; font-size: 18px;
    }
    .qm-title { font-size: 14px; font-weight: 800; }
    .qm-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
    .qm-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

    /* FARZAND KARTASI */
    .kids { display: grid; gap: 22px; }
    .kid {
        background: var(--bg-surface);
        border: 2px solid var(--border-subtle);
        border-radius: var(--radius-xl);
        overflow: hidden;
        box-shadow: var(--shadow-sm);
    }
    .kid.locked { border-color: var(--danger); }

    .kid-head {
        display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
        padding: 22px;
    }
    .kid-who { display: flex; gap: 14px; min-width: 0; flex: 1 1 220px; align-items: flex-start; }
    .kid-av { position: relative; }
    .kid-av::after {
        content: ''; position: absolute; right: -1px; bottom: -1px;
        width: 13px; height: 13px; border-radius: 50%;
        border: 2.5px solid var(--bg-surface); background: var(--text-muted);
    }
    .kid-av.on::after { background: var(--accent-emerald); box-shadow:none; }
    .kid-name {
        font-size: 18px; font-weight: 800; line-height: 1.3;
        display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    }
    .kid-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.55; }
    .kid-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

    .chip {
        display: inline-flex; align-items: center; gap: 5px;
        font-size: 11px; font-weight: 800; padding: 4px 10px;
        border-radius: var(--radius-full); letter-spacing: .03em;
        text-transform: uppercase; white-space: nowrap;
    }
    .chip-rose { background: var(--wash-rose); color: var(--accent-rose-text); }
    .chip-amber { background: var(--wash-amber); color: var(--accent-amber-text); }
    .chip-emerald { background: var(--wash-emerald); color: var(--accent-emerald-text); }
    .chip-blue { background: var(--wash-blue); color: var(--accent-blue-text); }
    .chip-mute { background: var(--bg-surface-elevated); color: var(--text-muted); }

    .ask {
        margin: 0 22px 18px; padding: 16px 18px;
        border-radius: var(--radius-lg);
        background: var(--surface);
        border: var(--stroke-line) solid var(--outline);
        box-shadow: var(--sticker-sm);
        display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    }
    /* Kunduzi och sariq fon chiroyli; tunda --sun-soft loyqa zaytun
       rangga o'xshab qoladi — u yerda oddiy karta + sariq belgi. */
    html.theme-light .ask { background: var(--sun-soft); }
    .ask-txt {
        flex: 1 1 220px; display: flex; align-items: center; gap: 10px;
        font-size: 14px; line-height: 1.5; color: var(--ink);
    }
    .ask-txt .material-symbols-rounded {
        width: 32px; height: 32px; flex-shrink: 0;
        display: grid; place-items: center; font-size: 19px;
        border-radius: var(--radius-pill);
        background: var(--sun); color: var(--on-sun);
        border: var(--stroke-line) solid var(--edge);
    }
    .ask-txt b { color: var(--ink); font-family: var(--font-display); }
    .ask-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

    /* OVQATLANISH OGOHLANTIRISHI (MEALTIME ALERT) */
    .meal-alert {
        margin: 0 22px 18px; padding: 16px 18px;
        border-radius: var(--radius-lg);
        background: var(--surface);
        border: var(--stroke-line) solid var(--edge);
        box-shadow: var(--sticker-md);
        display: flex; flex-direction: column; gap: 8px;
    }
    .meal-alert.hot {
        background: var(--sun-soft);
        border-color: var(--sun-text);
    }
    .meal-alert-title {
        display: flex; align-items: center; gap: 8px;
        font-family: var(--font-display); font-size: 16px; font-weight: 800; color: var(--ink);
    }
    .meal-alert-sub {
        font-size: 13.5px; color: var(--ink-muted); margin: 0; line-height: 1.4;
    }
    .meal-alert-acts {
        display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px;
    }

    /* REJIMLAR PANELI: UYQU VA OVQAT (SMART MODES) */
    .kid-modes-bar {
        display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
        padding: 0 22px 18px;
    }
    .mode-tile {
        background: var(--surface);
        border: var(--stroke-line) solid var(--outline);
        border-radius: var(--radius-lg);
        box-shadow: var(--sticker-sm);
        padding: 12px 16px;
        display: flex; align-items: center; justify-content: space-between;
        gap: 12px;
        transition: transform 120ms, box-shadow 120ms;
    }
    .mode-tile.mode-active {
        border-color: var(--edge);
        background: var(--primary-soft);
        box-shadow: var(--sticker-md);
    }
    .mode-info {
        display: flex; align-items: center; gap: 10px; min-width: 0;
    }
    .mode-icon {
        width: 36px; height: 36px; border-radius: var(--radius-md);
        display: grid; place-items: center;
        background: var(--grape-soft); color: var(--grape);
        border: 2px solid var(--edge);
        flex-shrink: 0;
    }
    .mode-tile.mode-active .mode-icon {
        background: var(--sun); color: var(--on-sun);
    }
    .mode-info b {
        display: block; font-family: var(--font-display); font-size: 14.5px;
        font-weight: 800; color: var(--ink); line-height: 1.2;
    }
    .mode-desc {
        display: block; font-size: 12px; color: var(--ink-muted); margin-top: 2px;
    }

    .stats {
        display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
        padding: 0 22px 20px;
    }
    .stat {
        background: var(--bg-body); border: 2px solid var(--border-hairline);
        border-radius: var(--radius-md); padding: 14px 16px;
    }
    .stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.2; }
    .stat span {
        display: block; margin-top: 4px; font-size: 11px; font-weight: 700;
        color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
    }
    .stat-row { display: flex; align-items: center; gap: 9px; }
    .stat-row b { white-space: nowrap; }
    .step {
        width: 28px; height: 28px; flex-shrink: 0;
        border-radius: var(--radius-sm); border: 2px solid var(--border-subtle);
        background: var(--bg-surface-elevated); color: var(--text-primary);
        font-size: 16px; font-weight: 800; line-height: 1; cursor: pointer;
        display: grid; place-items: center; font-family: inherit;
    }
    .step:hover:not(:disabled) { border-color: var(--border-focus); background: var(--bg-surface); }
    .step:disabled { opacity: .38; cursor: not-allowed; }

    /* ---- ILOVALAR QIDIRUVI VA FILTRI ---- */
    .apps-panel-top {
        border-top: 2px solid var(--border-hairline);
        padding: 18px 22px 14px; display: grid; gap: 12px;
    }
    .apps-head-line {
        display: flex; align-items: center; justify-content: space-between;
        gap: 12px; flex-wrap: wrap;
    }
    .apps-head-line h3 {
        font-size: 13px; margin: 0; text-transform: uppercase;
        letter-spacing: .08em; color: var(--text-muted); font-weight: 800;
    }
    .apps-search-wrap {
        display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    }
    .app-search-input {
        flex: 1 1 200px; max-width: 320px;
        font-family: inherit; font-size: 13px;
        padding: 8px 12px; border-radius: var(--radius-md);
        border: 2px solid var(--border-subtle);
        background: var(--bg-body); color: var(--text-primary);
    }
    .app-search-input:focus {
        outline: none; border-color: var(--border-focus);
        box-shadow:0 0 0 3px var(--primary-soft);
    }

    .apps-filters {
        display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    }
    .app-filter-btn {
        font-family: inherit; font-size: 11.5px; font-weight: 700;
        padding: 5px 11px; border-radius: var(--radius-full);
        border: 2px solid var(--border-subtle);
        background: var(--bg-surface-elevated); color: var(--text-muted);
        cursor: pointer; transition: all .14s ease;
    }
    .app-filter-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
    .app-filter-btn.active {
        background: var(--accent-blue); color: var(--on-primary); border-color: var(--accent-blue);
    }

    /* Ommaviy amallar qatori */
    .batch-bar {
        display: flex; align-items: center; justify-content: space-between;
        gap: 10px; flex-wrap: wrap; padding: 10px 14px;
        background: var(--bg-surface-elevated); border-radius: var(--radius-md);
        font-size: 12px; font-weight: 700; color: var(--text-secondary);
    }
    .batch-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
    .btn-tiny {
        padding: 5px 9px; font-size: 11px; font-weight: 700;
        border-radius: var(--radius-sm); cursor: pointer;
        border: 2px solid var(--border-subtle);
        background: var(--bg-surface); color: var(--text-primary);
        font-family: inherit;
    }
    .btn-tiny:hover { border-color: var(--border-strong); }

    .apps { padding: 0 22px 22px; display: grid; gap: 10px; }
    .app {
        display: grid; grid-template-columns: minmax(0, 1fr) auto;
        gap: 14px; align-items: center;
        padding: 14px 16px;
        border: 2px solid var(--border-hairline);
        border-radius: var(--radius-lg);
        background: var(--bg-body);
        transition: border-color .15s ease;
    }
    /* Holat qator konturida emas, o'ngdagi segmentda ko'rinadi
       (sariq/qizil kontur ko'zni charchatardi). Yopiq ilova esa
       xiraroq fon bilan ajralib turadi. */
    .app.s-hard { background: var(--surface-sunken); }
    .app-l { display: flex; gap: 13px; align-items: center; min-width: 0; }
    .app-mark {
        width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px;
        display: grid; place-items: center;
        font-size: 15px; font-weight: 800; color: var(--on-grape); background: var(--grape); border: 2px solid var(--edge);
    }
    .app-body { min-width: 0; }
    .app-name {
        font-size: 14px; font-weight: 700; line-height: 1.35;
        display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
    }
    .app-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
    .bar { height: 5px; border-radius: 4px; background: var(--bg-surface-elevated); margin-top: 7px; overflow: hidden; }
    .bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent-emerald); transition: width .3s ease; }
    .bar.mid i { background: var(--sun); }
    .bar.max i { background: var(--accent-rose); }
    .app-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

    .seg {
        display: inline-flex; background: var(--bg-surface-elevated);
        border: 2px solid var(--border-subtle); border-radius: var(--radius-md);
        padding: 3px; gap: 3px;
    }
    .seg button {
        border: none; background: none; color: var(--text-muted);
        font-family: inherit; font-size: 12px; font-weight: 700;
        padding: 7px 12px; border-radius: calc(var(--radius-md) - 4px);
        cursor: pointer; white-space: nowrap;
        transition: background .14s ease, color .14s ease;
    }
    .seg button:hover:not(.on) { color: var(--text-primary); }
    .seg button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
    /* Faol holat: to'liq rang + o'sha rangning o'z yozuv tokeni (--on-*).
       Ilgari "Test" sariq fonda --sun-text bilan yozilardi: tungi
       rejimda u sariq ustida sariq bo'lib, umuman o'qilmasdi. */
    .seg button { border: 2px solid transparent; }
    .seg button.on { border-color: var(--edge); box-shadow: 0 2px 0 0 var(--edge); }
    .seg button.on[data-state="open"] { background: var(--success); color: var(--on-success); }
    .seg button.on[data-state="quiz"] { background: var(--sun); color: var(--on-sun); }
    .seg button.on[data-state="hard"] { background: var(--danger); color: var(--on-danger); }
    .seg.busy { opacity: .5; pointer-events: none; }

    .sel {
        font-family: inherit; font-size: 12.5px; font-weight: 700;
        padding: 8px 11px; border-radius: var(--radius-md);
        background: var(--bg-surface-elevated); color: var(--text-primary);
        border: 2px solid var(--border-subtle); cursor: pointer;
        max-width: 152px;
    }
    .sel:focus-visible { outline: none; border-color: var(--border-focus); box-shadow:0 0 0 3px var(--primary-soft); }
    .sel.set { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }

    /* ---- TELEFONNI ULASH (SETUP GUIDE) ---- */
    .setup {
        margin: 0 22px 22px; padding: 20px;
        border: 2px dashed var(--border-strong);
        border-radius: var(--radius-lg); background: var(--bg-body);
    }
    .setup h4 { margin: 0 0 14px; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
    .creds { display: flex; gap: 10px; flex-wrap: wrap; }
    .cred {
        background: var(--bg-surface-elevated); border: 2px solid var(--border-hairline);
        border-radius: var(--radius-md); padding: 10px 15px;
    }
    .cred span {
        display: block; font-size: 11.5px; color: var(--text-muted);
        text-transform: uppercase; letter-spacing: .06em; font-weight: 800;
    }
    .cred b { font-family: var(--font-display); font-size: 17px; letter-spacing: .04em; }

    .setup-steps {
        display: grid; gap: 10px; margin-top: 16px;
        padding-top: 16px; border-top: 2px dashed var(--border-hairline);
    }
    .step-item {
        display: flex; align-items: flex-start; gap: 10px;
        font-size: 12.5px; line-height: 1.55; color: var(--text-secondary);
    }
    .step-num {
        width: 22px; height: 22px; border-radius: 50%;
        background: var(--accent-blue); color: var(--on-primary);
        display: grid; place-items: center; font-size: 11px;
        font-weight: 800; flex-shrink: 0;
    }

    /* ---- TELEGRAM BOT VA PIN MARKAZI KARTALARI ---- */
    .info-grid {
        display: grid; grid-template-columns: repeat(2, 1fr);
        gap: 16px; margin-top: 24px;
    }
    .info-card {
        background: var(--bg-surface); border: 2px solid var(--border-subtle);
        border-radius: var(--radius-lg); padding: 20px;
    }
    .info-card h4 {
        margin: 0 0 10px; font-size: 15px; display: flex;
        align-items: center; gap: 9px;
    }
    .info-card p {
        font-size: 13px; color: var(--text-muted);
        line-height: 1.6; margin: 0 0 16px;
    }
    .info-card ul {
        margin: 0 0 16px; padding-left: 18px; font-size: 12.5px;
        color: var(--text-secondary); line-height: 1.6;
    }

    /* Bo'sh holat va skelton */
    .empty {
        text-align: center; padding: 60px 24px;
        background: var(--bg-surface); border: 2px dashed var(--border-strong);
        border-radius: var(--radius-xl);
    }
    .empty .em { font-size: 46px; margin-bottom: 16px; }
    .empty h2 { font-size: 20px; margin: 0 0 10px; }
    .empty p { color: var(--text-muted); font-size: 14px; line-height: 1.7; max-width: 460px; margin: 0 auto 24px; }

    .skel {
        height: 220px; border-radius: var(--radius-xl);
        border: 2px solid var(--border-subtle);
        background: var(--surface-sunken);
        animation: shine 1.2s ease-in-out infinite alternate;
    }
    @keyframes shine { from { opacity: 1; } to { opacity: .55; } }

    /* Toasts */
    .toasts {
        position: fixed; left: 50%; transform: translateX(-50%);
        bottom: calc(22px + env(safe-area-inset-bottom, 0px)); z-index: 90;
        display: grid; gap: 9px; width: calc(100% - 32px); max-width: 430px;
    }
    .toast {
        display: flex; gap: 11px; align-items: flex-start;
        background: var(--bg-overlay); border: 2px solid var(--border-strong);
        border-radius: var(--radius-md); padding: 13px 16px;
        font-size: 13.5px; font-weight: 600; line-height: 1.5;
        box-shadow: var(--shadow-lg); animation: up .22s ease;
        backdrop-filter: none;
    }
    .toast i { font-style: normal; flex-shrink: 0; }
    .toast.ok { border-color: var(--success); }
    .toast.err { border-color: var(--danger); }
    @keyframes up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

    /* ---- Focus tarifi: holat paneli ----
       Stiker ko'rinishi (kontur, soya, rangli variantlar) sticker.css
       11.3 da; bu yerda faqat maket. */
    .focus-bar {
        display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
        border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 16px;
    }
    .focus-bar-ico {
        width: 44px; height: 44px; flex-shrink: 0;
        display: grid; place-items: center;
        border-radius: var(--radius-md);
        border: var(--stroke-line) solid var(--edge);
        box-shadow: var(--sticker-sm);
    }
    .focus-bar-ico .material-symbols-rounded { font-size: 24px; }
    .focus-bar-txt { flex: 1 1 260px; min-width: 0; }
    .focus-bar-title {
        font-family: var(--font-display); font-weight: 800;
        font-size: 17px; line-height: 1.3; color: var(--ink);
        text-wrap: balance;
    }
    .focus-bar-text { margin: 3px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-muted); }
    .focus-bar .btn { flex-shrink: 0; }
    .focus-bar.is-info .focus-bar-ico   { background: var(--primary); color: var(--on-primary); }
    .focus-bar.is-ok .focus-bar-ico     { background: var(--success); color: var(--on-success); }
    .focus-bar.is-warn .focus-bar-ico   { background: var(--sun);     color: var(--on-sun); }
    .focus-bar.is-danger .focus-bar-ico { background: var(--danger);  color: var(--on-danger); }
    .focus-bar.is-warn .focus-bar-text,
    .focus-bar.is-danger .focus-bar-text { color: var(--ink); }

    /* ---- Focus tarifi: tarif tanlash oynasi ---- */
    .modal-card.fp-card {
        max-width: 620px;
        max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px);
        overflow-y: auto; overscroll-behavior: contain;
    }
    .fp-head { margin-bottom: 14px; }
    .modal-card .fp-title { margin: 4px 0 6px; font-size: 24px; line-height: 1.2; }
    .modal-card .fp-lead { margin: 0; font-size: 14px; color: var(--ink-muted); }
    .fp-feats { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
    .fp-feats li {
        display: flex; gap: 10px; align-items: flex-start;
        font-size: 14px; line-height: 1.45; color: var(--ink);
    }
    .fp-feats .material-symbols-rounded { font-size: 20px; flex-shrink: 0; color: var(--success-text); }
    .fp-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
    .fp-plan {
        display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
        min-height: 140px; padding: 12px 14px 14px;
        border-radius: var(--radius-lg);
        font: inherit; text-align: left; color: var(--ink); cursor: pointer;
    }
    .fp-plan:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
    .fp-plan-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; margin-bottom: 8px; }
    .fp-plan-label { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink-muted); }
    .fp-plan-price { font-size: 21px; line-height: 1.2; color: var(--ink); white-space: nowrap; }
    .fp-plan-sub { font-size: 12.5px; color: var(--ink-muted); }
    .fp-plan-save { margin-top: 4px; font-size: 12.5px; font-weight: 800; color: var(--success-text); }
    .modal-card .fp-note { margin: 14px 0 0; font-size: 12.5px; text-align: center; color: var(--ink-muted); }

    .modal-card.fp-done { text-align: center; }
    .fp-done-ico {
        width: 64px; height: 64px; margin: 0 auto 14px;
        display: grid; place-items: center; border-radius: var(--radius-pill);
        background: var(--success); color: var(--on-success);
        border: var(--stroke-line) solid var(--edge); box-shadow: var(--sticker-md);
    }
    .fp-done-ico .material-symbols-rounded { font-size: 34px; }

    @media (max-width: 600px) {
        .fp-plans { grid-template-columns: 1fr; gap: 10px; }
        .fp-plan {
            min-height: 0;
            display: grid; grid-template-columns: 1fr auto; align-items: center;
            column-gap: 12px; row-gap: 2px;
        }
        .fp-plan-tags { grid-column: 1 / -1; min-height: 0; margin-bottom: 2px; }
        .fp-plan-tags:empty { display: none; }
        .fp-plan-label { grid-column: 1; }
        .fp-plan-sub { grid-column: 1; }
        .fp-plan-save { grid-column: 1; margin-top: 0; }
        .fp-plan-price { grid-column: 2; grid-row: span 2; }
        .modal-card.fp-card { padding: 20px 20px 0; }
        .fp-plan-price { font-size: 19px; }
        .fp-plan-sub { white-space: nowrap; }
        .fp-feats { gap: 6px; margin-bottom: 14px; }
        .fp-feats li { font-size: 13.5px; }
        /* To'lov tugmasi doim ko'rinib tursin: ro'yxat aylantirilsa ham
           oyna pastiga yopishadi. */
        .fp-card .modal-btns {
            position: sticky; bottom: 0; z-index: 1;
            margin: 0 -20px; padding: 12px 20px 16px;
            background: var(--surface);
            border-top: var(--stroke-line) solid var(--line);
        }
        .fp-card [data-pay] { font-size: 16px; min-height: 52px; height: auto; line-height: 1.25; white-space: normal; }
        .modal-card .fp-note { margin: 12px 0 20px; }
    }

    /* Modallar */
    .modal {
        position: fixed; inset: 0; z-index: 100;
        display: grid; place-items: center; padding: 18px;
        background: var(--overlay); backdrop-filter: none;
        animation: fade .16s ease;
    }
    @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
    .modal-card {
        width: 100%; max-width: 420px; background: var(--bg-surface);
        border: 2px solid var(--border-strong); border-radius: var(--radius-xl);
        padding: 26px; box-shadow: var(--shadow-lg); animation: up .2s ease;
    }
    .modal-card h3 { margin: 0 0 9px; font-size: 18px; }
    .modal-card p { margin: 0 0 20px; font-size: 13.5px; color: var(--text-muted); line-height: 1.65; white-space: pre-line; }
    .modal-btns { display: grid; gap: 9px; }
    .modal-btns .btn { width: 100%; }
    .modal-card .creds { display: grid; gap: 9px; margin: 4px 0 16px; }
    .modal-card .cred { padding: 11px 15px; }
    .modal-card .cred b {
        font-size: 22px; font-weight: 700; letter-spacing: .09em;
        user-select: all; -webkit-user-select: all;
    }
    .btn-danger { background: var(--danger); color: var(--on-danger); }
    .btn-danger:hover { opacity: .93; }

    /* RESPONSIVLIK */
    @media (max-width: 860px) {
        .sum { grid-template-columns: repeat(2, 1fr); }
        .info-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 720px) {
        .top-in { padding: 10px 14px; gap: 8px; }
        /* .top-in bilan kuchaytirilgan: sticker.css (oxirida yuklanadi) navbar uchun
           .brand-badge ni ko'rsatib, tugmalarni ikkinchi qatorga itarardi */
        .top-in .brand-badge { display: none; }
        .top-acts { flex-wrap: nowrap; gap: 6px; }
        /* Faqat yozuv yashiriladi. Ilgari "span:last-child" ichki ikonkani ham
           yashirib, telefonda tugmalar butunlay bo'sh (21x17) qolardi. */
        .top-link-btn > span:last-child { display: none; }
        .top-link-btn { padding: 0; width: 40px; height: 40px; justify-content: center; }
        .top-link-btn .material-symbols-rounded { font-size: 20px; }
        .shell { padding: 16px 14px calc(56px + env(safe-area-inset-bottom, 0px)); }

        .auth { padding: 28px 20px 24px; border-radius: var(--radius-lg); }
        .auth h1, .auth h2 { font-size: 20px; }
        .otp-cells { gap: 6px; }
        .otp-cells i { height: 50px; font-size: 19px; }

        .pbar { padding: 16px; }
        .pbar-acts { width: 100%; }
        .pbar-acts .btn { flex: 1 1 auto; justify-content: center; }

        .quick-modes { flex-direction: column; align-items: stretch; }
        .qm-actions { width: 100%; }
        .qm-actions .btn { flex: 1 1 auto; justify-content: center; }

        .stats { grid-template-columns: repeat(2, 1fr); padding-left: 16px; padding-right: 16px; }
        .stats > :nth-child(3) { grid-column: 1 / -1; }

        .kid-head, .apps-panel-top, .apps { padding-left: 16px; padding-right: 16px; }
        .ask, .setup { margin-left: 16px; margin-right: 16px; }
        .kid-acts { width: 100%; }
        .kid-acts .btn:first-child { flex: 1 1 auto; justify-content: center; }

        .app { grid-template-columns: 1fr; gap: 12px; }
        .app-r { justify-content: stretch; }
        .app-r .seg { width: 100%; }
        .app-r .seg button { flex: 1 1 0; text-align: center; }
        .app-r .sel { max-width: none; flex: 1 1 130px; min-width: 0; }
    }
    /* Telefonda tanlovlar 16px (iOS kattalashtirmasin), ikkitasi bir
       qatorga sig'masdan "Vaqt beri…" bo'lib kesilardi — alohida qator. */
    @media (max-width: 480px) {
        .app-r .sel { flex-basis: 100%; }
    }
    @media (max-width: 380px) {
        .otp-cells { gap: 5px; }
        .otp-cells i { height: 46px; font-size: 17px; }
    }
    @media (prefers-reduced-motion: reduce) {
        .skel, .otp-cells i.cur::after { animation: none; }
        * { transition-duration: .01ms !important; }
    }
