/**
 * SemtixAds - Dark Theme Design System
 *
 * Adapted from SemtixWP. ChatGPT-inspired neutral dark theme.
 * WCAG AA compliant contrast ratios.
 */

/* ========================================================================
   CSS Custom Properties (Theme)
   ======================================================================== */

:root {
    --bg-primary: #212121;
    --bg-secondary: #171717;
    --bg-tertiary: #2f2f2f;
    --bg-surface: #303030;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --text-muted: #8e8e8e;
    --accent: #10a37f;
    --accent-hover: #1a7f64;
    --accent-subtle: rgba(16, 163, 127, 0.15);
    --success: #22c55e;
    --success-subtle: rgba(34, 197, 94, 0.15);
    --warning: #eab308;
    --warning-subtle: rgba(234, 179, 8, 0.15);
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.15);
    --border: #383838;
    --border-light: #444444;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --transition: 200ms ease;
}

/* ========================================================================
   Reset & Base
   ======================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

html, body {
    height: 100%;
    overflow: hidden;
}

#app {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--accent-hover);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

/* ========================================================================
   Auth Page (Login / Register)
   ======================================================================== */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-secondary);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 14px;
    font-family: inherit;
}

.auth-tab:hover {
    color: var(--text-secondary);
}

.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

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

.auth-error {
    background: var(--danger-subtle);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========================================================================
   Forms
   ======================================================================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ========================================================================
   Buttons
   ======================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-surface);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 8px 12px;
}
.btn-ghost:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========================================================================
   Layout: Top Bar
   ======================================================================== */

.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 50;
}

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

.topbar-brand {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-center {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

/* Quick client settings button in topbar */
.topbar-client-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
}
.topbar-client-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.topbar-client-btn-write {
    border-color: rgba(234, 179, 8, 0.5);
    color: var(--warning);
}
.topbar-client-btn-write:hover {
    background: rgba(234, 179, 8, 0.08);
}
.topbar-client-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    color: var(--text-secondary);
    font-size: 13px;
    background: none;
    border: none;
    font-family: inherit;
}
.topbar-user:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    font-size: 20px;
}
.hamburger-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* ========================================================================
   Layout: App Shell (Sidebar + Content)
   ======================================================================== */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ========================================================================
   Sidebar
   ======================================================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    overflow: hidden;
    transition: width 250ms ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Client Card */
.client-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 2px;
}

.client-card:hover {
    background: var(--bg-tertiary);
}

.client-card.active {
    background: var(--accent-subtle);
}

.client-card-info {
    flex: 1;
    min-width: 0;
}

.client-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-card-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}

.client-card-icon {
    width: 16px;
    height: 16px;
    opacity: 0.3;
}

.client-card-icon.connected {
    opacity: 1;
}

.client-card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition);
    margin-left: 4px;
}

.client-card:hover .client-card-actions {
    opacity: 1;
}

.client-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.client-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

/* ========================================================================
   Modal
   ======================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 24px 20px;
}

/* ========================================================================
   Confirm Dialog
   ======================================================================== */

.confirm-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* ========================================================================
   Dashboard / Content
   ======================================================================== */

.dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.dashboard-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.dashboard-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.dashboard-empty-text {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 400px;
}

.dashboard-client {
    max-width: 800px;
}

.dashboard-client h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.dashboard-client-notes {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.dashboard-placeholder {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
}

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.dashboard-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

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

.dashboard-tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.dashboard-tab svg {
    opacity: 0.6;
}

.dashboard-tab-active svg {
    opacity: 1;
}

.dashboard-tab-content {
    margin-top: 0;
}

/* ========================================================================
   Toast Notifications
   ======================================================================== */

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
    animation: toast-in 200ms ease;
    max-width: 360px;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

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

/* ========================================================================
   User Dropdown Menu
   ======================================================================== */

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    min-width: 180px;
    padding: 4px;
    z-index: 60;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
    text-align: left;
}

.user-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.user-dropdown-email {
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

/* ========================================================================
   Responsive
   ======================================================================== */

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

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 150;
        transform: translateX(-100%);
        transition: transform var(--transition);
    }

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 140;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .topbar-center {
        display: none;
    }
}

/* ========================================================================
   Utilities
   ======================================================================== */

/* ========================================================================
   Settings Page
   ======================================================================== */

.settings-page {
}

.settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.settings-title {
    font-size: 24px;
    margin-bottom: 4px;
}

.settings-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.settings-loading {
    color: var(--text-muted);
    padding: 32px 0;
    text-align: center;
}

.settings-empty {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    color: var(--text-secondary);
}

/* Provider Cards */
.provider-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.provider-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}

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

.provider-card-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.provider-name {
    font-size: 16px;
    font-weight: 600;
}

