/* Google Chat AI Bot - Admin Dashboard
   Aesthetic: Refined Command Centre — precise, contained, warm */

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

/* ============================================
   CSS VARIABLES - LIGHT THEME (DEFAULT)
   ============================================ */
:root {
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f6f5f3;
    --bg-tertiary: #eeedeb;
    --bg-card: #ffffff;
    --bg-hover: #f0efed;
    --bg-wash: #faf9f7;

    /* Text */
    --text-primary: #1a1a1a;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;

    /* Borders */
    --border-color: #e0ddd8;
    --border-subtle: #eae8e4;

    /* Accent — warm slate-blue */
    --accent: #4a5568;
    --accent-hover: #2d3748;
    --accent-light: #edf2f7;
    --accent-vivid: #4361ee;
    --accent-vivid-hover: #3651d4;
    --accent-vivid-light: #eef1fd;

    /* Status colors */
    --success: #2d9d78;
    --success-light: #eaf6f2;
    --danger: #d64545;
    --danger-light: #fce8e8;
    --warning: #d69e2e;
    --warning-light: #fefaed;
    --info: #3182ce;
    --info-light: #ebf4ff;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06);
    --shadow-ring: 0 0 0 3px rgba(67, 97, 238, 0.15);

    /* Radii */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Fonts */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;

    /* Layout */
    --container-width: 1080px;
    --sidebar-width: 240px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   CSS VARIABLES - DARK THEME
   ============================================ */
[data-theme="dark"] {
    --bg-primary: #141414;
    --bg-secondary: #1c1c1c;
    --bg-tertiary: #242424;
    --bg-card: #1c1c1c;
    --bg-hover: #282828;
    --bg-wash: #181818;

    --text-primary: #e8e6e3;
    --text-secondary: #9aa0a6;
    --text-muted: #5f6368;

    --border-color: #2e2e2e;
    --border-subtle: #262626;

    --accent: #a0aec0;
    --accent-hover: #cbd5e0;
    --accent-light: #1a202c;
    --accent-vivid: #6b8cff;
    --accent-vivid-hover: #8ba3ff;
    --accent-vivid-light: #1a1f33;

    --success: #48bb78;
    --success-light: #1a2e23;
    --danger: #fc8181;
    --danger-light: #2d1b1b;
    --warning: #ecc94b;
    --warning-light: #2d2510;
    --info: #63b3ed;
    --info-light: #1a2535;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 2px 8px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
    --shadow-ring: 0 0 0 3px rgba(107, 140, 255, 0.25);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.55;
    font-size: 13.5px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.006em;
}

a {
    color: var(--accent-vivid);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--accent-vivid-hover);
}

.mono {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: -0.02em;
}

::selection {
    background: var(--accent-vivid-light);
    color: var(--accent-vivid);
}

/* ============================================
   CONTAINER — contained, centred, breathing room
   ============================================ */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 28px 32px;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 10px;
    letter-spacing: -0.025em;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Alert badge */
.alert-badge {
    position: relative;
    display: inline-flex;
}

.alert-badge .badge-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    border: 2px solid var(--bg-secondary);
}

/* ============================================
   STATUS GRID — compact, warm cards
   ============================================ */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.status-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.2s var(--ease-out), border-color 0.2s, transform 0.2s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.status-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-subtle);
    transition: background 0.2s;
}

.status-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.status-item:hover::before {
    background: var(--accent-vivid);
}

.status-item .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.status-item .value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.status-item .value.success { color: var(--success); }
.status-item .value.danger { color: var(--danger); }
.status-item .value.warning { color: var(--warning); }
.status-item .value.info { color: var(--info); }
.status-item .value.accent { color: var(--accent-vivid); }

