/* ============================================================
   IM Concern Assistant — Premium SaaS Chat UI
   ============================================================ */

/* ============================================================
   SIDEBAR LAYOUT — New full-viewport app layout
   ============================================================ */

/* Root layout */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--surface, #fff);
    border-right: 1px solid var(--border, #e1e4e8);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.22s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
    z-index: 200;
}
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-app-name,
.sidebar.collapsed .sidebar-username,
.sidebar.collapsed .sidebar-logout,
.sidebar.collapsed .sidebar-badge-new { display: none !important; }
.sidebar.collapsed .sidebar-brand { padding: 14px 12px; }
.sidebar.collapsed .sidebar-item { padding: 12px; justify-content: center; }
.sidebar.collapsed .sidebar-icon { margin: 0; }

/* Brand header */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    min-height: 56px;
}
.sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    overflow: hidden;
}
.sidebar-logo-wrap {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #1557b0 0%, #1a73e8 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary, #1a1d23);
    line-height: 1.35;
    flex: 1;
    white-space: nowrap;
}
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary, #9aa0a6);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface-hover, #f8f9fb); color: var(--text-primary, #1a1d23); }

/* ── Sidebar collapse toggle row ─────────────────────────── */
.sidebar-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-light, #f0f1f3);
    cursor: pointer;
    color: var(--text-secondary, #5f6368);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle-row:hover {
    background: var(--primary-light, #e8f0fe);
    color: var(--primary, #1a73e8);
}
.sidebar-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    flex-shrink: 0;
}
.sidebar-toggle-label { white-space: nowrap; }

/* Show collapse chevron (←) when expanded, hide expand chevron (→) */
.chevron-collapse { display: block; }
.chevron-expand   { display: none; }

/* When collapsed: show expand chevron (→), hide collapse chevron (←) */
.sidebar.collapsed .chevron-collapse { display: none; }
.sidebar.collapsed .chevron-expand   { display: block; }
.sidebar.collapsed .sidebar-toggle-label { display: none; }
.sidebar.collapsed .sidebar-toggle-row { justify-content: center; padding: 10px; }

/* Dark mode */
/* sidebar-toggle-row dark mode — handled by universal blue sidebar rules above */

/* Hide on mobile */
@media (max-width: 768px) { .sidebar-toggle-row { display: none; } }

/* Brand area: Capillary logo + app name side by side */
.sidebar-brand-favicon {
    height: 28px;
    max-width: 90px;
    object-fit: contain;
    flex-shrink: 0;
}
/* When collapsed: show logo at small square size */
.sidebar.collapsed .sidebar-brand-favicon {
    height: 28px;
    max-width: 28px;
    object-fit: contain;
}
.sidebar-app-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
/* Hide app name text when collapsed */
.sidebar.collapsed .sidebar-app-name { display: none; }

/* Sections */
.sidebar-section {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light, #f0f1f3);
    flex-shrink: 0;
}
.sidebar-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-tertiary, #9aa0a6);
    letter-spacing: .9px;
    text-transform: uppercase;
    padding: 4px 14px 6px;
}