.provider-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.provider-card-details {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.provider-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.provider-detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.provider-detail-value {
    font-size: 13px;
    color: var(--text-secondary);
}

.api-key-masked {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.02em;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-active {
    background: var(--success-subtle);
    color: var(--success);
}

.badge-inactive {
    background: var(--bg-surface);
    color: var(--text-muted);
}

.badge-connected {
    background: var(--success-subtle);
    color: var(--success);
}

.badge-disconnected {
    background: var(--bg-surface);
    color: var(--text-muted);
}

.badge-expired {
    background: var(--danger-subtle);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-subtle);
    color: var(--warning);
}

/* Test Result */
.test-result {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.test-success {
    background: var(--success-subtle);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.test-error {
    background: var(--danger-subtle);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Add / Edit Provider Form */
.add-provider-form,
.edit-provider-form {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.edit-provider-form {
    margin-top: 8px;
    border-color: var(--warning);
    border-style: dashed;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-toggle input {
    padding-right: 60px;
}

.input-toggle-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: inherit;
}

.input-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

/* ========================================================================
   Credential Cards (Phase 2 - OAuth)
   ======================================================================== */

.credential-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.credential-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.credential-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.credential-card-title {
    font-size: 16px;
    font-weight: 600;
}

.credential-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credential-card-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.credential-card-detail .detail-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.credential-card-detail .detail-value {
    font-size: 13px;
    color: var(--text-secondary);
}

.customer-id-input {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.05em;
}

.credential-card-footer {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

/* ========================================================================
   Utilities
   ======================================================================== */

.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }

/* ========================================================================
   Campaign List
   ======================================================================== */

.campaign-view {
    width: 100%;
}

.campaign-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.campaign-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.campaign-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 0;
    color: var(--text-muted);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.campaign-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 0;
    color: var(--text-muted);
    text-align: center;
}

.campaign-error-icon {
    color: var(--warning);
}

.campaign-empty {
    padding: 48px 0;
    text-align: center;
    color: var(--text-muted);
}

/* Campaign Table */
.campaign-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.campaign-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.campaign-table thead {
    background: var(--bg-tertiary);
}

.campaign-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.campaign-table th.num,
.campaign-table td.num {
    text-align: right;
}

.campaign-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
}

.campaign-table tbody tr:last-child td {
    border-bottom: none;
}

.campaign-row {
    cursor: pointer;
    transition: background 0.15s;
}

.campaign-row:hover {
    background: var(--bg-tertiary);
}

.campaign-name {
    font-weight: 500;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-enabled {
    background: var(--success-subtle);
    color: var(--success);
}

.status-paused {
    background: var(--warning-subtle);
    color: var(--warning);
}

.status-removed {
    background: var(--danger-subtle);
    color: var(--danger);
}

/* ========================================================================
   Ad Cards
   ======================================================================== */

.ads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ad-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.ad-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.approval-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.approval-badge.approved {
    background: var(--success-subtle);
    color: var(--success);
}

.approval-badge.not-approved {
    background: var(--danger-subtle);
    color: var(--danger);
}

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

.ad-headline {
    background: var(--accent-subtle);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.ad-descriptions {
    margin-bottom: 8px;
}

.ad-description {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.ad-url {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    word-break: break-all;
}

.ad-metrics {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.ad-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ad-metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ad-metric-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================================================
   Import Form
   ======================================================================== */

.import-form {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.import-form .form-group {
    margin-bottom: 12px;
}

.import-form .form-group:last-of-type {
    margin-bottom: 16px;
}

/* ========================================================================
   Account Summary Card
   ======================================================================== */

.account-summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.account-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.account-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.account-summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 16px;
}

.summary-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ========================================================================
   Sub-Tabs (Ads / Keywords within ad group)
   ======================================================================== */

.sub-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 3px;
    width: fit-content;
}

.sub-tab {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

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

.sub-tab-active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ========================================================================
   Action Buttons in Table Rows
   ======================================================================== */

.actions-cell {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

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

/* ========================================================================
   Keyword Table
   ======================================================================== */

.keyword-text {
    font-weight: 500;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: monospace;
}

.match-exact {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.match-phrase {
    background: rgba(236, 172, 65, 0.15);
    color: #ecac41;
}

.match-broad {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* Quality Score badges */
.qs-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.qs-good {
    background: var(--success-subtle);
    color: var(--success);
}

.qs-ok {
    background: var(--warning-subtle);
    color: var(--warning);
}

.qs-bad {
    background: var(--danger-subtle);
    color: var(--danger);
}

/* ========================================================================
   Account List (MCC child accounts)
   ======================================================================== */

.account-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.account-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.account-card-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.account-card-info {
    flex: 1;
    min-width: 0;
}

.account-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-card-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.account-card-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ========================================================================
   Client Selector (Sidebar Dropdown)
   ======================================================================== */

.client-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.client-selector-btn:hover {
    border-color: var(--border-light);
    background: var(--bg-surface);
}

.client-selector-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

.client-dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.client-dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.client-dropdown-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

.client-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.client-dropdown-add {
    color: var(--accent);
}

.client-dropdown-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Row: selector button + gear shortcut side by side */
.client-selector-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.client-selector-row .client-selector-btn {
    flex: 1;
    min-width: 0;
}

/* Gear icon button — quick link to Client Hub */
.client-hub-shortcut {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.client-hub-shortcut:hover {
    background: var(--bg-surface);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* Dropdown section label (e.g. "Connections") */
.client-dropdown-section-label {
    padding: 4px 10px 2px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Connector / MCC items — slightly muted vs regular clients */
.client-dropdown-connector {
    opacity: 0.75;
    font-size: 12px;
}

.client-dropdown-connector:hover {
    opacity: 1;
}

/* ========================================================================
   Sidebar Section Title
   ======================================================================== */

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================================================
   Account Items (Sidebar)
   ======================================================================== */

.account-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 1px;
}

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

.account-item.active {
    background: var(--accent-subtle);
}

.account-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-item-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

/* ========================================================================
   Sidebar Footer
   ======================================================================== */

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.sidebar-footer-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
    text-align: left;
}

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

/* ========================================================================
   Chat Container
   ======================================================================== */

.app-content-chat {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

/* ========================================================================
   Account Selector Dropdown (Sidebar)
   ======================================================================== */

.sidebar-account-select {
    flex-shrink: 0;
}

.account-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.account-selector-btn:hover {
    border-color: var(--border-light);
    background: var(--bg-surface);
}

.account-selector-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-selector-placeholder {
    color: var(--text-muted);
}

.account-selector-wrap {
    position: relative;
}

.account-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 100;
    overflow: hidden;
}

.account-dropdown-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.account-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.account-search-input::placeholder {
    color: var(--text-muted);
}

.account-dropdown-list {
    max-height: min(420px, 55vh);
    overflow-y: auto;
    padding: 4px;
}

.account-dropdown-item {
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition);
}

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

.account-dropdown-item.active {
    background: var(--accent-subtle);
}

.account-dropdown-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-dropdown-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.account-dropdown-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ========================================================================
   Chat Sessions (Sidebar)
   ======================================================================== */

.sidebar-new-chat-btn {
    margin-left: auto;
    padding: 2px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.sidebar-new-chat-btn:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

.sidebar-sessions {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    min-height: 0;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    gap: 6px;
}

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

.session-item-active {
    background: var(--accent-subtle);
}

.session-item-content {
    flex: 1;
    min-width: 0;
}

.session-item-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item-meta {
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

.session-item-actions {
    display: none;
    gap: 2px;
    flex-shrink: 0;
}

.session-item:hover .session-item-actions {
    display: flex;
}

.session-action {
    padding: 3px;
    background: transparent;
    border: none;
    border-radius: 3px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.session-action:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.session-action-delete:hover {
    color: var(--danger);
}

.session-item-edit {
    flex: 1;
}

.session-edit-input {
    width: 100%;
    padding: 3px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    outline: none;
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-msg {
    display: flex;
    max-width: 100%;
    min-width: 0;
}

.chat-msg-user {
    justify-content: flex-end;
}

.chat-msg-assistant {
    justify-content: flex-start;
}

/* Chat Bubbles */
.chat-bubble {
    max-width: 720px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    min-width: 0;
    overflow: hidden;
}

.chat-bubble-user {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble-assistant {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-bubble-wide {
    max-width: 900px;
    width: 100%;
}

.chat-bubble-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger);
    background: var(--danger-subtle);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Welcome */
.chat-welcome {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-welcome-sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

/* Suggestions */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.chat-suggestion {
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.chat-suggestion:hover {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent);
}

/* Chat Card Titles */
.chat-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
}

.chat-card-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

/* Chat Metrics Grid */
.chat-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.chat-metrics-sm {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
}

.chat-metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.chat-metric-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.chat-metrics-sm .chat-metric-val {
    font-size: 15px;
}

.chat-metric-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Chat Table */
.chat-table-wrap {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.chat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.chat-table thead {
    background: var(--bg-tertiary);
}

.chat-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.chat-table th.num,
.chat-table td.num {
    text-align: right;
}

.chat-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    white-space: nowrap;
}

.chat-table tbody tr:last-child td {
    border-bottom: none;
}

.chat-table-row {
    cursor: pointer;
    transition: background 0.15s;
}

.chat-table-row:hover {
    background: var(--bg-tertiary);
}

.chat-campaign-name {
    font-weight: 500;
    color: var(--accent);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-empty {
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px 0;
}

/* Chat Loading Indicator */
.chat-bubble-loading {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
}

.chat-loading-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 2px;
    animation: chat-loading-fade 2s ease-in-out infinite;
}

@keyframes chat-loading-fade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.chat-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: chat-dot-pulse 1.4s ease-in-out infinite;
}

.chat-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-dot-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Chat Input Area */
.chat-input-area {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

/* .chat-input-wrap replaced by .chat-input-row (see below) */

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========================================================================
   LLM Chat Answer Styles
   ======================================================================== */

.chat-llm-answer {
    line-height: 1.7;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.chat-llm-answer p {
    margin-bottom: 0.6em;
}

.chat-llm-answer p:last-child {
    margin-bottom: 0;
}

.chat-llm-answer strong {
    color: #fff;
    font-weight: 600;
}

.chat-llm-answer ul,
.chat-llm-answer ol {
    padding-left: 1.4em;
    margin-bottom: 0.6em;
}

.chat-llm-answer li {
    margin-bottom: 0.25em;
}

.chat-llm-answer table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.6em 0;
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
}

.chat-llm-answer th,
.chat-llm-answer td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}

.chat-llm-answer th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: #fff;
}

.chat-llm-answer tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.chat-llm-answer code {
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
}

.chat-llm-answer pre {
    background: var(--bg-secondary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0.6em 0;
}

.chat-llm-answer pre code {
    background: none;
    padding: 0;
}

.chat-llm-answer h1,
.chat-llm-answer h2,
.chat-llm-answer h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin: 0.8em 0 0.3em;
}

.chat-llm-answer h1:first-child,
.chat-llm-answer h2:first-child,
.chat-llm-answer h3:first-child {
    margin-top: 0;
}

/* Tool badges */
.chat-tools-used {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.chat-tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.chat-tool-badge svg {
    opacity: 0.7;
}

/* ========================================================================
   Chat Charts
   ======================================================================== */

.chat-chart {
    margin: 12px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-width: 100%;
    position: relative;
}

.chat-chart canvas {
    display: block;
    width: 100% !important;
    max-height: 360px;
}

/* ========================================================================
   Chat Message Actions (tools + PDF button)
   ======================================================================== */

.chat-msg-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    gap: 8px;
}

.chat-msg-actions .chat-tools-used {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex: 1;
    min-width: 0;
}

.chat-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-pdf-btn:hover {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent);
}

.chat-pdf-btn svg {
    opacity: 0.7;
}

.chat-pdf-btn:hover svg {
    opacity: 1;
}

.chat-msg-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.chat-excel-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-excel-btn:hover {
    background: rgba(16, 163, 127, 0.08);
    color: #10a37f;
    border-color: #10a37f;
}

.chat-excel-btn svg {
    opacity: 0.7;
}

.chat-excel-btn:hover svg {
    opacity: 1;
}

/* ========================================================================
   API Keys Section (Settings)
   ======================================================================== */

.settings-section {
    margin-top: 32px;
}

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

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.mt-4 { margin-top: 32px; }

.created-key-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 8px;
}

.created-key-warning {
    font-size: 13px;
    font-weight: 600;
    color: var(--warning);
    margin-bottom: 10px;
}

.created-key-value {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

.created-key-value code {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: var(--accent);
    word-break: break-all;
    line-height: 1.4;
}

.api-keys-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-key-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.api-key-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.api-key-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.api-key-prefix {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.api-key-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.badge-scope {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* Ghost button variant */
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-ghost:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-ghost.text-danger:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-subtle);
}

/* ========================================================================
   Settings Tabs
   ======================================================================== */

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

/* Connections overview */
.conn-overview-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.conn-overview-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}
.conn-overview-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    flex-wrap: wrap;
}
.conn-overview-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    min-width: 120px;
}
.conn-overview-statuses {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
}
.conn-overview-platform {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.conn-overview-cid {
    color: var(--text-muted);
    font-size: 11px;
    font-family: monospace;
}
.conn-overview-details {
    border-top: 1px solid var(--border);
    padding: 16px;
    background: var(--bg);
}

.settings-tab {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    font-family: inherit;
}

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

.settings-tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ========================================================================
   Settings Table (Logs)
   ======================================================================== */

.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.settings-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.settings-table td {
    padding: 8px 10px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
}

.settings-table tr:hover td {
    background: var(--bg-tertiary);
}

/* ========================================================================
   Sidebar Brand
   ======================================================================== */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand svg {
    color: var(--accent);
    flex-shrink: 0;
}

/* ========================================================================
   Sidebar Selectors (Client + Account compact)
   ======================================================================== */

.sidebar-selectors {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.client-selector-wrap,
.account-selector-wrap {
    position: relative;
}

.sidebar-compact-status {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-compact-status.sidebar-compact-error {
    color: var(--danger);
}

/* ========================================================================
   Sidebar Navigation
   ======================================================================== */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-align: left;
    position: relative;
}

.sidebar-nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

.sidebar-nav-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-nav-item.active svg {
    opacity: 1;
}

.sidebar-nav-label {
    flex: 1;
}

.sidebar-nav-badge {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

/* ========================================================================
   Sidebar Chat Section
   ======================================================================== */

.sidebar-chat-section {
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 240px;
    flex-shrink: 0;
}

.sidebar-chat-section .sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-new-chat-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.sidebar-new-chat-btn:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

.sidebar-sessions {
    overflow-y: auto;
    padding: 4px 8px 8px;
}

/* ========================================================================
   Sidebar Footer (Language + User with submenu)
   ======================================================================== */

.sidebar-lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
    text-align: left;
    letter-spacing: 0.03em;
}

.sidebar-lang-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* User wrap — contains button + submenu */
.sidebar-user-wrap {
    position: relative;
}

.sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
    text-align: left;
}

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

.sidebar-user-email {
    flex: 1;
    font-size: 12px;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User submenu — opens upward from footer */
.sidebar-user-submenu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 4px;
    right: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    padding: 4px;
    z-index: 100;
    animation: submenuSlideUp 0.15s ease-out;
}

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

.sidebar-user-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-align: left;
}

.sidebar-user-submenu-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-user-submenu-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

.sidebar-user-submenu-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-user-submenu-item.active svg {
    opacity: 1;
}

.sidebar-user-submenu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.sidebar-user-submenu-logout {
    color: var(--text-muted);
}

.sidebar-user-submenu-logout:hover {
    color: var(--danger);
    background: var(--danger-subtle);
}

.sidebar-user-submenu-logout:hover svg {
    opacity: 1;
}

/* ========================================================================
   Placeholder Pages (Coming Soon)
   ======================================================================== */

.placeholder-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

.placeholder-content {
    text-align: center;
}

.placeholder-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.placeholder-content p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ========================================================================
   Image Upload — Chat
   ======================================================================== */

/* Drag overlay */
.chat-drag-overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 163, 127, 0.08);
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.chat-drag-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
}

/* Pending files strip above input */
.chat-pending-files {
    display: flex;
    gap: 8px;
    padding: 8px 16px 0;
    flex-wrap: wrap;
}

.chat-pending-file {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-pending-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-pending-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--transition);
}

.chat-pending-remove:hover {
    background: var(--danger);
}

/* ── Message queue strip ── */
.chat-queue-strip {
    margin: 0 16px 6px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-queue-header {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 2px;
}

.chat-queue-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .8rem;
}

.chat-queue-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.chat-queue-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 3px;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color .1s;
}

.chat-queue-item-remove:hover {
    color: var(--danger);
}

/* Attach button (📎) */
.chat-attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

.chat-attach-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Image thumbnails in chat messages */
.chat-image-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.chat-image-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: opacity var(--transition);
}

.chat-image-thumb:hover {
    opacity: 0.8;
}

/* ── Consolidated Chat Input Row ── */
.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 720px;
    margin: 0 auto;
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 4px 4px 4px 8px;
    transition: border-color var(--transition);
}

.chat-input-container:focus-within {
    border-color: var(--accent);
}

.chat-input-write {
    border-color: rgba(234, 179, 8, 0.4);
}

.chat-input-write:focus-within {
    border-color: var(--warning);
}

/* Mode indicator pill inside input */
.chat-input-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Button variant — clickable mode toggle */
.chat-input-mode-btn {
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, filter 0.15s;
}

.chat-input-mode-btn:hover:not(:disabled) {
    transform: scale(1.15);
    filter: brightness(1.25);
}

.chat-input-mode-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.chat-input-mode-readonly {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.chat-input-mode-write {
    color: var(--accent);
    background: var(--accent-subtle);
}

/* Spinning animation for write mode toggle loading state */
@keyframes chat-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.chat-mode-spin {
    animation: chat-spin 0.8s linear infinite;
}

/* Client settings gear button inside input container */
.chat-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    transition: color var(--transition), background var(--transition), transform 0.2s;
}

.chat-settings-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    transform: rotate(45deg);
}

/* Textarea inside container (no own border) */
.chat-input-container .chat-input {
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 8px;
    flex: 1;
}

.chat-input-container .chat-input:focus {
    border-color: transparent;
    box-shadow: none;
    outline: none;
}

/* Attach button inside container */
.chat-input-container .chat-attach-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    transition: color var(--transition), background var(--transition);
}

.chat-input-container .chat-attach-btn:hover:not(:disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.chat-input-container .chat-attach-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Auto-approve button (lightning bolt) */
.chat-autoapprove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all var(--transition);
}

.chat-autoapprove-btn:hover {
    color: var(--warning);
    background: rgba(234, 179, 8, 0.12);
}

.chat-autoapprove-btn.active {
    color: var(--warning);
    background: rgba(234, 179, 8, 0.12);
}

/* ── Wizard Suggestion Buttons ── */
.chat-suggestion-wizard {
    background: rgba(16, 163, 127, 0.08);
    border-color: var(--accent);
    color: var(--accent);
}

.chat-suggestion-wizard:hover {
    background: rgba(16, 163, 127, 0.18);
    color: var(--accent);
}

/* ── Images in LLM Answers ── */
.chat-llm-answer img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    transition: opacity 0.2s;
    border: 1px solid var(--border-color);
}