.status-item .trend {
    font-size: 11px;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.status-item .trend.up { color: var(--success); }
.status-item .trend.down { color: var(--danger); }
.status-item .trend.neutral { color: var(--text-muted); }

/* ============================================
   TABS — refined underline style
   ============================================ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.2s var(--ease-out);
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    letter-spacing: -0.01em;
}

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

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

.tab .tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.tab.active .tab-badge {
    background: var(--text-primary);
    color: var(--bg-card);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: tabFadeIn 0.25s var(--ease-out);
}

.tab-content.active {
    display: block;
}

/* Config sub-tabs */
.config-subtabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.config-subtab {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.config-subtab:hover { color: var(--text-primary); }
.config-subtab.active { color: var(--text-primary); border-bottom-color: var(--text-primary); font-weight: 600; }

.config-subtab .subtab-icon {
    font-size: 13px;
    opacity: 0.6;
}

.config-subcontent { display: none; animation: tabFadeIn 0.2s var(--ease-out); }
.config-subcontent.active { display: block; }

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

/* ============================================
   CARDS — refined, warm
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: 16px;
    transition: box-shadow 0.2s var(--ease-out);
}

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

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h2 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.card-header .card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.card-body {
    padding: 18px 20px;
}

.card-body:empty {
    padding: 0;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-wash);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-wash);
    position: sticky;
    top: 0;
    z-index: 1;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--text-primary);
}

th.sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    vertical-align: middle;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 3.5px solid var(--text-muted);
    opacity: 0.3;
}

th.sortable.asc::after {
    border-top: none;
    border-bottom: 3.5px solid var(--accent-vivid);
    opacity: 1;
}

th.sortable.desc::after {
    border-top: 3.5px solid var(--accent-vivid);
    opacity: 1;
}

tr:hover td {
    background: var(--bg-hover);
}

table.striped tbody tr:nth-child(even) td {
    background: var(--bg-wash);
}

table.striped tbody tr:nth-child(even):hover td {
    background: var(--bg-hover);
}

/* Expandable rows */
tr.expandable-row { cursor: pointer; }
tr.expanded-content { display: none; }
tr.expanded-content.active { display: table-row; }

tr.expanded-content td {
    background: var(--bg-wash);
    padding: 14px 20px;
    border-left: 3px solid var(--accent-vivid);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-accent { background: var(--accent-vivid-light); color: var(--accent-vivid); }

.badge-sm { font-size: 10.5px; padding: 1px 6px; }
.badge-xs { font-size: 9.5px; padding: 0px 5px; }

/* Dot indicators */
.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-success { background: var(--success); }
.dot-danger { background: var(--danger); }
.dot-warning { background: var(--warning); }
.dot-info { background: var(--info); }
.dot-accent { background: var(--accent-vivid); }
.dot-lg { width: 8px; height: 8px; }

/* ============================================
   BUTTONS — refined, purposeful
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--ease-out);
    font-family: var(--font-sans);
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    letter-spacing: -0.005em;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    box-shadow: var(--shadow-xs);
}

.btn:active {
    transform: scale(0.97);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-ring);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary */
.btn-primary {
    background: var(--accent-vivid);
    color: #ffffff;
    border-color: var(--accent-vivid);
}

.btn-primary:hover {
    background: var(--accent-vivid-hover);
    border-color: var(--accent-vivid-hover);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.25);
}

/* Secondary */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

/* Danger */
.btn-danger {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #c53030;
    border-color: #c53030;
    box-shadow: 0 2px 8px rgba(214, 69, 69, 0.25);
}

/* Outline */
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger-light);
}

/* Sizes */
.btn-sm {
    padding: 4px 10px;
    font-size: 11.5px;
    border-radius: 5px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
}

/* Icon button */
.btn-icon {
    padding: 6px;
    min-width: 30px;
    min-height: 30px;
}

.btn-icon.btn-sm {
    padding: 4px;
    min-width: 24px;
    min-height: 24px;
}

/* Button group */
.btn-group {
    display: inline-flex;
    gap: 0;
}

.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* ============================================
   FORMS
   ============================================ */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

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

.form-group label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: var(--font-sans);
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-vivid);
    box-shadow: var(--shadow-ring);
}

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

