/* ============================================
   MCG Platform Admin – Apple-white Clean Design
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #0055FF;
    --primary-light: #3377FF;
    --primary-dark: #0044CC;
    --primary-bg: rgba(0, 85, 255, 0.06);
    --primary-bg-hover: rgba(0, 85, 255, 0.10);
    --bg: #f5f5f7;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --border: #e5e5e7;
    --border-light: #f0f0f2;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --text-on-primary: #ffffff;
    --success: #30D158;
    --success-bg: rgba(48, 209, 88, 0.10);
    --warning: #FF9F0A;
    --warning-bg: rgba(255, 159, 10, 0.10);
    --error: #FF3B30;
    --error-bg: rgba(255, 59, 48, 0.08);
    --info: #0055FF;
    --info-bg: rgba(0, 85, 255, 0.06);
    --emerald: #34C759;
    --emerald-bg: rgba(52, 199, 89, 0.10);
    --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-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px -4px rgba(0, 0, 0, 0.10);
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
    --sidebar-width: 260px;
    --header-height: 64px;
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg);
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ==================== LOGIN SCREEN ==================== */

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    font-size: 24px;
    font-weight: 700;
    border-radius: var(--radius);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    font-weight: 400;
}

.login-error {
    background: var(--error-bg);
    color: var(--error);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    text-align: center;
}

.login-forgot {
    text-align: center;
    margin-top: 16px;
}

.login-forgot a {
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}

.login-forgot a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.login-info {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 24px;
    padding: 0 8px;
}

.login-success {
    background: var(--success-bg);
    color: var(--success);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    text-align: center;
}

/* ==================== FORM ELEMENTS ==================== */

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.12);
    background: var(--bg-card);
}

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

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

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 1.5L6 6l4.5-4.5' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* ==================== BUTTONS ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    white-space: nowrap;
    cursor: pointer;
    border: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

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

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #E5342A;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #28BD4E;
}

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

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition);
    border: none;
    background: none;
    cursor: pointer;
}

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

.btn .btn-loading { display: none; }
.btn.loading .btn-text { display: none; }
.btn.loading .btn-loading { display: inline-flex; align-items: center; gap: 8px; }

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==================== APP LAYOUT ==================== */

.app {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    margin-bottom: 2px;
}

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

.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

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

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: capitalize;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    backdrop-filter: blur(2px);
}

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

/* ==================== MAIN WRAPPER ==================== */

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==================== HEADER ==================== */

.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.mobile-menu-btn {
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user-name {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== CONTENT AREA ==================== */

.content {
    flex: 1;
    padding: 32px;
    max-width: 1400px;
    width: 100%;
}

/* ==================== STAT CARDS ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}

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

.stat-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.stat-card-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--error); }

/* ==================== TABLES ==================== */

.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.table-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.table-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    padding: 8px 14px 8px 36px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    width: 260px;
    max-width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 10-1.397 1.398h-.001l3.85 3.85a1 1 0 001.415-1.414l-3.85-3.85-.017.016zm-5.242.156a5 5 0 110-10 5 5 0 010 10z' fill='%2386868b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.12);
    background-color: var(--bg-card);
}

.filter-select {
    padding: 8px 32px 8px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 1.5L6 6l4.5-4.5' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: border-color var(--transition);
}

.filter-select:focus {
    border-color: var(--primary);
}

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

thead {
    background: var(--bg);
}

th {
    text-align: left;
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

td {
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background var(--transition);
}

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

tbody tr.clickable {
    cursor: pointer;
}

tbody tr.expanded {
    background: var(--primary-bg);
}

.table-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}

.table-empty svg {
    display: inline-block;
    margin-bottom: 12px;
    opacity: 0.3;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
}

.table-pagination-info {
    font-size: 13px;
    color: var(--text-tertiary);
}

.table-pagination-btns {
    display: flex;
    gap: 4px;
}

/* ==================== STATUS BADGES ==================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-new {
    background: var(--info-bg);
    color: var(--primary);
}

.badge-contacted {
    background: var(--warning-bg);
    color: #B87100;
}

.badge-qualified {
    background: var(--success-bg);
    color: #1B9E3E;
}

.badge-won {
    background: var(--emerald-bg);
    color: #1F8C3B;
}

.badge-lost {
    background: var(--error-bg);
    color: var(--error);
}

.badge-active {
    background: var(--success-bg);
    color: #1B9E3E;
}

.badge-inactive {
    background: var(--error-bg);
    color: var(--error);
}

.badge-master {
    background: #F0E6FF;
    color: #7C3AED;
}

.badge-client {
    background: var(--info-bg);
    color: var(--primary);
}

/* ==================== DETAIL PANEL (inline expand) ==================== */

.detail-row td {
    padding: 0;
    background: var(--bg);
}