.chat-llm-answer img:hover {
    opacity: 0.85;
}

/* Grid layout when multiple images */
.chat-llm-answer p:has(img + img),
.chat-llm-answer p:has(img) + p:has(img) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-llm-answer p:has(img + img) img,
.chat-llm-answer p:has(img) + p:has(img) img {
    max-width: calc(50% - 4px);
    flex: 0 0 auto;
}

/* ── Textarea chat input (replaces <input type=text>) ── */
textarea.chat-input {
    resize: none;
    overflow-y: hidden;
    min-height: 42px;
    max-height: 200px;
    line-height: 1.5;
    padding-top: 10px;
    padding-bottom: 10px;
    font-family: inherit;
}

/* (keyboard hint removed — consolidated into input row) */

/* ── Per-message action buttons (hover) ── */
.chat-msg-user-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.chat-msg-hover-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.chat-msg-user-wrap:hover .chat-msg-hover-actions {
    opacity: 1;
}

.chat-msg-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    padding: 0;
}

.chat-msg-action-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.chat-msg-action-delete:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* ── Chat mode badge (Read Only / Write) ── */
.chat-mode-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    text-transform: uppercase;
    line-height: 1.6;
}

.chat-mode-readonly {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.25);
}

.chat-mode-write {
    color: #10a37f;
    background: rgba(16, 163, 127, 0.1);
    border-color: rgba(16, 163, 127, 0.25);
}

