    *, *::before, *::after {
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
    }

    :root,
    [data-theme="brand"] {
        --font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

        --bg-base: #060913;
        --bg-surface: #0B101D;
        --bg-elevated: #121A2D;

        --glass-panel: linear-gradient(180deg, #0E1526 0%, #090E1A 100%);
        --glass-card: linear-gradient(145deg, #151F34 0%, #0F1727 100%);
        --glass-card-hover: linear-gradient(145deg, #1B2741 0%, #131D31 100%);
        --glass-border: rgba(255, 255, 255, 0.085);
        --glass-border-strong: rgba(255, 255, 255, 0.16);
        --glass-highlight: rgba(255, 255, 255, 0.06);
        --glass-shine: inset 0 1px 0 0 rgba(255, 255, 255, 0.12);

        --accent: #0A84FF;
        --accent-hover: #2997FF;
        --accent-gradient: linear-gradient(135deg, #2997FF 0%, #0066CC 100%);
        --accent-glow: rgba(10, 132, 255, 0.28);
        --accent-soft: linear-gradient(135deg, rgba(10, 132, 255, 0.18) 0%, rgba(10, 132, 255, 0.06) 100%);

        --success: #30D158;
        --danger: #FF453A;
        --warning: #FF9F0A;

        --text-main: #F1F5F9;
        --text-secondary: #CBD5E1;
        --text-muted: #8695AA;
        --text-inverted: #FFFFFF;

        --input-bg: #080C16;
        --msg-other-bg: linear-gradient(145deg, #172238 0%, #111A2C 100%);
        --code-bg: #060911;
        --code-text: #E2E8F0;
        --overlay-bg: rgba(4, 7, 14, 0.86);
        --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238695AA' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

        --radius-xs: 10px;
        --radius-sm: 13px;
        --radius-md: 17px;
        --radius-lg: 22px;
        --msg-radius: 18px;

        --shadow-ambient: 0 18px 40px -10px rgba(0, 0, 0, 0.65);
        --shadow-glow: 0 6px 18px -4px rgba(10, 132, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
        --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.28);

        --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
        --side-w: 365px;
    }

    [data-theme="dark"] {
        --bg-base: #060608;
        --bg-surface: #0B0C0F;
        --bg-elevated: #14161C;

        --glass-panel: linear-gradient(180deg, #111217 0%, #0A0B0E 100%);
        --glass-card: linear-gradient(145deg, #171920 0%, #111217 100%);
        --glass-card-hover: linear-gradient(145deg, #1E2029 0%, #16181F 100%);
        --glass-border: rgba(255, 255, 255, 0.075);
        --glass-border-strong: rgba(255, 255, 255, 0.14);
        --glass-highlight: rgba(255, 255, 255, 0.06);
        --glass-shine: inset 0 1px 0 0 rgba(255, 255, 255, 0.1);

        --accent: #3B82F6;
        --accent-hover: #60A5FA;
        --accent-gradient: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
        --accent-glow: rgba(59, 130, 246, 0.28);
        --accent-soft: linear-gradient(135deg, rgba(59, 130, 246, 0.17) 0%, rgba(59, 130, 246, 0.06) 100%);

        --text-main: #F1F3F5;
        --text-secondary: #C1C4CD;
        --text-muted: #7E828E;
        --text-inverted: #FFFFFF;

        --input-bg: #08090C;
        --msg-other-bg: linear-gradient(145deg, #191B23 0%, #13151B 100%);
        --code-bg: #07080A;
        --code-text: #F1F5F9;
        --overlay-bg: rgba(3, 3, 5, 0.88);
        --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237E828E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

        --shadow-ambient: 0 18px 40px -10px rgba(0, 0, 0, 0.8);
        --shadow-glow: 0 6px 18px -4px rgba(59, 130, 246, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
        --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.42);
    }

    [data-theme="light"] {
        --bg-base: #EEF2F7;
        --bg-surface: #F7F9FC;
        --bg-elevated: #FFFFFF;

        --glass-panel: linear-gradient(180deg, #FFFFFF 0%, #F3F6FB 100%);
        --glass-card: linear-gradient(145deg, #FFFFFF 0%, #F8FAFD 100%);
        --glass-card-hover: linear-gradient(145deg, #FFFFFF 0%, #EFF4FC 100%);
        --glass-border: rgba(15, 23, 42, 0.08);
        --glass-border-strong: rgba(15, 23, 42, 0.15);
        --glass-highlight: rgba(10, 132, 255, 0.06);
        --glass-shine: inset 0 1px 0 0 #FFFFFF;

        --accent: #007AFF;
        --accent-hover: #0062CC;
        --accent-gradient: linear-gradient(135deg, #2997FF 0%, #0066CC 100%);
        --accent-glow: rgba(0, 122, 255, 0.24);
        --accent-soft: linear-gradient(135deg, rgba(0, 122, 255, 0.12) 0%, rgba(0, 122, 255, 0.04) 100%);

        --text-main: #0F172A;
        --text-secondary: #334155;
        --text-muted: #64748B;
        --text-inverted: #FFFFFF;

        --input-bg: #FFFFFF;
        --msg-other-bg: linear-gradient(145deg, #FFFFFF 0%, #F1F5FA 100%);
        --code-bg: #EEF2F7;
        --code-text: #0F172A;
        --overlay-bg: rgba(15, 23, 42, 0.55);
        --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

        --shadow-ambient: 0 18px 38px -10px rgba(15, 23, 42, 0.12);
        --shadow-glow: 0 6px 16px -4px rgba(0, 122, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.45);
        --shadow-card: 0 3px 10px rgba(15, 23, 42, 0.05);
    }

    html, body {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        background-color: var(--bg-base);
        -webkit-text-size-adjust: 100%;
    }

    body {
        font-family: var(--font-family);
        color: var(--text-main);
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
        overflow: hidden;
        background: var(--bg-base);
    }

    header, .header, .pixsafe-header, nav {
        display: none !important;
    }

    h1, h2, h3, h4, p {
        margin: 0;
    }

    h1, h2, h3, h4 {
        font-family: var(--font-display);
        letter-spacing: -0.02em;
        line-height: 1.25;
    }

    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    ::-webkit-scrollbar-thumb {
        background: var(--glass-border-strong);
        border-radius: 999px;
    }
    @media (hover: hover) and (pointer: fine) {
        ::-webkit-scrollbar-thumb:hover {
            background: var(--text-muted);
        }
    }

    @keyframes cascadeInDown {
        from {
            opacity: 0;
            transform: translate3d(0, -6px, 0);
        }
        to {
            opacity: 1;
            transform: translate3d(0, 0, 0);
        }
    }

    .tickets-grid .cascade-enter {
        animation: cascadeInDown 200ms var(--ease-out) both;
        animation-delay: calc(var(--stagger-idx, 0) * 16ms);
    }

    .chat-area .cascade-enter {
        animation: none !important;
    }

    .app {
        display: flex;
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        z-index: 99999;
        background: var(--bg-base);
        overflow: hidden;
    }

    .btn, .tab-btn, .icon-btn, .ticket-card, .cat-option, .theme-btn, .theme-option, .notif-btn, .btn-close-action, .status-pill {
        touch-action: manipulation;
    }

    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 40px;
        padding: 9px 18px;
        border-radius: var(--radius-sm);
        font-weight: 700;
        cursor: pointer;
        border: 1px solid transparent;
        text-decoration: none;
        font-size: 13.5px;
        line-height: 1.2;
        font-family: inherit;
        color: var(--text-main);
        transition: transform 140ms var(--ease-out), filter 140ms var(--ease-out), border-color 140ms var(--ease-out);
        user-select: none;
        flex-shrink: 0;
        outline: none;
        white-space: nowrap;
    }

    .btn:disabled {
        opacity: 0.55;
        cursor: not-allowed;
        transform: none !important;
    }

    .btn:focus-visible, .tab-btn:focus-visible, .ticket-card:focus-visible, .icon-btn:focus-visible, .modern-input:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

    .btn-primary {
        background: var(--accent-gradient);
        color: var(--text-inverted);
        box-shadow: var(--shadow-glow);
    }

    .btn-glass {
        background: var(--glass-card);
        border-color: var(--glass-border);
        box-shadow: var(--shadow-card), var(--glass-shine);
    }

    .btn-sm {
        min-height: 35px;
        padding: 7px 14px;
        font-size: 12.5px;
        border-radius: var(--radius-xs);
    }

    @media (hover: hover) and (pointer: fine) {
        .btn-primary:hover:not(:disabled) {
            filter: brightness(1.08);
            transform: translate3d(0, -1px, 0);
        }
        .btn-glass:hover:not(:disabled) {
            background: var(--glass-card-hover);
            border-color: var(--glass-border-strong);
            transform: translate3d(0, -1px, 0);
        }
    }

    .btn:active:not(:disabled) {
        transform: scale(0.97);
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
        border: 1px solid var(--glass-border);
        background: var(--glass-card);
        color: var(--text-main);
        cursor: pointer;
        text-decoration: none;
        font-size: 15px;
        box-shadow: var(--shadow-card), var(--glass-shine);
        transition: transform 140ms var(--ease-out), border-color 140ms var(--ease-out), filter 140ms var(--ease-out);
        outline: none;
    }

    .icon-btn.is-on {
        color: var(--accent);
        border-color: var(--accent);
        background: var(--accent-soft);
    }

    .icon-btn-accent {
        background: var(--accent-gradient);
        border-color: rgba(255, 255, 255, 0.2);
        color: var(--text-inverted);
        box-shadow: var(--shadow-glow);
    }

    @media (hover: hover) and (pointer: fine) {
        .icon-btn:hover {
            background: var(--glass-card-hover);
            border-color: var(--glass-border-strong);
            transform: translate3d(0, -1px, 0);
        }
        .icon-btn-accent:hover {
            filter: brightness(1.08);
            transform: translate3d(0, -1px, 0);
        }
    }

    .icon-btn:active {
        transform: scale(0.94);
    }

    .sidebar {
        width: var(--side-w);
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        min-height: 0;
        min-width: 0;
        background: var(--glass-panel);
        border-right: 1px solid var(--glass-border);
        z-index: 10;
    }

    .side-head {
        padding: 18px 18px 14px;
        display: flex;
        flex-direction: column;
        gap: 13px;
        flex-shrink: 0;
    }

    .side-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .page-title {
        font-family: var(--font-display);
        font-size: 19px;
        font-weight: 800;
        color: var(--text-main);
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        flex: 1;
    }

    .page-title i {
        width: 36px;
        height: 36px;
        border-radius: 11px;
        background: var(--accent-soft);
        border: 1px solid rgba(10, 132, 255, 0.28);
        box-shadow: var(--glass-shine);
        color: var(--accent);
        font-size: 15px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        transition: transform 150ms var(--ease-out);
    }

    @media (hover: hover) and (pointer: fine) {
        .page-title:hover i {
            transform: scale(1.05);
        }
    }

    .user-chip {
        display: flex;
        align-items: center;
        gap: 11px;
        padding: 10px 13px;
        border-radius: var(--radius-md);
        background: var(--glass-card);
        border: 1px solid var(--glass-border);
        box-shadow: var(--shadow-card), var(--glass-shine);
        min-width: 0;
    }

    .user-chip-ava {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--accent-gradient);
        color: var(--text-inverted);
        font-weight: 800;
        font-size: 14px;
        box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3);
    }

    .user-chip-text {
        min-width: 0;
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1px;
    }

    .user-chip-name {
        font-size: 14px;
        font-weight: 800;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-chip-role {
        font-size: 12px;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600;
    }

    .guest-note {
        margin: 0 18px 12px;
        padding: 9px 12px;
        border-radius: var(--radius-sm);
        background: var(--accent-soft);
        border: 1px solid var(--glass-border);
        font-size: 12px;
        color: var(--text-secondary);
        line-height: 1.42;
        flex-shrink: 0;
    }

    .guest-note i {
        color: var(--accent);
        margin-right: 4px;
    }

    .admin-tabs {
        display: flex;
        gap: 4px;
        margin: 0 18px 12px;
        padding: 4px;
        background: var(--input-bg);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-sm);
        flex-shrink: 0;
    }

    .tab-btn {
        flex: 1;
        min-height: 34px;
        background: transparent;
        border: 1px solid transparent;
        color: var(--text-muted);
        padding: 6px 12px;
        border-radius: 9px;
        cursor: pointer;
        font-weight: 700;
        font-size: 12.5px;
        font-family: inherit;
        white-space: nowrap;
        text-align: center;
        user-select: none;
        transition: color 100ms ease, transform 100ms ease;
        outline: none;
    }

    .tab-btn:active {
        transform: scale(0.97);
    }

    @media (hover: hover) and (pointer: fine) {
        .tab-btn:hover:not(.active) {
            color: var(--text-main);
        }
    }

    .tab-btn.active {
        background: var(--accent-gradient);
        color: var(--text-inverted);
        box-shadow: var(--shadow-glow);
    }

    .tickets-grid {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 2px 14px 80px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        overscroll-behavior: contain;
    }

    .tickets-grid > div[style*="grid-column"] {
        width: 100%;
        padding: 48px 16px !important;
        text-align: center !important;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: var(--text-muted);
        font-size: 13.5px;
        font-weight: 600;
    }

    .ticket-card {
        flex-shrink: 0;
        background: var(--glass-card);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-md);
        padding: 13px 15px;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 11px;
        position: relative;
        color: inherit;
        text-decoration: none;
        box-shadow: var(--shadow-card), var(--glass-shine);
        transition: transform 150ms var(--ease-out), border-color 150ms var(--ease-out), background 150ms var(--ease-out);
        outline: none;
        min-width: 0;
    }

    @media (hover: hover) and (pointer: fine) {
        .ticket-card:hover {
            background: var(--glass-card-hover);
            border-color: var(--glass-border-strong);
            transform: translate3d(0, -1.5px, 0);
        }
    }

    .ticket-card:active {
        transform: scale(0.985);
    }

    .ticket-card.active {
        background: var(--accent-soft);
        border-color: rgba(10, 132, 255, 0.45);
    }

    .ticket-card.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 12px;
        bottom: 12px;
        width: 3.5px;
        border-radius: 0 4px 4px 0;
        background: var(--accent);
    }

    .card-in-review {
        border-color: rgba(10, 132, 255, 0.35);
    }

    .ticket-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .ticket-id {
        font-size: 11.5px;
        color: var(--accent);
        font-weight: 800;
        display: flex;
        align-items: center;
        gap: 6px;
        font-variant-numeric: tabular-nums;
    }

    .ticket-info h4, .ticket-subj {
        font-size: 14.5px;
        font-weight: 800;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.32;
        margin: 2px 0 !important;
        letter-spacing: -0.01em;
    }

    .ticket-last-msg {
        font-size: 13px;
        color: var(--text-muted);
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ticket-last-msg b {
        color: var(--text-secondary);
        font-weight: 700;
    }

    .ticket-date {
        font-size: 11.5px;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        gap: 5px;
        font-weight: 600;
        margin-top: 3px !important;
        font-variant-numeric: tabular-nums;
    }

    .ticket-status-col {
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        max-width: 43%;
    }

    .status-pill {
        padding: 5px 10px;
        border-radius: 999px;
        font-size: 10.5px;
        font-weight: 800;
        line-height: 1.2;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        white-space: nowrap;
        background: var(--glass-card);
        border: 1px solid var(--glass-border-strong);
        box-shadow: var(--glass-shine);
        letter-spacing: 0.03em;
        text-transform: uppercase;
        max-width: 100%;
    }

    .status-pill span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    @keyframes anim-float {
        0%, 100% { transform: translate3d(0, 0, 0); }
        50% { transform: translate3d(0, -2px, 0); }
    }
    @keyframes anim-shake {
        0%, 100% { transform: rotate(0deg); }
        25% { transform: rotate(4deg); }
        75% { transform: rotate(-4deg); }
    }
    @keyframes anim-breathe {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.08); }
    }
    @keyframes anim-spin-slow {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    @keyframes anim-bounce-soft {
        0%, 100% { transform: translate3d(0, 0, 0); }
        50% { transform: translate3d(0, -2.5px, 0); }
    }
    @keyframes blink-anim {
        50% { opacity: 0.55; }
    }

    .status-anim-float i { animation: anim-float 3s ease-in-out infinite; }
    .status-anim-glow i { animation: anim-breathe 2.5s ease-in-out infinite; }
    .status-anim-shake i { animation: anim-shake 4s ease-in-out infinite; }
    .status-anim-breathe i { animation: anim-breathe 2.5s ease-in-out infinite; }
    .status-anim-spin i { animation: anim-spin-slow 8s linear infinite; }
    .status-anim-bounce i { animation: anim-bounce-soft 2s ease-in-out infinite; }
    .status-blink { animation: blink-anim 1.5s infinite; }

    .cursor-pointer {
        cursor: pointer;
    }

    .empty-state {
        text-align: center;
        padding: 48px 22px;
        color: var(--text-muted);
        border-radius: var(--radius-lg);
        border: 1px dashed var(--glass-border-strong);
        margin: 12px 6px;
        background: var(--glass-card);
        box-shadow: var(--glass-shine);
        font-size: 13.5px;
    }

    .empty-state i {
        font-size: 32px;
        opacity: 0.7;
        margin-bottom: 12px;
        color: var(--accent);
        display: block;
    }

    .main {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        min-height: 0;
        background: var(--bg-surface);
        position: relative;
    }

    .chat-head {
        flex-shrink: 0;
        padding: 13px 22px;
        border-bottom: 1px solid var(--glass-border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        background: var(--glass-panel);
        z-index: 20;
        min-width: 0;
    }

    .chat-head-back {
        display: none;
    }

    .chat-head-title {
        flex: 1;
        min-width: 0;
    }

    .chat-head-title h2 {
        font-size: 17px;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        gap: 9px;
        color: var(--text-main);
    }

    .chat-head-title h2 i {
        color: var(--accent);
        font-size: 14px;
        flex-shrink: 0;
    }

    .chat-head-meta {
        color: var(--text-muted);
        font-size: 12.5px;
        margin-top: 4px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 5px 12px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

    .chat-head-meta > span:first-child {
        color: var(--accent);
        font-weight: 800;
    }

    .chat-head-actions {
        display: flex;
        align-items: center;
        gap: 9px;
        flex-shrink: 0;
    }

    .category-dropdown-wrapper {
        position: relative;
        display: inline-flex;
        align-items: center;
    }

    .category-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        width: 320px;
        max-width: calc(100vw - 24px);
        max-height: 400px;
        overflow-y: auto;
        background: var(--bg-elevated);
        border: 1px solid var(--glass-border-strong);
        border-radius: var(--radius-md);
        padding: 10px;
        z-index: 1000;
        display: none;
        box-shadow: var(--shadow-ambient), var(--glass-shine);
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .category-menu.show {
        display: grid;
        animation: cascadeInDown 160ms var(--ease-out) both;
    }

    .cat-option {
        padding: 9px 11px;
        border-radius: var(--radius-xs);
        cursor: pointer;
        font-size: 12px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 7px;
        border: 1px solid rgba(255, 255, 255, 0.06);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        transition: filter 120ms ease, transform 120ms ease;
    }

    .cat-option:hover {
        filter: brightness(1.14);
        transform: translate3d(0, -1px, 0);
    }

    .admin-bar {
        flex-shrink: 0;
        display: none;
        flex-wrap: wrap;
        gap: 10px 14px;
        align-items: center;
        padding: 11px 22px;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--glass-border);
        z-index: 15;
    }

    .admin-bar.show {
        display: flex;
    }

    .admin-bar form {
        display: flex;
        gap: 8px;
        align-items: center;
        flex-wrap: wrap;
    }

    .admin-bar .divider {
        width: 1px;
        height: 22px;
        background: var(--glass-border-strong);
    }

    .admin-label {
        font-size: 13px;
        font-weight: 800;
        color: var(--text-secondary);
        display: inline-flex;
        align-items: center;
        gap: 7px;
    }

    .admin-label i {
        color: var(--accent);
    }

    .chat-area {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 20px 24px;
        display: flex;
        flex-direction: column;
        gap: 11px;
        overscroll-behavior: contain;
        contain: content;
    }

    .msg-row {
        display: flex;
        align-items: flex-end;
        gap: 10px;
        max-width: min(76%, 740px);
        min-width: 0;
    }

    .msg-row-mine {
        margin-left: auto;
        flex-direction: row-reverse;
    }

    .msg-row-other {
        margin-right: auto;
    }

    .msg-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--accent-gradient);
        color: var(--text-inverted);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        font-size: 13px;
        flex-shrink: 0;
        overflow: hidden;
        box-shadow: var(--shadow-card);
    }

    .msg-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .msg-row-mine .msg-avatar {
        display: none;
    }

    .msg-content {
        display: flex;
        flex-direction: column;
        gap: 3px;
        min-width: 0;
        max-width: 100%;
    }

    .msg-row-mine .msg-content {
        align-items: flex-end;
    }

    .msg-row-other .msg-content {
        align-items: flex-start;
    }

    .msg-name {
        font-size: 12.5px;
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 5px;
        font-weight: 700;
        padding: 0 5px;
    }

    .message-bubble {
        padding: 11px 16px;
        font-size: 14.5px;
        line-height: 1.48;
        letter-spacing: -0.005em;
        position: relative;
        max-width: 100%;
        width: fit-content;
        min-width: 0;
        word-wrap: break-word;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .message-bubble p {
        margin: 0 !important;
        line-height: 1.48;
    }

    .message-bubble p + p {
        margin-top: 2px !important;
    }

    .message-bubble p:empty,
    .message-bubble p > br:only-child {
        display: block;
        height: 5px;
        line-height: 5px;
    }

    .message-bubble ul,
    .message-bubble ol {
        padding-left: 19px;
        margin: 4px 0;
    }

    .message-bubble li {
        margin-bottom: 2px;
        line-height: 1.45;
    }

    .message-bubble img {
        display: block;
        max-width: min(100%, 350px);
        height: auto;
        max-height: 360px;
        border-radius: 12px;
        margin: 6px 0 2px;
        cursor: zoom-in;
        object-fit: contain;
        border: 1px solid var(--glass-border-strong);
    }

    .message-bubble pre {
        background: var(--code-bg);
        color: var(--code-text);
        padding: 10px 13px;
        border-radius: var(--radius-xs);
        overflow-x: auto;
        max-width: 100%;
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        font-size: 12.5px;
        line-height: 1.46;
        border: 1px solid var(--glass-border-strong);
        margin: 5px 0;
        white-space: pre-wrap;
    }

    .message-bubble code {
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        background: rgba(0, 0, 0, 0.22);
        padding: 2px 5px;
        border-radius: 5px;
        font-size: 0.88em;
    }

    [data-theme="light"] .message-bubble.msg-other code {
        background: rgba(15, 23, 42, 0.07);
    }

    .message-bubble.msg-other {
        background: var(--msg-other-bg);
        color: var(--text-main);
        border-radius: var(--msg-radius);
        border-bottom-left-radius: 5px;
        border: 1px solid var(--glass-border);
        box-shadow: var(--shadow-card), var(--glass-shine);
    }

    .message-bubble.msg-mine {
        background: var(--accent-gradient);
        color: var(--text-inverted);
        border-radius: var(--msg-radius);
        border-bottom-right-radius: 5px;
        box-shadow: var(--shadow-glow);
    }

    .message-bubble.msg-mine a {
        color: var(--text-inverted) !important;
        text-decoration: underline !important;
        font-weight: 700 !important;
    }

    .message-bubble.msg-other a {
        color: var(--accent);
        text-decoration: underline;
        font-weight: 700;
    }

    .sys-msg-container {
        width: 100%;
        display: flex;
        justify-content: center;
        margin: 5px 0;
    }

    .msg-system {
        background: var(--glass-card);
        border: 1px solid var(--glass-border-strong);
        box-shadow: var(--shadow-card), var(--glass-shine);
        color: var(--text-secondary);
        border-radius: 999px;
        padding: 6px 15px;
        font-size: 12.5px;
        font-weight: 600;
        text-align: center;
        max-width: 90%;
    }

    .date-separator {
        width: 100%;
        text-align: center;
        margin: 12px 0;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .date-separator::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        width: 100%;
        height: 1px;
        background: linear-gradient(90deg, transparent 0%, var(--glass-border-strong) 20%, var(--glass-border-strong) 80%, transparent 100%);
        z-index: 1;
    }

    .date-separator span {
        background: var(--bg-elevated);
        border: 1px solid var(--glass-border-strong);
        box-shadow: var(--glass-shine);
        padding: 4px 14px;
        color: var(--text-secondary);
        font-size: 11.5px;
        font-weight: 700;
        position: relative;
        z-index: 2;
        border-radius: 999px;
    }

    .msg-meta {
        font-size: 11px;
        color: var(--text-muted);
        padding: 0 5px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

    .badge-status {
        font-size: 9.5px;
        padding: 2px 7px;
        border-radius: 999px;
        background: var(--glass-card);
        border: 1px solid var(--glass-border);
        margin-left: 4px;
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        font-weight: 800;
    }

    .status-admin { color: var(--danger); background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.28); }
    .status-guest { color: var(--warning); background: rgba(255, 159, 10, 0.14); border-color: rgba(255, 159, 10, 0.28); }
    .status-user { color: var(--text-muted); }
    .status-moder { color: var(--accent); background: var(--accent-soft); border-color: rgba(10, 132, 255, 0.3); }
    .status-tech { color: var(--success); background: rgba(48, 209, 88, 0.14); border-color: rgba(48, 209, 88, 0.28); }
    .status-default { color: var(--text-muted); }

    #input-section {
        flex-shrink: 0;
        border-top: 1px solid var(--glass-border);
        background: var(--glass-panel);
        padding: 13px 22px calc(13px + env(safe-area-inset-bottom, 0px));
        z-index: 10;
    }

    .input-wrapper {
        background: var(--input-bg);
        border-radius: var(--radius-md);
        border: 1px solid var(--glass-border-strong);
        box-shadow: var(--shadow-card), var(--glass-shine);
        position: relative;
        transition: border-color 140ms ease;
    }

    .input-wrapper:focus-within {
        border-color: var(--accent);
        box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.2);
    }

    .composer-bar {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        flex-wrap: wrap;
        gap: 9px;
        padding: 8px 12px;
        border-top: 1px solid var(--glass-border);
        background: var(--glass-card);
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }

    .ql-toolbar.ql-snow {
        border: none !important;
        border-bottom: 1px solid var(--glass-border) !important;
        background: var(--glass-card);
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        padding: 7px 12px !important;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 5px;
    }

    .ql-snow .ql-formats {
        margin-right: 6px !important;
        display: inline-flex;
        align-items: center;
        gap: 2px;
    }

    .ql-snow.ql-toolbar button,
    .ql-snow .ql-toolbar button {
        width: 30px;
        height: 30px;
        padding: 4px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .ql-snow.ql-toolbar button:hover {
        background: var(--glass-highlight);
    }

    .ql-snow.ql-toolbar button.ql-active {
        background: var(--accent-soft);
    }

    .ql-container.ql-snow {
        border: none !important;
        font-family: var(--font-family);
        font-size: 14.5px;
        color: var(--text-main);
        height: auto;
    }

    .ql-editor {
        min-height: 66px;
        max-height: 190px;
        overflow-y: auto !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        padding: 11px 15px;
        line-height: 1.48;
    }

    .ql-editor p {
        margin: 0 0 2px 0 !important;
        line-height: 1.48;
    }

    .ql-editor p:last-child {
        margin-bottom: 0 !important;
    }

    .ql-editor.ql-blank::before {
        color: var(--text-muted);
        font-style: normal;
        left: 15px;
        right: 15px;
    }

    .ql-stroke { stroke: var(--text-muted) !important; }
    .ql-fill { fill: var(--text-muted) !important; }
    .ql-picker { color: var(--text-muted) !important; }

    .ql-snow.ql-toolbar button:hover .ql-stroke,
    .ql-snow.ql-toolbar button.ql-active .ql-stroke {
        stroke: var(--accent) !important;
    }

    .ql-snow.ql-toolbar button:hover .ql-fill,
    .ql-snow.ql-toolbar button.ql-active .ql-fill {
        fill: var(--accent) !important;
    }

    .ql-snow .ql-editor pre.ql-syntax {
        background: var(--code-bg);
        color: var(--code-text);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-xs);
        padding: 9px 12px;
        margin: 4px 0;
    }

    .ql-snow .ql-tooltip {
        background-color: var(--bg-elevated) !important;
        border: 1px solid var(--glass-border-strong) !important;
        box-shadow: var(--shadow-ambient) !important;
        color: var(--text-main) !important;
        border-radius: var(--radius-sm) !important;
        padding: 8px 12px !important;
        z-index: 100 !important;
        left: 12px !important;
    }

    .ql-snow .ql-tooltip input[type="text"] {
        background: var(--input-bg) !important;
        border: 1px solid var(--glass-border-strong) !important;
        color: var(--text-main) !important;
        border-radius: 7px !important;
        padding: 5px 9px !important;
        outline: none !important;
    }

    .closed-note {
        padding: 15px 20px;
        text-align: center;
        background: var(--glass-card);
        border: 1px solid var(--glass-border);
        box-shadow: var(--shadow-card), var(--glass-shine);
        border-radius: var(--radius-md);
        color: var(--text-muted);
        font-size: 13.5px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .modern-input {
        width: 100%;
        min-height: 42px;
        padding: 9px 14px;
        background-color: var(--input-bg);
        border: 1px solid var(--glass-border-strong);
        border-radius: var(--radius-sm);
        color: var(--text-main);
        font-family: inherit;
        font-size: 14px;
        font-weight: 500;
        outline: none;
        transition: border-color 140ms ease;
        -webkit-appearance: none;
        appearance: none;
    }

    select.modern-input {
        background-image: var(--select-arrow);
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 36px;
        cursor: pointer;
    }

    .modern-input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.2);
    }

    select.modern-input option {
        background: var(--bg-elevated);
        color: var(--text-main);
    }

    .admin-bar .modern-input {
        width: auto;
        min-height: 35px;
        padding: 6px 34px 6px 12px;
        font-size: 13px;
        border-radius: var(--radius-xs);
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-label {
        display: block;
        margin-bottom: 7px;
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .warning-box {
        background: rgba(255, 159, 10, 0.12);
        border: 1px solid rgba(255, 159, 10, 0.3);
        padding: 11px 14px;
        border-radius: var(--radius-sm);
        margin-top: 8px;
        font-size: 13px;
        line-height: 1.46;
        color: var(--warning);
        display: none;
        font-weight: 600;
    }

    .create-pane {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 30px 24px calc(44px + env(safe-area-inset-bottom, 0px));
    }

    .create-card {
        max-width: 700px;
        margin: 0 auto;
        background: var(--glass-card);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-lg);
        padding: 28px;
        box-shadow: var(--shadow-ambient), var(--glass-shine);
    }

    .create-head {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 24px;
        padding-bottom: 18px;
        border-bottom: 1px solid var(--glass-border);
    }

    .create-head-icon {
        width: 46px;
        height: 46px;
        background: var(--accent-soft);
        border: 1px solid rgba(10, 132, 255, 0.32);
        box-shadow: var(--glass-shine);
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--accent);
        flex-shrink: 0;
        font-size: 19px;
    }

    .create-head h2 {
        font-size: 20px;
        font-weight: 800;
    }

    .create-head p {
        font-size: 13.5px;
        color: var(--text-muted);
        margin-top: 3px;
        font-weight: 500;
    }

    .create-card .ql-editor {
        min-height: 190px;
        max-height: 380px;
    }

    .create-actions {
        display: flex;
        justify-content: flex-end;
        margin-top: 20px;
    }

    .image-modal {
        position: fixed;
        z-index: 999999;
        inset: 0;
        width: 100%;
        height: 100%;
        padding: 24px;
        background-color: var(--overlay-bg);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .image-modal.show {
        opacity: 1;
        pointer-events: auto;
        display: flex !important;
    }

    .image-modal-content {
        display: block;
        max-width: min(92vw, 1280px);
        max-height: 86dvh;
        border-radius: var(--radius-md);
        object-fit: contain;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    }

    .image-modal-close {
        position: absolute;
        top: 20px;
        right: 24px;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: rgba(15, 23, 42, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #FFFFFF;
        font-size: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .btn-close-action {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        min-height: 36px;
        padding: 7px 14px;
        border-radius: var(--radius-xs);
        font-size: 12.5px;
        font-weight: 700;
        color: var(--danger);
        background: rgba(255, 69, 58, 0.12);
        border: 1px solid rgba(255, 69, 58, 0.28);
        box-shadow: var(--glass-shine);
        cursor: pointer;
        transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
        white-space: nowrap;
        font-family: inherit;
        outline: none;
        flex-shrink: 0;
    }

    .btn-close-action:hover {
        background: rgba(255, 69, 58, 0.2);
        border-color: rgba(255, 69, 58, 0.45);
    }

    .btn-close-action:active {
        transform: scale(0.97);
    }

    .notif-modal-overlay {
        display: none;
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        z-index: 1000000;
        background: var(--overlay-bg);
        align-items: center;
        justify-content: center;
        padding: 16px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .notif-modal-overlay.active {
        display: flex !important;
        opacity: 1;
        pointer-events: auto;
    }

    .notif-modal-card {
        background: var(--bg-elevated);
        border: 1px solid var(--glass-border-strong);
        border-radius: var(--radius-lg);
        padding: 30px 26px 24px;
        width: 100%;
        max-width: 410px;
        text-align: center;
        position: relative;
        box-shadow: var(--shadow-ambient), var(--glass-shine);
    }

    .notif-modal-close-btn {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: var(--glass-card);
        border: 1px solid var(--glass-border);
        color: var(--text-muted);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        cursor: pointer;
    }

    .notif-modal-icon {
        width: 58px;
        height: 58px;
        border-radius: 17px;
        background: var(--accent-soft);
        border: 1px solid rgba(10, 132, 255, 0.35);
        box-shadow: var(--shadow-glow);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--accent);
        font-size: 24px;
        margin-bottom: 16px;
    }

    .notif-modal-title {
        font-size: 19px;
        font-weight: 800;
        color: var(--text-main);
        margin: 0 0 8px;
    }

    .notif-modal-text {
        font-size: 13.5px;
        line-height: 1.5;
        color: var(--text-muted);
        margin: 0 0 20px;
    }

    .notif-modal-actions {
        display: flex;
        gap: 10px;
    }

    .notif-btn {
        flex: 1;
        min-height: 42px;
        padding: 0 16px;
        font-size: 13.5px;
        font-weight: 700;
        border-radius: var(--radius-sm);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        font-family: inherit;
        border: 1px solid transparent;
    }

    .notif-btn-secondary {
        background: var(--glass-card);
        border-color: var(--glass-border-strong);
        color: var(--text-main);
    }

    .notif-btn-primary {
        background: var(--accent-gradient);
        color: var(--text-inverted);
        box-shadow: var(--shadow-glow);
    }

    .theme-switcher-wrapper {
        position: fixed;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        left: calc(18px + env(safe-area-inset-left, 0px));
        z-index: 100000;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .theme-btn {
        width: 42px;
        height: 42px;
        border-radius: 13px;
        background: var(--bg-elevated);
        border: 1px solid var(--glass-border-strong);
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: var(--shadow-ambient), var(--glass-shine);
        transition: border-color 140ms ease, transform 140ms ease;
        padding: 0;
    }

    @media (hover: hover) and (pointer: fine) {
        .theme-btn:hover {
            border-color: var(--accent);
            transform: translate3d(0, -1.5px, 0);
        }
    }

    .theme-btn:active {
        transform: scale(0.94);
    }

    .theme-btn svg {
        width: 19px;
        height: 19px;
        fill: currentColor;
        transition: transform 200ms ease;
    }

    .theme-menu {
        position: absolute;
        bottom: calc(100% + 8px);
        left: 0;
        width: 176px;
        background: var(--bg-elevated);
        border: 1px solid var(--glass-border-strong);
        border-radius: var(--radius-md);
        padding: 6px;
        display: flex;
        flex-direction: column;
        gap: 3px;
        box-shadow: var(--shadow-ambient), var(--glass-shine);
        opacity: 0;
        transform: scale(0.96);
        transform-origin: bottom left;
        pointer-events: none;
        transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
    }

    .theme-menu.show {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }

    .theme-option {
        padding: 9px 12px;
        border-radius: 9px;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 13px;
        font-weight: 700;
        color: var(--text-secondary);
        cursor: pointer;
        border: 1px solid transparent;
    }

    .theme-option svg {
        width: 16px;
        height: 16px;
        fill: currentColor;
        opacity: 0.8;
    }

    .theme-option:hover {
        background: var(--glass-highlight);
        color: var(--text-main);
    }

    .theme-option.active {
        background: var(--accent-soft);
        color: var(--accent);
        border-color: rgba(10, 132, 255, 0.3);
    }

    .hide-mobile { display: inline; }
    .create-head-back { display: none; }
    .mobile-cat { display: none; }

    @media (max-width: 1120px) and (min-width: 861px) {
        :root, [data-theme="brand"], [data-theme="dark"], [data-theme="light"] {
            --side-w: 325px;
        }
    }

    @media (max-width: 860px) {
        .hide-mobile { display: none; }
        .mobile-cat { display: flex; margin-top: 6px; }
        .sidebar { width: 100%; border-right: none; }
        .main { display: none; }
        .app.detail-open .sidebar { display: none !important; }
        .app.detail-open .main { display: flex !important; }
        .app.detail-open ~ .theme-switcher-wrapper { display: none !important; }
        .chat-head { padding: max(10px, env(safe-area-inset-top, 10px)) 14px 10px; gap: 10px; }
        .chat-head-back, .create-head-back { display: inline-flex !important; }
        .chat-head-actions .btn-close-action span { display: none; }
        .chat-head-actions .btn-close-action { width: 38px; padding: 0; }
        .category-menu { position: fixed; top: 68px; right: 12px; left: 12px; width: auto; max-width: none; }
        .chat-area { padding: 14px 12px; }
        .msg-row { max-width: 92%; }
        #input-section { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
        .create-pane { padding: 16px 12px calc(32px + env(safe-area-inset-bottom, 0px)); }
        .create-card { padding: 20px 16px; }
    }

.composer-actions-right {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
    flex-wrap: wrap;
}

.tpl-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: auto;
}

.tpl-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-ambient), var(--glass-shine);
    padding: 12px;
    z-index: 1200;
    display: none;
    flex-direction: column;
    gap: 10px;
}

.tpl-panel.show {
    display: flex;
    animation: cascadeInDown 160ms var(--ease-out) both;
}

.tpl-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.tpl-add-toggle {
    background: var(--accent-soft);
    border: 1px solid rgba(10, 132, 255, 0.3);
    color: var(--accent);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    transition: filter 120ms ease;
}

.tpl-add-toggle:hover {
    filter: brightness(1.12);
}

.tpl-create-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

.tpl-input {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 13px;
}

.tpl-textarea {
    min-height: 70px;
    padding: 8px 11px;
    font-size: 13px;
    resize: vertical;
}

.tpl-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tpl-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.tpl-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    transition: background 120ms ease, border-color 120ms ease;
}

.tpl-item:hover {
    background: var(--glass-card-hover);
    border-color: var(--glass-border-strong);
}

.tpl-item-body {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.tpl-item-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tpl-item-preview {
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.tpl-del-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid rgba(255, 69, 58, 0.25);
    background: rgba(255, 69, 58, 0.1);
    color: var(--danger);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 120ms ease;
}

.tpl-del-btn:hover {
    background: rgba(255, 69, 58, 0.22);
}

.tpl-empty {
    text-align: center;
    padding: 18px 10px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
}

@media (max-width: 860px) {
    .composer-actions-right {
        width: 100%;
        justify-content: flex-end;
    }
    .tpl-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 84px;
        width: auto;
        max-width: none;
    }
}