@import url('https://fonts.loli.net/css2?family=Manrope:wght@300;400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  /* Serene Architect - Light */
  --color-primary: #00668c;
  --color-primary-dim: #00597b;
  --color-on-primary: #f4f9ff;
  --color-primary-container: #8ad2fd;
  --color-on-primary-container: #004763;
  --color-surface: #faf9f6;
  --color-surface-container-low: #f4f4f0;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-high: #e8e9e4;
  --color-on-surface: #303330;
  --color-on-surface-variant: #5d605c;
  --color-outline-variant: #b0b3ae;
  --color-outline: #797b78;
  --color-secondary: #4d626c;
  --color-secondary-container: #d0e6f2;
  --color-on-secondary-container: #40555f;
  --color-tertiary: #00668a;
  --color-tertiary-fixed: #7ed0fc;
  --color-error: #a83836;
  --color-error-container: #fa746f;
  --shadow-ambient: 0 4px 20px rgba(0, 102, 140, 0.07);
  --z-overlay: 150;
  --z-sidebar: 200;
  --z-lightbox: 500;

  --font-headline: "Manrope", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  /* Serene Architect - Dark */
  --color-primary: #7eccf5;
  --color-primary-dim: #5cb8e8;
  --color-on-primary: #003549;
  --color-primary-container: #004d6a;
  --color-on-primary-container: #c2e6ff;
  --color-surface: #161816;
  --color-surface-container-low: #1e201e;
  --color-surface-container-lowest: #111311;
  --color-surface-container-high: #282a28;
  --color-on-surface: #e2e3de;
  --color-on-surface-variant: #c0c3bc;
  --color-outline-variant: #444844;
  --color-outline: #8a8e8a;
  --color-secondary: #b4cad6;
  --color-secondary-container: #344c58;
  --color-on-secondary-container: #d0e6f2;
  --color-tertiary: #6cc8f0;
  --color-tertiary-fixed: #2a8ab0;
  --color-error: #ffb4ab;
  --color-error-container: #93000a;
  --shadow-ambient: 0 4px 24px rgba(0, 0, 0, 0.28);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-surface);
    color: var(--color-on-surface);
    height: 100dvh;
    overflow: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4, .headline {
    font-family: var(--font-headline);
    letter-spacing: -0.02em;
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 24px;
    right: 30px;
    background: transparent;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    color: var(--color-on-surface-variant);
    transition: all 0.3s;
}

.theme-toggle:hover {
    color: var(--color-on-surface);
    background: var(--color-surface-container-high);
}

/* Layout */
.container {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 280px;
    background: var(--color-surface-container-low);
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: all 0.3s ease;
}

.logo {
    display: flex;
    justify-content: center;
    margin-bottom: 48px;
}

.logo img {
    height: 60px;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
    mix-blend-mode: multiply;
}

nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

nav a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--color-on-surface-variant);
    text-decoration: none;
    font-family: var(--font-headline);
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
    gap: 12px;
}

nav a i {
    font-size: 1.1em;
}

nav a:hover {
    color: var(--color-on-surface);
    background: var(--color-surface-container-high);
}

nav li.active a {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
    color: var(--color-on-primary);
    box-shadow: var(--shadow-ambient);
    font-weight: 600;
}

/* Webhook Selectors */
.webhook-section {
    padding-left: 48px;
    padding-right: 12px;
    margin-top: 4px;
}

.webhook-selector {
    position: relative;
    width: 100%;
}

.current-webhook-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85rem;
    color: var(--color-on-surface-variant);
}

.current-webhook-display:hover {
    background: var(--color-surface-container-high);
}

.webhook-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--color-surface-container-lowest);
    border-radius: 12px;
    margin-top: 4px;
    box-shadow: var(--shadow-ambient);
    display: none;
    z-index: 100;
}

.webhook-selector.open .webhook-dropdown {
    display: block;
    animation: slideUp 0.2s ease-out;
}

.webhook-option {
    padding: 12px 16px;
    cursor: pointer;
    color: var(--color-on-surface-variant);
    font-size: 14px;
    border-radius: 8px;
}

.webhook-option:hover {
    background: var(--color-surface-container-high);
    color: var(--color-on-surface);
}

/* Profile */
.profile {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    justify-content: center;
}

.profile img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    /* No border, soft drop shadow instead */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    object-fit: cover;
}

/* Main Content Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
    padding-bottom: 24px; /* Default desktop padding */
}

/* Chat History */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    animation: entry 0.4s ease-out;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

/* Message row: avatar + bubble */
.message-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.message.user .message-row {
    justify-content: flex-end;
}

/* Avatar */
.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

.bot-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-on-primary);
    font-size: 15px;
}

/* Bubble */
.message-bubble {
    padding: 16px 24px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-bubble p {
    padding: 0;
    margin: 0;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
    color: var(--color-on-primary);
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-ambient);
}

.message.assistant .message-bubble {
    background: var(--color-surface-container-low);
    color: var(--color-on-surface);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-ambient);
}

