/* =====================================================================
   CloudSMS — Design System v2 ("Bento")
   Light gray canvas, white rounded tiles, pill buttons, one calm accent.
   Font: Helvetica Neue LT GEO
   Loaded on: landing, auth, client cabinet, admin panel
   ===================================================================== */

@font-face { font-family: 'Helvetica Neue LT GEO'; src: url('/assets/fonts/HelveticaNeueLTGEO-45Lt.woff2') format('woff2'); font-weight: 300 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Helvetica Neue LT GEO'; src: url('/assets/fonts/HelveticaNeueLTGEO-55Rm.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Helvetica Neue LT GEO'; src: url('/assets/fonts/HelveticaNeueLTGEO-65Md.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Helvetica Neue LT GEO'; src: url('/assets/fonts/HelveticaNeueLTGEO-75Bd.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Helvetica Neue LT GEO'; src: url('/assets/fonts/HelveticaNeueLTGEO-85Bl.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Helvetica Neue LT GEO'; src: url('/assets/fonts/HelveticaNeueLTGEO-85Hw.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }

/* `html:root` outranks plain `:root` blocks inside individual pages. */
html:root {
    --font: 'Helvetica Neue LT GEO', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Canvas & tiles */
    --bg: #F5F5F7;
    --bg-2: #EDEDF0;
    --surface-1: #FFFFFF;
    --surface-2: #FAFAFB;
    --surface-3: #F2F2F5;
    --line: #E9E9EE;
    --line-strong: #DADAE0;

    /* Text */
    --ink: #1D1D1F;
    --ink-2: #48484D;
    --ink-3: #6E6E73;
    --ink-4: #A1A1A6;

    /* Accent */
    --brand: #0A84E0;
    --brand-strong: #0068B8;
    --brand-deep: #0058A0;
    --brand-soft: #EBF4FD;
    --brand-ring: rgba(10, 132, 224, 0.22);
    --brand-gradient: linear-gradient(180deg, #1890EA 0%, #0A7FDA 100%);
    --mint: #1DA772;

    /* States */
    --ok: #1C9E69;
    --warn: #C9821C;
    --bad: #D9434F;

    /* Shape */
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 28px;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.03), 0 4px 14px rgba(0, 0, 0, 0.03);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.04), 0 18px 40px -12px rgba(0, 0, 0, 0.10);
    --shadow-3: 0 30px 70px -20px rgba(0, 0, 0, 0.18);
    --shadow-brand: 0 8px 20px -8px rgba(10, 132, 224, 0.45);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* ---- Legacy aliases used by existing page styles ---- */
    --primary: var(--brand);
    --primary-hover: var(--brand-strong);
    --primary-dark: var(--brand-strong);
    --secondary: var(--brand-deep);
    --accent: var(--mint);
    --background: var(--bg);
    --dark-bg: var(--bg);
    --surface: var(--surface-1);
    --surface-light: var(--surface-3);
    --card-bg: var(--surface-1);
    --text-main: var(--ink);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-2);
    --text-muted: var(--ink-3);
    --border: var(--line-strong);
    --border-color: var(--line);
    --glass: #FFFFFF;
    --glass-bg: #FFFFFF;
    --glass-border: var(--line);
    --glass-hover: #FFFFFF;
    --gradient-main: var(--brand-gradient);
    --primary-gradient: var(--brand-gradient);
    --success-gradient: linear-gradient(180deg, #25B079, #1C9E69);
    --danger-gradient: linear-gradient(180deg, #E45561, #D9434F);
    --warning-gradient: linear-gradient(180deg, #DE9935, #C9821C);
    --info-gradient: var(--brand-gradient);
    --success: var(--ok);
    --warning: var(--warn);
    --error: var(--bad);
    --danger: var(--bad);
    --radius-sm: var(--r-sm);
    --radius-md: var(--r-md);
    --radius-lg: var(--r-lg);
    --radius-xl: var(--r-xl);
    --shadow-sm: var(--shadow-1);
    --shadow-md: var(--shadow-2);
    --shadow-lg: var(--shadow-3);

    color-scheme: light;
    -webkit-text-size-adjust: 100%;
}

/* ---------- Base ---------- */
html body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
html body button,
html body input,
html body select,
html body textarea { font-family: inherit; }
html body h1, html body h2, html body h3, html body h4 {
    font-family: var(--font);
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: inherit;
}
html body img { max-width: 100%; }

::selection { background: rgba(10, 132, 224, 0.2); color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: #CFCFD4 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #D2D2D7; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #B0B0B6; background-clip: padding-box; }

/* ---------- Buttons: pills ---------- */
html .btn {
    font-family: var(--font);
    font-weight: 600;
    border-radius: 999px;
    min-height: 42px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    letter-spacing: 0;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s, border-color .2s, color .2s;
}
html .btn-sm { min-height: 32px; padding-left: .85rem; padding-right: .85rem; }

html .btn-primary {
    background: var(--brand);
    color: #fff;
    border: 0;
    box-shadow: none;
}
html .btn-primary:hover { background: var(--brand-strong); color: #fff; transform: none; box-shadow: var(--shadow-brand); }
html .btn-primary:active { transform: scale(0.98); }

html .btn-secondary,
html .btn-outline,
html .btn-glass {
    background: var(--surface-3);
    color: var(--ink);
    border: 1px solid transparent;
    box-shadow: none;
    backdrop-filter: none;
}
html .btn-secondary:hover,
html .btn-outline:hover,
html .btn-glass:hover { background: #E8E8EC; color: var(--ink); border-color: transparent; }

html .btn-danger { background: #FCEDEE; color: var(--bad); border: 1px solid transparent; }
html .btn-danger:hover { background: var(--bad); color: #fff; }
html .btn-success { background: #E7F6EF; color: var(--ok); border: 1px solid transparent; }
html .btn-success:hover { background: var(--ok); color: #fff; }

/* ---------- Tiles (cards & panels) ---------- */
html .card,
html .card-glass,
html .glass-panel,
html .stat-card,
html .package-card {
    background: var(--surface-1);
    border: 0;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--ink);
}
html .glass-panel:hover,
html .stat-card:hover,
html .package-card:hover {
    background: var(--surface-1);
    transform: none;
    box-shadow: var(--shadow-2);
}
html .stat-card::before { display: none; }

html .stat-value {
    font-weight: 800;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--ink);
}
html .stat-label { color: var(--ink-3); font-weight: 500; letter-spacing: 0; text-transform: none; }

html .stat-icon {
    border-radius: 14px;
    box-shadow: none;
    color: var(--brand);
    background: var(--brand-soft);
}
html .stat-icon.info { background: var(--brand-soft); color: var(--brand); }
html .stat-icon.success { background: #E7F6EF; color: var(--ok); }
html .stat-icon.warning { background: #FBF2E3; color: var(--warn); }
html .stat-icon.danger { background: #FCEDEE; color: var(--bad); }
html .stat-icon.violet { background: #F0EEFB; color: #6857C8; }

html .list-item { background: var(--surface-3); border: 0; border-radius: var(--r-md); }
html a.stat-card, html a.stat-card:hover, html a.quick-action { text-decoration: none; color: var(--ink); }

/* ---------- Forms ---------- */
html .form-label { color: var(--ink-2); font-weight: 600; font-size: 0.85rem; }

html .form-input,
html .form-control,
html .small-input {
    background: var(--surface-3);
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--ink);
    min-height: 46px;
    font-size: 16px; /* prevents iOS zoom on focus */
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}
html textarea.form-input,
html textarea.form-control { min-height: 120px; }
html .form-input:hover,
html .form-control:hover { background: #EDEDF1; }
html .form-input:focus,
html .form-control:focus,
html .small-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}
html .form-input::placeholder,
html .form-control::placeholder { color: var(--ink-4); }
html select option { background: #fff; color: var(--ink); }
html input[type="checkbox"], html input[type="radio"], html input[type="range"] { accent-color: var(--brand); }

/* ---------- Tables ---------- */
html .table th,
html .modern-table th {
    color: var(--ink-3);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    text-transform: none;
    background: transparent;
}
html .table td { border-bottom-color: var(--line); }
html .table tbody tr:hover td { background: var(--surface-2); }

html .modern-table { border-spacing: 0; }
html .modern-table tr { background: transparent; }
html .modern-table td {
    background: transparent;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 !important;
}
html .modern-table td:first-child,
html .modern-table td:last-child { border-left: 0; border-right: 0; }
html .modern-table tr:hover td { background: var(--surface-2); }
html .table-responsive { -webkit-overflow-scrolling: touch; }

/* ---------- Badges ---------- */
html .badge {
    font-weight: 600;
    letter-spacing: 0;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-size: 0.72rem;
    line-height: 1.2;
    text-transform: none;
    border: 0;
}
html .badge-success { background: #E7F6EF; color: #137A50; }
html .badge-warning { background: #FBF2E3; color: #95600F; }
html .badge-danger, html .badge-error { background: #FCEDEE; color: #B0303B; }
html .badge-info { background: var(--brand-soft); color: var(--brand-strong); }
html .badge-secondary { background: var(--surface-3); color: var(--ink-2); }

/* ---------- Alerts ---------- */
html .alert { border-radius: var(--r-md); padding: 0.95rem 1.15rem; font-weight: 500; border: 0; }
html .alert-success { background: #E7F6EF; color: #137A50; }
html .alert-error, html .alert-danger { background: #FCEDEE; color: #A3283A; }
html .alert-warning { background: #FBF2E3; color: #85560E; }
html .alert-info { background: var(--brand-soft); color: var(--brand-deep); }

/* ---------- Text ---------- */
html .text-gradient,
html .gradient-text {
    background: linear-gradient(90deg, #0A84E0 0%, #3E6BE0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
html .subtle { color: var(--ink-3); }

html .main-title,
html .main-title.text-gradient,
html .page-title,
html .settings-title,
html .dashboard-title {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--ink);
    font-size: clamp(1.6rem, 2.8vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}
html .admin-main h1[style*="background"],
html .main-content h1[style*="background"] {
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    color: var(--ink) !important;
}
html .dashboard-subtitle { color: var(--ink-3); }

/* ---------- Modals ---------- */
html .modal-content,
html .modal-box,
html .modal-dialog {
    background: #fff;
    color: var(--ink);
    border: 0;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-3);
}

/* ===================================================================
   APP SHELL — client cabinet & admin panel
   =================================================================== */
.app-side {
    background: rgba(250, 250, 251, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}
.app-brand { display: flex; align-items: center; padding: 0.25rem 0.6rem; }
.app-brand img { height: 30px; width: auto; display: block; }

.app-nav-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink-4);
    margin: 1.35rem 0.8rem 0.4rem;
}

.app-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    margin: 1px 0;
    border-radius: 12px;
    color: var(--ink-2);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    line-height: 1.3;
    transition: background-color .15s, color .15s;
}
.app-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--ink-4);
    transition: color .15s;
    flex-shrink: 0;
}
.app-link:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }
.app-link:hover i { color: var(--ink-2); }
.app-link.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.app-link.active i { color: var(--brand); }
.app-link .app-count {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--bad);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-user {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem;
    border-radius: var(--r-md);
    background: #fff;
    box-shadow: var(--shadow-1);
}
.app-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5AB8F5, #0A7FDA);
    color: #fff;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    text-transform: uppercase;
}
.app-user-meta { min-width: 0; flex: 1; }
.app-user-name { font-size: 0.84rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-role { font-size: 0.74rem; color: var(--ink-3); }
.app-logout {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ink-3);
    text-decoration: none;
    transition: background-color .15s, color .15s;
    flex-shrink: 0;
}
.app-logout:hover { background: #FCEDEE; color: var(--bad); }

/* Mobile top bar */
.app-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    background: rgba(245, 245, 247, 0.82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
    z-index: 9000;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.app-topbar img { height: 26px; width: auto; display: block; }
.app-burger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: #fff;
    color: var(--ink);
    display: grid;
    place-items: center;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-1);
}
.app-topbar-actions { display: flex; align-items: center; gap: 8px; }
.app-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    box-shadow: var(--shadow-1);
}
.app-pill i { color: var(--brand); }
.app-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(3px);
    z-index: 9500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.app-scrim.show { opacity: 1; pointer-events: auto; }
body.app-locked { overflow: hidden; }

/* ===================================================================
   CLIENT CABINET  (.dashboard > .sidebar + .main-content)
   =================================================================== */
html .dashboard { background: var(--bg); }
html .dashboard .sidebar {
    width: 264px;
    padding: 1.25rem 0.9rem 0.9rem;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    scrollbar-width: none;
    box-shadow: none;
    z-index: 9600;
}
html .dashboard .sidebar::-webkit-scrollbar { display: none; }
html .dashboard .main-content {
    padding: 2.5rem clamp(1rem, 3.2vw, 3rem) 3rem;
    min-width: 0;
    flex: 1;
}

html .client-menu-toggle,
html .mobile-balance-indicator,
html .client-overlay { display: none !important; }

@media (max-width: 900px) {
    html .dashboard .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 290px;
        max-width: 86vw;
        background: #F7F7F9;
        transform: translateX(-105%);
        transition: transform .3s var(--ease);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.12);
    }
    html .dashboard .sidebar.mobile-open { transform: translateX(0); }
    html .dashboard .main-content { padding: calc(72px + env(safe-area-inset-top, 0px)) 1rem 2rem; width: 100%; }
    .app-topbar.is-client { display: flex; }
}

html .quick-action {
    background: #fff;
    border: 0;
    border-radius: var(--r-lg);
    color: var(--ink);
    box-shadow: var(--shadow-1);
}
html .quick-action:hover { box-shadow: var(--shadow-2); }
html .quick-action-icon { width: 3rem; height: 3rem; border-radius: 14px; font-size: 1.1rem; }
html .quick-action-arrow { font-size: 0.95rem; color: var(--ink-4); }
html .activity-item { border-bottom-color: var(--line); }
html .activity-avatar { font-size: 0.95rem; color: var(--ink-3); background: var(--surface-3); border-radius: 50%; }

/* Client balance tile in sidebar */
.app-balance {
    margin: 1.1rem 0 0.4rem;
    padding: 1rem 1rem 0.9rem;
    border-radius: var(--r-lg);
    color: var(--ink);
    background: #fff;
    box-shadow: var(--shadow-1);
}
.app-balance-label { font-size: 0.75rem; color: var(--ink-3); font-weight: 500; }
.app-balance-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; margin: 0.1rem 0 0.75rem; font-variant-numeric: tabular-nums; }
.app-balance-value small { font-size: 0.8rem; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.app-balance-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color .2s;
}
.app-balance-btn:hover { background: var(--brand-strong); color: #fff; }

.app-lang { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, 0.05); gap: 2px; }
.app-lang a { padding: 3px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; color: var(--ink-3); text-decoration: none; }
.app-lang a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

/* ===================================================================
   ADMIN PANEL  (.admin-sidebar + .admin-main)
   =================================================================== */
html .admin-sidebar {
    width: 264px;
    padding: 1.25rem 0.9rem 0.9rem;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 9600;
}
html .admin-sidebar::-webkit-scrollbar { display: none; }

html .admin-main,
html .admin-sidebar ~ .main-content {
    margin-left: 264px;
    padding: 2.5rem clamp(1rem, 3.2vw, 3rem) 4rem;
    min-width: 0;
    max-width: 100%;
}
@media (min-width: 1025px) {
    html .admin-main, html .admin-sidebar ~ .main-content { width: auto; flex: 1 1 auto; }
}
html .admin-header { margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }

html .mobile-menu-toggle,
html .mobile-overlay { display: none !important; }

@media (max-width: 1024px) {
    html .admin-sidebar {
        background: #F7F7F9;
        transform: translateX(-105%);
        transition: transform .3s var(--ease);
        width: 290px;
        max-width: 86vw;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.12);
    }
    html .admin-sidebar.mobile-open { transform: translateX(0); }
    html .admin-main,
    html .admin-sidebar ~ .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: calc(72px + env(safe-area-inset-top, 0px)) 1rem 2rem !important;
    }
    .app-topbar.is-admin { display: flex; }
    html .dashboard-header { margin-top: 0; }
}

/* ===================================================================
   RESPONSIVE COMFORT
   =================================================================== */
@media (max-width: 1024px) {
    html .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    html .grid-2, html .grid-3 { grid-template-columns: 1fr !important; }
    html .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 0.75rem; }
    html .card, html .glass-panel, html .stat-card { padding: 1rem; border-radius: 20px; }
    html .stat-value { font-size: 1.5rem; }
    html .main-title, html .page-title, html .dashboard-title, html body h1 { font-size: 1.55rem !important; }
    html .btn { min-height: 44px; }
    html .form-actions { flex-direction: column; }
    html .form-actions .btn { width: 100%; }
    html .card, html .glass-panel { overflow-x: auto; }
    html .table, html .modern-table { min-width: 560px; }
    html .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 0.75rem !important; }
    html .stats-grid .stat-card { padding: 1rem; }
    html .stats-grid .stat-icon { width: 2.4rem; height: 2.4rem; font-size: 1rem; margin-bottom: 0.75rem; }
    html .quick-actions-grid { gap: 0.75rem !important; }
}
@media (max-width: 380px) {
    html .grid-4 { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ===================================================================
   AUTH PAGES (login / register / verify)
   =================================================================== */
html .bg-glow { display: none; }
html .auth-container { max-width: 460px; }
html .auth-card {
    background: #fff;
    border: 0;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-2);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: clamp(1.75rem, 5vw, 2.75rem);
}
html .logo-box { margin-bottom: 1.5rem; }
html .logo-box img { height: 2.1rem; }
html .auth-header { margin-bottom: 2rem; }
html .auth-header h1 {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--ink);
    font-size: clamp(1.6rem, 4vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.15;
}
html .auth-header p { color: var(--ink-3); font-size: 0.98rem; }
html .btn-submit {
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    min-height: 50px;
    font-weight: 600;
    box-shadow: none;
}
html .btn-submit:hover { background: var(--brand-strong); transform: none; box-shadow: var(--shadow-brand); }
html .auth-footer { color: var(--ink-3); }
html .auth-footer a { color: var(--brand); }
html .back-link {
    background: #fff;
    color: var(--ink-2);
    padding: 0.5rem 0.95rem 0.5rem 0.75rem;
    border-radius: 999px;
    box-shadow: var(--shadow-1);
    font-weight: 500;
}
html .back-link:hover { color: var(--ink); }
html .type-toggle { background: var(--surface-3); border: 0; border-radius: 999px; padding: 4px; }
html .type-btn { border-radius: 999px; font-weight: 600; }
html .type-btn.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }
html .math-box { background: var(--surface-3); border: 0; border-radius: var(--r-md); }
html .math-question { color: var(--ink); }
html .code-input { background: var(--surface-3); border: 1px solid transparent; border-radius: 14px; color: var(--ink); }
html .code-input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); outline: none; }
@media (max-width: 560px) {
    html .back-link { top: 1rem; left: 1rem; }
    html .auth-container { padding: 4.5rem 1rem 2rem; }
}
html body > .back-link { position: absolute; top: 1.5rem; left: 1.5rem; z-index: 20; }
html body > .auth-container { width: 100%; margin-left: auto; margin-right: auto; }
@media (max-width: 560px) {
    html body > .back-link { top: 1rem; left: 1rem; }
}

/* ===================================================================
   PAGE KIT — building blocks for cabinet/admin pages
   =================================================================== */
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.pg-title { font-size: clamp(1.6rem, 2.8vw, 2.15rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.1; color: var(--ink); margin: 0; }
.pg-sub { color: var(--ink-3); margin-top: 0.35rem; font-size: 0.98rem; }
.pg-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.pg-back { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-3); font-size: 0.85rem; font-weight: 500; text-decoration: none; margin-bottom: 0.6rem; }
.pg-back:hover { color: var(--ink); }

.tile-box { background: #fff; border-radius: var(--r-lg); padding: clamp(1.1rem, 2.2vw, 1.6rem); box-shadow: var(--shadow-1); min-width: 0; }
.tile-box + .tile-box { margin-top: 16px; }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tile-title { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); margin: 0; display: flex; align-items: center; gap: 0.55rem; }
.tile-title i { color: var(--brand); font-size: 0.95rem; }
.tile-note { color: var(--ink-3); font-size: 0.85rem; }

.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.grid-2c { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-main-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2c { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: var(--r-lg); padding: 1.2rem 1.25rem; box-shadow: var(--shadow-1); min-width: 0; }
.kpi-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 0.9rem; margin-bottom: 0.9rem; background: var(--brand-soft); color: var(--brand); }
.kpi-ico.green { background: #E7F6EF; color: var(--ok); }
.kpi-ico.amber { background: #FBF2E3; color: var(--warn); }
.kpi-ico.red { background: #FCEDEE; color: var(--bad); }
.kpi-ico.violet { background: #F0EEFB; color: #6857C8; }
.kpi-val { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-val small { font-size: 0.5em; color: var(--ink-3); font-weight: 600; letter-spacing: 0; margin-left: 0.15em; }
.kpi-label { color: var(--ink-3); font-size: 0.84rem; margin-top: 0.15rem; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .kpi { padding: 1rem; } .kpi-val { font-size: 1.45rem; } }

.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar > .grow { flex: 1 1 220px; }
.search-input { position: relative; }
.search-input i { position: absolute; left: 0.95rem; top: 50%; transform: translateY(-50%); color: var(--ink-4); font-size: 0.85rem; pointer-events: none; }
.search-input input { padding-left: 2.4rem !important; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg > a, .seg > button { border: 0; background: transparent; border-radius: 999px; padding: 0.45rem 0.95rem; font-family: inherit; font-weight: 600; font-size: 0.86rem; color: var(--ink-3); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, color .15s; }
.seg > a:hover, .seg > button:hover { color: var(--ink); }
.seg > .active, .seg > .active-tab { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * clamp(1.1rem, 2.2vw, 1.6rem)); padding: 0 clamp(1.1rem, 2.2vw, 1.6rem); }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 0.85rem 0.75rem; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .strong { color: var(--ink); font-weight: 600; }
.tbl .muted { color: var(--ink-3); font-size: 0.82rem; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .tbl { min-width: 620px; } }

.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.chip.blue { background: var(--brand-soft); color: var(--brand-strong); }
.chip.green { background: #E7F6EF; color: #137A50; }
.chip.amber { background: #FBF2E3; color: #95600F; }
.chip.red { background: #FCEDEE; color: #B0303B; }

.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; text-decoration: none; font-size: 0.85rem; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: #E6E6EA; color: var(--ink); }
.icon-btn.blue { background: var(--brand-soft); color: var(--brand); }
.icon-btn.blue:hover { background: var(--brand); color: #fff; }
.icon-btn.red { background: #FCEDEE; color: var(--bad); }
.icon-btn.red:hover { background: var(--bad); color: #fff; }
.icon-btn.green { background: #E7F6EF; color: var(--ok); }
.icon-btn.green:hover { background: var(--ok); color: #fff; }
.row-actions { display: flex; gap: 0.35rem; justify-content: flex-end; flex-wrap: nowrap; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink-3); }
.empty i { display: block; font-size: 1.8rem; color: var(--ink-4); margin-bottom: 0.75rem; }
.empty b { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 0.25rem; }

.field { margin-bottom: 1rem; }
.field > label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 0.4rem; }
.field .hint { font-size: 0.8rem; color: var(--ink-3); margin-top: 0.35rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.9rem; }
@media (max-width: 640px) { .form-row-2 { grid-template-columns: 1fr; } }

.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #D7D7DC; border-radius: 999px; transition: background-color .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(18px); }

.list-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { color: var(--ink); font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .s { color: var(--ink-3); font-size: 0.82rem; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); color: var(--ink-3); display: grid; place-items: center; flex-shrink: 0; font-size: 0.85rem; font-weight: 700; }

.code-box { font-family: var(--mono); font-size: 0.85rem; background: var(--surface-3); border-radius: 12px; padding: 0.8rem 1rem; color: var(--ink); overflow-x: auto; word-break: break-all; }