.form-group .help-text {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Inline form group */
.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.form-inline .form-group {
    flex: 1;
    min-width: 0;
}

/* Range slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-vivid);
    cursor: pointer;
    border: 2px solid var(--bg-card);
    box-shadow: var(--shadow-sm);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-vivid);
    cursor: pointer;
    border: 2px solid var(--bg-card);
    box-shadow: var(--shadow-sm);
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent-vivid);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ============================================
   SPLIT PANEL (Conversations Tab)
   ============================================ */
.split-panel {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    overflow: hidden;
    min-height: 460px;
}

.split-panel-left {
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 600px;
}

.split-panel-right {
    overflow-y: auto;
    max-height: 600px;
}

.split-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-wash);
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ============================================
   MESSAGE VIEWER (Chat Bubbles)
   ============================================ */
.message-list {
    max-height: 480px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-item {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    line-height: 1.6;
    position: relative;
}

.message-item.user {
    align-self: flex-end;
    background: var(--accent-vivid);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.message-item.assistant {
    align-self: flex-start;
    background: var(--bg-wash);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
}

.message-item .meta {
    font-size: 10.5px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-item.user .meta { color: rgba(255,255,255,0.65); }
.message-item.assistant .meta { color: var(--text-muted); }
.message-item .meta .sender { font-weight: 600; }
.message-item .meta .timestamp { font-size: 10px; }

.message-item .meta .cost-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(0,0,0,0.08);
}

.message-item .content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Flat message style */
.message-item-flat {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.message-item-flat.user {
    background: var(--accent-vivid-light);
    border-left: 3px solid var(--accent-vivid);
}

.message-item-flat.assistant {
    background: var(--bg-wash);
    border-left: 3px solid var(--success);
}

.message-item-flat .meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.message-item-flat .content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================
   LOG VIEWER — dark terminal
   ============================================ */
.log-viewer {
    background: #191919;
    color: #d4d4d4;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.65;
    padding: 16px;
    border-radius: var(--radius);
    max-height: 550px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #2a2a2a;
}

.log-viewer .log-line {
    padding: 1px 4px;
    border-radius: 2px;
    display: block;
}

.log-line-number {
    color: #444;
    display: inline-block;
    width: 36px;
    text-align: right;
    margin-right: 12px;
    user-select: none;
    flex-shrink: 0;
}

.log-line-info { color: #888; }
.log-line-warning { color: #e5c07b; background: rgba(229,192,123,0.08); }
.log-line-error { color: #e06c75; background: rgba(224,108,117,0.08); }
.log-line-debug { color: #61afef; }

.log-viewer .auto-scroll-indicator {
    position: sticky;
    bottom: 0;
    text-align: center;
    padding: 4px 8px;
    background: rgba(25,25,25,0.92);
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
}

[data-theme="dark"] .log-viewer {
    background: #111;
    border-color: #222;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
    position: relative;
    height: 260px;
}

.chart-container canvas {
    width: 100% !important;
    height: auto !important;
}

.chart-container-sm { max-height: 180px; }
.chart-container-md { max-height: 280px; }
.chart-container-lg { max-height: 380px; }

/* ============================================
   FILTERS BAR
   ============================================ */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-wash);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filters-bar input,
.filters-bar select {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12.5px;
    font-family: var(--font-sans);
}

.filters-bar input:focus,
.filters-bar select:focus {
    outline: none;
    border-color: var(--accent-vivid);
    box-shadow: var(--shadow-ring);
}

.filters-bar .filter-label {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.filters-bar .filter-separator {
    width: 1px;
    height: 18px;
    background: var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-group label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group input,
.filter-group select {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12.5px;
    font-family: var(--font-sans);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--accent-vivid);
    box-shadow: var(--shadow-ring);
}

/* ============================================
   OVERLAY / MODAL
   ============================================ */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.overlay.active {
    display: flex;
}

.overlay-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: overlaySlideIn 0.25s var(--ease-out);
}

@keyframes overlaySlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.overlay-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.overlay-card p {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 13.5px;
    line-height: 1.6;
}

.overlay-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.35;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 13px;
    max-width: 340px;
    margin: 0 auto;
    line-height: 1.6;
}

.empty-state .btn {
    margin-top: 14px;
}

/* ============================================
   TEST RESULTS
   ============================================ */
.test-results .test-pass { color: var(--success); }
.test-results .test-fail { color: var(--danger); font-weight: 600; }
.test-results .test-skip { color: var(--warning); }

.test-results .progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.test-results .progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.test-results .progress-bar.pass { background: var(--success); }
.test-results .progress-bar.fail { background: var(--danger); }
.test-results .progress-bar.partial { background: var(--warning); }

/* Progress bar (generic) */
.progress-bar-wrap {
    width: 100%;
    height: 5px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--accent-vivid);
    transition: width 0.3s ease;
}

/* ============================================
   TIMELINE (Audit Log)
   ============================================ */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding: 6px 0 18px 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -19px;
    top: 11px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-vivid);
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 1.5px var(--border-color);
}

.timeline-item.success::before { background: var(--success); }
.timeline-item.danger::before { background: var(--danger); }
.timeline-item.warning::before { background: var(--warning); }

.timeline-item .timeline-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.timeline-item .timeline-content { font-size: 13px; }
.timeline-item .timeline-detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ============================================
   CONVERSATION BROWSER
   ============================================ */
.space-card {
    margin-bottom: 10px;
}

.space-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.space-header:hover { background: var(--bg-hover); }

.space-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.space-header-left h2 { margin: 0; }

.expand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.15s;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.expand-icon.expanded { transform: rotate(90deg); }
.space-conversations { animation: tabFadeIn 0.15s var(--ease-out); }
.space-conversations table { margin: 0; }

/* Conversation list items */
.conv-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s;
}

.conv-list-item:hover { background: var(--bg-hover); }

.conv-list-item.active {
    background: var(--accent-vivid-light);
    border-left: 3px solid var(--accent-vivid);
}

.conv-list-item .conv-name { font-size: 13px; font-weight: 500; }
.conv-list-item .conv-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.conv-actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

/* ============================================
   QUICK ACTIONS PANEL
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.quick-action-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.quick-action-card:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.quick-action-card .action-icon {
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.quick-action-card .action-label { font-size: 12.5px; font-weight: 500; }
.quick-action-card .action-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* ============================================
   ACTIVITY FEED
   ============================================ */
.activity-feed {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-subtle);
    border-left: 3px solid transparent;
    transition: background 0.15s;
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-hover); }
.activity-item.status-success { border-left-color: var(--success); }
.activity-item.status-danger { border-left-color: var(--danger); }
.activity-item.status-warning { border-left-color: var(--warning); }
.activity-item.status-info { border-left-color: var(--info); }

