/* ========================================
   PsychGuard Mini App - Prototype Styles
   Telegram Theme Compatible
   ======================================== */

/* ========================================
   Device Simulator Styles
   ======================================== */

.simulator-mode {
    background: linear-gradient(135deg, #2A2118 0%, #3D2914 50%, #1F170F 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    overflow: auto;
}

/* Device Selector Bar */
.device-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.device-selector label {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.device-selector select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.device-selector select:focus {
    outline: none;
    border-color: #2481cc;
}

.device-selector button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.device-selector button:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Device Frame */
.device-frame {
    position: relative;
    background: #1c1c1e;
    border-radius: 50px;
    padding: 12px;
    box-shadow:
        0 0 0 3px #2c2c2e,
        0 0 0 6px #1c1c1e,
        0 25px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Device Screen */
.device-screen {
    position: relative;
    border-radius: 40px;
    overflow: hidden;
    background: var(--tg-theme-bg-color);
}

/* Dynamic Island */
.dynamic-island {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 126px;
    height: 37px;
    background: #000;
    border-radius: 20px;
    z-index: 1000;
}

/* Device Sizes */
.device-frame.iphone-15-pro .device-screen {
    width: 393px;
    height: 852px;
}

.device-frame.iphone-15-pro-max .device-screen {
    width: 430px;
    height: 932px;
}

.device-frame.iphone-se .device-screen {
    width: 375px;
    height: 667px;
}

.device-frame.iphone-se .dynamic-island {
    display: none;
}

.device-frame.iphone-se {
    border-radius: 40px;
}

.device-frame.iphone-se .device-screen {
    border-radius: 30px;
}

/* iPhone SE - Home Button */
.device-frame.iphone-se::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border: 3px solid #3a3a3c;
    border-radius: 50%;
    background: #1c1c1e;
}

.device-frame.iphone-14 .device-screen {
    width: 390px;
    height: 844px;
}

.device-frame.iphone-14 .dynamic-island {
    width: 80px;
    height: 25px;
    border-radius: 13px;
}

.device-frame.pixel-7 .device-screen {
    width: 412px;
    height: 915px;
}

.device-frame.pixel-7 {
    border-radius: 35px;
}

.device-frame.pixel-7 .device-screen {
    border-radius: 25px;
}

.device-frame.pixel-7 .dynamic-island {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    top: 20px;
}

.device-frame.samsung-s23 .device-screen {
    width: 360px;
    height: 780px;
}

.device-frame.samsung-s23 {
    border-radius: 35px;
}

.device-frame.samsung-s23 .device-screen {
    border-radius: 25px;
}

.device-frame.samsung-s23 .dynamic-island {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    top: 15px;
}

/* Fullscreen Mode */
.device-frame.fullscreen {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.device-frame.fullscreen .device-screen {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
}

.device-frame.fullscreen .dynamic-island {
    display: none;
}

body.simulator-mode.fullscreen-active {
    padding: 0;
}

body.simulator-mode.fullscreen-active .device-selector {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    opacity: 0.3;
    transition: opacity 0.3s;
}

body.simulator-mode.fullscreen-active .device-selector:hover {
    opacity: 1;
}

/* App Container in Simulator */
.simulator-mode #app {
    height: 100%;
}

.simulator-mode .bottom-nav {
    position: absolute;
    border-radius: 0 0 40px 40px;
}

.device-frame.iphone-se .bottom-nav {
    border-radius: 0 0 30px 30px;
}

.device-frame.pixel-7 .bottom-nav,
.device-frame.samsung-s23 .bottom-nav {
    border-radius: 0 0 25px 25px;
}

.device-frame.fullscreen .bottom-nav {
    border-radius: 0;
}

/* Toast in Simulator */
.simulator-mode .toast {
    bottom: 100px;
}

/* Modal in Simulator */
.simulator-mode .modal-overlay {
    border-radius: 40px;
}

.device-frame.fullscreen .modal-overlay {
    border-radius: 0;
}

/* Notch safe area simulation — ALL scoped to body.simulator-mode/.fullscreen-active
 * so they don't bleed into the real Telegram WebApp, which uses .tg-fullscreen
 * + the Telegram safe-area pipeline instead. Real Telegram also adds
 * `.device-frame.fullscreen` via app.js, so we must NOT match on that alone. */
.simulator-mode .header {
    padding-top: calc(50px + var(--spacing-md));
}

body.simulator-mode .device-frame.iphone-se .header {
    padding-top: calc(20px + var(--spacing-md));
}

body.simulator-mode .device-frame.pixel-7 .header,
body.simulator-mode .device-frame.samsung-s23 .header {
    padding-top: calc(40px + var(--spacing-md));
}

body.fullscreen-active .device-frame.fullscreen .header {
    padding-top: var(--spacing-md);
}

/* Scale for smaller screens */
@media (max-height: 950px) {
    .device-frame:not(.fullscreen) {
        transform: scale(0.85);
        transform-origin: top center;
    }
}

@media (max-height: 800px) {
    .device-frame:not(.fullscreen) {
        transform: scale(0.75);
        transform-origin: top center;
    }
}

@media (max-height: 700px) {
    .device-frame:not(.fullscreen) {
        transform: scale(0.65);
        transform-origin: top center;
    }
}

/* CSS Variables - Modern Minimal Theme */
:root {
    /* Light Theme - Off-white neutrals with indigo accent */
    --tg-theme-bg-color: #FAFAFA;
    --tg-theme-text-color: #1F2937;
    --tg-theme-hint-color: #6B7280;
    --tg-theme-link-color: #4F46E5;
    --tg-theme-button-color: #4F46E5;
    --tg-theme-button-text-color: #FFFFFF;
    --tg-theme-secondary-bg-color: #F3F4F6;
    --tg-theme-header-bg-color: #FFFFFF;
    --tg-theme-accent-text-color: #4338CA;
    --tg-theme-section-bg-color: #FFFFFF;
    --tg-theme-section-header-text-color: #6B7280;
    --tg-theme-section-separator-color: #E5E7EB;
    --tg-theme-subtitle-text-color: #9CA3AF;
    --tg-theme-destructive-text-color: #DC2626;

    /* Legacy boho-* tokens remapped to the minimal palette so existing
       rules keep working without sweeping changes. Names retained
       intentionally — semantics now match modern neutral/indigo system. */
    --boho-orange: #4F46E5;        /* primary accent */
    --boho-tangerine: #6366F1;     /* accent-light */
    --boho-coral: #EF4444;         /* warm alert */
    --boho-magenta: #DB2777;       /* secondary accent */
    --boho-pink: #F472B6;          /* secondary accent light */
    --boho-teal: #0891B2;          /* cool accent */
    --boho-turquoise: #06B6D4;     /* cool accent light */
    --boho-cream: #FAFAFA;         /* neutral bg */
    --boho-sand: #F3F4F6;          /* neutral bg subtle */
    --boho-caramel: #6B7280;       /* neutral text mid */
    --boho-brown: #4B5563;         /* neutral text strong */
    --boho-espresso: #1F2937;      /* neutral text darkest */
    --boho-sage: #10B981;          /* positive */
    --boho-forest: #059669;        /* positive darker */

    /* Accent gradients - subtle, single-hue ramps */
    --gradient-primary: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    --gradient-coral: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
    --gradient-teal: linear-gradient(135deg, #0891B2 0%, #06B6D4 100%);

    /* Severity - calm, low saturation */
    --severity-high: #DC2626;
    --severity-high-bg: #FEE2E2;
    --severity-medium: #D97706;
    --severity-medium-bg: #FEF3C7;
    --severity-low: #059669;
    --severity-low-bg: #D1FAE5;
    --severity-none: #6B7280;
    --severity-none-bg: #F3F4F6;

    /* Health Score */
    --health-high: #059669;
    --health-high-bg: #D1FAE5;
    --health-medium: #D97706;
    --health-medium-bg: #FEF3C7;
    --health-low: #DC2626;
    --health-low-bg: #FEE2E2;

    /* Type scale: 12 / 13 / 14 / 16 / 18 / 20 / 24 (plus display sizes for icons) */
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 999px;

    /* Shadows - cool, restrained */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 16px rgba(79, 70, 229, 0.18);

    /* Safe areas
     * Two stacking insets matter inside Telegram WebApps:
     *   1. OS-level chrome (iOS notch / Dynamic Island, Android status bar)
     *      → exposed via env(safe-area-inset-*) once the WebApp scrolls
     *        edge-to-edge.
     *   2. Telegram-level chrome (the close/profile pill in fullscreen and,
     *      on iOS, the top swipe handle area) → exposed via
     *      WebApp.contentSafeAreaInset (Bot API 8.0+) and the older
     *      WebApp.safeAreaInset. These are written to the
     *      --tg-content-safe-area-* / --tg-safe-area-* custom props from
     *      JS on init and on `safeAreaChanged` / `contentSafeAreaChanged` /
     *      `fullscreenChanged`.
     * Taking the max keeps us correct whether we're in normal expanded mode,
     * iOS-with-notch, fullscreen, or running outside Telegram (where the
     * tg-* vars stay 0px and we fall back to OS env() alone). */
    --tg-content-safe-area-top: 0px;
    --tg-content-safe-area-bottom: 0px;
    --tg-safe-area-top: 0px;
    --tg-safe-area-bottom: 0px;
    --tg-effective-safe-area-top: 0px;
    --tg-effective-safe-area-bottom: 0px;
    --safe-area-top: max(
        env(safe-area-inset-top, 0px),
        var(--tg-effective-safe-area-top),
        var(--tg-content-safe-area-top),
        var(--tg-safe-area-top)
    );
    --safe-area-bottom: max(
        env(safe-area-inset-bottom, 0px),
        var(--tg-effective-safe-area-bottom),
        var(--tg-content-safe-area-bottom),
        var(--tg-safe-area-bottom)
    );
}

/* Alias tokens used by the later component blocks (feedback inbox, loading
   spinner, summary modals, …). They were referenced without fallbacks but
   never defined, which made every declaration using them invalid at
   computed-value time (e.g. the global .spinner rendered with no border).
   Declared on both :root and .theme-dark so the var() references resolve
   against the active theme's values instead of inheriting light-theme ones. */
:root,
.theme-light,
.theme-dark {
    --text-primary: var(--tg-theme-text-color);
    --text-secondary: var(--tg-theme-hint-color);
    --text-tertiary: var(--tg-theme-subtitle-text-color);
    --bg-primary: var(--tg-theme-bg-color);
    --bg-secondary: var(--tg-theme-secondary-bg-color);
    --bg-tertiary: var(--tg-theme-section-bg-color);
    --card-bg: var(--tg-theme-section-bg-color);
    --hover-bg: var(--tg-theme-secondary-bg-color);
    --border-color: var(--tg-theme-section-separator-color);
    --accent-color: var(--tg-theme-button-color);
    --accent-gradient: var(--gradient-primary);
    --error-color: var(--tg-theme-destructive-text-color);
    --border-radius-md: var(--radius-md);
    --border-radius-lg: var(--radius-lg);
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-xxl: 24px;
    --transition-fast: 0.15s ease;
}

/* Brand light — only when the user picks it in Settings. By default the
   --tg-theme-* tokens come from Telegram (set on <html> by the SDK). */
.theme-light {
    --tg-theme-bg-color: #FAFAFA;
    --tg-theme-text-color: #1F2937;
    --tg-theme-hint-color: #6B7280;
    --tg-theme-link-color: #4F46E5;
    --tg-theme-button-color: #4F46E5;
    --tg-theme-button-text-color: #FFFFFF;
    --tg-theme-secondary-bg-color: #F3F4F6;
    --tg-theme-header-bg-color: #FFFFFF;
    --tg-theme-accent-text-color: #4338CA;
    --tg-theme-section-bg-color: #FFFFFF;
    --tg-theme-section-header-text-color: #6B7280;
    --tg-theme-section-separator-color: #E5E7EB;
    --tg-theme-subtitle-text-color: #9CA3AF;
    --tg-theme-destructive-text-color: #DC2626;
}

/* Dark Theme - Slate with indigo accent (user-selected in Settings) */
.theme-dark {
    --tg-theme-bg-color: #0F172A;
    --tg-theme-text-color: #F1F5F9;
    --tg-theme-hint-color: #CBD5E1;
    --tg-theme-link-color: #A5B4FC;
    --tg-theme-button-color: #6366F1;
    --tg-theme-button-text-color: #FFFFFF;
    --tg-theme-secondary-bg-color: #1E293B;
    --tg-theme-header-bg-color: #0F172A;
    --tg-theme-accent-text-color: #C7D2FE;
    --tg-theme-section-bg-color: #1E293B;
    --tg-theme-section-header-text-color: #CBD5E1;
    --tg-theme-section-separator-color: #334155;
    --tg-theme-subtitle-text-color: #CBD5E1;
    --tg-theme-destructive-text-color: #FCA5A5;
}

/* Scheme tokens (non-Telegram): follow Telegram's dark colorScheme by default,
   so they apply with either .scheme-dark (Telegram colors) or .theme-dark (brand). */
.theme-dark,
.scheme-dark {
    /* Legacy boho-* tokens (dark) — brightened for AA contrast */
    --boho-orange: #A5B4FC;
    --boho-tangerine: #C7D2FE;
    --boho-coral: #FCA5A5;
    --boho-magenta: #F9A8D4;
    --boho-pink: #FBCFE8;
    --boho-teal: #67E8F9;
    --boho-turquoise: #A5F3FC;
    --boho-cream: #0F172A;
    --boho-sand: #1E293B;
    --boho-caramel: #CBD5E1;
    --boho-brown: #E2E8F0;
    --boho-espresso: #F8FAFC;
    --boho-sage: #6EE7B7;
    --boho-forest: #34D399;

    /* Severity */
    --severity-high: #F87171;
    --severity-high-bg: rgba(248, 113, 113, 0.15);
    --severity-medium: #FBBF24;
    --severity-medium-bg: rgba(251, 191, 36, 0.15);
    --severity-low: #34D399;
    --severity-low-bg: rgba(52, 211, 153, 0.15);
    --severity-none: #94A3B8;
    --severity-none-bg: rgba(148, 163, 184, 0.12);

    /* Health */
    --health-high: #34D399;
    --health-high-bg: rgba(52, 211, 153, 0.15);
    --health-medium: #FBBF24;
    --health-medium-bg: rgba(251, 191, 36, 0.15);
    --health-low: #F87171;
    --health-low-bg: rgba(248, 113, 113, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 16px rgba(129, 140, 248, 0.25);
}

/* ========================================
   Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* ========================================
   Lucide Icons
   ======================================== */

.lucide-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.lucide-icon-xl {
    width: 72px;
    height: 72px;
    stroke-width: 1.5;
    color: var(--boho-orange);
}

.lucide-icon-lg {
    width: 32px;
    height: 32px;
    stroke-width: 2;
}

.lucide-icon-sm {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.lucide-icon-xs {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.lucide-icon-xxs {
    width: 12px;
    height: 12px;
    stroke-width: 2.5;
    vertical-align: middle;
}

.lucide-avatar {
    width: 40px;
    height: 40px;
    stroke-width: 1.5;
    color: var(--boho-caramel);
    background: var(--boho-sand);
    padding: 8px;
    border-radius: 50%;
}

/* Navigation icons */
.nav-icon .lucide-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

/* Header action icons */
.header-action .lucide-icon,
.header-action .lucide-icon-sm,
.header-action .lucide-icon-xs {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    color: var(--boho-orange, #e8a055);
}
.header-action {
    color: var(--boho-orange, #e8a055);
}

/* Button icons */
.btn .lucide-icon-sm {
    margin-left: 4px;
}

/* Step number icons */
.step-num .lucide-icon-xs {
    color: white;
}

/* Disclaimer check icons */
.disclaimer-list .lucide-icon-xs {
    color: var(--boho-sage);
    margin-right: 8px;
    vertical-align: middle;
}

/* Severity badge icons */
.severity-badge .lucide-icon-xxs {
    margin-right: 3px;
}

/* Health score icons */
.health-score .lucide-icon-xxs {
    margin-right: 2px;
}

/* Dialog chevron */
.dialog-chevron .lucide-icon-sm {
    color: var(--tg-theme-hint-color);
}

/* ========================================
   Typography - Space Grotesk for headlines
   ======================================== */

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    font-weight: 600;
    color: var(--tg-theme-text-color);
    letter-spacing: -0.02em;
}

h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p {
    color: var(--tg-theme-text-color);
}

.text-secondary {
    color: var(--tg-theme-hint-color);
}

.text-accent {
    color: var(--tg-theme-accent-text-color);
}

.text-danger {
    color: var(--tg-theme-destructive-text-color);
}

/* ========================================
   Screen Container
   ======================================== */

.screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    padding-bottom: calc(var(--spacing-xl) + var(--safe-area-bottom));
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   Header
   ======================================== */

.header {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    padding-top: var(--spacing-md);
    padding-top: max(var(--spacing-md), calc(env(safe-area-inset-top, 0px) + var(--spacing-md)));
    background: linear-gradient(180deg, var(--tg-theme-header-bg-color) 0%, var(--tg-theme-bg-color) 100%);
    border-bottom: 1px solid var(--tg-theme-section-separator-color);
    min-height: 56px;
}

.header.with-back {
    gap: var(--spacing-sm);
}

.back-btn {
    background: none;
    border: none;
    color: var(--tg-theme-link-color);
    font-size: 14px;
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.back-btn:hover {
    transform: translateX(-3px);
}

.header-content {
    flex: 1;
}

.header-title {
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-subtitle {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.header-action {
    background: none;
    border: none;
    font-size: 20px;
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.header-action:hover {
    transform: scale(1.1);
}

/* ========================================
   Bottom Navigation - Warm & Friendly
   ======================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: linear-gradient(0deg, var(--tg-theme-header-bg-color) 0%, rgba(245, 230, 211, 0.95) 100%);
    border-top: 1px solid var(--tg-theme-section-separator-color);
    padding: var(--spacing-sm);
    padding-bottom: calc(var(--safe-area-bottom) + var(--spacing-sm));
    z-index: 100;
    backdrop-filter: blur(10px);
}

.theme-dark .bottom-nav,
.scheme-dark .bottom-nav {
    background: linear-gradient(0deg, var(--tg-theme-header-bg-color) 0%, rgba(45, 35, 26, 0.95) 100%);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    color: var(--tg-theme-hint-color);
    transition: all 0.25s ease;
    border-radius: var(--radius-md);
    position: relative;
}

.nav-item:hover {
    color: var(--boho-orange);
}

.nav-item.active {
    color: var(--boho-orange);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 3px 3px;
}

.nav-icon {
    font-size: 24px;
    transition: transform 0.2s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.nav-item.active .nav-icon {
    animation: gentlePop 0.3s ease;
}

.nav-label {
    font-size: 12px;
    font-weight: 600;
}

/* ========================================
   Buttons - Warm & Friendly
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 14px 28px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--tg-theme-button-text-color);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--boho-sand) 0%, var(--tg-theme-secondary-bg-color) 100%);
    color: var(--tg-theme-text-color);
    box-shadow: var(--shadow-sm);
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
}

.btn-secondary:hover {
    box-shadow: var(--shadow-md);
}

.btn-text {
    background: none;
    color: var(--tg-theme-link-color);
    padding: var(--spacing-sm);
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
}

.btn-text:hover {
    color: var(--boho-coral);
}

.btn-danger {
    background: var(--gradient-coral);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-full {
    width: 100%;
}

/* ========================================
   Cards - Warm & Cozy
   ======================================== */

.card, .dialog-card, .health-card, .context-card,
.message-card, .technique-card, .summary-card,
.section-card, .report-card, .stat-card {
    background-color: var(--tg-theme-section-bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--tg-theme-section-separator-color);
    transition: all 0.25s ease;
}

.dialog-card:hover,
.report-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--boho-tangerine);
}

.dialog-card:active,
.report-card:active {
    transform: translateY(0);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.card-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(139, 111, 71, 0.2));
}

.card-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-theme-section-header-text-color);
}

.card-action {
    background: none;
    border: none;
    color: var(--tg-theme-link-color);
    font-size: 14px;
    cursor: pointer;
}

/* ========================================
   Dialog List
   ======================================== */

.dialog-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.dialog-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    cursor: pointer;
    transition: background-color 0.2s;
}

.dialog-card:active {
    background-color: var(--tg-theme-secondary-bg-color);
}

.dialog-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--tg-theme-secondary-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.dialog-info {
    flex: 1;
    min-width: 0;
}

.dialog-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 2px;
}

.dialog-name {
    font-weight: 600;
    font-size: 16px;
}

.dialog-meta {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.dialog-stats {
    margin-top: 4px;
}

.dialog-time {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-top: 2px;
}

.dialog-chevron {
    color: var(--tg-theme-hint-color);
    font-size: 16px;
}

/* Unread Dialog Indicator */
.dialog-card.unread {
    position: relative;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(129, 140, 248, 0.04) 100%);
    border-left: 3px solid var(--boho-orange);
}

.dialog-card.unread .dialog-name {
    font-weight: 700;
}

.unread-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--boho-orange) 0%, var(--boho-tangerine) 100%);
    color: white;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
    animation: gentlePulse 2s ease-in-out infinite;
}

.unread-badge i {
    width: 10px;
    height: 10px;
}

@keyframes gentlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.unread-dot {
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--boho-orange);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--boho-orange);
}