.detail-panel {
    padding: 24px;
    border-top: 1px solid var(--border-light);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.detail-field .value {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.detail-actions {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ==================== CARDS ==================== */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 24px;
    margin-bottom: 20px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

/* ==================== TOGGLE SWITCH ==================== */

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--success);
}

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

/* ==================== FLAG CARDS ==================== */

.flags-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.flag-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: box-shadow var(--transition);
}

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

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

.flag-key {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.flag-description {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.flag-value {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    margin-top: 4px;
}

/* ==================== KANBAN BOARD ==================== */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    min-height: 400px;
}

.kanban-column {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.kanban-column-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kanban-column-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.kanban-column.col-idea .kanban-column-header { border-bottom-color: #AF52DE; }
.kanban-column.col-todo .kanban-column-header { border-bottom-color: var(--primary); }
.kanban-column.col-in-progress .kanban-column-header { border-bottom-color: var(--warning); }
.kanban-column.col-done .kanban-column-header { border-bottom-color: var(--success); }

.kanban-cards {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.kanban-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}

.kanban-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.kanban-card-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.kanban-card-assignee {
    font-size: 12px;
    color: var(--text-tertiary);
}

.kanban-card-priority {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.priority-high { background: var(--error-bg); color: var(--error); }
.priority-medium { background: var(--warning-bg); color: #B87100; }
.priority-low { background: var(--info-bg); color: var(--primary); }

/* ==================== MODALS ==================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.2s ease;
}

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

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-tertiary);
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: none;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

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

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

/* ==================== TOAST NOTIFICATIONS ==================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.2s ease;
}

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

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

/* ==================== SECTION HEADER ==================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-tertiary);
}

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

.empty-state-text {
    font-size: 15px;
    margin-bottom: 20px;
}

/* ==================== LOADING ==================== */

.loading-view {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .header {
        padding: 0 16px;
    }

    .content {
        padding: 20px 16px;
    }

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

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar-left {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

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

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

    .form-inline {
        flex-direction: column;
    }

    .login-card {
        padding: 32px 24px;
    }

    .modal {
        margin: 16px;
    }

    td, th {
        padding: 10px 12px;
        font-size: 13px;
    }

    .header-user-name {
        display: none;
    }
}

/* ==================== ANALYTICS DASHBOARD ==================== */

.stats-grid-wide {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stats-grid-wide .stat-card {
    padding: 20px;
}

.stats-grid-wide .stat-card-value {
    font-size: 28px;
}

.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 24px;
    margin-bottom: 24px;
}

.chart-container .card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    margin-bottom: 20px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 140px;
    padding-top: 8px;
}

.chart-bar {
    flex: 1;
    min-width: 0;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    transition: opacity var(--transition);
    position: relative;
    cursor: default;
    opacity: 0.7;
}

.chart-bar:hover {
    opacity: 1;
}

.chart-bar-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-card);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    margin-bottom: 4px;
    pointer-events: none;
    z-index: 10;
}

.chart-bar:hover .chart-bar-tooltip {
    display: block;
}

.chart-bar-labels {
    display: flex;
    gap: 3px;
    margin-top: 8px;
}

.chart-bar-label {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 10px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.breakdown-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 24px;
}

.breakdown-card .card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

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

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: capitalize;
}

.breakdown-item-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.breakdown-empty {
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 12px 0;
}

@media (max-width: 1200px) {
    .stats-grid-wide {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid-wide {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .chart-bars {
        height: 100px;
    }
}

@media (max-width: 480px) {
    .stats-grid-wide {
        grid-template-columns: 1fr;
    }
}

/* ==================== MARKET MONITOR (Competitor Cards) ==================== */

.competitor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.competitor-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow var(--transition);
}

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

.competitor-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.competitor-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.competitor-url {
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: none;
    display: inline-block;
    margin-top: 2px;
    transition: color var(--transition);
}

.competitor-url:hover {
    color: var(--primary);
    text-decoration: underline;
}

.competitor-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.competitor-pricing {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
    align-self: flex-start;
}

.competitor-diff {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.competitor-diff strong,
.competitor-notes strong {
    font-weight: 600;
    color: var(--text-secondary);
}

.competitor-notes {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.5;
    font-style: italic;
}

.competitor-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

@media (max-width: 1024px) {
    .competitor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .competitor-card {
        padding: 18px;
    }
}

/* ==================== UTILITY ==================== */

.text-muted { color: var(--text-tertiary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-mono { font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden, [hidden] { display: none !important; }

/* ==================== A/B TESTS ==================== */

.ab-tests-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ab-test-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 24px;
    transition: box-shadow var(--transition);
}

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

.ab-test-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ab-test-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.ab-test-element {
    font-size: 13px;
    color: var(--text-tertiary);
}

.ab-status-draft { background: var(--bg); color: var(--text-tertiary); padding: 3px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.ab-status-running { background: var(--success-bg); color: #1B9E3E; padding: 3px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.ab-status-paused { background: var(--warning-bg); color: #B87100; padding: 3px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.ab-status-completed { background: var(--info-bg); color: var(--primary); padding: 3px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }

.ab-variants {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.ab-variant-row {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ab-variant-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.ab-variant-value {
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-word;
}

.ab-variant-stats {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.ab-stat {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.ab-stat-rate {
    font-weight: 700;
    color: var(--primary);
}

.ab-test-id {
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-right: 4px;
}

.ab-test-actions {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.ab-variant-input {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.ab-variant-input input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
}

.ab-variant-input input[type="number"] {
    padding: 8px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
}

.ab-variant-input input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.12);
}

/* ==================== TRACKING ==================== */

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

.tracking-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    padding: 24px;
    transition: box-shadow var(--transition);
}

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

.tracking-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.tracking-service-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.tracking-service-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.tracking-status {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.status-connected {
    background: var(--success);
}

.status-dot.status-disconnected {
    background: var(--error);
}

.status-dot.status-unknown {
    background: var(--text-tertiary);
}

.tracking-id-display {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ==================== AI COSTS / BUDGET ==================== */

.budget-bar-container {
    margin-top: 4px;
}

.budget-bar-track {
    width: 100%;
    height: 12px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.budget-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.budget-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* AI Provider Badge */
.ai-provider-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
}

.ai-provider-badge .provider-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.ai-provider-badge .provider-name {
    font-weight: 600;
    color: var(--text-primary);
}

.ai-provider-badge .provider-sep {
    color: var(--text-tertiary);
}

.ai-provider-badge .provider-key {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-weight: 600;
    color: var(--primary);
    background: rgba(0, 85, 255, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Chatbot Config */
.textarea-code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    box-sizing: border-box;
}

.textarea-code:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.1);
}

.range-input {
    width: 100%;
    margin: 4px 0;
    accent-color: var(--primary);
}

.field-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.knowledge-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 0 20px 20px;
}

.knowledge-file-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    background: var(--bg-primary);
    transition: border-color 0.15s;
}

.knowledge-file-card:hover {
    border-color: var(--primary);
}

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

.knowledge-file-name {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary);
}

.knowledge-file-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}

.knowledge-file-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    margin-bottom: 12px;
}

.knowledge-file-actions {
    display: flex;
    gap: 8px;
}

/* System Stack */
.system-services {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding: 0 20px 20px;
}

.system-service {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.service-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.service-type {
    font-size: 12px;
    color: var(--text-tertiary);
}

.service-status {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}

.service-status.status-ok {
    color: var(--success);
}

.service-status.status-warn {
    color: var(--warning);
}

.system-table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 0 20px 20px;
}

.system-table-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 12px;
}

.table-name {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
}

.table-count {
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== CHAT LOGS ==================== */

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

.chat-session-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

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

.chat-session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background var(--transition);
}

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

.chat-session-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.chat-session-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-session-details {
    flex: 1;
    min-width: 0;
}

.chat-session-id {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-session-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-session-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--text-tertiary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.chat-session-toggle.expanded {
    transform: rotate(180deg);
}

.chat-session-messages {
    display: none;
    padding: 0 20px 20px;
    border-top: 1px solid var(--border-light);
}

.chat-session-messages.visible {
    display: block;
}

.chat-bubble-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
    max-height: 500px;
    overflow-y: auto;
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

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

.chat-bubble-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.chat-bubble.user .chat-bubble-time {
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

@media (max-width: 768px) {
    .tracking-grid {
        grid-template-columns: 1fr;
    }

    .ab-variant-stats {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ab-variant-input {
        flex-direction: column;
    }

    .ab-variant-input input[type="number"] {
        width: 100% !important;
    }

    .ai-provider-badge {
        flex-wrap: wrap;
    }

    .knowledge-files {
        grid-template-columns: 1fr;
    }

    .system-services {
        grid-template-columns: 1fr;
    }

    .system-table-grid {
        grid-template-columns: 1fr;
    }

    .chat-bubble {
        max-width: 90%;
    }
}

/* ==================== AGENTIC A/B TEST ==================== */
.agentic-badge { display: inline-block; background: #0055FF; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; margin-left: 8px; vertical-align: middle; }
.btn-agentic { background: linear-gradient(135deg, #0055FF, #00C2FF); color: #fff; border: none; }
.btn-agentic:hover { opacity: 0.9; }
.evolution-log { margin-top: 16px; }
.evolution-entry { border-left: 3px solid #0055FF; padding: 8px 16px; margin-bottom: 12px; background: #f8f9fa; border-radius: 0 8px 8px 0; }
.evolution-entry .gen { font-weight: 600; color: #0055FF; font-size: 14px; }
.evolution-entry .date { color: #888; font-size: 12px; margin-top: 2px; }
.evolution-entry .details { margin-top: 6px; font-size: 13px; color: #444; line-height: 1.4; }
.evolution-entry .details strong { color: #222; }
.ab-test-gen { display: inline-block; background: #e8f0fe; color: #0055FF; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; margin-left: 8px; }