.activity-item .activity-icon { font-size: 15px; flex-shrink: 0; width: 22px; text-align: center; margin-top: 2px; }
.activity-item .activity-content { flex: 1; min-width: 0; }
.activity-item .activity-title { font-size: 12.5px; font-weight: 500; }
.activity-item .activity-detail { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.activity-item .activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 0;
}

.pagination .btn { min-width: 30px; }

.pagination .page-indicator {
    font-size: 12.5px;
    color: var(--text-secondary);
    padding: 0 8px;
}

.pagination .page-indicator strong { color: var(--text-primary); }

/* ============================================
   RULES LIST
   ============================================ */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--bg-wash);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
}

.rule-item:hover { border-color: var(--border-color); }

.rule-item .rule-text {
    flex: 1;
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color 0.15s, background 0.15s;
}

.rule-item .rule-text:focus {
    border-color: var(--accent-vivid);
    background: var(--bg-primary);
    outline: none;
}

.rule-item .rule-remove {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 4px;
    border: none;
    background: none;
    transition: color 0.15s, background 0.15s;
}

.rule-item .rule-remove:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* ============================================
   CONVERSATIONS TAB - Split Panel Browser
   ============================================ */
.conversations-split-panel {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    min-height: 520px;
}

.conversations-browser {
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.conversations-browser .card {
    border-radius: 0;
    box-shadow: none;
    border: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.conversations-browser .card-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.conversations-viewer {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.conversations-viewer .card {
    border-radius: 0;
    box-shadow: none;
    border: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.conversations-viewer .card-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.conversation-search {
    padding: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.conversation-search input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-wash);
    color: var(--text-primary);
    font-size: 12.5px;
    font-family: var(--font-sans);
}

.conversation-search input:focus {
    outline: none;
    border-color: var(--accent-vivid);
    box-shadow: var(--shadow-ring);
}

/* Space tree items */
.space-tree-item { border-bottom: 1px solid var(--border-subtle); }

.space-tree-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 10px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 12.5px;
    font-weight: 600;
}

.space-tree-header:hover { background: var(--bg-hover); }

.space-tree-icon { font-size: 9px; color: var(--text-muted); width: 12px; flex-shrink: 0; }

.space-tree-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.space-tree-badges { display: flex; gap: 4px; flex-shrink: 0; }

.space-tree-children {
    background: var(--bg-wash);
    border-top: 1px solid var(--border-subtle);
}

.space-tree-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 7px 10px 7px 30px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
    font-size: 12.5px;
}

.space-tree-child:last-child { border-bottom: none; }
.space-tree-child:hover { background: rgba(67, 97, 238, 0.04); }

.space-tree-child.selected {
    background: var(--accent-vivid-light);
    border-left: 3px solid var(--accent-vivid);
    padding-left: 27px;
}

.space-tree-child.empty {
    color: var(--text-muted);
    cursor: default;
    font-style: italic;
}

.space-tree-child-main { display: flex; align-items: center; gap: 5px; }
.space-tree-child-name { font-weight: 500; }
.space-tree-child-meta { font-size: 10.5px; color: var(--text-muted); }
.space-tree-child-actions { display: flex; gap: 4px; margin-top: 2px; }

.active-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    flex-shrink: 0;
}