/* ========================================
   Severity Badges
   ======================================== */

.severity-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.severity-badge.high {
    background-color: var(--severity-high-bg);
    color: var(--severity-high);
    box-shadow: 0 2px 6px rgba(201, 68, 68, 0.2);
}

.severity-badge.processing {
    background-color: rgba(36, 129, 204, 0.18);
    color: var(--tg-theme-link-color);
    gap: 6px;
}
.severity-badge.processing .spinner-dot {
    width: 8px; height: 8px; border-radius: 50%;
    border: 1.5px solid currentColor;
    border-top-color: transparent;
    display: inline-block;
    animation: fab-spin 0.9s linear infinite;
}
.analysis-card.pending { opacity: 0.92; }
@keyframes fab-spin { to { transform: rotate(360deg); } }

.severity-badge.medium {
    background-color: var(--severity-medium-bg);
    color: var(--severity-medium);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

.severity-badge.low {
    background-color: var(--severity-low-bg);
    color: var(--severity-low);
    box-shadow: 0 2px 6px rgba(123, 160, 91, 0.2);
}

.severity-badge.none {
    background-color: var(--severity-none-bg);
    color: var(--severity-none);
}

/* Health Score */
.health-score {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}

.health-score.high {
    color: var(--health-high);
    background-color: var(--health-high-bg);
}
.health-score.medium {
    color: var(--health-medium);
    background-color: var(--health-medium-bg);
}
.health-score.low {
    color: var(--health-low);
    background-color: var(--health-low-bg);
}

/* ========================================
   Health Card
   ======================================== */

.health-card {
    text-align: center;
    padding: var(--spacing-lg);
}

.health-score-big {
    font-size: 64px;
    font-weight: 700;
    color: var(--severity-low);
    line-height: 1;
    margin: var(--spacing-md) 0;
}

.health-bar {
    height: 8px;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: var(--spacing-md) 0;
}

.health-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--severity-high), var(--severity-medium), var(--severity-low));
    border-radius: var(--radius-full);
    transition: width 0.3s;
}

