/* ══════════════════════════════════════════════════════════════════
   HESOYAM Mini App — Unified Design System
   ══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Base palette */
    --bg:        #0a0a16;
    --bg-soft:   #11112a;
    --card:      rgba(255, 255, 255, 0.04);
    --card-hover: rgba(255, 255, 255, 0.07);
    --accent:    #667eea;
    --accent2:   #764ba2;
    --text:      #e8e8f0;
    --text-soft: #b0b0cf;
    --muted:     #7a7a9a;
    --success:   #69f0ae;
    --danger:    #ff4757;
    --warning:   #ffb84d;

    /* Borders */
    --border:        rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --border-accent: rgba(102, 126, 234, 0.35);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
    --shadow-accent: 0 8px 28px rgba(102, 126, 234, 0.35);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-pink:    linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-blue:    linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-green:   linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-orange:  linear-gradient(135deg, #fcb045 0%, #fd1d1d 100%);

    /* Layout */
    --header-h: 54px;
    --screen-header-h: 56px;
    --tg-viewport-height: 100dvh;
    --keyboard-inset: 0px;
    /* Top-offset для нашего хедера. JS (applyTelegramViewport) вычисляет
       --tg-ui-top динамически под текущий режим Telegram'а:
         - fullscreen → высота Telegram top-bar + system status,
         - вкладка/sheet → 0 (Telegram top-bar ВНЕ webview, наш хедер
           прижимается к верху).
       CSS-fallback используется только если SDK ещё не успел отработать
       (или совсем не отдал событий) — берём env(safe-area-inset-top)
       чтобы хотя бы обойти iOS-notch. Никакого «88px по умолчанию»: иначе
       во вкладке хедер уезжает вниз без причины. */
    --app-top-offset: var(--tg-ui-top, env(safe-area-inset-top, 0px));
    --blur:     blur(20px);
}

html, body { height: var(--tg-viewport-height); }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(102, 126, 234, 0.15), transparent 60%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(118, 75, 162, 0.12), transparent 60%);
    background-attachment: fixed;
    color: var(--text);
    /* 100dvh = реальная видимая высота, учитывает address bar и панели браузера.
       На Desktop Telegram webview занимает всё окно, и 100vh может превышать
       видимую область. 100dvh решает эту проблему (поддерживается Desktop Chromium). */
    height: var(--tg-viewport-height);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    font-size: 15px;
    line-height: 1.4;
}

#app { position: relative; min-height: var(--tg-viewport-height); }

.app-boot-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    opacity: 1;
    transition: opacity 0.22s ease;
}
.app-boot-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    color: var(--text);
    transform: translateY(-4vh);
}
.app-boot-mark .mascot-mini {
    animation: mm-boot-float 3.4s ease-in-out infinite;
    width: 44px;
    gap: 2px;
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.5));
}
.app-boot-mark .mm-antenna {
    width: 4px;
    height: 12px;
    border-radius: 4px;
    margin-bottom: -2px;
}
.app-boot-mark .mm-antenna::before {
    top: -10px;
    width: 8px;
    height: 8px;
}
.app-boot-mark .mm-head {
    width: 44px;
    height: 32px;
    border-radius: 10px;
    gap: 8px;
}
.app-boot-mark .mm-head::before,
.app-boot-mark .mm-head::after {
    width: 4px;
    height: 16px;
    border-radius: 4px;
}
.app-boot-mark .mm-head::before { left: -2px; }
.app-boot-mark .mm-head::after { right: -2px; }
.app-boot-mark .mm-eye {
    width: 10px;
    height: 10px;
}
.app-boot-mark .mm-eye::after {
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
}
.app-boot-mark .mm-body {
    width: 36px;
    height: 20px;
    border-radius: 0 0 8px 8px;
    font-size: 10px;
    letter-spacing: 1px;
}
@keyframes mm-boot-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.app-boot-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 0;
}
body:not(.app-booting) .app-boot-screen {
    opacity: 0;
    pointer-events: none;
}
body.app-booting .app-header,
body.app-booting .screen {
    visibility: hidden;
}

/* ── Header ── */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: calc(var(--header-h) + var(--app-top-offset));
    /* Лёгкий вертикальный градиент → глубина */
    background: linear-gradient(180deg,
        rgba(10, 10, 22, 0.92) 0%,
        rgba(10, 10, 22, 0.78) 100%);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    /* Мягкая тень вниз вместо жёсткого border-bottom */
    box-shadow:
        0 8px 24px -12px rgba(0, 0, 0, 0.55),
        inset 0 -1px 0 rgba(255, 255, 255, 0.025);
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--app-top-offset) 14px 0;
}
/* Тонкая акцентная градиентная линия снизу — заменяет border-bottom */
.app-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 14%; right: 14%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(102, 126, 234, 0.35) 35%,
        rgba(118, 75, 162, 0.35) 65%,
        transparent 100%);
    pointer-events: none;
}