/* ── Write-Mode Row (ClientSettings) ─────────────────────────── */
.write-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-secondary, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    margin-bottom: 12px;
}

.write-mode-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.write-mode-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e5e7eb);
}

.write-mode-desc {
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    line-height: 1.4;
}

.btn-write-inactive {
    white-space: nowrap;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-write-inactive:hover {
    background: rgba(245, 158, 11, 0.2);
}

.btn-write-active {
    white-space: nowrap;
    color: #10a37f;
    background: rgba(16, 163, 127, 0.1);
    border: 1px solid rgba(16, 163, 127, 0.3);
}

.btn-write-active:hover {
    background: rgba(16, 163, 127, 0.2);
}

/* ══════════════════════════════════════════════════════════════
   Write Mode: Dashed Border on Chat Container (YOLO-style)
   ══════════════════════════════════════════════════════════════ */
.chat-container-write {
    border: 2px dashed rgba(234, 179, 8, 0.5);
    border-radius: var(--radius);
    position: relative;
    box-shadow: inset 0 0 20px rgba(234, 179, 8, 0.04);
    animation: write-mode-pulse 3s ease-in-out infinite;
}

@keyframes write-mode-pulse {
    0%, 100% {
        border-color: rgba(234, 179, 8, 0.5);
        box-shadow: inset 0 0 20px rgba(234, 179, 8, 0.04);
    }
    50% {
        border-color: rgba(234, 179, 8, 0.25);
        box-shadow: inset 0 0 30px rgba(234, 179, 8, 0.06);
    }
}

/* ══════════════════════════════════════════════════════════════
   Client Context Panel (collapsible, above chat body)
   ══════════════════════════════════════════════════════════════ */
.chat-client-panel {
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-client-panel-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: color var(--transition), background var(--transition);
}

.chat-client-panel-toggle:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.chat-client-name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: left;
}

.chat-client-has-context {
    color: var(--accent);
    opacity: 0.6;
    display: flex;
    align-items: center;
}

.chat-client-panel-body {
    padding: 0 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-client-panel-body label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chat-client-panel-body p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 2px 0 0;
    white-space: pre-wrap;
}

.chat-client-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   Client Hub Component
   ══════════════════════════════════════════════════════════════ */
.client-hub {
    max-width: 800px;
    padding: 24px;
}

.client-hub-header {
    margin-bottom: 20px;
}

.client-hub-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.client-hub-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.client-hub-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}

.client-hub-tab:hover {
    color: var(--text-primary);
}

.client-hub-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.client-hub-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.client-hub-actions {
    display: flex;
    gap: 12px;
}

.client-info-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.client-info-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.client-info-card-header label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.client-info-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.client-info-textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    padding: 10px 12px;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
    line-height: 1.5;
    box-sizing: border-box;
}

.client-info-textarea:focus {
    border-color: var(--accent);
}

.client-info-textarea::placeholder {
    color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════
   Write Mode Toggle (in ClientHub Overview tab)
   ══════════════════════════════════════════════════════════════ */
.client-write-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border-color 0.2s, background 0.2s;
}
.client-write-toggle-active {
    border-color: rgba(234, 179, 8, 0.4);
    background: rgba(234, 179, 8, 0.05);
}
.client-write-toggle-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.client-write-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    color: var(--text-secondary);
}
.client-write-toggle-active .client-write-toggle-icon {
    color: var(--warning);
    background: rgba(234, 179, 8, 0.12);
}
.client-write-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.client-write-toggle-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Toggle switch */
.client-write-switch {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.client-write-switch.on {
    background: var(--warning);
    border-color: var(--warning);
}
.client-write-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s, background 0.2s;
}
.client-write-switch.on .client-write-switch-thumb {
    transform: translateX(18px);
    background: #fff;
}

/* ========================================================================
   Sidebar: Resize Handle, Collapse / Expand, Brand Button
   ======================================================================== */

/* Draggable resize handle — positioned in .app-layout (position:relative),
   snaps to the right edge of the sidebar via left: var(--sidebar-width) */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    left: var(--sidebar-width);
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 20;
    transform: translateX(-50%);
    background: transparent;
    transition: background 0.2s;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.resizing {
    background: var(--accent);
    opacity: 0.4;
}

/* Clickable brand button (logo → home) */
.sidebar-brand-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: color var(--transition);
}

.sidebar-brand-btn:hover {
    color: var(--accent);
}

.sidebar-brand-btn svg {
    flex-shrink: 0;
    color: var(--accent);
}

/* Collapse button (← arrow inside sidebar brand area) */
.sidebar-collapse-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
    padding: 0;
}

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

/* Expand button — fixed at left edge of viewport when sidebar is hidden */
.sidebar-expand-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    width: 20px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
    padding: 0;
}

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

/* ========================================================================
   Client Dropdown — Search Input
   ======================================================================== */

.client-dropdown-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.client-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
}

.client-search-input::placeholder {
    color: var(--text-muted);
}

/* ========================================================================
   Clients Home — Grid of linked accounts
   ======================================================================== */

.clients-home {
    height: 100%;
    overflow-y: auto;
    padding: 24px;
}

.clients-home-header {
    margin-bottom: 24px;
}

.clients-home-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.clients-home-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.clients-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.client-home-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform 0.1s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.client-home-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-subtle), var(--shadow-sm);
    transform: translateY(-1px);
}

.client-home-card-active {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.client-home-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    color: var(--accent);
    margin-bottom: 4px;
    flex-shrink: 0;
}

.client-home-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-home-card-account {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-home-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.client-home-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.client-home-badge-write {
    color: var(--warning);
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.25);
}

.client-home-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 48px 24px;
    font-size: 14px;
}

/* ── View toggle & header row ──────────────────────────────────────────── */

.clients-home-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.clients-view-toggle {
    display: flex;
    gap: 3px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
    flex-shrink: 0;
    align-self: flex-start;
}

.cvt-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: calc(var(--radius) - 2px);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

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

.cvt-btn-active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ── Read-only mode badge (table view) ────────────────────────────────── */

