/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ──────────────────────────────────────────────────────────────
   FONT — Inter (loaded via <link> on login page)
   Fallback to system fonts everywhere else
────────────────────────────────────────────────────────────── */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    /* Cores principais - Inspiradas em teusck.com */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary: #0ea5e9;
    --secondary-dark: #0284c7;
    --accent: #6366f1;
    --accent-dark: #4f46e5;

    /* Cores de fundo - Tema claro */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;

    /* Cores de texto - Tema claro */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;

    /* Cores neutras */
    --dark: #0a0e27;
    --darker: #0d1128;
    --light: #F1F5F9;
    --gray: #64748B;
    --gray-light: #E2E8F0;

    /* Cores de status */
    --danger: #EF4444;
    --danger-color: #EF4444;
    --success: #008000;
    --warning: #FFD700;
    --info: #3b82f6;

    /* Branco */
    --white: #FFFFFF;

    /* Sombras */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(59, 130, 246, 0.1), 0 4px 6px -2px rgba(59, 130, 246, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(59, 130, 246, 0.15), 0 10px 10px -5px rgba(59, 130, 246, 0.08);
    --shadow-xl: 0 25px 50px -12px rgba(59, 130, 246, 0.25);

    /* Outros */
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-color: #E5E7EB;
}

/* Tema escuro - Inspirado em teusck.com */
[data-theme="dark"] {
    /* Cores principais - tons mais suaves e menos saturados */
    --primary: #5b8fd9;
    --primary-dark: #4a7dc0;
    --primary-light: #6b9fe9;
    --secondary: #4a9d6a;
    --secondary-dark: #3d8558;
    --accent: #e6c84f;
    --accent-dark: #d4b640;

    /* Cores de fundo - cinza médio para menos contraste */
    --bg-primary: #1e1e1e;
    --bg-secondary: #252525;
    --bg-tertiary: #2b2b2b;

    /* Cores de texto - contraste reduzido */
    --text-primary: #c0c0c0;
    --text-secondary: #9a9a9a;
    --text-tertiary: #7a7a7a;

    /* Cores neutras */
    --dark: #c0c0c0;
    --darker: #c0c0c0;
    --light: #2b2b2b;
    --gray: #808080;
    --gray-light: #353535;

    /* Cores de status - menos saturadas */
    --danger: #d98989;
    --success: #4a9d6a;
    --warning: #e6c84f;
    --info: #5b8fd9;

    /* Sombras - mais suaves */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --border-color: #353535;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    margin: 0;
    overflow: hidden;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body > * {
    position: relative;
    z-index: 1;
}

.container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    padding: 0;
    margin: 0;
}

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE — Modern split-screen redesign
══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE — Dark Navy Glassmorphism (teusck.com aesthetic)
══════════════════════════════════════════════════════════════ */

/* Full-page dark navy gradient, same palette as teusck.com */
body.login-page {
    height: auto;
    min-height: 100vh;
    overflow: auto;
    display: block;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0d1128 100%);
    background-attachment: fixed;
    font-family: var(--font-sans);
    color: #E8E8E8;
}

/* Layout: two columns */
.login-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ─── LEFT: Brand panel ─────────────────────────────────────── */
.login-brand {
    position: relative;
    background: linear-gradient(160deg, rgba(10,14,39,0.95) 0%, rgba(13,17,48,0.98) 100%);
    border-right: 1px solid rgba(59, 130, 246, 0.12);
    overflow: hidden;
    display: flex;
    align-items: stretch;
}

.login-brand-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 48px 52px;
    gap: 48px;
    width: 100%;
}

/* Logo row */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4), 0 0 40px rgba(37, 211, 102, 0.15);
}

.brand-icon-badge.sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.1rem;
}

.brand-wordmark {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Headline + sub */
.brand-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand-headline {
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.brand-highlight {
    background: linear-gradient(90deg, #FFD700, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-sub {
    font-size: 1rem;
    color: rgba(232, 232, 232, 0.65);
    line-height: 1.65;
    max-width: 380px;
}

/* Feature list */
.brand-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 8px;
}

.brand-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.bf-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(30, 41, 82, 0.6);
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #3b82f6;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.brand-feature:hover .bf-icon {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.bf-text strong {
    display: block;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.bf-text p {
    color: rgba(232, 232, 232, 0.55);
    font-size: 0.825rem;
    line-height: 1.4;
    margin: 0;
}

/* Decorative orbs */
.brand-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: orb-float 8s ease-in-out infinite;
}

.orb-1 {
    width: 320px;
    height: 320px;
    background: #3b82f6;
    bottom: -80px;
    left: -60px;
    opacity: 0.18;
    animation-delay: 0s;
}

.orb-2 {
    width: 200px;
    height: 200px;
    background: #008000;
    top: 10%;
    right: -40px;
    opacity: 0.15;
    animation-delay: -3s;
}

.orb-3 {
    width: 160px;
    height: 160px;
    background: #FFD700;
    top: 40%;
    right: 20%;
    opacity: 0.1;
    animation-delay: -5s;
}

@keyframes orb-float {
    0%, 100% { transform: translateY(0px) scale(1); }
    50%       { transform: translateY(-24px) scale(1.05); }
}

/* ─── RIGHT: Form panel — WhatsApp dark ────────────────────── */
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fundo com gradientes coloridos para o glass do card ter algo para mostrar */
    background:
        radial-gradient(ellipse at 20% 20%, rgba(37, 211, 102, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 75%, rgba(59, 130, 246, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(37, 211, 102, 0.08) 0%, transparent 40%),
        #111b21;
    padding: 48px 32px;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Subtle WhatsApp-style dot grid */
.login-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 26px 26px;
    pointer-events: none;
    z-index: 0;
}

/* Vignette nas bordas */
.login-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Floating decorative icons */
.wp-bg-icons {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.wp-bg-icon {
    position: absolute;
    color: rgba(37, 211, 102, 0.07);
    animation: wp-icon-float 7s ease-in-out infinite;
}

.wp-bg-icon:nth-child(2) { animation-delay: -2s; animation-duration: 9s; }
.wp-bg-icon:nth-child(3) { animation-delay: -4s; animation-duration: 8s; }
.wp-bg-icon:nth-child(4) { animation-delay: -1s; animation-duration: 10s; }
.wp-bg-icon:nth-child(5) { animation-delay: -3s; animation-duration: 6s; }
.wp-bg-icon:nth-child(6) { animation-delay: -5s; animation-duration: 11s; }
.wp-bg-icon:nth-child(7) { animation-delay: -1.5s; animation-duration: 8.5s; }
.wp-bg-icon:nth-child(8) { animation-delay: -3.5s; animation-duration: 7.5s; }

@keyframes wp-icon-float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-14px); }
}

.login-panel-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Mobile-only logo strip (hidden on desktop) */
.brand-mobile {
    display: none;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
}

/* ─── Auth card — glass navbar style + bottom bloom ─────────── */
@keyframes bloom-pulse {
    0%, 100% { opacity: 0.35; transform: translateX(-50%) scaleX(1); }
    50%       { opacity: 0.7;  transform: translateX(-50%) scaleX(1.15); }
}

.auth-card {
    position: relative;
    background: rgba(10, 14, 39, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.15);
    padding: 40px 36px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: authCardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Blue bloom at the bottom — slow pulse */
.auth-card::after {
    content: '';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 75%;
    height: 36px;
    background: radial-gradient(ellipse at 50% 100%, rgba(59, 130, 246, 0.6) 0%, transparent 70%);
    filter: blur(14px);
    animation: bloom-pulse 3.5s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes authCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.auth-card-top {
    margin-bottom: 28px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.4px;
    margin-bottom: 6px;
}

.auth-desc {
    font-size: 0.9rem;
    color: rgba(232, 232, 232, 0.55);
    margin: 0;
}

/* ─── Form fields ───────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(232, 232, 232, 0.85);
    letter-spacing: 0.1px;
}

.field-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 14px;
    font-size: 0.9rem;
    color: rgba(232, 232, 232, 0.35);
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s ease;
}

.field-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: #E8E8E8;
    background: rgba(30, 41, 82, 0.5);
    backdrop-filter: blur(6px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    outline: none;
}

.field-input::placeholder {
    color: rgba(232, 232, 232, 0.3);
}

.field-input:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(30, 41, 82, 0.65);
}

.field-input:focus {
    border-color: #3b82f6;
    background: rgba(30, 41, 82, 0.75);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 0 12px rgba(59, 130, 246, 0.1);
}

.field-wrap:focus-within .field-icon {
    color: #3b82f6;
}

/* Eye button for password */
.field-eye-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: rgba(232, 232, 232, 0.35);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    line-height: 1;
    transition: color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.field-eye-btn:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Add right padding to password inputs */
.field-wrap:has(.field-eye-btn) .field-input {
    padding-right: 44px;
}

/* ─── Inline row (remember me) ──────────────────────────────── */
.field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: -4px;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: rgba(232, 232, 232, 0.6);
    user-select: none;
}

.check-label input[type="checkbox"] {
    accent-color: #3b82f6;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ─── Auth button ───────────────────────────────────────────── */
.auth-btn {
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    margin-top: 4px;
    letter-spacing: 0.1px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4), 0 0 30px rgba(59, 130, 246, 0.15);
    position: relative;
    overflow: hidden;
}

.auth-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5), 0 0 40px rgba(59, 130, 246, 0.2);
    filter: brightness(1.08);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.auth-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: none;
}

/* ─── Footer links ──────────────────────────────────────────── */
.auth-links {
    margin-top: 22px;
    text-align: center;
    font-size: 0.875rem;
    color: rgba(232, 232, 232, 0.5);
}

.auth-links a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}

.auth-links a:hover {
    color: #60a5fa;
    text-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
}

/* ─── Alert overrides for dark bg ───────────────────────────── */
.auth-card .alert {
    border-radius: 10px;
    font-size: 0.875rem;
    padding: 10px 14px;
}

.auth-card .alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.auth-card .alert-success {
    background: rgba(0, 128, 0, 0.15);
    border: 1px solid rgba(0, 128, 0, 0.3);
    color: #86efac;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-brand {
        display: none;
    }

    .login-panel {
        padding: 32px 20px;
        min-height: 100vh;
    }

    .brand-mobile {
        display: flex;
    }

    .auth-card {
        padding: 32px 24px;
    }
}

@media (max-width: 420px) {
    .auth-card {
        border-radius: 16px;
        padding: 28px 18px;
    }
}

/* ══════════════════════════════════════════════════════════════
   END LOGIN PAGE
══════════════════════════════════════════════════════════════ */

/* Login Box (legacy — kept for any remaining references) */
.login-box {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
    max-width: 450px;
    margin: 0 auto;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.logo p {
    color: var(--gray);
    font-size: 0.95rem;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease-out;
}

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

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 96px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
}

.password-toggle:hover {
    background: rgba(99, 102, 241, 0.08);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #D1D5DB;
    background: var(--bg-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.remember-me-group .checkbox-label {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.remember-me-group input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
}

/* Buttons */
@keyframes gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.btn::before {
    display: none;
}

.btn:hover::before {
    display: none;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
    background-size: 200% 200%;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
    animation: gradient-shift 4s ease infinite;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.55);
    animation-duration: 2s;
}

[data-theme="dark"] .btn-primary {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    color: #ffffff;
}

[data-theme="dark"] .btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(239, 68, 68, 0.5);
}

[data-theme="dark"] .btn-danger {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.2);
}

.btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.35);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    animation: none;
}

.btn:disabled::before {
    display: none;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInDown 0.3s ease-out;
    border-left: 4px solid;
    box-shadow: var(--shadow-md);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert::before {
    content: '';
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-error {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    color: #991b1b;
    border-left-color: #dc2626;
}

.alert-error::before {
    content: '❌';
}

.alert-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #14532d;
    border-left-color: #16a34a;
}

.alert-success::before {
    content: '✅';
}

.alert-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
    border-left-color: #f59e0b;
}

.alert-warning::before {
    content: '⚠️';
}

.alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e3a8a;
    border-left-color: #3b82f6;
}

.alert-info::before {
    content: 'ℹ️';
}

/* Links */
.register-link {
    text-align: center;
    margin-top: 20px;
    color: var(--gray);
}

.register-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.register-link a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0d1128 100%);
    background-attachment: fixed;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    margin: 0;
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
    color: #E8E8E8;
}

[data-theme="dark"] .dashboard {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0d1128 100%);
}

[data-theme="dark"] .dashboard-header {
    background: transparent;
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.4);
}

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

.dashboard-header {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: #E8E8E8;
    padding: 8px 20px;
    height: auto;
    min-height: 55px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0;
    border-bottom: none;
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    flex-shrink: 0;
    z-index: 100;
}

.dashboard-header::before {
    display: none;
}

.dashboard-header h1 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    white-space: nowrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.user-info span {
    font-size: 0.9rem;
    font-weight: 500;
}