.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.header-brand {
    font-size: 16px; font-weight: 800; letter-spacing: 0.4px;
    background: var(--gradient-primary);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Статус — пилюля с тинтом по состоянию */
.header-status {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 11px 5px 9px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    font-size: 12px; font-weight: 500;
    color: var(--text-soft);
    transition: background .25s, border-color .25s, color .25s;
    max-width: 55vw;
    min-width: 0;
    line-height: 1;
}
#status-text {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: color .2s;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; transition: background .2s, box-shadow .2s; }
.status-dot.authenticated    { background: var(--success); box-shadow: 0 0 6px rgba(105, 240, 174, 0.5); }
.status-dot.not-authenticated { background: var(--danger); }
.status-dot.is-saving { background: #c5caff; box-shadow: 0 0 6px rgba(197,202,255,0.55); animation: status-pulse 1s ease-in-out infinite; }
.status-dot.is-saved  { background: #43e97b; box-shadow: 0 0 6px rgba(67,233,123,0.6); }
.status-dot.is-error  { background: var(--danger); box-shadow: 0 0 6px rgba(255,71,87,0.55); }
#status-text.is-saving { color: #c5caff; }
#status-text.is-saved  { color: #43e97b; font-weight: 600; }
#status-text.is-error  { color: var(--danger); font-weight: 600; }

/* Тинт пилюли подстраивается под статус (через :has, поддержка >95% TG-клиентов) */
.header-status:has(.status-dot.authenticated) {
    background: rgba(105, 240, 174, 0.08);
    border-color: rgba(105, 240, 174, 0.22);
    color: var(--success);
}
.header-status:has(.status-dot.not-authenticated),
.header-status:has(.status-dot.is-error) {
    background: rgba(255, 71, 87, 0.08);
    border-color: rgba(255, 71, 87, 0.22);
}
.header-status:has(.status-dot.is-saving) {
    background: rgba(197, 202, 255, 0.08);
    border-color: rgba(197, 202, 255, 0.22);
}
.header-status:has(.status-dot.is-saved) {
    background: rgba(67, 233, 123, 0.08);
    border-color: rgba(67, 233, 123, 0.22);
}

@keyframes status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Узкие экраны (iPhone SE и подобные) */
@media (max-width: 380px) {
    .app-header { padding: var(--app-top-offset) 12px 0; }
    .header-left { gap: 8px; }
    .header-brand { font-size: 15px; letter-spacing: 0.3px; }
    .header-status {
        font-size: 11.5px;
        padding: 4px 10px 4px 8px;
        max-width: 52vw;
    }
}

/* ── Mini Mascot (header) ── */
.mascot-mini { width: 22px; display: flex; flex-direction: column; align-items: center; gap: 1px;
    flex-shrink: 0; animation: mm-float 3.4s ease-in-out infinite;
    filter: drop-shadow(0 2px 6px rgba(102, 126, 234, 0.5)); }
@keyframes mm-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.mm-antenna { width: 2px; height: 6px;
    background: linear-gradient(to bottom, #c5caff, rgba(255, 255, 255, 0.5));
    border-radius: 2px; margin-bottom: -1px; position: relative; }
.mm-antenna::before { content: ''; position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; background: var(--danger); border-radius: 50%;
    animation: mm-glow 1.8s ease-in-out infinite; }
@keyframes mm-glow { 0%, 100% { box-shadow: 0 0 3px rgba(255, 71, 87, 0.6); } 50% { box-shadow: 0 0 8px rgba(255, 71, 87, 1); } }
.mm-head { width: 22px; height: 16px;
    background: linear-gradient(150deg, #7a8ef5, #764ba2);
    border-radius: 5px; display: flex; align-items: center; justify-content: center; gap: 4px; position: relative; }
.mm-head::before, .mm-head::after { content: ''; position: absolute; top: 50%; transform: translateY(-50%);
    width: 2px; height: 8px; background: linear-gradient(150deg, #7a8ef5, #764ba2); border-radius: 2px; }
.mm-head::before { left: -1px; } .mm-head::after { right: -1px; }
.mm-eye { width: 5px; height: 5px; background: #fff; border-radius: 50%; position: relative; flex-shrink: 0;
    animation: mm-blink 4.8s ease-in-out infinite; }
.mm-eye.r { animation-delay: 0.18s; }
.mm-eye::after { content: ''; position: absolute; top: 1px; left: 1px; width: 3px; height: 3px;
    background: #111; border-radius: 50%; }
@keyframes mm-blink { 0%, 87%, 100% { transform: scaleY(1); } 92% { transform: scaleY(0.08); } }
.mm-body { width: 18px; height: 10px; background: linear-gradient(150deg, #6a4fa0, #5868cc);
    border-radius: 0 0 4px 4px; display: flex; align-items: center; justify-content: center;
    font-size: 5px; font-weight: 800; color: rgba(255, 255, 255, 0.9); letter-spacing: 0.5px; }

/* ── Large Mascot (auth) ── */
.auth-mascot {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 174px;
    margin-bottom: 14px;
}
.mascot-lg {
    width: 80px; display: flex; flex-direction: column; align-items: center; gap: 3px;
    animation: mascot-float 3.4s ease-in-out infinite;
    filter: drop-shadow(0 8px 24px rgba(102, 126, 234, 0.5));
    cursor: pointer; transition: filter 0.2s;
    position: relative;
}
.mascot-lg:hover { filter: drop-shadow(0 8px 32px rgba(102, 126, 234, 0.85)); }

.mascot-lg.roasting-0 .m-pupil {
    transform: translate(-50%, calc(-50% - 5px)) !important;
    transition: transform 0.25s ease;
}
.mascot-lg.roasting-1 .m-eye {
    animation: none !important;
    transform: scaleY(0.25);
    transition: transform 0.2s ease;
}
.mascot-lg.roasting-2 .m-pupil {
    transform: translate(calc(-50% + 5px), -50%) !important;
    transition: transform 0.3s ease;
}
.mascot-lg.roasting-3 #mlg-eye-l .m-pupil {
    transform: translate(calc(-50% + 4px), -50%) !important;
}
.mascot-lg.roasting-3 #mlg-eye-r .m-pupil {
    transform: translate(calc(-50% - 4px), -50%) !important;
}
.mascot-lg.roasting-4 #mlg-eye-r {
    animation: none !important;
    transform: scaleY(0.05);
    transition: transform 0.15s ease;
}

.mascot-lg .mascot-bubble {
    position: absolute;
    left: 50%;
    top: calc(100% + 14px);
    background: rgba(30, 30, 60, 0.92);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border-accent);
    color: var(--text);
    font-size: 13px; font-weight: 500;
    padding: 8px 14px;
    border-radius: 12px;
    width: max-content;
    max-width: min(280px, calc(100vw - 48px));
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    pointer-events: none;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateX(-50%) translateY(-8px) scale(0.85);
    transition: none;
    z-index: 10;
}
.mascot-lg .mascot-bubble::before {
    content: '';
    position: absolute; left: 50%; top: -7px; transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid var(--border-accent);
}
@keyframes bubble-in {
    0%   { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.8); }
    55%  { opacity: 1; transform: translateX(-50%) translateY(3px) scale(1.05); }
    75%  { transform: translateX(-50%) translateY(-2px) scale(0.97); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes bubble-out {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.88); }
}
.mascot-lg .mascot-bubble.visible { animation: bubble-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.mascot-lg .mascot-bubble.hiding { animation: bubble-out 0.25s ease-in forwards; }

@keyframes mascot-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-12px); }
}
@keyframes mascot-jump {
    0%   { transform: translateY(0) scaleY(1) scaleX(1); }
    15%  { transform: translateY(0) scaleY(0.75) scaleX(1.2); }
    40%  { transform: translateY(-48px) scaleY(1.1) scaleX(0.92); }
    60%  { transform: translateY(-52px) scaleY(1.1) scaleX(0.92); }
    80%  { transform: translateY(0) scaleY(0.8) scaleX(1.15); }
    90%  { transform: translateY(-10px) scaleY(1) scaleX(1); }
    100% { transform: translateY(0) scaleY(1) scaleX(1); }
}
.mascot-lg.jumping { animation: mascot-jump 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }

.m-antenna {
    width: 3px; height: 18px;
    background: linear-gradient(to bottom, #a0aaff, rgba(255, 255, 255, 0.4));
    border-radius: 3px; margin-bottom: -2px; position: relative;
}
.m-antenna::before {
    content: ''; position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
    width: 7px; height: 7px; background: #ff4757; border-radius: 50%;
    animation: glow 1.8s ease-in-out infinite;
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 4px rgba(255, 71, 87, 0.6); }
    50%       { box-shadow: 0 0 14px rgba(255, 71, 87, 1), 0 0 28px rgba(255, 71, 87, 0.4); }
}
.m-head {
    width: 72px; height: 52px;
    background: linear-gradient(150deg, #7a8ef5 0%, #764ba2 100%);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center; gap: 12px;
    position: relative;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
}
.m-head::before, .m-head::after {
    content: ''; position: absolute; top: 50%; transform: translateY(-50%);
    width: 6px; height: 26px;
    background: linear-gradient(150deg, #7a8ef5, #764ba2);
    border-radius: 4px;
}
.m-head::before { left: -5px; }
.m-head::after  { right: -5px; }
.m-eye {
    width: 16px; height: 16px; background: white; border-radius: 50%;
    position: relative; flex-shrink: 0;
    animation: m-blink 4.8s ease-in-out infinite;
    overflow: hidden;
}
.m-eye.r { animation-delay: 0.18s; }
.m-pupil {
    position: absolute; top: 50%; left: 50%;
    width: 8px; height: 8px; background: #111; border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.08s ease-out;
    pointer-events: none;
}
@keyframes m-blink {
    0%, 87%, 100% { transform: scaleY(1); }
    92%           { transform: scaleY(0.07); }
}
.m-body {
    width: 60px; height: 32px;
    background: linear-gradient(150deg, #6a4fa0, #5868cc);
    border-radius: 0 0 12px 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 800; color: rgba(255, 255, 255, 0.9); letter-spacing: 1px;
}

/* ── Screens & Navigation ── */
.screen {
    display: none;
    /* Скролл переносим на экран, а не на body — так position:fixed на хедере
       работает одинаково во всех клиентах Telegram (Desktop, iOS, Android). */
    position: fixed;
    top: calc(var(--header-h) + var(--app-top-offset));
    left: 0; right: 0; bottom: auto;
    height: calc(var(--tg-viewport-height) - var(--header-h) - var(--app-top-offset));
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-top: calc(var(--screen-header-h) + 16px);
    scroll-padding-bottom: calc(32px + var(--keyboard-inset));
    -webkit-overflow-scrolling: touch;
}
.screen.active {
    display: block;
}

/* Removed screen transitions - instant switch for now */

.screen-header {
    display: flex; align-items: center; gap: 12px;
    min-height: var(--screen-header-h);
    padding: 14px 16px 12px;
    /* top:0 — sticky относительно скролла .screen, который теперь сам скроллится */
    position: sticky; top: 0; z-index: 60;
    flex-shrink: 0;
    background: rgba(10, 10, 22, 0.85);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--border);
}
.screen-title { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }

.screen-content { padding: 16px 16px calc(32px + var(--keyboard-inset)); display: flex; flex-direction: column; gap: 14px; }
.screen-content.centered { align-items: center; text-align: center; padding-top: 40px; }
#auth-screen .screen-content.centered { padding-top: clamp(72px, 11vh, 96px); }

/* ── Auth ── */
.auth-flow {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(-10%);
    transform-origin: top center;
}
.auth-title { font-size: 26px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.3px; }
.auth-sub   { font-size: 14px; color: var(--text-soft); max-width: 260px; line-height: 1.5; }

/* ══════════════════════════════════════════════════════════════════
   Buttons
   ══════════════════════════════════════════════════════════════════ */

.btn-back {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--card); border: 1px solid var(--border);
    backdrop-filter: var(--blur);
    color: var(--text); font-size: 22px; font-weight: 500;
    line-height: 1;
    border-radius: 50%; cursor: pointer;
    transition: background 0.15s, transform 0.12s, border-color 0.15s;
    flex-shrink: 0;
    padding: 0 0 2px 0;
    font-family: inherit;
}
.btn-back:hover  { background: var(--card-hover); border-color: var(--border-strong); }
.btn-back:active { transform: scale(0.94); }

.btn-primary {
    background: var(--gradient-primary);
    color: #fff; border: none; font-size: 15px; font-weight: 700;
    padding: 14px 20px; border-radius: var(--radius-md); cursor: pointer;
    box-shadow: var(--shadow-accent);
    transition: opacity 0.15s, transform 0.15s, box-shadow 0.2s;
    text-align: center;
    font-family: inherit;
}
.btn-primary:hover  { box-shadow: 0 10px 30px rgba(102, 126, 234, 0.45); }
.btn-primary:active { opacity: 0.9; transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
    background: var(--card); border: 1px solid var(--border);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    color: var(--text); font-size: 15px; font-weight: 600;
    padding: 13px 20px; border-radius: var(--radius-md); cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
    text-align: center;
    font-family: inherit;
}
.btn-secondary:hover  { background: var(--card-hover); border-color: var(--border-strong); }
.btn-secondary:active { transform: scale(0.98); }
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-danger {
    background: rgba(255, 71, 87, 0.12); border: 1px solid rgba(255, 71, 87, 0.35);
    color: var(--danger); font-size: 15px; font-weight: 700;
    width: 100%; padding: 14px; border-radius: var(--radius-md); cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    text-align: center;
    font-family: inherit;
}
.btn-danger:hover  { background: rgba(255, 71, 87, 0.18); }
.btn-danger:active { transform: scale(0.98); }

.btn-hero   { font-size: 17px; padding: 17px; }
.full-width { width: 100%; display: block; }

/* ══════════════════════════════════════════════════════════════════
   Cards (legacy .card unified with glass)
   ══════════════════════════════════════════════════════════════════ */

.card {
    background: var(--card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: border-color 0.2s, background 0.2s;
}

.card-section-title {
    font-size: 13px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 10px;
}

.emoji-badge {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.settings-subscription-card {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    min-height: 68px;
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.16), rgba(118, 75, 162, 0.08)),
        rgba(255, 255, 255, 0.045);
    border-color: rgba(102, 126, 234, 0.28);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.settings-subscription-card::before {
    content: "";
    position: absolute;
    inset: 10px auto 10px 0;
    width: 3px;
    border-radius: 0 999px 999px 0;
    background: var(--gradient-primary);
}

.settings-subscription-card:active {
    transform: translateY(1px);
}

.settings-subscription-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.14);
    border: 1px solid rgba(102, 126, 234, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-subscription-card__body {
    flex: 1;
    min-width: 0;
}

.settings-subscription-card__title {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
}

.settings-subscription-card__pill {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.24);
    color: #cdd6ff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.settings-subscription-card__arrow {
    font-size: 20px;
    color: var(--text-soft);
    line-height: 1;
    flex-shrink: 0;
}

/* legacy alias — kept for compat with older JS/HTML */
.card-icon-badge {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px; line-height: 1; flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   Form fields
   ══════════════════════════════════════════════════════════════════ */

.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }

.letter-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin-top: 10px;
    border: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    padding: 12px 14px;
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.28);
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.letter-generate-btn:active {
    transform: translateY(1px);
    box-shadow: 0 8px 18px rgba(102, 126, 234, 0.22);
}

.letter-generate-btn:disabled {
    opacity: 0.58;
    box-shadow: none;
}

.button-loading-dots {
    display: inline-grid;
    grid-template-columns: repeat(3, 0.35em);
    margin-left: 1px;
    text-align: left;
}

.button-loading-dots span {
    animation: buttonDotPulse 1.2s infinite;
    opacity: 0.22;
}

.button-loading-dots span:nth-child(2) {
    animation-delay: 0.18s;
}

.button-loading-dots span:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes buttonDotPulse {
    0%, 20% { opacity: 0.22; }
    45%, 80% { opacity: 1; }
    100% { opacity: 0.22; }
}

.field-input, .field-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 13px 14px;
    font-size: 15px; color: var(--text);
    font-family: inherit; outline: none;
    transition: border-color 0.18s, background 0.18s;
    -webkit-appearance: none;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
    touch-action: manipulation;
}
.field-input:focus, .field-textarea:focus {
    border-color: var(--border-accent);
    background: rgba(102, 126, 234, 0.06);
}
.field-input::placeholder, .field-textarea::placeholder { color: var(--muted); }

.field-textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

.cover-letter-textarea {
    height: 216px;
    min-height: 216px;
    max-height: 216px;
    resize: none;
    line-height: 1.45;
    overflow: hidden;
    transition: min-height 0.18s ease, max-height 0.18s ease, height 0.18s ease, background 0.18s ease;
}

.cover-letter-textarea.is-expanded {
    min-height: 216px;
    max-height: min(70vh, 560px);
    resize: vertical;
    overflow: auto;
}

.auth-captcha-image {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    margin: 10px 0 12px;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
}

select.field-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7a9a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
}
select.field-input option { background: var(--bg-soft); color: var(--text); }

