:root {
    --bg: #000000; --sidebar: #0b0b10; --text: #f2edff; --input-bg: #131318;
    --border: #232a45; --accent: linear-gradient(135deg, #2563eb, #2563eb 55%, #7c3aed);
    --accent-solid: #3b82f6; --accent-hover: #2563eb;
    --user-msg: linear-gradient(135deg, #2563eb, #2563eb 55%, #7c3aed);
    --ai-msg: #0d0d12; --error: #ff4d4d; --hover-bg: #17171c;
    --code-bg: #0f0f14;
}
.light-theme {
    --bg: #f4f7ff; --sidebar: #ffffff; --text: #0f172a; --input-bg: #eef2fc;
    --border: #d9e1f4; --accent: linear-gradient(135deg, #2563eb, #2563eb 55%, #7c3aed);
    --accent-solid: #2563eb; --accent-hover: #1d4ed8;
    --user-msg: linear-gradient(135deg, #2563eb, #2563eb 55%, #7c3aed);
    --ai-msg: #ffffff; --hover-bg: #edf2ff; --code-bg: #f1f4fc;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif; scrollbar-width: thin; scrollbar-color: #333 #0a0a0a; }
svg { display: block; flex-shrink: 0; width: 1em; height: 1em; }
*::-webkit-scrollbar { width: 6px; height: 6px; background: transparent; }
*::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }
*::-webkit-scrollbar-track { background: transparent; }
body { background: var(--bg); color: var(--text); display: flex; height: 100vh; overflow: hidden; }
body.auth-page { display: block; }

/* LANDING */
.landing-page { position: fixed; inset: 0; z-index: 2000; background: linear-gradient(135deg, #ff00cc 0%, #333399 50%, #00cc99 100%); background-size: 400% 400%; animation: gradientShift 15s ease infinite; display: none; flex-direction: column; justify-content: flex-start; align-items: center; overflow-y: auto; }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.landing-content { text-align: center; z-index: 10; animation: fadeInUp 1s ease; min-height: 100vh; width: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 20px; box-sizing: border-box; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.landing-title { font-size: 80px; font-weight: 900; color: #ffffff; text-shadow: 0 0 20px rgba(0, 255, 255, 0.8), 0 0 40px rgba(0, 255, 255, 0.6); letter-spacing: 8px; margin-bottom: 20px; }
.landing-subtitle { font-size: 24px; color: rgba(255, 255, 255, 0.9); margin-bottom: 60px; letter-spacing: 3px; font-weight: 300; font-style: italic; }
.start-btn { padding: 18px 60px; background: transparent; border: 2px solid #00ffff; color: #00ffff; font-size: 18px; font-weight: 700; letter-spacing: 4px; cursor: pointer; border-radius: 8px; transition: all 0.3s ease; box-shadow: 0 0 20px rgba(0, 255, 255, 0.4); }
.start-btn:hover { background: rgba(0, 255, 255, 0.1); box-shadow: 0 0 40px rgba(0, 255, 255, 0.6); transform: translateY(-2px); }
/* Landing page SEO content (crawlable, below the full-screen hero). */
.seo-section { position: relative; z-index: 10; width: 100%; max-width: 1100px; margin: 0 auto 48px; padding: 0 24px; box-sizing: border-box; color: #fff; }
.seo-inner { background: rgba(6, 10, 18, 0.62); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 24px; padding: 42px 40px; backdrop-filter: blur(12px); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); }
.seo-inner h2 { font-size: 30px; line-height: 1.25; margin: 0 0 14px; letter-spacing: -0.01em; }
.seo-inner h2 + .seo-lead { margin-top: 0; }
.seo-lead { font-size: 16px; line-height: 1.7; color: rgba(255, 255, 255, 0.82); max-width: 760px; margin-bottom: 30px; }
.seo-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 36px; }
.seo-feature { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px; padding: 18px 18px 16px; }
.seo-feature h3 { font-size: 16px; margin: 0 0 8px; color: #9ef7ff; }
.seo-feature p { font-size: 14px; line-height: 1.6; margin: 0; color: rgba(255, 255, 255, 0.78); }
.seo-faq { display: flex; flex-direction: column; gap: 10px; margin-bottom: 30px; }
.seo-faq details { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px; padding: 14px 18px; }
.seo-faq summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.seo-faq details p { margin: 10px 0 0; font-size: 14px; line-height: 1.65; color: rgba(255, 255, 255, 0.78); }
.seo-cta-row { text-align: center; margin: 6px 0 0; }
.seo-cta { padding: 15px 42px; font-size: 15px; }
.seo-footer { text-align: center; padding: 22px 12px 40px; font-size: 13px; color: rgba(255, 255, 255, 0.72); }
.seo-footer a { color: #9ef7ff; text-decoration: none; }
.seo-footer a:hover { text-decoration: underline; }
.seo-footer span { margin: 0 8px; }
@media (max-width: 640px) {
    .seo-inner { padding: 26px 20px; }
    .seo-inner h2 { font-size: 23px; }
    .seo-lead { font-size: 15px; }
}

/* LOGIN */
.login-screen { position: fixed; inset: 0; z-index: 1500; background: linear-gradient(135deg, #6600cc 0%, #00cc99 100%); background-size: 400% 400%; animation: gradientShift 15s ease infinite; display: none; justify-content: center; align-items: center; overflow-y: auto; padding: 20px; }
.login-container { background: rgba(10, 10, 20, 0.95); border: 1px solid rgba(0, 255, 255, 0.3); border-radius: 20px; padding: 50px 40px; width: 90%; max-width: 450px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 255, 255, 0.2); backdrop-filter: blur(10px); animation: fadeInUp 0.6s ease; margin: auto; max-height: 90vh; overflow-y: auto; }
@media (max-height: 700px) { .login-screen { align-items: flex-start; padding-top: 30px; } .login-container { margin: 20px auto; } }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1, .login-header h2 { font-size: 36px; font-weight: 900; background: linear-gradient(135deg, #00ffff, #ff00cc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 4px; margin-bottom: 10px; }
.login-header p { color: rgba(255, 255, 255, 0.7); font-size: 14px; }
.auth-tabs { display: flex; gap: 10px; margin-bottom: 25px; }
.auth-tab { flex: 1; padding: 12px; background: rgba(0,0,0,0.3); border: 1px solid rgba(0,255,255,0.3); border-radius: 10px; color: rgba(255,255,255,0.7); cursor: pointer; font-weight: 600; transition: 0.3s; text-align: center; }
.auth-tab.active { background: rgba(0,255,255,0.2); border-color: #00ffff; color: #00ffff; }
.login-label { color: #00ffff; font-size: 12px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; display: block; }
.login-form input { width: 100%; padding: 14px 18px; margin-bottom: 15px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(0, 255, 255, 0.3); border-radius: 10px; color: #ffffff; font-size: 15px; outline: none; transition: all 0.3s ease; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; margin-bottom: 15px; }
.pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; font-size: 16px; padding: 4px; margin-top: -7px; }
.pw-toggle:hover { color: #00ffff; }
.login-form input:focus { border-color: #00ffff; box-shadow: 0 0 20px rgba(0, 255, 255, 0.3); }
.login-form input::placeholder { color: rgba(255, 255, 255, 0.5); }
.login-btn { width: 100%; padding: 14px; border: none; border-radius: 10px; background: linear-gradient(135deg, #00ffff, #ff00cc); color: #ffffff; font-size: 16px; font-weight: 700; letter-spacing: 3px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 10px 30px rgba(0, 255, 255, 0.3); margin-bottom: 15px; }
.login-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 15px 40px rgba(0, 255, 255, 0.5); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.back-link { display: block; text-align: center; color: rgba(255,255,255,0.6); font-size: 14px; cursor: pointer; margin-top: 10px; }
.back-link:hover { color: #00ffff; }
.auth-msg { font-size: 13px; margin-bottom: 15px; text-align: center; min-height: 18px; }
.auth-msg.error { color: #ff4d4d; }
.auth-msg.success { color: #00ff88; }

/* SIDEBAR */
.sidebar { width: 280px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; height: 100vh; overflow-y: auto; overflow-x: hidden; transition: transform 0.3s ease; z-index: 100; scrollbar-width: thin; scrollbar-color: #2a2f36 #111315; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 15px; }
.z-logo { width: 42px; height: 42px; min-width: 42px; min-height: 42px; flex-shrink: 0; aspect-ratio: 1; background: linear-gradient(135deg, #0066ff, #6366f1, #8b5cf6); color: white; display: flex; align-items: center; justify-content: center; font-family: 'Algerian', 'Cambria', serif; font-weight: 400; font-size: 28px; border-radius: 12px; box-shadow: 0 0 12px rgba(99,102,241,0.3); }
.brand h2 { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.sidebar-actions { padding: 10px 15px; display: flex; flex-direction: column; gap: 8px; }
.btn { padding: 12px; background: transparent; border: none; border-radius: 8px; color: var(--text); cursor: pointer; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; transition: 0.2s; }
.btn:hover { background: var(--hover-bg); }
.btn.primary { background: var(--accent-solid); color: white; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--error); }
.btn.danger:hover { background: rgba(255, 77, 77, 0.2); }
.btn.info { color: var(--accent-solid); }
.btn.info:hover { background: var(--hover-bg); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn.primary svg { fill: white; stroke: white; }
.chat-list { flex: 1; min-height: 160px; overflow-y: auto; padding: 0 10px; }
.chat-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 14px; color: #ccc; transition: 0.2s; }
.chat-item:hover, .chat-item.active { background: var(--hover-bg); color: var(--text); }
.chat-item .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat-item .actions { display: none; gap: 5px; }
.chat-item:hover .actions { display: flex; }
.chat-item .actions button { background: none; border: none; color: #888; cursor: pointer; font-size: 14px; padding: 2px; }
.chat-item .actions button:hover { color: var(--accent-solid); }
.bottom-bar { border-top: 1px solid var(--border); padding: 10px 15px; display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; max-height: 50vh; overflow-y: auto; }
.bottom-bar .btn { font-size: 13px; padding: 8px 10px; }
.sidebar-tools-toggle { width: 100%; padding: 8px 10px; background: transparent; border: 1px solid var(--border); border-radius: 8px; color: #888; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.sidebar-tools-toggle:hover { background: var(--hover-bg); color: var(--text); }
.sidebar-tools-toggle svg { width: 14px; height: 14px; transition: transform 0.2s; }
.sidebar-tools-toggle.open svg { transform: rotate(180deg); }
.sidebar-tools { display: none; flex-direction: column; gap: 5px; padding-top: 5px; }
.sidebar-tools.open { display: flex; }
.user-profile-bar { border-top: 1px solid var(--border); padding: 15px; display: flex; align-items: center; gap: 10px; background: var(--input-bg); min-width: 0; flex-shrink: 0; margin-top: auto; position: sticky; bottom: 0; z-index: 10; }
.user-profile-bar .user-avatar { width: 32px; height: 32px; min-width: 32px; min-height: 32px; flex-shrink: 0; aspect-ratio: 1; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; font-size: 14px; }
.user-profile-bar .user-meta { flex: 1; min-width: 0; overflow: hidden; }
.user-profile-bar .uname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-profile-bar .logout-btn { background: none; border: none; color: var(--error); cursor: pointer; font-size: 12px; margin-left: auto; flex-shrink: 0; }

/* HAMBURGER */
.hamburger { display: none; position: fixed; top: 15px; left: 15px; z-index: 101; background: var(--sidebar); border: 1px solid var(--border); border-radius: 10px; width: 42px; height: 42px; align-items: center; justify-content: center; cursor: pointer; color: var(--text); transition: opacity 0.2s, transform 0.2s; }
.hamburger.hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }
.hamburger svg { width: 22px; height: 22px; }

/* MOBILE TOP BAR (username + logout, always visible) */
.mobile-topbar { display: none; position: fixed; top: 0; left: 0; right: 0; height: 52px; background: var(--sidebar); border-bottom: 1px solid var(--border); z-index: 100; align-items: center; gap: 10px; padding: 0 12px 0 66px; }
.mobile-uname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--text); }
.mobile-logout { background: none; border: none; color: var(--error); font-size: 12px; cursor: pointer; flex-shrink: 0; padding: 6px 8px; border-radius: 6px; }
.mobile-logout:hover { background: var(--hover-bg); }

/* MAIN */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
#chat-container { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: #333 #0a0a0a; }
#chat-container::-webkit-scrollbar, .chat-list::-webkit-scrollbar, .modal-content::-webkit-scrollbar { width: 6px; background: transparent; }
#chat-container::-webkit-scrollbar-thumb, .chat-list::-webkit-scrollbar-thumb, .modal-content::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 3px; }
#chat-container::-webkit-scrollbar-track, .chat-list::-webkit-scrollbar-track, .modal-content::-webkit-scrollbar-track { background: transparent; }
.chat-list, .modal-content { scrollbar-width: thin; scrollbar-color: #333 #0a0a0a; }
#scroll-down-btn { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; background: #1a1a1a; border: 1px solid #2a2a2a; color: #e5e5e5; display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
#scroll-down-btn:hover { background: #222; }
#scroll-down-btn svg { width: 18px; height: 18px; }
.msg-wrapper { display: flex; flex-direction: column; max-width: 85%; animation: fadeIn 0.3s; position: relative; }
.msg-wrapper.user { align-self: flex-end; align-items: flex-end; }
.msg-wrapper.assistant { align-self: flex-start; align-items: flex-start; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.msg-bubble { padding: 14px 20px; border-radius: 18px; line-height: 1.7; word-wrap: break-word; position: relative; overflow-wrap: break-word; max-width: 100%; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.user .msg-bubble { background: var(--user-msg); color: white; border-bottom-right-radius: 6px; }
.assistant .msg-bubble { background: var(--ai-msg); border: 1px solid var(--border); border-bottom-left-radius: 6px; box-shadow: 0 2px 12px rgba(0,0,0,0.15); }
.msg-bubble pre { background: var(--code-bg); border-radius: 8px; padding: 12px; overflow-x: auto; margin: 8px 0; }
.msg-bubble code { font-family: 'Fira Code', 'Consolas', monospace; font-size: 13px; }
.msg-bubble :not(pre) > code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.msg-actions { display: flex; gap: 6px; margin-top: 6px; }
.msg-actions button { background: none; border: 1px solid var(--border); color: #888; cursor: pointer; font-size: 11px; padding: 3px 8px; border-radius: 6px; transition: 0.2s; display: flex; align-items: center; gap: 4px; }
.msg-actions button svg { width: 12px; height: 12px; }
.msg-actions button:hover { color: var(--accent-solid); border-color: var(--accent-solid); }

/* WELCOME */
.welcome-message { text-align: center; margin: auto; display: flex; flex-direction: column; justify-content: center; align-items: center; animation: fadeInUp 0.6s ease; padding: 40px 20px; }
.welcome-z-logo { width: 72px; height: 72px; background: linear-gradient(135deg, #0066ff, #6366f1, #8b5cf6); color: white; display: flex; align-items: center; justify-content: center; font-family: 'Algerian', 'Cambria', serif; font-weight: 400; font-size: 38px; border-radius: 16px; margin: 0 auto 20px; box-shadow: 0 8px 32px rgba(99,102,241,0.3); }
.welcome-message h2 { font-size: 28px; margin-bottom: 6px; color: var(--text); font-weight: 700; }
.welcome-message h2 span { background: var(--accent); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.welcome-message .welcome-sub { color: #888; margin: 6px 0 30px; font-size: 15px; }
.welcome-bubble { background: var(--ai-msg); border: 1px solid var(--border); border-radius: 18px; border-bottom-left-radius: 6px; padding: 20px 28px; max-width: 600px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); text-align: left; }
.welcome-bubble h3 { color: var(--accent-solid); font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.welcome-bubble h3 svg { width: 20px; height: 20px; }
.welcome-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.welcome-feature { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #aaa; padding: 8px 12px; border-radius: 8px; background: var(--hover-bg); transition: 0.2s; }
.welcome-feature:hover { background: var(--input-bg); color: var(--text); }
.welcome-feature svg { width: 16px; height: 16px; flex-shrink: 0; }

/* INPUT */
.input-wrapper { padding: 15px; background: transparent; display: flex; flex-direction: column; gap: 8px; }
.composer-box { display: flex; flex-direction: column; align-items: stretch; gap: 0; background: var(--input-bg); border: 1px solid var(--border); border-radius: 22px; padding: 10px 12px 8px; }
.composer-box:focus-within { border-color: var(--accent-solid); }
.composer-tools { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
/* The tools scroll sideways rather than wrapping, so the box never jumps in height. */
.ct-scroll { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; padding-bottom: 1px; }
.ct-scroll::-webkit-scrollbar { display: none; }
/* A soft fade on whichever end still has more to scroll to. */
.ct-scroll { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); }
.ct-scroll.at-start { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent 100%); mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent 100%); }
.ct-scroll.at-end { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px); mask-image: linear-gradient(90deg, transparent 0, #000 14px); }
.ct-scroll.at-start.at-end { -webkit-mask-image: none; mask-image: none; }
.ct-sep { flex: none; width: 1px; height: 18px; margin: 0 4px; background: var(--border); }
.ct-right { display: flex; align-items: center; gap: 6px; flex: none; }
.composer-icon { font-size: 13px; cursor: pointer; color: #888; background: transparent; border: none; padding: 7px 10px; transition: 0.18s; border-radius: 10px; display: flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.composer-icon:hover { color: var(--accent-solid); background: var(--hover-bg); }
.composer-icon.active { color: var(--accent-solid); background: rgba(0, 102, 255, 0.15); }
.composer-icon svg { width: 16px; height: 16px; }
.attachments-area { display: none; gap: 10px; flex-wrap: wrap; padding: 0 0 10px; }
.attachments-area.has-items { display: flex; }
.composer-box .attachments-area { width: 100%; box-sizing: border-box; padding: 6px 0 8px; margin: 0; }
.composer-box .attachments-area.has-items { display: flex; padding-bottom: 10px; }
.att-preview { position: relative; border-radius: 12px; overflow: visible; background: transparent; display: flex; align-items: center; }
.att-preview img { width: 64px; height: 64px; object-fit: cover; display: block; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
.remove-att { position: absolute; top: -6px; right: -6px; background: #000; color: white; border: 1px solid rgba(255,255,255,0.2); font-size: 12px; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.5); }
/* File pill/chip used in message bubbles + the attachment bar (fluid + mobile-safe) */
.file-pill { display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 260px; background: #2a2a2a; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; }
.file-pill.msgb { margin-bottom: 8px; }
.att-preview .file-pill { width: 100%; max-width: 260px; margin-bottom: 0; }
.file-pill .fp-ic { width: 36px; height: 36px; border-radius: 8px; background: var(--hover-bg); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.file-pill .fp-info { flex: 1; min-width: 0; }
.file-pill .fp-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.file-pill .fp-sub { font-size: 11px; color: #888; }
.file-pill .fp-x { flex-shrink: 0; background: transparent; color: #888; border: none; font-size: 16px; cursor: pointer; padding: 0; line-height: 1; }
.file-pill .fp-x:hover { color: #fff; }
.file-pill.ftest { width: 100%; max-width: 420px; }
.file-pill .fp-dls { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fp-dls .fp-dl { background: rgba(76,201,240,.12); border: 1px solid rgba(76,201,240,.4); color: #7df0ff; border-radius: 7px; padding: 5px 8px; font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s; }
.fp-dls .fp-dl:hover { background: rgba(76,201,240,.22); color: #fff; }
@media (max-width: 480px) {
    .file-pill, .file-pill.ftest { max-width: 100%; width: 100%; }
    .file-pill .fp-dls { justify-content: flex-start; width: 100%; }
}

/* Generated-file download card: a single, polished card showing exactly the
   format the user asked for, with a persistent shareable download link. */
.file-card { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 460px; box-sizing: border-box; background: linear-gradient(135deg, rgba(124,58,237,.10), rgba(76,201,240,.07)); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin: 10px 0 0; }
.file-card .fc-ic { width: 42px; height: 42px; border-radius: 11px; background: var(--hover-bg); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.file-card .fc-body { flex: 1; min-width: 0; }
.file-card .fc-name { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .fc-sub { font-size: 11.5px; color: #888; margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.file-card .fc-actions { display: flex; gap: 8px; flex-shrink: 0; }
.file-card .fc-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none; font-family: inherit; transition: all .15s; white-space: nowrap; }
.file-card .fc-btn:hover { background: var(--hover-bg); }
.file-card .fc-btn.primary { background: var(--accent-solid); border-color: transparent; color: #fff; }
.file-card .fc-btn.primary:hover { filter: brightness(1.08); }
.file-card .fc-spin { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: #7df0ff; animation: attSpin .7s linear infinite; }
@media (max-width: 480px) {
    .file-card { flex-wrap: wrap; }
    .file-card .fc-actions { width: 100%; }
    .file-card .fc-btn { flex: 1; justify-content: center; }
}
.msg-image { max-width: 280px; border-radius: 12px; margin-bottom: 8px; display: block; border: 1px solid var(--border); }
/* Generated images arrive as markdown -> <img> inside the assistant bubble. Cap
   the size so they never overflow the bubble / overlap the composer, and make
   them clickable so they open in the zoom lightbox. */
.msg-bubble img { max-width: min(100%, 360px); max-height: 420px; width: auto; height: auto; object-fit: contain; border-radius: 12px; margin: 8px 0; display: block; border: 1px solid var(--border); background: var(--code-bg); cursor: zoom-in; }
.msg-bubble img.gen-image { max-width: min(100%, 360px); }
/* "Sketching it out" wait animation shown while a file is generated: a dot-matrix
   grid with a rotating status line and a percentage pill. */
.sk { position: relative; width: 100%; max-width: 520px; background: radial-gradient(130% 120% at 85% -10%, rgba(79,157,255,.06), transparent 55%), #0b0e14; border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px 56px; overflow: hidden; }
.sk-title { font-size: 19px; font-weight: 700; color: #e8eef7; margin: 0 0 20px; letter-spacing: -.01em; }
.sk-grid { display: grid; gap: 14px 16px; }
.sk-d { width: 4px; height: 4px; border-radius: 50%; background: rgba(120,150,190,.20); animation: skPulse 1.6s ease-in-out infinite; }
@keyframes skPulse {
    0%, 100% { background: rgba(120,150,190,.18); transform: scale(1); box-shadow: none; }
    50% { background: #4f9dff; transform: scale(1.55); box-shadow: 0 0 8px rgba(79,157,255,.9); }
}
.sk-pct { position: absolute; right: 18px; bottom: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.08); color: #dfe7f2; font-size: 14px; font-weight: 600; padding: 8px 16px; border-radius: 999px; }
@media (max-width: 640px) { .sk { padding: 16px 16px 48px; } .sk-grid { gap: 10px 11px; } }
.img-lightbox { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px; background: rgba(0,0,0,.9); backdrop-filter: blur(8px); padding: 24px; }
.img-lightbox.open { display: flex; }
.img-lightbox img { max-width: min(92vw, 1400px); max-height: 78vh; width: auto; height: auto; border-radius: 12px; box-shadow: 0 30px 90px rgba(0,0,0,.7); background: #111; }
.img-lightbox-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.img-lightbox-actions button, .img-lightbox-actions a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit; }
.img-lightbox-actions button:hover, .img-lightbox-actions a:hover { background: rgba(255,255,255,.18); }
.img-lightbox-actions .il-close { border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.15); }
.img-lightbox-actions .il-close:hover { background: rgba(239,68,68,.3); }
.img-lightbox-actions .il-dl { border-color: rgba(76,201,240,.5); background: rgba(76,201,240,.15); }
.img-lightbox-actions .il-dl:hover { background: rgba(76,201,240,.28); }
@media (max-width: 480px) {
    .msg-bubble img { max-height: 320px; }
    .img-lightbox img { max-height: 66vh; }
}
.input-col { width: 100%; min-width: 0; display: flex; flex-direction: column; }
#user-input { width: 100%; box-sizing: border-box; background: transparent; border: none; color: var(--text); font-size: 15.5px; line-height: 1.5; resize: none; outline: none; min-height: 26px; max-height: 190px; padding: 4px 2px; font-family: inherit; }
#user-input::placeholder { color: #777; }
#send-btn { color: white; background: var(--accent-solid); border-radius: 50%; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; flex-shrink: 0; transition: transform .15s, opacity .15s; }
#send-btn:hover { transform: scale(1.06); }
#stop-btn { color: #fff; background: var(--error); border-radius: 50%; width: 38px; height: 38px; align-items: center; justify-content: center; border: none; cursor: pointer; flex-shrink: 0; }
#stop-btn svg { width: 16px; height: 16px; }
#send-btn svg { width: 16px; height: 16px; }
#send-btn:disabled { cursor: wait; opacity: .85; }
.att-spin, .snd-spin { display: inline-block; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: #7df0ff; animation: attSpin .7s linear infinite; }
.att-spin { width: 12px; height: 12px; vertical-align: middle; margin-right: 5px; }
.att-spin.chip { width: 11px; height: 11px; margin-right: 2px; }
.snd-spin { width: 12px; height: 12px; flex-shrink: 0; }
.att-spin-overlay { position: absolute; inset: 0; border-radius: 12px; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.att-spin-overlay .att-spin { width: 18px; height: 18px; border-width: 3px; margin: 0; border-color: rgba(255,255,255,.3); border-top-color: #7df0ff; }
.file-pill.uploading { opacity: .75; }
@keyframes attSpin { to { transform: rotate(360deg); } }

/* MODAL */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); justify-content: center; align-items: center; z-index: 200; backdrop-filter: blur(5px); }
.modal-content { background: var(--sidebar); padding: 25px; border-radius: 16px; width: 480px; max-width: 92%; border: 1px solid var(--border); max-height: 85vh; overflow-y: auto; }
details { margin-bottom: 15px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
summary { padding: 12px 15px; background: var(--input-bg); cursor: pointer; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
summary svg { width: 16px; height: 16px; }
.details-content { padding: 15px; }
.modal-content label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: #aaa; }
.modal-content input, .modal-content select, .modal-content textarea { width: 100%; padding: 10px; margin-bottom: 15px; background: var(--input-bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; outline: none; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }

/* ADMIN GOLD THEME — vibrant shimmer + glow */
body.admin-gold { --accent: linear-gradient(135deg, #fff4b0, #FFD700, #FF8C00, #FFD700); --accent-solid: #FFD700; --accent-hover: #ffb347; --user-msg: linear-gradient(135deg, #fff4b0, #FFD700, #FF8C00); }
body.admin-gold .z-logo, body.admin-gold .welcome-z-logo, body.admin-gold .user-profile-bar .user-avatar, body.admin-gold #send-btn { background: linear-gradient(135deg, #fff4b0, #FFD700 40%, #FF8C00 70%, #FFD700 100%); background-size: 220% 220%; animation: gradientShift 4s ease infinite; }
body.admin-gold .z-logo { box-shadow: 0 0 18px rgba(255,215,0,.55), 0 4px 18px rgba(255,140,0,.35); }
body.admin-gold .welcome-z-logo { box-shadow: 0 8px 32px rgba(255,215,0,.5), 0 0 46px rgba(255,215,0,.35); }
body.admin-gold .welcome-message h2 span { background: linear-gradient(90deg, #fff4b0, #FFD700 30%, #FF8C00 50%, #FFD700 70%, #fff4b0 100%); background-size: 220% 100%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; animation: gradientShift 4s ease infinite; filter: drop-shadow(0 0 12px rgba(255,215,0,.4)); }
body.admin-gold .msg-actions button:hover { color: #FFD700; border-color: #FFD700; text-shadow: 0 0 10px rgba(255,215,0,.7); box-shadow: 0 0 14px rgba(255,215,0,.25); }
body.admin-gold .btn.info { color: #FFD700; text-shadow: 0 0 10px rgba(255,215,0,.55); }
body.admin-gold #send-btn { position: relative; overflow: hidden; }
body.admin-gold #send-btn:hover { box-shadow: 0 0 22px rgba(255,215,0,.7); }
body.admin-gold .composer-icon.active { color: #FFD700; background: rgba(255,215,0,.18); box-shadow: 0 0 14px rgba(255,215,0,.35); }
body.admin-gold .composer-icon:hover { color: #FFD700; text-shadow: 0 0 10px rgba(255,215,0,.6); }
body.admin-gold .user-profile-bar .user-avatar { box-shadow: 0 0 14px rgba(255,215,0,.55); }
body.admin-gold .thinking-text { color: #FFD700; text-shadow: 0 0 10px rgba(255,215,0,.65); }
body.admin-gold .streaming-cursor::after { background: #FFD700; box-shadow: 0 0 10px #FFD700; }
body.admin-gold .chat-item .actions button:hover { color: #FFD700; text-shadow: 0 0 10px rgba(255,215,0,.6); }
body.admin-gold #memory-modal h3, body.admin-gold #kb-modal h3, body.admin-gold #files-modal h3, body.admin-gold #security-modal h3, body.admin-gold #code-modal h3, body.admin-gold #kb-items-modal h3, body.admin-gold #kb-items-title { color: #FFD700 !important; text-shadow: 0 0 12px rgba(255,215,0,.45); }
body.admin-gold .composer-box:focus-within { border-color: #FFD700; box-shadow: 0 0 0 1px rgba(255,215,0,.25), 0 0 20px rgba(255,215,0,.3); }

#admin-panel-modal .modal-content {
    background: linear-gradient(145deg, #1a1a0a, #2d2416);
    border: 2px solid #FFD700;
    box-shadow: 0 20px 60px rgba(255,215,0,0.15);
}
#admin-panel-modal .modal-content h3 { color: #FFD700 !important; text-shadow: 0 0 10px rgba(255,215,0,0.3); }
#admin-panel-modal .modal-content input { background: rgba(0,0,0,0.5) !important; border-color: rgba(255,215,0,0.3) !important; color: #FFD700 !important; }
#admin-panel-modal .modal-content input::placeholder { color: rgba(255,215,0,0.4) !important; }
#admin-panel-modal .modal-content input:focus { border-color: #FFD700 !important; box-shadow: 0 0 15px rgba(255,215,0,0.15) !important; }
#admin-panel-modal .btn { color: #FFD700 !important; border-color: rgba(255,215,0,0.3) !important; }
#admin-panel-modal .btn:hover { background: rgba(255,215,0,0.1) !important; }
#close-admin-panel { color: rgba(255,215,0,0.6) !important; border-color: rgba(255,215,0,0.3) !important; }
#close-admin-panel:hover { color: #FFD700 !important; }

/* TOAST */
.toast { position: fixed; top: 20px; right: 20px; background: var(--sidebar); border: 1px solid var(--border); border-left: 4px solid var(--accent-solid); padding: 12px 24px; border-radius: 8px; color: var(--text); z-index: 300; box-shadow: 0 10px 30px rgba(0,0,0,0.3); transform: translateX(120%); transition: transform 0.3s ease; }
.toast.show { transform: translateX(0); visibility: visible; }
/* an idle toast used to peek ~10px in from the right edge (120% of an empty box isn't far enough) */
.toast:not(.show) { transform: translateX(calc(100% + 40px)); visibility: hidden; transition: transform 0.3s ease, visibility 0s linear 0.3s; }
.toast.error { border-left-color: var(--error); }
.toast.success { border-left-color: #00ff88; }

/* STREAMING CURSOR */
.thinking-text { color: var(--accent-solid); font-style: italic; animation: thinkingPulse 1.5s ease-in-out infinite; }
@keyframes thinkingPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.streaming-cursor::after { content: ''; display: inline-block; width: 2px; height: 1em; background: var(--accent-solid); margin-left: 2px; animation: blink 0.8s infinite; vertical-align: text-bottom; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

@media (max-width: 1100px) and (min-width: 901px) {
    .sidebar { width: 60px; min-width: 60px; overflow-y: auto; }
    .brand { justify-content: center; padding: 15px 5px; }
    .brand h2 { display: none; }
    .sidebar-actions { padding: 10px 5px; align-items: center; }
    .sidebar-actions .btn, .bottom-bar .btn { font-size: 0; gap: 0; justify-content: center; padding: 10px; width: 44px; height: 44px; border-radius: 10px; }
    .sidebar-actions .btn svg, .bottom-bar .btn svg { width: 20px; height: 20px; }
    .chat-list { padding: 5px; display: flex; flex-direction: column; align-items: center; gap: 6px; overflow-y: auto; }
    .chat-item { width: 44px; height: 44px; min-height: 44px; justify-content: center; align-items: center; padding: 0; border-radius: 10px; background: var(--input-bg); border: 1px solid transparent; flex-shrink: 0; }
    .chat-item.active { background: var(--hover-bg); border-color: var(--accent-solid); }
    .chat-item .title, .chat-item .actions, .chat-item:hover .actions { display: none !important; }
    .chat-item::before { content: "\25A3"; font-size: 14px; color: var(--text); opacity: 0.7; }
    .chat-item.active::before { opacity: 1; }
    .bottom-bar { padding: 10px 5px; align-items: center; overflow-y: auto; max-height: 50vh; }
    .sidebar-tools { align-items: center; width: 100%; }
    .sidebar-tools .btn { width: 44px; height: 44px; }
    .sidebar-tools-toggle { justify-content: center; font-size: 0; gap: 0; width: 44px; height: 44px; padding: 0; flex-shrink: 0; }
    .sidebar-tools-toggle span, .sidebar-tools .btn span { display: none; }
    .user-profile-bar { justify-content: center; padding: 10px 5px; }
    .user-profile-bar .user-meta, .user-profile-bar .logout-btn { display: none; }
    .ct-right .composer-icon span { display: none; }
    .composer-icon { padding: 7px 9px; }
}
@media (max-width: 900px) {
    .hamburger { display: flex; }
    .hamburger.hidden { display: none !important; }
    .mobile-topbar { display: none; }
    .sidebar.open + .mobile-topbar { display: none; }
    .sidebar { position: fixed; top: 0; left: 0; width: 280px; min-width: 280px; height: 100dvh; height: 100vh; transform: translateX(-100%); box-shadow: none; overflow-y: auto; display: flex; flex-direction: column; }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
    .sidebar-overlay.active { display: block; }
    .main { width: 100%; min-height: 100dvh; }
    .ct-right .composer-icon span { display: none; }
    .composer-icon { padding: 7px 9px; font-size: 12.5px; }
}
/* ========== MOBILE ========== */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .hamburger.hidden { display: none !important; }

    .login-screen { overflow-y: auto; align-items: center; }
    .login-container { margin: 20px auto; }

    .sidebar { position: fixed; top: 0; left: 0; height: 100dvh; height: 100vh; transform: translateX(-100%); box-shadow: none; overflow-y: auto; display: flex; flex-direction: column; }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
    .sidebar-overlay.active { display: block; }
    .chat-list { flex: 1; min-height: 0; max-height: none; overflow-y: auto; }
    .bottom-bar { flex-shrink: 0; }
    .user-profile-bar { flex-shrink: 0; margin-top: auto; position: sticky; bottom: 0; z-index: 10; background: var(--input-bg); }

    .main { width: 100%; min-height: 100dvh; }
    #chat-container { padding: 15px; gap: 14px; flex: 1; overflow-y: auto; }
    .input-wrapper { padding: 10px; gap: 6px; flex-shrink: 0; position: sticky; bottom: 0; background: var(--bg); }
    #search-results { position: fixed; inset: 0; z-index: 60; padding: 15px; padding-top: 20px; background: var(--bg); }

    .msg-wrapper { max-width: 94%; }
    .msg-bubble { padding: 12px 16px; font-size: 14px; }
    .msg-image { max-width: 200px; }
    .msg-actions { flex-wrap: wrap; }

    .welcome-message { padding: 20px 15px; }
    .welcome-z-logo { width: 56px; height: 56px; font-size: 28px; border-radius: 14px; }
    .welcome-message h2 { font-size: 20px; }
    .welcome-message .welcome-sub { font-size: 14px; margin-bottom: 16px; }

    /* Every tool stays reachable: the row swipes sideways instead of hiding things. */
    .composer-box { padding: 9px 10px 7px; border-radius: 18px; }
    /* Icons alone below this width: labels would mean swiping for everything. */
    .composer-icon span { display: none; }
    .composer-icon { padding: 8px; font-size: 12px; }
    .composer-icon svg { width: 18px; height: 18px; }
    .ct-sep { margin: 0 2px; }
    .input-col { min-width: 0; }
    #user-input { font-size: 16px; }   /* 16px stops iPhones zooming in when you tap it */

    .modal-content { width: 96%; padding: 16px; margin: 10px; max-height: 88vh; }
    .modal-content h3 { font-size: 16px; }
    details summary { font-size: 13px; padding: 10px 12px; }

    .landing-title { font-size: 32px; letter-spacing: 3px; }
    .landing-subtitle { font-size: 14px; }
    .start-btn { padding: 14px 36px; font-size: 15px; }
    .login-container { padding: 30px 20px; margin: 15px; }

    #attach-btn span, #mic-btn span { display: none; }
    .bottom-bar { padding: 8px 10px; }
    .bottom-bar .btn { font-size: 12px; padding: 7px 8px; }
    .user-profile-bar { padding: 10px; }
}

@media (max-width: 480px) {
    .landing-title { font-size: 28px; letter-spacing: 2px; }
    .landing-subtitle { font-size: 14px; margin-bottom: 40px; }
    .welcome-message h2 { font-size: 20px; }
    .welcome-bubble h3 { font-size: 14px; }
}

/* Security dashboard responsive */
#security-modal .modal-content {
    max-height: 85vh;
    overflow: auto;
    width: 480px;
    max-width: 92%;
}
#security-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    overflow: auto;
    max-height: 40vh;
    padding-right: 4px;
}
#security-history {
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
    word-break: break-word;
    overflow-wrap: anywhere;
}
#security-history > div {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    #security-modal .modal-content {
        width: 92%;
        max-width: 92%;
        max-height: 85vh;
        overflow: auto;
    }
    #security-stats {
        grid-template-columns: 1fr 1fr;
        max-height: 35vh;
    }
    #security-history {
        max-height: 45vh;
    }
}
@media (max-width: 480px) {
    #security-stats {
        grid-template-columns: 1fr;
    }
}

/* Mobile: billing, voice, broadcast */
@media (max-width: 768px) {
    #billing-cards { grid-template-columns: 1fr !important; }
    #voice-mode-modal > div { padding: 20px 12px !important; }
    #voice-transcript { font-size: 14px !important; max-width: 90vw !important; }
    #attention-modal .modal-content { width: 95% !important; max-width: 95% !important; }
}
/* ---- OWNER THEME (Vibrant Titanium) — shimmering silver, icy glows, frosted panels ---- */
body.admin-owner {
    --bg: #101216;
    --sidebar: #14171b;
    --surface: #1A1D22;
    --cards: #232730;
    --text: #C0C7D1;
    --input-bg: #1A1D22;
    --border: #2b313b;
    --hover-bg: #232730;
    --accent: linear-gradient(135deg, #f4f8ff, #ffffff 30%, #8B949E 60%, #dfe7f5 90%, #f4f8ff);
    --accent-solid: #dfe7f5;
    --accent-hover: #ffffff;
    --user-msg: linear-gradient(135deg, #dfe7f5, #8B949E);
    --ai-msg: #191d21;
    --code-bg: #171a1e;
}
body.admin-owner .z-logo,
body.admin-owner .welcome-z-logo,
body.admin-owner .user-profile-bar .user-avatar,
body.admin-owner #send-btn,
body.admin-owner .btn.primary {
    background: linear-gradient(135deg, #ffffff, #dfe7f5 35%, #8B949E 65%, #eef4ff 90%);
    background-size: 220% 220%;
    animation: gradientShift 4s ease infinite;
}
body.admin-owner .z-logo {
    color: #0f1216;
    border: 1px solid rgba(223,231,245,.5);
    box-shadow: 0 0 20px rgba(223,231,245,.45), 0 4px 18px rgba(139,148,158,.35);
}
body.admin-owner .welcome-z-logo {
    color: #0f1216;
    box-shadow: 0 8px 32px rgba(139,148,158,.4), 0 0 46px rgba(223,231,245,.4);
}
body.admin-owner .brand h2 {
    color: #eef4ff;
    text-shadow: 0 0 12px rgba(223,231,245,.45);
}
body.admin-owner .sidebar {
    background: linear-gradient(180deg, #14171b, #101216);
    border-right: 1px solid rgba(223,231,245,.1);
}
body.admin-owner .btn.primary {
    color: #11151a;
    border: 1px solid rgba(223,231,245,.35);
    box-shadow: 0 0 14px rgba(223,231,245,.25);
}
body.admin-owner .btn.primary:hover {
    box-shadow: 0 0 22px rgba(223,231,245,.45);
}
body.admin-owner .chat-item.active,
body.admin-owner .chat-item:hover {
    background: #232730;
    border-left: 2px solid #dfe7f5;
    box-shadow: inset 0 0 14px rgba(223,231,245,.08);
}
body.admin-owner .user-profile-bar .uname {
    color: #eef4ff;
    text-shadow: 0 0 10px rgba(223,231,245,.5);
}
body.admin-owner .msg-actions button:hover {
    color: #ffffff;
    border-color: #dfe7f5;
    text-shadow: 0 0 10px rgba(223,231,245,.7);
    box-shadow: 0 0 14px rgba(223,231,245,.25);
}
body.admin-owner .btn.info {
    color: #dfe7f5;
    text-shadow: 0 0 10px rgba(223,231,245,.5);
}
body.admin-owner .composer-icon.active {
    color: #ffffff;
    background: rgba(223,231,245,.16);
    box-shadow: 0 0 14px rgba(223,231,245,.35);
}
body.admin-owner .composer-icon:hover {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(223,231,245,.6);
}
body.admin-owner #send-btn {
    color: #11151a;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 18px rgba(223,231,245,.4);
}
body.admin-owner .thinking-text {
    color: #dfe7f5;
    text-shadow: 0 0 10px rgba(223,231,245,.6);
}
body.admin-owner .streaming-cursor::after {
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255,255,255,.8);
}
body.admin-owner .composer-box:focus-within {
    border-color: #dfe7f5;
    box-shadow: 0 0 0 1px rgba(223,231,245,.25), 0 0 20px rgba(223,231,245,.3);
}
body.admin-owner .welcome-message h2 span {
    background: linear-gradient(90deg, #ffffff, #dfe7f5 30%, #8B949E 55%, #ffffff 80%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
    filter: drop-shadow(0 0 10px rgba(223,231,245,.45));
}
body.admin-owner #admin-panel-modal h3 {
    color: #eef4ff;
    text-shadow: 0 0 12px rgba(223,231,245,.4);
    letter-spacing: 3px;
    font-weight: 600;
}
body.admin-owner #admin-stats > div {
    background: #232730;
    border: 1px solid #2c3238;
    box-shadow: inset 0 0 14px rgba(223,231,245,.06);
}
/* Owner — kill all gold, force Vibrant Titanium */
body.admin-owner #admin-panel-modal .modal-content h3 { color: #eef4ff !important; text-shadow: 0 0 12px rgba(223,231,245,.4) !important; }
body.admin-owner #admin-panel-modal .modal-content { background: linear-gradient(160deg, #1A1D22, #232730 70%, #171b20) !important; border: 1px solid rgba(223,231,245,.22) !important; box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 20px rgba(223,231,245,.16) !important; }
body.admin-owner #admin-panel-modal .modal-content input { background: rgba(0,0,0,0.35) !important; border-color: rgba(223,231,245,.3) !important; color: #eef4ff !important; }
body.admin-owner #admin-panel-modal .modal-content input::placeholder { color: rgba(223,231,245,.45) !important; }
body.admin-owner #admin-panel-modal .modal-content input:focus { border-color: #dfe7f5 !important; box-shadow: 0 0 14px rgba(223,231,245,.25) !important; }
body.admin-owner #admin-panel-modal .btn,
body.admin-owner #admin-panel-modal #admin-refresh,
body.admin-owner #admin-panel-modal #close-admin-panel { color: #dfe7f5 !important; border-color: rgba(223,231,245,.35) !important; text-shadow: 0 0 10px rgba(223,231,245,.35); }
body.admin-owner #admin-panel-modal .btn:hover { background: rgba(223,231,245,.1) !important; }
body.admin-owner #admin-filter-buttons button { border-color: rgba(223,231,245,.28) !important; color: #8B949E !important; }
body.admin-owner #admin-filter-buttons button[style*="border-color: rgb(255, 215, 0)"],
body.admin-owner #admin-filter-buttons button[style*="#FFD700"] { border-color: #dfe7f5 !important; color: #eef4ff !important; background: rgba(223,231,245,.16) !important; }
body.admin-owner #admin-users-list [data-action="reset"] { border-color: rgba(223,231,245,.45) !important; color: #dfe7f5 !important; }
body.admin-owner #admin-users-list [data-action="ban"] { border-color: rgba(255,77,77,0.35) !important; }
body.admin-owner .sidebar .btn.info { color: #dfe7f5 !important; border-color: rgba(223,231,245,.18) !important; text-shadow: 0 0 10px rgba(223,231,245,.3); }

/* ---- Generic modal mobile responsiveness ---- */
.modal-content {
    max-width: 92vw;
}
@media (max-width: 768px) {
    .modal-content {
        width: 94% !important;
        max-width: 94% !important;
        max-height: 88vh;
        overflow-y: auto;
        padding: 16px !important;
    }
    #admin-panel-modal .modal-content {
        width: 96% !important;
        max-width: 96% !important;
    }
    #admin-stats {
        grid-template-columns: 1fr 1fr !important;
    }
    #admin-users-list > div {
        flex-direction: column;
        align-items: flex-start !important;
    }
    #staff-chat-modal .modal-content,
    #attention-modal .modal-content {
        width: 96% !important;
        max-width: 96% !important;
    }
}
@media (max-width: 420px) {
    #admin-stats {
        grid-template-columns: 1fr 1fr !important;
    }
    /* Tight enough that all seven tools fit on a narrow phone without swiping. */
    .composer-tools { gap: 5px; }
    .composer-icon { padding: 7px; }
    .ct-scroll { gap: 0; }
    .ct-sep { margin: 0 1px; }
    .ct-right { gap: 3px; }
    #send-btn, #stop-btn { width: 34px; height: 34px; }
}

/* ── Folder groups in the chat list ─────────────────────────────── */
.chat-group { margin-bottom: 8px; }
.chat-group-tag {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--muted);
    text-transform: uppercase;
}

/* ── Message reactions ──────────────────────────────────────────── */
.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.msg-reactions.viewer .reaction-chip.static {
    cursor: default;
    pointer-events: none;
    opacity: .95;
}
.viewer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CC9F0, #6A5CFF);
    color: #fff;
    font-size: 11px;
    flex-shrink: 0;
    margin-right: 2px;
    box-shadow: 0 0 8px rgba(76,201,240,.4);
}
.reaction-chip, .reaction-add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 12px;
    cursor: pointer;
    transition: transform .12s, border-color .12s, background .12s;
}
.reaction-chip:hover, .reaction-add:hover {
    transform: translateY(-1px);
    border-color: rgba(76,201,240,.5);
    background: rgba(76,201,240,.08);
}
.reaction-chip .rc-count { color: var(--muted); font-size: 11px; }
.reaction-chip.mine {
    border-color: #4CC9F0;
    background: rgba(76,201,240,.14);
}
.reaction-add { font-size: 13px; line-height: 1; }
.reaction-picker {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 20px;
    padding: 3px 6px;
}
.reaction-picker button {
    border: none;
    background: none;
    font-size: 15px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 8px;
    line-height: 1;
    transition: transform .1s;
}
.reaction-picker button:hover { transform: scale(1.25); }

/* ── Welcome templates ──────────────────────────────────────────── */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    margin-top: 22px;
    max-width: 640px;
    width: 100%;
}
.template-card {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.template-card:hover {
    transform: translateY(-2px);
    border-color: rgba(76,201,240,.45);
    box-shadow: 0 8px 24px rgba(76,201,240,.12);
}
.tpl-ic { font-size: 20px; }
.tpl-t { font-weight: 700; line-height: 1.3; }
.tpl-t small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; margin-top: 2px; }
/* phones: the welcome block used to keep its 620px desktop width, so the
   greeting and the right-hand column of starter cards ran off-screen */
@media (max-width: 768px) {
    .welcome-message { width: 100%; max-width: 100%; box-sizing: border-box; }
    .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .template-card { padding: 10px 11px; min-width: 0; }
}

/* ── Share & export modal ───────────────────────────────────────── */
.sx-tab {
    transition: background .15s, color .15s;
}
.sx-tab.active {
    background: rgba(76,201,240,.12) !important;
    color: #4CC9F0 !important;
}
.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.export-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}
.export-card:hover {
    transform: translateY(-2px);
    border-color: rgba(76,201,240,.45);
    box-shadow: 0 8px 24px rgba(76,201,240,.14);
}
.ex-ic { font-size: 22px; }
.ex-t { font-weight: 700; font-size: 13px; line-height: 1.3; }
.ex-t small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; margin-top: 2px; }
.ex-go { font-size: 11.5px; color: #4CC9F0; font-weight: 600; margin-top: 2px; }

/* ── PDF export preview (white page) ────────────────────────────── */
.pdf-doc { color: #1a1a1a; }
.pdf-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 3px solid #4CC9F0;
    padding-bottom: 12px;
    margin-bottom: 20px;
    font-weight: 800;
    font-size: 16px;
}
.pdf-logo {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #4CC9F0, #6A5CFF);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
}
.pdf-msg {
    margin: 14px 0;
    padding: 12px 16px;
    border-radius: 10px;
    background: #f4f6f8;
}
.pdf-msg.is-user { background: #eef7fd; border-left: 3px solid #4CC9F0; }
.pdf-msg-role {
    font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
    color: #6b7280; margin-bottom: 5px; font-weight: 600;
}
.pdf-msg-body { font-size: 14px; line-height: 1.7; white-space: normal; }

/* ── Sidebar reminders button styling match ─────────────────────── */
#reminders-open { color: #4CC9F0; }