.dashboard-header {
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.header-left h1 {
    flex: 0 0 auto;
    justify-content: flex-start;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.header-nav .nav-tab {
    position: relative;
    display: inline-block;
    padding: 0.4em 0.8em;
    color: #fff;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.header-nav .nav-tab::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0%;
    height: 3px;
    border-radius: 3px;
    transition: width 0.1s ease;
    z-index: 2;
}

.header-nav .nav-tab i {
    color: inherit;
}

.header-nav .nav-tab:hover {
    color: #ffffff !important;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
    background: transparent;
}

.header-nav .nav-tab:hover::after {
    background-color: #ffffff;
    box-shadow: 0 0 2px #ffffff, 0 0 4px #ffffff, 0 0 8px #ffffff, 0 0 10px #ffffff;
    width: 40px;
}

.header-nav .nav-tab.active {
    color: #ffffff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
    background: transparent;
    border: none;
    box-shadow: none;
}

.header-nav .nav-tab.active::after {
    background-color: #ffffff;
    box-shadow: 0 0 2px #ffffff, 0 0 4px #ffffff, 0 0 8px #ffffff, 0 0 10px #ffffff;
    width: 40px;
}

.header-nav .nav-tab.active i {
    color: inherit;
}

.header-nav .menu-toggle-btn-header {
    padding: 8px 14px;
    font-size: 13px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.profile-menu-toggle {
    padding: 8px 16px;
    background: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: auto;
    height: auto;
}

.profile-menu-toggle:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.profile-status-dot {
    font-size: 0.5rem;
    color: var(--agent-status-color, #28a745);
    line-height: 1;
}

.profile-menu-dropdown {
    position: fixed;
    top: 72px;
    right: 24px;
    width: 220px;
    background: #f7f7f7;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.profile-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

[data-theme="dark"] .profile-menu-dropdown {
    background: #1b1b1b;
    border-color: rgba(255, 255, 255, 0.12);
}

.profile-menu-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .profile-menu-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.profile-menu-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.profile-menu-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.profile-menu-items {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

.profile-menu-item {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.profile-menu-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.profile-menu-item.danger {
    color: var(--danger);
}

.profile-menu-icon {
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.profile-menu-item[data-action="agent-status"] .profile-menu-icon {
    color: var(--agent-status-color, #28a745);
}

/* Theme Toggle Button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.theme-toggle i {
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.theme-toggle:hover::before {
    width: 100px;
    height: 100px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.theme-toggle:hover i {
    transform: rotate(180deg);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.logout-btn:hover {
    background: var(--bg-primary);
    color: var(--primary);
    border-color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--gray-light);
    padding: 0 6px;
    gap: 4px;
    position: relative;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 0;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: 8px;
    position: relative;
    width: 100%;
    border-left: 2px solid transparent;
}

.nav-tab i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    transition: var(--transition);
}

.nav-tab:hover i {
    transform: none;
}

.nav-tab.active i {
    color: var(--primary);
}

.nav-tab:hover:not(.active) {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary);
    border-left-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .nav-tab:hover:not(.active) {
    background: rgba(59, 130, 246, 0.15);
    box-shadow: none;
}

.nav-tab.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--primary);
    font-weight: 700;
}

[data-theme="dark"] .nav-tab.active {
    background: rgba(59, 130, 246, 0.2);
    box-shadow: none;
}

/* Header navbar — override global nav-tab rules with higher specificity */
.dashboard-header .header-nav .nav-tab,
.dashboard-header .header-nav .nav-tab:hover,
.dashboard-header .header-nav .nav-tab:hover:not(.active),
.dashboard-header .header-nav .nav-tab.active {
    background: transparent !important;
    border-left: none !important;
    border-left-color: transparent !important;
    border-radius: 0 !important;
    width: auto !important;
    overflow: visible !important;
}

.dashboard-header .header-nav .nav-tab:hover,
.dashboard-header .header-nav .nav-tab:hover:not(.active) {
    color: #ffffff !important;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.6) !important;
    box-shadow: none !important;
}

.dashboard-header .header-nav .nav-tab.active {
    color: #ffffff !important;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.6) !important;
    font-weight: 400 !important;
    box-shadow: none !important;
}

[data-theme="dark"] .nav-tabs {
    background: var(--bg-tertiary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-secondary);
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Tab Chat - Full Height without Padding */
#tab-chat {
    padding: 0 !important;
    overflow: hidden !important;
}

/* Custom scrollbar for tab content */
.tab-content::-webkit-scrollbar {
    width: 10px;
}

.tab-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.tab-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-light);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 12px 16px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    transform: translate(-20px, -20px);
}

.stat-card h3 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: var(--white);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-card p {
    font-size: 0.8rem;
    opacity: 0.95;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.automation-view-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
}

.view-toggle-btn.is-active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.automation-mindmap-list {
    display: grid;
    gap: 14px;
}

.mindmap-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

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

.mindmap-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.mindmap-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mindmap-flow {
    position: relative;
    padding: 18px;
    border-radius: 16px;
    border: 1px dashed var(--border-color);
    background-color: var(--bg-secondary);
    background-image: radial-gradient(#dfe3ea 1px, transparent 1px);
    background-size: 18px 18px;
    overflow-x: auto;
}

.mindmap-track {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: max-content;
    padding: 6px;
}

.mindmap-node {
    width: 120px;
    min-height: 108px;
    padding: 10px 8px;
    border-radius: 14px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.mindmap-node.is-muted {
    opacity: 0.55;
    filter: grayscale(0.15);
}

.mindmap-node.is-inactive .node-icon {
    background: #95a5a6;
}

.node-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.node-title {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-primary);
}

.node-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 96px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mindmap-connector {
    flex: 0 0 42px;
    height: 2px;
    background: #cfd4dc;
    position: relative;
}

.mindmap-connector::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid #cfd4dc;
    background: var(--card-bg);
}

.mindmap-connector::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -4px;
    border-left: 6px solid #cfd4dc;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.node-trigger .node-icon {
    background: #4facfe;
}

.node-scope .node-icon {
    background: #9b59b6;
}

.node-ai .node-icon {
    background: #00bcd4;
}

.node-action .node-icon {
    background: #f39c12;
}

.node-status .node-icon {
    background: #27ae60;
}

@media (max-width: 900px) {
    .mindmap-node {
        width: 108px;
        min-height: 100px;
    }

    .mindmap-connector {
        flex-basis: 32px;
    }
}

/* Mindmap Editor Modal */
.modal-content.mindmap-modal {
    max-width: 98vw;
    width: 98vw;
    height: 92vh;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mindmap-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    overflow-x: auto;
}

.mindmap-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.mindmap-toolbar .btn.is-active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.mindmap-toolbar .btn {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.mindmap-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow: hidden;
    padding: 16px;
}

.mindmap-select {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    white-space: nowrap;
}

.mindmap-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.mindmap-canvas {
    position: relative;
    min-height: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: var(--bg-secondary);
    background-image: radial-gradient(#dfe3ea 1px, transparent 1px);
    background-size: 18px 18px;
    overflow: auto;
    min-width: 0;
    z-index: 1;
}

.mindmap-canvas.is-linking {
    cursor: crosshair;
}

.mindmap-links {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.mindmap-links .mindmap-link {
    pointer-events: auto;
    cursor: pointer;
}

.mindmap-links .mindmap-link.is-selected {
    stroke: #2ecc71;
    stroke-width: 3;
}

.mindmap-node-edit {
    position: absolute;
    width: 130px;
    min-height: 110px;
    padding: 10px 8px;
    border-radius: 14px;
    border: 2px solid #d5dbe4;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    cursor: grab;
    user-select: none;
    overflow: visible;
}

.mindmap-node-edit:active {
    cursor: grabbing;
}

.mindmap-node-edit.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.mindmap-node-edit.is-link-source {
    border-color: #f39c12;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.2);
}

.mindmap-node-edit .node-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.mindmap-node-edit .node-title {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-primary);
}

.mindmap-node-edit .node-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 110px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mindmap-node-edit .node-output {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mindmap-node-edit .node-output .node-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c2c7d0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #c2c7d0;
    cursor: pointer;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.mindmap-node-edit .node-output .node-dot.is-active {
    background: #2ecc71;
    box-shadow: 0 0 0 1px #27ae60;
}

.mindmap-sidebar {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px;
    background: var(--bg-secondary);
    z-index: 2;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 12px;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

.mindmap-sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mindmap-tabbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mindmap-tab {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mindmap-tab.is-active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.mindmap-sidebar-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding-right: 4px;
    min-height: 0;
}

.mindmap-sidebar-content::-webkit-scrollbar {
    width: 8px;
}

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

.mindmap-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}

.mindmap-buttons-list {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.mindmap-button-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.mindmap-timeout-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.mindmap-timeout-row .form-input {
    max-width: 120px;
}

.mindmap-sidebar h4 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
}

.mindmap-hint {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fff8e1;
    border: 1px solid #ffe0b2;
    color: #8d6e63;
    border-radius: 10px;
    font-size: 0.85rem;
}

@media (max-width: 980px) {
    .mindmap-layout {
        grid-template-columns: 1fr;
    }

    .mindmap-sidebar {
        order: 2;
    }
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

table tr:hover {
    background: var(--bg-secondary);
}

/* Status Badges - Minimalista */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #4b5563;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    background: #6b7280;
}

.badge-success {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: #4b5563;
}

.badge-success::before {
    background: #6b7280;
}

.badge-danger {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: #4b5563;
}

.badge-danger::before {
    background: #6b7280;
}

.badge-warning {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: #4b5563;
}

.badge-warning::before {
    background: #6b7280;
}

.badge-info {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: #4b5563;
}

.badge-info::before {
    background: #6b7280;
}

/* Keyword Badge - Para palavras-chave de departamentos */
.keyword-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #4b5563;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    margin: 2px;
    transition: all 0.2s ease;
}

.keyword-badge:hover {
    background: var(--bg-tertiary);
    border-color: #374151;
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--white);
    border-right-color: var(--white);
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.loading-state::before {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #F3F4F6;
    border-radius: 50%;
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 1100px) {
    .header-nav .nav-tab {
        display: none;
    }

    .header-nav {
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .login-box {
        padding: 30px 20px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .nav-tabs {
        flex-direction: column;
    }

    .header-left h1 {
        justify-content: center;
    }

    .header-nav {
        width: 100%;
        justify-content: center;
    }

    .profile-menu-dropdown {
        right: 16px;
        top: 78px;
    }

    .department-preview {
        flex-direction: column;
        align-items: flex-start;
    }

    .department-preview-color {
        align-self: flex-start;
    }

    .department-toggle-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Code block */
.code-block {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow-x: auto;
    margin: 10px 0;
}

[data-theme="dark"] .code-block {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Config Section */
.config-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.config-section:last-child {
    border-bottom: none;
}

.config-section h4 {
    color: var(--primary);
    margin-bottom: 15px;
}

/* Help Text */
.help-text {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 5px;
}

/* Copy Button */
.copy-btn {
    background: var(--secondary);
    color: var(--white);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-left: 10px;
}

.copy-btn:hover {
    background: #2a9dd9;
}

/* Chat Interface */
/* ── Chat Container ── teusck.com aesthetic ──────────────────── */
.chat-container {
    display: flex;
    gap: 0;
    flex: 1;
    background: transparent;
    overflow: hidden;
    min-height: 0;
    position: relative;
    padding: 8px 12px 12px;
}

.conversations-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 20, 50, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    min-height: 0;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.2s ease;
    width: var(--chat-list-width, 380px);
    flex-shrink: 0;
    min-width: 240px;
    max-width: 600px;
}

.conversations-panel:hover {
    border-color: rgba(59, 130, 246, 0.28);
}

/* Resize handle between panels */
.resize-handle {
    width: 8px;
    flex-shrink: 0;
    cursor: col-resize;
    position: relative;
    z-index: 10;
    background: transparent;
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 48px;
    border-radius: 2px;
    background: rgba(59, 130, 246, 0);
    transition: background 0.2s ease;
}

.resize-handle:hover::after,
.resize-handle.dragging::after {
    background: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.resize-handle.locked {
    cursor: default;
    pointer-events: none;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(10, 14, 39, 0.55);
    color: #E8E8E8;
    border-bottom: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 10px 10px 0 0;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.panel-header::after {
    display: none;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

.status-filter {
    padding: 6px 12px;
    border: 2px solid var(--white);
    background: transparent;
    color: var(--white);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.status-filter:hover {
    background: var(--bg-primary);
    color: var(--primary);
}

.status-filter option {
    color: var(--text-primary);
    background: var(--bg-primary);
}

.btn-icon {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: rgba(255, 255, 255, 0.8);
    width: 34px;
    height: 34px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-icon::before {
    display: none;
}

.btn-icon:hover::before {
    display: none;
}

.btn-icon:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.4);
    color: #fff;
    transform: none;
}

.conversations-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.25) transparent;
}

.conversations-list::-webkit-scrollbar { width: 4px; }
.conversations-list::-webkit-scrollbar-track { background: transparent; }
.conversations-list::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.25); border-radius: 2px; }
.conversations-list::-webkit-scrollbar-thumb:hover { background: rgba(59, 130, 246, 0.45); }

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 10;
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-bottom-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.scroll-to-bottom-btn:active {
    transform: translateY(0);
}

.scroll-to-bottom-btn i {
    font-size: 20px;
}

[data-theme="dark"] .scroll-to-bottom-btn {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .scroll-to-bottom-btn:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

/* Conversation item — container-principal style com conic gradient no hover */
.conversation-item {
    padding: 10px 12px;
    margin: 3px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    border: 1px solid rgba(59, 130, 246, 0.08);
    background: rgba(30, 41, 82, 0.35);
    position: relative;
}

.conversation-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
}

.conversation-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.35);
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.conversation-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
}

.conversation-meta-row .department-badge {
    flex: 1;
    margin-top: 0 !important;
}

.conversation-meta-row .btn-start-attendance {
    margin: 0 0 0 auto;
    flex-shrink: 0;
}

.conversation-phone {
    font-weight: 600;
    color: #E8E8E8;
    font-size: 0.875rem;
    letter-spacing: -0.2px;
}

.conversation-time {
    font-size: 0.68rem;
    color: rgba(232, 232, 232, 0.4);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 7px;
    border-radius: 6px;
}

.conversation-preview {
    font-size: 0.78rem;
    color: rgba(232, 232, 232, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}
.conversation-preview:empty { display: none; }

.conversation-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.6rem;
    margin-top: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.conversation-status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

.conversation-status.active {
    background: rgba(37, 211, 102, 0.12);
    color: #4ade80;
    border: 1px solid rgba(37, 211, 102, 0.25);
}

.conversation-status.active::before {
    background: #25d366;
    animation: pulse 2s ease-in-out infinite;
}

.conversation-status.resolved {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.conversation-status.resolved::before {
    background: #3b82f6;
}

/* Chat Panel */
/* Chat panel — container-secundario style */
.chat-panel {
    display: flex;
    flex-direction: column;
    background: rgba(15, 20, 50, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    height: 100%;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    flex: 1;
    z-index: 5;
    transition: transform 0.3s ease;
    container-type: inline-size;
    container-name: chat-panel-ctx;
}

.chat-header {
    background: rgba(10, 14, 39, 0.55);
    color: #E8E8E8;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 10px 10px 0 0;
    box-shadow: none;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 10;
    min-height: 52px;
    font-size: clamp(11px, 2.5cqw, 16px);
}

.chat-header::before { display: none; }
.chat-header::after { display: none; }

.chat-header .empty-state {
    color: rgba(232, 232, 232, 0.45);
    text-align: center;
    width: 100%;
}

.chat-contact-info {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.chat-contact-info h3 {
    margin: 0 0 0.25em 0;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #E8E8E8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-actions {
    display: flex;
    gap: 0;
    align-items: center;
    flex-shrink: 0;
    overflow: visible;
}

.btn-chat-action {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.25em 0.45em;
    color: rgba(255, 255, 255, 0.75);
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 400;
    white-space: nowrap;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* Hide button text labels when chat panel is narrow */
@container chat-panel-ctx (max-width: 500px) {
    .btn-chat-action .btn-label { display: none; }
}

.btn-chat-action::before { display: none; }
.btn-chat-action:hover::before { display: none; }

.btn-chat-action::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0%;
    height: 2px;
    border-radius: 2px;
    transition: width 0.1s ease;
    z-index: 2;
}

.btn-chat-action:hover {
    color: #ffffff !important;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
    background: transparent;
    transform: none;
    box-shadow: none;
}

.btn-chat-action:hover::after {
    background-color: #ffffff;
    box-shadow: 0 0 2px #ffffff, 0 0 4px #ffffff, 0 0 8px #ffffff;
    width: 30px;
}

.btn-chat-action.resolve:hover {
    color: #4ade80 !important;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

.btn-chat-action.resolve:hover::after {
    background-color: #4ade80;
    box-shadow: 0 0 2px #4ade80, 0 0 4px #4ade80, 0 0 8px #4ade80;
}

.btn-chat-action.reopen:hover {
    color: #60a5fa !important;
    text-shadow: 0 0 6px rgba(96, 165, 250, 0.6);
}

.btn-chat-action.reopen:hover::after {
    background-color: #60a5fa;
    box-shadow: 0 0 2px #60a5fa, 0 0 4px #60a5fa, 0 0 8px #60a5fa;
}

.chat-contact-info p {
    margin: 0;
    font-size: 0.82em;
    color: rgba(232, 232, 232, 0.5);
}

/* Messages Wrapper - Container with scroll */
.messages-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background:
        radial-gradient(ellipse at 10% 10%, rgba(37, 211, 102, 0.04) 0%, transparent 45%),
        radial-gradient(ellipse at 90% 90%, rgba(59, 130, 246, 0.05) 0%, transparent 45%),
        #0d1128;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    min-height: 0;
    position: relative;
}

.messages-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
}

.messages-wrapper::-webkit-scrollbar { width: 4px; }
.messages-wrapper::-webkit-scrollbar-track { background: transparent; }
.messages-wrapper::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }
.messages-wrapper::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

.messages-container {
    padding: 16px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.empty-state {
    color: rgba(232, 232, 232, 0.4);
    text-align: center;
    padding: 40px 20px;
}

.message-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 1px;
}

.message.outbound {
    flex-direction: row-reverse;
}

.message-bubble {
    max-width: 72%;
    padding: 8px 12px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
    animation: messageSlideIn 0.25s ease-out;
}

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

.message.inbound .message-bubble {
    background: rgba(30, 41, 82, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 4px 16px 16px 16px;
    color: #E8E8E8;
}

.message.outbound .message-bubble {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 16px 4px 16px 16px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    border: none;
    color: #fff;
}

.message-content {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #E8E8E8;
    font-weight: 400;
}

.message.outbound .message-content { color: #fff; }

.temp-buttons-preview {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.temp-buttons-preview span {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.75rem;
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .temp-buttons-preview span {
    border-color: rgba(15, 23, 42, 0.15);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.8);
}

.mindmap-chat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.mindmap-chat-buttons button {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.message.inbound .mindmap-chat-buttons button {
    border-color: rgba(15, 23, 42, 0.15);
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.04);
}

.mindmap-chat-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.automation-message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--fg-0);
    font-size: 13px;
    line-height: 1.5;
}

.automation-message-header {
    font-weight: 700;
}

.automation-message-body {
    white-space: normal;
    word-break: break-word;
}

.automation-message-footer {
    color: var(--fg-2);
    font-size: 12px;
}

.automation-message-bot-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--line-2);
    color: var(--fg-2);
    font-size: 11px;
    font-weight: 500;
}

.automation-message-bot-footer i {
    color: var(--acc);
    font-size: 12px;
}

.automation-message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.automation-message-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid var(--acc-line);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--fg-0);
    font-size: 12px;
    font-weight: 600;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 3px;
    font-size: 0.62rem;
    color: rgba(232, 232, 232, 0.45);
}

.message-status {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
}

.message-status.delivered {
    color: #667781;
}

.message-status.read {
    color: var(--secondary);
}

.message-status.failed {
    color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
}

/* Chat Input - Fixed at bottom */
.chat-input-area {
    background: rgba(10, 14, 39, 0.55);
    padding: 10px 14px;
    border-top: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 0 0 10px 10px;
    flex: 0 0 auto;
    position: relative;
    z-index: 10;
}

.chat-input-area form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.chat-quick-buttons.empty {
    justify-content: flex-start;
}

.chat-quick-buttons-empty {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.quick-reply-button-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px dashed var(--primary);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.quick-reply-button-indicator .indicator-icon {
    font-size: 1.2rem;
}

.quick-reply-button-indicator .indicator-text {
    flex: 1;
}

.quick-reply-button-indicator .indicator-text small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.quick-reply-button-indicator .indicator-remove {
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
}

.quick-reply-button-indicator .indicator-remove:hover {
    text-decoration: underline;
}

[data-theme="dark"] .quick-reply-button-indicator {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
}

.chat-quick-button {
    border: 1px solid var(--gray-light);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-quick-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .chat-quick-button {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .chat-quick-button:hover {
    border-color: var(--primary);
}

.chat-input-area input[type="text"] {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 24px;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    background: rgba(30, 41, 82, 0.5);
    color: #E8E8E8;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-area input[type="text"]::placeholder {
    color: rgba(232, 232, 232, 0.3);
}

.chat-input-area input[type="text"]:hover {
    border-color: rgba(59, 130, 246, 0.35);
}

.chat-input-area input[type="text"]:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    transform: none;
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    flex-shrink: 0;
    font-size: 0.9rem;
}

.btn-send:hover {
    background: #2563eb;
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.5);
}

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

.loading-state {
    text-align: center;
    padding: 20px;
    color: var(--gray);
}

/* Responsive Chat */
@media (max-width: 768px) {
    .chat-container {
        position: relative;
        height: calc(100vh - 55px);
    }

    .conversations-panel {
        position: absolute;
        inset: 0;
        width: 100% !important;
        max-width: 100% !important;
        z-index: 10;
        transform: translateX(0);
    }

    .conversations-panel.mobile-hide {
        transform: translateX(-100%);
        pointer-events: none;
    }

    .chat-panel {
        position: absolute;
        inset: 0;
        transform: translateX(100%);
    }

    .chat-panel.mobile-show {
        transform: translateX(0);
    }

    .conversations-panel.mobile-show { transform: translateX(0); pointer-events: auto; }
    .chat-panel.mobile-hide { transform: translateX(100%); }

    .resize-handle {
        display: none;
    }
}

/* Mobile back button */
.chat-back-btn {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(30, 41, 82, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: rgba(232, 232, 232, 0.7);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.chat-back-btn:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #fff;
}

@media (max-width: 768px) {
    .chat-back-btn { display: flex; }
}

/* Media Upload Styles */
.chat-action-menu-wrapper {
    position: relative;
    flex-shrink: 0;
    z-index: 200;
}

.btn-chat-actions {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(30, 41, 82, 0.5);
    color: rgba(232, 232, 232, 0.6);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-chat-actions:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
    color: #fff;
}

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

.chat-action-menu {
    position: fixed;
    top: -9999px;
    left: -9999px;
    transform: translate(-50%, 8px) scale(0.95);
    transform-origin: bottom center;
    width: 260px;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.15);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    padding: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9999;
}

.chat-action-menu[data-placement="below"] {
    transform: translate(-50%, 8px) scale(0.95);
    transform-origin: top center;
}

.chat-action-menu.open[data-placement="above"],
.chat-action-menu.open[data-placement="below"] {
    transform: translate(-50%, 0) scale(1);
}

.chat-action-menu.open {
    opacity: 1;
    pointer-events: auto;
    top: auto;
    left: auto;
}

.chat-action-menu::before,
.chat-action-menu::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
}

.chat-action-menu[data-placement="above"]::before {
    bottom: -8px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(59, 130, 246, 0.15);
}

.chat-action-menu[data-placement="above"]::after {
    bottom: -7px;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid rgba(10, 14, 39, 0.95);
}

.chat-action-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
    color: #E8E8E8;
}

.chat-action-option + .chat-action-option {
    margin-top: 4px;
}

.chat-action-option:hover {
    background: rgba(59, 130, 246, 0.12);
}

.chat-action-option-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #3b82f6;
    flex-shrink: 0;
}

.chat-action-option-icon.note {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.chat-action-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-action-option-text strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #E8E8E8;
    margin-bottom: 2px;
}

.chat-action-option-text span {
    font-size: 0.78rem;
    color: rgba(232, 232, 232, 0.5);
}

.field-counter {
    display: flex;
    justify-content: flex-end;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.file-preview {
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    flex: 1;
    border: 1px solid var(--border-color);
}

.file-preview-content span {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.btn-close-preview {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close-preview:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* Media message styles */
.message-media {
    margin-top: 8px;
    margin-bottom: 8px;
    max-width: 300px;
}

.message-media img,
.message-media video {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

.message-media audio {
    width: 100%;
    margin-top: 5px;
}

.message-media-placeholder {
    padding: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.message-document {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 5px;
}

.message-document:hover {
    background: rgba(0, 0, 0, 0.1);
}

.message-document-icon {
    font-size: 2rem;
}

.message-document-info {
    flex: 1;
}

.message-document-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.message-document-size {
    font-size: 0.75rem;
    opacity: 0.7;
}

.message.alert-message {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #FFF3CD 0%, #FFF9E6 100%);
    border-left: 4px solid #FFC107;
    border-radius: 12px;
    margin: 16px 0;
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.2);
    overflow: hidden;
}


.message.alert-message .alert-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    padding: 12px 16px;
    background: rgba(255, 193, 7, 0.15);
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
    font-size: 0.85rem;
    color: #7C4D00;
}

.message.alert-message .alert-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.message.alert-message .alert-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.message.alert-message .alert-header i {
    color: #FF9800;
    font-size: 18px;
}

.message.alert-message .alert-badge {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #E65100;
}

.message.alert-message .alert-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #FF9800;
    color: white;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.message.alert-message .alert-trigger-badge {
    margin-left: 8px;
    background: rgba(255, 152, 0, 0.12);
    color: #E65100;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.message.alert-message .alert-content {
    padding: 16px;
    color: #7C4D00;
    font-size: 0.95rem;
    line-height: 1.5;
    word-break: break-word;
}


.message.alert-message .alert-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 193, 7, 0.2);
    background: rgba(255, 193, 7, 0.1);
    font-size: 0.75rem;
    color: #7C4D00;
}

.message.alert-message .alert-footer-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.message.alert-message .alert-footer .message-time {
    font-size: 0.7rem;
    opacity: 0.8;
}

.message.alert-message .alert-footer i {
    color: #FF9800;
}

[data-theme="dark"] .message.alert-message {
    background: linear-gradient(135deg, #3E2723 0%, #4E342E 100%);
    border-left-color: #FFB300;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .message.alert-message .alert-header {
    background: rgba(255, 183, 77, 0.15);
    color: #FFE0B2;
    border-bottom-color: rgba(255, 183, 77, 0.2);
}

[data-theme="dark"] .message.alert-message .alert-badge {
    color: #FFE0B2;
}

[data-theme="dark"] .message.alert-message .alert-trigger {
    background: #FB8C00;
}

[data-theme="dark"] .message.alert-message .alert-trigger-badge {
    background: rgba(255, 213, 79, 0.12);
    color: #FFE082;
}

[data-theme="dark"] .message.alert-message .alert-content,
[data-theme="dark"] .message.alert-message .alert-footer {
    color: #FFE0B2;
}

.message.alert-message.note-message {
    background: linear-gradient(135deg, #E3F2FD 0%, #F1F8FF 100%);
    border-left-color: #2196F3;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.2);
}

.message.alert-message.note-message.note-message-highlight {
    animation: noteMessagePulse 2.6s ease;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.35);
}

.message.alert-message.note-message .alert-header {
    background: rgba(33, 150, 243, 0.12);
    border-bottom-color: rgba(33, 150, 243, 0.2);
    color: #0D47A1;
}

.message.alert-message.note-message .alert-badge {
    color: #1565C0;
}

.message.alert-message .note-author {
    background: rgba(33, 150, 243, 0.12);
    color: #0D47A1;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.message.alert-message.note-message .alert-footer {
    background: rgba(33, 150, 243, 0.08);
    border-top-color: rgba(33, 150, 243, 0.2);
    color: #0D47A1;
}

.message.alert-message.note-message .alert-footer i {
    color: #1E88E5;
}

[data-theme="dark"] .message.alert-message.note-message {
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.4) 0%, rgba(13, 71, 161, 0.8) 100%);
    border-left-color: #90CAF9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .message.alert-message.note-message .alert-header {
    background: rgba(21, 101, 192, 0.35);
    color: #E3F2FD;
    border-bottom-color: rgba(21, 101, 192, 0.4);
}

[data-theme="dark"] .message.alert-message.note-message .alert-badge,
[data-theme="dark"] .message.alert-message .note-author,
[data-theme="dark"] .message.alert-message.note-message .alert-footer {
    color: #E3F2FD;
}

[data-theme="dark"] .message.alert-message.note-message .alert-footer i {
    color: #90CAF9;
}

@keyframes noteMessagePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.35);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 0 0 8px rgba(33, 150, 243, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
    }
}

/* Loading spinner for uploads */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #e7f3ff;
    border-radius: 8px;
    margin-top: 5px;
}

.upload-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Media preview modal */
.media-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.media-modal.active {
    display: flex;
}

.media-modal-content {
    max-width: 90%;
    max-height: 90%;
}

.media-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.media-modal-close:hover {
    color: #bbb;
}

/* =============================================================================
   Contacts Page Styles
   ============================================================================= */

/* Contacts Header */
/* ── Modern page section header (replaces contacts-header) ── */
.page-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.page-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.page-section-title i {
    color: var(--primary);
    font-size: 1.1rem;
}

.page-section-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 5px 0 0 0;
}

