/* Self-hosted Fonts — Montserrat (headlines) + Lato (body) */
@font-face {
    font-family: 'Montserrat';
    src: url('../vendor/fonts/montserrat/Montserrat-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../vendor/fonts/montserrat/Montserrat-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../vendor/fonts/montserrat/Montserrat-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../vendor/fonts/montserrat/Montserrat-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Lato';
    src: url('../vendor/fonts/lato/Lato-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Lato';
    src: url('../vendor/fonts/lato/Lato-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Lato';
    src: url('../vendor/fonts/lato/Lato-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Lato';
    src: url('../vendor/fonts/lato/Lato-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

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

:root {
    /* Light Theme Colors */
    --primary-color: #6366f1;
    --primary-hover: #5b5ce8;
    --primary-light: #eef2ff;
    --secondary-color: #ec4899;
    --secondary-hover: #db2777;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-glass-strong: rgba(255, 255, 255, 0.95);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: #6366f1;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --success-color: #10b981;
    --success-light: #d1fae5;
    --error-color: #ef4444;
    --warning-color: #f59e0b;

    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);

    --font-family-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-body: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family: var(--font-family-body);
    --dynamic-font-size: 14px; /* Default font size, will be overridden by JS */
    --font-size-xs: calc(var(--dynamic-font-size) * 0.75);
    --font-size-sm: calc(var(--dynamic-font-size) * 0.875);
    --font-size-base: var(--dynamic-font-size);
    --font-size-lg: calc(var(--dynamic-font-size) * 1.125);
    --font-size-xl: calc(var(--dynamic-font-size) * 1.25);
    --font-size-2xl: calc(var(--dynamic-font-size) * 1.5);

    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-2xl: 1.5rem;

    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.3s ease;
    --transition-slow: all 0.5s ease;

    --z-modal: 1000;
    --z-tooltip: 100;
    --z-dropdown: 50;
    --z-sidebar: 40;
    --z-header: 30;
}

/* Dark Theme Colors — "Rust" palette
 *
 * Light mode stays neutral-workshop (cool slate, indigo brand).
 * Dark mode is intentionally a different surface, not a tonal flip:
 * deep coffee + oxidised-iron rust + copper amber. The hero
 * backgrounds (loading + login SVG) carry the same gradient stops
 * inline so the dark theme reads as one cohesive forge surface
 * rather than "light theme with the lights off".
 *
 * Rust palette anchors:
 *   - rust       #c9502f  primary accent (oxidised iron)
 *   - amber      #e8a030  secondary highlight (copper)
 *   - dark-rust  #b84a25  pressed/active state
 *   - coffee     #1c1a17  base surface
 *   - cream      #f5e9d8  body text
 *   - brass      #c4b39a  secondary text (tarnished)
 */
body.dark-theme {
    /* Override the brand primary in dark mode to rust */
    --primary-color: #c9502f;
    --primary-hover: #a8431f;
    --primary-light: rgba(201, 80, 47, 0.18);
    --secondary-color: #e8a030;          /* copper amber accent */
    --secondary-hover: #d18b1f;

    /* Surfaces — deep coffee base, two warmer tints for elevation */
    --bg-primary: #1c1a17;               /* base */
    --bg-secondary: #252220;             /* container-low */
    --bg-tertiary: #2f2b27;              /* container */
    --bg-glass: rgba(28, 26, 23, 0.8);
    --bg-glass-strong: rgba(28, 26, 23, 0.95);

    /* Text — warm cream / tarnished brass */
    --text-primary: #f5e9d8;
    --text-secondary: #c4b39a;
    --text-tertiary: #8a7f6e;

    --border-color: #3b342d;
    --border-light: #4a4137;
    --border-focus: #c9502f;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.55), 0 10px 10px -5px rgba(0, 0, 0, 0.3);

    /* Editorial gradients — rust forge vibe, used on splash / login */
    --gradient-primary: linear-gradient(135deg, #c9502f 0%, #b84a25 100%);
    --gradient-secondary: linear-gradient(135deg, #e8a030 0%, #c9502f 100%);
    --gradient-accent: linear-gradient(135deg, #f5b942 0%, #c9502f 100%);
    --gradient-bg: linear-gradient(135deg, #c9502f 0%, #e8a030 50%, #b84a25 100%);
}

/* Dark Theme — "Slate" variant
 *
 * The original cool dark theme (indigo brand on slate surfaces). Kept
 * alongside Rust as a second dark choice — applied via the extra
 * `dark-slate` body class on top of `dark-theme`, so all dark-theme
 * specific rules still match while the variables flip to indigo/slate.
 */
body.dark-theme.dark-slate {
    --primary-color: #6366f1;
    --primary-hover: #5b5ce8;
    --primary-light: rgba(99, 102, 241, 0.15);
    --secondary-color: #ec4899;
    --secondary-hover: #db2777;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-glass: rgba(15, 23, 42, 0.8);
    --bg-glass-strong: rgba(15, 23, 42, 0.95);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;

    --border-color: #334155;
    --border-light: #475569;
    --border-focus: #6366f1;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);

    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

/* Slate restores the indigo link colour (rust used copper for links). */
body.dark-theme.dark-slate .message.assistant .message-bubble a {
    color: #60a5fa;
}

/* Dark Theme Specific Overrides */
body.dark-theme .conversation-item.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

body.dark-theme .conversation-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.dark-theme .conversation-title {
    color: var(--text-primary);
}

body.dark-theme .conversation-preview {
    color: var(--text-secondary);
}

body.dark-theme .conversation-time {
    color: var(--text-tertiary);
}

body.dark-theme .persona-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .persona-card.working {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

body.dark-theme .persona-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

body.dark-theme .message.assistant .message-bubble {
    background: var(--bg-secondary);
    backdrop-filter: none;
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .message.assistant .message-bubble strong,
body.dark-theme .message.assistant .message-bubble b {
    color: var(--text-primary);
}

body.dark-theme .message.assistant .message-bubble em,
body.dark-theme .message.assistant .message-bubble i {
    color: var(--text-primary);
}

body.dark-theme .message.assistant .message-bubble a {
    /* Rust theme: links pick up the secondary copper amber so they
     * read as warm-but-legible against the cream message text without
     * fighting the rust primary used for actions. */
    color: var(--secondary-color);
}

body.dark-theme .message.assistant .message-bubble p,
body.dark-theme .message.assistant .message-bubble div,
body.dark-theme .message.assistant .message-bubble span {
    color: inherit;
}

body.dark-theme .message.user .message-bubble {
    background: var(--primary-color);
    color: #ffffff;
}

body.dark-theme .code-block-wrapper {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.dark-theme .code-block-header {
    background: var(--bg-primary);
    border-bottom-color: var(--border-color);
}

body.dark-theme .code-block-wrapper pre {
    background: var(--bg-tertiary);
}

body.dark-theme .code-block-wrapper code {
    color: var(--text-primary);
}

body.dark-theme .message-bubble code {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
    border-color: rgba(99, 102, 241, 0.25);
}

body.dark-theme .message-bubble .code-block-wrapper code {
    color: var(--text-primary);
    background: transparent;
    border: none;
}

body.dark-theme .message-bubble blockquote {
    background: var(--bg-tertiary);
    border-left-color: var(--primary-color);
    color: var(--text-secondary);
}

body.dark-theme .message-bubble hr {
    border-top-color: var(--border-color);
}

body.dark-theme .message.assistant .message-bubble h1,
body.dark-theme .message.assistant .message-bubble h2,
body.dark-theme .message.assistant .message-bubble h3,
body.dark-theme .message.assistant .message-bubble h4 {
    color: var(--text-primary);
}

body.dark-theme .persona-info h4 {
    color: var(--text-primary);
}

body.dark-theme .persona-version {
    color: var(--text-tertiary);
    opacity: 0.7;
}

body.dark-theme .persona-description {
    color: var(--text-secondary);
}

body.dark-theme .company-info {
    border-top-color: var(--border-color);
}

body.dark-theme .company-name {
    color: var(--text-primary);
}

body.dark-theme .company-more-btn {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

body.dark-theme .company-more-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

body.dark-theme .context-checkbox-label {
    color: var(--text-secondary);
}

/* Base Styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    transition: var(--transition-normal);
}

h1, h2, h3, h4 {
    font-family: var(--font-family-heading);
}

h3 {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Solid coffee — no decorative wave SVG; replaced with a clean
     * 0-100% progress bar below for a more deterministic boot
     * feel. The radial gradient from the old loading_background_v2
     * SVG was the "waves" Anders asked us to drop. */
    background: radial-gradient(ellipse at center, #2a2520 0%, #1c1a17 80%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    transition: var(--transition-slow);
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.loading-text {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
}

.loading-spinner {
    /* Legacy spinner — kept for any other view that still uses it.
     * The boot screen now uses the progress bar below. */
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto;
}

/* Boot screen progress bar — replaces the spinner + wave-art bg.
 * 240 px track, 4 px tall, brand-coloured fill driven from app.js
 * across the existing ~2 s boot delay. */
.loading-progress {
    width: 240px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin: 28px auto 12px;
}
.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--brand-primary, #c9502f), #d4a017);
    transition: width 0.18s ease-out;
}
.loading-progress-label {
    font-family: ui-monospace, 'Menlo', 'Consolas', monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.12em;
}

/* Main App Layout */
.app {
    display: flex;
    height: 100vh;
    background: var(--bg-primary);
    transition: var(--transition-normal);
}

.app.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: var(--z-sidebar);
    transition: width var(--transition-normal), min-width var(--transition-normal), border var(--transition-normal);
    flex-shrink: 0;
    min-width: 320px;
}

/* Desktop collapsed state — hides the sidebar completely; toggle button stays in header to re-open */
.sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right-width: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    flex: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary-color);
}

.company-info + .logo {
    margin-bottom: 0.5rem;
}

.company-info {
    margin-left: 2.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

.company-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.company-more-btn {
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.company-more-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.company-more-btn i {
    font-size: 0.75rem;
}

/* -----------------------------------------------------------------
 * Company-context toggle — "warm forge" pill-switch
 *
 * The whole row is a bordered card with a building glyph, a label
 * and a rust-tracked pill-switch on the right. Tinted rust at 6%
 * when active, border deepens to rust on hover. Theme-safe — all
 * colours go through --primary-color / --border-light / --text-* /
 * --bg-secondary tokens which already swap per body theme class.
 *
 * The native <input> stays in the DOM (required by JS contract on
 * CompanyProfileManager.js:145) but is visually hidden; the pill-
 * switch span paints the on/off state and we react to
 * :has(input:checked) so no JS class-toggling is needed.
 * --------------------------------------------------------------- */
/* Slimmed 2026-05-23 per Anders — the previous bordered card with
 * fa-building icon ate too much vertical space in the sidebar header
 * and pushed adjacent menu items off. Now: inline row, no border,
 * no icon, short label + pill switch. The pill switch itself stays
 * as the visual on/off cue (defined further down). */
.company-context-option {
    margin: 0.25rem 0 0;
}

.context-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0.1rem;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    line-height: 1.3;
    transition: color 150ms ease;
}

.context-checkbox-label:hover {
    color: var(--text-primary);
}

.context-checkbox-label:has(input:checked) {
    color: var(--text-primary);
}

.context-checkbox-label:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

.context-checkbox-text {
    flex: 1 1 auto;
    line-height: 1.3;
}

/* Visually hide the native input but keep it interactive + focusable. */
.context-checkbox-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Pill switch — 30 × 16 px track, 12 × 12 px handle. Off = muted
 * grey track + handle at left. On = rust track + handle at right
 * with a subtle 2 px rust glow. */
.context-checkbox-switch {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 30px;
    height: 16px;
    border-radius: 9999px;
    background: var(--border-light);
    border: 1px solid var(--border-color, var(--border-light));
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.context-checkbox-switch-handle {
    position: absolute;
    top: 50%;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    background: var(--bg-primary, #ffffff);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%);
    transition: left 150ms ease, background-color 150ms ease;
}

.context-checkbox-label:has(input:checked) .context-checkbox-switch {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 18%, transparent);
}

.context-checkbox-label:has(input:checked) .context-checkbox-switch-handle {
    left: 16px;
    background: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
    .context-checkbox-label,
    .context-checkbox-icon,
    .context-checkbox-switch,
    .context-checkbox-switch-handle {
        transition-duration: 0.01ms;
    }
}

.company-details-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.company-details-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.company-details-section h4 {
    color: var(--primary-color);
    font-size: var(--font-size-base);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.company-details-section h4 i {
    font-size: var(--font-size-sm);
    opacity: 0.7;
}

.company-details-section p {
    color: var(--text-primary);
    line-height: 1.6;
}

.details-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.details-list li {
    padding: 0.5rem 0;
    color: var(--text-primary);
    position: relative;
    padding-left: 1.5rem;
    line-height: 1.5;
}

.details-list li::before {
    content: '•';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.logo i {
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-controls {
    display: flex;
    gap: 0.5rem;
}

/* Search Container — collapsed by default; toggled open via #search-toggle-btn */
.search-container {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: none;
}

.search-container.expanded {
    display: block;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 0.75rem;
    transition: var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box i {
    color: var(--text-tertiary);
    margin-right: 0.75rem;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.search-clear {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    opacity: 0;
    pointer-events: none;
}

.search-clear.visible {
    opacity: 1;
    pointer-events: auto;
}

.search-clear:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.search-results {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.5rem;
    display: none;
}

.search-results.visible {
    display: block;
}

.search-result {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background: var(--primary-light);
}

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.search-result-snippet {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Conversations */
.conversations-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.conversations-header {
    padding: 1rem 1.5rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversations-header h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.conversations-header .btn-icon {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem;
}

.conversation-count {
    background: var(--primary-color);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
}

/* --- Conversation source filter (pill tabstrip) ------------------------
   Sits under the Conversations header, replaces the native <select> that
   looked OS-styled and out of place. One pill per source type with icon
   + label, compact enough for the sidebar's narrow column. */
.conv-source-tabs {
    display: flex;
    gap: 4px;
    padding: 0 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-color, #2a2d3a);
    margin-bottom: 0.25rem;
}
.conv-source-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 4px;
    font-size: 10px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-muted, #6b7280);
    background: transparent;
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}
.conv-source-tab i { font-size: 10px; opacity: 0.9; }
.conv-source-tab:hover {
    background: var(--bg-tertiary, rgba(255,255,255,0.04));
    color: var(--text-primary, #e5e7eb);
    border-color: var(--primary-color, #3b82f6);
}
/* Active = this source is currently enabled. The filled-primary look
   says 'on' — distinct from the outlined idle state that says 'off'. */
.conv-source-tab.active {
    color: #ffffff;
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
}
.conv-source-tab.active i { opacity: 1; }
.light-theme .conv-source-tab:not(.active):hover,
body.light-theme .conv-source-tab:not(.active):hover {
    background: rgba(0,0,0,0.05);
    color: #1f2937;
}

/* Very narrow sidebars (e.g. mobile collapsed state): hide labels, keep
   icons only so the strip doesn't overflow */
@media (max-width: 340px) {
    .conv-source-tab span { display: none; }
    .conv-source-tab { padding: 6px 0; }
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

body:has(.modal-overlay.visible) .conversations-list {
    overflow-y: hidden;
}

.conversations-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.conversation-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
    position: relative;
}

.conversation-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.conversation-item.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.conversation-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.conversation-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.conversation-time {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.conversation-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: var(--transition-fast);
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.no-conversations {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
}

.no-conversations i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-conversations p {
    margin-bottom: 0.5rem;
}

.no-conversations .subtitle {
    font-size: var(--font-size-sm);
    opacity: 0.7;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
}

/* Header */
.header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    z-index: var(--z-header);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.conversation-info h1 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    cursor: text;
    border-radius: var(--border-radius-sm);
    padding: 0.1rem 0.35rem;
    transition: background 0.15s ease;
}

.conversation-info h1:hover {
    background: var(--bg-tertiary);
}

.conversation-info h1.editing {
    outline: none;
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.conversation-info p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Subtle group separator between header icon clusters
   (Studio | Theme/Settings/Help | User) */
.header-divider {
    display: inline-block;
    width: 1px;
    height: 22px;
    margin: 0 0.25rem;
    background: rgba(255, 255, 255, 0.15);
}
body.light-theme .header-divider,
.light-theme .header-divider {
    background: rgba(0, 0, 0, 0.12);
}

/* ============================================================
   Company Profile — health diagnostics banner (Phase 1)
   Shown at the top of the Company Profile modal when the Azure
   deployment / auth health check returns issues. Each card has a
   'Fix this →' button that deep-links to the relevant config.
   ============================================================ */
.cp-diag-host { margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.cp-diag-loading {
    padding: 14px 16px;
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 8px;
    font-size: 12px; color: var(--text-muted, #6b7280);
    display: flex; align-items: center; gap: 10px;
}
.cp-diag-ok {
    padding: 12px 14px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 8px;
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; color: #86efac;
}
.cp-diag-ok i { font-size: 14px; }
.light-theme .cp-diag-ok, body.light-theme .cp-diag-ok { color: #166534; }

.cp-diag {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px; border-radius: 8px;
    border: 1px solid;
}
.cp-diag-error { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.4); }
.cp-diag-warn  { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.4); }
.cp-diag-info  { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.35); }

.cp-diag-icon {
    flex-shrink: 0; width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.cp-diag-error .cp-diag-icon { background: rgba(239,68,68,0.18); color: #fca5a5; }
.cp-diag-warn  .cp-diag-icon { background: rgba(245,158,11,0.18); color: #fcd34d; }
.cp-diag-info  .cp-diag-icon { background: rgba(59,130,246,0.18); color: #93c5fd; }
.light-theme .cp-diag-error .cp-diag-icon, body.light-theme .cp-diag-error .cp-diag-icon { color: #991b1b; }
.light-theme .cp-diag-warn  .cp-diag-icon, body.light-theme .cp-diag-warn  .cp-diag-icon { color: #92400e; }
.light-theme .cp-diag-info  .cp-diag-icon, body.light-theme .cp-diag-info  .cp-diag-icon { color: #1e40af; }

.cp-diag-body { flex: 1; min-width: 0; }
.cp-diag-title {
    font-size: 13px; font-weight: 600; margin-bottom: 3px;
    color: var(--text-primary, #e5e7eb);
}
.cp-diag-desc {
    font-size: 11px; line-height: 1.5;
    color: var(--text-muted, #6b7280);
}
.cp-diag-action {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 11px; font-weight: 600;
    border: 1px solid currentColor;
    background: transparent;
    color: var(--primary, #3b82f6);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s;
    align-self: center;
}
.cp-diag-action:hover {
    background: rgba(59,130,246,0.15);
}
.cp-diag-action:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Phase 3 — preflight panel inside the diagnostics banner */
.cp-diag-preflight {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(59,130,246,0.04);
    border: 1px dashed rgba(59,130,246,0.3);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cp-diag-preflight-hint {
    font-size: 10px;
    color: var(--text-muted, #6b7280);
}
.cp-preflight-result {
    margin-top: 6px;
    padding: 10px;
    background: var(--bg-secondary, #1a1d27);
    border-radius: 6px;
    font-size: 12px;
}
.light-theme .cp-preflight-result,
body.light-theme .cp-preflight-result {
    background: #f9fafb;
}
.cp-preflight-summary {
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 3px;
    font-size: 12px;
    background: rgba(255,255,255,0.03);
}
.cp-preflight-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cp-preflight-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 11px;
}
.cp-preflight-row i { flex-shrink: 0; }
.cp-preflight-name { font-weight: 600; min-width: 150px; }
.cp-preflight-detail {
    color: var(--text-muted, #6b7280);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cp-preflight-hints {
    margin: 8px 0 0;
    padding-left: 20px;
    font-size: 11px;
    color: var(--text-muted, #6b7280);
}
.cp-preflight-hints li {
    margin-bottom: 4px;
}

/* Pulse-highlight for a config field the banner has deep-linked to.
   2.4s animation matches the JS timeout. */
@keyframes cpDiagPulse {
    0%   { box-shadow: 0 0 0 0 rgba(59,130,246,0.55); border-color: var(--primary, #3b82f6); }
    50%  { box-shadow: 0 0 0 8px rgba(59,130,246,0); border-color: var(--primary, #3b82f6); }
    100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}
.cp-diag-pulse {
    animation: cpDiagPulse 1.2s ease-out 2;
}

/* ============================================================
   Admin feature cards (Require Login, Entra ID SSO)
   — richer than a bare setting-group toggle: icon + title +
     description + proper switch. Used in the Administration modal.
   ============================================================ */
.admin-feature-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}
.admin-feature-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 10px;
    transition: border-color 0.15s, background 0.15s;
}
.admin-feature-card:hover {
    border-color: var(--primary, #3b82f6);
}
.light-theme .admin-feature-card,
body.light-theme .admin-feature-card {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.08);
}

.admin-feature-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
/* Colour variants per card purpose */
.admin-feature-security .admin-feature-icon {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}
.admin-feature-microsoft .admin-feature-icon {
    background: rgba(0, 120, 212, 0.15);
    color: #00a4ef;  /* Microsoft brand cyan */
}
.admin-feature-timezone .admin-feature-icon {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

/* Timezone picker host (combobox + save indicator) */
.admin-feature-tz {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 220px;
}
.admin-feature-tz-status {
    display: inline-block;
    width: 14px; height: 14px;
    font-size: 12px;
}
.admin-feature-tz-status.saved   { color: #22c55e; }
.admin-feature-tz-status.saving  { color: var(--text-muted, #6b7280); }
.admin-feature-tz-status.error   { color: #ef4444; }

/* ============================================================
   Timezone combobox — searchable dropdown with full zone list
   ============================================================ */
.tz-combobox {
    position: relative;
    display: inline-block;
    min-width: 220px;
}
.tz-combobox-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    font-size: 12px;
    font-family: inherit;
    background: var(--bg-secondary, #1a1d27);
    color: var(--text-primary, #e5e7eb);
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.tz-combobox-button:hover,
.tz-combobox-open .tz-combobox-button {
    border-color: var(--primary, #3b82f6);
}
.tz-combobox-open .tz-combobox-button {
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}
.light-theme .tz-combobox-button,
body.light-theme .tz-combobox-button {
    background: #ffffff;
    color: #1f2937;
    border-color: #d1d5db;
}
.tz-combobox-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tz-combobox-chevron {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.15s;
}
.tz-combobox-open .tz-combobox-chevron {
    transform: rotate(180deg);
}

.tz-combobox-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 260px;
    z-index: 1000;
    background: var(--bg-secondary, #1a1d27);
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    overflow: hidden;
}
.tz-combobox-open .tz-combobox-panel { display: block; }
.light-theme .tz-combobox-panel,
body.light-theme .tz-combobox-panel {
    background: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.tz-combobox-search {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color, #2a2d3a);
}
.tz-combobox-search i { opacity: 0.5; font-size: 12px; }
.tz-combobox-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 12px;
    color: var(--text-primary, #e5e7eb);
}
.light-theme .tz-combobox-search input,
body.light-theme .tz-combobox-search input {
    color: #1f2937;
}

.tz-combobox-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
}
.tz-combobox-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-primary, #e5e7eb);
    transition: background 0.08s;
}
.tz-combobox-item:hover,
.tz-combobox-item.tz-active {
    background: rgba(59,130,246,0.15);
}
.light-theme .tz-combobox-item,
body.light-theme .tz-combobox-item {
    color: #1f2937;
}
.light-theme .tz-combobox-item:hover,
.light-theme .tz-combobox-item.tz-active {
    background: rgba(59,130,246,0.08);
}
.tz-combobox-item.tz-selected {
    font-weight: 600;
}
.tz-combobox-item.tz-selected i {
    color: var(--primary, #3b82f6);
    font-size: 11px;
}

.tz-combobox-empty {
    padding: 16px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
}

.admin-feature-body {
    flex: 1;
    min-width: 0;
}
.admin-feature-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-primary, #e5e7eb);
}
.admin-feature-desc {
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-muted, #6b7280);
}

/* Full-size switch (bigger than the compact one in the user dropdown) */
.admin-feature-switch {
    position: relative;
    flex-shrink: 0;
    width: 42px;
    height: 24px;
    cursor: pointer;
}
.admin-feature-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.admin-feature-switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color, #3a3a4a);
    border-radius: 24px;
    transition: background 0.18s;
}
.admin-feature-switch-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.18s;
}
.admin-feature-switch input:checked + .admin-feature-switch-slider {
    background: var(--primary, #3b82f6);
}
.admin-feature-switch input:checked + .admin-feature-switch-slider::before {
    transform: translateX(18px);
}
.admin-feature-switch input:focus-visible + .admin-feature-switch-slider {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* ============================================================
   Personal Business Memos tab (in info-summary-modal)
   ============================================================ */
.personal-memo-header {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #2a2d3a);
}
.personal-memo-header h4 { margin: 0 0 4px; font-size: 14px; }
.personal-memo-header p { margin: 0 0 10px; font-size: 12px; color: var(--text-muted, #6b7280); }
.personal-memo-search {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary, #1a1d27);
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 6px;
}
.personal-memo-search i { opacity: 0.5; font-size: 12px; }
.personal-memo-search input {
    flex: 1; background: transparent; border: none; outline: none;
    color: inherit; font-size: 12px; font-family: inherit;
}
.personal-memo-list { display: flex; flex-direction: column; gap: 6px; max-height: 500px; overflow-y: auto; }
.personal-memo-empty { padding: 40px 12px; text-align: center; color: var(--text-muted, #6b7280); font-size: 12px; }
.pm-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 8px;
    transition: border-color 0.15s;
}
.pm-row:hover { border-color: var(--primary, #3b82f6); }
.pm-row-icon {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(59,130,246,0.12); color: #60a5fa;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pm-row-body { flex: 1; min-width: 0; }
.pm-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.pm-email { color: var(--text-muted, #6b7280); font-size: 11px; }
.pm-role {
    font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 1px 6px; border-radius: 3px; font-weight: 600;
}
.pm-role-admin { background: rgba(239,68,68,0.15); color: #fca5a5; }
.pm-role-moderator { background: rgba(245,158,11,0.15); color: #fcd34d; }
.pm-role-user { background: rgba(59,130,246,0.12); color: #93c5fd; }
.pm-row-meta {
    display: flex; gap: 10px; margin-top: 3px;
    font-size: 11px; color: var(--text-muted, #6b7280);
    flex-wrap: wrap;
}
.pm-schedule i { margin-right: 4px; opacity: 0.7; }
.pm-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pm-btn {
    padding: 5px 10px; font-size: 11px; font-weight: 500;
    background: transparent; color: var(--text-primary, #e5e7eb);
    border: 1px solid var(--border-color, #2a2d3a); border-radius: 5px;
    cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
    transition: background 0.12s, border-color 0.12s;
}
.pm-btn:hover { background: rgba(59,130,246,0.1); border-color: var(--primary, #3b82f6); }
.pm-btn-close {
    border: none; background: transparent; padding: 4px 8px;
    color: var(--text-muted, #6b7280); font-size: 14px; cursor: pointer;
}
.pm-toggle {
    position: relative; display: inline-block;
    width: 36px; height: 20px; cursor: pointer;
}
.pm-toggle input { opacity: 0; width: 0; height: 0; }
.pm-toggle-slider {
    position: absolute; inset: 0;
    background: var(--border-color, #3a3a4a);
    border-radius: 20px; transition: background 0.15s;
}
.pm-toggle-slider::before {
    content: ''; position: absolute;
    height: 14px; width: 14px; left: 3px; top: 3px;
    background: white; border-radius: 50%;
    transition: transform 0.15s;
}
.pm-toggle input:checked + .pm-toggle-slider { background: var(--primary, #3b82f6); }
.pm-toggle input:checked + .pm-toggle-slider::before { transform: translateX(16px); }

/* Preview modal for latest personal memo */
.pm-preview-backdrop {
    position: fixed; inset: 0; z-index: 10001;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
}
.pm-preview-modal {
    width: 720px; max-width: 95vw; max-height: 85vh;
    background: var(--bg-secondary, #1a1d27);
    color: var(--text-primary, #e5e7eb);
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 12px;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.pm-preview-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color, #2a2d3a);
    display: flex; align-items: center; gap: 12px;
}
.pm-preview-header h3 { flex: 1; font-size: 14px; margin: 0; }
.pm-preview-meta { font-size: 11px; color: var(--text-muted, #6b7280); }
.pm-preview-content {
    padding: 18px;
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 12px; line-height: 1.5;
    white-space: pre-wrap; word-wrap: break-word;
    overflow-y: auto;
    flex: 1;
    background: var(--bg-tertiary, rgba(255,255,255,0.02));
    margin: 0;
}

/* ============================================================
   Compact personal preferences inside the user dropdown
   (Theme picker + Font size slider + Sound toggle)
   ============================================================ */
.user-dropdown-prefs {
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--border-color, #2a2d3a);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.user-dropdown-pref-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.user-dropdown-pref-row-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}
.user-dropdown-pref-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted, #6b7280);
    font-weight: 600;
}

/* ----- Theme picker (3-way segmented) ----- */
.user-dropdown-theme-options {
    display: flex !important;
    gap: 4px;
    margin: 0 !important;
}
/* Override the heavy .setting-option styling when rendered inside the dropdown */
.user-dropdown-theme-options .setting-option {
    flex: 1;
    padding: 6px 4px !important;
    font-size: 11px !important;
    gap: 4px !important;
    min-height: 0 !important;
    border-radius: 4px !important;
    flex-direction: row !important;
    white-space: nowrap;
    justify-content: center !important;
}
.user-dropdown-theme-options .setting-option i {
    font-size: 12px !important;
    margin: 0 !important;
}
.user-dropdown-theme-options .setting-option span {
    font-size: 11px;
}

/* ----- Font size (slider + live value) ----- */
.user-dropdown-font {
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-dropdown-font input[type="range"] {
    flex: 1;
    accent-color: var(--primary, #3b82f6);
    background: transparent;
    cursor: pointer;
}
.user-dropdown-font #font-size-value {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: right;
}

/* ----- Sound toggle (inline switch) ----- */
.user-dropdown-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    cursor: pointer;
}
.user-dropdown-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.user-dropdown-switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color, #3a3a4a);
    border-radius: 18px;
    transition: background 0.15s;
}
.user-dropdown-switch-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.15s;
}
.user-dropdown-switch input:checked + .user-dropdown-switch-slider {
    background: var(--primary, #3b82f6);
}
.user-dropdown-switch input:checked + .user-dropdown-switch-slider::before {
    transform: translateX(14px);
}

/* ============================================================
   Command Palette launcher (chip-style button in header)
   ============================================================ */
.cp-launcher {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: inherit;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.cp-launcher:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}
.light-theme .cp-launcher,
body.light-theme .cp-launcher {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
.light-theme .cp-launcher:hover {
    background: rgba(0, 0, 0, 0.08);
}
.cp-launcher .cp-launcher-hint { opacity: 0.8; }
.cp-launcher-kbd {
    font-size: 10px; font-family: monospace;
    padding: 1px 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    opacity: 0.7;
}
.light-theme .cp-launcher-kbd {
    border-color: rgba(0, 0, 0, 0.15);
}
@media (max-width: 768px) {
    .cp-launcher .cp-launcher-hint,
    .cp-launcher .cp-launcher-kbd { display: none; }
}

/* ============================================================
   Command Palette (Ctrl/Cmd+K)
   ============================================================ */
.cp-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 15vh;
    backdrop-filter: blur(2px);
}
.cp-modal {
    width: 560px; max-width: 92vw;
    background: var(--bg-secondary, #1a1d27);
    color: var(--text-primary, #e5e7eb);
    border: 1px solid var(--border-color, #2a2d3a);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex; flex-direction: column;
    max-height: 70vh;
}
.light-theme .cp-modal,
body.light-theme .cp-modal {
    background: #ffffff;
    color: #1f2937;
    border-color: #d1d5db;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.cp-search {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #2a2d3a);
}
.light-theme .cp-search { border-color: #e5e7eb; }
.cp-search-icon { opacity: 0.6; font-size: 14px; }
#cp-input {
    flex: 1;
    background: transparent;
    border: none; outline: none;
    color: inherit;
    font-size: 15px;
    font-family: inherit;
}
.cp-esc, .cp-item-enter {
    font-size: 10px; padding: 2px 6px;
    border: 1px solid var(--border-color, #374151);
    border-radius: 4px;
    opacity: 0.6; font-family: monospace;
}
.cp-footer kbd {
    font-size: 10px; padding: 1px 5px;
    border: 1px solid var(--border-color, #374151);
    border-radius: 3px;
    margin: 0 2px; font-family: monospace;
}
.cp-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.cp-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted, #6b7280);
    padding: 10px 16px 4px;
    font-weight: 600;
}
.cp-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
}
.cp-item-active,
.cp-item:hover {
    background: rgba(59, 130, 246, 0.15);
}
.light-theme .cp-item-active,
.light-theme .cp-item:hover {
    background: rgba(59, 130, 246, 0.08);
}
.cp-icon {
    width: 24px; text-align: center;
    color: var(--primary, #3b82f6);
    font-size: 14px;
    flex-shrink: 0;
}
.cp-item-body { flex: 1; min-width: 0; }
.cp-item-label {
    font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cp-item-hint {
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cp-item-enter { opacity: 0; }
.cp-item-active .cp-item-enter { opacity: 1; }
.cp-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
}
.cp-footer {
    border-top: 1px solid var(--border-color, #2a2d3a);
    padding: 8px 16px;
    font-size: 11px;
    color: var(--text-muted, #6b7280);
    display: flex; gap: 16px;
    flex-shrink: 0;
}
.light-theme .cp-footer { border-color: #e5e7eb; }

/* User Menu Dropdown */
.user-menu-container {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-primary);
}

.user-dropdown-items {
    padding: 8px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
}

.user-dropdown-item i {
    width: 16px;
    color: var(--text-secondary);
}

/* User logged in state */
#user-btn.logged-in #user-icon {
    color: var(--accent-color);
}

/* User role badge */
.user-role-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
}

.user-role-badge.admin {
    background: #dc354520;
    color: #dc3545;
}

.user-role-badge.moderator {
    background: #fd7e1420;
    color: #fd7e14;
}

.user-role-badge.user {
    background: #28a74520;
    color: #28a745;
}

.btn-icon-small {
    padding: 4px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

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

.btn-small {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-small:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
}

/* Users list in management modal */
.users-list {
    max-height: 300px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
}

.user-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-item-email {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-item-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.user-item-role.admin {
    background: #dc354520;
    color: #dc3545;
}

.user-item-role.moderator {
    background: #fd7e1420;
    color: #fd7e14;
}

.user-item-role.user {
    background: #28a74520;
    color: #28a745;
}

.user-item-actions {
    display: flex;
    gap: 8px;
}

.user-item-actions select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
}

.user-item-actions .btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* User edit form (inline within user-item) */
.user-edit-form {
    width: 100%;
}

.user-edit-form .form-group {
    margin-bottom: 8px;
    flex: 1;
}

.user-edit-form .form-group label {
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 2px;
    display: block;
    color: var(--text-secondary);
}

.user-edit-form .form-control {
    font-size: 13px;
    padding: 6px 8px;
}

.user-edit-form-row {
    display: flex;
    gap: 10px;
}

.user-edit-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

/* Company Logo Styling */
.company-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    margin: 0 auto;
    height: 48px;
    width: 200px;
}

.company-logo {
    max-height: 48px;
    max-width: 200px;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Ensure SVG logos scale properly */
.company-logo[src$=".svg"] {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

/* Dark theme adjustments for logo */
.dark-theme .company-logo {
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.1));
}

/* Auto theme uses dark logo in dark mode */
.auto-theme .company-logo {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@media (prefers-color-scheme: dark) {
    .auto-theme .company-logo {
        filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.1));
    }
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    scroll-behavior: smooth;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
}

.welcome-content {
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    width: 100%;
}

.welcome-logo {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content h2 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.welcome-content p {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.welcome-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 100%;
}

.suggestion-chip-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.suggestion-chip {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    padding-right: 3rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
    cursor: pointer;
}

.suggestion-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.suggestion-edit-btn {
    position: absolute;
    right: 0.5rem;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, color 0.3s;
    font-size: 0.85rem;
}

.suggestion-chip-wrapper:hover .suggestion-edit-btn {
    opacity: 0.7;
}

.suggestion-edit-btn:hover {
    opacity: 1 !important;
    color: var(--primary-color);
}

.suggestion-edit-input {
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}

/* Follow-up suggestion pills (after AI responses) */
.follow-up-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 3.5rem 1rem;
    animation: messageSlideIn 0.3s ease-out;
}

.follow-up-pill {
    padding: 0.5rem 1rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    max-width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
}

.follow-up-pill:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--primary-color);
}

.follow-up-pill:active {
    transform: scale(0.98);
}

/* Messages */
.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: messageSlideIn 0.3s ease-out;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin: 0 0.75rem;
    flex-shrink: 0;
}

.message-avatar.user {
    background: var(--gradient-secondary);
    color: white;
}

.message-avatar.assistant {
    background: var(--gradient-primary);
    color: white;
    padding: 2px;
}

.persona-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-primary);
}

/* Persona Selection Modal */
.persona-search-container {
    margin-bottom: 1.5rem;
}

.persona-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.persona-search-box > i {
    position: absolute;
    left: 1rem;
    color: var(--text-tertiary);
    font-size: 1rem;
}

.persona-search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.persona-search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.persona-search-box .search-clear-btn {
    position: absolute;
    right: 3.5rem;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    z-index: 1;
}

.persona-search-box .search-clear-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Persona modal specific styling to prevent double scrollbars */
#persona-modal {
    max-width: 900px; /* Wider for persona grid */
    max-height: 70vh; /* 70% of full site height for better visibility */
    height: 70vh; /* Fixed height at 70% of viewport */
}

#persona-modal .modal-content {
    overflow-y: visible; /* Remove the outer scroll */
    max-height: none; /* Remove height restriction on modal-content */
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 1.5rem 1.5rem 0.5rem 1.5rem; /* Reduce bottom padding to minimize wasted space */
}

/* Settings and Knowledge Management Styling */
.persona-settings-btn,
.persona-knowledge-btn {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 2;
    box-shadow: var(--shadow-sm);
}

.persona-settings-btn:hover,
.persona-knowledge-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.persona-refresh-btn {
    position: absolute;
    bottom: 0.75rem;
    right: 3.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 2;
    box-shadow: var(--shadow-sm);
}

.persona-refresh-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.persona-knowledge-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.persona-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* Settings and Knowledge Modal Styling */
#settings-modal,
#agent-settings-modal,
#knowledge-modal {
    max-width: 700px;
}

/* Settings Modal Specific Styles */
.settings-section {
    margin-bottom: 2rem;
}

.azure-config-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.agent-status-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
}

.agent-status {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-full);
    font-weight: 500;
    font-size: var(--font-size-sm);
}

.agent-status.unconfigured {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.agent-status.configured {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.agent-status.active {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Segoe UI Mono', 'Courier New', monospace;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* System Prompt Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 120px;
    font-family: 'Segoe UI Mono', 'Courier New', monospace;
    line-height: 1.5;
}

#system-prompt-textarea {
    font-size: 0.9rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    min-height: 250px;
}

#system-prompt-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

.system-prompt-section .setting-group {
    margin-bottom: 1rem;
}

.system-prompt-section .btn-secondary {
    font-size: 0.9rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-label > span:not(.toggle-slider) {
    font-weight: 500;
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.toggle-input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 28px;
    background: var(--bg-tertiary);
    border-radius: 14px;
    position: relative;
    transition: var(--transition-fast);
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

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

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

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

.knowledge-upload-section {
    margin-bottom: 2rem;
}

.knowledge-upload-section h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-secondary);
    position: relative;
    user-select: none;
    pointer-events: auto;
}

.file-upload-area * {
    pointer-events: none;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.file-upload-area:active {
    transform: translateY(0);
    box-shadow: none;
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: scale(1.02);
}

.file-upload-area i {
    font-size: 3rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.file-upload-area p {
    margin: 0.5rem 0;
    color: var(--text-primary);
    font-weight: 500;
}

.file-upload-area small {
    color: var(--text-secondary);
}

/* Knowledge Files List */
.knowledge-files-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.knowledge-files-list {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.no-files {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem;
    font-style: italic;
}

.knowledge-file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    margin-bottom: 0.5rem;
    transition: var(--transition-fast);
}

.knowledge-file-item:hover {
    background: var(--bg-tertiary);
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border-radius: var(--border-radius-md);
}

.file-icon i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.file-delete-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-delete-btn:hover {
    background: var(--bg-tertiary);
    color: #ef4444;
}

.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0 1rem 0; /* Added bottom padding for space */
    max-height: calc(70vh - 180px); /* Adjusted for reduced padding */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom scrollbar for webkit browsers */
.persona-grid::-webkit-scrollbar {
    width: 8px;
}

.persona-grid::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.persona-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.persona-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.persona-grid.filtered {
    min-height: 200px;
}

.persona-card.hidden {
    display: none;
}

.no-results-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
}

.persona-card {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    position: relative;
}

.persona-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.persona-card.working {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.persona-card.working::after {
    content: "Available";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.persona-card.not-working {
    opacity: 0.6;
    cursor: not-allowed;
}

.persona-card.not-working::after {
    content: "Coming Soon";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--text-tertiary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.persona-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.persona-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    flex-shrink: 0;
}

.persona-fallback-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Fallback logo styling when persona image fails to load */
.persona-avatar-large.fallback-logo {
    object-fit: contain;
    padding: 10px;
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.persona-info h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.persona-version {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
    font-weight: normal;
    opacity: 0.8;
}

.persona-description {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.4;
    margin-top: 0.5rem;
}

.message-content {
    max-width: 70%;
    position: relative;
}

.message-bubble {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-xl);
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
    /* All corners equally rounded - removed custom bottom-right radius */
}

.message.assistant .message-bubble {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    /* All corners equally rounded - removed custom bottom-left radius */
}

.message-time {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

/* Star Rating System */
.message-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

.star-rating {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.star-rating .star {
    font-size: 1.1rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.star-rating .star:hover {
    color: #fbbf24;
    transform: scale(1.1);
}

.star-rating .star.hover-preview {
    color: #fbbf24;
}

.star-rating .star.filled,
.message .message-bubble .star-rating .star.filled {
    color: #fbbf24 !important;
}

.star-rating .star.filled:hover,
.message .message-bubble .star-rating .star.filled:hover {
    color: #f59e0b !important;
}

.star-rating .star:hover,
.message .message-bubble .star-rating .star:hover {
    color: #fbbf24 !important;
}

.star-rating .star.hover-preview,
.message .message-bubble .star-rating .star.hover-preview {
    color: #fbbf24 !important;
}

.rating-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-left: 0.5rem;
}

.rating-saved {
    font-size: var(--font-size-xs);
    color: var(--success-color);
    margin-left: 0.5rem;
    opacity: 0;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Code Blocks */
.code-block-wrapper {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.code-language {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.copy-code-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-code-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.copy-code-button:active {
    transform: translateY(0);
}

.code-block-wrapper pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    background: var(--bg-secondary);
}

.code-block-wrapper code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre;
    display: block;
}

.message-bubble code {
    background: rgba(99, 102, 241, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.875em;
}

.message-bubble .code-block-wrapper code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre;
    display: block;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

/* Markdown styles in message bubbles */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
    margin: 0.75rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
}

.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child {
    margin-top: 0;
}

.message-bubble h1 {
    font-size: 1.4em;
}

.message-bubble h2 {
    font-size: 1.25em;
}

.message-bubble h3 {
    font-size: 1.1em;
}

.message-bubble h4 {
    font-size: 1em;
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-bubble li {
    margin: 0.25rem 0;
    line-height: 1.5;
}

.message-bubble blockquote {
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    border-left: 3px solid var(--primary-color);
    background: var(--bg-secondary);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    font-style: italic;
    color: var(--text-secondary);
}

.message-bubble hr {
    margin: 1rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.message-bubble a {
    color: var(--primary-color);
    text-decoration: none;
}

.message-bubble a:hover {
    text-decoration: underline;
}

.message.user .message-bubble a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.message.user .message-bubble blockquote {
    border-left-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Typing Indicator */
.message.typing-indicator {
    display: none;
}

.message.typing-indicator.visible {
    display: flex;
    align-items: flex-start;
}

.typing-indicator .message-bubble {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.typing-status {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-style: italic;
    transition: opacity 0.15s ease-in-out;
    min-height: 1.2em;
    white-space: nowrap;
    opacity: 1;
}

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

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

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

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Input Area */
.input-area {
    border-top: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
}

.input-container {
    max-width: 100%;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    padding: 0.75rem 1rem;
    transition: var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 150px;
    min-height: 24px;
}

#message-input:focus {
    outline: none;
    border: none;
}

#search-input:focus {
    outline: none;
    border: none;
}

.input-wrapper textarea::placeholder {
    color: var(--text-tertiary);
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 0.75rem;
}

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

.input-hints {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-hints kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.125rem 0.375rem;
    font-size: var(--font-size-xs);
    font-family: monospace;
}

/* Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.1rem;
}

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

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

/* Azure connection status indicator for company-profile-btn */
#company-profile-btn {
    position: relative;
}

#company-profile-btn .status-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    transition: var(--transition-fast);
}

#company-profile-btn .status-indicator.connected {
    background-color: #22c55e; /* Green */
}

#company-profile-btn .status-indicator.disconnected {
    background-color: #ef4444; /* Red */
    animation: pulse-red 2s infinite;
}

#company-profile-btn .status-indicator.checking {
    background-color: #f59e0b; /* Orange/Yellow */
    animation: pulse-yellow 1s infinite;
}

/* Mirrored Azure status indicator on the header gear button so admins
   see at a glance that something is wrong without opening the admin
   modal. Hidden by default — only shown after checkAzureHealth() has
   resolved (.connected / .disconnected / .checking). */
#settings-btn {
    position: relative;
}
#settings-btn .status-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    display: none;       /* default — invisible until a state class lands */
    transition: var(--transition-fast);
}
#settings-btn .status-indicator.connected,
#settings-btn .status-indicator.disconnected,
#settings-btn .status-indicator.checking {
    display: block;
}
#settings-btn .status-indicator.connected    { background-color: #22c55e; }
#settings-btn .status-indicator.disconnected {
    background-color: #ef4444;
    animation: pulse-red 2s infinite;
}
#settings-btn .status-indicator.checking {
    background-color: #f59e0b;
    animation: pulse-yellow 1s infinite;
}

@keyframes pulse-red {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

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

.btn-send {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1rem;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-2xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: var(--transition-normal);
}

.modal-overlay.visible .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header-actions .btn {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.modal-content {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
    scrollbar-width: thin;
}

/* Delete Confirmation Modal Overlay */
.delete-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-modal) + 5);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.delete-confirm-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.delete-confirm-modal {
    max-width: 420px;
    width: 90%;
}

.delete-confirm-overlay.visible .delete-confirm-modal {
    transform: scale(1) translateY(0);
}

.delete-confirm-message {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-size-base);
    white-space: pre-line;
}

.delete-confirm-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--border-radius-2xl) var(--border-radius-2xl);
}

/* M4estro Warning Modal Overlay */
.m4gentic-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-modal) + 5);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.m4gentic-warning-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.m4gentic-warning-modal {
    max-width: 460px;
    width: 90%;
}

.m4gentic-warning-overlay.visible .m4gentic-warning-modal {
    transform: scale(1) translateY(0);
}

.m4gentic-warning-message {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-size-base);
}

.m4gentic-warning-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--border-radius-2xl) var(--border-radius-2xl);
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.setting-group label.toggle-label {
    display: flex;
    margin-bottom: 0;
}

.setting-options {
    display: flex;
    gap: 0.5rem;
}

.setting-option {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
}

.setting-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.setting-option.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.setting-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.setting-slider input[type="range"] {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    outline: none;
    -webkit-appearance: none;
}

.setting-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.setting-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.setting-toggle {
    display: flex;
    align-items: center;
}

/* Removed duplicate toggle styles - using the correct ones defined earlier */

.help-section {
    margin-bottom: 2rem;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.shortcut:last-child {
    border-bottom: none;
}

.shortcut kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
    font-family: monospace;
    margin-right: 0.25rem;
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.help-section li::before {
    content: '•';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Notifications */
.notifications-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: calc(var(--z-modal) + 10);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: notificationSlideIn 0.3s ease-out;
}

.notification.success {
    border-left: 4px solid #10b981;
}

.notification.error {
    border-left: 4px solid #ef4444;
}

.notification.warning {
    border-left: 4px solid #f59e0b;
}

.notification.info {
    border-left: 4px solid var(--primary-color);
}

.notification-icon {
    font-size: 1.2rem;
}

.notification.success .notification-icon {
    color: #10b981;
}

.notification.error .notification-icon {
    color: #ef4444;
}

.notification.warning .notification-icon {
    color: #f59e0b;
}

.notification.info .notification-icon {
    color: var(--primary-color);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

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

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

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

@keyframes typingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: calc(var(--z-modal) - 1);
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
    }

    .mobile-only {
        display: flex;
    }

    .welcome-suggestions {
        grid-template-columns: 1fr;
    }

    .message-content {
        max-width: 85%;
    }

    .setting-options {
        flex-direction: column;
    }

    .setting-option {
        justify-content: flex-start;
    }

    .shortcuts-list {
        font-size: var(--font-size-sm);
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none;
    }
}

/* File Upload Styles */
/* File upload area styles moved to line 1117 to avoid duplication */

.file-upload-content i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-upload-content p {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.file-upload-content small {
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
}

.current-profile-info {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
}

.profile-summary h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.profile-summary p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.profile-actions {
    display: flex;
    gap: 0.5rem;
}

/* Button Base Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: var(--font-size-sm);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

/* Agent Creation System - Simplified */
.persona-modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.btn-add-agent,
.btn-add-supervisor {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-add-agent:hover,
.btn-add-supervisor:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
}

.btn-add-supervisor {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.btn-add-supervisor:hover {
    background: linear-gradient(135deg, #059669, var(--success-color));
}

#agent-creation-modal {
    max-width: 700px;
    max-height: 85vh;
}

#agent-creation-modal .modal-content {
    max-height: calc(85vh - 100px);
    overflow-y: auto;
    padding: 1.5rem;
}

/* Upload Container */
.agent-upload-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.upload-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.upload-section h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    background: var(--bg-primary);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: scale(1.02);
}

.upload-area i {
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.upload-area p {
    margin: 0.5rem 0;
    color: var(--text-primary);
    font-weight: 500;
}

.upload-area small {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
}

.file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--success-light);
    color: var(--success-color);
    border-radius: var(--border-radius-md);
}

.image-preview {
    margin-top: 1rem;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
}

/* Upload Instructions */
.upload-instructions {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.upload-instructions h4 {
    margin-top: 0;
    color: var(--text-primary);
}

.upload-instructions ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.upload-instructions li {
    margin: 0.5rem 0;
}

.example-format {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
}

.example-format h5 {
    margin-top: 0;
    color: var(--text-primary);
}

.example-format pre {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin: 0.5rem 0 0 0;
}

/* Success Light Color */
:root {
    --success-light: rgba(16, 185, 129, 0.1);
}

/* Azure Service Principal Styles */
.required {
    color: #ef4444;
    font-weight: normal;
    margin-left: 2px;
}

.password-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.password-input-group .form-control {
    flex: 1;
}

.password-input-group .toggle-password {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.password-input-group .toggle-password:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    margin: 10px 0;
    font-size: var(--font-size-sm);
}

.alert.alert-success {
    background-color: #10b98129;
    border: 1px solid #10b981;
    color: #047857;
}

.alert.alert-error {
    background-color: #ef444429;
    border: 1px solid #ef4444;
    color: #b91c1c;
}

.alert.alert-warning {
    background-color: #f5970029;
    border: 1px solid #f59700;
    color: #92400e;
}

.alert.alert-info {
    background-color: #3b82f629;
    border: 1px solid #3b82f6;
    color: #1d4ed8;
}

#company-profile-modal h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: var(--font-size-lg);
}

#company-profile-modal .text-muted.mb-3 {
    display: block;
    margin-bottom: 16px;
}

.ml-2 {
    margin-left: 8px;
}

.text-info {
    color: #3b82f6;
    font-size: 0.85rem;
    display: block;
    margin-top: 4px;
}

.clear-field {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-field:hover {
    background: #ef444429;
    border-color: #ef4444;
    color: #ef4444;
}


/* Collapsible Section Styles */
.collapsible-header {
    cursor: pointer;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.collapsible-header:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.collapsible-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.collapsible-header .toggle-icon {
    transition: transform 0.3s ease;
    color: var(--primary-color);
    font-size: 0.9em;
}

.collapsible-header.active .toggle-icon {
    transform: rotate(90deg);
}

.collapsible-header small {
    display: block;
    margin-top: 4px;
    margin-left: 24px;
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    max-height: 0;
}

.collapsible-content.expanded {
    opacity: 1;
    max-height: 2000px;
}

.collapsible-content .setting-group:first-child {
    margin-top: 12px;
}

/* Notification Click-to-Close */
.notification {
    cursor: pointer;
}

.notification:hover {
    border-color: var(--primary-color);
}

/* Agent Settings Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.loading-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 3rem;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
}

.loading-overlay-text {
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 500;
    text-align: center;
}

.loading-spinner-large {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Flowpipe Logo Branding */
.logo-image-sidebar {
    width: 180px;
    height: auto;
    max-height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.logo-image-sidebar:hover {
    transform: scale(1.05);
}

.logo-image-loading {
    width: 250px;
    height: auto;
    max-height: 60px;
    object-fit: contain;
    margin-bottom: 1rem;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(78, 205, 196, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(78, 205, 196, 0.6));
    }
}

/* Adjust logo container for better alignment */
.sidebar .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    gap: 0;
}

/* Loading screen logo adjustments */
.loading-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

/* Dark theme adjustments for logo */
.dark-theme .logo-image-sidebar {
    filter: drop-shadow(0 2px 4px rgba(255,255,255,0.1));
}

.dark-theme .logo-image-loading {
    /* No filter needed - using white logo for dark theme */
}

/* Mobile responsiveness for logo */
@media (max-width: 768px) {
    .logo-image-sidebar {
        width: 150px;
        max-height: 35px;
    }

    .logo-image-loading {
        width: 200px;
        max-height: 50px;
    }
}

/* Welcome heading: solid dark text in light mode, theme-specific
 * gradient in dark modes (slate gets indigo→purple, rust gets
 * rust→dark-rust). Light mode stays a calm typographic neutral
 * rather than a coloured gradient. */
#welcome-screen h2 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

body.dark-theme #welcome-screen h2 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

/* Brand-secondary tokens — historically teal/mint, now rust/copper
 * to match the round-3 logo recolour. Used for the primary-button
 * hover gradient and any future "alt brand colour" surface. */
:root {
    --primary-color-alt: #c9502f;
    --primary-color-light: #e8a030;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-color-alt), var(--primary-color-light));
    border-color: var(--primary-color-alt);
}

/* Welcome Screen Logo */
.welcome-logo-image {
    width: 300px;
    height: auto;
    max-height: 70px;
    object-fit: contain;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 8px rgba(78, 205, 196, 0.2));
    animation: welcomeFadeIn 1s ease-out;
}

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

/* Remove old welcome-logo icon styling */
.welcome-logo i {
    display: none;
}

/* Modal branding updates */
.modal-header {
    border-bottom: 2px solid var(--primary-color-alt);
}

/* Update notification colors to match brand */
.notification.success {
    border-left: 4px solid var(--primary-color-alt);
}

/* Update active conversation highlight */
.conversation-item.active {
    border-left: 3px solid var(--primary-color-alt);
}

/* Update typing indicator with brand color */
.typing-dots span {
    background: var(--primary-color-alt);
}

/* Mobile adjustments for welcome logo */
@media (max-width: 768px) {
    .welcome-logo-image {
        width: 250px;
        max-height: 60px;
    }
}

/* Dark theme welcome logo */
.dark-theme .welcome-logo-image {
    filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.1));
}

/* Ensure theme-aware logos have no color filters */
.theme-aware-logo {
    /* Remove any color filters to preserve logo colors */
    filter: none !important;
}

/* Add subtle shadows based on theme */
.light-theme .theme-aware-logo {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1)) !important;
}

.dark-theme .theme-aware-logo {
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.05)) !important;
}

/* Danger Button Style */
.btn-danger {
    background: #ef4444;
    color: white;
    border: 1px solid #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: var(--shadow-sm);
}

.btn-danger:active {
    transform: scale(0.98);
}

/* Modal header actions spacing */
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header-actions .btn-danger {
    margin-right: auto;
}

/* Knowledge Overview Cards */
.knowledge-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.knowledge-stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

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

.knowledge-stat-card i {
    font-size: 1.5rem;
    color: var(--primary-color);
    opacity: 0.8;
}

.knowledge-stat-card div {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Knowledge Subsections */
.knowledge-subsection {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.knowledge-subsection h5 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.knowledge-subsection h5 i {
    color: var(--primary-color);
    opacity: 0.7;
}

/* Vector Stores List */
.vector-stores-list,
.search-services-list,
.external-apis-list {
    margin-bottom: 12px;
    min-height: 60px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

.vector-store-item,
.search-service-item,
.api-connection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
}

.vector-store-item:last-child,
.search-service-item:last-child,
.api-connection-item:last-child {
    margin-bottom: 0;
}

.knowledge-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.knowledge-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.knowledge-item-details {
    font-size: 0.85rem;
    color: var(--text-light);
}

.knowledge-item-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.knowledge-item-status.active {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.knowledge-item-status.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.knowledge-item-status.connected {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

/* Small buttons for knowledge sections */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Update knowledge files section styling */
.knowledge-files-section {
    margin-top: 12px;
}

.knowledge-files-list {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-color);
    border-radius: 6px;
    padding: 8px;
}

/* Dark theme adjustments */
.dark-theme .knowledge-stat-card {
    background: var(--surface-color);
}

.dark-theme .knowledge-subsection {
    background: rgba(255, 255, 255, 0.02);
}

.dark-theme .vector-stores-list,
.dark-theme .search-services-list,
.dark-theme .external-apis-list,
.dark-theme .knowledge-files-list {
    background: rgba(0, 0, 0, 0.2);
}

/* Advanced Settings Expandable Section */
.advanced-settings-section {
    margin-top: 20px;
}

.expandable-header {
    cursor: pointer;
    padding: 12px 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.expandable-header:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.expandable-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.expandable-header h4 i {
    transition: transform 0.3s ease;
    color: var(--primary-color);
}

.expandable-header.expanded h4 i {
    transform: rotate(90deg);
}

.expandable-content {
    margin-top: 16px;
    animation: slideDown 0.3s ease;
}

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

.dark-theme .expandable-header {
    background: rgba(255, 255, 255, 0.02);
}

.dark-theme .expandable-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Agent Creation Tabs */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary, #666);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-primary, #333);
}

.tab-btn.active {
    color: var(--primary-color, #2196F3);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color, #2196F3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.agent-form-container {
    max-width: 600px;
    margin: 0 auto;
}

.agent-form-container .form-group {
    margin-bottom: 20px;
}

.agent-form-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-primary, #333);
}

.agent-form-container .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    font-size: 14px;
    background: var(--input-bg, #fff);
    color: var(--text-primary, #333);
}

.agent-form-container textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.agent-form-container .text-muted {
    font-size: 12px;
    color: var(--text-secondary, #666);
    margin-top: 5px;
    display: block;
}

.upload-area.small {
    padding: 15px;
    min-height: 120px;
}

.upload-area.small i {
    font-size: 1.5em;
}

.upload-area.small p {
    margin: 5px 0;
    font-size: 13px;
}

/* Avatar source tabs */
.avatar-source-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.avatar-tab {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-light);
    transition: all 0.2s;
}

.avatar-tab:hover {
    color: var(--primary);
}

.avatar-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.avatar-tab i {
    margin-right: 4px;
}

/* Agent settings — Profile image section */
.agent-image-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 6px;
}
.agent-image-current {
    flex-shrink: 0;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-color);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.agent-image-current img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.agent-image-fallback {
    color: var(--text-tertiary);
    font-size: 3rem;
}
.agent-image-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.agent-image-actions .btn {
    align-self: flex-start;
}
/* When inside the library modal, allow more vertical room */
#persona-image-library-modal .persona-image-grid {
    max-height: 60vh;
}

/* Persona image picker grid */
.persona-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background);
}

.persona-image-grid-loading {
    width: 100%;
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 13px;
}

.persona-image-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}

.persona-image-option:hover {
    border-color: var(--primary);
    transform: scale(1.1);
}

.persona-image-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

.persona-image-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form-actions {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

/* Dark theme adjustments for agent creation */
.dark-theme .tab-nav {
    border-bottom-color: #333;
}

.dark-theme .tab-btn {
    color: #888;
}

.dark-theme .tab-btn:hover {
    color: #ddd;
}

.dark-theme .tab-btn.active {
    color: #4CAF50;
}

.dark-theme .tab-btn.active::after {
    background: #4CAF50;
}

.dark-theme .agent-form-container .form-control {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

.dark-theme .agent-form-container label {
    color: #e0e0e0;
}

/* Version Manager Styles */
.version-section {
    margin-bottom: 2rem;
}

.version-info-card {
    background: var(--card-bg, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.version-number {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color, #2196F3);
}

.version-details {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
}

.version-details div {
    margin: 0.25rem 0;
}

.version-details i {
    width: 20px;
    text-align: center;
    margin-right: 0.5rem;
}

.version-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.version-type-btn {
    background: var(--card-bg, #fff);
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.version-type-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.version-type-btn.active {
    border-color: var(--primary-color, #2196F3);
    background: var(--primary-light, #e3f2fd);
}

.version-type-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.version-type-info strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary, #333);
}

.version-type-info small {
    color: var(--text-secondary, #666);
}

.version-preview {
    text-align: center;
    padding: 0.75rem;
    background: var(--primary-light, #e3f2fd);
    border-radius: 4px;
    color: var(--primary-color, #2196F3);
}

.changelog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.changelog-tag {
    padding: 0.25rem 0.75rem;
    background: var(--card-bg, #f0f0f0);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.changelog-tag:hover {
    background: var(--primary-light, #e3f2fd);
    border-color: var(--primary-color, #2196F3);
    transform: scale(1.05);
}

.changelog-tag.active {
    background: var(--primary-color, #2196F3);
    color: white;
    border-color: var(--primary-color, #2196F3);
}

.experimental-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--warning-light, #fff3cd);
    border: 1px solid var(--warning-border, #ffc107);
    border-radius: 4px;
}

.experimental-toggle label {
    margin: 0;
    cursor: pointer;
}

.experimental-toggle small {
    display: block;
    color: var(--text-secondary, #666);
    margin-top: 0.25rem;
}

.instruction-diff-toggle {
    margin-top: 0.5rem;
}

.version-history-list {
    max-height: 400px;
    overflow-y: auto;
}

.version-history-item {
    padding: 1rem;
    border-left: 3px solid var(--border-color, #e0e0e0);
    margin-bottom: 1rem;
    position: relative;
}

.version-history-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 1.5rem;
    width: 11px;
    height: 11px;
    background: var(--card-bg, #fff);
    border: 2px solid var(--primary-color, #2196F3);
    border-radius: 50%;
}

.version-history-item.current {
    border-left-color: var(--primary-color, #2196F3);
    background: var(--primary-light, #f0f8ff);
}

.version-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.version-history-version {
    font-weight: bold;
    color: var(--primary-color, #2196F3);
}

.version-history-date {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
}

.version-history-changelog {
    font-size: 0.9rem;
    color: var(--text-primary, #333);
    margin: 0.5rem 0;
}

.version-history-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
}

.version-badge {
    padding: 0.125rem 0.5rem;
    background: var(--success-light, #d4edda);
    color: var(--success-dark, #155724);
    border-radius: 12px;
    font-size: 0.75rem;
}

.version-badge.experimental {
    background: var(--warning-light, #fff3cd);
    color: var(--warning-dark, #856404);
}

/* Foundry Version Manager Styles */
.foundry-current-version {
    background: linear-gradient(135deg, var(--primary-light, #e3f2fd) 0%, var(--card-bg, #f8f9fa) 100%);
    border: 2px solid var(--primary-color, #0078d4);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.foundry-version-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.foundry-version-badge i {
    font-size: 2.5rem;
    color: var(--primary-color, #0078d4);
}

.version-number-large {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color, #0078d4);
}

.foundry-version-meta {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
    min-width: 200px;
}

.foundry-version-meta div {
    margin: 0.25rem 0;
}

.foundry-version-meta i {
    width: 20px;
    margin-right: 0.5rem;
    color: var(--primary-color, #0078d4);
}

.foundry-sync-indicator {
    background: var(--success-light, #d4edda);
    color: var(--success, #28a745);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.foundry-sync-indicator i {
    margin-right: 0.5rem;
}

.foundry-not-connected .alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--warning-light, #fff3cd);
    border: 1px solid var(--warning, #ffc107);
    border-radius: 8px;
    color: var(--warning-dark, #856404);
}

.section-description {
    color: var(--text-secondary, #666);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Simplified version history for Foundry */
.version-history-item.foundry-version {
    border-left: 4px solid var(--primary-color, #0078d4);
    background: var(--card-bg, #f8f9fa);
    margin-bottom: 0.75rem;
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    transition: all 0.2s ease;
}

.version-history-item.foundry-version:hover {
    background: var(--primary-light, #e3f2fd);
}

.version-history-item.foundry-version.latest {
    border-left-color: var(--success, #28a745);
    background: var(--success-light, #d4edda);
}

.version-history-item .version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.version-history-item .version-tag {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color, #0078d4);
}

.version-history-item .version-date {
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
}

.version-history-item .version-changelog {
    font-size: 0.9rem;
    color: var(--text-primary, #333);
}

.version-history-item .latest-badge {
    display: inline-block;
    background: var(--success, #28a745);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

/* Dark theme adjustments for version manager */
.dark-theme .version-info-card {
    background: #2a2a2a;
    border-color: #444;
}

.dark-theme .foundry-current-version {
    background: linear-gradient(135deg, #1a3a52 0%, #2a2a2a 100%);
    border-color: #0078d4;
}

.dark-theme .foundry-sync-indicator {
    background: #1a3a2a;
    color: #4CAF50;
}

.dark-theme .foundry-not-connected .alert {
    background: #3a3a2a;
    border-color: #666633;
    color: #ffc107;
}

.dark-theme .version-history-item.foundry-version {
    background: #2a2a2a;
    border-left-color: #0078d4;
}

.dark-theme .version-history-item.foundry-version:hover {
    background: #1a3a52;
}

.dark-theme .version-history-item.foundry-version.latest {
    background: #1a3a2a;
    border-left-color: #4CAF50;
}

.dark-theme .changelog-tag {
    background: #333;
    border-color: #555;
}

.dark-theme .changelog-tag:hover {
    background: #1a3a52;
    border-color: #4CAF50;
}

/* Version Selection Styles */
.version-selector-container {
    background: var(--card-bg, #f8f9fa);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.active-version-display {
    text-align: center;
    margin-bottom: 1rem;
}

.version-badge-large {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--success-light, #d4edda);
    color: var(--success-dark, #155724);
    border: 2px solid var(--success, #28a745);
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.version-badge-large i {
    color: var(--success, #28a745);
}

.version-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.ab-testing-panel {
    background: var(--warning-light, #fff8e6);
    border: 1px solid var(--warning-border, #ffc107);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.ab-testing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ab-testing-header h5 {
    margin: 0;
    color: var(--warning-dark, #856404);
}

.traffic-display {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.version-history-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.version-history-item:hover {
    transform: translateX(5px);
    background: var(--hover-bg, #f0f0f0);
}

.version-history-item.active-version {
    border-left-color: var(--success, #28a745);
    background: var(--success-light, #e8f5e9);
}

.version-switch-btn {
    padding: 0.25rem 0.75rem;
    background: var(--primary-color, #2196F3);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.version-switch-btn:hover {
    background: var(--primary-dark, #1976D2);
    transform: scale(1.05);
}

.version-switch-btn.rollback {
    background: var(--warning, #ff9800);
}

.version-switch-btn:disabled {
    background: var(--disabled, #ccc);
    cursor: not-allowed;
}

.version-comparison-modal {
    max-width: 800px;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.comparison-side {
    padding: 1rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
}

.comparison-side.left {
    background: var(--primary-light, #e3f2fd);
}

.comparison-side.right {
    background: var(--secondary-light, #fce4ec);
}

/* Dark theme adjustments */
.dark-theme .version-selector-container {
    background: #2a2a2a;
}

.dark-theme .version-badge-large {
    background: #1a3a2a;
    color: #4CAF50;
    border-color: #4CAF50;
}

.dark-theme .ab-testing-panel {
    background: #3a3a2a;
    border-color: #666633;
}

.dark-theme .version-history-item:hover {
    background: #333;
}

.dark-theme .version-history-item.active-version {
    background: #1a3a2a;
    border-left-color: #4CAF50;
}

/* Version diff styles */
.diff-line {
    padding: 1px 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-added {
    background: #e6ffec;
    color: #1a7f37;
}

.diff-removed {
    background: #ffebe9;
    color: #cf222e;
    text-decoration: line-through;
}

.dark-theme .diff-added {
    background: #1a3a2a;
    color: #7ee787;
}

.dark-theme .diff-removed {
    background: #3a1a1a;
    color: #f85149;
}

.form-range {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: var(--border-color, #ddd);
    border-radius: 5px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color, #2196F3);
    border-radius: 50%;
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color, #2196F3);
    border-radius: 50%;
    cursor: pointer;
}
/* Welcome Message Configuration Styles */
.suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    transition: all 0.2s;
}

.suggestion-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.suggestion-item .suggestion-text {
    flex: 1;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.suggestion-item .suggestion-actions {
    display: flex;
    gap: 0.5rem;
}

.suggestion-item .btn-icon {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.add-suggestion-container {
    margin-top: 1rem;
}

.welcome-preview-modal {
    max-width: 600px;
    margin: 2rem auto;
}

.preview-welcome-content {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
}

.preview-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.preview-suggestion {
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.preview-suggestion:hover {
    background: var(--primary-color);
    color: white;
}
/* Welcome Screen Suggestions */
.welcome-suggestions {
    margin-top: 2rem;
    width: 100%;
}

.suggestions-title {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: center;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.suggestion-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.suggestion-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.suggestion-card i {
    color: var(--primary-color);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.suggestion-card span {
    flex: 1;
}

.persona-welcome-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.welcome-content h2 {
    margin-top: 1rem;
}

/* =============================================
   Cost Calculator Modal Styles
   ============================================= */

.calculator-modal {
    max-width: 900px;
    width: 95%;
}

.calculator-modal .modal-content {
    max-height: 75vh;
}

.calculator-modal .modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calculator-modal .modal-header h3 i {
    color: var(--primary-color);
}

.calculator-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: var(--font-size-sm);
}

.calculator-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.calculator-section:last-of-type {
    margin-bottom: 1rem;
}

.calculator-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.calculator-section-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.calculator-section-icon.embeddings-icon {
    background: linear-gradient(135deg, #0078d4, #00a4ef);
}

.calculator-section-icon.chat-icon {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.calculator-section-header h4 {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 600;
    margin: 0;
}

.calculator-section-desc {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    margin: 0.25rem 0 0 0;
}

.calculator-section .setting-group {
    margin-bottom: 1rem;
}

.calculator-section .setting-group:last-child {
    margin-bottom: 0;
}

.calculator-input-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.calculator-input-row.three-col {
    grid-template-columns: repeat(3, 1fr);
}

.calculator-chat-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.calculator-results-panel {
    background: var(--bg-primary);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.calculator-results-title {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.calculator-result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.calculator-result-grid.four-col {
    grid-template-columns: repeat(4, 1fr);
}

.calculator-result-item {
    text-align: center;
}

.calculator-result-value {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.calculator-result-value.cost {
    color: var(--success-color);
}

.calculator-result-label {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    margin-top: 0.25rem;
}

.calculator-pricing-note {
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    margin: 0;
}

/* Dark theme adjustments for calculator */
body.dark-theme .calculator-section {
    background: var(--bg-tertiary);
}

body.dark-theme .calculator-results-panel {
    background: var(--bg-secondary);
}

/* Responsive adjustments for calculator */
@media (max-width: 768px) {
    .calculator-modal {
        width: 98%;
    }

    .calculator-input-row,
    .calculator-input-row.three-col {
        grid-template-columns: 1fr;
    }

    .calculator-chat-inputs {
        grid-template-columns: 1fr;
    }

    .calculator-result-grid,
    .calculator-result-grid.four-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .calculator-result-value {
        font-size: var(--font-size-lg);
    }
}

/* ============================================
   SUPERVISOR AGENT MODAL - Multi-Agent Workflow Builder
   ============================================ */

.supervisor-modal {
    z-index: 2000;
    max-width: none !important;
    width: 98vw !important;
    max-height: none !important;
    height: 92vh !important;
    border-radius: 16px !important;
}

.supervisor-modal-container {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
}

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

.supervisor-modal-container > .modal-header {
    padding: 1.5rem;
}

/* Modal Body - 3 Column Layout */
.supervisor-modal-body {
    display: grid;
    grid-template-columns: 300px 1fr 350px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.supervisor-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.supervisor-panel:last-child {
    border-right: none;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.panel-header h3 i {
    color: var(--primary-color);
}

/* Agents Panel (Left) */
.agents-panel {
    background: var(--bg-secondary);
}

.agent-search {
    width: 100%;
    padding: 10px 14px;
    margin-top: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.agent-search::placeholder {
    color: var(--text-tertiary);
}

.agent-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.available-agents-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.draggable-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.draggable-agent:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.draggable-agent:active {
    cursor: grabbing;
}

.draggable-agent.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.draggable-agent .agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.draggable-agent .agent-avatar-fallback {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

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

.draggable-agent .agent-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draggable-agent .agent-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draggable-agent .agent-version {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 4px;
    font-weight: 500;
}

.panel-hint {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--border-color);
}

/* Dynamically generated states in agents panel */
.draggable-agent.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.loading-agents,
.no-agents-message,
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

.loading-agents i,
.no-agents-message i,
.error-message i {
    font-size: 1.25rem;
    opacity: 0.6;
}

.error-message {
    color: var(--error-color);
}

/* Supervisor name input placeholder */
.node-name-input::placeholder {
    color: var(--text-tertiary);
}

/* Workflow Panel (Center) */
.workflow-panel {
    background: var(--bg-primary);
}

.workflow-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-small {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

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

.workflow-canvas {
    flex: 1;
    position: relative;
    background:
        radial-gradient(circle, var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
    padding: 30px;
}

/* Supervisor Node */
.workflow-node {
    position: absolute;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
    z-index: 10;
}

.supervisor-node {
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-primary) 100%);
}

.workflow-node .node-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.supervisor-node .node-icon {
    background: var(--gradient-primary);
    color: white;
}

.workflow-node .node-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.node-name-input {
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 150px;
    padding: 2px 0;
}

.node-name-input:focus {
    outline: none;
    border-bottom: 2px solid var(--primary-color);
}

.node-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.node-connections {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
}

.connection-point {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--bg-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.connection-point:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* SME Drop Zone */
.sme-drop-zone {
    position: absolute;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 80px);
    min-height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    transition: all 0.3s;
}

.sme-drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    padding: 20px;
}

.drop-zone-content i {
    font-size: 2rem;
    opacity: 0.5;
}

.drop-zone-content span {
    font-size: 0.9rem;
}

.sme-drop-zone.has-agents .drop-zone-content {
    display: none;
}

.connected-agents {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    width: 100%;
}

/* Connected SME Agent Node */
.sme-agent-node {
    background: var(--bg-primary);
    border: 2px solid var(--success-color);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    position: relative;
    animation: nodeAppear 0.3s ease-out;
}

@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sme-agent-node .node-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    overflow: hidden;
}

.sme-agent-node .node-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sme-agent-node .node-icon .fallback {
    width: 100%;
    height: 100%;
    background: var(--success-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.sme-agent-node .sme-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.sme-agent-node .sme-specialty {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sme-agent-node .remove-sme {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--error-color);
    color: white;
    border: 2px solid var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0;
    transition: all 0.2s;
}

.sme-agent-node:hover .remove-sme {
    opacity: 1;
}

.sme-agent-node .remove-sme:hover {
    transform: scale(1.1);
}

/* Connection Line Input */
.sme-agent-node .connection-input {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success-color);
    border: 2px solid var(--bg-primary);
}

/* SVG Connections */
.workflow-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.workflow-connections path {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    animation: flowDash 1s linear infinite;
}

@keyframes flowDash {
    to {
        stroke-dashoffset: -10;
    }
}

.workflow-legend {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.workflow-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Config Panel (Right) */
.config-panel {
    background: var(--bg-secondary);
}

.config-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.config-section {
    margin-bottom: 20px;
}

.config-section label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.config-section textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.config-section textarea::placeholder {
    color: var(--text-tertiary);
}

.config-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.config-section select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.config-section select option,
.config-section select optgroup {
    background: var(--bg-primary);
    color: var(--text-primary);
}

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

.connected-sme-list {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
}

.connected-sme-list .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    gap: 8px;
}

.connected-sme-list .empty-state i {
    font-size: 1.5rem;
    opacity: 0.5;
}

.connected-sme-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
}

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

.connected-sme-item .sme-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

.connected-sme-item .sme-details {
    flex: 1;
}

.connected-sme-item .sme-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.connected-sme-item .sme-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Modal Footer */
.supervisor-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-info i {
    color: var(--warning-color);
}

.footer-actions {
    display: flex;
    gap: 12px;
}

.footer-actions .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.footer-actions .btn-secondary {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.footer-actions .btn-secondary:hover {
    background: var(--bg-tertiary);
}

.footer-actions .btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-actions .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.footer-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive adjustments for supervisor modal */
@media (max-width: 1400px) {
    .supervisor-modal-body {
        grid-template-columns: 260px 1fr 300px;
    }
}

@media (max-width: 1100px) {
    .supervisor-modal-body {
        grid-template-columns: 220px 1fr 260px;
    }
}

@media (max-width: 900px) {
    .supervisor-modal {
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
    }

    .supervisor-modal-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .agents-panel {
        max-height: 180px;
    }

    .config-panel {
        max-height: 220px;
    }
}

/* Login Modal Styles */
#login-modal {
    max-width: 400px;
}


.login-form-container {
    padding: 0.5rem 0;
}

.login-form-container .form-group {
    margin-bottom: 1.25rem;
}

.login-form-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.login-form-container .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: var(--font-size-base);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.login-form-container .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.login-form-container .password-input-group {
    position: relative;
    display: flex;
    gap: 0.5rem;
}

.login-form-container .password-input-group .form-control {
    flex: 1;
}

.login-form-container .password-input-group .btn-icon {
    flex-shrink: 0;
}

.login-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: var(--font-size-sm);
    text-align: center;
}

.login-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ============================================
   M4GENTIC MASTER ORCHESTRATOR STYLES
   ============================================ */

/* M4gentic card - gradient border */
.persona-card.persona-card-m4gentic {
    border: 2px solid transparent;
    background-image: linear-gradient(var(--bg-primary), var(--bg-primary)),
                      linear-gradient(135deg, #7c3aed, #4f46e5, #6366f1);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    position: relative;
}

.persona-card.persona-card-m4gentic.working {
    background-image: linear-gradient(var(--primary-light), var(--primary-light)),
                      linear-gradient(135deg, #7c3aed, #4f46e5, #6366f1);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.persona-card.persona-card-m4gentic:hover {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-3px);
}

.persona-card.persona-card-m4gentic.working::after {
    content: "Orchestrator";
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

/* Supervisor card styling */
.persona-card.persona-card-supervisor.working::after {
    content: "Supervisor";
    background: linear-gradient(135deg, #6366f1, #818cf8);
}

/* Crown overlay - top right of avatar */
.m4gentic-crown {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    color: #f59e0b;
    font-size: 1rem;
    z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Connected agents badge */
.connected-agents-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

/* M4gentic avatar border */
.persona-card.persona-card-m4gentic .persona-avatar-large {
    border-color: #7c3aed;
}

/* M4gentic header badge in chat welcome */
.m4gentic-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Dark theme adjustments */
body.dark-theme .persona-card.persona-card-m4gentic {
    background-image: linear-gradient(var(--bg-primary), var(--bg-primary)),
                      linear-gradient(135deg, #8b5cf6, #6366f1, #818cf8);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

body.dark-theme .persona-card.persona-card-m4gentic.working {
    background-image: linear-gradient(var(--primary-light), var(--primary-light)),
                      linear-gradient(135deg, #8b5cf6, #6366f1, #818cf8);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

body.dark-theme .persona-card.persona-card-m4gentic:hover {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

/* ============================================================================
   File Attachment Styles
   ============================================================================ */

/* Attachment preview bar - shown above input when file is selected */
.attachment-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    animation: slideDown 0.2s ease-out;
}

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

.attachment-preview .attachment-icon {
    color: var(--primary-color);
    font-size: 1rem;
    flex-shrink: 0;
}

.attachment-preview .attachment-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.attachment-preview .attachment-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-preview .attachment-size {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.attachment-remove {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.attachment-remove:hover {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

/* Attachment badge in message bubbles */
.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    margin-bottom: 0.5rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.message-attachment i {
    color: var(--primary-color);
}

/* Drag-and-drop highlight on input container */
#input-container.drag-over .input-wrapper {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Disabled attach button */
#attach-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================================
   Persona Filter Bar & Toggle Switch
   ============================================================================ */

.persona-modal-footer .toggle-switch {
    margin-right: auto;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-switch .toggle-slider {
    position: relative;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.toggle-switch .toggle-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* ============================================
   LOGIN GATE OVERLAY
   ============================================ */

.login-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.login-gate-overlay.visible {
    opacity: 1;
}

.login-gate-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.login-gate-backdrop {
    position: absolute;
    inset: 0;
    /* Theme-aware: light = soft surface, dark = coffee hero with the
       branded SVG backdrop. Same overlay, two moods. */
    background: var(--st-bg);
}
body.dark-theme .login-gate-backdrop {
    background: #1c1a17 url('../images/branding/backgrounds/login_background.svg') no-repeat center center;
    background-size: cover;
}

.login-gate-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    /* Default = solid card on the cream surface (light theme). The
       glass-morphism look only kicks in for dark themes where the
       hero backdrop gives it something to refract over. */
    background: var(--st-card-bg);
    border: 1px solid var(--st-border);
    border-radius: 24px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.08);
    color: var(--st-text);
    text-align: center;
    transform: translateY(20px) scale(0.96);
    animation: loginGateAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.15s;
    opacity: 0;
}
body.dark-theme .login-gate-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 32px 64px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 -1px 2px rgba(255, 255, 255, 0.15) inset;
    color: #fff;
}

@keyframes loginGateAppear {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.login-gate-logo {
    margin-bottom: 1.5rem;
}

.login-gate-logo-img {
    height: 48px;
    /* No filter — our two-variant SVG toggle (.login-gate-logo-img-on-light
       vs -on-dark in login.html) already picks the right colour per theme.
       Earlier `filter: brightness(0) invert(1)` forced everything white,
       which clashed with the light-theme dark-text variant. */
    opacity: 0.95;
}

.login-gate-title {
    font-family: var(--font-family-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--st-text);
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}
body.dark-theme .login-gate-title { color: #fff; }

.login-gate-subtitle {
    font-size: 0.875rem;
    color: var(--st-text-muted);
    margin-bottom: 2rem;
}
body.dark-theme .login-gate-subtitle { color: rgba(255, 255, 255, 0.65); }

.login-gate-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.login-gate-field {
    position: relative;
}

.login-gate-input-wrapper {
    display: flex;
    align-items: center;
    /* Light theme: white wrapper sits flush on the white card and
       relies on a thin border + soft inner-shadow for depth — the
       Stripe / Linear pattern. Earlier we used --st-bg (cream) which
       matched the backdrop and made the input look orphaned inside
       the white card. Now the input feels intentional. */
    background: var(--st-card-bg);
    border: 1.5px solid var(--st-border);
    border-radius: 8px;
    padding: 0;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
body.dark-theme .login-gate-input-wrapper {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: none;
}

.login-gate-input-wrapper:hover {
    border-color: var(--st-text-muted);
}
body.dark-theme .login-gate-input-wrapper:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

.login-gate-input-wrapper:focus-within {
    border-color: var(--st-primary);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.04),
        0 0 0 4px var(--st-primary-ring);
}
body.dark-theme .login-gate-input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.login-gate-input-wrapper > i:first-child {
    color: var(--st-text-muted);
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 14px;
    transition: color 0.18s;
}
body.dark-theme .login-gate-input-wrapper > i:first-child {
    color: rgba(255, 255, 255, 0.55);
}
.login-gate-input-wrapper:focus-within > i:first-child {
    color: var(--st-primary);
}
body.dark-theme .login-gate-input-wrapper:focus-within > i:first-child {
    color: rgba(255, 255, 255, 0.85);
}

.login-gate-input-wrapper input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    padding: 12px 14px;
    color: var(--st-text);
    font-size: 14.5px;
    font-family: inherit;
    letter-spacing: -0.005em;
}
body.dark-theme .login-gate-input-wrapper input { color: #fff; }
/* Chrome autofill — Chromium repaints the input background + colour
   when it autofills credentials, ignoring `background: none`. The
   classic fix is an inset box-shadow that masks the autofill colour.
   Earlier we used a solid coffee-dark hex which clashed with the
   wrapper's glass tint AND missed -webkit-text-fill-color, so the
   autofilled text rendered black on glass. Now we paint a transparent
   inset (lets the wrapper's own background show through), set the
   light text-fill colour explicitly, match the caret, inherit the
   wrapper's border-radius, and stack a 9999s transition so Chrome's
   late background fade can't sneak in. Both `:-webkit-autofill`
   (Chromium) and `:autofill` (standard, Firefox 86+) covered. */
.login-gate-input-wrapper input:-webkit-autofill,
.login-gate-input-wrapper input:-webkit-autofill:hover,
.login-gate-input-wrapper input:-webkit-autofill:focus,
.login-gate-input-wrapper input:-webkit-autofill:active,
.login-gate-input-wrapper input:autofill {
    -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
            box-shadow: 0 0 0 1000px transparent inset !important;
    -webkit-text-fill-color: var(--st-text);
    caret-color: var(--st-text);
    border-radius: inherit;
    transition:
        background-color 9999s ease-out 0s,
                  color 9999s ease-out 0s;
}
body.dark-theme .login-gate-input-wrapper input:-webkit-autofill,
body.dark-theme .login-gate-input-wrapper input:-webkit-autofill:hover,
body.dark-theme .login-gate-input-wrapper input:-webkit-autofill:focus,
body.dark-theme .login-gate-input-wrapper input:-webkit-autofill:active,
body.dark-theme .login-gate-input-wrapper input:autofill {
    -webkit-text-fill-color: #fff;
    caret-color: #fff;
}

.login-gate-input-wrapper input::placeholder {
    color: var(--st-text-muted);
    opacity: 0.7;
}
body.dark-theme .login-gate-input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    opacity: 1;
}

.login-gate-eye {
    background: none;
    border: none;
    color: var(--st-text-muted);
    cursor: pointer;
    padding: 4px 2px;
    font-size: 0.875rem;
    transition: color 0.2s;
}
body.dark-theme .login-gate-eye { color: rgba(255, 255, 255, 0.4); }

.login-gate-eye:hover { color: var(--st-text); }
body.dark-theme .login-gate-eye:hover { color: rgba(255, 255, 255, 0.7); }

.login-gate-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.9rem 1.5rem;
    /* Theme-aware: solid primary in light themes (rust accent on cream
       cards reads well); white pill on dark glass keeps the original
       cinematic look. */
    background: var(--st-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.01em;
}
body.dark-theme .login-gate-submit {
    background: rgba(255, 255, 255, 0.95);
    color: #4f46e5;
}

.login-gate-submit:hover {
    background: var(--st-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
body.dark-theme .login-gate-submit:hover { background: #fff; }

.login-gate-submit:active {
    transform: translateY(0);
}

.login-gate-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Entra ID SSO button */
.login-gate-divider {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    gap: 0.75rem;
}

.login-gate-divider::before,
.login-gate-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--st-border);
}
body.dark-theme .login-gate-divider::before,
body.dark-theme .login-gate-divider::after {
    background: rgba(255, 255, 255, 0.15);
}

.login-gate-divider span {
    font-size: 0.78rem;
    color: var(--st-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
body.dark-theme .login-gate-divider span { color: rgba(255, 255, 255, 0.4); }

.login-gate-microsoft {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--st-border);
    border-radius: 12px;
    background: var(--st-card-bg);
    color: var(--st-text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    transition: all 0.2s ease;
}
body.dark-theme .login-gate-microsoft {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
}

.login-gate-microsoft:hover {
    background: var(--st-bg);
    border-color: var(--st-primary);
    transform: translateY(-1px);
}
body.dark-theme .login-gate-microsoft:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

.login-gate-microsoft:active {
    transform: translateY(0);
}

/* CSS Microsoft logo — 2x2 grid */
.ms-logo {
    display: inline-grid;
    grid-template-columns: 10px 10px;
    grid-template-rows: 10px 10px;
    gap: 2px;
    transition: gap 0.2s ease;
}

.login-gate-microsoft:hover .ms-logo {
    gap: 3px;
}

.ms-sq {
    display: block;
    border-radius: 1.5px;
}

.login-gate-microsoft.loading .ms-logo {
    animation: ms-logo-spin 1.2s linear infinite;
}

@keyframes ms-logo-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-gate-footer {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--st-text-muted);
    opacity: 0.75;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
body.dark-theme .login-gate-footer {
    color: rgba(255, 255, 255, 0.35);
    opacity: 1;
}

.login-gate-overlay .login-message {
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 0.8125rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
}

.login-gate-overlay .login-message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.login-gate-overlay .login-message.success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Forgot Password Link */
.forgot-password-link a {
    color: #6366f1;
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color 0.2s;
}
.forgot-password-link a:hover {
    color: #4f46e5;
}
.login-gate-forgot-link {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color 0.2s;
}
.login-gate-forgot-link:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* Admin sender email item */
.admin-sender-item {
    padding: 0.5rem 0.75rem !important;
}

/* ============================================
   SETUP WIZARD OVERLAY
   ============================================ */

.setup-wizard-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.setup-wizard-overlay.visible {
    opacity: 1;
}

.setup-wizard-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.setup-wizard-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow:
        0 32px 64px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 -1px 2px rgba(255, 255, 255, 0.15) inset;
    text-align: center;
    transform: translateY(20px) scale(0.96);
    animation: loginGateAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.15s;
    opacity: 0;
}

/* Hide scrollbar on wizard card */
.setup-wizard-card::-webkit-scrollbar {
    width: 4px;
}

.setup-wizard-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.setup-wizard-title {
    font-family: var(--font-family-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.setup-wizard-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 1.5rem;
}

/* Stepper */
.setup-wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
}

.setup-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.setup-step-dot.active {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.95);
    color: #4f46e5;
    transform: scale(1.1);
}

.setup-step-dot.completed {
    background: rgba(16, 185, 129, 0.8);
    border-color: rgba(16, 185, 129, 0.8);
    color: #fff;
}

.setup-step-line {
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Step content */
.setup-wizard-step {
    text-align: left;
    animation: setupStepFadeIn 0.3s ease;
}

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

.setup-step-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setup-step-title i {
    color: rgba(255, 255, 255, 0.7);
}

.setup-step-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* Toggle cards for login step */
.setup-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setup-toggle-option input[type="radio"] {
    display: none;
}

.setup-toggle-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: rgba(255, 255, 255, 0.7);
}

.setup-toggle-card:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

.setup-toggle-card i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.setup-toggle-card strong {
    color: #fff;
    font-size: 0.9375rem;
}

.setup-toggle-card span {
    font-size: 0.8rem;
}

.setup-toggle-option input:checked + .setup-toggle-card {
    background: rgba(79, 70, 229, 0.25);
    border-color: rgba(99, 102, 241, 0.6);
}

/* Select dropdown */
.setup-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: #fff;
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    margin-bottom: 0.875rem;
    appearance: none;
}

.setup-select option {
    background: #1a1a2e;
    color: #fff;
}

.setup-field-label {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    text-align: left;
}

/* Logo upload dropzone */
.setup-logo-upload {
    text-align: center;
}

.setup-logo-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: rgba(255, 255, 255, 0.6);
}

.setup-logo-dropzone:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.setup-logo-dropzone i {
    font-size: 2rem;
}

.setup-logo-dropzone small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

.setup-logo-preview {
    max-width: 200px;
    max-height: 80px;
    margin-top: 1rem;
    border-radius: 8px;
    filter: brightness(0) invert(1);
}

/* Navigation buttons */
.setup-wizard-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.setup-wizard-nav-spacer {
    flex: 1;
}

.setup-wizard-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
}

.setup-wizard-btn.primary {
    background: rgba(255, 255, 255, 0.95);
    color: #4f46e5;
}

.setup-wizard-btn.primary:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.setup-wizard-btn.primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.setup-wizard-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.setup-wizard-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Reuse login-message styles */
.setup-wizard-card .login-message {
    margin-bottom: 0.75rem;
    text-align: center;
}

.setup-wizard-card .login-message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.8125rem;
}

.setup-wizard-card .login-message.success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.8125rem;
}

/* Admin toggle in dropdown */
.admin-toggle-item {
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
    cursor: default;
}

.admin-toggle-item span {
    flex: 1;
}

.admin-toggle-item .toggle-switch-sm {
    margin-left: auto;
}

.toggle-switch-sm {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch-sm input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-sm .toggle-slider {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-switch-sm .toggle-slider::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 1.5px;
    left: 1.5px;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch-sm input:checked + .toggle-slider {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.toggle-switch-sm input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.deployment-warning {
    margin-top: 6px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid var(--warning-color);
    border-radius: 6px;
    color: var(--warning-color);
    font-size: 0.82rem;
    line-height: 1.4;
}

/* ===================================
   Info-Summary Modal Styles
   =================================== */

#info-summary-modal {
    max-width: 95vw;
    width: 95vw;
    height: 92vh;
    max-height: 92vh;
}

#info-summary-modal .modal-content {
    overflow-y: auto;
    max-height: calc(92vh - 65px);
    padding-bottom: 2rem;
    border-radius: 0 0 var(--border-radius-2xl) var(--border-radius-2xl);
}

#info-summary-modal h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

#info-summary-modal h5 {
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

#info-summary-modal hr {
    margin: 1.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

#info-summary-modal hr + h5,
#info-summary-modal h4 + h5 {
    margin-top: 0;
}

#info-summary-modal .setting-group {
    margin-bottom: 1.25rem;
}

#info-summary-modal .setting-group:last-child {
    margin-bottom: 0;
}

.summary-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.summary-tab {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px 6px 0 0;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.summary-tab:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

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

.summary-tab i {
    margin-right: 4px;
}

.summary-tab-content {
    display: none;
}

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

/* Dashboard */
.summary-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-stat-card {
    background: var(--card-bg, var(--background));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.summary-stat-card .stat-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.summary-stat-card .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
}

.summary-stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 2px;
}

.summary-actions {
    margin-bottom: 1.25rem;
}

.summary-run-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 0.5rem;
}

.summary-run-controls select {
    max-width: 200px;
}

.summary-run-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--info-bg, rgba(59, 130, 246, 0.08));
    border-radius: 6px;
    margin-top: 8px;
    color: var(--text-color);
}

.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Collapsible sections */
.collapsible-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.collapsible-section .collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    background: var(--hover-bg);
    transition: background 0.2s;
}

.collapsible-section .collapsible-header:hover {
    background: var(--border-color);
}

.collapsible-section .collapsible-header h5 {
    margin: 0;
    font-size: 0.9rem;
}

.collapsible-section .collapsible-content {
    padding: 12px 14px;
}

.collapsible-section .toggle-icon {
    transition: transform 0.2s;
    font-size: 0.8rem;
    color: var(--text-light);
}

.platform-status {
    font-size: 0.75rem;
    margin-left: 6px;
}

/* Run History Table */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

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

.summary-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.summary-table tbody tr:hover {
    background: var(--hover-bg);
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.running {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.summary-pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 12px;
}

.summary-history-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

/* Memo Viewer */
#summary-memo-viewer {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 16px;
    overflow: hidden;
}

.memo-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--hover-bg);
    border-bottom: 1px solid var(--border-color);
}

.memo-viewer-header h5 {
    margin: 0;
    font-size: 0.9rem;
}

.memo-viewer-header > div {
    display: flex;
    gap: 6px;
    align-items: center;
}

.memo-content {
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.88rem;
    line-height: 1.6;
}

.memo-content h1, .memo-content h2, .memo-content h3 {
    margin-top: 16px;
    margin-bottom: 8px;
}

.memo-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.memo-content th,
.memo-content td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    text-align: left;
    font-size: 0.84rem;
}

.memo-content th {
    background: var(--hover-bg);
    font-weight: 600;
}

/* Customer Config Cards */
.summary-configs-toolbar {
    margin-bottom: 12px;
}

.summary-configs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-config-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    transition: opacity 0.2s ease;
}

.summary-config-card.disabled {
    opacity: 0.5;
}

.config-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.config-card-header .badge {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--primary-color);
    color: white;
}

.config-card-meta {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.config-card-actions {
    display: flex;
    gap: 6px;
}

/* Config Editor */
.config-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.config-editor-header h5 {
    margin: 0;
}

/* AI Mode Selector */
.summary-mode-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 1.25rem;
}

.summary-mode-option {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    transition: var(--transition-normal);
    cursor: pointer;
}

.summary-mode-option:hover {
    border-color: var(--primary-color);
}

.summary-mode-option.active {
    border-color: var(--primary-color);
    background: var(--bg-glass);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.summary-mode-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    cursor: pointer;
    margin: 0;
}

.summary-mode-label input[type="radio"] {
    margin-top: 4px;
    flex-shrink: 0;
}

.summary-mode-content {
    flex: 1;
}

.summary-mode-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.summary-mode-header i {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.summary-mode-settings {
    padding: 1rem;
    background: var(--bg-glass);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.summary-mode-settings.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Email picker / directory search */
.email-picker-container {
    position: relative;
    margin-bottom: 0.4rem;
}

.email-search-input {
    font-size: 0.85rem;
}

.email-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-secondary, #2b2b2b);
    border: 1px solid var(--border-color, #444);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.email-search-results.active {
    display: block;
}

.email-result-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color, #333);
}

.email-result-item:hover {
    background: var(--bg-hover, #3a3a3a);
}

.email-result-item .email-result-name {
    font-weight: 500;
}

.email-result-item .email-result-detail {
    color: var(--text-muted, #999);
    font-size: 0.8rem;
}

/* Outlook-style email tags */
.email-tags-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border: 1px solid var(--border-color, #444);
    border-radius: 4px;
    background: var(--bg-primary, #1e1e1e);
    min-height: 38px;
    cursor: text;
}

.email-tags-container:focus-within {
    border-color: var(--accent-color, #4a9eff);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.15);
}

.email-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px 2px 8px;
    border-radius: 12px;
    background: var(--bg-tertiary, #3a3a3a);
    border: 1px solid var(--border-color, #555);
    font-size: 0.82rem;
    color: var(--text-primary, #ddd);
    max-width: 100%;
    white-space: nowrap;
}

.email-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted, #999);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.email-tag-remove:hover {
    background: var(--danger-color, #e74c3c);
    color: #fff;
}

.email-tags-container .email-picker-container {
    margin-bottom: 0;
}

.email-tags-container .email-search-input {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 2px 4px;
    min-width: 160px;
}

.email-tags-container .email-search-input:focus {
    outline: none;
    box-shadow: none;
}

/* ============================================================
   Test Runner Modal
   ============================================================ */

.modal.modal-large {
    max-width: 960px;
    width: 95%;
}

.test-runner-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    margin-bottom: 1rem;
}

.test-runner-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.test-runner-summary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.75rem;
}

.test-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    background: var(--bg-glass, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-color, #2a2a2a);
    color: var(--text-secondary);
}

.test-badge strong {
    color: var(--text-primary);
    font-weight: 600;
}

.test-badge-success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.08);
}
.test-badge-success strong { color: #22c55e; }

.test-badge-danger {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}
.test-badge-danger strong { color: #ef4444; }

.test-badge-warning {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.08);
}
.test-badge-warning strong { color: #f59e0b; }

.test-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: auto;
}
.test-status-badge:empty { display: none; }
.test-status-badge.running {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.4);
}
.test-status-badge.success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.4);
}
.test-status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.test-status-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.test-runner-progress {
    margin-bottom: 0.75rem;
}
.test-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--bg-glass, rgba(255, 255, 255, 0.05));
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.test-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    transition: width 0.3s ease;
}
.test-current-line {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.test-runner-output {
    background: #0a0a0a;
    color: #e5e7eb;
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    padding: 0.85rem;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.4;
    height: 380px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-pass { color: #22c55e; font-weight: 600; }
.log-fail { color: #ef4444; font-weight: 600; }
.log-skip { color: #94a3b8; font-weight: 600; }

.test-badge-warn-yellow {
    border-color: rgba(234, 179, 8, 0.3);
    background: rgba(234, 179, 8, 0.08);
}
.test-badge-warn-yellow strong { color: #eab308; }

/* ============================================================
   Admin Banner (persistent top-of-page warning)
   ============================================================ */

.admin-banner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1.25rem;
    color: #0a0a0a;
    font-size: 0.88rem;
    position: sticky;
    top: 0;
    z-index: 2000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.admin-banner-warning {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    color: #78350f;
}

.admin-banner-critical {
    background: linear-gradient(90deg, #fee2e2, #fecaca);
    color: #7f1d1d;
}

.admin-banner-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.admin-banner span {
    flex: 1;
}

.admin-banner strong {
    font-weight: 700;
}

.admin-banner .btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
}

.admin-banner-dismiss {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: opacity 0.15s;
}
.admin-banner-dismiss:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
}

body.dark-theme .admin-banner-warning {
    background: linear-gradient(90deg, #713f12, #854d0e);
    color: #fef3c7;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}
body.dark-theme .admin-banner-critical {
    background: linear-gradient(90deg, #7f1d1d, #991b1b);
    color: #fee2e2;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}
body.dark-theme .admin-banner-dismiss:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* When an admin banner is visible, switch body to a vertical flex column so
   the banner takes real flow space and pushes .app down instead of overlaying
   the bottom of the viewport (.app defaults to height: 100vh). */
body.has-admin-banner {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: hidden;
}
body.has-admin-banner > .admin-banner {
    position: static;    /* sticky → static since body is the scroll root now */
    flex-shrink: 0;
}
body.has-admin-banner > .app {
    flex: 1 1 auto;
    height: auto;        /* override the 100vh default */
    min-height: 0;       /* allow children with overflow:auto to scroll */
}

/* ============================================================
   Patch Runner Modal — reboot wait + success overlays
   ============================================================ */

.patch-info-strip {
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}

.patch-phase-pill {
    font-weight: 600;
    letter-spacing: 0.3px;
}

.patch-reboot-wait {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--bg-glass, rgba(255, 255, 255, 0.03));
    border: 1px dashed var(--border-color, #2a2a2a);
    border-radius: 10px;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

.patch-reboot-wait h3 {
    margin: 1rem 0 0.4rem;
    color: #f59e0b;
    font-weight: 600;
}

.patch-reboot-wait p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    max-width: 480px;
    margin: 0 0 1rem;
    line-height: 1.5;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-yellow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}

/* Thin success bar — shown at the top of modal-content after a
   completed patch run. Compact single-line layout with icon, message,
   action button, and dismiss button. */
.patch-success-bar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.85rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-left: 4px solid #22c55e;
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--text-primary);
    animation: fadeIn 0.25s ease;
}

.patch-success-bar > i.fa-check-circle {
    color: #22c55e;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.patch-success-bar-text {
    color: var(--text-primary);
    font-weight: 500;
}

.patch-success-bar-spacer {
    flex: 1;
}

.patch-success-bar .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.patch-success-bar-dismiss {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    padding: 0.3rem 0.45rem;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.patch-success-bar-dismiss:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}
body.light-theme .patch-success-bar-dismiss:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ============================================================
   Patch Runner — inline confirmation overlay
   ============================================================ */

/* Make the patch modal's content area positioning context for the
   confirmation overlay so it can fill the entire modal body. */
#patch-runner-modal .modal-content {
    position: relative;
}

.patch-confirm {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 2rem 1.75rem;
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 10px;
    animation: fadeIn 0.25s ease;

    /* Fill the modal content area so it always covers the scrolled-away
       log output and is guaranteed visible regardless of scroll position. */
    position: absolute;
    inset: 0.5rem;
    z-index: 20;
    overflow-y: auto;
}

body.light-theme .patch-confirm {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(245, 158, 11, 0.5);
}

.patch-confirm-icon {
    font-size: 2.6rem;
    color: #f59e0b;
    margin-bottom: 0.6rem;
}

.patch-confirm h3 {
    margin: 0.3rem 0 0.6rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.15rem;
}

.patch-confirm-message {
    color: var(--text-secondary);
    font-size: 0.92rem;
    max-width: 560px;
    margin: 0 0 1rem;
    line-height: 1.5;
}

.patch-confirm-details {
    list-style: none;
    padding: 0.75rem 1.25rem;
    margin: 0 0 0.9rem;
    text-align: left;
    background: var(--bg-glass, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 320px;
    max-width: 560px;
}

.patch-confirm-details li {
    padding: 0.35rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.patch-confirm-details li i {
    color: #f59e0b;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.patch-confirm-details code {
    background: rgba(245, 158, 11, 0.08);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.82rem;
    color: #f59e0b;
}

.patch-confirm-warning {
    margin: 0 0 1.1rem;
    font-size: 0.82rem;
    color: var(--text-tertiary);
    max-width: 560px;
}
.patch-confirm-warning i {
    color: #f59e0b;
    margin-right: 0.3rem;
}

.patch-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.patch-confirm-actions .btn {
    min-width: 160px;
}

/* ============================================================
   Test Runner — Dashboard v2 (percentage-focused)
   ============================================================ */

.test-progress-dashboard {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: center;
    padding: 1.25rem 0.5rem;
    margin: 1rem 0;
    /* No border-top: the .test-runner-controls above already has a
       border-bottom, which served as a duplicate divider here. */
    border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.test-progress-ring-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    justify-self: center;
}

.test-progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.test-progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 8;
}

.test-progress-ring-fg {
    fill: none;
    stroke: #22c55e;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.726;     /* 2 * π * 52 */
    stroke-dashoffset: 326.726;    /* starts empty */
    transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}

.test-progress-ring-fg.running   { stroke: #3b82f6; }
.test-progress-ring-fg.success   { stroke: #22c55e; }
.test-progress-ring-fg.error     { stroke: #ef4444; }
.test-progress-ring-fg.warning   { stroke: #f59e0b; }

.test-progress-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.test-progress-percent {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.test-progress-sub {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.test-progress-counters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.test-counter {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg-glass, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 8px;
}

.test-counter > i {
    font-size: 1.4rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.test-counter > div {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.test-counter strong {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.test-counter span {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.test-counter-success > i { color: #22c55e; }
.test-counter-success strong { color: #22c55e; }

.test-counter-danger > i { color: #ef4444; }
.test-counter-danger strong { color: #ef4444; }

.test-counter-warning > i { color: #94a3b8; }

.test-counter-warn-yellow > i { color: #eab308; }
.test-counter-warn-yellow strong { color: #eab308; }

/* Status line */
.test-status-line {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.test-status-line .test-current-line {
    flex: 1;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Post-run actions bar */
.test-post-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.6rem 0;
    border-top: 1px dashed var(--border-color, #2a2a2a);
    margin-top: 0.5rem;
}

.test-post-actions .btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Warnings panel */
.test-warnings-panel {
    margin-top: 0.75rem;
    border: 1px solid rgba(234, 179, 8, 0.35);
    background: rgba(234, 179, 8, 0.04);
    border-radius: 8px;
    overflow: hidden;
    animation: fadeIn 0.25s ease;
}

.test-warnings-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    background: rgba(234, 179, 8, 0.08);
    border-bottom: 1px solid rgba(234, 179, 8, 0.25);
    color: #eab308;
    font-size: 0.88rem;
}

.test-warnings-header > i {
    font-size: 1rem;
}

.test-warnings-content {
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 0.85rem 1rem;
    background: #0a0a0a;
    color: #fbbf24;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    border: 0;
}

body.light-theme .test-warnings-content {
    background: #fefce8;
    color: #713f12;
}

/* Responsive — collapse dashboard into vertical stack on narrow modals */
@media (max-width: 720px) {
    .test-progress-dashboard {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .test-progress-counters {
        grid-template-columns: repeat(2, 1fr);
        width: 100%;
    }
}

/* ============================================================
   Test Runner — Failed tests panel
   ============================================================ */

.test-failed-panel {
    margin-top: 0.9rem;
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.06);
    border-radius: 8px;
    overflow: hidden;
    animation: fadeIn 0.25s ease;
}

.test-failed-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    background: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    font-size: 0.9rem;
}

.test-failed-header > i {
    font-size: 1.05rem;
}

.test-failed-header strong {
    color: #ef4444;
    font-weight: 600;
}

.test-failed-header .btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.77rem;
}

.test-failed-list {
    list-style: none;
    margin: 0;
    padding: 0.4rem 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-glass, rgba(255, 255, 255, 0.02));
}

.test-failed-list li {
    padding: 0.45rem 1rem 0.45rem 2.5rem;
    position: relative;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.77rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(239, 68, 68, 0.08);
    word-break: break-all;
    line-height: 1.4;
}

.test-failed-list li:last-child {
    border-bottom: 0;
}

.test-failed-list li::before {
    content: "✗";
    position: absolute;
    left: 1rem;
    color: #ef4444;
    font-weight: 700;
    font-family: sans-serif;
    font-size: 0.95rem;
}

.test-failed-list li .test-failed-file {
    color: var(--text-tertiary);
}

.test-failed-list li .test-failed-name {
    color: #fca5a5;
    font-weight: 600;
}

body.light-theme .test-failed-list li .test-failed-name {
    color: #b91c1c;
}

.test-failed-tracebacks {
    margin: 0;
    padding: 0.85rem 1rem;
    max-height: 320px;
    overflow: auto;
    background: #0a0a0a;
    color: #fca5a5;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    border-top: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 0;
}

body.light-theme .test-failed-tracebacks {
    background: #fef2f2;
    color: #7f1d1d;
}

/* ============================================================
   Patch Runner — Enhanced reboot-wait overlay
   ============================================================ */

.patch-reboot-wait h3 {
    /* override earlier rule so the new title is slightly larger */
    font-size: 1.25rem;
}

.patch-reboot-message {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 520px;
    margin: 0.25rem 0 1rem;
    line-height: 1.5;
    text-align: center;
}

/* Circular countdown ring with number in the center */
.patch-reboot-spinner-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 0.85rem;
}

.patch-reboot-spinner-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.patch-reboot-spinner-bg {
    fill: none;
    stroke: rgba(245, 158, 11, 0.12);
    stroke-width: 6;
}

.patch-reboot-spinner-fg {
    fill: none;
    stroke: #f59e0b;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 276.46;    /* 2π * 44 */
    stroke-dashoffset: 276.46;
    transition: stroke-dashoffset 0.3s linear;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
}

.patch-reboot-spinner-fg.idle {
    stroke: rgba(245, 158, 11, 0.25);
    animation: spin 2s linear infinite;
    transform-origin: center;
}

.patch-reboot-spinner-fg.success {
    stroke: #22c55e;
    filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.5));
}

.patch-reboot-spinner-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.patch-reboot-countdown-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.patch-reboot-countdown-label {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.3rem;
}

/* Last attempt result — pill with icon */
.patch-reboot-last-result {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.85rem;
    margin: 0 0 0.85rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--text-primary);
    min-height: 32px;
    transition: background 0.2s, border-color 0.2s;
}
.patch-reboot-last-result.pending {
    animation: pulse-yellow 2s ease infinite;
}
.patch-reboot-last-result.waiting {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}
.patch-reboot-last-result.waiting .patch-reboot-last-icon { color: #3b82f6; }
.patch-reboot-last-result.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
}
.patch-reboot-last-result.success .patch-reboot-last-icon { color: #22c55e; }
.patch-reboot-last-icon {
    font-size: 0.9rem;
    color: #f59e0b;
}

/* Stat tiles row */
.patch-reboot-stats {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    justify-content: center;
}
.patch-reboot-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-glass, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    min-width: 90px;
}
.patch-reboot-stat strong {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.patch-reboot-stat span {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 0.2rem;
}

/* Activity log of attempts */
.patch-reboot-activity-wrap {
    width: 100%;
    max-width: 520px;
    margin-top: 0.35rem;
}
.patch-reboot-activity-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 0.3rem;
    text-align: left;
    padding-left: 0.35rem;
}
.patch-reboot-activity {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
    max-height: 160px;
    overflow-y: auto;
    background: var(--bg-glass, rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.74rem;
    line-height: 1.4;
}
.patch-reboot-activity li {
    padding: 0.3rem 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.patch-reboot-activity li:last-child {
    border-bottom: 0;
}
.patch-reboot-activity li .ts {
    color: var(--text-tertiary);
    flex-shrink: 0;
    min-width: 44px;
}
.patch-reboot-activity li .msg {
    flex: 1;
}
.patch-reboot-activity li.wait     .msg { color: #94a3b8; }
.patch-reboot-activity li.checking .msg { color: #3b82f6; }
.patch-reboot-activity li.fail     .msg { color: #f59e0b; }
.patch-reboot-activity li.success  .msg { color: #22c55e; font-weight: 600; }

/* ============================================================
   Thin reboot-wait bar (replaces the big overlay)
   ============================================================ */

.patch-reboot-bar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.85rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--text-primary);
    animation: fadeIn 0.25s ease;
}

.patch-reboot-bar-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(245, 158, 11, 0.25);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.patch-reboot-bar-text {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

.patch-reboot-bar .btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.77rem;
}

/* Pulsing animation for dashboard ring during reboot */
@keyframes reboot-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

.test-progress-ring-fg.rebooting {
    stroke: #f59e0b;
    animation: reboot-pulse 1.8s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.5));
}

/* During reboot, the main dashboard percent number is replaced by the
   countdown. Add a smaller "seconds" suffix for clarity. */
.test-progress-percent.countdown-mode {
    font-size: 2.4rem;
}
.test-progress-percent.countdown-mode::after {
    content: 's';
    font-size: 1.1rem;
    opacity: 0.6;
    margin-left: 0.1rem;
}
.test-progress-percent.countdown-mode.dots::after {
    content: '';
}

/* Test runner — live output toggle (visible during run, not just after) */
.test-log-toggle {
    display: flex;
    padding: 0.4rem 0;
}
.test-log-toggle .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.test-log-toggle .btn-sm:hover {
    opacity: 1;
}

/* ============================================================
   Backup panel (Settings → System → Backups)
   ============================================================ */
.backup-panel { padding: 16px 4px; }
.backup-panel h3 { margin: 0 0 8px; font-size: 1.15rem; }
.backup-panel h4 { margin: 24px 0 8px; font-size: 1rem; }
.backup-panel .setting-hint { color: var(--muted, #888); font-size: 0.9em; margin: 0 0 16px; }
.backup-info {
    display: flex; gap: 24px; flex-wrap: wrap;
    padding: 12px 16px; background: var(--bg-subtle, rgba(0,0,0,0.04));
    border-radius: 6px; margin-bottom: 16px; font-size: 0.95em;
}
.backup-info-stat strong { color: var(--accent, #2a7); }
.backup-info-empty, .backup-info-loading { color: var(--muted, #888); }
.backup-actions { display: flex; gap: 12px; margin-bottom: 12px; }
.backup-progress {
    margin: 16px 0; padding: 12px; border-radius: 6px;
    background: var(--bg-subtle, rgba(0,0,0,0.04));
}
.backup-progress-status {
    display: flex; justify-content: space-between;
    font-size: 0.95em; margin-bottom: 8px; font-weight: 600;
}
.backup-progress-log {
    font-family: monospace; font-size: 0.85em; line-height: 1.4;
    max-height: 240px; overflow-y: auto; margin: 0;
    background: #1a1a1a; color: #e8e8e8; padding: 10px 12px;
    border-radius: 4px; white-space: pre-wrap; word-wrap: break-word;
}
.backup-list { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.backup-list th, .backup-list td {
    text-align: left; padding: 8px 12px;
    border-bottom: 1px solid var(--border, rgba(0,0,0,0.08));
}
.backup-list th { font-weight: 600; color: var(--muted, #888); }
.backup-list code { font-size: 0.95em; }
.backup-list-empty { text-align: center; color: var(--muted, #888); padding: 20px; }

/* ============================================================
   Webhook Test Inbox panel
   ============================================================ */
.webhook-inbox-panel { padding: 16px 4px; }
.webhook-inbox-panel h4 { margin: 0 0 8px; font-size: 1rem; }
.webhook-inbox-panel .setting-hint {
    color: var(--muted, #888); font-size: 0.9em; margin: 0 0 12px;
}
.webhook-inbox-panel .setting-hint code {
    background: var(--bg-subtle, rgba(0,0,0,0.06));
    padding: 1px 4px; border-radius: 3px;
}
.webhook-inbox-actions { display: flex; gap: 12px; margin-bottom: 16px; }
.webhook-inbox-layout {
    display: grid; grid-template-columns: minmax(280px, 40%) 1fr; gap: 18px;
    min-height: 420px;
}
.webhook-inbox-list-section {
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    border-radius: 6px; padding: 10px 12px; overflow: auto; max-height: 70vh;
}
.webhook-inbox-list { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.webhook-inbox-list th, .webhook-inbox-list td {
    text-align: left; padding: 6px 8px;
    border-bottom: 1px solid var(--border, rgba(0,0,0,0.06));
}
.webhook-inbox-list th { font-weight: 600; color: var(--muted, #888); }
.webhook-inbox-list-empty {
    text-align: center; color: var(--muted, #888); padding: 18px; font-style: italic;
}
.webhook-inbox-row { cursor: pointer; }
.webhook-inbox-row:hover { background: var(--bg-subtle, rgba(0,0,0,0.04)); }
.webhook-inbox-row.is-selected {
    background: var(--accent-bg, rgba(42, 119, 0.12));
}
.webhook-inbox-detail-section {
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    border-radius: 6px; padding: 12px 14px; overflow: auto; max-height: 70vh;
}
.webhook-inbox-detail-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; gap: 12px;
}
.webhook-inbox-detail-actions { display: flex; gap: 6px; }
.webhook-inbox-detail-url {
    font-size: 0.88em; margin-bottom: 12px; color: var(--muted, #888);
    word-break: break-all;
}
.webhook-inbox-detail-url code {
    background: var(--bg-subtle, rgba(0,0,0,0.06));
    padding: 2px 6px; border-radius: 3px; font-size: 0.95em;
}
.webhook-inbox-url-label { font-weight: 600; color: var(--text, #333); margin-right: 4px; }
.webhook-inbox-empty {
    text-align: center; color: var(--muted, #888);
    padding: 40px 12px; font-style: italic;
}
.webhook-inbox-capture {
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    border-radius: 5px; margin-bottom: 8px; background: var(--bg, transparent);
}
.webhook-inbox-capture > summary {
    cursor: pointer; padding: 8px 12px; display: flex; gap: 12px;
    align-items: center; font-size: 0.9em;
}
.webhook-inbox-capture > summary:hover { background: var(--bg-subtle, rgba(0,0,0,0.03)); }
.webhook-inbox-method {
    font-weight: 700; padding: 2px 8px; border-radius: 4px;
    font-size: 0.8em; letter-spacing: 0.5px;
}
.webhook-inbox-method-POST   { background: #2a7; color: #fff; }
.webhook-inbox-method-PUT    { background: #27a; color: #fff; }
.webhook-inbox-method-DELETE { background: #c53; color: #fff; }
.webhook-inbox-time { color: var(--muted, #888); }
.webhook-inbox-ip { color: var(--muted, #888); font-family: monospace; font-size: 0.85em; }
.webhook-inbox-ct { color: var(--muted, #888); font-style: italic; margin-left: auto; }
.webhook-inbox-capture-body { padding: 4px 12px 12px; }
.webhook-inbox-capture-section { margin-top: 8px; }
.webhook-inbox-capture-label {
    font-size: 0.8em; font-weight: 600; color: var(--muted, #888);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.webhook-inbox-capture-pre {
    font-family: monospace; font-size: 0.82em; line-height: 1.4;
    background: #1a1a1a; color: #e8e8e8; padding: 8px 10px;
    border-radius: 4px; margin: 0; max-height: 280px; overflow: auto;
    white-space: pre-wrap; word-wrap: break-word;
}
.webhook-inbox-truncated {
    color: #c53; font-size: 0.85em; font-weight: 400;
    text-transform: none; letter-spacing: 0;
}
.webhook-inbox-filter-bar {
    display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
    flex-wrap: wrap;
}
.webhook-inbox-search {
    flex: 1 1 240px; min-width: 180px;
    padding: 6px 10px; border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9em;
}
.webhook-inbox-search:focus {
    outline: none; border-color: var(--primary-color);
}
.webhook-inbox-method-pills {
    display: flex; gap: 4px; flex-wrap: wrap;
}
.webhook-inbox-pill {
    padding: 4px 10px; border-radius: 999px; font-size: 0.78em;
    font-weight: 600; letter-spacing: 0.5px; cursor: pointer;
    border: 1px solid var(--border-color); background: transparent;
    color: var(--text-secondary); transition: all 0.15s ease;
}
.webhook-inbox-pill:hover {
    border-color: var(--primary-color); color: var(--text-primary);
}
.webhook-inbox-pill.is-active {
    background: var(--primary-color); border-color: var(--primary-color);
    color: #fff;
}
.webhook-inbox-replay-btn {
    margin-left: 8px;
}
.webhook-inbox-load-more-row {
    display: flex; justify-content: center; padding: 12px 0;
}
@media (max-width: 900px) {
    .webhook-inbox-layout { grid-template-columns: 1fr; }
}

/* ─── Public chat widget: takeover bar (Visitors thread, Fas 3) ─────────── */
.widget-takeover-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    margin: 0 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    font-size: 13px;
    color: var(--text-secondary);
}
.widget-takeover-bar.wtb-human {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--text-primary);
}
.widget-takeover-bar .wtb-status { flex: 1; display: flex; align-items: center; gap: 8px; }
.widget-takeover-bar .wtb-status i { opacity: 0.8; }
.widget-takeover-bar .wtb-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.widget-takeover-bar .wtb-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.widget-takeover-bar .wtb-btn.wtb-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.widget-takeover-bar .wtb-btn.wtb-primary:hover { background: var(--primary-hover); color: #fff; }