.health-trend {
    font-size: 14px;
    margin-bottom: var(--spacing-md);
}

.health-trend.negative { color: var(--severity-high); }
.health-trend.positive { color: var(--severity-low); }
.health-trend.neutral { color: var(--tg-theme-hint-color); }

.health-stats {
    display: flex;
    justify-content: space-around;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--tg-theme-section-separator-color);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

/* ========================================
   Context Card
   ======================================== */

.context-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--tg-theme-text-color);
}

/* ========================================
   Tabs
   ======================================== */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--tg-theme-section-separator-color);
    margin-bottom: var(--spacing-md);
}

.tab {
    flex: 1;
    padding: var(--spacing-md);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    color: var(--tg-theme-accent-text-color);
    border-bottom-color: var(--tg-theme-accent-text-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   Timeline
   ======================================== */

.timeline {
    position: relative;
}

.timeline-group {
    margin-bottom: var(--spacing-lg);
}

.timeline-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-theme-section-header-text-color);
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-sm);
}

.timeline-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--tg-theme-section-bg-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s;
}

.timeline-item:active {
    background-color: var(--tg-theme-secondary-bg-color);
}

.timeline-time {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    flex-shrink: 0;
    width: 40px;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-content .severity-badge {
    margin-bottom: var(--spacing-xs);
}

.techniques {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.timeline-quote {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-action {
    font-size: 12px;
    color: var(--tg-theme-link-color);
    flex-shrink: 0;
    align-self: center;
}

/* ========================================
   Summaries
   ======================================== */

.summary-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.summary-card {
    background-color: var(--tg-theme-section-bg-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.summary-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.summary-icon {
    font-size: 18px;
}

.summary-period {
    font-weight: 600;
}

.summary-stats {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-sm);
}

.summary-techniques {
    font-size: 13px;
    margin-bottom: var(--spacing-sm);
}

.summary-trend {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.summary-trend.negative { color: var(--severity-high); }
.summary-trend.positive { color: var(--severity-low); }
.summary-trend.neutral { color: var(--tg-theme-hint-color); }

.summary-text {
    font-size: 13px;
    font-style: italic;
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-sm);
}

.summary-card.collapsed .summary-text,
.summary-card.collapsed .summary-techniques {
    display: none;
}

/* ========================================
   Statistics
   ======================================== */

.stats-section {
    margin-bottom: var(--spacing-lg);
}

.stats-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-theme-section-header-text-color);
    margin-bottom: var(--spacing-md);
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.bar-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.bar-label {
    font-size: 12px;
    width: 90px;
    flex-shrink: 0;
}

.bar {
    flex: 1;
    height: 12px;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background-color: var(--tg-theme-button-color);
    border-radius: var(--radius-full);
}

.bar-value {
    font-size: 12px;
    font-weight: 500;
    width: 40px;
    text-align: right;
}

.severity-distribution {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

.severity-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.severity-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.severity-dot.high { background-color: var(--severity-high); }
.severity-dot.medium { background-color: var(--severity-medium); }
.severity-dot.low { background-color: var(--severity-low); }
.severity-dot.none { background-color: var(--severity-none); }

.severity-label {
    font-size: 13px;
}

.activity-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 100px;
    padding: var(--spacing-md) 0;
}

.day-bar {
    flex: 1;
    margin: 0 4px;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
    transition: background-color 0.2s;
}

.day-bar.active {
    background-color: var(--tg-theme-button-color);
}

.day-bar span {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.activity-note {
    text-align: center;
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-top: var(--spacing-lg);
}

/* ========================================
   Analysis Detail
   ======================================== */

.severity-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.severity-banner.high {
    background-color: rgba(255, 59, 48, 0.1);
}

.severity-banner.medium {
    background-color: rgba(255, 149, 0, 0.1);
}

.severity-banner.low {
    background-color: rgba(52, 199, 89, 0.1);
}

.severity-icon {
    font-size: 32px;
}

.severity-level {
    display: block;
    font-weight: 700;
    font-size: 16px;
}

.severity-desc {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.message-text, .response-text {
    font-size: 16px;
    line-height: 1.6;
    padding: var(--spacing-md);
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--tg-theme-button-color);
    margin: var(--spacing-sm) 0;
}

.message-meta {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.techniques-section, .summary-section, .advice-section, .response-section {
    margin-bottom: var(--spacing-md);
}

.technique-card {
    margin-top: var(--spacing-sm);
}

.technique-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.technique-name {
    font-weight: 600;
}

.technique-confidence {
    font-size: 14px;
    font-weight: 600;
}

.technique-confidence.high { color: var(--severity-high); }
.technique-confidence.medium { color: var(--severity-medium); }

.technique-desc {
    font-size: 14px;
    line-height: 1.5;
    color: var(--tg-theme-text-color);
    margin-bottom: var(--spacing-sm);
}

.typical-badge {
    display: inline-block;
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-sm);
}

.advice-text {
    font-size: 14px;
    line-height: 1.6;
}

.actions-row {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.actions-row .btn {
    flex: 1;
}

/* ========================================
   Reports
   ======================================== */

.filters {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--tg-theme-section-header-text-color);
}

.filter-select {
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--tg-theme-secondary-bg-color);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--tg-theme-text-color);
}

.reports-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.report-header {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.report-icon {
    font-size: 24px;
}

.report-info {
    display: flex;
    flex-direction: column;
}

.report-title {
    font-weight: 600;
}

.report-period {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.report-stats {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-md);
}

.report-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* ========================================
   Profile
   ======================================== */

.profile-header {
    text-align: center;
    padding: var(--spacing-lg) 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--tg-theme-secondary-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto var(--spacing-md);
}

.profile-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.profile-username {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    display: block;
    margin-bottom: var(--spacing-sm);
}

.profile-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.stats-cards {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    flex: 1;
    text-align: center;
    padding: var(--spacing-md);
    margin-bottom: 0;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    display: block;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}

.techniques-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.technique-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
}

.technique-rank {
    font-weight: 600;
    width: 24px;
}

.technique-row .technique-name {
    flex: 1;
}

.technique-count {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.subscription {
    border: 1px solid var(--tg-theme-button-color);
}

.subscription-info {
    padding-top: var(--spacing-sm);
}

.subscription-plan {
    margin-bottom: var(--spacing-md);
}

.plan-name {
    display: block;
    font-size: 18px;
    font-weight: 600;
}

.plan-status {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.subscription-features {
    list-style: none;
    margin-bottom: var(--spacing-md);
}

.subscription-features li {
    font-size: 14px;
    padding: var(--spacing-xs) 0;
    color: var(--severity-low);
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* ========================================
   Settings
   ======================================== */

.settings-section {
    margin-bottom: var(--spacing-lg);
}

.settings-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-theme-section-header-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--spacing-sm) 0;
    margin-bottom: var(--spacing-sm);
}

.settings-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    background-color: var(--tg-theme-section-bg-color);
    margin-bottom: 1px;
    cursor: pointer;
}

.settings-item:first-of-type {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.settings-item:last-of-type {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    margin-bottom: 0;
}

.settings-item:only-of-type {
    border-radius: var(--radius-md);
}

.settings-item.danger .settings-label {
    color: var(--tg-theme-destructive-text-color);
}

.settings-info {
    flex: 1;
}

.settings-label {
    display: block;
    font-size: 16px;
}

.settings-desc {
    display: block;
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-top: 2px;
}

.settings-value {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
}

.settings-chevron {
    color: var(--tg-theme-hint-color);
    margin-left: var(--spacing-sm);
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 50px;
    height: 30px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-full);
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background-color: var(--severity-low);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Retention Picker */
.settings-intro {
    font-size: 16px;
    margin-bottom: var(--spacing-lg);
}

.retention-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.retention-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--tg-theme-section-bg-color);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.retention-option input {
    display: none;
}

.retention-radio {
    width: 22px;
    height: 22px;
    border: 2px solid var(--tg-theme-hint-color);
    border-radius: 50%;
    position: relative;
}

.retention-option input:checked + .retention-radio {
    border-color: var(--tg-theme-button-color);
}

.retention-option input:checked + .retention-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-color: var(--tg-theme-button-color);
    border-radius: 50%;
}

.retention-info {
    flex: 1;
}

.retention-days {
    display: block;
    font-size: 16px;
    font-weight: 500;
}

.retention-desc {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
}

.retention-warning {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background-color: rgba(255, 149, 0, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.warning-icon {
    font-size: 20px;
}

.retention-warning p {
    font-size: 13px;
    color: var(--severity-medium);
}

/* Delete Confirmation */
.delete-confirm {
    text-align: center;
    padding-top: var(--spacing-xl);
}

.delete-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
}

.delete-title {
    font-size: 24px;
    margin-bottom: var(--spacing-sm);
}

.delete-text {
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-md);
}

.delete-list {
    list-style: none;
    text-align: left;
    padding: var(--spacing-md);
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.delete-list li {
    padding: var(--spacing-xs) 0;
    color: var(--tg-theme-hint-color);
}

.delete-confirm-input {
    text-align: left;
    margin-bottom: var(--spacing-lg);
}

.delete-confirm-input label {
    display: block;
    font-size: 14px;
    margin-bottom: var(--spacing-sm);
}

.input {
    width: 100%;
    padding: var(--spacing-md);
    background-color: var(--tg-theme-secondary-bg-color);
    border: 1px solid var(--tg-theme-section-separator-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    color: var(--tg-theme-text-color);
}

.input:focus {
    border-color: var(--tg-theme-button-color);
}

.delete-actions {
    display: flex;
    gap: var(--spacing-md);
}

.delete-actions .btn {
    flex: 1;
}

/* ========================================
   Onboarding - Warm & Welcoming
   ======================================== */

.onboarding-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    background: linear-gradient(180deg, var(--tg-theme-bg-color) 0%, var(--tg-theme-secondary-bg-color) 100%);
}

.onboarding-content {
    text-align: center;
    max-width: 320px;
}

.onboarding-icon {
    font-size: 80px;
    margin-bottom: var(--spacing-lg);
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.35));
    animation: gentleBounce 2s ease-in-out infinite;
}

.onboarding-title {
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--boho-espresso) 0%, var(--boho-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.theme-dark .onboarding-title,
.scheme-dark .onboarding-title {
    background: linear-gradient(135deg, var(--boho-cream) 0%, var(--boho-tangerine) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.onboarding-text {
    font-size: 16px;
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.onboarding-text.disclaimer {
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.onboarding-steps {
    text-align: left;
    margin-bottom: var(--spacing-lg);
}

.step {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) 0;
    animation: slideInLeft 0.5s ease-out backwards;
}

.step:nth-child(1) { animation-delay: 0.1s; }
.step:nth-child(2) { animation-delay: 0.2s; }
.step:nth-child(3) { animation-delay: 0.3s; }

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
}

.step-text {
    font-size: 16px;
}

.disclaimer-list {
    list-style: none;
    text-align: left;
    margin-bottom: var(--spacing-lg);
}

.disclaimer-list li {
    padding: var(--spacing-sm) 0;
    font-size: 16px;
    animation: fadeIn 0.4s ease-out backwards;
}

.disclaimer-list li:nth-child(1) { animation-delay: 0.1s; }
.disclaimer-list li:nth-child(2) { animation-delay: 0.2s; }
.disclaimer-list li:nth-child(3) { animation-delay: 0.3s; }

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--tg-theme-secondary-bg-color);
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--gradient-primary);
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.45);
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-xl);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-title {
    font-size: 20px;
    margin-bottom: var(--spacing-sm);
}