/* ── Metric chips row (replaces stats-grid in sections) ── */
.metrics-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.metric-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    flex: 1;
    min-width: 140px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.metric-chip:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.metric-chip-icon {
    font-size: 1.1rem;
    color: var(--primary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    flex-shrink: 0;
}

.metric-chip-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.metric-chip-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-chip-lbl {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 3px;
    white-space: nowrap;
}

/* Legacy contacts-header kept for backward compat */
.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.contacts-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
}

/* Contacts Filters */
.contacts-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-actions select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    min-width: 180px;
    cursor: pointer;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s;
}

.filter-actions select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Contacts Table */
.contacts-table-container {
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

#contactsTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

#contactsTable thead {
    background: var(--primary);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}

#contactsTable th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

#contactsTable td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

#contactsTable tbody tr {
    transition: all 0.2s ease;
}

#contactsTable tbody tr:hover {
    background: var(--bg-secondary);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
    .contacts-table-container {
        border-radius: 8px;
    }

    #contactsTable th,
    #contactsTable td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }
}

/* Avatar */
.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--white);
    font-size: 1rem;
    text-transform: uppercase;
}

/* Contact Tags */
.contact-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: var(--white);
    border: none;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    transition: all 0.2s ease;
}

.tag-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

/* Blocked Badge */
.blocked-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: var(--white);
    border: none;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.blocked-badge i {
    font-size: 0.8rem;
}

[data-theme="dark"] .tag-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

[data-theme="dark"] .blocked-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-icon-action {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-icon-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-icon-action:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-icon-action i {
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .action-buttons {
        gap: 4px;
    }

    .btn-icon-action {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination button {
    width: auto;
    padding: 10px 20px;
    margin: 0;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pageInfo, #usersPageInfo {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        gap: 12px;
    }

    .pagination button {
        width: 100%;
        justify-content: center;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.active {
    display: flex;
}

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

.modal-content {
    background-color: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.department-modal-content {
    max-width: 680px;
}

.department-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 24px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--gray-light);
    border-radius: 12px;
}

.department-preview-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--gray-light);
    font-size: 1.6rem;
    color: var(--text-primary);
}

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

.department-preview-info h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.department-preview-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.3;
}

.department-preview-badges {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.department-preview-badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.department-preview-badge.is-default {
    background: rgba(245, 158, 11, 0.18);
    color: var(--warning);
}

.department-preview-badge.is-inactive {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.department-preview-color {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.department-form {
    padding: 20px 24px 24px;
}

.department-form .form-group {
    margin-bottom: 18px;
}

.department-color-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.department-color-input input[type="color"] {
    width: 52px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
    border: 2px solid var(--gray-light);
    background: transparent;
}

.department-color-input input[type="text"] {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.department-toggle-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--gray-light);
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.department-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.department-toggle-text strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.department-toggle-text span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

#internalNoteModal .modal-content.internal-note-modal {
    width: min(96vw, 1100px);
    max-width: 1100px;
}

.internal-note-body {
    display: flex;
    gap: 32px;
    padding: 24px 30px 30px;
}

.internal-note-form {
    flex: 1;
}

.internal-note-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.internal-note-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.internal-note-sidebar {
    width: 320px;
    padding: 20px;
    border-radius: 10px;
    border: 1px dashed var(--border-color, #e5e7eb);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.internal-note-sidebar .sidebar-title {
    margin: 0 0 6px;
    font-weight: 600;
    color: var(--text-primary);
}

.internal-note-sidebar .sidebar-description {
    margin: 0;
}

.internal-note-sidebar .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.internal-note-sidebar .sidebar-header .sidebar-title {
    margin: 0;
    font-size: 0.95rem;
}

.btn-icon-small {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon-small:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.previous-notes-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 0;
}

.previous-notes-list .loading-state {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.previous-notes-list .empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.previous-notes-list .empty-state i {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.note-item {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
}

.note-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.note-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.note-item-user {
    font-weight: 600;
    color: var(--primary-color);
}

.note-item-date {
    color: var(--text-tertiary);
    font-size: 0.7rem;
}

.note-item-content {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.note-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.note-item-actions button {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-item-actions .btn-edit {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.note-item-actions .btn-edit:hover {
    background: var(--primary-color);
    color: white;
}

.note-item-actions .btn-delete {
    background: var(--bg-secondary);
    color: var(--danger-color);
}

.note-item-actions .btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

@media (max-width: 768px) {
    .internal-note-body {
        flex-direction: column;
        padding: 20px;
    }

    .internal-note-sidebar {
        width: 100%;
    }

    .previous-notes-list {
        max-height: 250px;
    }
}

.modal-small {
    max-width: 450px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary);
    color: var(--white);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--white);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer .btn {
    width: auto;
    padding: 10px 24px;
    margin: 0;
}

/* Tags Input */
.tags-input-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    min-height: 50px;
    cursor: text;
}

.tags-input-container:focus-within {
    border-color: var(--primary);
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary);
    color: var(--white);
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag-remove {
    background: transparent;
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    margin: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

#contactTagsInput {
    border: none;
    outline: none;
    padding: 4px;
    font-size: 1rem;
    width: 100%;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Required field indicator */
.required {
    color: var(--danger);
    font-weight: bold;
}

/* Empty State */
.empty-contacts {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-contacts .icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-contacts h3 {
    color: var(--text-primary);
    margin: 0 0 10px 0;
    font-size: 1.3rem;
}

.empty-contacts p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1rem;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-dots::after {
    content: '...';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Responsive */
@media (max-width: 1024px) {
    #contactsTable {
        font-size: 0.9rem;
    }

    #contactsTable th,
    #contactsTable td {
        padding: 12px 8px;
    }
}

@media (max-width: 768px) {
    .contacts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .contacts-header .btn {
        width: 100%;
    }

    .contacts-filters {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-actions {
        width: 100%;
        flex-direction: column;
    }

    .filter-actions select,
    .filter-actions button {
        width: 100%;
    }

    /* Stack table on mobile */
    #contactsTable thead {
        display: none;
    }

    #contactsTable,
    #contactsTable tbody,
    #contactsTable tr,
    #contactsTable td {
        display: block;
        width: 100%;
    }

    #contactsTable tr {
        margin-bottom: 20px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
    }

    #contactsTable td {
        text-align: right;
        padding: 12px;
        position: relative;
        padding-left: 50%;
        border-bottom: 1px solid var(--border-color);
    }

    #contactsTable td:last-child {
        border-bottom: none;
    }

    #contactsTable td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        font-weight: 600;
        text-align: left;
    }

    .pagination {
        flex-direction: column;
        gap: 10px;
    }

    .pagination button {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 20px;
    }
}

/* Message Status Indicators */
.message-status {
    font-size: 0.9rem;
    margin-left: 5px;
    opacity: 0.7;
}

.message-status.sent {
    color: #999;
}

.message-status.delivered {
    color: #666;
    opacity: 0.8;
}

.message-status.read {
    color: #34B7F1 !important;
    opacity: 1;
}

.message-status.failed {
    color: #dc3545;
    opacity: 1;
}

.message-error {
    color: #dc3545;
    font-size: 1.1rem;
    margin-left: 5px;
    cursor: help;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
}

.message.outbound .message-bubble {
    position: relative;
}

.message.outbound .message-meta {
    justify-content: flex-end;
}

.message.inbound .message-meta {
    justify-content: flex-start;
}

/* Status tooltips enhancement */
.message-status[title]:hover,
.message-error[title]:hover {
    opacity: 1;
    cursor: help;
}

/* Quick Replies Menu */
.quick-replies-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 1100;
    backdrop-filter: blur(12px);
    transform-origin: bottom;
}

.quick-replies-menu.active {
    display: block;
    animation: quickRepliesPop 0.2s ease-out;
}

@keyframes quickRepliesPop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.quick-reply-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    transition: background 0.15s, transform 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.quick-reply-item:last-child {
    border-bottom: none;
}

.quick-reply-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

.quick-reply-item.selected {
    background: rgba(76, 175, 80, 0.15);
    border-left: 3px solid #4CAF50;
    padding-left: 13px;
}

.quick-reply-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
}