.message.assistant .markdown-body {
    background: none;
    padding: 0;
}

.message.assistant .markdown-body > *:first-child { margin-top: 0; }
.message.assistant .markdown-body > *:last-child { margin-bottom: 0; }

.message.assistant .markdown-body p {
    background: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    margin: 0.4em 0;
}

.message.assistant .markdown-body ul,
.message.assistant .markdown-body ol {
    margin: 0.4em 0;
    padding-left: 1.5em;
}

.message.assistant .markdown-body li { margin: 0.2em 0; }

.message.assistant .markdown-body h1,
.message.assistant .markdown-body h2,
.message.assistant .markdown-body h3 {
    margin: 0.8em 0 0.3em;
    font-size: 1em;
    font-weight: 600;
}

.message.assistant .markdown-body hr {
    border: none;
    border-top: 1px solid var(--color-outline-variant, #ccc);
    margin: 0.6em 0;
}

.message.assistant .markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.6em 0;
    font-size: 0.9em;
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.message.assistant .markdown-body th,
.message.assistant .markdown-body td {
    border: 1px solid var(--color-outline-variant, #ccc);
    padding: 6px 12px;
    text-align: left;
}

.message.assistant .markdown-body th {
    background: rgba(0,0,0,0.05);
    font-weight: 600;
}

.message.assistant .markdown-body tr:nth-child(even) td {
    background: rgba(0,0,0,0.02);
}

.message.assistant .markdown-body strong { font-weight: 600; }
.message.assistant .markdown-body em { font-style: italic; }
.message.assistant .markdown-body code {
    background: rgba(0,0,0,0.06);
    border-radius: 4px;
    padding: 0.1em 0.3em;
    font-size: 0.9em;
}
.message.assistant .markdown-body pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: pre;
    padding: 10px 12px;
    margin: 0.5em 0;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    font-size: 0.85em;
    line-height: 1.5;
}
.message.assistant .markdown-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    white-space: pre;
}

/* Chat Input */
.chat-input-area {
    padding: 0 40px;
}

.input-wrapper {
    background: var(--color-surface-container-low);
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 10px 20px;
    box-shadow: var(--shadow-ambient);
    transition: all 0.3s ease;
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper:focus-within {
    background: var(--color-surface-container-high);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 16px;
    color: var(--color-on-surface);
    font-size: 16px;
    font-family: inherit;
    resize: none;
}

#chat-input::placeholder {
    color: var(--color-outline);
}

.clear-session-btn {
    background: none;
    border: none;
    color: var(--color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: color 0.2s;
    font-size: 1.2rem;
}

.clear-session-btn:hover {
    color: var(--color-error);
}

#upload-btn {
    background: none;
    border: none;
    color: var(--color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: color 0.2s;
    font-size: 1.2rem;
}

#upload-btn:hover {
    color: var(--color-primary);
}

#send-btn {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
    color: var(--color-on-primary);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-ambient);
}

/* Workspaces */
.workspaces-content {
    flex: 1;
    overflow-y: auto;
    padding: 60px 40px;
}

.workspaces-header {
    text-align: center;
    margin-bottom: 48px;
}

.workspaces-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.workspaces-header p {
    color: var(--color-on-surface-variant);
}

.workspace-sections {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.workspace-section {
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-outline-variant);
    font-family: var(--font-headline);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-on-surface);
}

.section-header i {
    color: var(--color-primary);
    font-size: 1rem;
}

.workspaces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.workspace-card {
    background: var(--color-surface-container-lowest);
    border-radius: 20px;
    padding: 24px 24px 32px 24px;
    text-align: left;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-surface-container-high);
    text-decoration: none;
    color: inherit;
    display: block;
}

.workspace-card::after {
    content: '\f061';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    bottom: 28px;
    right: 24px;
    color: var(--color-primary);
    font-size: 1.1rem;
    opacity: 0;
    transform: translateX(-15px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.workspace-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    border-color: transparent;
}

[data-theme="dark"] .workspace-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.workspace-card:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.workspace-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--color-secondary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-on-secondary-container);
    margin-bottom: 20px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.workspace-card:hover .workspace-icon {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
    color: var(--color-on-primary);
    box-shadow: 0 8px 16px rgba(0, 102, 140, 0.25);
    transform: scale(1.05);
}

.workspace-card h3 {
    margin-bottom: 10px;
    color: var(--color-on-surface);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.workspace-card p {
    color: var(--color-on-surface-variant);
    font-size: 0.85rem;
    line-height: 1.5;
    padding-right: 24px;
}

/* Login and Settings Pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100dvh;
}

.auth-card {
    background: var(--color-surface-container-lowest);
    border-radius: 16px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-ambient);
    text-align: center;
}

.auth-card h1 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 12px;
}

.auth-card p {
    color: var(--color-on-surface-variant);
    margin-bottom: 32px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-field {
    background: var(--color-surface-container-low);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.input-field:focus-within {
    background: var(--color-surface-container-highest);
    box-shadow: inset 0 0 0 1px rgba(176, 179, 174, 0.4); /* Ghost border */
}