.empty-text {
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-lg);
}

/* ========================================
   Loading & Error States
   ======================================== */

.loading-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-xl);
    height: 100%;
}

.loading-spinner {
    font-size: 48px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-text {
    font-size: 16px;
    color: var(--tg-theme-hint-color);
    margin-top: var(--spacing-md);
}

.error-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
}

.error-title {
    font-size: 18px;
    margin-bottom: var(--spacing-sm);
}

.error-text {
    color: var(--tg-theme-hint-color);
    margin-bottom: var(--spacing-lg);
}

/* ========================================
   Toast
   ======================================== */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--tg-theme-text-color);
    color: var(--tg-theme-bg-color);
    border-radius: var(--radius-full);
    font-size: 14px;
    box-shadow: var(--shadow-md);
    z-index: 200;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ========================================
   Modal
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 300;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background-color: var(--tg-theme-bg-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUpModal 0.3s ease;
}

@keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--tg-theme-section-separator-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--tg-theme-hint-color);
    cursor: pointer;
    padding: var(--spacing-sm);
}

.modal-content {
    padding: var(--spacing-md);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-top: 1px solid var(--tg-theme-section-separator-color);
}

.modal-actions .btn {
    flex: 1;
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.form-select, .form-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--tg-theme-secondary-bg-color);
    border: 1px solid var(--tg-theme-section-separator-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    color: var(--tg-theme-text-color);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    line-height: 1.5;
}

.form-textarea::placeholder {
    color: var(--tg-theme-hint-color);
}

.date-range {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.date-range .form-input {
    flex: 1;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.radio-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.radio-option input {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--tg-theme-hint-color);
    border-radius: 50%;
    position: relative;
}

.radio-option input:checked + .radio-custom {
    border-color: var(--tg-theme-button-color);
}

.radio-option input:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: var(--tg-theme-button-color);
    border-radius: 50%;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 360px) {
    .health-score-big {
        font-size: 48px;
    }

    .stats-cards {
        flex-wrap: wrap;
    }

    .stat-card {
        min-width: calc(50% - var(--spacing-xs));
    }
}

/* ========================================
   Scrollbar Styling
   ======================================== */

.content::-webkit-scrollbar {
    width: 4px;
}

.content::-webkit-scrollbar-track {
    background: transparent;
}

.content::-webkit-scrollbar-thumb {
    background-color: var(--boho-sand);
    border-radius: var(--radius-full);
}

.theme-dark .content::-webkit-scrollbar-thumb,
.scheme-dark .content::-webkit-scrollbar-thumb {
    background-color: var(--tg-theme-hint-color);
}

/* ========================================
   Animations - Lively & Friendly
   ======================================== */

/* Gentle bounce for icons */
@keyframes gentleBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Pop effect for nav items */
@keyframes gentlePop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Slide in from left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade in up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale in */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse glow */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(214, 69, 80, 0.4);
    }
    50% {
        box-shadow: 0 0 15px 4px rgba(214, 69, 80, 0.25);
    }
}

/* Shake for attention */
@keyframes gentleShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-4px);
    }
    75% {
        transform: translateX(4px);
    }
}

/* Spin for loading */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Heartbeat for important elements */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    15% {
        transform: scale(1.1);
    }
    30% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.05);
    }
}

/* ========================================
   Animation Classes - Apply to elements
   ======================================== */

/* Dialog cards staggered animation */
.dialog-card {
    animation: fadeInUp 0.4s ease-out backwards;
}

.dialog-card:nth-child(1) { animation-delay: 0.05s; }
.dialog-card:nth-child(2) { animation-delay: 0.1s; }
.dialog-card:nth-child(3) { animation-delay: 0.15s; }
.dialog-card:nth-child(4) { animation-delay: 0.2s; }
.dialog-card:nth-child(5) { animation-delay: 0.25s; }
.dialog-card:nth-child(6) { animation-delay: 0.3s; }
.dialog-card:nth-child(7) { animation-delay: 0.35s; }
.dialog-card:nth-child(8) { animation-delay: 0.4s; }
.dialog-card:nth-child(9) { animation-delay: 0.45s; }
.dialog-card:nth-child(10) { animation-delay: 0.5s; }

/* Timeline items animation */
.timeline-item {
    animation: slideInLeft 0.4s ease-out backwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }

/* Cards animation */
.health-card,
.context-card,
.message-card,
.summary-card {
    animation: scaleIn 0.35s ease-out backwards;
}

.health-card { animation-delay: 0.1s; }
.context-card { animation-delay: 0.15s; }
.message-card { animation-delay: 0.2s; }
.summary-card { animation-delay: 0.25s; }

/* Technique cards */
.technique-card {
    animation: fadeInUp 0.35s ease-out backwards;
}

.technique-card:nth-child(1) { animation-delay: 0.1s; }
.technique-card:nth-child(2) { animation-delay: 0.2s; }
.technique-card:nth-child(3) { animation-delay: 0.3s; }

/* Severity badge pulse on high */
.severity-badge.high {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Toast animation */
.toast:not(.hidden) {
    animation: slideInRight 0.3s ease-out, fadeIn 0.3s ease-out;
}

/* Modal animation */
.modal-sheet {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button hover ripple effect */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn:active::after {
    width: 200%;
    height: 200%;
}

/* Avatar bounce on hover */
.dialog-avatar {
    transition: transform 0.2s ease;
}

.dialog-card:hover .dialog-avatar {
    animation: gentleBounce 0.5s ease;
}

/* Health score number animation */
.health-score-big {
    animation: scaleIn 0.5s ease-out;
}

/* Progress bar animation */
.health-bar-fill {
    animation: growWidth 1s ease-out;
}

@keyframes growWidth {
    from {
        width: 0;
    }
}

/* Stat cards staggered */
.stat-card {
    animation: fadeInUp 0.3s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.25s; }

/* Profile stats */
.profile-stat {
    transition: transform 0.2s ease;
}

.profile-stat:hover {
    transform: scale(1.05);
}

/* Toggle switch animation */
.toggle-slider {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   AI Chat Styles
   ======================================== */

/* Ask AI Button Section */
.ask-ai-section {
    margin: var(--spacing-lg) 0;
    text-align: center;
}

.btn-ai {
    background: linear-gradient(135deg, var(--boho-teal) 0%, var(--boho-turquoise) 100%);
    color: white;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(58, 155, 165, 0.35);
    font-family: 'Space Grotesk', 'DM Sans', sans-serif;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(58, 155, 165, 0.45);
}

.btn-ai i {
    margin-right: 8px;
}

.ask-ai-hint {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-top: var(--spacing-sm);
}

/* Chat Screen Layout */
.chat-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-screen .chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
}

.chat-header {
    border-bottom: 1px solid var(--tg-theme-section-separator-color);
}

.ai-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--boho-teal) 0%, var(--boho-turquoise) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 2px 10px rgba(58, 155, 165, 0.3);
}

/* Chat Context Card */
.chat-context-card {
    margin: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--boho-teal);
}

.context-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--boho-teal);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.context-text {
    font-size: 13px;
    color: var(--tg-theme-text-color);
    font-style: italic;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.context-techniques {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.technique-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

.technique-tag.high {
    background: var(--severity-high-bg);
    color: var(--severity-high);
}

.technique-tag.medium {
    background: var(--severity-medium-bg);
    color: var(--severity-medium);
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Chat Message */
.chat-message {
    display: flex;
    gap: 10px;
    animation: fadeInUp 0.3s ease-out;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--boho-teal) 0%, var(--boho-turquoise) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.message-content {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.chat-message.user .message-content {
    align-items: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.message-bubble.ai {
    background: var(--tg-theme-section-bg-color);
    border: 1px solid var(--tg-theme-section-separator-color);
    border-radius: 18px 18px 18px 4px;
}

.message-bubble.user {
    background: linear-gradient(135deg, var(--boho-orange) 0%, var(--boho-tangerine) 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message-bubble p {
    margin: 0 0 8px 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-time {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-top: 4px;
    padding: 0 4px;
}

/* AI Message Content Styles */
.suggestion-list {
    margin: 8px 0;
    padding-left: 20px;
}

.suggestion-list li {
    margin: 4px 0;
    color: var(--boho-teal);
    font-weight: 500;
}

.ai-point {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--tg-theme-section-separator-color);
}

.ai-point:last-of-type {
    border-bottom: none;
}

.point-icon {
    color: var(--boho-orange);
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-note {
    margin-top: 12px;
    padding: 10px;
    background: rgba(58, 155, 165, 0.1);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--boho-teal);
}

.ai-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
}

.ai-step .step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.ai-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--boho-orange);
}

.ai-warning i {
    color: var(--boho-coral);
}

/* Quick Suggestions */
.quick-suggestions {
    display: flex;
    gap: 8px;
    padding: var(--spacing-sm) var(--spacing-md);
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

.quick-suggestions::-webkit-scrollbar {
    display: none;
}

.suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--tg-theme-secondary-bg-color);
    border: 1px solid var(--tg-theme-section-separator-color);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--tg-theme-text-color);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: linear-gradient(135deg, rgba(58, 155, 165, 0.1) 0%, rgba(74, 189, 196, 0.1) 100%);
    border-color: var(--boho-teal);
    color: var(--boho-teal);
}

.suggestion-chip i {
    color: var(--boho-teal);
}

/* Chat Input */
.chat-input-container {
    padding: var(--spacing-md);
    background: var(--tg-theme-bg-color);
    border-top: 1px solid var(--tg-theme-section-separator-color);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--tg-theme-section-bg-color);
    border-radius: var(--radius-full);
    padding: 4px 4px 4px 16px;
    border: 1px solid var(--tg-theme-section-separator-color);
    transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--boho-teal);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--tg-theme-text-color);
    padding: 8px 0;
}

.chat-input::placeholder {
    color: var(--tg-theme-hint-color);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--boho-teal) 0%, var(--boho-turquoise) 100%);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(58, 155, 165, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--boho-teal);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ========================================
   Safe Area Support (iOS + Telegram fullscreen)
   ========================================
   The :root --safe-area-top/--safe-area-bottom vars already max() over the
   iOS env() values and the Telegram-supplied --tg-*-safe-area-* values, so
   we just funnel everything through them. Keeping the @supports block lets
   browsers that don't understand env() still pick up the Telegram side
   (--tg-content-safe-area-*) via the var() fallback chain.

   IMPORTANT: no arbitrary px floor here — we use --spacing-md so the header
   matches the default compact look in non-fullscreen Telegram (where
   Telegram's own chrome sits above the WebView, so no extra top space is
   needed). The 88px fullscreen floor is enforced below for `tg-fullscreen`. */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: var(--spacing-md);
        padding-top: max(var(--spacing-md), calc(var(--safe-area-top) + var(--spacing-md)));
    }

    .bottom-nav {
        padding-bottom: calc(var(--safe-area-bottom) + var(--spacing-sm));
    }

    #app {
        padding-bottom: var(--safe-area-bottom);
    }
}