.client-home-badge-read {
    color: var(--text-muted);
    border-color: var(--border);
    background: transparent;
}

/* ── Table view ───────────────────────────────────────────────────────── */

.clients-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.clients-table thead th {
    text-align: left;
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.clients-table-row {
    cursor: pointer;
}

.clients-table-row td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
    transition: background var(--transition);
}

.clients-table-row:hover td {
    background: var(--bg-hover, var(--bg-secondary));
}

.clients-table-row-active td {
    background: var(--accent-subtle);
}

.clients-table-name {
    font-weight: 500;
}

.clients-table-cid {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, 'Cascadia Code', monospace;
}

/* ── Detail / performance view ────────────────────────────────────────── */

.perf-period-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, var(--text-primary));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.clients-detail-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.client-detail-row {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color var(--transition), background var(--transition);
    min-height: 64px;
}

.client-detail-row:hover {
    border-color: var(--accent);
}

.client-detail-row-active {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.client-detail-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    max-width: 250px;
    cursor: pointer;
    flex-shrink: 0;
}

.client-detail-meta {
    overflow: hidden;
}

.client-detail-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-detail-cid {
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, 'Cascadia Code', monospace;
    margin-top: 1px;
}

.client-detail-metrics {
    display: flex;
    align-items: stretch;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

.perf-metric {
    flex: 1;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    border-left: 1px solid var(--border);
    text-align: center;
}

.perf-metric-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
    white-space: nowrap;
}

.perf-metric-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.perf-delta {
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
}

.perf-delta-up {
    color: #22c55e;
}

.perf-delta-down {
    color: #ef4444;
}

.perf-delta-neutral {
    color: var(--text-muted);
}

/* Skeleton shimmer for loading state */
.perf-skeleton {
    flex: 1;
    min-width: 72px;
    height: 40px;
    margin: 4px 6px;
    border-radius: var(--radius-sm);
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-secondary, var(--bg-hover, #e5e7eb)) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: ch-shimmer 1.4s ease-in-out infinite;
}

@keyframes ch-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.perf-error {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-left: 1px solid var(--border);
    color: #ef4444;
    font-size: 12px;
}

.perf-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border-left: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}

/* ========================================================================
   Client Settings Drawer (slide-over panel)
   ======================================================================== */

.client-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    display: flex;
    justify-content: flex-end;
}

.client-drawer {
    width: min(680px, 100vw);
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Vue transition for drawer */
.drawer-enter-active .client-drawer { animation: slideInRight 220ms cubic-bezier(0.22, 1, 0.36, 1); }
.drawer-leave-active .client-drawer { animation: slideOutRight 180ms cubic-bezier(0.55, 0, 1, 0.45); }
.drawer-enter-active .client-drawer-overlay { animation: fadeInOverlay 220ms ease; }
.drawer-leave-active .client-drawer-overlay { animation: fadeOutOverlay 180ms ease; }

@keyframes slideInRight  { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOutRight { from { transform: translateX(0); }   to { transform: translateX(100%); } }
@keyframes fadeInOverlay  { from { background: transparent; }   to { background: rgba(0,0,0,.45); } }
@keyframes fadeOutOverlay { from { background: rgba(0,0,0,.45); } to { background: transparent; } }

.client-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-surface);
}

.client-drawer-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.client-drawer-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.client-drawer-body {
    flex: 1;
    overflow-y: auto;
    /* Let ClientHub component own its padding */
}

/* ========================================================================
   Feature Pages — shared layout
   ======================================================================== */

.feature-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 24px;
}

.feature-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.feature-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.feature-page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.feature-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.feature-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.feature-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--danger, #ef4444);
    font-size: 13px;
    margin-bottom: 16px;
}