/* ══════════════════════════════════════════════════════════════════
   Toggle switch (legacy class, unified with modern-toggle look)
   ══════════════════════════════════════════════════════════════════ */

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-name { font-size: 15px; font-weight: 600; }
.toggle-desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.toggle-row.is-locked { opacity: 0.72; }

.toggle-switch {
    position: relative; display: inline-block;
    width: 50px; height: 30px;
    flex-shrink: 0;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 30px;
    transition: background 0.25s, border-color 0.25s;
}
.toggle-slider::before {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px;
    border-radius: 50%; background: #fff;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
input:checked + .toggle-slider {
    background: var(--gradient-primary);
    border-color: transparent;
}
input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch input:disabled + .toggle-slider {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    cursor: not-allowed;
}
.toggle-switch input:disabled + .toggle-slider::before {
    background: rgba(255, 255, 255, 0.55);
}

/* ══════════════════════════════════════════════════════════════════
   Checkbox chips
   ══════════════════════════════════════════════════════════════════ */

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-group.vertical { flex-direction: column; gap: 6px; }

.checkbox-item {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    -webkit-user-select: none; user-select: none;
}
.checkbox-item:hover { background: var(--card-hover); border-color: var(--border-strong); }
.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] {
    width: 0; height: 0; opacity: 0; position: absolute; pointer-events: none;
}
.checkbox-item:has(input:checked) {
    background: rgba(102, 126, 234, 0.18);
    border-color: var(--border-accent);
    color: var(--text);
}
.checkbox-item label { cursor: pointer; margin: 0; font-weight: inherit; }
.checkbox-item:has(input:checked)::before {
    content: '✓';
    color: var(--accent);
    font-weight: 800;
    font-size: 11px;
    line-height: 1;
}

/* Dense vertical list style (used for long industry list) */
.checkbox-list {
    display: flex; flex-direction: column; gap: 4px;
}
.checkbox-list .checkbox-item {
    width: 100%;
    justify-content: flex-start;
    border-radius: 10px;
    padding: 10px 11px;
    min-height: 40px;
}
.checkbox-list .checkbox-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}
#industry-filter .checkbox-item {
    align-items: flex-start;
    min-height: 50px;
    padding: 10px 11px;
}
#industry-filter .checkbox-item span {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.32;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
#industry-filter .checkbox-item:has(input:checked)::before {
    flex: 0 0 auto;
    margin-top: 3px;
}

/* ══════════════════════════════════════════════════════════════════
   Stats
   ══════════════════════════════════════════════════════════════════ */

.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.stat-card {
    position: relative;
    background: var(--card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-align: center;
    overflow: hidden;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--gradient-primary);
    opacity: 0.6;
}
.stat-val {
    display: block; font-size: 32px; font-weight: 800; line-height: 1;
    min-width: 3ch;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, #a5b4ff, #c7b5ff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    transform-origin: center;
    transition: filter 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}