/* Fullscreen floor: when Telegram is in fullscreen mode (close pill visible),
 * guarantee the header clears the pill even on clients/devices where
 * contentSafeAreaInset under-reports (e.g. returns 0). The pill is ~50-60px
 * tall on iOS; 88px gives comfortable breathing room. Bottom gets a smaller
 * floor for the home-indicator area. Body class `tg-fullscreen` is toggled
 * in api.js. Applies to ALL top-of-screen header variants — both `.header`
 * (most screens) AND alternate header components like `.screen-header`
 * used by fragments / fragment-detail screens. */
body.tg-fullscreen .header,
body.tg-fullscreen .screen-header {
    padding-top: 88px;
    padding-top: max(88px, calc(var(--safe-area-top) + 16px));
}
body.tg-fullscreen .bottom-nav {
    padding-bottom: calc(max(var(--safe-area-bottom), 24px) + var(--spacing-sm));
}

/* On-screen safe-area diagnostic badge. Renders a tiny fixed strip at the
 * very top of the viewport showing the live values reported by Telegram +
 * the OS, so we can debug top-offset issues from a screenshot without
 * needing devtools / console access. Disable by removing class. */
.safe-area-debug {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    padding: 2px 8px;
    background: rgba(220, 38, 38, 0.92);
    color: #fff;
    font: 600 10px/1.2 -apple-system, system-ui, sans-serif;
    text-align: center;
    pointer-events: none;
    letter-spacing: 0.2px;
}

/* ========================================
   Loading Overlay
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--text-primary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    text-align: center;
    color: var(--text-secondary);
    min-height: 200px;
}

.empty-state h3 {
    margin: var(--spacing-md) 0 var(--spacing-sm);
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.empty-state p {
    font-size: var(--font-size-sm);
    margin: 0;
}

.empty-state .lucide-icon-xl,
.empty-state .lucide-icon-lg {
    opacity: 0.5;
}

/* ========================================
   Dynamic Dialog Cards (API Data)
   ======================================== */

.dialog-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dialog-card:hover {
    background: var(--hover-bg);
    transform: translateX(4px);
}

.dialog-card:active {
    transform: scale(0.98);
}

.dialog-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.dialog-info {
    flex: 1;
    min-width: 0;
}

.dialog-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.dialog-name {
    font-weight: 600;
    font-size: var(--font-size-md);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dialog-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.dialog-meta span::after {
    content: '•';
    margin-left: var(--spacing-sm);
    opacity: 0.5;
}

.dialog-meta span:last-child::after {
    display: none;
}

.dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.health-score {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.dialog-arrow {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* ========================================
   Analysis Cards (API Data)
   ======================================== */

.analysis-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.analysis-card:hover {
    background: var(--hover-bg);
}

.analysis-card:active {
    transform: scale(0.98);
}

.analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.analysis-date {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.analysis-techniques {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.analysis-summary {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* ========================================
   Technique Items (Analysis Detail)
   ======================================== */

.technique-item {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.technique-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.technique-name {
    font-weight: 600;
    color: var(--text-primary);
}

.confidence {
    font-size: var(--font-size-sm);
    color: var(--accent-color);
    font-weight: 500;
}

.technique-evidence {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
    font-style: italic;
}

/* ========================================
   Telegram-Specific Styles
   ======================================== */

body:not(.simulator-mode) {
    background: var(--tg-theme-bg-color, var(--bg-primary));
}

body:not(.simulator-mode) .device-frame {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

body:not(.simulator-mode) .device-screen {
    border-radius: 0 !important;
}

body:not(.simulator-mode) .dynamic-island {
    display: none !important;
}

/* ========================================
   Survey Screen Styles
   ======================================== */

.survey-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Survey Header */
.survey-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.survey-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.survey-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.survey-close:active {
    transform: scale(0.95);
}

.survey-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.survey-progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.survey-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--boho-teal));
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.survey-progress-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-align: right;
}

/* Survey Content */
.survey-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

/* Survey Context */
.survey-context {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.survey-context-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    border-radius: 50%;
    color: white;
}

.survey-context-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.survey-context-text strong {
    color: var(--text-primary);
}

/* Survey Question Card */
.survey-question-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.survey-question-card.animate-in {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.survey-question {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0 0 var(--spacing-lg) 0;
}

/* Survey Options */
.survey-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.survey-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.survey-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: translateX(4px);
}

.survey-option:active {
    transform: scale(0.98);
}

.survey-option.selected {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.survey-option.selected .survey-option-icon {
    color: white;
}

.survey-option:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.survey-option-label {
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--text-primary);
}

.survey-option.selected .survey-option-label {
    color: white;
}

.survey-option-icon {
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
}

.survey-option:hover .survey-option-icon {
    transform: translateX(4px);
    color: var(--accent-color);
}

/* Survey Loading */
.survey-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.survey-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Survey Error */
.survey-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-secondary);
}

.survey-error .lucide-icon-lg {
    color: var(--error-color);
}

/* Survey Footer */
.survey-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.survey-hint {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin: 0;
}

/* Survey Complete Screen */
.survey-complete-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-primary);
    padding: var(--spacing-xl);
}

.survey-complete-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 300px;
}

.survey-complete-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--boho-teal), var(--accent-color));
    border-radius: 50%;
    margin-bottom: var(--spacing-lg);
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.survey-complete-icon .lucide-icon-xxl {
    width: 48px;
    height: 48px;
    color: white;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.survey-complete-title {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-sm) 0;
}

.survey-complete-text {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 var(--spacing-xl) 0;
}

/* Icon sizes for survey */
.lucide-icon-xxl {
    width: 64px;
    height: 64px;
}

/* Context Survey Button */
.context-survey-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    width: 100%;
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
}

.context-survey-btn .lucide-icon-sm {
    width: 16px;
    height: 16px;
}

/* Small button variant */
.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
}

/* Card action with icon */
.card-action {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========================================
   Assignment Screen Styles
   ======================================== */

.assign-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
}

.assign-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.assign-header .header-content {
    flex: 1;
}

.assign-header .header-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0;
}

.assign-header .header-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Messages Preview */
.assign-preview-card {
    margin-bottom: var(--spacing-md);
}

.messages-preview {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
}

.message-preview-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
}

.preview-sender {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--accent-color);
}

.preview-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-preview-more {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    text-align: center;
    padding: var(--spacing-xs);
}

/* Dialog Selection */
.assign-dialogs-card {
    margin-bottom: var(--spacing-md);
}

.dialog-list.compact {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
}

.dialog-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dialog-option:hover {
    background: var(--hover-bg);
}

.dialog-option:active {
    transform: scale(0.98);
}

.dialog-option .dialog-avatar {
    width: 40px;
    height: 40px;
    font-size: var(--font-size-md);
}

.dialog-option .dialog-info {
    flex: 1;
}

.dialog-option .dialog-name {
    font-weight: 600;
    display: block;
}

.dialog-option .dialog-meta {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin: 0;
}

/* Full-width button */
.btn-full {
    width: 100%;
    justify-content: center;
}

/* Assignment Success/Error Screens */
.assign-success-screen,
.assign-error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-primary);
    padding: var(--spacing-xl);
}

.success-content,
.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 300px;
}

.success-icon,
.error-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: var(--spacing-lg);
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-icon {
    background: linear-gradient(135deg, var(--boho-teal), var(--accent-color));
}

.error-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.success-icon .lucide-icon-xxl,
.error-icon .lucide-icon-xxl {
    width: 48px;
    height: 48px;
    color: white;
}

.success-title,
.error-title {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-sm) 0;
}

.success-text,
.error-text {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 var(--spacing-xl) 0;
}

/* Form hint text */
.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: var(--spacing-xs);
}

/* ========================================
   Dialog Detail — Summary Tab + Fragments
   ======================================== */

#tab-summary .summary-stats {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    color: var(--tg-theme-hint-color, #8a8f9a);
    line-height: 1.4;
}
#tab-summary .summary-stats > span {
    color: var(--tg-theme-text-color, #e5e7ef);
    font-weight: 500;
}
#tab-summary .stat-tile.hidden { display: none; }
#tab-summary .summary-card {
    padding: 1rem;
    border: 1px solid var(--tg-theme-section-separator-color, #ddd);
    border-radius: 0.5rem;
}
#tab-summary .summary-card .empty {
    color: var(--tg-theme-hint-color, #999);
    font-style: italic;
}

.banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #fff3cd;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}
.banner.hidden { display: none; }

/* ========================================
   Phase 5 — Summary lifecycle UI
   ======================================== */