.input-field i {
    color: var(--color-outline);
}

.input-field input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--color-on-surface);
    font-family: var(--font-body);
    font-size: 1rem;
}

.input-field input::placeholder {
    color: var(--color-outline);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
    color: var(--color-on-primary);
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-ambient);
    transition: transform 0.2s;
    font-family: var(--font-body);
}

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

#auth-error {
    color: var(--color-error);
    margin-top: 16px;
    font-size: 0.9em;
    min-height: 20px;
}

/* Settings Form specific */
.settings-info {
    text-align: left;
    background: var(--color-surface-container-high);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.settings-info img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.settings-details {
    text-align: center;
}

.settings-details h3 {
    color: var(--color-on-surface);
    margin-bottom: 4px;
}

.settings-details p {
    color: var(--color-on-surface-variant);
    margin: 0;
}

.btn-logout {
    background: var(--color-error-container);
    color: var(--color-error);
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-logout:hover {
    filter: brightness(0.9);
}

/* Responsive Layout */
@media (max-width: 768px) {
    .container {
        flex-direction: column-reverse;
    }
    
    .sidebar {
        width: 100%;
        height: 70px;
        flex-direction: row;
        padding: 0;
        justify-content: center;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
        z-index: 100;
    }

    [data-theme="dark"] .sidebar {
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    }

    .logo, .webhook-section, .profile {
        display: none;
    }

    nav {
        width: 100%;
        height: 100%;
    }

    nav ul {
        flex-direction: row;
        height: 100%;
        justify-content: space-around;
        align-items: center;
        gap: 0;
    }

    nav a {
        flex-direction: column;
        padding: 8px;
        gap: 4px;
        border-radius: 8px;
        font-size: 0.75rem;
    }

    nav a i {
        font-size: 1.2rem;
    }

    nav li.active a {
        box-shadow: none;
        background: transparent;
        color: var(--color-primary);
    }
    
    .chat-area {
        padding-bottom: 16px;
    }

    .workspaces-content {
        padding: 32px 16px 80px;
    }

    .workspaces-header {
        margin-bottom: 32px;
    }

    .workspaces-header h1 {
        font-size: 2rem;
    }

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

    .chat-history {
        padding: 20px;
    }

    .message {
        max-width: 95%;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
    }

    .chat-input-area {
        padding: 0 16px;
    }
    
    .theme-toggle {
        top: 16px;
        right: 16px;
    }
}

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

/* Image previews in input area */
.image-previews {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 40px 8px;
    max-width: 800px;
    margin: 0 auto;
}

.image-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-outline-variant);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.image-preview-remove:hover {
    background: var(--color-error);
}

/* Images in messages */
.message-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    align-items: flex-start;
}

.message-image-thumb {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    max-height: 120px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    border-radius: 0.5rem;
    cursor: pointer !important;
    display: inline-block !important;
    transition: transform 0.15s;
}
.message-image-thumb:hover {
    transform: scale(1.05);
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-lightbox);
    cursor: pointer;
    animation: fadeIn 0.2s ease-out;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading indicator */
.loading-indicator {
    opacity: 0.6;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--color-outline-variant); border-radius: 10px; }

/* Background ambient decoration */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.04;
}
[data-theme="dark"] .floating-shape { opacity: 0.07; }
.shape-1 {
    width: 560px; height: 560px;
    background: var(--color-primary);
    top: -140px; right: -100px;
}
.shape-2 {
    width: 440px; height: 440px;
    background: var(--color-secondary);
    bottom: -100px; left: 8%;
}
.shape-3 {
    width: 320px; height: 320px;
    background: var(--color-tertiary);
    top: 38%; left: -90px;
}

/* Entry animation for chat messages */
@keyframes entry {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Button :active pressed feedback */
#send-btn:active { transform: scale(0.92) !important; }
#upload-btn:active,
.clear-session-btn:active { transform: scale(0.88); opacity: 0.7; }
.topbar-logout:active,
.mobile-menu-btn:active,
.theme-toggle:active { transform: scale(0.88); opacity: 0.8; }
.profile-btn:active { transform: scale(0.97); }

/* Keyboard focus ring */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Chat empty / welcome state */
.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 60px 24px;
    animation: entry 0.5s ease-out;
}
#chat-history:has(.message) .chat-empty-state { display: none; }
.chat-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--color-primary-container) 60%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--color-primary);
    margin-bottom: 20px;
}
.chat-empty-title {
    font-family: var(--font-headline);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-on-surface);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.chat-empty-sub {
    font-size: 0.95rem;
    color: var(--color-on-surface-variant);
    margin-bottom: 28px;
    max-width: 380px;
    line-height: 1.6;
}
.chat-empty-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 560px;
}
.suggestion-chip {
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--color-outline-variant);
    background: var(--color-surface-container-lowest);
    color: var(--color-on-surface-variant);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.suggestion-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary-container) 40%, transparent);
}
.suggestion-chip:active { transform: scale(0.96); }