.stat-val-ready {
    animation: stat-value-in 0.34s ease both;
}
.stat-val-bump {
    animation: stat-value-bump 0.62s ease both;
}
.stat-card-updated {
    border-color: rgba(165, 180, 255, 0.42);
    box-shadow: 0 10px 30px rgba(105, 240, 174, 0.08), inset 0 0 0 1px rgba(165, 180, 255, 0.08);
    transform: translateY(-1px);
}
.stats-refreshing .stats-chart-card,
.stats-refreshing #st-history-list {
    opacity: 0.78;
    transition: opacity 0.18s ease;
}
@keyframes stat-value-in {
    from { opacity: 0; transform: translateY(5px); filter: blur(3px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes stat-value-bump {
    0% { transform: translateY(0) scale(1); filter: brightness(1); }
    36% { transform: translateY(-2px) scale(1.045); filter: brightness(1.18); }
    100% { transform: translateY(0) scale(1); filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) {
    .stat-val-ready,
    .stat-val-bump {
        animation: none;
    }
    .stat-card,
    .stat-val,
    .stats-refreshing .stats-chart-card,
    .stats-refreshing #st-history-list {
        transition: none;
    }
}
.stat-lbl {
    display: block; font-size: 11px; color: var(--muted); margin-top: 6px;
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}

#stats-screen .stats-row { grid-template-columns: repeat(4, 1fr); }
#stats-screen .stat-val  { font-size: 26px; }

.stats-chart-card {
    padding-bottom: 16px;
}

.stats-chart-frame {
    position: relative;
    margin-top: 8px;
    padding: 6px 0 0;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    overflow: hidden;
}

.stats-chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}
.stats-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.stats-chart-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.stats-chart-dot--success { background: rgba(105, 240, 174, 0.82); }
.stats-chart-dot--error { background: rgba(255, 107, 122, 0.82); }

/* ══════════════════════════════════════════════════════════════════
   Segmented control (e.g. stats period 7/30 days)
   ══════════════════════════════════════════════════════════════════ */

.segmented {
    display: inline-flex;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.segmented-option {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px; font-weight: 600;
    color: var(--text-soft);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}
.segmented-option.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}
.segmented-option:not(.active):hover { color: var(--text); }

/* ══════════════════════════════════════════════════════════════════
   Profile badge (legacy compat — used by app.js)
   ══════════════════════════════════════════════════════════════════ */

.profile-badge {
    font-size: 11px; font-weight: 700; padding: 5px 11px;
    border-radius: 999px; flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 4px;
}
.profile-badge.connected    { background: rgba(105, 240, 174, 0.12); color: var(--success); border: 1px solid rgba(105, 240, 174, 0.25); }
.profile-badge.disconnected { background: rgba(255, 71, 87, 0.12);   color: var(--danger);  border: 1px solid rgba(255, 71, 87, 0.25); }

.auto-apply-notice {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    right: auto;
    width: min(calc(100% - 24px), 340px);
    z-index: 1000;
    --notice-glow: rgba(255, 71, 87, 0.16);
    --notice-border: var(--border-strong);
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 58px;
    padding: 12px 12px 12px 15px;
    border-radius: 14px;
    border: 1px solid var(--notice-border);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
        rgba(17, 17, 42, 0.92);
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.48;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    text-align: left;
    box-shadow:
        0 16px 34px rgba(0, 0, 0, 0.34),
        0 0 32px var(--notice-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: autoApplyNoticeIn 0.32s cubic-bezier(0.2, 0.9, 0.2, 1) both;
    pointer-events: none;
    transform: translateX(-50%);
}
.auto-apply-notice__text {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 6px;
    white-space: pre-line;
}
.auto-apply-notice__mascot {
    width: 48px;
    height: 58px;
    flex: 0 0 auto;
    object-fit: contain;
    align-self: center;
    margin-left: -8px;
    filter: drop-shadow(0 8px 14px rgba(102, 126, 234, 0.28));
    animation: autoApplyMascotFloat 2.8s ease-in-out infinite;
}
.auto-apply-notice--info {
    --notice-glow: rgba(102, 126, 234, 0.20);
    --notice-border: var(--border-accent);
}
.auto-apply-notice--empty {
    --notice-glow: rgba(38, 198, 218, 0.20);
    --notice-border: rgba(38, 198, 218, 0.30);
}
.auto-apply-notice--empty .auto-apply-notice__mascot {
    filter: drop-shadow(0 8px 14px rgba(38, 198, 218, 0.30));
}
.auto-apply-notice--warning {
    --notice-glow: rgba(255, 184, 77, 0.18);
    --notice-border: rgba(255, 184, 77, 0.26);
}
.auto-apply-notice--leaving {
    animation: autoApplyNoticeOut 0.24s cubic-bezier(0.4, 0, 1, 1) forwards;
}
.auto-apply-notice[hidden] { display: none !important; }
.auto-apply-card.has-auto-apply-notice {
    z-index: 120;
}
@keyframes autoApplyNoticeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px) scale(0.975);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        filter: blur(0);
    }
}
@keyframes autoApplyNoticeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px) scale(0.975);
        filter: blur(4px);
    }
}
@keyframes autoApplyMascotFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}
@media (prefers-reduced-motion: reduce) {
    .auto-apply-notice {
        animation: autoApplyNoticeInReduced 0.2s ease-out both;
    }
    .auto-apply-notice__mascot {
        animation: none;
    }
    .auto-apply-notice--leaving {
        animation: autoApplyNoticeOutReduced 0.15s ease-out forwards;
    }
    @keyframes autoApplyNoticeInReduced {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    @keyframes autoApplyNoticeOutReduced {
        from { opacity: 1; }
        to { opacity: 0; }
    }
}
/* ── Settings account row ── */
.settings-account-row { display: flex; align-items: center; gap: 10px; }
.connected-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.connected-dot.on  { background: var(--success); box-shadow: 0 0 6px rgba(105, 240, 174, 0.5); }
.connected-dot.off { background: var(--danger); }
.settings-account-details {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
}
.settings-account-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    color: var(--muted);
    font-size: 13px;
}
.settings-account-line strong {
    color: var(--text);
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.settings-account-warning {
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 193, 7, 0.12);
    color: var(--warning);
    font-size: 12px;
    line-height: 1.35;
}

/* ══════════════════════════════════════════════════════════════════
   Resume / vacancy cards
   ══════════════════════════════════════════════════════════════════ */

.vacancy-card {
    background: var(--card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    transition: background 0.2s, border-color 0.2s;
}
.vacancy-card:hover { background: var(--card-hover); border-color: var(--border-strong); }

.resume-card {
    cursor: pointer;
    align-items: center;
}

.resume-card.is-selected {
    border-color: var(--border-accent);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.10), rgba(118, 75, 162, 0.06));
}

.vacancy-card .resume-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; line-height: 1;
    flex-shrink: 0;
}
.vacancy-card .resume-info { flex: 1; min-width: 0; }
.vacancy-card h3 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vacancy-card .resume-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.resume-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.vacancy-card .btn-small {
    background: var(--gradient-primary);
    color: #fff; border: none; border-radius: var(--radius-sm);
    padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
    white-space: nowrap; flex-shrink: 0;
    font-family: inherit;
    transition: opacity 0.15s, transform 0.12s;
}
.vacancy-card .btn-small:hover    { opacity: 0.9; }
.vacancy-card .btn-small:active   { transform: scale(0.96); }
.vacancy-card .btn-small:disabled {
    background: rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.22);
    color: #c5caff;
    opacity: 1;
    cursor: default;
    transform: none;
}

.vacancy-card .btn-small-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

.vacancy-card .btn-small-ghost:hover {
    background: var(--card-hover);
}

.resume-empty-state {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    margin-bottom: 12px;
    background: var(--card);
}

.resume-empty-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.resume-empty-sub {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted);
}

.resume-roast-card {
    margin-top: 12px;
}

.resume-roast-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.resume-roast-head .btn-small {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    font-family: inherit;
}

.resume-roast-head .btn-small:disabled {
    background: rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.22);
    color: #c5caff;
}

.resume-roast-result {
    margin-top: 14px;
    display: grid;
    gap: 12px;
}