.feature-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 48px 24px;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Feature-page button helpers (scoped to avoid conflicting with .btn system) */
.feature-page .btn-primary, .automations-editor .btn-primary, .client-drawer .btn-primary  {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
    background: var(--accent); color: #fff; border: none; border-radius: 6px;
    cursor: pointer; font-size: 13px; font-weight: 500; transition: opacity 0.15s; font-family: inherit;
}
.feature-page .btn-primary:hover, .automations-editor .btn-primary:hover, .client-drawer .btn-primary:hover { opacity: 0.88; }
.feature-page .btn-primary:disabled, .automations-editor .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.feature-page .btn-secondary, .automations-editor .btn-secondary {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
    background: transparent; color: var(--text-secondary); border: 1px solid var(--border);
    border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500;
    transition: background 0.15s, color 0.15s; font-family: inherit;
}
.feature-page .btn-secondary:hover, .automations-editor .btn-secondary:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.feature-page .btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.feature-page .btn-sm, .automations-editor .btn-sm { padding: 5px 10px; font-size: 12px; }
.icon-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.icon-btn-danger:hover { background: rgba(239,68,68,0.1); color: var(--danger, #ef4444); }

/* ========================================================================
   Alerts Page
   ======================================================================== */

.alerts-filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.alerts-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.alerts-filter-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.alerts-filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.alerts-filter-btn.active .alerts-badge { background: rgba(255,255,255,0.25); color: #fff; }

.alerts-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 700;
}
.alerts-badge-critical { background: rgba(239,68,68,0.15); color: var(--danger, #ef4444); }
.alerts-badge-warning  { background: rgba(245,158,11,0.15); color: var(--warning, #f59e0b); }
.alerts-badge-info     { background: rgba(99,102,241,0.12); color: var(--accent); }

.alerts-list { display: flex; flex-direction: column; gap: 10px; }

.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    position: relative;
    transition: box-shadow 0.15s;
}
.alert-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.alert-card-critical { border-left: 3px solid var(--danger, #ef4444); }
.alert-card-warning  { border-left: 3px solid var(--warning, #f59e0b); }
.alert-card-info     { border-left: 3px solid var(--accent); }

.alert-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.alert-card-critical .alert-card-icon { background: rgba(239,68,68,0.1);  color: var(--danger, #ef4444); }
.alert-card-warning  .alert-card-icon { background: rgba(245,158,11,0.1); color: var(--warning, #f59e0b); }
.alert-card-info     .alert-card-icon { background: rgba(99,102,241,0.1); color: var(--accent); }

.alert-card-body { flex: 1; min-width: 0; }
.alert-card-title   { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.alert-card-message { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.alert-card-meta    { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.alert-card-dismiss {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.alert-card-dismiss:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ========================================================================
   Actions Page
   ======================================================================== */

.actions-list { display: flex; flex-direction: column; gap: 0; }

.actions-group-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 20px 0 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.actions-group-date:first-child { padding-top: 0; }

.actions-session-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: default;
    transition: background 0.12s;
    margin-bottom: 4px;
}
.actions-session-card:hover { background: var(--bg-tertiary); }

.actions-session-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.actions-session-icon.write { background: rgba(245,158,11,0.12); color: var(--warning, #f59e0b); }
.actions-session-icon.read  { background: var(--bg-tertiary); color: var(--text-muted); }

.actions-session-body { flex: 1; min-width: 0; }
.actions-session-title { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions-session-meta  { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.actions-write-badge { background: rgba(245,158,11,0.15); color: var(--warning,#f59e0b); font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }

/* ========================================================================
   Automations Page
   ======================================================================== */

.automations-phase-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.automations-editor {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.automations-editor-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0 0 16px 0; }

.automations-form { display: flex; flex-direction: column; gap: 12px; }
.automations-form-row { display: flex; flex-direction: column; gap: 5px; }
.automations-form-toggle { flex-direction: row; align-items: center; justify-content: space-between; }

.automations-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

.automations-rule-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: box-shadow 0.15s;
}
.automations-rule-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.automations-rule-card.disabled { opacity: 0.5; }

.automations-rule-toggle { flex-shrink: 0; }
.automations-rule-body   { flex: 1; min-width: 0; }
.automations-rule-name   { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 5px; }
.automations-rule-desc   { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.automations-rule-actions { display: flex; gap: 4px; flex-shrink: 0; }

.automations-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.automations-chip-trigger { background: rgba(99,102,241,0.1); color: var(--accent); }
.automations-chip-action  { background: rgba(16,185,129,0.1); color: var(--success, #10b981); }

/* Generic form inputs for feature pages */
.hub-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.hub-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.hub-input:focus { border-color: var(--accent); }
.hub-input[type="number"] { width: 100%; }

/* Toggle switch */
.hub-toggle    { position: relative; width: 44px; height: 24px; border-radius: 12px; border: none; background: var(--border); cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.hub-toggle.active { background: var(--accent); }
.hub-toggle-sm { width: 36px; height: 20px; border-radius: 10px; }
.hub-toggle-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.hub-toggle.active .hub-toggle-thumb { transform: translateX(20px); }
.hub-toggle-sm .hub-toggle-thumb { width: 14px; height: 14px; }
.hub-toggle-sm.active .hub-toggle-thumb { transform: translateX(16px); }

/* ========================================================================
   Reports Page
   ======================================================================== */

.reports-range-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.reports-range-presets { display: flex; gap: 6px; flex-wrap: wrap; }

.reports-preset-btn {
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.reports-preset-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.reports-preset-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.reports-custom-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.reports-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.reports-summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.reports-summary-label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.reports-summary-value { font-size: 20px; font-weight: 700; color: var(--text-primary); }

.reports-section-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0 0 14px 0; }

.reports-table-wrap { margin-bottom: 24px; }
.reports-table-scroll { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }

.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.reports-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.reports-table th.num { text-align: right; }
.reports-table td {
    padding: 10px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.reports-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.reports-table tbody tr:last-child td { border-bottom: none; }
.reports-table tbody tr:hover td { background: var(--bg-tertiary); }

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-enabled { background: rgba(16,185,129,0.1); color: var(--success, #10b981); }
.status-paused  { background: rgba(245,158,11,0.1);  color: var(--warning, #f59e0b); }

/* ========================================================================
   v19: Quick Actions, Integration Badges, Help Page, Sidebar Minifooter
   ======================================================================== */

/* ── Google Ads integration badge on client cards ───────────────────────── */
.client-home-card-integrations {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.client-integration-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    background: rgba(66, 133, 244, 0.12);
    color: #4285f4;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.client-integration-badge svg { flex-shrink: 0; }

/* ── Home section header ────────────────────────────────────────────────── */
.home-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 28px 0 14px;
}
.home-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}
.home-section-client {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ── Quick actions grid ─────────────────────────────────────────────────── */
.quick-actions-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.quick-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    color: var(--text-primary);
    width: 100%;
}
.quick-action-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
    transform: translateX(2px);
}
.quick-action-card:active { transform: translateX(0); }
.quick-action-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 8px;
}
.quick-action-body { flex: 1; min-width: 0; }
.quick-action-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-action-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.quick-action-arrow {
    flex-shrink: 0;
    opacity: 0.3;
    transition: opacity 0.15s, transform 0.15s;
}
.quick-action-card:hover .quick-action-arrow {
    opacity: 0.7;
    transform: translateX(3px);
}

/* ── Sidebar minifooter ─────────────────────────────────────────────────── */
.sidebar-minifooter {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0 2px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
}
.sidebar-minifooter-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.sidebar-minifooter-link:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

/* ── Help page ──────────────────────────────────────────────────────────── */
.help-page { max-width: 900px; }

.help-intro {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 24px;
}
.help-intro-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 10px;
}
.help-intro-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 8px;
}
.help-intro-tip {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}
.help-intro-tip strong { color: var(--text-secondary); }

.help-capabilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.help-cap-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
}
.help-cap-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.help-cap-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 8px;
}
.help-cap-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.help-cap-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.help-cap-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.help-cap-item svg { margin-top: 2px; }

.help-tips-section { margin-top: 8px; }
.help-tips-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 14px;
}
.help-tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.help-tip-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.help-tip-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.help-tip-card strong { color: var(--text-primary); }

/* ========================================================================
   Select / hub-select — dark theme fix
   ======================================================================== */

select,
select.hub-input,
.hub-select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 32px 8px 10px;
    font-size: 13px;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e8e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: border-color var(--transition);
    width: 100%;
    min-width: 0;
}
select:focus,
select.hub-input:focus,
.hub-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}
select option,
select optgroup {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
select optgroup {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ========================================================================
   Automations v2 — new elements
   ======================================================================== */

/* Label chips (POKUD / PAK) */
.automations-label-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    margin-right: 4px;
}
.automations-label-if {
    background: rgba(99,102,241,.15);
    color: #818cf8;
}
.automations-label-then {
    background: rgba(16,185,129,.15);
    color: #34d399;
}

/* Form grid — 2 columns on wide screens */
.automations-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
}
.automations-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.automations-form-row-full {
    grid-column: 1 / -1;
}
.automations-form-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
.automations-then-arrow {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--text-muted);
}
.automations-form-toggle {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    grid-column: 1 / -1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Priority row */
.automations-priority-row {
    display: flex;
    gap: 8px;
}
.automations-priority-btn {
    flex: 1;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.automations-priority-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* Rule card — meta tags row */
.automations-rule-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 4px 0 6px;
}
.automations-meta-tag {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 7px;
    white-space: nowrap;
}

/* ========================================================================
   Reports v2 — Chart.js charts
   ======================================================================== */

.reports-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0 8px;
}
@media (max-width: 900px) {
    .reports-charts-grid { grid-template-columns: 1fr; }
}

.reports-chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px 18px;
}
.reports-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.reports-chart-wrap {
    position: relative;
    height: 220px;
}
.reports-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Automations form on small screens — single column */
@media (max-width: 640px) {
    .automations-form { grid-template-columns: 1fr; }
    .automations-form-row-full { grid-column: 1; }
}

/* ========================================================================
   Dashboard Overview v7 — Account header + Quick Actions
   ======================================================================== */

.dashboard-overview {
    padding: 24px;
    max-width: 800px;
}

/* Account header card */
.dashboard-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    gap: 12px;
}
.dashboard-overview-account {
    display: flex;
    align-items: center;
    gap: 14px;
}
.dashboard-overview-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dashboard-overview-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.dashboard-overview-id {
    font-size: 12px;
    color: var(--text-muted);
}
.dashboard-overview-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Mode badge (Read only / Write mode) */
.dashboard-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    white-space: nowrap;
}
.dashboard-mode-badge-write {
    color: var(--warning);
    background: var(--warning-subtle);
    border-color: rgba(234, 179, 8, 0.3);
}

/* Quick actions heading */
.dashboard-qa-heading {
    margin-bottom: 16px;
}
.dashboard-qa-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
}
.dashboard-qa-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    padding-left: 23px;
}

/* Quick actions grid (vertical list) */
.dashboard-qa-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

/* QA card */
.dashboard-qa-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform 80ms ease;
    text-align: left;
    width: 100%;
    color: inherit;
    font-family: inherit;
}
.dashboard-qa-card:hover {
    border-color: var(--border-light);
    background: var(--bg-tertiary);
    transform: translateX(3px);
}
.dashboard-qa-card:active {
    transform: translateX(1px);
}
.dashboard-qa-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dashboard-qa-card-body {
    flex: 1;
    min-width: 0;
}
.dashboard-qa-card-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.dashboard-qa-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-qa-card-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity var(--transition), transform var(--transition);
}
.dashboard-qa-card:hover .dashboard-qa-card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* "Open Chat" hint footer */
.dashboard-open-chat-hint {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.dashboard-open-chat-hint strong {
    color: var(--text-secondary);
}
.dashboard-open-chat-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: inherit;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity var(--transition);
}
.dashboard-open-chat-link:hover {
    opacity: 0.8;
}

/* ========================================================================
   Session Status Dots — Working (green pulse) + Unread (orange)
   ======================================================================== */

/* Title row: flex container holding the title + optional status dot */
.session-item-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.session-item-title-row .session-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Base dot */
.session-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Working: green pulsing — LLM is still processing */
.session-status-working {
    background: #10a37f;
    animation: pulse-dot 1.4s ease-in-out infinite;
}

/* Unread: orange solid — AI replied while user was away */
.session-status-unread {
    background: #f59e0b;
}

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

/* ========================================================================
   Active Integrations Overview — ClientSettings v2.3
   ======================================================================== */

.active-creds-section {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    overflow: hidden;
}

.active-creds-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.active-cred-row {
    border-bottom: 1px solid var(--border);
}
.active-cred-row:last-child {
    border-bottom: none;
}

.active-cred-main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
}

.active-cred-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.active-cred-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.active-cred-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.active-cred-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
}

.active-cred-id {
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 6px;
    white-space: nowrap;
}

.active-cred-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: auto;
}

.active-cred-edit {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.active-cred-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ========================================================================
   Integrations Tab — SettingsPage v4.7
   ======================================================================== */

/* App credentials table (Section A) */
.integ-app-table { width:100%; border-collapse:collapse; font-size:13px; }
.integ-app-table thead tr { background:var(--bg-tertiary); border-bottom:2px solid var(--border); }
.integ-app-table th { padding:8px 12px; text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); font-weight:600; }
.integ-app-table td { padding:10px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.integ-app-table tr:last-child td { border-bottom:none; }
.integ-app-platform { display:flex; align-items:center; gap:8px; font-weight:600; font-size:13px; }
.integ-app-id code, .integ-app-secret code { font-size:11px; background:var(--bg-tertiary); border:1px solid var(--border); border-radius:3px; padding:2px 6px; font-family:'Courier New',monospace; color:var(--text-secondary); max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; }
.integ-app-actions { text-align:right; }
.integ-app-row-open td { background:var(--bg-secondary); }
.integ-app-edit-row > td { background:var(--bg-secondary); padding:0; }
.integ-app-edit-form { padding:14px 14px 18px; }
.integ-app-edit-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

/* Connections table (Section B) */
.integ-conn-table { border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.integ-conn-head { display:grid; grid-template-columns:1.5fr 1.5fr 1.8fr 100px 120px 130px; gap:0; padding:8px 14px; background:var(--bg-tertiary); border-bottom:1px solid var(--border); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); }
.integ-conn-row { display:grid; grid-template-columns:1.5fr 1.5fr 1.8fr 100px 120px 130px; gap:0; padding:10px 14px; border-bottom:1px solid var(--border); align-items:center; transition:background .12s; }
.integ-conn-row:hover { background:var(--bg-secondary); }
.integ-conn-row-active { background:var(--bg-secondary); }
.integ-conn-platform { display:flex; align-items:center; gap:6px; font-size:13px; }
.integ-conn-ids { display:flex; flex-wrap:wrap; gap:4px; }
.integ-conn-date { font-size:12px; color:var(--text-muted); }
.integ-conn-actions { display:flex; align-items:center; gap:4px; justify-content:flex-end; }
.integ-conn-edit { border-bottom:1px solid var(--border); background:var(--bg-secondary); }
.integ-conn-edit-inner { padding:14px 16px; }
.integ-conn-edit-grid { display:grid; grid-template-columns:2fr 1fr 1fr; gap:10px; }
.integ-conn-edit-actions { display:flex; gap:8px; margin-top:10px; }

/* MCC account tree */
.integ-conn-tree { border-bottom:1px solid var(--border); background:var(--bg-tertiary); }
.integ-tree-row { display:flex; align-items:center; gap:8px; padding:7px 24px; border-bottom:1px solid var(--border); font-size:12px; }
.integ-tree-row:last-child { border-bottom:none; }
.integ-tree-id { font-family:'Courier New',monospace; font-size:11px; background:var(--bg-secondary); border:1px solid var(--border); border-radius:3px; padding:1px 6px; color:var(--text-secondary); flex-shrink:0; }
.integ-tree-name { flex:1; color:var(--text-primary); font-size:12px; }

/* ========================================================================
   Multi-MCC Connections UI — ClientSettings v2.0
   ======================================================================== */

/* ── Extra small button variant ────────────────────────────────────────── */
.btn-xs {
    padding: 3px 7px;
    font-size: 11px;
    line-height: 1.4;
    border-radius: var(--radius-sm);
    min-height: 24px;
}

/* ── Connections list ───────────────────────────────────────────────────── */
.mcc-connections-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.mcc-connection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
}
.mcc-connection-item:hover {
    border-color: var(--primary);
}

/* Info block (icon + text) */
.mcc-conn-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.mcc-conn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--primary);
    flex-shrink: 0;
}

.mcc-conn-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mcc-conn-details {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mcc-conn-date {
    opacity: 0.75;
}

/* Action buttons */
.mcc-conn-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

/* ── Edit form (inline inside connection item) ──────────────────────────── */
.mcc-edit-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

/* ── Add connection form ────────────────────────────────────────────────── */
.mcc-add-form {
    margin-top: 10px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mcc-add-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

/* ── File upload zone ───────────────────────────────────────────────────── */
.mcc-file-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, background 0.15s;
}
.mcc-file-zone:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.04);
}

.mcc-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.mcc-file-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Divider "nebo zadat ručně" ─────────────────────────────────────────── */
.mcc-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.mcc-divider::before,
.mcc-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ========================================================================
   Sidebar CHATY section — clickable title link + unread badge  (v25.0)
   ======================================================================== */

/* Clickable "CHATY" label that navigates to /chat */
.sidebar-section-title-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    transition: color var(--transition);
    flex: 1;
    min-width: 0;
}

.sidebar-section-title-link:hover {
    color: var(--accent);
}

/* Unread badge on the CHATY section header */
.sidebar-chat-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--warning, #f59e0b);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    line-height: 1;
    flex-shrink: 0;
}

/* ========================================================================
   Chat error bubble — retry button
   ======================================================================== */

/* Retry button — distinct from delete, uses accent color */
.chat-msg-action-retry {
    color: var(--accent);
    border-color: var(--accent);
    opacity: 0.85;
}

.chat-msg-action-retry:hover {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent);
    opacity: 1;
}

.chat-msg-action-retry:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Message timestamps ── */
.chat-msg-time {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
    text-align: right;
    user-select: none;
    white-space: nowrap;
}

.chat-msg-time-inline {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
}

/* ========================================================================
   Facebook App Setup Modal
   ======================================================================== */
.fb-setup-modal {
    width: 100%;
    max-width: 520px;
}

.fb-modal-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 12px 0;
}

/* Step-by-step instructions */
.fb-modal-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 18px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.fb-modal-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.fb-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}
.fb-modal-steps a {
    color: var(--accent);
    text-decoration: underline;
}

/* Redirect URI row */
.fb-modal-redirect-row {
    margin-bottom: 16px;
}
.fb-modal-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fb-modal-redirect-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.fb-modal-redirect-uri {
    flex: 1;
    font-size: 12px;
    font-family: 'Fira Mono', 'Consolas', monospace;
    color: var(--text-secondary);
    word-break: break-all;
    background: none;
}

/* Form fields */
.fb-modal-field {
    margin-bottom: 16px;
}
.fb-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--transition);
}
.fb-modal-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
.fb-modal-secret-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.fb-modal-secret-row .fb-modal-input {
    flex: 1;
}
.fb-secret-toggle {
    flex-shrink: 0;
    padding: 8px 10px !important;
}
.fb-modal-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin: 4px 0 0;
}
.fb-secret-saved-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--success, #22c55e);
    background: rgba(34, 197, 94, 0.1);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 4px;
}