.quick-reply-content {
    flex: 1;
}

.quick-reply-pin-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.quick-reply-pin-toggle input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

.quick-reply-pin-toggle label {
    cursor: pointer;
    user-select: none;
}

.quick-reply-command {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.quick-reply-description {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.quick-reply-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 1px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.quick-reply-text {
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-top: 4px;
    padding: 6px 8px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 5px;
    border-left: 3px solid var(--primary);
    font-style: italic;
}

.quick-replies-header {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 1;
    flex-wrap: wrap;
}

.quick-replies-empty {
    padding: 20px;
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
}

[data-theme="dark"] .quick-replies-menu {
    background: rgba(20, 26, 36, 0.92);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .quick-reply-item {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .quick-reply-item:hover {
    background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .quick-reply-item.selected {
    background: rgba(76, 175, 80, 0.22);
    border-left-color: rgba(76, 175, 80, 0.8);
}

[data-theme="dark"] .quick-reply-icon {
    background: rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .quick-reply-command {
    color: #cfd9ff;
}

[data-theme="dark"] .quick-reply-description {
    color: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] .quick-reply-text {
    background: rgba(255, 255, 255, 0.05);
    color: #f5f5f5;
}

/* Scrollbar for quick replies menu */
.quick-replies-menu::-webkit-scrollbar {
    width: 6px;
}

.quick-replies-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.quick-replies-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.quick-replies-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Quick Replies Management Modal */
.modal-large {
    max-width: 780px;
    width: 85%;
}

.modal-medium {
    max-width: 640px;
    width: 90%;
}

.quick-reply-form-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.quick-reply-form-section h4 {
    margin-bottom: 15px;
    color: var(--primary-dark);
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
}

.quick-replies-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.qr-list-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    transition: all 0.2s;
}

.qr-list-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.qr-list-icon {
    font-size: 1.35rem;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 8px;
}

.qr-list-content {
    flex: 1;
}

.qr-list-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.qr-pinned-info {
    border: 1px dashed rgba(15, 23, 42, 0.15);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: rgba(248, 250, 252, 0.9);
}

[data-theme="dark"] .qr-pinned-info {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.7);
}

.qr-list-command {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.9rem;
    background: #e8f5e9;
    padding: 2px 10px;
    border-radius: 18px;
}

.qr-list-description {
    color: var(--gray);
    font-size: 0.85rem;
}

.qr-list-text {
    margin-top: 8px;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    color: #444;
    font-size: 0.9rem;
    line-height: 1.5;
}

.qr-list-button-info {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px dashed rgba(15, 23, 42, 0.15);
    background: rgba(248, 250, 252, 0.9);
}

.qr-list-button-info.inactive {
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(253, 230, 138, 0.2);
}

.qr-list-button-info.missing {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(254, 226, 226, 0.25);
}

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

.qr-list-button-status {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--danger);
}

.qr-list-tag.button {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.25);
    color: var(--primary);
}

.qr-list-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.qr-buttons-config {
    background: #f9f9f9;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    padding: 14px;
    margin-top: 16px;
}

.qr-buttons-config .help-text {
    margin-top: 6px;
    margin-bottom: 0;
}

.qr-buttons-section {
    margin-top: 12px;
    border-top: 1px dashed rgba(15, 23, 42, 0.1);
    padding-top: 12px;
}

.qr-buttons-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qr-button-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.qr-button-input {
    flex: 1;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.qr-button-remove {
    border: none;
    background: rgba(248, 113, 113, 0.15);
    color: #dc2626;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.qr-button-remove:hover {
    background: rgba(248, 113, 113, 0.25);
}

.qr-buttons-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    justify-content: space-between;
}

.qr-buttons-count {
    font-weight: 600;
    color: var(--text-secondary);
}

.qr-list-tag {
    font-size: 0.72rem;
    padding: 2px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    border: 1px solid transparent;
}

.qr-list-tag.pinned {
    background: #ecfeff;
    border-color: #bae6fd;
    color: #0369a1;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: translateY(-2px);
}

.btn-icon.edit:hover {
    background: #e3f2fd;
    border-color: var(--secondary);
    color: var(--secondary);
}

.btn-icon.delete:hover {
    background: #ffebee;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-icon.pin {
    border-color: rgba(99, 102, 241, 0.2);
}

.btn-icon.pin.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.qr-list-empty {
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

.qr-list-empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.modal-interactive-buttons-section {
    margin-top: 25px;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 14px;
    padding: 18px;
    background: var(--card-bg, #fff);
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
}

.modal-interactive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.modal-interactive-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-interactive-buttons-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-interactive-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-interactive-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.modal-interactive-card-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-interactive-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-interactive-card .badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.modal-interactive-card-empty {
    text-align: center;
    padding: 30px 20px;
    border: 1px dashed rgba(15, 23, 42, 0.2);
    border-radius: 12px;
    color: var(--text-tertiary);
}

.modal-interactive-card .btn {
    font-size: 0.8rem;
    padding: 8px 14px;
}

[data-theme="dark"] .modal-interactive-buttons-section {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

[data-theme="dark"] .modal-interactive-card {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .modal-interactive-card-empty {
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
}

/* Interactive button modal enhancements */
.ib-modal-intro {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.ib-stepper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.ib-step {
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
    background: rgba(255, 255, 255, 0.9);
}

.ib-step.active {
    border-color: #4f46e5;
    color: #111827;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(14, 165, 233, 0.08) 100%);
}

.ib-step-circle {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
}

.ib-step.active .ib-step-circle {
    background: #4f46e5;
    color: #fff;
}

.ib-tip-card {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.85rem;
    line-height: 1.3;
}

.ib-tip-card i {
    font-size: 1rem;
    color: #2563eb;
}

.ib-section-card {
    background: var(--bg-card, #fff);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.ib-section-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.ib-section-card-header h4 {
    margin: 0;
    font-size: 1rem;
}

.ib-section-card-header p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ib-chip {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(79, 70, 229, 0.12);
    color: #4338ca;
    white-space: nowrap;
}

.ib-live-preview-card {
    margin-top: 16px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    padding: 16px;
}

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

.ib-live-preview-kicker {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: #6366f1;
    margin: 0;
}

.ib-live-preview-header h5 {
    margin: 2px 0 0 0;
}

.ib-live-preview-body {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 14px;
    border: 1px dashed rgba(99, 102, 241, 0.3);
}

.ib-live-preview-pill {
    display: inline-flex;
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.ib-live-preview-body p {
    margin: 6px 0 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ib-live-preview-footer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.ib-live-preview-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ib-live-preview-buttons button {
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: var(--bg-primary);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4338ca;
    cursor: default;
}

.ib-preview-list {
    list-style: none;
    padding: 8px 0 0;
    margin: 0;
}

.ib-preview-list li {
    padding: 6px 0;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
    font-size: 0.85rem;
    color: #1f2937;
}

.ib-preview-list li:last-child {
    border-bottom: none;
}

.ib-preview-list span {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
}

.ib-section-card--automation {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.form-section.ib-section-card {
    border-top: none;
    padding-top: 0;
}

[data-theme="dark"] .ib-step {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .ib-step.active {
    background: rgba(79, 70, 229, 0.35);
    color: #fff;
}

[data-theme="dark"] .ib-step-circle {
    background: rgba(255, 255, 255, 0.12);
    color: #e5e7eb;
}

[data-theme="dark"] .ib-step.active .ib-step-circle {
    background: #4f46e5;
}

[data-theme="dark"] .ib-tip-card {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .ib-section-card {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

[data-theme="dark"] .ib-section-card-header p,
[data-theme="dark"] .ib-live-preview-body p,
[data-theme="dark"] .ib-preview-list li {
    color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .ib-live-preview-card {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.25) 0%, rgba(13, 148, 136, 0.15) 100%);
}

[data-theme="dark"] .ib-live-preview-body {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] .ib-live-preview-buttons button {
    background: rgba(255, 255, 255, 0.08);
    color: #c7d2fe;
}

[data-theme="dark"] .ib-preview-list span {
    color: rgba(255, 255, 255, 0.6);
}

/* Quick Replies Modal Enhancements */
.quick-reply-form-section,
.chat-buttons-section {
    background: linear-gradient(180deg, rgba(249, 249, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(3px);
}

.quick-reply-form-section .form-row,
.chat-button-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.quick-reply-form-section label,
.chat-button-form label {
    font-size: 0.85rem;
}

.quick-reply-form-section input,
.quick-reply-form-section textarea,
.chat-button-form input,
.chat-button-form textarea {
    padding: 8px 10px;
    border-radius: 9px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: rgba(255, 255, 255, 0.92);
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.85rem;
}

.quick-reply-form-section input:focus,
.quick-reply-form-section textarea:focus,
.chat-button-form input:focus,
.chat-button-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.quick-replies-list {
    padding-right: 4px;
}

.qr-list-item,
.chat-button-item {
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: var(--bg-primary);
    backdrop-filter: blur(3px);
}

.qr-list-item:hover,
.chat-button-item:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.15);
}

.qr-list-command {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-dark);
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 14px;
}

.qr-list-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.qr-list-text,
.chat-button-preview {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary);
    border-radius: 5px;
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 0.8rem;
}

[data-theme="dark"] .modal-content {
    background: rgba(13, 17, 23, 0.96);
    color: var(--white);
}

[data-theme="dark"] .quick-reply-form-section,
[data-theme="dark"] .chat-buttons-section {
    background: rgba(22, 28, 36, 0.9);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .quick-reply-form-section input,
[data-theme="dark"] .quick-reply-form-section textarea,
[data-theme="dark"] .chat-button-form input,
[data-theme="dark"] .chat-button-form textarea {
    background: rgba(9, 13, 20, 0.95);
    border-color: rgba(99, 102, 241, 0.45);
    color: var(--white);
}

[data-theme="dark"] .qr-list-item,
[data-theme="dark"] .chat-button-item {
    background: rgba(15, 20, 28, 0.92);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .qr-list-command {
    background: rgba(99, 102, 241, 0.2);
    color: #E0E7FF;
}

[data-theme="dark"] .qr-list-description {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .qr-list-text,
[data-theme="dark"] .chat-button-preview {
    background: rgba(99, 102, 241, 0.18);
    color: var(--white);
}

[data-theme="dark"] .qr-list-button-info {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .qr-list-button-status {
    color: #fca5a5;
}

[data-theme="dark"] .qr-list-tag.button {
    background: rgba(99, 102, 241, 0.35);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
}

[data-theme="dark"] .qr-buttons-config {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .qr-button-input {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

[data-theme="dark"] .chat-buttons-list-empty {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.7);
}

/* Interactive Buttons Page */
.page-interactive-buttons {
    background: linear-gradient(135deg, #f4f7ff 0%, #eef2ff 50%, #fff 100%);
    min-height: 100vh;
    padding: 32px clamp(16px, 4vw, 48px);
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.ib-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.ib-header h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.btn-link-light {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    font-weight: 600;
}

.ib-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
    gap: 28px;
}

.ib-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.page-interactive-buttons .form-row.two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.ib-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ib-panel-header h2 {
    margin: 0;
}

.ib-search {
    display: flex;
    align-items: center;
    border: 1px solid rgba(15, 23, 42, 0.1);
    padding: 8px 12px;
    border-radius: 999px;
    gap: 6px;
    background: rgba(255, 255, 255, 0.7);
}

.ib-search input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    min-width: 220px;
}

.ib-card-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ib-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
}

.ib-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
}

.ib-card-main {
    display: flex;
    gap: 14px;
    align-items: center;
}

.ib-card-pill {
    width: 12px;
    height: 72px;
    border-radius: 999px;
    background: var(--primary);
}

.ib-card-title {
    margin: 0;
    font-size: 1rem;
}

.ib-card-description {
    margin: 4px 0 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ib-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ib-card-meta .badge,
.ib-card-meta .badge-secondary {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.ib-card-meta .badge-secondary {
    background: rgba(76, 175, 80, 0.12);
    color: #2e7d32;
}

.ib-card-actions {
    display: flex;
    gap: 8px;
}

.ib-card-actions .btn-icon {
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 8px 10px;
}

.ib-card-actions .btn-icon.danger {
    color: var(--danger);
    border-color: rgba(244, 67, 54, 0.4);
}

.ib-empty {
    text-align: center;
    padding: 40px;
    border: 1px dashed rgba(15, 23, 42, 0.2);
    border-radius: 16px;
    color: var(--text-secondary);
}

.ib-empty div {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.ib-phone {
    background: #111827;
    border-radius: 34px;
    padding: 18px 12px;
    position: relative;
    width: min(320px, 100%);
    margin: 0 auto;
    box-shadow: 0 30px 50px rgba(15, 23, 42, 0.35);
}

.ib-phone-notch {
    width: 140px;
    height: 18px;
    background: #0b1220;
    border-radius: 0 0 16px 16px;
    margin: 0 auto 10px;
}

.ib-phone-content {
    background: #e5ddd5;
    border-radius: 24px;
    padding: 18px;
    min-height: 420px;
}

.ib-chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    margin-bottom: 12px;
    position: relative;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.ib-chat-bubble span {
    display: block;
    text-align: right;
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 4px;
}

.ib-chat-bubble.inbound {
    background: var(--bg-primary);
    border-bottom-left-radius: 0;
}

.ib-chat-bubble.outbound {
    background: #dcf8c6;
    border-bottom-right-radius: 0;
    margin-left: auto;
}

.ib-chat-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.ib-preview-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.85rem;
    text-align: left;
}

.ib-preview-btn span {
    font-size: 1rem;
}

.ib-preview-btn strong {
    display: block;
}

.ib-preview-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.ib-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #111827;
    color: white;
    padding: 12px 18px;
    border-radius: 999px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.ib-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1100px) {
    .ib-wrapper {
        grid-template-columns: 1fr;
    }

    .ib-phone {
        width: 100%;
        max-width: none;
    }

    .ib-panel {
        padding: 18px;
    }
}

/* Quick Replies Config Button in Header */
.quick-replies-config-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    font-weight: 600;
    white-space: nowrap;
}

.quick-replies-config-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-large {
        width: 95%;
        max-width: none;
    }

    .qr-list-item {
        flex-direction: column;
    }

    .qr-list-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Hamburger Menu Button in Header */
.menu-toggle-btn-header {
    padding: 8px 14px;
    background: transparent;
    border: 2px solid #ffffff;
    border-radius: 0;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    width: auto;
    height: auto;
}

.menu-toggle-btn-header i {
    transition: none;
}

.menu-toggle-btn-header::before {
    display: none;
}

.menu-toggle-btn-header:hover::before {
    display: none;
}

.menu-toggle-btn-header:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.menu-toggle-btn-header:hover i {
    transform: none;
    color: var(--text-primary);
}

/* Side Navigation Menu */
.side-nav {
    position: fixed;
    top: 0;
    left: -300px;
    width: 260px;
    height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--gray-light);
    box-shadow: none;
    z-index: 90;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding-top: 80px;
}

[data-theme="dark"] .side-nav {
    background: #0d1128;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

[data-theme="dark"] .side-nav-header {
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.side-nav.active {
    left: 0;
}

.side-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: none;
    z-index: 89;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.side-nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.side-nav-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--gray-light);
    margin-bottom: 6px;
}

.side-nav-header h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-nav-items {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}


/* =============================================================================
   Notifications Badge
   ============================================================================= */

.unread-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.6);
    }
}

[data-theme="dark"] .unread-badge {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

/* Awaiting Reply Badge - posicionado no canto inferior direito com animação laranja-vermelho */
.awaiting-reply-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
    animation: awaitingPulse 2s ease-in-out infinite;
}

@keyframes awaitingPulse {
    0%, 100% {
        transform: scale(1);
        background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); /* Laranja */
        box-shadow: 0 2px 6px rgba(249, 115, 22, 0.4);
    }
    50% {
        transform: scale(1.1);
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); /* Vermelho */
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.6);
    }
}

[data-theme="dark"] .awaiting-reply-badge {
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    box-shadow: 0 2px 6px rgba(251, 146, 60, 0.4);
}

@keyframes awaitingPulseDark {
    0%, 100% {
        transform: scale(1);
        background: linear-gradient(135deg, #fb923c 0%, #f97316 100%); /* Laranja claro */
        box-shadow: 0 2px 6px rgba(251, 146, 60, 0.4);
    }
    50% {
        transform: scale(1.1);
        background: linear-gradient(135deg, #f87171 0%, #ef4444 100%); /* Vermelho claro */
        box-shadow: 0 4px 14px rgba(248, 113, 113, 0.6);
    }
}

[data-theme="dark"] .awaiting-reply-badge {
    animation: awaitingPulseDark 2s ease-in-out infinite;
}

/* Conversation Unread Badge */
.conversation-unread-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: inline-block;
}

[data-theme="dark"] .conversation-unread-badge {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

/* Awaiting Reply Indicator - na lista de conversas */
.awaiting-reply-indicator {
    display: inline-block;
    margin-right: 6px;
    font-size: 1rem;
    animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Conversa aguardando resposta - animação laranja-vermelho */
.conversation-item.awaiting-reply {
    border-left: 4px solid #f97316;
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.08) 0%, transparent 100%);
    animation: border-pulse-alert 2s ease-in-out infinite;
}

@keyframes border-pulse-alert {
    0%, 100% {
        border-left-color: #f97316; /* Laranja */
        box-shadow: -3px 0 8px rgba(249, 115, 22, 0.3);
    }
    50% {
        border-left-color: #ef4444; /* Vermelho */
        box-shadow: -3px 0 12px rgba(239, 68, 68, 0.5);
    }
}

[data-theme="dark"] .conversation-item.awaiting-reply {
    border-left: 4px solid #fb923c;
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.1) 0%, transparent 100%);
    animation: border-pulse-alert-dark 2s ease-in-out infinite;
}

@keyframes border-pulse-alert-dark {
    0%, 100% {
        border-left-color: #fb923c; /* Laranja claro */
        box-shadow: -3px 0 10px rgba(251, 146, 60, 0.4);
    }
    50% {
        border-left-color: #f87171; /* Vermelho claro */
        box-shadow: -3px 0 14px rgba(248, 113, 113, 0.6);
    }
}

/* Hover state para conversa aguardando resposta */
.conversation-item.awaiting-reply:hover {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.12) 0%, transparent 100%);
}

[data-theme="dark"] .conversation-item.awaiting-reply:hover {
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.15) 0%, transparent 100%);
}

/* ========================================
   Conversation item options (···) button
   ======================================== */
.conv-time-options {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.conv-options-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.conversation-item:hover .conv-options-btn {
    opacity: 1;
}

.conv-options-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.conv-options-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: rgba(15, 20, 50, 0.97);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    z-index: 200;
    min-width: 200px;
    padding: 4px 0;
    display: none;
}

.conv-options-dropdown.open {
    display: block;
}

.conv-options-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: 13px;
    color: #ccc;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.conv-options-dropdown-item:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
}

/* Unanswered state — green static glow, no animation */
.conversation-item.unanswered {
    box-shadow: 0 0 0 1px rgba(37, 211, 102, 0.4),
                0 0 14px rgba(37, 211, 102, 0.18);
    border-color: rgba(37, 211, 102, 0.4) !important;
}

.conversation-item.unanswered .conv-options-btn {
    opacity: 1;
}


/* ========================================
   Modern SVG Icons Styles
   ======================================== */

/* Ícones SVG nos botões */
.btn-attach svg,
.btn-icon svg,
.btn-send svg {
    display: block;
    transition: transform 0.2s ease;
}

.btn-attach:hover svg,
.btn-icon:hover svg {
    transform: scale(1.1) rotate(5deg);
}

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

/* Ícone de anexo com animação */
.btn-attach:hover svg {
    transform: rotate(-15deg) scale(1.1);
}

/* Headers com ícones SVG */
.panel-header h3 svg,
.chat-header h3 svg {
    vertical-align: middle;
}


/* ========================================
   Status Filter Buttons
   ======================================== */

.status-filter-buttons {
    display: flex;
    gap: 4px;
    flex: 1;
}

.conversations-panel .btn-icon {
    width: 34px;
    height: 34px;
}

.panel-header .btn-icon {
    background: rgba(30, 41, 82, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: rgba(232, 232, 232, 0.7);
    box-shadow: none;
    backdrop-filter: none;
    border-radius: 10px;
}

.panel-header .btn-icon::before { display: none; }

.panel-header .btn-icon:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.4);
    color: #fff;
    transform: none;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: 1px solid rgba(59, 130, 246, 0.12);
    background: rgba(30, 41, 82, 0.35);
    color: rgba(232, 232, 232, 0.55);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex: 1;
    justify-content: center;
}