.resume-roast-score {
    width: fit-content;
    min-width: 74px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-accent);
    background: rgba(102, 126, 234, 0.12);
    color: #fff;
}

.resume-roast-score span {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.resume-roast-score small {
    color: var(--text-soft);
    font-size: 12px;
    margin-left: 2px;
}

.resume-roast-verdict {
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

.resume-roast-error {
    border: 1px solid rgba(255, 71, 87, 0.24);
    border-radius: var(--radius-md);
    background: rgba(255, 71, 87, 0.10);
    color: #ff9aa8;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.4;
}

.resume-info-message,
.resume-roast-info,
.resume-roast-loading {
    border: 1px solid rgba(102, 126, 234, 0.24);
    border-radius: var(--radius-md);
    background: rgba(102, 126, 234, 0.10);
    color: var(--text);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.4;
}

.resume-info-message {
    margin-bottom: 10px;
}

.resume-roast-loading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.resume-roast-loading b,
.resume-roast-loading span {
    display: block;
}

.resume-roast-loading span {
    color: var(--text-soft);
    margin-top: 2px;
}

.resume-roast-spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    flex: 0 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.resume-roast-section {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.resume-roast-section h3 {
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.resume-roast-section p {
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    margin-top: 6px;
}

.resume-roast-rewrite p {
    color: var(--text-soft);
}

.autoraise-card {
    margin-top: 12px;
}

.resume-roast-history {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.resume-roast-history-opened {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    font-size: 12px;
}

.resume-roast-history-opened .btn-small-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

.resume-roast-history-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.resume-roast-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.resume-roast-history-item:first-of-type {
    border-top: 0;
}

.resume-roast-history-main {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.resume-roast-history-main span {
    font-size: 13px;
    font-weight: 700;
}

.resume-roast-history-main small {
    color: var(--text-soft);
    font-size: 11px;
}

.resume-roast-history-toggle {
    width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.resume-roast-history-toggle:active {
    transform: translateY(1px);
}

/* ══════════════════════════════════════════════════════════════════
   History list (stats screen)
   ══════════════════════════════════════════════════════════════════ */

.st-history-item {
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.st-history-item:last-child { border-bottom: none; }
.st-history-title {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-history-title:hover   { text-decoration: underline; }
.st-history-company { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.st-history-date    { font-size: 11px; color: var(--muted); margin-top: 2px; }
.st-history-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.st-history-status {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}
.st-history-status--success {
    color: #6dffc0;
    background: rgba(105, 240, 174, 0.12);
}
.st-history-status--failed {
    color: #ff8fa3;
    background: rgba(245, 87, 108, 0.13);
}
.st-history-error {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.35;
    color: #ffb3c0;
}
.st-history-note {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-soft);
}

/* ══════════════════════════════════════════════════════════════════
   Filters preview & tags
   ══════════════════════════════════════════════════════════════════ */

.filters-preview {
    background: var(--card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px; font-size: 13px; color: var(--muted);
    min-height: 40px;
}
.filters-preview .filter-tag {
    display: inline-block; padding: 4px 11px; margin: 3px 3px 3px 0;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #a5b4ff; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}

.selected-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 0;
}

.selected-filter-chips:empty { display: none; }

.selected-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.36);
    background: rgba(102, 126, 234, 0.16);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.selected-filter-chip--muted {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
}

.selected-filter-chip--readonly {
    padding-right: 10px;
}

.selected-filter-chip__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-filter-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.geo-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.geo-option {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font: inherit;
    cursor: pointer;
}

.geo-option small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.preview-text { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.hint-text    { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

.filters-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filters-summary-panel,
.filter-panel {
    background: var(--card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.filters-summary-panel {
    padding: 15px;
    border-color: rgba(102, 126, 234, 0.28);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(20, 20, 34, 0.72));
}

.filters-summary-panel__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.filters-summary-panel__title {
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.filters-summary-panel__text {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.45;
}

.filters-summary-panel__text.is-warning { color: #ffd166; }

.filters-summary-panel__badge {
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.42);
    background: rgba(102, 126, 234, 0.22);
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

.filters-summary-chips { margin-top: 12px; }

.filters-preview-btn {
    min-height: 46px;
    font-weight: 700;
}

.filters-open-hh-btn {
    margin-top: 12px;
}

.filters-open-hh-status {
    min-height: 18px;
}

.filter-panel {
    padding: 14px;
}

.filter-panel--important {
    border-color: rgba(102, 126, 234, 0.32);
}

.filter-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-panel__title {
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.filter-panel__summary {
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.4;
}

.filter-panel__summary.is-muted { color: var(--muted); }

.filter-panel__required {
    flex-shrink: 0;
    padding: 5px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 209, 102, 0.35);
    background: rgba(255, 209, 102, 0.10);
    color: #ffd166;
    font-size: 11px;
    font-weight: 800;
}

.filter-options-list {
    position: relative;
    max-height: min(250px, 40vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-top: 8px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.045);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.018);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 10px,
        #000 calc(100% - 10px),
        transparent 100%
    );
}

.filter-options-list::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.filter-options-list .checkbox-item {
    border-color: transparent;
    background: transparent;
}

.filter-options-list .checkbox-item:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
}

.filter-options-list .checkbox-item:has(input:checked) {
    border-color: rgba(102, 126, 234, 0.28);
    background: rgba(102, 126, 234, 0.12);
}

.filter-options-list .hint-text {
    margin: 0;
    padding: 14px 10px;
    text-align: center;
}

.filter-options-list--compact {
    max-height: min(204px, 32vh);
}

.filter-panel > .selected-filter-chips:not(:empty) {
    margin-bottom: 10px;
}

.filter-field-grid {
    display: grid;
    gap: 14px;
}

/* ══════════════════════════════════════════════════════════════════
   States
   ══════════════════════════════════════════════════════════════════ */

.loading {
    text-align: center; padding: 12px 14px;
    color: var(--muted); font-size: 14px;
    border-radius: var(--radius-md);
    background: var(--card); border: 1px solid var(--border);
}
.success {
    background: rgba(105, 240, 174, 0.1);
    border: 1px solid rgba(105, 240, 174, 0.25);
    color: var(--success);
    border-radius: var(--radius-md); padding: 14px 16px;
    font-size: 14px; font-weight: 500; line-height: 1.5;
}
.error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.25);
    color: var(--danger);
    border-radius: var(--radius-md); padding: 14px 16px;
    font-size: 14px; font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════
   Accordion
   ══════════════════════════════════════════════════════════════════ */

.accordion {
    background: var(--card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s;
}
.accordion + .accordion { margin-top: 10px; }
.accordion.open { border-color: var(--border-strong); }

.filters-layout .accordion + .accordion { margin-top: 10px; }
.filters-section-label {
    margin: 8px 2px 0;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}
.filters-section-label:first-child { margin-top: 0; }

.accordion-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none; -webkit-user-select: none;
    transition: background 0.15s;
}
.accordion-header:hover { background: rgba(255, 255, 255, 0.03); }

.accordion-title {
    flex: 1;
    font-size: 14px; font-weight: 700;
    color: var(--text);
    letter-spacing: 0.1px;
}
.accordion-caret {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    transition: transform 0.25s, color 0.25s;
    flex-shrink: 0;
}
.accordion.open .accordion-caret { transform: rotate(180deg); color: var(--accent); }

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.accordion.open .accordion-body {
    max-height: 1600px;
    transition: max-height 0.45s ease-in;
}
.accordion-body-inner {
    padding: 0 16px 16px;
    display: flex; flex-direction: column; gap: 14px;
}

/* ══════════════════════════════════════════════════════════════════
   Modal
   ══════════════════════════════════════════════════════════════════ */

.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: auto;
    height: var(--tg-viewport-height);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    padding: 16px;
    overflow-y: auto;
    animation: modal-fade 0.22s ease-out;
}
:root.keyboard-open .modal { align-items: flex-start; }
@keyframes modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: rgba(25, 25, 50, 0.95);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    max-width: 420px; width: 100%;
    max-height: 85vh;
    max-height: min(85vh, calc(var(--tg-viewport-height) - 32px)); overflow-y: auto;
    scroll-padding-bottom: calc(18px + var(--keyboard-inset));
    box-shadow: var(--shadow-lg);
    animation: modal-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
:root.keyboard-open .modal-content { max-height: calc(var(--tg-viewport-height) - 32px); }
@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.94) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    margin: 0; font-size: 17px; font-weight: 700;
    color: var(--text);
}
.modal-close {
    width: 32px; height: 32px;
    background: none; border: none;
    font-size: 20px; color: var(--muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.modal-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }

/* ══════════════════════════════════════════════════════════════════
   Toast notifications
   ══════════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed; bottom: 24px; left: 16px; right: 16px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 13px 16px;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600;
    line-height: 1.4;
    pointer-events: auto;
    animation: toast-slide-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: opacity 0.25s, transform 0.25s;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}
.toast-hide { opacity: 0; transform: translateY(8px); }
.toast-success {
    background: rgba(105, 240, 174, 0.14);
    border: 1px solid rgba(105, 240, 174, 0.3);
    color: var(--success);
}
.toast-error {
    background: rgba(255, 71, 87, 0.14);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--danger);
}
@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════
   Progress bar
   ══════════════════════════════════════════════════════════════════ */

.progress-bar {
    width: 100%; height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    margin-top: 8px; overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 6px;
    background: var(--gradient-primary);
    transition: width 0.4s ease;
}

.reminders-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reminders-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.14), rgba(118, 75, 162, 0.08)),
        var(--card);
}

.reminders-hero__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.16);
    border: 1px solid rgba(102, 126, 234, 0.22);
    font-size: 21px;
}

.reminders-hero__title {
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.reminders-hero__text {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.reminders-toggle-card,
.reminders-compose-card {
    margin: 0;
}

.reminders-rule-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.reminders-rule {
    min-width: 0;
    padding: 10px 8px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(180deg, rgba(102, 126, 234, 0.055), rgba(255,255,255,0.025)),
        var(--card);
}

.reminders-rule span,
.reminders-rule b,
.reminders-rule small {
    display: block;
}

.reminders-rule span {
    font-size: 17px;
    line-height: 1;
    color: #a5b4ff;
}

.reminders-rule b {
    margin-top: 6px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.2;
}

.reminders-rule small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.25;
}

.reminders-textarea {
    min-height: 112px;
}

.reminders-compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.reminders-compose-footer .hint-text {
    margin-top: 0;
}

.reminders-limit-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.reminders-limit-pill input {
    width: 48px;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font: inherit;
    text-align: center;
}

.reminders-actions {
    display: grid;
    gap: 8px;
}

#reminders-processed-counter {
    margin-top: 0;
}

.reminders-progress {
    position: relative;
    margin-top: 0;
    padding: 14px;
    overflow: hidden;
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.14), rgba(118, 75, 162, 0.08)),
        var(--card);
    box-shadow: 0 14px 34px rgba(31, 38, 135, 0.16);
}

.reminders-progress::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 0%, rgba(197,202,255,0.13) 45%, transparent 70%);
    transform: translateX(-120%);
}