/* Conversation stats bar */
.conversation-stats-bar {
    display: flex;
    gap: 14px;
    padding: 8px 14px;
    background: var(--bg-wash);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11.5px;
    flex-wrap: wrap;
}

.conv-stat { color: var(--text-secondary); }
.conv-stat strong, .conv-stat code { color: var(--text-primary); }
.conv-stat code { font-size: 10.5px; background: var(--bg-tertiary); padding: 1px 4px; border-radius: 3px; }

/* Message search */
.conversation-msg-search {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.conversation-msg-search input {
    width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-wash);
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-sans);
}

.conversation-msg-search input:focus {
    outline: none;
    border-color: var(--accent-vivid);
}

/* Viewer header actions */
.viewer-header-actions { display: flex; align-items: center; gap: 6px; }

/* Conversation pagination */
.conv-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-wash);
    font-size: 11.5px;
}

.conv-page-info { color: var(--text-muted); font-size: 11.5px; }

/* ============================================
   ANALYTICS TAB
   ============================================ */
.analytics-date-range {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
}

.analytics-range {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.analytics-range.active {
    background: var(--text-primary);
    color: var(--bg-card);
    border-color: var(--text-primary);
}

.analytics-summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.mini-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
}

.mini-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    font-weight: 500;
}

.mini-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.analytics-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

/* Leaderboard */
#analytics-space-leaderboard { width: 100%; }
th[data-col] { cursor: pointer; user-select: none; }
th[data-col]:hover { color: var(--accent-vivid); }
.sort-indicator { font-size: 10px; margin-left: 2px; }

/* ============================================
   QUEUE STATS
   ============================================ */
.queue-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.bulk-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Queue detail rows */
.queue-row { cursor: pointer; }
.queue-row:hover td { background: var(--bg-hover); }
.queue-row.expanded td { background: var(--bg-wash); }

.queue-detail-row td {
    background: var(--bg-wash);
    border-left: 3px solid var(--accent-vivid);
}

.queue-detail {
    padding: 4px 0;
}

.queue-detail-section {
    margin-bottom: 10px;
}