.filter-btn i { font-size: 0.78rem; }

.filter-btn span:not(.filter-count) { font-size: 0.78rem; }

.filter-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
    color: rgba(232, 232, 232, 0.85);
    transform: none;
}

.filter-btn.active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.35);
    color: #fff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.12);
}

.filter-btn:active { transform: none; }

/* Filter Count Badge */
.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 1px 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 2px;
    transition: all 0.2s ease;
    color: rgba(232, 232, 232, 0.7);
}

.filter-btn.active .filter-count {
    background: #3b82f6;
    color: #fff;
}

.filter-btn:hover .filter-count {
    background: rgba(59, 130, 246, 0.2);
}


/* Panel header sem título - centralizar ações */
.panel-header:empty {
    justify-content: center;
}

.panel-header:not(:has(h3)) {
    justify-content: center;
}

.panel-header:not(:has(h3)) .panel-actions {
    width: 100%;
    justify-content: center;
}


/* Ajuste de posição dos botões - 10px para esquerda */
.panel-header:not(:has(h3)) .panel-actions {
    padding-left: 10px;
}


/* ========================================
   Botão Iniciar Atendimento
   ======================================== */

.btn-start-attendance {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin: 8px 0;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-start-attendance:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-start-attendance:active {
    transform: translateY(0);
}

.btn-start-attendance svg {
    flex-shrink: 0;
}

/* Dark theme */
[data-theme="dark"] .btn-start-attendance {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .btn-start-attendance:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

/* ========================================
   Notificações
   ======================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
}

.notification-info {
    border-left: 4px solid #3b82f6;
}

.notification.fade-out {
    animation: slideOutRight 0.3s ease;
}

.alert-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #FFF3CD 0%, #FFE082 100%);
    border-left: 4px solid #FF9800;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(255, 152, 0, 0.3);
    z-index: 11000;
    min-width: 280px;
    max-width: 360px;
    animation: slideInRight 0.3s ease-out;
    cursor: pointer;
}

.alert-notification-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #E65100;
    font-weight: 600;
    margin-bottom: 6px;
}

.alert-notification-header i {
    font-size: 20px;
}

.alert-notification-body {
    color: #7C4D00;
    font-size: 0.9rem;
    line-height: 1.4;
    padding-right: 24px;
}

.alert-notification button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #7C4D00;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.alert-notification button:hover {
    color: #E65100;
}

.alert-notification.fade-out {
    animation: slideOutRight 0.3s ease forwards;
}

[data-theme="dark"] .alert-notification {
    background: linear-gradient(135deg, #4E342E 0%, #3E2723 100%);
    border-left-color: #FFB300;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .alert-notification-header,
[data-theme="dark"] .alert-notification-body,
[data-theme="dark"] .alert-notification button {
    color: #FFE0B2;
}

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

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

/* ========================================
   Template Management
   ======================================== */

.templates-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.templates-header h2 {
    margin: 0;
}

.templates-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.templates-content {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 24px;
}

.templates-sidebar {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.templates-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.templates-filters input,
.templates-filters select {
    padding: 10px 12px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--white);
}

.templates-list {
    max-height: 520px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-item {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 12px;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.template-item:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.template-item.active {
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.18);
}

.template-item-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.template-item-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.template-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    font-weight: 600;
}

.template-details {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    min-height: 560px;
}

.template-details-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.95rem;
}

.template-details-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.template-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.template-summary h3 {
    margin: 0;
}

.template-section {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.template-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.template-variables-table {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.template-variables-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.template-variables-table th,
.template-variables-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    text-align: left;
}

.template-variables-table th {
    background: rgba(99, 102, 241, 0.08);
    font-weight: 600;
}

.template-variables-table input[type="text"],
.template-variables-table input[type="checkbox"] {
    width: 100%;
}

.template-variables-table input[type="text"] {
    padding: 6px 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 0.85rem;
}

.template-preview-inputs {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.template-preview-inputs label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

.template-preview-inputs input {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.template-preview-output {
    background: rgba(99, 102, 241, 0.05);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.template-preview-output .preview-body {
    font-size: 0.95rem;
    line-height: 1.6;
}

.template-preview-output .preview-header {
    font-size: 0.85rem;
    font-weight: 600;
}

.template-preview-output .preview-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.template-preview-output .preview-button-item {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.75rem;
}

.template-details textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px;
    font-size: 0.9rem;
    resize: vertical;
}

@media (max-width: 1100px) {
    .templates-content {
        grid-template-columns: 1fr;
    }

    .templates-sidebar {
        order: 2;
    }

    .template-details {
        order: 1;
    }
}

/* Dark theme */
[data-theme="dark"] .notification {
    background: #1e293b;
    color: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}


/* ==========================================
   Admin Panel Styles
   ========================================== */

/* Admin Info Badge */
.admin-info-badge {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

/* Role and Status Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.badge-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
}

.badge-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
    color: white;
}

.badge-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, #28a745 0%, #20753a 100%);
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, #dc3545 0%, #a02935 100%);
    color: white;
}

/* Small Buttons */
.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-small i {
    font-size: 1rem;
}

/* Alinhar botões na coluna Ações */
table td:last-child {
    white-space: nowrap;
}

table td .btn-small {
    display: inline-block;
    vertical-align: middle;
}

.btn-small.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: none;
}

.btn-small.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
}

.btn-small.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: white;
    box-shadow: none;
}

.btn-small.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.btn-small.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: none;
}

.btn-small.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

/* Checkbox Items */
.checkbox-item {
    transition: all 0.2s ease;
}

.checkbox-item:hover {
    background: var(--bg-secondary);
    transform: translateX(5px);
}

.checkbox-item label {
    margin: 0;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Users Table Specific Styles */
#usersTable tbody tr:hover {
    background: var(--bg-secondary);
}

#usersTable td {
    vertical-align: middle;
}

/* Modal Improvements for Admin */
.modal-small {
    max-width: 400px;
}

.modal-large {
    max-width: 900px;
}

/* Form Row (for side-by-side inputs) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Help Text Improvements */
.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Stats Grid for Admin Panel */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Enhanced Select Styling */
select {
    padding: 10px 15px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    border-color: var(--primary);
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Dark mode adjustments for admin panel */
.dark-mode .admin-info-badge {
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.5);
}

.dark-mode .badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dark-mode .checkbox-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dark-mode select {
    background: var(--bg-secondary);
    border-color: var(--gray);
}

/* Dark Mode - Corrigir elementos brancos */
[data-theme="dark"] .file-preview-content,
[data-theme="dark"] .notification,
[data-theme="dark"] .qr-list-item,
[data-theme="dark"] .file-preview {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--gray-light) !important;
}

[data-theme="dark"] table th {
    background: #1f1f1f !important;
    color: var(--text-primary) !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] table tr:hover {
    background: #1a1a1a !important;
}

[data-theme="dark"] table th,
[data-theme="dark"] table td {
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .filter-btn.active {
    background: var(--bg-tertiary) !important;
    color: var(--primary) !important;
}

[data-theme="dark"] .admin-info-badge {
    background: var(--bg-tertiary) !important;
    color: var(--warning) !important;
    border-color: var(--warning) !important;
}

/* Dark Mode - Badges permanecem com cores vibrantes */
[data-theme="dark"] .badge-success,
[data-theme="dark"] .badge-danger,
[data-theme="dark"] .badge-warning,
[data-theme="dark"] .badge-info,
[data-theme="dark"] .badge-secondary {
    color: #FFFFFF !important;
}

/* Dark Mode - Melhorar contraste de modais */
[data-theme="dark"] .modal-content {
    background: #1a1a1a !important;
    border: 1px solid #2a2a2a !important;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #2a2a2a !important;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #2a2a2a !important;
}

/* Dark Mode - Code blocks */
[data-theme="dark"] .code-block {
    background: #1a1a1a !important;
    color: var(--text-primary) !important;
    border: 1px solid #2a2a2a !important;
}

/* Dark Mode - Scrollbars */
[data-theme="dark"] .tab-content::-webkit-scrollbar-track {
    background: #1a1a1a !important;
}

[data-theme="dark"] .tab-content::-webkit-scrollbar-thumb {
    background: #3a3a3a !important;
}

[data-theme="dark"] .tab-content::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a !important;
}

/* Dark Mode - Checkbox items */
[data-theme="dark"] .checkbox-item {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
}

[data-theme="dark"] .checkbox-item:hover {
    background: #1f1f1f !important;
}

/* Dark Mode - Barra de pesquisa em cinza escuro */
[data-theme="dark"] .search-box input {
    background: #1a1a1a !important;
    border-color: #2a2a2a !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .search-box input::placeholder {
    color: var(--text-secondary) !important;
}

/* Dark Mode - Badge Agente em cinza escuro */
[data-theme="dark"] .badge-secondary {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%) !important;
    color: var(--text-secondary) !important;
    border: 1px solid #3a3a3a !important;
}

/* Dark Mode - Contacts header border */
/* Dark Mode - Reduzir contraste de outros elementos */
[data-theme="dark"] .file-preview-content,
[data-theme="dark"] .file-preview {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .filter-btn.active {
    background: #2a2a2a !important;
    color: var(--primary) !important;
}

[data-theme="dark"] .admin-info-badge {
    background: #1f1f1f !important;
    color: var(--warning) !important;
    border-color: #3a3a3a !important;
}

/* Departments Header */
.departments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.departments-header .header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.departments-header .header-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.departments-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Departments Grid */
.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

.department-card {
    display: flex;
    flex-direction: column;
    min-height: 260px;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
}

.department-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.department-card-actions {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    gap: 8px;
}

.department-card-actions .btn-small {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.department-card-actions .btn-small:hover {
    transform: translateY(-2px);
}

.department-card-actions .btn-small i {
    font-size: 0.95rem;
}

.department-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary) !important;
}

[data-theme="dark"] .department-card {
    background: var(--bg-secondary) !important;
}

[data-theme="dark"] .department-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.keyword-badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 1024px) {
    .departments-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .departments-grid {
        grid-template-columns: 1fr;
    }

    .department-card {
        min-height: auto;
    }

    .department-card-actions {
        flex-wrap: wrap;
    }
}

/* ==================================================================
   Agent Status & Workload Management
   ================================================================== */