.reminders-progress.is-running::before {
    animation: remindersSweep 1.8s ease-in-out infinite;
}

.reminders-progress__head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.reminders-progress__title {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.reminders-progress__status {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.reminders-progress.is-running .reminders-progress__status::after {
    content: "";
    display: inline-block;
    width: 1.2em;
    text-align: left;
    animation: reminderDots 1.2s steps(4, end) infinite;
}

.reminders-progress__pulse {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.45);
}

.reminders-progress.is-running .reminders-progress__pulse {
    animation: remindersPulse 1.35s ease-out infinite;
}

.reminders-progress__track {
    position: relative;
    z-index: 1;
    height: 8px;
    margin-top: 13px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}

.reminders-progress__fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--gradient-primary);
    box-shadow: 0 0 18px rgba(102, 126, 234, 0.45);
    transition: width 0.35s ease;
}

.reminders-progress.is-running .reminders-progress__fill {
    width: 62%;
    animation: remindersBar 1.6s ease-in-out infinite;
}

.reminders-progress.is-done .reminders-progress__fill {
    width: 100%;
}

.reminders-progress__meta {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

@keyframes remindersSweep {
    0% { transform: translateX(-120%); }
    55%, 100% { transform: translateX(120%); }
}

@keyframes remindersPulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.45); transform: scale(0.95); }
    70% { box-shadow: 0 0 0 11px rgba(102, 126, 234, 0); transform: scale(1); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); transform: scale(0.95); }
}

@keyframes remindersBar {
    0% { transform: translateX(-42%); }
    50% { transform: translateX(36%); }
    100% { transform: translateX(112%); }
}

@keyframes reminderDots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75%, 100% { content: "..."; }
}

/* ══════════════════════════════════════════════════════════════════
   Scrollbar
   ══════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar        { width: 4px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border-strong); border-radius: 4px; }

/* ══════════════════════════════════════════════════════════════════
   Touch-устройства: на iOS/Android :hover залипает после тапа и оставляет
   серый фон на action-card/аккордеонах/кнопках до следующего тапа по
   фону. Отключаем hover-фоны для устройств без настоящего ховера.
   ══════════════════════════════════════════════════════════════════ */

@media (hover: none) {
    .action-card:hover,
    .accordion-header:hover,
    .btn-back:hover,
    .btn-secondary:hover,
    .checkbox-item:hover,
    .vacancy-card:hover,
    .secondary-action-btn:hover,
    .card:hover {
        background: var(--card) !important;
        border-color: var(--border) !important;
        transform: none !important;
    }
    .accordion-header:hover { background: transparent !important; }
}

/* Убираем «серую» серую рамку фокуса от тапа (Mobile Safari/Chrome).
   :focus-visible по-прежнему работает для клавиатурной навигации. */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* ═══ Keyboard navigation: visible focus rings ══════════════════ */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.7);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Carousel swipe hint — fades out on first interaction */
.carousel-swipe-hint {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    opacity: 1;
    transition: opacity 0.8s ease;
    pointer-events: none;
    letter-spacing: 0.3px;
    height: 16px;
}
.carousel-swipe-hint.is-hidden {
    opacity: 0;
    height: 0;
    margin-top: 0;
}
@media (hover: hover) and (pointer: fine) {
    .carousel-swipe-hint {
        display: none;
    }
}

/* Filters count badge — shows active filter count */
.filters-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    margin-left: 6px;
}

/* Apply debug view toggle button */
.debug-view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.debug-view-toggle-btn:hover { background: var(--card-hover); color: var(--text); }
.debug-view-toggle-btn.is-active {
    background: rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.3);
    color: var(--accent);
}

/* AI context counter — color shift at thresholds */
#ai-context-counter { transition: color 0.25s; }
#ai-context-counter.at-warning { color: var(--warning); font-weight: 700; }
#ai-context-counter.at-danger  { color: var(--danger);  font-weight: 700; }

.ai-compact-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
}

.ai-compact-status--down {
    border-color: rgba(255, 71, 87, 0.35);
    background: rgba(255, 71, 87, 0.12);
}

.ai-compact-status--down .ai-status-dot {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.14);
}

.ai-status-pill--warn {
    border-color: rgba(255, 184, 77, 0.38);
    background: rgba(255, 184, 77, 0.12);
}

.ai-status-pill--warn .ai-status-dot {
    background: var(--warning);
    box-shadow: 0 0 0 4px rgba(255, 184, 77, 0.14);
}

.ai-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(105, 240, 174, 0.12);
    flex: 0 0 auto;
}

.ai-status-pill-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.ai-status-pill-sub,
.ai-feature-desc,
.ai-context-hint {
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-soft);
}

.ai-settings-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    overflow: hidden;
}

.ai-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.ai-setting-row:last-child {
    border-bottom: 0;
}

.ai-setting-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.ai-setting-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.14);
    color: var(--accent);
    font-size: 17px;
    font-weight: 800;
    flex: 0 0 auto;
}

.ai-disabled-by-admin {
    opacity: 0.58;
}