/* Nav items */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-secondary, #5f6368);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.sidebar-text {
    flex: 1;
    min-width: 0;
    overflow: visible;
}
.sidebar-item:hover { background: var(--surface-hover, #f8f9fb); color: var(--text-primary, #1a1d23); }
.sidebar-item.active {
    background: var(--primary-light, #e8f0fe);
    color: var(--primary, #1a73e8);
    font-weight: 600;
}
.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    flex-shrink: 0;
    color: inherit;
}
.sidebar-aibot-icon {
    background: linear-gradient(135deg, #1a73e8, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.sidebar-badge-new {
    margin-left: auto;
    background: linear-gradient(135deg, #1a73e8, #7c3aed);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 99px;
    letter-spacing: .3px;
}

/* Bottom section */
.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid var(--border, #e1e4e8);
    padding: 6px 0;
    flex-shrink: 0;
}
.sidebar-notif-wrap { position: relative; }
.notification-dropdown {
    position: absolute !important;
    left: 100% !important;
    bottom: 0 !important;
    top: auto !important;
    right: auto !important;
    min-width: 280px;
    z-index: 1000;
    display: none;
}
.notification-dropdown.open { display: block; }
.sidebar-notif-badge {
    margin-left: auto;
    background: var(--red, #e17055);
    color: #fff;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
}

/* User row at sidebar bottom */
.sidebar-user {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-light, #f0f1f3);
    margin-top: 4px;
}
.sidebar-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary, #1a73e8);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}
.sidebar-username {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #1a1d23);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-logout {
    font-size: 11px;
    color: var(--red, #e17055);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
    font-family: inherit;
    transition: background var(--transition);
}
.sidebar-logout:hover { background: var(--red-light, #fef0ed); }

/* ── Main area ─────────────────────────────────────────────── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: var(--bg, #f0f2f5);
    background-image: var(--bg-pattern);
}

/* ── Mobile topbar ─────────────────────────────────────────── */
.topbar { display: none; }

/* ── Sidebar overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 199;
}
.sidebar-overlay.visible { display: block; }

/* ── Sidebar ALWAYS BLUE (light + dark mode) ─────────────────── */
.sidebar {
    background: #0f2744 !important;
    border-color: rgba(255,255,255,0.08) !important;
}
.sidebar-brand  { border-color: rgba(255,255,255,0.1)  !important; }
.sidebar-section { border-color: rgba(255,255,255,0.07) !important; }
.sidebar-bottom  { border-color: rgba(255,255,255,0.1)  !important; }
.sidebar-user    { border-color: rgba(255,255,255,0.08) !important; }
.sidebar-label   { color: rgba(255,255,255,0.4) !important; }
.sidebar-item    { color: rgba(255,255,255,0.72) !important; }
.sidebar-item:hover  { background: rgba(255,255,255,0.1) !important; color: #fff !important; }
.sidebar-item.active { background: rgba(255,255,255,0.16) !important; color: #fff !important; font-weight: 600; }
.sidebar-toggle      { color: rgba(255,255,255,0.5) !important; }
.sidebar-toggle:hover { background: rgba(255,255,255,0.1) !important; color: #fff !important; }
.sidebar-toggle-row  { color: rgba(255,255,255,0.55) !important; border-color: rgba(255,255,255,0.08) !important; }
.sidebar-toggle-row:hover { background: rgba(255,255,255,0.1) !important; color: #fff !important; }
.sidebar-username    { color: rgba(255,255,255,0.9) !important; }
/* Logout always red */
.sidebar-logout { color: #ff6b6b !important; font-weight: 600; }
.sidebar-logout:hover { background: rgba(255,107,107,0.15) !important; }
/* Notification badge */
.sidebar-notif-badge { background: #ff6b6b !important; }

/* Dark mode topbar */
body.dark-mode .topbar { background: #1a1d2e; border-color: #2d3748; }
body.dark-mode .topbar-title { color: #e2e8f0; }
body.dark-mode .topbar-hamburger { color: #9aa0a6; }

/* ── Mobile responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 16px;
        height: 52px;
        background: var(--surface, #fff);
        border-bottom: 1px solid var(--border, #e1e4e8);
        flex-shrink: 0;
    }
    .topbar-hamburger {
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-secondary, #5f6368);
        display: flex;
        align-items: center;
        padding: 4px;
    }
    .topbar-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--text-primary, #1a1d23);
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
        z-index: 1000;
        width: 260px !important;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar .sidebar-text,
    .sidebar .sidebar-label,
    .sidebar .sidebar-title,
    .sidebar .sidebar-username,
    .sidebar .sidebar-badge-new { display: block !important; }
    .sidebar-item { padding: 9px 14px !important; justify-content: flex-start !important; }
    .notification-dropdown { left: 0 !important; bottom: auto !important; top: 100% !important; }
}

/* ============================================================
   END SIDEBAR LAYOUT
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --primary-glow: rgba(26, 115, 232, 0.15);
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --surface: #ffffff;
    --surface-hover: #f8f9fb;
    --bg: #f0f2f5;
    --bg-pattern: radial-gradient(circle at 20% 50%, rgba(26, 115, 232, 0.03) 0%, transparent 50%),
                  radial-gradient(circle at 80% 20%, rgba(108, 92, 231, 0.03) 0%, transparent 50%),
                  radial-gradient(circle at 50% 80%, rgba(0, 184, 148, 0.02) 0%, transparent 50%);
    --text-primary: #1a1d23;
    --text-secondary: #5f6368;
    --text-tertiary: #9aa0a6;
    --border: #e1e4e8;
    --border-light: #f0f1f3;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --bot-bg: rgba(241, 243, 244, 0.7);
    --user-bg: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    --header-bg: linear-gradient(135deg, #1557b0 0%, #1a73e8 40%, #4285f4 100%);
    --green: #00b894;
    --green-light: #e6f9f3;
    --yellow: #fdcb6e;
    --yellow-light: #fef9e7;
    --red: #e17055;
    --red-light: #fef0ed;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    background-image: var(--bg-pattern);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Chat Container (legacy — kept for compatibility) --- */
.chat-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Header --- */
.chat-header {
    background: var(--header-bg);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: visible;
    z-index: 10;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: -60%;
    left: 10%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-text h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.chat-header p {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: 400;
}

.header-link {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 11px;
    margin-left: 8px;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.4);
    transition: color var(--transition);
}

.header-link:hover {
    color: #fff !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.logout-btn {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    transition: background var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* --- Login Section --- */
.login-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, var(--surface) 0%, #f8f9fc 100%);
}

/* ═══════════════════════════════════════════════════════
   NEW DARK ANIMATED LOGIN DESIGN
   ═══════════════════════════════════════════════════════ */
.lp-root {
    position: relative;
    background: #0a0f1f !important;
    overflow: hidden;
}

/* Background layers */
.lp-bg {
    position: absolute; inset: 0; z-index: 0;
    background:
        radial-gradient(900px 700px at 78% 22%, rgba(59,130,246,0.18), transparent 60%),
        radial-gradient(800px 600px at 18% 80%, rgba(34,197,94,0.10), transparent 60%),
        linear-gradient(160deg, #0a0f1f 0%, #101a36 55%, #060a16 100%);
}
.lp-grid {
    position: absolute; inset: 0; z-index: 0;
    background-image: linear-gradient(rgba(96,165,250,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(96,165,250,0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 80%);
}
.lp-scan {
    position: absolute; inset: 0; z-index: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(96,165,250,0.05) 50%, transparent 100%);
    width: 40%;
    animation: lpScan 9s linear infinite;
}
@keyframes lpScan { 0%{transform:translateX(-100%);} 100%{transform:translateX(350%);} }
.lp-neural { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; }

/* Floating bots */
.lp-float {
    position: absolute; z-index: 0; opacity: 0.10; color: #60a5fa;
    animation: lpFloat 16s ease-in-out infinite;
}
.lp-float.f1 { top: 14%; left: 12%; width: 70px; animation-delay: 0s; }
.lp-float.f2 { bottom: 16%; right: 14%; width: 90px; animation-delay: -5s; color: #22c55e; }
.lp-float.f3 { top: 60%; left: 8%; width: 54px; animation-delay: -9s; color: #f97316; }
.lp-float.f4 { top: 22%; right: 20%; width: 48px; animation-delay: -3s; }
@keyframes lpFloat { 0%,100%{transform:translateY(0) rotate(-3deg);} 50%{transform:translateY(-26px) rotate(4deg);} }
@keyframes lpPulse { 0%,100%{opacity:.35;} 50%{opacity:1;} }

/* Card */
.lp-card {
    position: relative; z-index: 2;
    width: min(440px, 92vw);
    padding: 44px 40px 36px;
    background: rgba(16,24,48,0.72);
    border: 1px solid rgba(96,165,250,0.18);
    border-radius: 28px;
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
    text-align: center;
    animation: lpRise 0.8s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes lpRise { from{opacity:0;transform:translateY(28px) scale(.98);} to{opacity:1;transform:translateY(0) scale(1);} }

/* Avatar */
.lp-avatar {
    width: 88px; height: 88px;
    margin: 0 auto 22px;
    border-radius: 22px;
    background: linear-gradient(150deg, rgba(59,130,246,0.18), rgba(34,197,94,0.12));
    border: 1px solid rgba(96,165,250,0.3);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 40px rgba(59,130,246,0.25);
    animation: lpBob 5s ease-in-out infinite;
    position: relative;
}
.lp-avatar::after {
    content:''; position:absolute; inset:-1px; border-radius:22px;
    background: conic-gradient(from 0deg, transparent, rgba(59,130,246,0.5), transparent 30%);
    animation: lpSpin 6s linear infinite; z-index:-1; opacity:0.6;
}
@keyframes lpBob { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-7px);} }
@keyframes lpSpin { to{transform:rotate(360deg);} }

/* Text */
.lp-title { font-size: 24px; font-weight: 800; letter-spacing: -.3px; line-height: 1.2; margin-bottom: 10px; color: #e8eefc; }
.lp-accent { background: linear-gradient(100deg, #60a5fa, #22c55e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-subtitle { color: #93a4c8; font-size: 14px; line-height: 1.55; margin-bottom: 26px; }

/* Primary button (Atlassian) */
.lp-btn-primary {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px;
    border: none; border-radius: 14px;
    background: linear-gradient(100deg, #3b82f6 0%, #2563eb 100%);
    color: #fff; font-size: 15px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    box-shadow: 0 12px 30px -8px rgba(59,130,246,0.5);
    transition: transform .18s, filter .18s, box-shadow .18s;
    font-family: 'Sora', 'Inter', sans-serif;
}
.lp-btn-primary:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 18px 40px -8px rgba(59,130,246,0.5); }
.lp-btn-primary:active { transform: translateY(0); }

/* Divider */
.lp-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 22px 0 14px;
    color: #93a4c8; font-size: 11px; letter-spacing: .6px;
    font-family: 'Space Mono', monospace;
}
.lp-divider::before, .lp-divider::after {
    content:''; flex:1; height:1px;
    background: linear-gradient(90deg, transparent, rgba(96,165,250,0.25), transparent);
}

.lp-note { color: #93a4c8; font-size: 12.5px; line-height: 1.5; margin-bottom: 16px; }
.lp-note b { color: #60a5fa; font-weight: 600; }

/* Input fields */
.lp-field {
    position: relative; margin-bottom: 10px;
}
.lp-field svg {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 17px; height: 17px; color: #93a4c8; pointer-events: none;
    transition: color .2s;
}
.lp-field input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(8,13,28,0.6);
    border: 1px solid rgba(96,165,250,0.18);
    border-radius: 12px;
    color: #e8eefc; font-size: 14px; font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.lp-field input::placeholder { color: #5e6f93; }
.lp-field input:hover { border-color: rgba(96,165,250,0.35); }
.lp-field input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.18); }
.lp-field:focus-within svg { color: #60a5fa; }

/* Secondary button (SSO-less) */
.lp-btn-secondary {
    width: 100%; margin-top: 4px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px;
    border: 1px solid rgba(96,165,250,0.28); border-radius: 12px;
    background: rgba(96,165,250,0.06);
    color: #e8eefc; font-size: 14px; font-weight: 500; font-family: inherit;
    cursor: pointer;
    transition: background .2s, border-color .2s, transform .15s;
}
.lp-btn-secondary:hover { background: rgba(96,165,250,0.14); border-color: #3b82f6; transform: translateY(-1px); }
.lp-btn-secondary:active { transform: translateY(0); }

/* Status indicator */
.lp-status {
    margin-top: 20px;
    font-size: 11px; letter-spacing: .5px; color: #93a4c8;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: 'Space Mono', monospace;
}
.lp-led {
    width: 8px; height: 8px; border-radius: 50%;
    background: #22c55e; box-shadow: 0 0 8px #22c55e;
    animation: lpBlink 2s ease-in-out infinite;
}
@keyframes lpBlink { 0%,100%{opacity:1;} 50%{opacity:.3;} }

.login-card {
    text-align: center;
    padding: 48px 40px;
    max-width: 400px;
}

.login-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-light);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.login-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.login-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.6;
}

.atlassian-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 28px;
    background: linear-gradient(135deg, #0052cc 0%, #0065ff 100%);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 600;
    transition: all var(--transition);
    box-shadow: 0 4px 14px rgba(0, 82, 204, 0.3);
}

.atlassian-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 82, 204, 0.4);
}

.atlassian-login-btn:active {
    transform: translateY(0);
}

/* --- Local Login Section (below Atlassian button) --- */
.local-login-section {
    margin-top: 20px;
    padding-top: 0;
    text-align: center;
}

.local-login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.local-login-divider::before,
.local-login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #e1e4e8);
}
.local-login-divider-text {
    font-size: 11px;
    color: var(--text-tertiary, #9aa0a6);
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.local-login-note {
    font-size: 11px;
    color: var(--text-tertiary, #9aa0a6);
    margin-bottom: 14px;
    line-height: 1.5;
}

.local-login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
}

/* Input groups with icon */
.login-input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.login-input-icon {
    position: absolute;
    left: 13px;
    color: var(--text-tertiary, #9aa0a6);
    pointer-events: none;
    transition: color 0.15s;
    flex-shrink: 0;
}
.login-input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid var(--border, #e1e4e8);
    border-radius: 10px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-primary, #1a1d23);
    background: var(--surface, #fff);
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.login-input::placeholder { color: var(--text-tertiary, #9aa0a6); }
.login-input:hover {
    border-color: #c5cfe4;
}
.login-input:focus {
    border-color: var(--primary, #1a73e8);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
    background: var(--surface, #fff);
}
.login-input-group:focus-within .login-input-icon {
    color: var(--primary, #1a73e8);
}

/* Continue without SSO button */
.local-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px 20px;
    background: var(--surface, #fff);
    color: var(--primary, #1a73e8);
    border: 1.5px solid var(--primary, #1a73e8);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
    margin-top: 2px;
    box-shadow: 0 1px 3px rgba(26,115,232,0.08);
}
.local-login-btn:hover {
    background: var(--primary, #1a73e8);
    color: #fff;
    box-shadow: 0 4px 14px rgba(26,115,232,0.25);
    transform: translateY(-1px);
}
.local-login-btn:active { transform: translateY(0); }

/* Dark mode */
body.dark-mode .login-input {
    background: #1e2030;
    border-color: #2d3748;
    color: #e2e8f0;
}
body.dark-mode .login-input:focus {
    border-color: #5b9aff;
    box-shadow: 0 0 0 3px rgba(91,154,255,0.15);
    background: #252840;
}
body.dark-mode .login-input::placeholder { color: #4a5568; }
body.dark-mode .local-login-btn {
    background: transparent;
    border-color: #5b9aff;
    color: #5b9aff;
}
body.dark-mode .local-login-btn:hover {
    background: #5b9aff;
    color: #fff;
}
body.dark-mode .local-login-divider::before,
body.dark-mode .local-login-divider::after { background: #2d3748; }

/* --- Chat Body --- */
.chat-body {
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

/* --- Messages Area --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(180deg, #fafbfc 0%, #f5f6f8 100%);
}

/* --- Custom Scrollbar --- */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* --- Message Bubbles --- */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    animation: messageAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

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

.message.bot {
    align-self: flex-start;
    background: var(--surface);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.message.user {
    align-self: flex-end;
    background: var(--user-bg);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.25);
}

/* --- Ticket Cards --- */
.message.bot .ticket-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 10px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.message.bot .ticket-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.ticket-card .ticket-key {
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    letter-spacing: -0.2px;
}

.ticket-card .ticket-key:hover {
    text-decoration: underline;
}

.ticket-card .ticket-summary {
    margin-top: 5px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.ticket-card .ticket-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ticket-card .ticket-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-hover);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
}

/* --- Keywords --- */
.keywords-used {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.keywords-used span {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    margin: 0 2px;
    font-weight: 500;
}

/* --- Ticket Preview --- */
.ticket-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
}

.ticket-preview-field {
    margin-bottom: 14px;
}

.ticket-preview-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.ticket-preview-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: all var(--transition);
    background: var(--surface-hover);
}

.ticket-preview-field textarea:focus,
.ticket-preview-field input:focus,
.ticket-preview-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

.ticket-preview-field input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all var(--transition);
    background: var(--surface-hover);
}

.ticket-preview-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.ticket-preview-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    background: var(--surface-hover);
    transition: all var(--transition);
    cursor: pointer;
}

.required {
    color: var(--red);
    font-weight: normal;
}

.ticket-preview-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

/* --- Triage Card --- */
.triage-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.triage-card:hover {
    box-shadow: var(--shadow-md);
}

/* --- Solution Analysis Card --- */
.solution-analysis {
    background: var(--surface);
    border: 1px solid #c8e6c9;
    border-left: 4px solid var(--green);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.solution-analysis:hover {
    box-shadow: var(--shadow-md);
}

/* --- Template Grid --- */
.template-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.template-btn {
    padding: 7px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--primary);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.template-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.template-btn:active {
    transform: translateY(0);
}

/* --- File Upload --- */
.file-upload-area {
    margin-top: 10px;
    display: flex;
    align-items: center;
}

.file-upload-btn {
    display: inline-block;
    padding: 8px 18px;
    background: linear-gradient(135deg, var(--primary) 0%, #4285f4 100%);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.25);
}

.file-upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.35);
}

/* --- Input Area --- */
.chat-input-area {
    padding: 12px 16px 10px;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
}

.chat-form {
    display: flex;
    gap: 8px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px 4px 4px 6px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.chat-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-md);
}

.chat-form input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: transparent;
    color: var(--text-primary);
}

.chat-form input::placeholder {
    color: var(--text-tertiary);
}

.chat-form button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    background: linear-gradient(135deg, var(--primary) 0%, #4285f4 100%);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.chat-form button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
}

.chat-form button:active {
    transform: scale(0.95);
}

.chat-form button:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* --- Action Buttons --- */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    animation: messageAppear 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-buttons button {
    padding: 9px 20px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.action-buttons button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.action-buttons button:active {
    transform: translateY(0);
}

.action-buttons button.primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4285f4 100%);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.25);
}

.action-buttons button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.35);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
}

.action-buttons button.primary:active {
    transform: translateY(0);
}

.action-buttons button.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--surface-alt);
    color: var(--text-secondary);
    border-color: var(--border);
    pointer-events: auto;
}
.action-buttons button.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* --- Typing Indicator --- */
.typing-indicator {
    display: inline-flex;
    gap: 5px;
    padding: 10px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

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

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* --- Toolbar --- */
.chat-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px 4px 2px;
    justify-content: center;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid var(--border-light);
    background: var(--surface);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.toolbar-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.toolbar-btn svg {
    opacity: 0.7;
}

.toolbar-btn:hover svg {
    opacity: 1;
}

/* --- Knowledge Base Card --- */
.kb-card {
    background: var(--yellow-light);
    border: 1px solid #fff3cd;
    border-left: 4px solid var(--yellow);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark-mode {
    --primary: #5b9aff;
    --primary-dark: #4080e0;
    --primary-light: rgba(91, 154, 255, 0.12);
    --primary-glow: rgba(91, 154, 255, 0.15);
    --surface: #1e2030;
    --surface-hover: #252840;
    --bg: #13141f;
    --bg-pattern: radial-gradient(circle at 20% 50%, rgba(91, 154, 255, 0.04) 0%, transparent 50%),
                  radial-gradient(circle at 80% 20%, rgba(108, 92, 231, 0.04) 0%, transparent 50%);
    --text-primary: #e2e4e9;
    --text-secondary: #9aa0b0;
    --text-tertiary: #6b7080;
    --border: #2a2d42;
    --border-light: #22253a;
    --bot-bg: rgba(30, 32, 48, 0.9);
    --user-bg: linear-gradient(135deg, #3a6fd8 0%, #5b9aff 100%);
    --header-bg: linear-gradient(135deg, #1a1d35 0%, #252a50 40%, #2d3560 100%);
    --green: #55efc4;
    --green-light: rgba(85, 239, 196, 0.1);
    --yellow: #ffeaa7;
    --yellow-light: rgba(255, 234, 167, 0.08);
    --red: #fab1a0;
    --red-light: rgba(250, 177, 160, 0.08);
    color: var(--text-primary);
    background: var(--bg);
    background-image: var(--bg-pattern);
}

body.dark-mode .chat-container {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

body.dark-mode .chat-header {
    background: var(--header-bg);
}

body.dark-mode .chat-messages {
    background: linear-gradient(180deg, #171928 0%, #13141f 100%);
}

body.dark-mode .message.bot {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .message.user {
    background: var(--user-bg);
    box-shadow: 0 2px 8px rgba(91, 154, 255, 0.2);
}

body.dark-mode .chat-input-area {
    background: var(--surface);
    border-color: var(--border);
}

body.dark-mode .chat-form {
    background: var(--surface-hover);
    border-color: var(--border);
}

body.dark-mode .chat-form:focus-within {
    border-color: var(--primary);
}

body.dark-mode .chat-form input {
    color: var(--text-primary);
}

body.dark-mode .chat-form button {
    background: linear-gradient(135deg, #3a6fd8 0%, #5b9aff 100%);
}

body.dark-mode .ticket-preview {
    background: var(--surface);
    border-color: var(--border);
}

body.dark-mode .ticket-preview-field textarea,
body.dark-mode .ticket-preview-field input,
body.dark-mode .ticket-preview-field select {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

body.dark-mode .ticket-preview-field textarea:focus,
body.dark-mode .ticket-preview-field input:focus,
body.dark-mode .ticket-preview-field select:focus {
    border-color: var(--primary);
    background: #1a1d35;
}

body.dark-mode .solution-analysis {
    background: var(--surface);
    border-color: var(--border);
    border-left-color: var(--green);
}

body.dark-mode .triage-card {
    background: var(--surface);
    border-color: var(--border);
    border-left-color: var(--primary);
}

body.dark-mode .ticket-card {
    background: var(--surface);
    border-color: var(--border);
}

body.dark-mode .ticket-card:hover {
    border-color: var(--primary);
}

body.dark-mode .template-btn {
    background: var(--surface-hover);
    color: var(--primary);
    border-color: var(--border);
}

body.dark-mode .template-btn:hover {
    background: var(--primary-light);
}

body.dark-mode .action-buttons button {
    border-color: var(--border);
    background: var(--surface-hover);
    color: var(--text-primary);
}

body.dark-mode .action-buttons button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

body.dark-mode .action-buttons button.primary {
    background: linear-gradient(135deg, #3a6fd8 0%, #5b9aff 100%);
    color: #fff;
    border: none;
}

body.dark-mode .action-buttons button.primary:hover {
    background: linear-gradient(135deg, #2d5fc0 0%, #4a88ee 100%);
    color: #fff;
}

body.dark-mode .toolbar-btn {
    background: var(--surface-hover);
    color: var(--text-secondary);
    border-color: var(--border);
}

body.dark-mode .toolbar-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

body.dark-mode .kb-card {
    background: var(--yellow-light);
    border-color: rgba(255, 234, 167, 0.15);
    border-left-color: var(--yellow);
}

body.dark-mode a {
    color: var(--primary);
}

body.dark-mode .login-section {
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

body.dark-mode .login-card h2 {
    color: var(--text-primary);
}

body.dark-mode .login-card p {
    color: var(--text-secondary);
}

body.dark-mode .login-icon {
    background: var(--primary-light);
}

body.dark-mode .login-icon svg {
    stroke: var(--primary);
}

body.dark-mode .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .keywords-used span {
    background: var(--primary-light);
    color: var(--primary);
}

body.dark-mode .ticket-card .ticket-meta span {
    background: var(--surface-hover);
}

body.dark-mode .ticket-preview-meta {
    border-top-color: var(--border);
}

body.dark-mode .file-upload-btn {
    background: linear-gradient(135deg, #3a6fd8 0%, #5b9aff 100%);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    body {
        align-items: stretch;
    }

    .chat-container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .chat-header {
        padding: 12px 14px;
    }

    .header-logo {
        width: 34px;
        height: 34px;
    }

    .header-logo svg {
        width: 22px;
        height: 22px;
    }

    .header-text h1 {
        font-size: 15px;
    }

    .chat-messages {
        padding: 14px;
        gap: 10px;
    }

    .message {
        max-width: 92%;
        font-size: 13px;
        padding: 10px 13px;
    }

    .chat-input-area {
        padding: 10px 12px 8px;
    }

    .action-buttons {
        gap: 6px;
    }

    .action-buttons button {
        padding: 8px 14px;
        font-size: 12px;
    }

    .chat-toolbar {
        gap: 3px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .toolbar-btn {
        padding: 4px 10px;
        font-size: 10px;
    }

    .toolbar-btn svg {
        width: 12px;
        height: 12px;
    }

    .ticket-preview-row {
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 400px) {
    .header-text h1 {
        font-size: 14px;
    }

    .chat-header p {
        font-size: 11px;
    }

    .header-link {
        display: none;
    }

    .logout-btn {
        font-size: 11px;
        padding: 4px 10px;
    }
}

/* ============================================================
   FEATURE: Ticket Status Timeline
   ============================================================ */
.timeline {
    border-left: 3px solid var(--border);
    margin: 10px 0 10px 8px;
    padding-left: 16px;
}

.timeline-item {
    position: relative;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--surface);
}

.timeline-item.active {
    color: var(--primary);
    font-weight: 600;
}

.timeline-item.active::before {
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

body.dark-mode .timeline {
    border-left-color: var(--border);
}

body.dark-mode .timeline-item::before {
    border-color: var(--surface);
}

/* ============================================================
   FEATURE: Similar Ticket Warning
   ============================================================ */
.similar-warning {
    background: var(--yellow-light);
    border: 1px solid var(--yellow);
    border-left: 4px solid var(--yellow);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 10px 0;
    font-size: 13px;
}

.similar-warning-title {
    font-weight: 600;
    color: #856404;
    margin-bottom: 6px;
}

.similar-warning-item {
    padding: 4px 0;
}

.similar-warning-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.similar-warning-item a:hover {
    text-decoration: underline;
}

body.dark-mode .similar-warning {
    background: rgba(253, 203, 110, 0.1);
    border-color: rgba(253, 203, 110, 0.3);
}

body.dark-mode .similar-warning-title {
    color: var(--yellow);
}

/* ============================================================
   FEATURE: Smart Brand Suggestions (Recent Brands)
   ============================================================ */
.recent-brands {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.recent-brand-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(26, 115, 232, 0.2);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.recent-brand-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

body.dark-mode .recent-brand-btn {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--border);
}

/* ============================================================
   FEATURE: Chat History Cards
   ============================================================ */
.chat-history-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.chat-history-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    max-width: 220px;
    min-width: 160px;
}

.chat-history-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.chat-history-card .history-brand {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.chat-history-card .history-concern {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-history-card .history-date {
    color: var(--text-tertiary);
    font-size: 11px;
    margin-top: 4px;
}

body.dark-mode .chat-history-card {
    background: var(--surface);
    border-color: var(--border);
}

/* ============================================================
   FEATURE: Voice Input Button
   ============================================================ */
.mic-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    background: transparent;
    color: var(--text-tertiary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.mic-btn.recording {
    color: var(--red);
    background: var(--red-light);
    animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(225, 112, 85, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(225, 112, 85, 0); }
}

/* ============================================================
   FEATURE: Notification Bell
   ============================================================ */
.notification-bell {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all var(--transition);
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.25);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-dark);
}

.notification-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 300px;
    max-height: 360px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.notification-dropdown.show {
    display: block;
}

.notification-dropdown-header {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-item {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    cursor: default;
}

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

.notification-item .notif-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.notification-empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
}

body.dark-mode .notification-dropdown {
    background: var(--surface);
    border-color: var(--border);
}

/* ============================================================
   FEATURE: PWA Install Button
   ============================================================ */
.pwa-install-btn {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.pwa-install-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.pwa-install-btn svg {
    width: 14px;
    height: 14px;
}