.queue-detail-section strong {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.queue-detail-pre {
    background: var(--bg-tertiary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.queue-detail-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.queue-content-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.error-text { color: var(--danger); }

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-accent { color: var(--accent-vivid); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }

.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }

.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }

.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

.w-100 { width: 100%; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.pulse { animation: pulse 2s ease-in-out infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.fade-in { animation: fadeIn 0.3s var(--ease-out); }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.slide-up { animation: slideUp 0.25s var(--ease-out); }

/* Processing status indicator */
.status-processing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-processing .dot {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Staggered card entrance */
.card {
    animation: cardEnter 0.35s var(--ease-out) both;
}

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

.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.12s; }

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 18px;
    background: var(--text-primary);
    color: var(--bg-card);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    z-index: 2000;
    animation: toastIn 0.3s var(--ease-spring);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-success { background: var(--success) !important; color: #fff !important; }
.toast-error { background: var(--danger) !important; color: #fff !important; }
.toast-warning { background: var(--warning) !important; color: #fff !important; }

/* ============================================
   RESPONSIVE - TABLET (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .container {
        padding: 16px 20px;
    }

    .status-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }

    .split-panel {
        grid-template-columns: 1fr 2fr;
    }

    .conversations-split-panel {
        grid-template-columns: 250px 1fr;
    }

    .analytics-chart-row {
        grid-template-columns: 1fr 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* ============================================
   RESPONSIVE - MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 12px 14px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 { font-size: 16px; }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .status-item { padding: 10px 12px; }
    .status-item .value { font-size: 18px; }

    .tabs { overflow-x: auto; -ms-overflow-style: none; }
    .tab { padding: 8px 12px; font-size: 12px; }
    .config-grid { grid-template-columns: 1fr; }
    th, td { padding: 7px 10px; font-size: 12px; }

    .split-panel { grid-template-columns: 1fr; }

    .conversations-split-panel {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .conversations-browser {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 300px;
        overflow-y: auto;
    }

    .analytics-chart-row { grid-template-columns: 1fr; }
    .analytics-summary-row { grid-template-columns: repeat(2, 1fr); }
    .viewer-header-actions { flex-wrap: wrap; }

    .split-panel-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 280px;
    }

    .split-panel-right { max-height: 360px; }
    .message-item { max-width: 92%; }

    .overlay-card {
        width: 95%;
        padding: 20px;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-bar .filter-separator { display: none; }
    .quick-actions { grid-template-columns: 1fr; }
    .btn-group { flex-wrap: wrap; }
    .pagination { gap: 4px; }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header .card-actions { width: 100%; }
    .queue-stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .status-grid { grid-template-columns: 1fr; }
    .status-item .value { font-size: 18px; }
    .conv-actions { flex-direction: column; }
    .header-actions { flex-wrap: wrap; }
}

/* ============================================
   FEATURE BADGES
   ============================================ */
.badge-feature {
    display: inline-block;
    padding: 4px 10px;
    margin: 3px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-secondary, #666);
    border: 1px solid var(--border-color, #e0e0e0);
}

.workload-person {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 13px;
}
.workload-person:last-child { border-bottom: none; }
.workload-score {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
}
.workload-score.overloaded { background: #fee2e2; color: #dc2626; }
.workload-score.busy { background: #fef3c7; color: #d97706; }
.workload-score.normal { background: #d1fae5; color: #059669; }
.workload-score.underutilized { background: #f3f4f6; color: #6b7280; }

[data-theme="dark"] .workload-score.overloaded { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .workload-score.busy { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .workload-score.normal { background: #022c22; color: #6ee7b7; }
[data-theme="dark"] .workload-score.underutilized { background: #1f2937; color: #9ca3af; }

.action-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 13px;
}
.action-item-row:last-child { border-bottom: none; }
.action-item-row .overdue { color: #dc2626; font-weight: 500; }

.kb-entry-row {
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 13px;
}
.kb-entry-row:last-child { border-bottom: none; }
.kb-entry-row .kb-topic { font-weight: 600; }
.kb-entry-row .kb-meta { font-size: 11px; color: var(--text-muted, #999); }

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body { background: #fff; color: #000; }
    .tabs, .header-actions, .btn, .overlay, .filters-bar { display: none !important; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .tab-content { display: block !important; }
}