/* Agent Status Toggle Button */
.agent-status-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.agent-status-toggle i {
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.agent-status-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.agent-status-toggle:hover::before {
    width: 100px;
    height: 100px;
}

.agent-status-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.agent-status-toggle:hover i {
    transform: scale(1.2);
}

/* Agent Menu Dropdown */
.agent-menu-dropdown {
    position: fixed;
    top: 70px;
    right: 24px;
    width: 350px;
    max-height: 500px;
    background: var(--bg-primary);
    border: 1px solid var(--gray-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.agent-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.agent-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid var(--gray-light);
    background: var(--bg-secondary);
}

.agent-menu-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.menu-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.menu-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

[data-theme="dark"] .menu-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.agent-menu-content {
    overflow-y: auto;
    max-height: 450px;
    padding: 16px;
}

/* Compact Agent Status Widget (for dropdown) */
.agent-status-widget {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    margin-bottom: 0;
}

.agent-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-light);
}

.agent-status-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-status-current {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

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

.status-label {
    color: var(--text-primary);
}

.agent-status-controls {
    margin-bottom: 20px;
}

.agent-status-controls label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.status-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.status-btn {
    padding: 8px 12px;
    border: 1.5px solid var(--status-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.status-btn:hover {
    background: var(--status-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.status-btn.active {
    background: var(--status-color);
    color: white;
    box-shadow: var(--shadow);
}

.agent-workload-info {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.workload-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.workload-item:not(:last-child) {
    border-bottom: 1px solid var(--gray-light);
}

.workload-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.workload-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.agent-settings {
    padding-top: 12px;
    border-top: 1px solid var(--gray-light);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.toggle-label input[type="checkbox"] {
    width: 40px;
    height: 20px;
    appearance: none;
    background: var(--gray-light);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-label input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-primary);
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-label input[type="checkbox"]:checked {
    background: var(--success);
}

.toggle-label input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* Available Agents List */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.agent-card {
    background: var(--bg-primary);
    border: 1px solid var(--gray-light);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s;
}

.agent-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-light);
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-email {
    font-size: 12px;
    color: var(--text-secondary);
}

.agent-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    display: flex;
    align-items: center;
    gap: 4px;
}

.agent-workload {
    margin-bottom: 12px;
}

.workload-bar {
    height: 8px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.workload-fill {
    height: 100%;
    transition: width 0.3s;
    border-radius: 4px;
}

.workload-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

.auto-assign-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--success);
    color: white;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.auto-assign-badge.disabled {
    background: var(--gray);
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: var(--success);
    color: white;
}

.notification-error {
    background: var(--danger);
    color: white;
}

.notification-info {
    background: var(--info);
    color: white;
}

/* Dark Theme Support */
[data-theme="dark"] .agent-menu-dropdown {
    background: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .agent-menu-header {
    background: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .agent-status-widget,
[data-theme="dark"] .agent-card {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .agent-workload-info {
    background: var(--bg-primary);
}

[data-theme="dark"] .status-btn {
    background: var(--bg-primary);
}

[data-theme="dark"] .status-btn:hover {
    background: var(--status-color);
}

[data-theme="dark"] .agent-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .agent-menu-dropdown {
        right: 10px;
        left: 10px;
        width: auto;
    }

    .status-buttons {
        grid-template-columns: 1fr 1fr;
    }

    .agents-grid {
        grid-template-columns: 1fr;
    }

    .agent-status-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ==================================================
   Toggle Switch Styles
   ================================================== */

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--white);
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--success);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--success);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Disabled state */
input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===================================
   ALERTS AND QUICK MESSAGES STYLES
   =================================== */

/* Alert Item Card */
.alert-item,
.quick-message-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.alert-item:hover,
.quick-message-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

[data-theme="dark"] .alert-item:hover,
[data-theme="dark"] .quick-message-item:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(148, 163, 184, 0.15);
    color: var(--gray);
}

/* Alert/Message Content */
.alert-content,
.message-content {
    flex: 1;
    min-width: 0; /* Para text-overflow funcionar */
}

.alert-title,
.message-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-text,
.message-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

.alert-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.alert-trigger-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 152, 0, 0.12);
    color: #b45a00;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}

.alert-trigger-chip i {
    font-size: 0.85rem;
}

.alert-trigger-chip.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

[data-theme="dark"] .alert-trigger-chip {
    background: rgba(255, 152, 0, 0.2);
    color: #ffcf99;
}

[data-theme="dark"] .alert-trigger-chip.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

/* Stats Section */
.alert-stats {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.stat-item i {
    font-size: 0.9rem;
    opacity: 0.7;
}

.stat-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Actions Section */
.alert-actions,
.message-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Icon Indicators */
.alert-icon,
.message-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.alert-icon.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.05) 100%);
    color: var(--success);
}

.alert-icon.inactive {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.2) 0%, rgba(148, 163, 184, 0.05) 100%);
    color: var(--gray);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    margin: 0;
    font-size: 1rem;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h4 i {
    font-size: 1.3rem;
    opacity: 0.8;
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
    gap: 10px;
}

.loading-state i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .alert-item,
    .quick-message-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .alert-actions,
    .message-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .alert-stats {
        flex-direction: column;
        gap: 8px;
    }

    .alert-title,
    .message-title {
        font-size: 1rem;
    }
}

/* =====================================================
 * ALERT TRIGGER TOGGLE (Exclusive Selection) - Minimal
 * =====================================================
 */

.alert-trigger-toggle {
    display: flex;
    gap: 12px;
    position: relative;
    background: transparent;
}

.alert-trigger-toggle input[type="radio"] {
    display: none;
}

.alert-trigger-toggle .trigger-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    border: 1px solid #4b5563;
    position: relative;
}

.alert-trigger-toggle .trigger-icon {
    font-size: 20px;
    line-height: 1;
    color: #6b7280;
    transition: all 0.2s ease;
}