.ai-feature-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ai-badge-dev {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.ai-setting-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.ai-letter-profile-panel {
    margin: 10px;
    padding: 12px;
    border: 1px solid rgba(102, 126, 234, 0.28);
    border-radius: var(--radius-md);
    background: rgba(102, 126, 234, 0.08);
}

.ai-letter-profile-title {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.ai-letter-profile-grid {
    display: grid;
    gap: 8px;
}

.ai-letter-profile-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.ai-letter-profile-option:has(input:checked) {
    border-color: rgba(102, 126, 234, 0.72);
    background: rgba(102, 126, 234, 0.16);
    color: var(--text);
}

.ai-letter-profile-option input {
    accent-color: var(--accent);
}

.ai-detail-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    overflow: hidden;
}

.ai-settings-panel .ai-detail-panel {
    margin: 10px;
}

.ai-detail-panel summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.ai-detail-panel summary::-webkit-details-marker {
    display: none;
}

.ai-detail-panel summary small {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.ai-detail-body {
    display: grid;
    gap: 10px;
    padding: 0 14px 14px;
}

#ai-auto-reply-controls .loading,
#ai-auto-reply-result .success,
#ai-auto-reply-result .error {
    margin-top: 2px;
    font-size: 13px;
}

.ai-context-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ai-context-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.ai-context-fill-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    padding: 10px 12px;
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.28);
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.ai-context-fill-btn:active {
    transform: translateY(1px);
    box-shadow: 0 8px 18px rgba(102, 126, 234, 0.22);
}

.ai-context-fill-btn:disabled {
    opacity: 0.58;
    box-shadow: none;
}

.ai-context-card {
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.07), rgba(255, 255, 255, 0.02)),
        var(--card);
}

.ai-context-textarea {
    min-height: 126px;
    overflow: hidden;
    line-height: 1.45;
}

.ai-context-progress {
    margin-top: 10px;
}

.ai-context-progress-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.ai-context-progress-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--gradient-primary);
    transition: width 0.25s ease;
}

.ai-context-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 12px;
}

.ai-context-guide {
    margin-top: 10px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.35;
}

.ai-context-guide b {
    color: var(--text);
    font-weight: 800;
}

.ai-history-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    text-align: left;
}

.ai-history-link-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.14);
    font-size: 20px;
}

.ai-history-link-title,
.ai-history-link-desc {
    display: block;
}

.ai-history-link-title {
    font-size: 14px;
    font-weight: 800;
}

.ai-history-link-desc {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-soft);
}

.ai-history-link-arrow {
    margin-left: auto;
    color: var(--text-soft);
    font-size: 18px;
}

.utility-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.utility-action {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.utility-action:not(:disabled):active {
    transform: translateY(1px);
}

.utility-action--disabled,
.utility-action:disabled {
    opacity: 0.68;
    cursor: not-allowed;
    box-shadow: none;
}

.utility-action-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.14);
    font-size: 18px;
}

.utility-action-copy {
    min-width: 0;
    flex: 1;
}

.utility-action-title,
.utility-action-desc {
    display: block;
}

.utility-action-title {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
}

.utility-action-desc {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-soft);
    line-height: 1.2;
}

.utility-action-badge {
    flex: 0 0 auto;
    max-width: 86px;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(255, 193, 7, 0.14);
    color: #946200;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
}

.utility-action-arrow {
    flex: 0 0 auto;
    color: var(--text-soft);
    font-size: 18px;
}

#ai-history-filter {
    margin-bottom: 12px;
}

.ai-history-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    overflow: hidden;
    margin-bottom: 10px;
}

.ai-history-item summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
}

.ai-history-item summary::-webkit-details-marker {
    display: none;
}

.ai-history-kind {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    flex: 0 0 auto;
}

.ai-history-main {
    min-width: 0;
    flex: 1;
}

.ai-history-title,
.ai-history-meta {
    display: block;
}

.ai-history-title {
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-history-meta,
.ai-history-extra {
    color: var(--text-soft);
    font-size: 12px;
    margin-top: 2px;
}

.ai-history-caret {
    color: var(--text-soft);
    transition: transform 0.2s ease;
}

.ai-history-item[open] .ai-history-caret {
    transform: rotate(180deg);
}

.ai-history-details {
    display: grid;
    gap: 10px;
    padding: 0 14px 14px;
}

.ai-history-answer {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.ai-history-question {
    color: var(--text-soft);
    font-size: 12px;
    margin-bottom: 4px;
}

.ai-history-text {
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
}

/* Empty state illustrations */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 16px;
    text-align: center;
}
.empty-state__icon { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3)); }
.empty-state__title { font-size: 15px; font-weight: 600; color: var(--text-soft); }
.empty-state__sub   { font-size: 13px; color: var(--muted); line-height: 1.5; }
.empty-state__action { margin-top: 8px; }

/* Skeleton loading — shimmer effect */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes tooltipIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.skeleton {
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 0%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.03) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════════
   Dark-theme compat (the app is always dark; these are no-op aliases
   retained for compatibility with telegram theme-changed events)
   ══════════════════════════════════════════════════════════════════ */

body.dark-theme {
    /* already dark — inherit :root vars */
}

/* ══════════════════════════════════════════════════════════════════
   Mobile (<= 480px)
   На компактных экранах уменьшаем паддинги и крупные шрифты, чтобы
   не было бокового скролла и карточки не вылезали за вьюпорт.
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .screen-content { padding: 12px 12px calc(24px + var(--keyboard-inset)); gap: 12px; }
    .screen-content.centered { padding-top: 24px; }

    .card { padding: 14px; border-radius: 14px; }

    .auth-title { font-size: 22px; }
    .auth-sub   { font-size: 13px; max-width: 100%; }

    .screen-title { font-size: 16px; }
    .btn-hero    { font-size: 15px; padding: 14px; }

    .field-input { font-size: 14px; padding: 10px 12px; }

    .stat-val         { font-size: 26px; }
    #stats-screen .stat-val { font-size: 22px; }
    #stats-screen .stats-row { grid-template-columns: repeat(2, 1fr); }

    .vacancy-card             { grid-template-columns: 40px minmax(0, 1fr); }
    .vacancy-card h3          { font-size: 13px; }
    .resume-actions           { grid-column: 2; width: 100%; }
    .resume-actions .btn-small { flex: 1; text-align: center; }
    .st-history-title         { font-size: 13px; }
    .st-history-company       { font-size: 11px; }
    .st-history-date          { font-size: 10px; }

    .toggle-name { font-size: 14px; }
    .toggle-desc { font-size: 11px; }
}

/* Очень узкие экраны (<= 360px) — старые Android. Дожимаем ещё компактнее. */
@media (max-width: 360px) {
    .screen-content { padding: 10px 10px calc(20px + var(--keyboard-inset)); gap: 10px; }
    .card { padding: 12px; }
    .auth-title { font-size: 20px; }
    .stat-val { font-size: 22px; }
}