.summary-banner {
    background: var(--tg-theme-section-bg-color, #FDF8F3);
    border: 1px solid var(--tg-theme-link-color, #E8734A);
    flex-wrap: wrap;
    gap: var(--spacing-sm, 8px);
}
.summary-banner .summary-banner-text { font-weight: 500; }
.summary-banner .summary-banner-actions { display: flex; gap: var(--spacing-sm, 8px); }

.summary-modal-body { padding: var(--spacing-md, 12px); }
.summary-modal-meta {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #8B7355);
    margin-bottom: var(--spacing-sm, 8px);
}
.summary-diff {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--spacing-md, 12px) 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid var(--tg-theme-section-separator-color, #E0CCAF);
    border-radius: 6px;
    overflow: hidden;
    max-height: 50vh;
    overflow-y: auto;
}
.summary-diff .diff-line {
    padding: 2px 8px;
    white-space: pre-wrap;
    word-break: break-word;
}
.summary-diff .diff-line::before {
    display: inline-block;
    width: 1.2em;
    color: var(--tg-theme-hint-color, #8B7355);
}
.diff-equal  { color: var(--tg-theme-text-color, inherit); }
.diff-equal::before  { content: "  "; }
.diff-insert { background: rgba(90, 143, 106, 0.18); }
.diff-insert::before { content: "+ "; color: var(--boho-forest, #5A8F6A); }
.diff-delete { background: rgba(214, 69, 80, 0.14); text-decoration: line-through; }
.diff-delete::before { content: "- "; color: var(--severity-high, #D64550); text-decoration: none; }

.summary-edit-field { width: 100%; box-sizing: border-box; margin-bottom: var(--spacing-sm, 8px); }
.summary-edit-field textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 120px;
    font-family: inherit;
    font-size: 14px;
    padding: 8px;
    border: 1px solid var(--tg-theme-section-separator-color, #E0CCAF);
    border-radius: 6px;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, inherit);
}
.summary-edit-field textarea.structured { font-family: ui-monospace, Menlo, monospace; font-size: 13px; min-height: 100px; }
.summary-edit-field input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid var(--tg-theme-section-separator-color, #E0CCAF);
    border-radius: 6px;
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, inherit);
}
.summary-edit-error {
    color: var(--severity-high, #D64550);
    font-size: 13px;
    margin: 4px 0 8px;
    min-height: 1em;
}

.summary-history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.summary-history-item {
    border: 1px solid var(--tg-theme-section-separator-color, #E0CCAF);
    border-radius: 6px;
    padding: 8px 10px;
    background: var(--tg-theme-section-bg-color, #FDF8F3);
}
.summary-history-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.summary-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.summary-pill.author-ai   { background: rgba(58, 155, 165, 0.18); color: var(--boho-teal, #3A9BA5); }
.summary-pill.author-user { background: rgba(99, 102, 241, 0.18); color: var(--boho-orange, #6366F1); }
.summary-pill.status-active     { background: rgba(90, 143, 106, 0.20); color: var(--boho-forest, #5A8F6A); }
.summary-pill.status-proposed   { background: rgba(242, 140, 90, 0.22); color: var(--boho-tangerine, #F28C5A); }
.summary-pill.status-superseded { background: rgba(139, 115, 85, 0.18); color: var(--tg-theme-hint-color, #8B7355); }
.summary-pill.status-rejected   { background: rgba(214, 69, 80, 0.18); color: var(--severity-high, #D64550); }
.summary-history-ts { font-size: 12px; color: var(--tg-theme-hint-color, #8B7355); margin-left: auto; }
.summary-history-preview {
    font-size: 13px;
    color: var(--tg-theme-text-color, inherit);
    white-space: pre-wrap;
    margin: 0;
}
.summary-history-note {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #8B7355);
    font-style: italic;
    margin-top: 4px;
}

.btn-secondary {
    background: var(--tg-theme-secondary-bg-color, #EDD9C4);
    color: var(--tg-theme-text-color, inherit);
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}
.msg-bubble {
    padding: 0.55rem 0.8rem;
    border-radius: 14px;
    max-width: 80%;
    color: var(--tg-theme-text-color);
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
}
.msg-bubble.me {
    align-self: flex-end;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border-bottom-right-radius: 4px;
}
.msg-bubble.them {
    align-self: flex-start;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    border-bottom-left-radius: 4px;
}
.msg-bubble .ts {
    display: block;
    font-size: 0.7rem;
    color: var(--tg-theme-hint-color);
    margin-top: 0.2rem;
    opacity: 0.85;
}
.msg-bubble.me .ts {
    color: var(--tg-theme-button-text-color);
    opacity: 0.75;
}
.msg-bubble .key { color: #FBBF24; margin-right: 0.25rem; }

.screen-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--tg-theme-section-separator-color, #ddd);
}
.screen-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.list { display: flex; flex-direction: column; }
.list-row {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--tg-theme-section-separator-color, #eee);
    cursor: pointer;
    color: inherit;
}
.list-row-main { font-weight: 500; }
.list-row-sub {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color, #666);
    margin-top: 0.15rem;
}

/* ========================================
   Communication Score Radar (Phase 2 T10)
   ======================================== */
.radar-svg { width: 100%; max-width: 320px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.radar-grid { fill: none; stroke: var(--tg-theme-hint-color, #ccc); stroke-width: 1; opacity: 0.4; }
.radar-spoke { stroke: var(--tg-theme-hint-color, #ccc); stroke-width: 1; opacity: 0.4; }
.radar-label { font-size: 12px; fill: var(--tg-theme-text-color, #e5e7ef); font-weight: 500; }
.radar-empty { font-size: 12px; fill: var(--tg-theme-hint-color, #999); }
.radar-fill-primary { fill: rgba(99, 102, 241, 0.35); stroke: rgba(129, 140, 248, 1); stroke-width: 2; }
.radar-fill-overlay { fill: rgba(244, 114, 182, 0.25); stroke: rgba(244, 114, 182, 1); stroke-width: 2; stroke-dasharray: 4 3; }

.score-tab-toggle { display: flex; gap: 8px; margin: 12px 0; }
.score-tab-toggle button {
    flex: 1; padding: 8px 12px; border-radius: 16px;
    border: 1px solid var(--boho-orange, #6366f1);
    background: transparent;
    color: var(--tg-theme-text-color, #e5e7ef);
    font-weight: 500;
    cursor: pointer;
}
.score-tab-toggle button.active {
    background: var(--boho-orange, #6366f1);
    color: #fff;
    border-color: transparent;
}
.fragment-chip-scroller {
    display: flex; gap: 8px; overflow-x: auto; padding: 8px 0;
    scrollbar-width: thin;
}
.fragment-chip {
    flex: 0 0 auto; padding: 6px 12px; border-radius: 12px;
    background: var(--tg-theme-secondary-bg-color, #f0f0f0);
    cursor: pointer; font-size: 13px; white-space: nowrap;
}
.fragment-chip.active {
    background: rgba(255, 99, 132, 0.85);
    color: white;
}

.score-confidence { text-align: center; font-size: 12px; color: var(--tg-theme-hint-color, #888); margin-top: 8px; }

/* ========================================
   Chat tab (Plan 3 — Task 10)
   ======================================== */
.chat-bubbles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
}
.chat-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 16px;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-bubble.user {
    align-self: flex-end;
    background: var(--tg-theme-button-color, #3390ec);
    color: #fff;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--tg-theme-secondary-bg-color, #f1f1f1);
    color: var(--tg-theme-text-color, #000);
}
.chat-bubble.loading {
    opacity: 0.6;
    font-style: italic;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--tg-theme-section-separator-color, rgba(0, 0, 0, 0.08));
    position: sticky;
    top: 0;
    background: var(--tg-theme-bg-color, #fff);
    z-index: 1;
}
.scope-chip {
    border: 1px solid var(--tg-theme-section-separator-color, rgba(0, 0, 0, 0.15));
    background: transparent;
    color: var(--tg-theme-text-color);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.context-info {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
}
.chat-composer {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--tg-theme-section-separator-color, rgba(0, 0, 0, 0.08));
    position: sticky;
    bottom: 0;
    background: var(--tg-theme-bg-color, #fff);
}
.chat-composer textarea {
    flex: 1;
    resize: none;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--tg-theme-section-separator-color, rgba(0, 0, 0, 0.15));
    background: var(--tg-theme-section-bg-color);
    color: var(--tg-theme-text-color);
}
.chat-composer textarea::placeholder {
    color: var(--tg-theme-hint-color);
}
.chat-composer button {
    width: 40px;
    border-radius: 50%;
    border: none;
    background: var(--tg-theme-button-color, #3390ec);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

/* ========================================
   Chat-tab quiz bubble (Plan 4 — Task 12)
   ======================================== */
.chat-quiz-mount {
    padding: 8px 12px 0 12px;
}
.quiz-bubble {
    background: var(--tg-theme-secondary-bg-color, #f1f1f1);
    color: var(--tg-theme-text-color, #000);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.quiz-title {
    font-weight: 600;
    font-size: 14px;
}
.quiz-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.quiz-question {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.quiz-question-text {
    font-size: 13px;
    opacity: 0.85;
}
.quiz-answer {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--tg-theme-section-separator-color, rgba(0, 0, 0, 0.15));
    background: var(--tg-theme-bg-color, #fff);
    color: inherit;
    font-size: 14px;
}
.quiz-submit {
    align-self: flex-end;
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    background: var(--tg-theme-button-color, #3390ec);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}
.quiz-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.quiz-confirm {
    font-size: 12px;
    color: var(--severity-low, #2e7d32);
    align-self: flex-end;
}
.dialog-quiz-refresh {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
}
.dialog-quiz-refresh:hover {
    background: var(--tg-theme-secondary-bg-color, rgba(0, 0, 0, 0.05));
}
.dialog-quiz-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Plan 6 T9: fragments-list multi-select / rename
   ======================================== */
.fragment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--tg-theme-section-separator-color, #eee);
    cursor: pointer;
    user-select: none;
}
.fragment-item.is-selected {
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid var(--accent-color, #6366f1);
    padding-left: calc(1rem - 3px);
}
.fragment-item-main { flex: 1; min-width: 0; }
.fragment-select-mark {
    font-size: 1.1rem;
    color: var(--accent-color, #6366f1);
    width: 1.25rem;
    text-align: center;
}
.fragment-rename-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    color: var(--tg-theme-hint-color, #888);
    border-radius: 0.25rem;
}
.fragment-rename-btn:hover {
    background: var(--tg-theme-secondary-bg-color, rgba(0,0,0,0.05));
    color: var(--tg-theme-text-color, inherit);
}
.fragments-action-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--tg-theme-bg-color, #fff);
    border-top: 1px solid var(--tg-theme-section-separator-color, #ddd);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    z-index: 2;
}
.fragments-action-bar .btn { flex: 1; }

/* ========================================
   Plan 6 T10: fragment-detail long-press action sheet
   ======================================== */
.msg-bubble { position: relative; user-select: none; }
.msg-bubble.is-key {
    border-left: 3px solid var(--accent-color, #6366f1);
    padding-left: calc(0.75rem - 3px);
}
.action-sheet {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0;
}
.action-sheet-btn {
    text-align: left;
    width: 100%;
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, inherit);
    cursor: pointer;
    border-radius: 0.375rem;
}
.action-sheet-btn:hover {
    background: var(--tg-theme-secondary-bg-color, rgba(0,0,0,0.05));
}
.action-sheet-btn.action-sheet-danger {
    color: #c0392b;
}
.picker-modal-body {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0;
}
.picker-row {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--tg-theme-section-separator-color, #eee);
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: inherit;
}
.picker-row:hover {
    background: var(--tg-theme-secondary-bg-color, rgba(0,0,0,0.05));
}

/* ========================================
   Plan 6 T11: soft-deleted toggle pill + is-deleted bubble
   ======================================== */
.pill-show-deleted {
    align-self: center;
    background: var(--tg-theme-secondary-bg-color, #444);
    color: var(--tg-theme-text-color, inherit);
    padding: 4px 12px;
    border-radius: 999px;
    border: none;
    font-size: 12px;
    cursor: pointer;
    margin: 0.5rem auto;
}
.pill-show-deleted.is-on {
    background: var(--accent-color, #6366f1);
    color: #fff;
}
.msg-bubble.is-deleted {
    opacity: 0.45;
    text-decoration: line-through;
}
.msg-bubble.is-deleted .key { text-decoration: none; }

/* Summary tab — inline fragments preview */
.summary-fragments-section {
    margin-top: var(--spacing-lg);
}
.summary-fragments-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    padding: 0 var(--spacing-xs);
}
.summary-fragments-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
}
.btn-link {
    background: none;
    border: none;
    color: var(--tg-theme-link-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.btn-link:hover { background: var(--tg-theme-secondary-bg-color); }
.summary-fragments-inline {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    background: var(--tg-theme-section-bg-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs);
    box-shadow: var(--shadow-sm);
}
.summary-fragments-inline .empty {
    margin: 0;
    padding: var(--spacing-md);
    text-align: center;
    color: var(--tg-theme-hint-color);
    font-size: 13px;
}
.summary-fragments-inline .list-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}
.summary-fragments-inline .list-row:hover {
    background: var(--tg-theme-secondary-bg-color);
}
.summary-fragments-inline .fragment-item-main {
    flex: 1;
    min-width: 0;
}
.summary-fragments-inline .list-row-main {
    font-weight: 500;
    color: var(--tg-theme-text-color);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.summary-fragments-inline .list-row-sub {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-top: 2px;
}
.summary-fragments-inline .list-row-chevron {
    color: var(--tg-theme-hint-color);
    font-size: 20px;
    line-height: 1;
}

/* =============================================
   Fragment card (Task 8)
   ============================================= */
.fragment-card {
    background: var(--tg-theme-secondary-bg-color, #1c1c1e);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    transition: opacity .15s;
}
.fragment-card:active { opacity: .7; }
.fragment-card.selectable { cursor: pointer; }
.fragment-card.selected { outline: 2px solid var(--tg-theme-button-color, #2481cc); }
.fragment-card-check { font-size: 24px; line-height: 1; flex-shrink: 0; color: var(--tg-theme-button-color, #2481cc); align-self: center; }
.fragment-card-body { flex: 1; min-width: 0; }
.fragment-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fragment-card-label { font-weight: 500; font-size: 14px; color: var(--tg-theme-text-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fragment-card-meta  { font-size: 12px; color: var(--tg-theme-hint-color); flex-shrink: 0; }
.fragment-preview { margin-top: 6px; }
.fragment-preview-row { font-size: 12px; color: var(--tg-theme-hint-color); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fragment-preview-divider { font-size: 12px; color: var(--tg-theme-hint-color); text-align: center; margin: 2px 0; }

/* =============================================
   Tab toolbar + primary button (Task 9)
   ============================================= */
.tab-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 0 4px;
}
.btn-primary {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
    background: transparent;
    color: var(--tg-theme-button-color, #2481cc);
    border: 1px solid var(--tg-theme-button-color, #2481cc);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
}
.btn-sm { padding: 4px 12px; font-size: 13px; }

/* =============================================
   Selection bar (Task 9)
   ============================================= */
.selection-bar {
    /* Legacy: kept in DOM for a11y/fallback but hidden — FAB is primary UI */
    display: none;
}

.analyze-fab {
    position: fixed;
    right: 20px;
    bottom: calc(var(--safe-area-bottom, 0px) + 24px);
    z-index: 250;
    min-width: 56px;
    height: 56px;
    padding: 0 18px;
    border-radius: 28px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    background: var(--tg-theme-button-color, #2481cc);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.analyze-fab:active { transform: scale(0.94); }
.analyze-fab[hidden] { display: none; }
.analyze-fab .analyze-fab-icon  { font-size: 24px; line-height: 1; }
.analyze-fab .analyze-fab-label { font-size: 16px; line-height: 1; font-weight: 700; }
.analyze-fab.fab-idle   { background: var(--tg-theme-button-color, #2481cc); }
.analyze-fab.fab-cancel { background: #DC2626; }
.analyze-fab.fab-go     { background: #059669; box-shadow: 0 6px 18px rgba(5, 150, 105, 0.45); }
.selection-bar-actions { display: flex; gap: 8px; }

/* =============================================
   Scope chip + chat button (Task 10)
   ============================================= */
.analysis-scope-chip {
    display: inline-block;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(36,129,204,.2);
    color: var(--tg-theme-link-color);
    font-weight: 500;
}
.analysis-chat-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
    margin-left: auto;
}

/* =============================================
   Per-analysis chat screen (Task 10)
   ============================================= */
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 0; }
.chat-bubble { max-width: 80%; margin: 6px 0; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.chat-bubble.user { background: var(--tg-theme-button-color, #2481cc); color: #fff; margin-left: auto; border-bottom-right-radius: 2px; }
.chat-bubble.assistant { background: var(--tg-theme-secondary-bg-color, #1c1c1e); color: var(--tg-theme-text-color); border-bottom-left-radius: 2px; }
.chat-bubble p { margin: 0; }
.chat-composer { display: flex; gap: 8px; padding: 8px 0; }
.chat-composer input { flex: 1; border-radius: 20px; padding: 8px 14px; background: var(--tg-theme-secondary-bg-color, #1c1c1e); border: none; color: var(--tg-theme-text-color); font-size: 16px; }
.chat-composer button { background: var(--tg-theme-button-color, #2481cc); color: #fff; border: none; border-radius: 50%; width: 44px; height: 44px; cursor: pointer; font-size: 16px; }
.muted { color: var(--tg-theme-hint-color, #999); font-size: 13px; text-align: center; }

/* Chat scope picker bottom sheet */
.scope-sheet-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 1100; display: flex; align-items: flex-end; justify-content: center;
    animation: fadeIn 0.18s ease-out;
}
.scope-sheet {
    width: 100%; max-width: 480px;
    background: var(--tg-theme-bg-color, #11131a);
    border-radius: 16px 16px 0 0;
    padding: 16px 16px 24px;
    max-height: 80vh; overflow-y: auto;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
    animation: slideUp 0.22s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
.scope-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.scope-sheet-title { font-size: 16px; font-weight: 600; color: var(--tg-theme-text-color, #e5e7ef); }
.scope-sheet-close {
    background: transparent; border: none; color: var(--tg-theme-hint-color, #8a8f9a);
    font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.scope-sheet-note {
    font-size: 12px; color: var(--tg-theme-hint-color, #8a8f9a);
    background: rgba(99,102,241,0.08);
    padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; line-height: 1.4;
}
.scope-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 4px; cursor: pointer;
    color: var(--tg-theme-text-color, #e5e7ef);
    font-size: 14px;
}
.scope-row input[type="radio"] { accent-color: var(--boho-orange, #6366f1); }
.scope-frag-list {
    margin: 4px 0 12px 24px;
    border-left: 2px solid rgba(99,102,241,0.25);
    padding-left: 10px;
    max-height: 240px; overflow-y: auto;
}
.scope-frag-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; cursor: pointer; font-size: 13px;
    color: var(--tg-theme-text-color, #e5e7ef);
}
.scope-frag-item input[type="checkbox"] { accent-color: var(--boho-orange, #6366f1); }
.scope-frag-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-frag-count { font-size: 12px; color: var(--tg-theme-hint-color, #8a8f9a); }
.scope-sheet-actions {
    display: flex; gap: 8px; margin-top: 12px;
    padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.06);
}
.scope-sheet-actions button {
    flex: 1; padding: 10px; border-radius: 12px;
    font-size: 14px; font-weight: 500; cursor: pointer; border: none;
}
.scope-sheet-cancel {
    background: transparent;
    color: var(--tg-theme-hint-color, #8a8f9a);
    border: 1px solid rgba(255,255,255,0.12) !important;
}
.scope-sheet-apply {
    background: var(--boho-orange, #6366f1);
    color: #fff;
}

/* Hero carousel: Health Score + Communication Score */
.hero-carousel {
    margin-bottom: var(--spacing-lg, 1rem);
}
.hero-carousel-track {
    display: flex;
    align-items: stretch;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.hero-carousel-track::-webkit-scrollbar { display: none; }
.hero-card {
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 260px;
}
.hero-card.health-card { margin-bottom: 0; }
.hero-card.score-card {
    background: var(--tg-theme-section-bg-color, #1c1f2a);
    border-radius: 12px;
    padding: 14px;
}
.hero-card.score-card .card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--tg-theme-text-color, #e5e7ef);
}
.hero-card.score-card #score-radar {
    margin: 4px auto 6px;
    max-height: 200px;
}
.hero-carousel-dots {
    display: flex; justify-content: center; gap: 6px;
    margin-top: 8px;
}
.hero-dot {
    width: 6px; height: 6px; border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}
.hero-dot.active {
    background: var(--boho-orange, #6366f1);
    transform: scale(1.4);
}


/* ========================================
   Area A: Empty state CTA
   ======================================== */

.empty-state-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 20px;
    margin: 24px 16px;
    background: var(--tg-theme-secondary-bg-color, rgba(255,255,255,.05));
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
}

.empty-cta-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-cta-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--tg-theme-text-color, #fff);
    margin: 0 0 20px;
}

.empty-cta-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    text-align: left;
    width: 100%;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-cta-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.7));
    line-height: 1.4;
}

.empty-cta-steps .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    background: var(--boho-orange, #e8a055);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Space Grotesk', monospace;
}

.empty-cta-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
}


/* ========================================
   Area C: Контекст card
   ======================================== */

#context-card {
    background: var(--tg-theme-secondary-bg-color, rgba(255,255,255,.04));
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

.context-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.context-card-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.context-card-icon {
    font-size: 16px;
}

.context-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--tg-theme-text-color, #fff);
    margin: 0;
}

.context-card-update-btn {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.2);
    background: transparent;
    color: var(--tg-theme-link-color, #2481cc);
    cursor: pointer;
    transition: background 0.15s;
}

.context-card-update-btn:hover {
    background: rgba(255,255,255,.08);
}

.proposal-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(255, 220, 80, 0.1);
    border: 1px solid rgba(255, 220, 80, 0.3);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--tg-theme-text-color, #fff);
}

.proposal-strip.hidden { display: none; }

.proposal-strip-text {
    flex: 1;
}

.context-empty-state {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.context-empty-hint {
    font-size: 13px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.7));
    line-height: 1.5;
}

.context-start-quiz-btn {
    align-self: flex-start;
}

.context-quiz-mount {
    margin-top: 8px;
}

.context-quiz-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.context-quiz-question {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.context-quiz-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--tg-theme-text-color, #fff);
}

.context-quiz-input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.05);
    color: var(--tg-theme-text-color, #fff);
    font-size: 14px;
}

.context-quiz-input::placeholder {
    color: rgba(255,255,255,.35);
}

.context-quiz-submit {
    align-self: flex-start;
    margin-top: 4px;
}

.context-summary-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--tg-theme-text-color, #fff);
    margin: 0;
}

.context-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,.1);
    margin: 12px 0;
}

.context-evolving-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.context-evolving-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--tg-theme-text-color, #fff);
    margin: 0;
}

.context-evolving-meta {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.5));
    line-height: 1.4;
}

.context-how-btn {
    background: none;
    border: none;
    color: var(--tg-theme-link-color, #2481cc);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    text-decoration: underline;
}

.context-loading {
    font-size: 13px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.5));
}


/* ========================================
   Area E: Чати hub + session screen
   ======================================== */

.chat-list {
    display: flex;
    flex-direction: column;
    padding-bottom: 80px; /* room for FAB */
}

.chat-list-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.5));
    font-size: 14px;
}

.chat-list-empty .muted {
    font-size: 12px;
    margin-top: 4px;
}

.chat-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.06);
    transition: background 0.15s;
}

.chat-list-row:active,
.chat-list-row:hover {
    background: rgba(255,255,255,.05);
}

.chat-list-purpose {
    font-size: 24px;
    width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.chat-list-info {
    flex: 1;
    min-width: 0;
}

.chat-list-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-list-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.chat-list-scope {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,.08);
    color: var(--tg-theme-hint-color, rgba(255,255,255,.6));
}

.chat-list-preview {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.5));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.chat-list-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.chat-list-time {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.4));
}

.chat-list-chevron {
    font-size: 18px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.3));
}

/* New chat FAB */
.new-chat-fab {
    position: fixed;
    bottom: calc(var(--safe-area-bottom, 0px) + 24px);
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    border-radius: 24px;
    background: var(--boho-orange, #e8a055);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(99, 102, 241,.4);
    z-index: 100;
    transition: transform 0.15s, box-shadow 0.15s;
}

.new-chat-fab:active {
    transform: scale(0.96);
}

.new-chat-fab[hidden] {
    display: none !important;
}

.new-chat-fab-icon {
    font-size: 18px;
    font-weight: 400;
}

/* Chat wizard */
.chat-wizard {
    max-height: 80vh;
    overflow-y: auto;
}

.wizard-body {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Purpose grid */
.purpose-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
}

.purpose-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 12px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.04);
    color: var(--tg-theme-text-color, #fff);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.purpose-tile.selected {
    border-color: var(--boho-orange, #e8a055);
    background: rgba(99, 102, 241,.1);
}

.purpose-tile-emoji {
    font-size: 24px;
}

.purpose-tile-label {
    font-size: 13px;
    font-weight: 600;
}

.purpose-tile-desc {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.5));
    line-height: 1.3;
}

/* Chat session screen */
.chat-session-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-session-context-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,255,255,.04);
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

#chatSessionContextLabel {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.6));
}

.chat-session-info-btn {
    background: none;
    border: none;
    color: var(--tg-theme-link-color, #2481cc);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}


/* ========================================
   Area F: Top actions + Search bar + Nav drawer
   ======================================== */

.top-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.top-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--tg-theme-text-color, #fff);
    cursor: pointer;
    font-size: 18px;
    transition: background 0.15s;
}

.top-action-btn:hover,
.top-action-btn:active {
    background: rgba(255,255,255,.1);
}

.search-bar {
    padding: 8px 16px 4px;
    background: var(--tg-theme-bg-color, #1c1c1e);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.search-bar.hidden {
    display: none;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.06);
    color: var(--tg-theme-text-color, #fff);
    font-size: 14px;
    box-sizing: border-box;
}

.search-input::placeholder {
    color: var(--tg-theme-hint-color, rgba(255,255,255,.4));
}

.search-input:focus {
    border-color: var(--tg-theme-link-color, #2481cc);
}

/* Nav Drawer */
.nav-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9000;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.nav-drawer {
    background: var(--tg-theme-bg-color, #1c1c1e);
    width: 80%;
    max-width: 280px;
    min-height: 100vh;
    min-height: 100dvh;
    box-shadow: -4px 0 24px rgba(0,0,0,.4);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 48px;
}

.nav-drawer-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    margin: 12px 12px 4px;
    background: rgba(255,255,255,.05);
    border-radius: 14px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,.08);
    transition: background 0.15s;
}

.nav-drawer-tile:hover {
    background: rgba(255,255,255,.1);
}

.nav-drawer-tile-icon {
    font-size: 24px;
}

.nav-drawer-tile-text strong {
    display: block;
    font-size: 16px;
    color: var(--tg-theme-text-color, #fff);
}

.nav-drawer-tile-text span {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.5));
}

.nav-drawer-body {
    padding: 8px 0;
    flex: 1;
}

.nav-drawer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    color: var(--tg-theme-text-color, #fff);
    font-size: 16px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.nav-drawer-row:hover {
    background: rgba(255,255,255,.06);
}

.nav-drawer-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,.08);
    margin: 8px 16px;
}

.nav-drawer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
}

.nav-drawer-version {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.4));
}

.nav-drawer-logout {
    background: none;
    border: none;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.5));
    font-size: 13px;
    cursor: pointer;
}

/* ============================================================ */
/* Context Quiz Modal (stepper, one question per page)          */
/* ============================================================ */
.context-quiz-modal {
    max-width: 480px;
    width: calc(100% - 32px);
}
.context-quiz-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.context-quiz-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.context-quiz-step-label {
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
    letter-spacing: 0.02em;
}
.context-quiz-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}
.context-quiz-progress-fill {
    height: 100%;
    background: var(--tg-theme-button-color, #7e7eff);
    transition: width 200ms ease;
}
.context-quiz-content {
    padding: 20px 4px 8px;
}
.context-quiz-question-text {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 16px;
    color: var(--tg-theme-text-color, #fff);
}
.context-quiz-answer-input {
    width: 100%;
    min-height: 96px;
    resize: vertical;
    font-size: 16px;
    line-height: 1.4;
}
.context-quiz-hint {
    margin: 10px 2px 0;
    font-size: 12px;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
}
.context-quiz-actions {
    display: flex;
    gap: 10px;
    padding-top: 8px;
}
.context-quiz-actions .btn {
    flex: 1;
}

/* Mock/Real mode badge inside the nav drawer */
.nav-drawer-mock-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.nav-drawer-mock-badge.mock {
    background: rgba(220, 140, 0, 0.85);
    color: #fff;
}
.nav-drawer-mock-badge.real {
    background: rgba(20, 120, 60, 0.85);
    color: #fff;
}

/* "How to" empty state inside the Аналізи tab */
.analyses-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--tg-theme-text-color, #fff);
}
.analyses-empty-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 12px;
    opacity: 0.85;
}
.analyses-empty-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
}
.analyses-empty-text {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.65));
}
.analyses-empty-steps {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 0 0 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.analyses-empty-steps li {
    counter-increment: step;
    position: relative;
    padding: 10px 12px 10px 42px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
}
.analyses-empty-steps li::before {
    content: counter(step);
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--tg-theme-button-color, #2481cc);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.analyses-empty .btn-primary {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
}
.analyses-empty-hint {
    margin: 14px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--tg-theme-hint-color, rgba(255,255,255,.55));
}

/* Health Score — semicircular arc gauge */
.health-arc-wrap {
    position: relative;
    width: 100%;
    max-width: 240px;
    margin: 8px auto 4px;
    aspect-ratio: 200 / 120;
}
.health-arc {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.health-arc-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
    padding-bottom: 6px;
}
.health-arc-center .health-score-big {
    font-size: 44px;
    font-weight: 800;
    line-height: 1;
    margin: 0;
}
.health-arc-max {
    font-size: 12px;
    opacity: 0.55;
    margin-top: 2px;
}

/* Чати hub — session cards */
.chat-list-loading { padding: 24px; text-align: center; opacity: 0.6; }
.chat-session-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    color: inherit;
    cursor: pointer;
}
.chat-session-card:hover { background: rgba(255,255,255,0.07); }
.chat-session-emoji { font-size: 24px; line-height: 1.1; }
.chat-session-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chat-session-title-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-session-title-row strong { font-size: 14px; }
.chat-session-when { font-size: 12px; opacity: 0.55; flex-shrink: 0; }
.chat-session-preview { font-size: 13px; opacity: 0.7; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Role-prefixed chat bubbles used by the chat-session screen */
.chat-bubble.chat-bubble-user {
    background: var(--tg-theme-button-color, #2481cc);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}
.chat-bubble.chat-bubble-assistant {
    background: var(--tg-theme-secondary-bg-color, #1c1c1e);
    color: var(--tg-theme-text-color);
    border-bottom-left-radius: 2px;
}

/* iOS-style action sheet (slides up from the bottom) */
.action-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.22s ease;
    -webkit-tap-highlight-color: transparent;
}
.action-sheet-overlay.open { opacity: 1; }

.action-sheet {
    width: 100%;
    max-width: 480px;
    background: var(--tg-theme-bg-color, #15151a);
    color: var(--tg-theme-text-color, #fff);
    border-radius: 18px 18px 0 0;
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(.22,.61,.36,1);
}
.action-sheet-overlay.open .action-sheet { transform: translateY(0); }

.action-sheet-grabber {
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.18);
    margin: 6px auto 12px;
}

.action-sheet-header {
    padding: 4px 6px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.action-sheet-header strong { font-size: 16px; font-weight: 700; }
.action-sheet-header span   { font-size: 13px; opacity: 0.65; line-height: 1.35; }

.action-sheet-list {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 12px;
}
.action-sheet-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 14px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255,255,255,0.06);
}
.action-sheet-row:last-child { border-bottom: none; }
.action-sheet-row:active    { background: rgba(255, 255, 255, 0.07); }
.action-sheet-emoji   { font-size: 24px; line-height: 1; flex-shrink: 0; }
.action-sheet-text    { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.action-sheet-text strong { font-size: 16px; font-weight: 600; }
.action-sheet-text span   { font-size: 13px; opacity: 0.6; line-height: 1.3; }
.action-sheet-chevron { opacity: 0.4; font-size: 20px; }

.action-sheet-cancel {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 14px;
    color: var(--tg-theme-link-color, #6f8ef5);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255,255,255,0.06);
}
.action-sheet-cancel:active { background: rgba(255, 255, 255, 0.09); }

/* ============================================================
   Feedback Inbox (Phase 7)
   ============================================================ */
.feedback-filter-chips {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    overflow-x: auto;
}
.feedback-filter-chips .chip {
    padding: 6px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    color: var(--tg-theme-text-color, #fff);
    border: none;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.feedback-filter-chips .chip.active {
    background: var(--tg-theme-button-color, #2481cc);
    color: #fff;
}
.feedback-list {
    padding: 8px 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.feedback-empty {
    text-align: center;
    opacity: .6;
    padding: 40px 16px;
}
.feedback-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%;
}
.feedback-card-row1 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.feedback-emoji { font-size: 18px; }
.feedback-when { margin-left: auto; opacity: .55; font-size: 12px; }
.feedback-card-reporter { font-size: 13px; opacity: .7; }
.feedback-card-preview {
    font-size: 14px;
    line-height: 1.4;
    opacity: .9;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.feedback-card-meta { font-size: 12px; opacity: .6; }
.feedback-status-pill {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.feedback-status-new      { background: rgba(36,129,204,.25); color: #6fb5ff; }
.feedback-status-done     { background: rgba(46,157,87,.25);  color: #65d18f; }
.feedback-status-rejected { background: rgba(176,58,58,.25);  color: #ff7878; }

.feedback-detail {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.feedback-detail-head { display: flex; align-items: center; gap: 10px; }
.feedback-detail-reporter,
.feedback-detail-when { font-size: 13px; opacity: .75; }
.feedback-detail-content {
    font-size: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.feedback-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.feedback-att {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
}
.feedback-att.is-video {
    position: relative;
}

/* ─── Lightbox overlay ─────────────────────────────────────────────── */
.feedback-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
}
.feedback-lightbox-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.feedback-lightbox-img,
.feedback-lightbox-video {
    max-width: 100%;
    max-height: 100%;
    transform-origin: center center;
    transition: transform 0.05s linear;
    will-change: transform;
}
.feedback-lightbox-video {
    background: #000;
}
.feedback-lightbox-img {
    cursor: grab;
}
.feedback-lightbox-img.is-panning {
    cursor: grabbing;
}
.feedback-lightbox-toolbar {
    position: absolute;
    top: calc(var(--safe-area-top, 0px) + 8px);
    left: 0;
    right: 0;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.feedback-lightbox-toolbar > * { pointer-events: auto; }
.feedback-lightbox-btn {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
}
.feedback-lightbox-btn:hover { background: rgba(255,255,255,0.2); }
.feedback-lightbox-zoom {
    display: flex;
    gap: 6px;
}
.feedback-lightbox-zoom-level {
    color: #fff;
    font-size: 13px;
    align-self: center;
    min-width: 48px;
    text-align: center;
}
.feedback-att-doc {
    padding: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    font-size: 13px;
}
.feedback-resolved-note {
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    font-size: 13px;
}
.feedback-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.feedback-actions .btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.btn-success { background: #059669; color: #fff; }
.btn-danger  { background: #DC2626; color: #fff; }
.btn-ghost   { background: rgba(255,255,255,0.08); color: inherit; }

.feedback-admins-list {
    padding: 12px 14px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
}
.admin-row-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.admin-row-name { font-size: 14px; font-weight: 500; }
.admin-row-meta { font-size: 12px; opacity: .7; }
.admin-role-pill {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.admin-role-super    { background: rgba(204,140,36,.25); color: #f0c068; }
.admin-role-reviewer { background: rgba(36,129,204,.25); color: #6fb5ff; }
.admin-row-remove {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    color: inherit;
    opacity: .7;
}
.admin-row-remove:hover { opacity: 1; }

.header-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    color: inherit;
}


/* ========================================
   Accessibility baseline
   ======================================== */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--tg-theme-link-color);
    outline-offset: 2px;
}

.top-action-btn,
.modal-close,
.hero-dot {
    position: relative;
}

/* Grow the hit area to 44px without changing the visual size */
.top-action-btn::after,
.modal-close::after,
.hero-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 44px;
    min-height: 44px;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
}

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