.alert-trigger-toggle .trigger-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.alert-trigger-toggle .trigger-option .trigger-extra {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.alert-trigger-toggle .trigger-option .trigger-extra input {
    width: 70px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

.alert-trigger-toggle .trigger-option .trigger-extra input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.alert-trigger-toggle .trigger-content strong {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.2s ease;
}

.alert-trigger-toggle .trigger-content span {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    transition: color 0.2s ease;
}

/* Estado hover */
.alert-trigger-toggle .trigger-option:hover {
    background: var(--bg-tertiary);
    border-color: #374151;
}

/* Estado selecionado - minimalista com fundo cinza escuro */
.alert-trigger-toggle input[type="radio"]:checked + .trigger-option {
    background: #374151;
    border-color: #374151;
    box-shadow: none;
}

.alert-trigger-toggle input[type="radio"]:checked + .trigger-option .trigger-icon {
    color: white;
}

.alert-trigger-toggle input[type="radio"]:checked + .trigger-option .trigger-content strong {
    color: white;
}

.alert-trigger-toggle input[type="radio"]:checked + .trigger-option .trigger-content span {
    color: rgba(255, 255, 255, 0.8);
}

/* Responsivo */
@media (max-width: 768px) {
    .alert-trigger-toggle {
        flex-direction: column;
        gap: 8px;
    }

    .alert-trigger-toggle .trigger-option {
        width: 100%;
    }
}

/* Dark mode support */
[data-theme="dark"] .alert-trigger-toggle .trigger-option {
    background: var(--bg-secondary);
    border-color: #4b5563;
}

[data-theme="dark"] .alert-trigger-toggle input[type="radio"]:checked + .trigger-option {
    background: #4b5563;
    border-color: #4b5563;
}

[data-theme="dark"] .alert-trigger-toggle .trigger-option .trigger-extra input {
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ============================================
   INTERACTIVE BUTTONS STYLES
   ============================================ */

.ib-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.ib-header-actions {
    display: flex;
    gap: 10px;
}

.ib-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

@media (max-width: 1200px) {
    .ib-content-wrapper {
        grid-template-columns: 1fr;
    }
}

/* List Panel */
.ib-list-panel {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
}

.ib-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ib-panel-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ib-search {
    position: relative;
    width: 100%;
    max-width: 300px;
}

.ib-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.ib-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.ib-cards-grid {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.ib-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}

.ib-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

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

.ib-card-header h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ib-card-description {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.ib-card-body {
    margin-bottom: 12px;
}

.ib-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ib-card-info span {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ib-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Preview Panel */
.ib-preview-panel {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 140px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ib-phone-mockup {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.ib-phone-screen {
    flex: 1;
    background: #ECE5DD;
    border-radius: 12px;
    padding: 16px;
    overflow-y: auto;
    max-height: 500px;
}

.ib-phone-notch {
    width: 120px;
    height: 20px;
    background: var(--text-primary);
    border-radius: 0 0 12px 12px;
    margin: 0 auto 10px;
}

.ib-chat-bubble {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.ib-chat-bubble.ib-inbound {
    background: #FFFFFF;
    align-self: flex-start;
    border-radius: 0 8px 8px 8px;
}

.ib-chat-bubble.ib-outbound {
    background: #DCF8C6;
    align-self: flex-end;
    margin-left: auto;
    border-radius: 8px 0 8px 8px;
}

.ib-chat-bubble p {
    margin: 0 0 4px 0;
}

.ib-time {
    font-size: 11px;
    color: #667781;
}

.ib-preview-buttons-area {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ib-preview-button {
    background: #FFFFFF;
    border: 1px solid #00A884;
    color: #00A884;
    padding: 10px;
    border-radius: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ib-preview-button:hover {
    background: #00A884;
    color: #FFFFFF;
}

.ib-preview-list-button {
    background: #FFFFFF;
    border: 1px solid #00A884;
    color: #00A884;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

/* Modal Specific Styles */
.ib-button-item,
.ib-list-section,
.ib-list-row {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color, #e5e7eb);
}

.ib-section-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.ib-section-header input {
    flex: 1;
}

.ib-section-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

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

.form-section-header label {
    font-weight: 600;
    margin: 0;
}

/* Dark Mode Support */
[data-theme="dark"] .ib-card {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .ib-phone-screen {
    background: #0B141A;
}

[data-theme="dark"] .ib-chat-bubble.ib-inbound {
    background: #202C33;
    color: #E9EDEF;
}

[data-theme="dark"] .ib-chat-bubble.ib-outbound {
    background: #005C4B;
    color: #E9EDEF;
}

[data-theme="dark"] .ib-preview-button,
[data-theme="dark"] .ib-preview-list-button {
    background: #202C33;
    border-color: #00A884;
}

[data-theme="dark"] .ib-preview-button:hover,
[data-theme="dark"] .ib-preview-list-button:hover {
    background: #00A884;
}

/* ========================================
   AUTO-TRIAGEM - ESTILOS MELHORADOS
   ======================================== */

/* Container principal de auto-triagem */
.auto-triage-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    margin-top: 25px;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.auto-triage-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.auto-triage-section .form-section-header {
    position: relative;
    z-index: 1;
}

.auto-triage-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.auto-triage-icon {
    font-size: 24px;
    animation: pulse-robot 2s ease-in-out infinite;
}

@keyframes pulse-robot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.auto-triage-title {
    color: white;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.auto-triage-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 5px 0 0 0;
}

/* Toggle de ativação */
.auto-triage-toggle {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.checkbox-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.checkbox-toggle input[type="checkbox"] {
    width: 50px;
    height: 26px;
    position: relative;
    appearance: none;
    background: #ccc;
    border-radius: 13px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-toggle input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.checkbox-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-primary);
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.checkbox-toggle input[type="checkbox"]:checked::before {
    left: 26px;
}

.toggle-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Container de configuração */
.auto-triage-config {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border-left: 4px solid #667eea;
}

/* Cards de trigger */
.trigger-option-card {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.trigger-option-card:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateX(5px);
}

.trigger-option-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.trigger-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.trigger-info {
    flex: 1;
}

.trigger-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.trigger-description {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Badge de prioridade */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.priority-low {
    background: #E0F2FE;
    color: #0369A1;
}

.priority-medium {
    background: #FEF3C7;
    color: #92400E;
}

.priority-high {
    background: #FEE2E2;
    color: #991B1B;
}

/* Condições avançadas */
.advanced-conditions {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    margin-top: 15px;
}

.advanced-conditions-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.condition-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.condition-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.condition-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

/* Badges nos cards */
.badge-auto {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {
    0%, 100% { box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5); }
}

/* Tooltips melhorados */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    margin-left: 5px;
    position: relative;
}

.tooltip-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #1F2937;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.tooltip-icon:hover::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1F2937;
    z-index: 1000;
}

/* Preview de trigger em tempo real */
.trigger-preview {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
    border: 2px dashed #667eea;
    border-radius: 10px;
    padding: 16px;
    margin-top: 15px;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #667eea;
    font-weight: 600;
}

.preview-content {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
}

.preview-example {
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

/* Wizard steps */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.wizard-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.wizard-step.active .step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.wizard-step.completed .step-number {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.step-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.wizard-step.active .step-label {
    color: #667eea;
    font-weight: 600;
}

/* Templates rápidos */
.quick-templates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.template-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.template-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.template-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.template-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.template-desc {
    font-size: 12px;
    color: #6B7280;
}

/* Animação de entrada */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auto-triage-config {
    animation: slideInUp 0.4s ease-out;
}

/* Responsivo */
@media (max-width: 768px) {
    .quick-templates {
        grid-template-columns: 1fr;
    }

    .wizard-steps {
        flex-direction: column;
        gap: 10px;
    }

    .wizard-steps::before {
        display: none;
    }
}

/* ============================================
   ACTION CONFIGURATION MODAL
   ============================================ */

/* Modal Subtitle */
.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 5px;
    font-weight: 400;
}

/* Action Section Header */
.action-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.action-section-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-count-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Existing Actions List */
.existing-actions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.action-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}

.action-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.action-item.inactive {
    opacity: 0.6;
    background: #f1f3f5;
}

.action-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.action-item-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.action-item-title .action-type-icon {
    font-size: 24px;
}

.action-item-title h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
}

.action-item-controls {
    display: flex;
    gap: 8px;
}

.action-item-controls button {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.action-item-controls button:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.action-item-controls button.btn-edit:hover {
    background: #0d6efd;
    border-color: #0d6efd;
}

.action-item-controls button.btn-delete:hover {
    background: #dc3545;
    border-color: #dc3545;
}

.action-item-body {
    padding-left: 34px;
}

.action-item-summary {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.action-item-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.action-meta-badge i {
    color: #667eea;
}

.action-meta-badge.priority-high {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border-color: transparent;
}

.action-meta-badge.priority-medium {
    background: linear-gradient(135deg, #ffa500 0%, #ff7f00 100%);
    color: white;
    border-color: transparent;
}

.action-meta-badge.priority-low {
    background: #e9ecef;
    color: #495057;
}

/* Action Type Selector */
.action-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.action-type-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.action-type-card:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
}

.action-type-card.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.action-type-card.selected .action-type-icon,
.action-type-card.selected .action-type-label,
.action-type-card.selected .action-type-desc {
    color: white;
}

.action-type-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.action-type-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.action-type-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Dynamic Fields Container */
#actionDynamicFields {
    margin-top: 25px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
    min-height: 100px;
    transition: all 0.3s ease;
}

#actionDynamicFields:empty::before {
    content: "👆 Selecione um tipo de ação acima para configurar";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-tertiary);
    font-size: 14px;
    font-style: italic;
}

#actionDynamicFields:not(:empty) {
    border-color: #667eea;
    background: var(--bg-primary);
}

/* Action Dynamic Fields Styling */
.action-field-group {
    margin-bottom: 20px;
}

.action-field-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.action-field-group input,
.action-field-group select,
.action-field-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.action-field-group input:focus,
.action-field-group select:focus,
.action-field-group textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.action-field-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.action-field-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-field-help i {
    color: #667eea;
}

/* Priority Slider */
.priority-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.priority-slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    outline: none;
    -webkit-appearance: none;
}

.priority-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.priority-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.priority-value {
    min-width: 120px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.priority-value i {
    margin-right: 5px;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    background: #e9ecef;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

/* IA & FAQ */
.faq-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.faq-list {
    display: grid;
    gap: 14px;
}

.faq-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

.faq-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.faq-item h5 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.faq-item p {
    margin: 0;
    color: var(--text-muted);
}

.faq-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.faq-tags {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.faq-tags span {
    background: rgba(79, 172, 254, 0.15);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
}

.faq-test-result {
    margin-top: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
}

.faq-answer {
    margin-bottom: 8px;
}

.faq-sources {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Help Icon */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    cursor: help;
    margin-left: 5px;
}

/* Empty State */
.action-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #adb5bd;
}

.action-empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.action-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Modal Large Variant */
.modal-content.modal-large {
    max-width: 900px;
    width: 90%;
}

/* Responsive */
@media (max-width: 768px) {
    .action-type-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-item-header {
        flex-direction: column;
        gap: 12px;
    }

    .action-item-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .priority-slider-container {
        flex-direction: column;
        align-items: stretch;
    }

    .priority-value {
        width: 100%;
    }

    .modal-content.modal-large {
        width: 95%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .action-type-selector {
        grid-template-columns: 1fr;
    }

    .action-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ══════════════════════════════════════════════════════════════
   GLOBAL POLISH — applies to entire app
══════════════════════════════════════════════════════════════ */

/* Modern scrollbar for all scrollable areas */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.55);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

/* Selection highlight */
::selection {
    background: rgba(59, 130, 246, 0.2);
    color: inherit;
}

/* Focus-visible ring for keyboard nav (no mouse focus ring) */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Smooth theme transitions for key properties */
.card, .auth-card, .modal-content,
.profile-menu-dropdown, .nav-tab,
.stat-card, .conversation-item {
    transition: background 0.25s ease, border-color 0.25s ease,
                box-shadow 0.25s ease, color 0.25s ease;
}

/* Loading spinner (used in auth.js) */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    flex-shrink: 0;
}

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

/* Dashboard sidebar collapsed state on mobile */
@media (max-width: 768px) {
    .nav-tabs {
        overflow-x: auto;
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 0 4px;
        border-right: none;
        border-bottom: 1px solid var(--gray-light);
    }

    .nav-tab {
        flex-direction: column;
        gap: 4px;
        padding: 8px 10px;
        font-size: 0.7rem;
        min-width: 68px;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .nav-tab.active {
        border-left: none;
        border-bottom-color: var(--primary);
    }

    .nav-tab i {
        font-size: 1.1rem;
    }
}

/* ──────────────────────────────────────────────────────────────
   DESIGN SYSTEM v2 — layout_new handoff mai/2026
   Preserva toda lógica, hooks e integrações existentes.
   Aplica tokens, layout sidebar+topbar e estilo de componentes.
   ────────────────────────────────────────────────────────────── */

/* ── Tokens v2 ── */
:root {
  --bg-0:#08080F; --bg-1:#0D0D17; --bg-2:#13131F; --bg-3:#1A1A28; --bg-4:#222234;
  --line:rgba(99,102,241,.08); --line-2:rgba(255,255,255,.06); --line-strong:rgba(255,255,255,.10);
  --fg-0:#F0EEFA; --fg-1:#CECBE0; --fg-2:#8B89A6; --fg-3:#5E5C78; --fg-4:#403E56;
  --acc:#6366F1; --acc-2:#818CF8; --acc-soft:rgba(99,102,241,.16); --acc-line:rgba(99,102,241,.36);
  --ok:#10B981; --warn:#F59E0B; --err:#EF4444; --info:#60A5FA;
  --font-sans:'Geist','Inter',ui-sans-serif,system-ui,sans-serif;
  --font-mono:'Geist Mono','JetBrains Mono',ui-monospace,monospace;
  --font-serif:'Instrument Serif',ui-serif,serif;
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-xl:18px;
  --side-w:72px; --topbar-h:56px; --inbox-w:380px;
  --row-py:14px; --row-px:14px; --gap:10px;
  --card-bg:rgba(255,255,255,.025); --card-bg-hover:rgba(255,255,255,.045);
  --card-line:rgba(255,255,255,.07); --card-blur:0px;
  --glass:rgba(13,13,23,.70);--glass-line:rgba(255,255,255,.06);
  --ease:cubic-bezier(.2,.8,.2,1); --ease-out:cubic-bezier(.16,1,.3,1);
  --dur-fast:120ms; --dur-base:180ms; --dur-slow:280ms;
}
[data-density="compact"]{--row-py:10px;--gap:6px;--topbar-h:48px}
[data-density="comfy"]{--row-py:18px;--gap:14px;--topbar-h:64px}
[data-card="glass"]{--card-bg:rgba(255,255,255,.04);--card-line:rgba(255,255,255,.08);--card-blur:14px}
[data-card="flat"]{--card-bg:rgba(255,255,255,.02);--card-line:transparent;--card-blur:0px}
[data-card="bordered"]{--card-bg:transparent;--card-line:rgba(255,255,255,.12);--card-blur:0px}
[data-theme="light"]{
  --bg-0:#F4F4F9;--bg-1:#EDEDF3;--bg-2:#E6E5EE;--bg-3:#DDDCE7;--bg-4:#CFCDDD;
  --line:rgba(99,102,241,.10);--line-2:rgba(0,0,0,.07);--line-strong:rgba(0,0,0,.14);
  --fg-0:#15131F;--fg-1:#34324A;--fg-2:#6A6880;--fg-3:#8A88A0;--fg-4:#ACAAC0;
  --glass:rgba(244,244,249,.70);--glass-line:rgba(0,0,0,.06);
  --card-bg:rgba(255,255,255,.6);--card-bg-hover:rgba(0,0,0,.04);--card-line:rgba(0,0,0,.08);
  --badge-ok-bg:rgba(16,185,129,.14);--badge-err-bg:rgba(239,68,68,.12);--badge-info-bg:rgba(96,165,250,.16);
}
[data-theme="light"][data-card="flat"]{--card-bg:rgba(0,0,0,.025);--card-line:transparent}
[data-theme="light"][data-card="bordered"]{--card-bg:transparent;--card-line:rgba(0,0,0,.14)}

/* ── Light-mode component overrides ── */
[data-theme="light"][data-card="glass"]{--card-bg:rgba(255,255,255,.60);--card-line:rgba(0,0,0,.08);--card-blur:14px}
[data-theme="light"] .sidebar-item:hover{background:rgba(0,0,0,.025)}
[data-theme="light"] .conversation-item:hover{background:rgba(0,0,0,.025)!important}
[data-theme="light"] .topbar-icon-btn:hover,
[data-theme="light"] .panel-header-btn:hover,
[data-theme="light"] .btn-icon:hover{background:rgba(0,0,0,.04)!important}
[data-theme="light"] .profile-menu-item:hover{background:rgba(0,0,0,.04)!important}
[data-theme="light"] .filter-count{background:rgba(0,0,0,.04)!important}
[data-theme="light"] .filter-btn:hover .filter-count{background:rgba(0,0,0,.06)!important}
[data-theme="light"] .status-filter-buttons{background:rgba(0,0,0,.025)!important}
[data-theme="light"] .conversations-panel{background:linear-gradient(180deg,rgba(0,0,0,.012),transparent 30%)!important}

/* ── Base ── */
body{
  font-family:var(--font-sans)!important;
  background:var(--bg-0)!important;
  color:var(--fg-0)!important;
  -webkit-font-smoothing:antialiased;
  font-feature-settings:"ss01","cv11";
}
body::before{
  content:"";position:fixed;inset:0;pointer-events:none;z-index:0;
  background:
    radial-gradient(60% 50% at 12% 0%,rgba(99,102,241,.10),transparent 60%),
    radial-gradient(50% 40% at 90% 100%,rgba(168,85,247,.06),transparent 60%);
  mix-blend-mode:screen;
}
[data-theme="light"] body::before{mix-blend-mode:multiply}
::selection{background:var(--acc-soft);color:var(--fg-0)}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.07);border-radius:99px}
::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.14)}
[data-theme="light"] ::-webkit-scrollbar-thumb{background:rgba(0,0,0,.12)}

/* ── App shell layout ── */
.dashboard{
  display:flex!important;
  flex-direction:row!important;
  background:var(--bg-0)!important;
  color:var(--fg-0)!important;
  position:relative;
  z-index:1;
}
.dashboard-header{display:none!important}

/* ── Sidebar rail ── */
.sidebar-rail{
  width:var(--side-w);height:100vh;flex:none;
  background:linear-gradient(180deg,var(--bg-1),var(--bg-0));
  border-right:1px solid var(--line-2);
  display:flex;flex-direction:column;align-items:center;
  padding:14px 10px;position:sticky;top:0;z-index:200;
}
.sidebar-brand{
  width:100%;display:flex;justify-content:center;padding-bottom:14px;
}
.sidebar-brand-divider{
  height:1px;width:80%;background:var(--line-2);margin:0 auto 12px;
}
.sidebar-nav{
  display:flex;flex-direction:column;gap:4px;width:100%;
}
.sidebar-footer{
  margin-top:auto;display:flex;flex-direction:column;
  gap:4px;width:100%;align-items:center;padding-top:8px;
}
.sidebar-footer-logo{
  width:100%;display:flex;justify-content:center;
  padding:8px 0 2px;margin-top:4px;
  opacity:.78;
}
.sidebar-footer-logo svg{
  display:block;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.18));
}
.sidebar-item{
  position:relative;width:100%;display:flex;flex-direction:column;
  align-items:center;gap:5px;padding:10px 6px;
  border-radius:var(--r-md);
  background:transparent;border:1px solid transparent;
  color:var(--fg-2);cursor:pointer;
  transition:all var(--dur-base) var(--ease);
  font-family:var(--font-mono);font-size:9px;
  letter-spacing:.08em;text-transform:uppercase;
}
.sidebar-item:hover{color:var(--fg-0);background:rgba(255,255,255,.03)}
.sidebar-item.active{color:var(--acc);background:var(--acc-soft);border-color:var(--acc-line)}
.sidebar-item-indicator{
  position:absolute;left:-10px;top:50%;transform:translateY(-50%);
  width:3px;height:18px;background:var(--acc);
  border-radius:0 2px 2px 0;display:none;
}
.sidebar-item.active .sidebar-item-indicator{display:block}
.sidebar-badge{
  position:absolute;top:6px;right:8px;
  min-width:16px;height:16px;padding:0 4px;
  border-radius:4px;background:var(--acc);color:var(--bg-0);
  font-family:var(--font-mono);font-size:9.5px;font-weight:600;
  display:flex;align-items:center;justify-content:center;
}
.sidebar-avatar-wrap{
  width:32px;height:32px;border-radius:999px;
  background:linear-gradient(135deg,rgba(129,140,248,.4),rgba(129,140,248,.18));
  border:1px solid rgba(129,140,248,.55);
  display:flex;align-items:center;justify-content:center;
  color:var(--acc-2);font-family:var(--font-mono);
  font-weight:600;font-size:11px;cursor:pointer;position:relative;
}
.sidebar-avatar-online{
  position:absolute;right:-1px;bottom:-1px;
  width:10px;height:10px;border-radius:999px;
  background:var(--ok);box-shadow:0 0 0 2px var(--bg-1),0 0 8px rgba(16,185,129,.6);
}

/* ── Main column ── */
.main-column{
  flex:1;min-width:0;display:flex;flex-direction:column;height:100vh;overflow:hidden;
}

/* ── Topbar ── */
.topbar{
  height:var(--topbar-h);flex:none;
  display:flex;align-items:center;gap:14px;padding:0 18px;
  border-bottom:1px solid var(--line-2);
  background:linear-gradient(180deg,var(--bg-1),rgba(255,255,255,0));
  position:relative;z-index:100;flex-shrink:0;
}
.topbar-breadcrumb{display:flex;align-items:baseline;gap:10px;min-width:0}
.topbar-section-slug{
  font-family:var(--font-mono);font-size:10.5px;
  color:var(--fg-3);letter-spacing:.10em;text-transform:uppercase;
}
.topbar-title{
  font-size:16px;font-weight:500;letter-spacing:-.01em;
  color:var(--fg-0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.topbar-spacer{flex:1}
.topbar-metrics{
  display:flex;align-items:center;gap:14px;padding:6px 12px;
  border:1px solid var(--line-2);border-radius:var(--r-md);
  background:var(--card-bg);backdrop-filter:blur(var(--card-blur));
  font-family:var(--font-mono);font-size:10.5px;
  color:var(--fg-2);letter-spacing:.06em;text-transform:uppercase;
}
.topbar-metrics .tsep{width:1px;height:11px;background:var(--line-2)}
.topbar-icon-btn{
  position:relative;width:32px;height:32px;border-radius:var(--r-sm);
  background:transparent;border:1px solid var(--line-2);
  color:var(--fg-2);cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:all var(--dur-fast) var(--ease);
}
.topbar-icon-btn:hover{background:rgba(255,255,255,.04);color:var(--fg-0);border-color:var(--line-strong)}
.topbar-notif-dot{
  position:absolute;top:7px;right:7px;width:6px;height:6px;
  background:var(--acc);border-radius:999px;
}
.topbar-sep{width:1px;height:24px;background:var(--line-2);margin:0 4px}
.topbar-agent{display:flex;align-items:center;gap:10px}
.topbar-agent-info{text-align:right;line-height:1.15}
.topbar-agent-name{font-size:12px;color:var(--fg-0);font-weight:500}
.topbar-agent-meta{
  font-family:var(--font-mono);font-size:9.5px;
  color:var(--fg-3);letter-spacing:.08em;text-transform:uppercase;
}
.topbar-avatar{
  width:32px;height:32px;border-radius:999px;
  background:linear-gradient(135deg,rgba(129,140,248,.4),rgba(129,140,248,.18));
  border:1px solid rgba(129,140,248,.55);
  display:flex;align-items:center;justify-content:center;
  color:var(--acc-2);font-family:var(--font-mono);font-weight:600;
  font-size:11px;cursor:pointer;position:relative;
}
.topbar-avatar-online{
  position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;
  border-radius:999px;background:var(--ok);
  box-shadow:0 0 0 2px var(--bg-1),0 0 8px rgba(16,185,129,.6);
}
.topbar-avatar-initials{
  font-family:var(--font-mono);font-size:11px;font-weight:600;
  color:var(--acc-2);letter-spacing:.02em;
  pointer-events:none;
}

/* ── Tab content inside main-column ── */
.main-column>.tab-content{background:transparent!important}

/* ── Conversations panel ── */
.conversations-panel{
  background:linear-gradient(180deg,rgba(255,255,255,.012),transparent 30%)!important;
  border:none!important;border-right:1px solid var(--line-2)!important;
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  border-radius:0!important;box-shadow:none!important;
  width:var(--inbox-w)!important;
}

/* Panel header */
.panel-header{
  background:transparent!important;border-bottom:1px solid var(--line-2)!important;
  border-radius:0!important;padding:16px 16px 12px!important;
  flex-direction:column!important;align-items:stretch!important;gap:12px!important;
}
.panel-header-label{
  display:flex;align-items:center;justify-content:space-between;
}
.panel-header-mono{
  font-family:var(--font-mono);font-size:10px;
  letter-spacing:.12em;text-transform:uppercase;color:var(--fg-3);
}
.panel-header-mono .acc{color:var(--acc)}
.panel-header-actions{display:flex;gap:6px}
.panel-header-btn{
  width:26px;height:26px;border-radius:var(--r-sm);
  background:transparent;border:1px solid var(--line-2);
  color:var(--fg-2);cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:all var(--dur-fast);font-size:12px;
}
.panel-header-btn:hover{background:rgba(255,255,255,.04);color:var(--fg-0)}
.panel-header-btn.accent{background:var(--acc);color:var(--bg-0);border-color:var(--acc)}

/* Filter tab strip */
.status-filter-buttons{
  display:flex!important;gap:4px!important;padding:3px!important;
  background:rgba(255,255,255,.02)!important;
  border:1px solid var(--line-2)!important;border-radius:var(--r-md)!important;
}
.filter-btn{
  flex:1!important;display:inline-flex!important;align-items:center!important;
  justify-content:center!important;gap:8px!important;
  padding:10px 8px!important;border-radius:var(--r-sm)!important;
  background:transparent!important;border:1px solid transparent!important;
  color:var(--fg-2)!important;cursor:pointer;
  transition:all var(--dur-fast) var(--ease);
  font-size:11.5px!important;font-weight:500!important;
  letter-spacing:-.005em!important;white-space:nowrap;position:relative;
}
.filter-btn i{display:none!important}
.filter-btn:hover{color:var(--fg-0)!important}
.filter-btn.active{
  background:var(--card-bg)!important;border-color:var(--line-strong)!important;
  color:var(--fg-0)!important;box-shadow:none!important;
}
.filter-btn.active::after{
  content:'';position:absolute;bottom:-1px;left:25%;right:25%;
  height:1px;background:var(--acc);
}
.filter-count{
  min-width:22px!important;padding:1px 5px!important;
  border-radius:4px!important;
  font-family:var(--font-mono)!important;font-size:10px!important;
  font-weight:500!important;background:rgba(255,255,255,.04)!important;
  border:1px solid var(--line-2)!important;color:var(--fg-2)!important;text-align:center;
}
.filter-btn.active .filter-count{
  background:var(--acc-soft)!important;color:var(--acc)!important;
  border-color:var(--acc-line)!important;
}
.filter-btn:hover .filter-count{background:rgba(255,255,255,.08)!important}

/* Panel actions row (refresh btn) */
.panel-actions{gap:0!important;flex-direction:column!important;justify-content:flex-start!important}

/* ── Chat container ── */
.chat-container{padding:0!important;gap:0!important}

/* ── Chat panel ── */
.chat-panel{
  background:var(--bg-0)!important;border:none!important;
  border-radius:0!important;backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;box-shadow:none!important;
}
.messages-container,.messages-wrapper{
  background:
    radial-gradient(800px 400px at 20% -10%,rgba(99,102,241,.04),transparent 60%),
    var(--bg-0)!important;
}
.chat-header{
  background:linear-gradient(180deg,var(--bg-1),transparent)!important;
  border-bottom:1px solid var(--line-2)!important;
  border-radius:0!important;padding:14px 18px!important;
  color:var(--fg-0)!important;
}

/* ── Message bubbles ── */
.message.inbound .message-bubble{
  background:var(--bg-2)!important;border:1px solid var(--line-2)!important;
  backdrop-filter:none!important;
  border-radius:4px 12px 12px 12px!important;color:var(--fg-0)!important;
}
.message.outbound .message-bubble{
  background:linear-gradient(180deg,var(--acc-soft),rgba(99,102,241,.08))!important;
  border:1px solid var(--acc-line)!important;
  border-radius:12px 4px 12px 12px!important;
  box-shadow:0 0 24px rgba(99,102,241,.08)!important;
  color:var(--fg-0)!important;
}
.message-content{
  color:var(--fg-0)!important;font-size:13px!important;line-height:1.5!important;
}
.message.outbound .message-content{color:var(--fg-0)!important}
.message-meta{
  font-family:var(--font-mono);font-size:9.5px!important;
  color:var(--fg-3)!important;letter-spacing:.04em;
}

/* ── Chat input ── */
.chat-input-area{
  background:var(--bg-1)!important;border-top:1px solid var(--line-2)!important;
  border-radius:0!important;padding:12px 18px 16px!important;
}
.chat-input-area form{
  align-items:center;padding:10px 12px;
  background:var(--bg-2)!important;border:1px solid var(--line-2)!important;
  border-radius:var(--r-lg)!important;
}
.chat-input-area input[type="text"]{
  background:transparent!important;border:none!important;
  color:var(--fg-0)!important;font-size:13px!important;
  font-family:var(--font-sans)!important;
}
.chat-input-area input[type="text"]::placeholder{color:var(--fg-3)!important}
.chat-input-area input[type="text"]:focus{
  outline:none!important;border:none!important;box-shadow:none!important;
}
.btn-send{
  background:var(--acc)!important;border-color:var(--acc)!important;
  border-radius:var(--r-sm)!important;color:var(--bg-0)!important;
  width:32px!important;height:32px!important;padding:0!important;flex:none;
}
.btn-send:hover{background:var(--acc-2)!important;border-color:var(--acc-2)!important}

/* ── Conversation cards v2 ── */
.conversation-item{
  padding:var(--row-py) var(--row-px)!important;
  margin:0!important;border-radius:0!important;
  border:none!important;border-bottom:1px solid var(--line-2)!important;
  background:transparent!important;position:relative;
  transition:background var(--dur-fast) var(--ease)!important;
}
.conversation-item:hover{background:rgba(255,255,255,.018)!important}
.conversation-item.active{background:var(--card-bg-hover)!important}
.conversation-item.active::before{
  content:'';position:absolute;left:0;top:0;bottom:0;
  width:2px;background:var(--acc);border-radius:0!important;
}
.conversation-phone{
  font-family:var(--font-mono)!important;font-size:10.5px!important;
  color:var(--fg-3)!important;letter-spacing:.02em!important;font-weight:400!important;
}
.conversation-time{
  font-family:var(--font-mono)!important;font-size:10px!important;
  color:var(--fg-3)!important;background:none!important;padding:0!important;
  border-radius:0!important;letter-spacing:.02em;
}
.conversation-preview{
  font-size:11.5px!important;color:var(--fg-1)!important;
  margin-top:8px!important;line-height:1.4;
}
.department-badge{
  display:inline-flex!important;align-items:center!important;gap:5px!important;
  padding:2px 7px!important;border-radius:4px!important;
  font-family:var(--font-mono)!important;font-size:10px!important;
  letter-spacing:.04em!important;text-transform:uppercase!important;
  border:1px solid rgba(99,102,241,.3)!important;
  background:rgba(99,102,241,.10)!important;color:var(--acc-2)!important;
}
.unread-count{
  border-radius:4px!important;
  background:var(--acc)!important;color:var(--bg-0)!important;
}

/* ── btn-icon ── */
.btn-icon{
  background:transparent!important;border:1px solid var(--line-2)!important;
  color:var(--fg-2)!important;border-radius:var(--r-sm)!important;
}
.btn-icon:hover{
  background:rgba(255,255,255,.04)!important;color:var(--fg-0)!important;
  border-color:var(--line-strong)!important;
}

/* ── Resize handle ── */
.resize-handle::after{
  background:var(--line-2)!important;box-shadow:none!important;
}
.resize-handle:hover::after,.resize-handle.dragging::after{
  background:var(--acc)!important;box-shadow:0 0 6px rgba(99,102,241,.4)!important;
}

/* ── Profile menu in new layout ── */
.profile-menu-dropdown{
  background:var(--bg-3)!important;border-color:var(--line-strong)!important;
  top:calc(var(--topbar-h) + 8px)!important;
}
[data-theme="dark"] .profile-menu-dropdown{
  background:var(--bg-3)!important;border-color:var(--line-strong)!important;
}
.profile-menu-item{color:var(--fg-1)!important;border-radius:var(--r-sm)!important}
.profile-menu-item:hover{background:rgba(255,255,255,.05)!important;color:var(--fg-0)!important}

/* Topbar profile toggle (old button hidden on desktop via sidebar) */
.profile-menu-toggle{display:none}

/* ── Topbar metrics expanded — SLA | Fila | Online ── */
.topbar-metrics{
  display:flex!important;align-items:center;gap:14px;padding:5px 11px;
  border:1px solid var(--line-2);border-radius:var(--r-md);
  background:var(--card-bg);backdrop-filter:blur(var(--card-blur));
  font-family:var(--font-mono);font-size:10px;
  color:var(--fg-2);letter-spacing:.06em;text-transform:uppercase;
}
.topbar-metrics-item{display:flex;align-items:center;gap:5px;line-height:1}
.topbar-metrics-item .tmi-label{color:var(--fg-3);font-size:9px;letter-spacing:.08em}
.topbar-metrics-item .tmi-val{color:var(--fg-0);font-weight:600;font-size:11px}
.topbar-metrics-item.ok .tmi-val{color:var(--ok)}
.topbar-metrics-item.warn .tmi-val{color:var(--warn,#f59e0b)}
.topbar-metrics-item.acc .tmi-val{color:var(--acc-2)}

/* ── Squircle avatar in conversation list ── */
.conv-squircle{
  flex-shrink:0;
  width:38px;height:38px;
  border-radius:30% 30% 30% 30% / 30% 30% 30% 30%;
  background:linear-gradient(135deg,var(--acc-soft),rgba(99,102,241,.12));
  border:1px solid var(--acc-line);
  display:flex;align-items:center;justify-content:center;
  position:relative;
  font-family:var(--font-mono);font-size:12px;font-weight:700;
  color:var(--acc-2);letter-spacing:.02em;
  user-select:none;
}
.conv-squircle-online{
  position:absolute;bottom:-1px;right:-1px;
  width:10px;height:10px;border-radius:999px;
  background:var(--ok);
  box-shadow:0 0 0 2px var(--bg-0),0 0 6px rgba(16,185,129,.5);
}
.conv-squircle-offline .conv-squircle-online{
  background:var(--fg-3);box-shadow:0 0 0 2px var(--bg-0);
}
.conv-item-body{
  flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;
}
.conv-item-row1{
  display:flex;align-items:baseline;justify-content:space-between;gap:6px;
}
.conv-item-row2{
  display:flex;align-items:center;gap:5px;flex-wrap:wrap;
}
.conv-item-row3{
  display:flex;align-items:center;justify-content:space-between;gap:6px;
}
.conv-dept-pill{
  display:inline-flex;align-items:center;gap:3px;
  padding:1px 6px;border-radius:3px;
  font-family:var(--font-mono);font-size:9px;font-weight:500;
  letter-spacing:.04em;text-transform:uppercase;
  background:rgba(99,102,241,.10);color:var(--acc-2);
  border:1px solid var(--acc-line);flex-shrink:0;
}
.conv-status-pill{
  display:inline-flex;align-items:center;gap:4px;
  padding:1px 6px;border-radius:3px;
  font-family:var(--font-mono);font-size:9px;font-weight:500;
  letter-spacing:.04em;text-transform:uppercase;flex-shrink:0;
}
.conv-status-pill.active{
  background:rgba(16,185,129,.10);color:var(--ok);
  border:1px solid rgba(16,185,129,.25);
}
.conv-status-pill.active::before{
  content:'';width:5px;height:5px;border-radius:999px;
  background:var(--ok);animation:pulse 2s ease-in-out infinite;flex-shrink:0;
}
.conv-status-pill.resolved{
  background:rgba(99,102,241,.10);color:var(--acc-2);
  border:1px solid var(--acc-line);
}
.conv-status-pill.resolved::before{
  content:'';width:5px;height:5px;border-radius:999px;
  background:var(--acc-2);flex-shrink:0;
}
.conv-status-pill.new{
  background:rgba(245,158,11,.10);color:var(--warn,#f59e0b);
  border:1px solid rgba(245,158,11,.25);
}
.conv-status-pill.new::before{
  content:'';width:5px;height:5px;border-radius:999px;
  background:var(--warn,#f59e0b);animation:pulse 2s ease-in-out infinite;flex-shrink:0;
}

/* Override old conversation-item internals when squircle layout is used */
.conversation-item .conv-item-wrap{
  display:flex;align-items:flex-start;gap:10px;
}

/* ── Chat header squircle + action buttons ── */
.chat-header-squircle{
  flex-shrink:0;
  width:36px;height:36px;
  border-radius:28% 28% 28% 28% / 28% 28% 28% 28%;
  background:linear-gradient(135deg,var(--acc-soft),rgba(99,102,241,.12));
  border:1px solid var(--acc-line);
  display:flex;align-items:center;justify-content:center;
  position:relative;
  font-family:var(--font-mono);font-size:12px;font-weight:700;
  color:var(--acc-2);letter-spacing:.02em;flex-shrink:0;user-select:none;
}
.chat-header-squircle .sq-online{
  position:absolute;bottom:-1px;right:-1px;
  width:9px;height:9px;border-radius:999px;
  background:var(--ok);box-shadow:0 0 0 2px var(--bg-1),0 0 6px rgba(16,185,129,.5);
}
.chat-header-info{
  flex:1;min-width:0;display:flex;flex-direction:column;gap:1px;
}
.chat-header-name{
  font-size:13.5px;font-weight:600;color:var(--fg-0);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  cursor:pointer;letter-spacing:-.01em;
  transition:color var(--dur-fast);display:inline-flex;align-items:center;gap:5px;
}
.chat-header-name:hover{color:var(--acc-2)}
.chat-header-name .ch-caret{
  opacity:.4;font-size:10px;transition:opacity var(--dur-fast);
}
.chat-header-name:hover .ch-caret{opacity:.8}
.chat-header-sub{
  font-family:var(--font-mono);font-size:9.5px;color:var(--fg-3);
  letter-spacing:.04em;display:flex;align-items:center;gap:6px;
}
.chat-header-sub .chsep{width:1px;height:8px;background:var(--line-2);display:inline-block}
.chat-header-btns{
  display:flex;align-items:center;gap:4px;flex-shrink:0;
}
.chat-hbtn{
  width:30px;height:30px;border-radius:var(--r-sm);
  background:transparent;border:1px solid var(--line-2);
  color:var(--fg-2);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:all var(--dur-fast) var(--ease);
}
.chat-hbtn:hover{background:rgba(255,255,255,.05);color:var(--fg-0);border-color:var(--line-strong)}
.chat-hbtn svg{display:block}
.chat-hbtn-sep{width:1px;height:20px;background:var(--line-2);margin:0 2px}

/* ── Contact info slide panel ── */
.contact-slide-panel{
  position:absolute;top:0;right:0;bottom:0;
  width:280px;
  background:var(--bg-1);
  border-left:1px solid var(--line-2);
  z-index:20;
  transform:translateX(100%);
  transition:transform .25s var(--ease);
  display:flex;flex-direction:column;
  overflow:hidden;
}
.contact-slide-panel.open{transform:translateX(0)}
.csp-head{
  padding:14px 16px;border-bottom:1px solid var(--line-2);
  display:flex;align-items:center;justify-content:space-between;
}
.csp-title{
  font-family:var(--font-mono);font-size:10px;letter-spacing:.12em;
  text-transform:uppercase;color:var(--fg-3);
}
.csp-close{
  width:24px;height:24px;border-radius:var(--r-sm);
  background:transparent;border:none;color:var(--fg-2);
  cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:all var(--dur-fast);font-size:13px;
}
.csp-close:hover{background:rgba(255,255,255,.05);color:var(--fg-0)}
.csp-body{flex:1;overflow-y:auto;padding:16px}
.csp-avatar{
  width:56px;height:56px;
  border-radius:35% 35% 35% 35% / 35% 35% 35% 35%;
  background:linear-gradient(135deg,var(--acc-soft),rgba(99,102,241,.2));
  border:1px solid var(--acc-line);
  display:flex;align-items:center;justify-content:center;
  font-family:var(--font-mono);font-size:18px;font-weight:700;
  color:var(--acc-2);margin:0 auto 14px;position:relative;
}
.csp-avatar .csp-online{
  position:absolute;bottom:0px;right:0px;
  width:13px;height:13px;border-radius:999px;
  background:var(--ok);box-shadow:0 0 0 2.5px var(--bg-1);
}
.csp-name{
  text-align:center;font-size:14px;font-weight:600;
  color:var(--fg-0);letter-spacing:-.01em;margin-bottom:2px;
}
.csp-phone{
  text-align:center;font-family:var(--font-mono);font-size:10px;
  color:var(--fg-3);letter-spacing:.04em;margin-bottom:16px;
}
.csp-section{margin-bottom:14px}
.csp-section-title{
  font-family:var(--font-mono);font-size:9px;letter-spacing:.12em;
  text-transform:uppercase;color:var(--fg-3);margin-bottom:6px;
}
.csp-row{
  display:flex;align-items:center;gap:8px;
  padding:7px 10px;border-radius:var(--r-sm);
  background:var(--bg-2);border:1px solid var(--line-2);
  margin-bottom:4px;
}
.csp-row-icon{width:16px;color:var(--fg-3);text-align:center;font-size:12px}
.csp-row-text{font-size:12px;color:var(--fg-1);font-family:var(--font-mono);letter-spacing:.02em}
.csp-row-label{font-size:9px;color:var(--fg-3);letter-spacing:.06em;text-transform:uppercase}

/* ── Start attendance btn (updated) ── */
.btn-start-attendance{
  display:inline-flex;align-items:center;gap:4px;
  padding:2px 8px;border-radius:3px;
  font-family:var(--font-mono);font-size:9px;font-weight:500;
  letter-spacing:.04em;text-transform:uppercase;
  background:rgba(99,102,241,.12);color:var(--acc-2);
  border:1px solid var(--acc-line);cursor:pointer;
  transition:all var(--dur-fast);flex-shrink:0;
}
.btn-start-attendance:hover{background:rgba(99,102,241,.2);color:var(--acc-2)}

/* ── Mobile ── */
@media(max-width:768px){
  .sidebar-rail{display:none!important}
  .main-column{flex:1}
  .dashboard-header{display:flex!important}
  .topbar{display:none!important}
  .conversations-panel{width:100%!important}
  .contact-slide-panel{width:100%;border-radius:0}
}
@media(min-width:769px){
  .side-nav{display:none!important}
  .side-nav-overlay{display:none!important}
}