/* ========================================================================
   Dashboard Quick Actions — 2-column layout
   ======================================================================== */
.dashboard-qa-grid-2col {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.dashboard-qa-grid-2col .dashboard-qa-card {
    transform: none !important;
}
.dashboard-qa-grid-2col .dashboard-qa-card:hover {
    transform: translateY(-1px) !important;
}

/* ========================================================================
   Dashboard — Active Campaigns Section
   ======================================================================== */
.dashboard-campaigns {
    margin-top: 24px;
}
.dashboard-campaigns-heading {
    margin-bottom: 12px;
}
.dashboard-campaigns-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 12px 0;
}
.dashboard-campaigns-error,
.dashboard-campaigns-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 10px 0;
}
.dashboard-campaigns-error {
    color: var(--danger, #ef4444);
}
.dashboard-campaigns-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.dashboard-campaigns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dashboard-campaigns-table thead th {
    background: var(--bg-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.dashboard-campaigns-table thead th.dct-num,
.dashboard-campaigns-table tbody td.dct-num-cell {
    text-align: right;
}
.dashboard-campaigns-table tbody .dct-row {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.dashboard-campaigns-table tbody .dct-row:last-child {
    border-bottom: none;
}
.dashboard-campaigns-table tbody .dct-row:hover {
    background: var(--bg-secondary);
}
.dashboard-campaigns-table tbody td {
    padding: 9px 12px;
    color: var(--text-primary);
    vertical-align: middle;
}
.dct-name-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.dct-num-cell {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ========================================================================
   Client Cards — Screenshot Background
   ======================================================================== */
.client-home-card-screenshot {
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    min-height: 160px;
}
/* Gradient overlay */
.client-home-card-screenshot::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.35) 0%,
        rgba(0, 0, 0, 0.75) 100%
    );
    border-radius: inherit;
    z-index: 0;
}
.client-home-card-screenshot .client-home-card-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
}
.client-home-card-screenshot .client-home-card-name {
    color: #fff;
}
.client-home-card-screenshot .client-home-card-account,
.client-home-card-screenshot .client-integration-badge {
    color: rgba(255, 255, 255, 0.75);
}
.client-home-card-screenshot .client-home-card-icon {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.client-home-card-screenshot:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-subtle), var(--shadow-sm);
    transform: translateY(-2px);
}
.client-home-card-screenshot.client-home-card-active::before {
    background: linear-gradient(
        to bottom,
        rgba(99, 102, 241, 0.5) 0%,
        rgba(99, 102, 241, 0.8) 100%
    );
}