/* ── Tier cards (в стиле лендинга website/) ─────────────────────────── */
.tier-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    margin-bottom: 16px;
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}
.tier-card:hover { transform: translateY(-4px); }
.tier-card--pro {
    border-color: rgba(102, 126, 234, 0.5);
    background: linear-gradient(160deg, rgba(102, 126, 234, 0.10) 0%, rgba(118, 75, 162, 0.08) 100%);
}
.tier-card--pro::after {
    content: 'Популярный';
    position: absolute; top: 18px; right: -32px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
    padding: 4px 36px;
    transform: rotate(45deg);
}
.tier-card--max {
    border-color: rgba(255, 180, 0, 0.35);
    background: linear-gradient(160deg, rgba(255, 180, 0, 0.07) 0%, rgba(118, 75, 162, 0.08) 100%);
}
.tier-card--max::after {
    content: 'Максимум';
    position: absolute; top: 18px; right: -34px;
    background: linear-gradient(135deg, #f5a623, #e8820c);
    color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
    padding: 4px 38px;
    transform: rotate(45deg);
}
.tier-card--current {
    border-color: rgba(105, 240, 174, 0.55);
    background: linear-gradient(160deg, rgba(105, 240, 174, 0.08) 0%, rgba(102, 126, 234, 0.05) 100%);
}
.tier-card--current::after {
    content: 'Активен';
    position: absolute; top: 18px; right: -30px;
    background: linear-gradient(135deg, #43e97b, #38a169);
    color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
    padding: 4px 36px;
    transform: rotate(45deg);
}
.tier-card__name {
    font-size: 13px; font-weight: 700;
    color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase;
    margin-bottom: 10px;
}
.tier-card__price {
    font-size: 46px; font-weight: 900; line-height: 1;
    color: var(--text); margin-bottom: 4px;
}
.tier-card__old-price {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    text-decoration: line-through;
}
.tier-card__promo-price {
    margin: 2px 0 6px;
    color: #6dffc0;
    font-size: 12px;
    font-weight: 700;
}
.tier-card__price small {
    font-size: 18px; font-weight: 600; color: var(--muted);
}
.tier-card__period {
    font-size: 13px; color: var(--muted); margin-bottom: 22px;
}
.tier-card__features {
    list-style: none; display: flex; flex-direction: column; gap: 10px;
    margin: 0 0 22px; padding: 0;
}
.tier-card__features li {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 14px; color: var(--text); line-height: 1.45;
}
.tier-card__features li::before {
    content: '✓'; color: #69f0ae; font-weight: 700; flex-shrink: 0;
}
.tier-card__features li.off { color: var(--muted); }
.tier-card__features li.off::before { content: '—'; color: var(--muted); }
.tier-card__features li.highlight-ai {
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78de8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.tier-card__features li.highlight-ai::before {
    content: '✦'; color: var(--accent); -webkit-text-fill-color: var(--accent);
}
.tier-card__btn {
    display: block; width: 100%; text-align: center;
    font-size: 15px; font-weight: 700;
    padding: 14px; border-radius: 12px; border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.tier-card__btn--outline {
    border: 1.5px solid var(--border); color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}
.tier-card__btn--outline:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.tier-card__btn--filled {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff; box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35);
}
.tier-card__btn--filled:hover { opacity: 0.9; transform: translateY(-1px); }
.tier-card__btn--max {
    background: linear-gradient(135deg, #f5a623, #e8820c);
    color: #fff; box-shadow: 0 4px 20px rgba(245, 166, 35, 0.35);
}
.tier-card__btn--max:hover { opacity: 0.9; transform: translateY(-1px); }
.tier-card__btn:disabled { opacity: 0.55; cursor: not-allowed; }

.checkout-promo {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 16px;
}
.checkout-promo__title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}
.checkout-promo__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.checkout-promo__input {
    text-transform: uppercase;
}
.checkout-promo__btn {
    min-height: 44px;
    padding: 0 14px;
    white-space: nowrap;
}
.checkout-promo__status {
    min-height: 18px;
    margin-top: 8px;
    font-size: 12px;
    color: #6dffc0;
}
.checkout-promo__status--error {
    color: #ff8fa3;
}

/* ── Locked feature cards ────────────────────────────────────────────── */
.is-locked { position: relative; pointer-events: auto; }
.is-locked::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(1px);
    border-radius: inherit;
    pointer-events: none;
}
.feature-badge {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: 0.5px;
    margin-left: 8px;
    vertical-align: middle;
    position: relative;
    z-index: 1;
}
.feature-badge--pro { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.feature-badge--max { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; }
.feature-badge--start { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); color: #1a1a1a; }

/* ── Free banner (top of main screen when plan='free') ──────────────── */
.free-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
    cursor: pointer;
}
.free-banner__text { font-size: 13px; line-height: 1.4; }
.free-banner__cta {
    background: white;
    color: #667eea;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    border: none;
}

/* ── Subscription screen card ────────────────────────────────────────── */
.sub-card {
    background: var(--card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 12px;
}
.sub-card__label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.sub-card__value { font-size: 18px; font-weight: 700; color: var(--text); }
.sub-card__value--muted { color: var(--text-soft); font-weight: 500; font-size: 15px; }


/* ══════════════════════════════════════════════════════════════════
   Реферальная программа
   ══════════════════════════════════════════════════════════════════ */

.action-card--accent {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.18), rgba(118, 75, 162, 0.18));
    border: 1px solid var(--border-accent);
}
.action-card--accent:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.28), rgba(118, 75, 162, 0.28));
    border-color: var(--accent);
    box-shadow: var(--shadow-accent);
}

.referral-hero {
    text-align: center;
    padding: 22px 18px;
    margin-bottom: 14px;
}
.referral-hero-icon { font-size: 36px; margin-bottom: 8px; }
.referral-hero-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.referral-hero-sub { font-size: 13px; color: var(--text-soft); line-height: 1.45; }

.referral-link-card {
    padding: 16px;
    margin-bottom: 14px;
}
.referral-link-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.referral-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.referral-link-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 13px;
    padding: 10px 12px;
    outline: none;
    user-select: all;
}
.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    width: 42px;
    height: 42px;
    font-size: 18px;
    cursor: pointer;
}
.btn-icon:active { transform: scale(0.96); }

.referral-list { padding: 14px 16px; margin-top: 14px; }
.referral-list-title {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.referral-list-items { display: flex; flex-direction: column; gap: 6px; }
.referral-list-empty {
    color: var(--text-soft);
    font-size: 13px;
    text-align: center;
    padding: 14px 4px;
    line-height: 1.5;
}
.referral-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
}
.ref-row-name { color: var(--text); font-size: 14px; font-weight: 500; }
.ref-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.ref-badge--paid {
    background: rgba(105, 240, 174, 0.18);
    color: var(--success);
}

.copy-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 20, 36, 0.95);
    color: var(--text);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-strong);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 10001;
}
.copy-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ══════════════════════════════════════════════════════════════════
   Онбординг-туториал (overlay)
   ══════════════════════════════════════════════════════════════════ */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(5, 5, 18, 0.78);
    pointer-events: auto;
}

.onboarding-spotlight {
    display: none !important;
}

@keyframes onboardingPulse {
    0%, 100% { box-shadow: 0 0 0 9999px rgba(5, 5, 18, 0.78), 0 0 0 0 rgba(102, 126, 234, 0.5); }
    50%      { box-shadow: 0 0 0 9999px rgba(5, 5, 18, 0.78), 0 0 0 8px rgba(102, 126, 234, 0); }
}

.onboarding-card {
    position: absolute;
    z-index: 10003;
    background: rgba(20, 20, 36, 0.96);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-lg);
    width: 320px;
    max-width: calc(100vw - 24px);
    transition: top 0.22s ease, left 0.22s ease;
}

.onboarding-highlight {
    position: relative !important;
    z-index: 10002 !important;
    border-color: rgba(102, 126, 234, 0.78) !important;
    box-shadow:
        0 0 0 2px rgba(102, 126, 234, 0.72),
        0 0 0 8px rgba(102, 126, 234, 0.18),
        0 16px 36px rgba(0, 0, 0, 0.38) !important;
}
.onboarding-step-counter {
    display: inline-block;
    font-size: 11px;
    color: var(--accent);
    background: rgba(102, 126, 234, 0.16);
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
}
.onboarding-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.onboarding-text {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.5;
    margin-bottom: 14px;
}
.onboarding-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.onboarding-skip {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 13px;
    padding: 8px 4px;
    cursor: pointer;
}
.onboarding-skip:hover { color: var(--text-soft); }
.onboarding-next {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-accent);
}
.onboarding-next:active { transform: scale(0.97); }

/* ═══════════════════════════════════════════════════════════════════
   Channel subscription gate (обязательная подписка на инфо-канал)
   ═══════════════════════════════════════════════════════════════════ */

.channel-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(5, 5, 18, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.channel-gate-card {
    background: rgba(20, 20, 36, 0.98);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.channel-gate-icon {
    font-size: 44px;
    margin-bottom: 12px;
}
.channel-gate-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}
.channel-gate-text {
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.5;
    margin-bottom: 20px;
}
.channel-gate-link {
    display: block;
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    box-shadow: var(--shadow-accent);
}
.channel-gate-link:active { transform: scale(0.98); }
.channel-gate-check {
    display: block;
    width: 100%;
    background: rgba(102, 126, 234, 0.16);
    color: var(--accent);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.channel-gate-check:active { transform: scale(0.98); }
.channel-gate-check:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.channel-gate-status {
    margin-top: 12px;
    font-size: 13px;
    min-height: 18px;
}
.channel-gate-status.error { color: #ff6b6b; }
.channel-gate-status.ok    { color: #4ade80; }

.apply-debug-view {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.apply-debug-view[hidden] { display: none; }
.apply-debug-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.apply-debug-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.apply-debug-stage {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.apply-debug-link {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}
.apply-debug-vacancy {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.apply-debug-frame {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
    aspect-ratio: 16 / 10;
}
.apply-debug-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.apply-debug-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.apply-debug-url {
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