/* ── Non-screenshot cards still need no inner wrapper ── */
.client-home-card:not(.client-home-card-screenshot) .client-home-card-inner {
    display: contents; /* pass-through: children behave as direct card children */
}

/* ── URL row (sits at bottom of card) ── */
.client-home-card-url-row {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
}

/* "Přidat web" button (shown when no URL set) */
.client-url-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.client-url-add-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.client-home-card-screenshot .client-url-add-btn {
    color: rgba(255,255,255,0.55);
    border-color: rgba(255,255,255,0.3);
}
.client-home-card-screenshot .client-url-add-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.7);
}

/* URL display + click-to-edit button (shown when URL is set) */
.client-url-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    font-size: 10px;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 2px 4px 2px 0;
    cursor: pointer;
    font-family: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition);
    border-radius: 3px;
}
.client-url-edit-btn:hover {
    color: var(--accent);
}
.client-home-card-screenshot .client-url-edit-btn {
    color: rgba(255,255,255,0.6);
}
.client-home-card-screenshot .client-url-edit-btn:hover {
    color: #fff;
}

/* Inline input row */
.client-home-card-url-input {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    padding: 4px 7px;
    background: var(--bg-primary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-subtle);
}
.client-home-card-screenshot .client-home-card-url-input {
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-color: rgba(255,255,255,0.5);
    box-shadow: none;
}

/* Save / Cancel icon buttons */
.client-url-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}
.client-url-btn-save {
    background: var(--accent);
    color: #fff;
}
.client-url-btn-save:hover { background: var(--accent-dark, var(--accent)); filter: brightness(1.1); }
.client-url-btn-save:disabled { opacity: 0.6; cursor: default; }
.client-url-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.client-url-btn-cancel:hover { background: var(--border); }

/* ========================================================================
   ClientHub — Website URL input
   ======================================================================== */
.client-info-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--transition);
}
.client-info-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ── Client settings gear button ───────────────────────────────────────── */
.client-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}
.client-settings-btn:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}
/* In table — column is narrow and right-aligned */
.clients-table-actions {
    width: 36px;
    text-align: center;
    padding: 0 4px !important;
}
/* On screenshot card — light on dark backdrop */
.client-home-card-screenshot .client-card-settings-btn {
    color: rgba(255,255,255,0.7);
}
.client-home-card-screenshot .client-card-settings-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
/* Card badges row — align gear to the right */
.client-home-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}
.client-card-settings-btn {
    margin-left: auto;
}

/* ── Rundeck integration ── */
.rundeck-test-result {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: .83rem;
    line-height: 1.4;
}
.rundeck-test-ok {
    background: rgba(34,197,94,.12);
    color: var(--success, #22c55e);
    border: 1px solid rgba(34,197,94,.25);
}
.rundeck-test-fail {
    background: rgba(239,68,68,.1);
    color: var(--danger, #ef4444);
    border: 1px solid rgba(239,68,68,.2);
}
.rundeck-info-box {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.rundeck-cmd-preview {
    display: block;
    padding: 7px 10px;
    background: var(--bg-secondary);
    border-radius: 5px;
    font-size: .78rem;
    font-family: monospace;
    color: var(--accent);
    word-break: break-all;
    margin: 6px 0;
}
.spin {
    animation: spin 0.9s linear infinite;
}

/* ========================================================================
   Audit Log Page
   ======================================================================== */

.audit-log-page {
    max-width: none;
}

.audit-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.audit-select {
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.audit-select:focus { outline: none; border-color: var(--accent); }

.audit-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.audit-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.audit-table {
    min-width: 800px;
}

.audit-td-datetime { white-space: nowrap; font-size: 12px; color: var(--text-muted); }
.audit-td-name     { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-td-user     { font-size: 12px; color: var(--text-muted); }
.audit-td-fields   { font-size: 12px; color: var(--text-secondary); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.audit-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.audit-badge-create { background: rgba(34,197,94,.15);  color: #16a34a; }
.audit-badge-update { background: rgba(59,130,246,.15); color: #2563eb; }
.audit-badge-remove { background: rgba(239,68,68,.15);  color: #dc2626; }

/* ── Global API Error Modal ────────────────────────────────────────────── */
.error-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.error-modal {
    background: var(--bg-elevated);
    border: 1px solid rgba(231,76,60,.45);
    border-radius: var(--radius);
    width: 100%; max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    overflow: hidden;
}
.error-modal-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    background: rgba(231,76,60,.08);
    border-bottom: 1px solid rgba(231,76,60,.2);
    font-weight: 600; color: var(--text-primary); font-size: .9rem;
}
.error-modal-header span { flex: 1; }
.error-modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary); font-size: 1.3rem; line-height: 1;
    padding: 2px 4px; border-radius: 4px;
}
.error-modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.error-modal-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.error-modal-row { display: flex; flex-direction: column; gap: 2px; }
.error-modal-label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); font-weight: 600;
}
.error-modal-value {
    font-size: .88rem; color: var(--text-primary);
    font-family: monospace; word-break: break-all;
    background: var(--bg-secondary); padding: 6px 10px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.error-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}
.error-modal-copy {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: .82rem; cursor: pointer;
}
.error-modal-copy:hover { border-color: var(--primary); color: var(--text-primary); }
.error-modal-dismiss {
    padding: 6px 16px; border-radius: var(--radius-sm);
    background: rgba(231,76,60,.15); border: 1px solid rgba(231,76,60,.3);
    color: #e74c3c; font-size: .82rem; cursor: pointer; font-weight: 500;
}
.error-modal-dismiss:hover { background: rgba(231,76,60,.25); }
/* fade transition */
.fade-enter-active, .fade-leave-active { transition: opacity .18s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

