/* ============================================================
   WHITE MOUNTAIN CATALOG — ENTERPRISE THEME
   ============================================================
   Stack  : Bootstrap 5.3 + Bootstrap Icons + Alpine.js
   Fonts  : Inter (Google Fonts)

   ┌─────────────────────────────────────────────────────────┐
   │  THEME CONFIGURATION — change these to retheme the app  │
   └─────────────────────────────────────────────────────────┘ */

:root {
    /* ── Primary brand color ─────────────────────────────── */
    --brand-50:    #eff6ff;
    --brand-100:   #dbeafe;
    --brand-200:   #bfdbfe;
    --brand-300:   #93c5fd;
    --brand-400:   #60a5fa;
    --brand-500:   #3b82f6;
    --brand-600:   #2563eb;   /* ← main accent — professional blue */
    --brand-700:   #1d4ed8;
    --brand-800:   #1e40af;
    --brand-900:   #1e3a8a;

    /* ── Legacy Aliases ──────────────────────────────────── */
    --blue-50:     var(--brand-50);
    --blue-100:    var(--brand-100);
    --blue-500:    var(--brand-500);
    --blue-600:    var(--brand-600);
    --blue-700:    var(--brand-700);

    /* ── Sidebar (Enterprise Light) ───────────────────────── */
    --sidebar-bg:          #ffffff;   /* ← Clean white background */
    --sidebar-border:      #e2e8f0;   /* ← Subtle border separator */
    --sidebar-text:        #475569;   /* ← Visible slate text */
    --sidebar-active-bg:   #eff6ff;
    --sidebar-active-text: #2563eb;
    --sidebar-active-border: #2563eb;
    --sidebar-width:       260px;

    /* ── App surface ─────────────────────────────────────── */
    --app-bg:      #f8fafc;   /* ← refined background color */
    --topbar-bg:   #ffffff;

    /* ── Re-wire Bootstrap primary ───────────────────────── */
    --bs-primary:            #2563eb;
    --bs-primary-rgb:        37, 99, 235;
    --bs-link-color:         #2563eb;
    --bs-link-hover-color:   #1d4ed8;
    --bs-border-radius:      0.5rem;
    --bs-border-radius-lg:   0.75rem;
    --bs-border-radius-xl:   1rem;
    --bs-border-radius-2xl:  1.25rem;
    --bs-body-font-family:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bs-body-bg:            var(--app-bg);
    --bs-body-color:         #0f172a;
    --bs-body-font-size:     0.875rem;
    --bs-body-line-height:   1.6;
    --bs-border-color:       #e2e8f0;
    --bs-secondary-bg:       #f8fafc;

    /* ── Shadows (Premium) ───────────────────────────────── */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:     0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-lg:  0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-xl:  0 25px 50px -12px rgba(0,0,0,0.15);

    /* ── Status ──────────────────────────────────────────── */
    --success:        #059669;
    --success-light:  #d1fae5;
    --warning:        #d97706;
    --warning-light:  #fef3c7;
    --danger:         #dc2626;
    --danger-light:   #fee2e2;

    /* ── Gray scale (Slate) ─────────────────────────────── */
    --gray-50:   #f8fafc;
    --gray-100:  #f1f5f9;
    --gray-200:  #e2e8f0;
    --gray-300:  #cbd5e1;
    --gray-400:  #94a3b8;
    --gray-500:  #64748b;
    --gray-600:  #475569;
    --gray-700:  #334155;
    --gray-800:  #1e293b;
    --gray-900:  #0f172a;

    /* ── Purple palette ─────────────────────────────────── */
    --purple-50:   #f5f3ff;
    --purple-100:  #ede9fe;
    --purple-200:  #ddd6fe;
    --purple-300:  #c4b5fd;
    --purple-400:  #a78bfa;
    --purple-500:  #8b5cf6;
    --purple-600:  #7c3aed;
    --purple-700:  #6d28d9;
    --purple-800:  #5b21b6;
    --purple-900:  #4c1d95;

    /* ── Red/Success Aliases ────────────────────────────── */
    --red-50:    var(--danger-light);
    --red-600:   var(--danger);
    --green-50:  var(--success-light);
    --green-600: var(--success);

    /* ── Aliases ────────────────────────────────────────── */
    --primary:        var(--brand-600);
    --primary-dark:   var(--brand-700);
    --primary-light:  var(--brand-50);

    /* ── Navbar ──────────────────────────────────────────── */
    --navbar-height: 64px;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--bs-body-font-family);
    background: var(--app-bg);
    color: var(--bs-body-color);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.02em;
    font-weight: 700;
}


/* ════════════════════════════════════════════════════════════
   BOOTSTRAP OVERRIDES — buttons, forms, cards, tables, badges
   ════════════════════════════════════════════════════════════ */

/* ── Primary btn ── */
.btn-primary {
    --bs-btn-bg:            var(--brand-600);
    --bs-btn-border-color:  var(--brand-600);
    --bs-btn-hover-bg:      var(--brand-700);
    --bs-btn-hover-border-color: var(--brand-700);
    --bs-btn-active-bg:     var(--brand-800);
    --bs-btn-active-border-color: var(--brand-800);
    --bs-btn-focus-shadow-rgb: 37,99,235;
    box-shadow: 0 1px 3px rgba(37,99,235,0.25);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.btn-primary:hover { box-shadow: 0 4px 10px rgba(37,99,235,0.35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* ── Secondary btn ── */
.btn-secondary {
    --bs-btn-bg:            #ffffff;
    --bs-btn-color:         var(--gray-700);
    --bs-btn-border-color:  var(--gray-200);
    --bs-btn-hover-bg:      var(--gray-50);
    --bs-btn-hover-color:   var(--gray-900);
    --bs-btn-hover-border-color: var(--gray-300);
    --bs-btn-active-bg:     var(--gray-100);
    font-weight: 600;
}

/* ── Danger btn ── */
.btn-danger {
    --bs-btn-bg:            #fff1f2;
    --bs-btn-color:         var(--danger);
    --bs-btn-border-color:  #fecdd3;
    --bs-btn-hover-bg:      #ffe4e6;
    --bs-btn-hover-border-color: #fca5a5;
    --bs-btn-hover-color:   var(--danger);
    --bs-btn-active-bg:     #fecdd3;
    font-weight: 600;
}

/* ── Shared btn ── */
.btn {
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: all 0.15s ease;
}

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

/* ── Forms ── */
.form-control, .form-select {
    font-family: inherit;
    font-size: 0.875rem;
    border-color: var(--gray-200);
    border-width: 1.5px;
    color: var(--gray-900);
    padding: 0.575rem 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

/* Keep .form-group working (Bootstrap 5 removed it) */
.form-group { margin-bottom: 1.125rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

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

/* ── Cards ── */
.card {
    border: 1px solid var(--gray-200);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

/* ── Badges (Professional & Unified) ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    background: #ffffff;
    border: 1.5px solid var(--gray-200);
    color: var(--gray-700);
    transition: all 0.15s ease;
}

.badge-gray {
    background: #ffffff;
    color: var(--gray-600);
    border-color: var(--gray-200);
}

.badge-primary, .badge-brand {
    background: #ffffff;
    color: var(--brand-700);
    border-color: var(--brand-200);
}

.badge-success {
    background: #ffffff;
    color: var(--success);
    border-color: #86efac; /* Success-300 */
}

.badge-warning {
    background: #ffffff;
    color: var(--warning);
    border-color: #fde047; /* Warning-300 */
}

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

.badge-purple {
    background: #ffffff;
    color: var(--purple-700);
    border-color: var(--purple-200);
}

.badge-info {
    background: #ffffff;
    color: var(--brand-600);
    border-color: var(--brand-200);
}

.badge-sm { padding: 0.15rem 0.45rem; font-size: 0.65rem; }

.badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-100);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-header h2 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    margin: 0;
}

.card-body { padding: 1.5rem; }

.icon-only-btn {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.15s;
}
.icon-only-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

/* ── Tables ── */
.table {
    --bs-table-color:       var(--gray-700);
    --bs-table-bg:          transparent;
    --bs-table-hover-bg:    var(--gray-50);
    --bs-table-border-color: var(--gray-100);
    font-size: 0.875rem;
}

.table th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.065em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom-width: 1px;
    padding: 0.65rem 1.25rem;
    white-space: nowrap;
}

.table td { padding: 1rem 1.25rem; vertical-align: middle; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-empty { text-align: center; color: var(--gray-400); padding: 3.5rem !important; }

.table tbody tr {
    transition: background-color 0.1s ease;
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

/* ── Badges — keep our semantic names ── */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.01em;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
}

/* Map our domain/status badge colours */
.badge-purple { background: #ede9fe !important; color: #5b21b6 !important; }
.badge-blue   { background: #dbeafe !important; color: #1d4ed8 !important; }
.badge-green  { background: #d1fae5 !important; color: #065f46 !important; }
.badge-yellow { background: #fef3c7 !important; color: #92400e !important; }
.badge-red    { background: #fee2e2 !important; color: #991b1b !important; }
.badge-gray   { background: var(--gray-100) !important; color: var(--gray-600) !important; }
.badge-orange { background: #fff7ed !important; color: #9a3412 !important; }
.badge-rose   { background: #fef2f2 !important; color: #9f1239 !important; }
.badge-pink   { background: #fce7f3 !important; color: #9d174d !important; }
.badge-teal   { background: #ccfbf1 !important; color: #115e59 !important; }

/* ── Modals ── */

/* Prevent Bootstrap's display:none conflicting with our system */
.modal-overlay { display: flex !important; }
.modal-overlay.hidden { display: none !important; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
    z-index: 1060;
    padding: 1rem;
    backdrop-filter: blur(2px);
}

.modal-box {
    background: white;
    border-radius: var(--bs-border-radius-xl);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    animation: modal-in 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

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

/* Override Bootstrap's .modal-header/.modal-body/.modal-footer */
.modal-box .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    border-radius: 0;
}

.modal-box .modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    margin: 0;
}

.modal-box .modal-body { padding: 1.5rem; }

.modal-box .modal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
    border-radius: 0 0 var(--bs-border-radius-xl) var(--bs-border-radius-xl);
}

/* Override Bootstrap's .btn-close SVG with our ✕ text approach */
.btn-close, .modal-box .btn-close {
    background-image: none;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--bs-border-radius-sm);
    color: var(--gray-400);
    opacity: 1;
    font-size: 1rem;
    transition: all 0.14s;
    background: none;
    border: none;
    cursor: pointer;
}

.btn-close:hover { color: var(--gray-700); background: var(--gray-100); opacity: 1; }

/* ── Alerts — keep our class names ── */
.alert { font-weight: 500; font-size: 0.875rem; border-radius: var(--bs-border-radius); }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* ── Pagination ── */
.asset-pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.875rem 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    border-top: 1px solid var(--gray-100);
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.6rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 7px;
    background: white;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.14s;
    white-space: nowrap;
    gap: 0.3rem;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--brand-50);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(37,99,235,0.3);
    cursor: default;
}

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

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    font-size: 0.82rem;
    color: var(--gray-400);
    letter-spacing: 0.05em;
}

.page-info {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-right: 0.5rem;
    white-space: nowrap;
}

/* ── Misc helpers ── */
.hidden { display: none !important; }

.search-input {
    padding: 0.575rem 0.875rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--bs-border-radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    color: var(--gray-800);
    transition: all 0.14s;
    min-width: 200px;
}

.search-input::placeholder { color: var(--gray-400); }
.search-input:hover { border-color: var(--gray-300); }
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.filter-select-dropdown {
    padding: 0.575rem 2rem 0.575rem 0.875rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--bs-border-radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: all 0.14s;
    color: var(--gray-700);
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 8l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
}

.filter-select-dropdown:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.access-info {
    font-size: 0.72rem;
    color: var(--gray-500);
    padding: 0.18rem 0.55rem;
    background: var(--gray-100);
    border-radius: 20px;
    font-weight: 500;
}

.filter-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }

.filter-btn {
    padding: 0.375rem 0.875rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 20px;
    background: white;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.14s;
    color: var(--gray-600);
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.filters-row { display: flex; align-items: center; gap: 0.5rem; flex: 1; flex-wrap: wrap; min-width: 0; }

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand-50);
    color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.78rem;
}

.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }

.shimmer {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer-anim 1.5s infinite;
    display: inline-block;
}

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

.perm-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--bs-border-radius);
    cursor: pointer;
    font-size: 0.82rem;
    transition: border-color 0.14s, background 0.14s;
    color: var(--gray-700);
}

.perm-item:hover { border-color: var(--primary); background: var(--brand-50); }
.perm-item input { accent-color: var(--primary); }

.permissions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }


/* ════════════════════════════════════════════════════════════
   APP LAYOUT
   ════════════════════════════════════════════════════════════ */

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

/* ── Sidebar ── */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--gray-900);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 300;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    border-right: 1px solid var(--sidebar-border);
    overflow: hidden;
}

.sidebar-brand {
    padding: 1.125rem 1.375rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.brand-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37,99,235,0.2);
}

.brand-text h2 {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--gray-900);
    margin: 0;
}

.brand-text p {
    font-size: 0.62rem;
    color: var(--gray-400);
    margin: 0.1rem 0 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.625rem 0 1rem;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
    padding: 1.5rem 1.375rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--brand-600); /* Highlighted brand color */
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-section::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--gray-100);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.575rem 1.375rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    background: none;
    width: calc(100% - 1.5rem);
    margin: 0.125rem 0.75rem;
    border-radius: 8px;
    letter-spacing: 0.005em;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    text-decoration: none;
}

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

.nav-item .icon {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    opacity: 0.75;
}

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

.nav-agent-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
}

.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    background: var(--gray-50);
}

.user-info { 
    display: flex; 
    align-items: center; 
    gap: 0.65rem; 
    padding: 0.5rem;
    border-radius: 12px;
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    flex-shrink: 0;
    color: white;
    box-shadow: 0 2px 5px rgba(37,99,235,0.2);
}

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

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--gray-900);
}

.user-role { font-size: 0.68rem; color: var(--gray-500); margin-top: 0.1rem; }

.btn-icon {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 6px;
    transition: all 0.14s;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

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

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 299;
    backdrop-filter: blur(1px);
}

/* ── Main content ── */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-200) transparent;
}

.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }

/* ── Topbar ── */

.topbar {
    height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 200;
    gap: 1rem;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.015em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    color: var(--gray-600);
    font-size: 1.2rem;
    line-height: 1;
    align-items: center;
    justify-content: center;
    transition: all 0.14s;
}

.menu-toggle:hover { background: var(--gray-100); color: var(--gray-800); }

.page-body { padding: 1.75rem; flex: 1; }

.footer {
    text-align: center;
    padding: 1.25rem;
    color: var(--gray-400);
    font-size: 0.75rem;
    border-top: 1px solid var(--gray-100);
    background: white;
    margin-top: auto;
}


/* ════════════════════════════════════════════════════════════
   STATS
   ════════════════════════════════════════════════════════════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: white;
    border-radius: var(--bs-border-radius-lg);
    padding: 1.375rem 1.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.15s, transform 0.15s;
}

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

.stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.065em;
    margin-bottom: 0.75rem;
}

.stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.035em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card .stat-sub { font-size: 0.78rem; color: var(--gray-400); }

.stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.stat-icon.purple { background: #ede9fe; }
.stat-icon.green  { background: #d1fae5; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.rose   { background: #ffe4e6; }


/* ════════════════════════════════════════════════════════════
   DOMAIN COMPONENTS
   ════════════════════════════════════════════════════════════ */

.domain-breakdown { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 1.25rem; }

.domain-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.625rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    text-decoration: none;
    color: var(--gray-800);
    transition: all 0.14s;
    background: white;
    font-weight: 500;
}

.domain-card:hover { border-color: var(--primary); background: var(--brand-50); transform: translateY(-1px); text-decoration: none; }
.domain-icon { font-size: 1.1rem; }
.domain-name { font-size: 0.875rem; font-weight: 600; text-transform: capitalize; }
.domain-count { margin-left: auto; background: var(--gray-100); color: var(--gray-600); font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 20px; }


/* ════════════════════════════════════════════════════════════
   SEARCH HERO
   ════════════════════════════════════════════════════════════ */

.search-hero {
    background: linear-gradient(145deg, var(--gray-900) 0%, var(--gray-800) 55%, var(--brand-800) 100%);
    border-radius: var(--bs-border-radius-xl);
    padding: 2.75rem 2.5rem;
    margin-bottom: 1.5rem;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.search-hero::before {
    content: '';
    position: absolute;
    top: -40%; right: -8%;
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(37,99,235,0.22) 0%, transparent 65%);
    pointer-events: none;
}

.search-hero h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.5rem; letter-spacing: -0.025em; }
.search-hero p { opacity: 0.6; margin-bottom: 1.5rem; font-size: 0.9rem; }

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 10px;
    padding: 0.35rem 0.35rem 0.35rem 1rem;
    max-width: 560px;
    margin: 0 auto;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.search-icon { font-size: 1rem; color: var(--gray-400); }

.search-hero-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--gray-800);
    font-family: inherit;
    background: transparent;
}

.access-banner {
    margin-top: 1.25rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--bs-border-radius);
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    display: inline-block;
}

.search-result-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.search-result-card {
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--bs-border-radius-lg);
    padding: 1.25rem 1.5rem;
    transition: all 0.14s;
}

.search-result-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37,99,235,0.1); }
.result-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.result-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.25rem; color: var(--gray-900); }
.result-desc { font-size: 0.8rem; color: var(--gray-400); }
.result-score { font-size: 0.75rem; font-weight: 700; color: var(--primary); background: var(--brand-50); padding: 0.2rem 0.5rem; border-radius: 6px; flex-shrink: 0; }
.result-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.search-loading,.search-empty { text-align: center; padding: 3rem; color: var(--gray-400); }
.search-empty h3 { margin: 0.75rem 0 0.5rem; color: var(--gray-600); font-weight: 600; }
.search-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; font-size: 0.875rem; color: var(--gray-600); }
.search-filters { margin-bottom: 1rem; }


/* ════════════════════════════════════════════════════════════
   LINEAGE
   ════════════════════════════════════════════════════════════ */

.lineage-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; align-items: start; }
.lineage-sidebar { display: flex; flex-direction: column; }
.asset-list-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.25rem; cursor: pointer; border-bottom: 1px solid var(--gray-100); transition: background 0.12s; font-size: 0.875rem; }
.asset-list-item:hover { background: var(--gray-50); }
.asset-list-item.active { background: var(--brand-50); color: var(--primary); }
.asset-list-name { font-weight: 500; }
.graph-layout { display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding: 2rem; width: 100%; }
.graph-column { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.graph-arrow { text-align: center; color: var(--gray-300); font-size: 1.25rem; }
.graph-arrow-h { color: var(--gray-300); font-size: 1.5rem; }
.graph-node { transition: transform 0.15s; }
.graph-node:hover { transform: translateY(-2px); }


/* ════════════════════════════════════════════════════════════
   CHAT
   ════════════════════════════════════════════════════════════ */

.chat-layout {
    display: grid;
    grid-template-columns: 1fr;
    height: calc(100vh - var(--navbar-height) - 3.5rem);
    min-height: 0;
}

.chat-left { display: flex; flex-direction: column; gap: 1rem; min-height: 0; overflow-y: auto; }

.chat-panel {
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--bs-border-radius-lg);
    padding: 1rem 1.125rem;
    box-shadow: var(--shadow-xs);
}

.chat-panel-title { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--gray-400); margin-bottom: 0.75rem; }

.domain-pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.55rem; background: var(--brand-50); color: var(--primary); border-radius: 20px; font-size: 0.7rem; font-weight: 600; margin: 0.2rem 0.2rem 0 0; }

.starters-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: 260px; overflow-y: auto; }

.starter-btn { text-align: left; padding: 0.5rem 0.75rem; border: 1.5px solid var(--gray-200); border-radius: var(--bs-border-radius); background: var(--gray-50); font-size: 0.8rem; font-family: inherit; cursor: pointer; color: var(--gray-600); transition: all 0.14s; line-height: 1.4; width: 100%; }
.starter-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--brand-50); }

.source-card { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem; border-radius: var(--bs-border-radius); background: var(--gray-50); border: 1px solid var(--gray-100); margin-bottom: 0.5rem; animation: fadeIn 0.25s ease both; }
.source-rank { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: white; font-size: 0.62rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.source-info { flex: 1; min-width: 0; }
.source-name { font-size: 0.78rem; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.2rem; }
.source-score { font-size: 0.7rem; font-weight: 700; color: var(--success); }
.sources-placeholder { font-size: 0.8rem; color: var(--gray-400); padding: 0.5rem 0; }

.msg-sources { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
.sources-toggle { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; font-size: 0.72rem; font-weight: 600; color: var(--gray-400); padding: 0; transition: color 0.14s; font-family: inherit; }
.sources-toggle:hover { color: var(--primary); }
.src-chevron { display: inline-block; transition: transform 0.2s; font-style: normal; }
.msg-sources.open .src-chevron { transform: rotate(180deg); }
.sources-list { display: none; flex-direction: column; margin-top: 8px; }
.msg-sources.open .sources-list { display: flex; }

.source-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--bs-border-radius); background: var(--gray-50); border: 1px solid var(--gray-100); font-size: 0.75rem; transition: border-color 0.14s, background 0.14s; text-decoration: none; color: inherit; cursor: pointer; font-family: inherit; text-align: left; width: 100%; }
.source-chip:hover { border-color: var(--primary); background: var(--brand-50); }
.src-rank { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: white; font-size: 0.6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.src-name { flex: 1; font-weight: 500; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.src-domain { font-size: 0.65rem; font-weight: 600; white-space: nowrap; flex-shrink: 0; padding: 1px 6px; border-radius: 10px; }
.src-score { font-size: 0.68rem; font-weight: 700; color: var(--success); white-space: nowrap; flex-shrink: 0; }
.src-link-icon { font-size: 0.7rem; color: var(--gray-400); flex-shrink: 0; opacity: 0; transition: opacity 0.14s; }
.source-chip:hover .src-link-icon { opacity: 1; }

.chat-main { display: flex; flex-direction: column; background: white; border-radius: var(--bs-border-radius-xl); border: 1.5px solid var(--gray-200); overflow: hidden; min-height: 0; box-shadow: var(--shadow-sm); }

.chat-topbar { display: flex; align-items: center; justify-content: space-between; padding: 0.875rem 1.5rem; border-bottom: 1px solid var(--gray-100); flex-shrink: 0; background: var(--gray-50); }
.chat-topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.bot-icon-lg { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #4f46e5); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.chat-topbar-title { font-size: 0.9rem; font-weight: 700; color: var(--gray-900); }
.chat-topbar-sub { font-size: 0.7rem; color: var(--gray-400); margin-top: 0.1rem; }

.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; scroll-behavior: smooth; min-height: 0; }
.chat-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3rem 2rem; }
.welcome-icon { font-size: 3rem; margin-bottom: 1rem; }
.chat-welcome h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--gray-900); }
.chat-welcome p { color: var(--gray-400); font-size: 0.875rem; line-height: 1.7; margin-bottom: 1.5rem; max-width: 360px; }
.welcome-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }

.msg-row { display: flex; align-items: flex-end; gap: 0.6rem; }
.msg-user { flex-direction: row-reverse; }
.msg-avatar-sm { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; flex-shrink: 0; }
.user-av { background: var(--primary); color: white; }
.bot-av  { background: var(--gray-100); color: var(--gray-500); }
.msg-bubble { max-width: 72%; padding: 0.875rem 1.1rem; border-radius: 16px; font-size: 0.875rem; line-height: 1.65; }
.msg-bubble-user { background: linear-gradient(135deg, var(--primary), #3b82f6); color: white; border-bottom-right-radius: 4px; }
.msg-bubble-bot { background: var(--gray-50); border: 1px solid var(--gray-200); border-bottom-left-radius: 4px; color: var(--gray-800); }
.msg-bubble-error { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.msg-time { font-size: 0.66rem; color: var(--gray-400); margin-top: 0.35rem; }

.cursor-blink { display: inline-block; animation: blink 0.7s infinite; color: var(--primary); font-weight: 700; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.typing-dots { display: flex; gap: 0.35rem; padding: 0.3rem 0; align-items: center; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-300); animation: bounce 1.4s ease-in-out infinite both; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:0.6} 30%{transform:translateY(-5px);opacity:1} }

.md-li { display: flex; gap: 0.5rem; margin: 0.25rem 0; }
.md-num { font-weight: 700; color: var(--primary); min-width: 1.2rem; }
.md-dot { color: var(--primary); }
code { background: rgba(0,0,0,0.055); padding: 0.1rem 0.35rem; border-radius: 4px; font-family: 'SF Mono','Fira Code','Consolas',monospace; font-size: 0.84em; }

.chat-input-wrapper { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); flex-shrink: 0; background: white; }
.chat-input-outer { display: flex; align-items: flex-end; gap: 0.5rem; background: white; border: 1.5px solid var(--gray-200); border-radius: 12px; padding: 0.65rem 0.65rem 0.65rem 1rem; transition: border 0.15s, box-shadow 0.15s; }
.chat-input-outer:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.chat-input-outer.loading { opacity: 0.65; pointer-events: none; }
.chat-textarea { flex: 1; background: none; border: none; outline: none; font-size: 0.9rem; resize: none; max-height: 140px; font-family: inherit; line-height: 1.55; color: var(--gray-800); }
.chat-textarea::placeholder { color: var(--gray-400); }
.btn-send { width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: white; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.14s; }
.btn-send:hover:not(:disabled) { background: var(--primary-dark); transform: scale(1.05); }
.btn-send:disabled { background: var(--gray-200); cursor: not-allowed; transform: none; }
.chat-disclaimer { font-size: 0.7rem; color: var(--gray-400); text-align: center; margin-top: 0.5rem; }


/* ════════════════════════════════════════════════════════════
   MODALS & OVERLAYS
   ════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.modal-box {
    background: white;
    border-radius: var(--bs-border-radius-xl);
    width: min(560px, 94vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.15s;
}

.btn-close:hover { color: var(--gray-900); }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--gray-50);
    border-bottom-left-radius: var(--bs-border-radius-xl);
    border-bottom-right-radius: var(--bs-border-radius-xl);
}


/* ════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════ */

.login-page { display: flex; min-height: 100vh; overflow: auto; }

.login-left {
    flex: 1;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    padding: 3rem 4rem;
    position: relative;
    overflow: hidden;
}

.login-left-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: auto; }
.login-brand-icon { width: 44px; height: 44px; background: linear-gradient(135deg, var(--brand-600), var(--brand-800)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; box-shadow: 0 4px 12px rgba(37,99,235,0.2); }
.login-brand-name { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.login-brand-sub { font-size: 0.68rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-top: 0.1rem; }

.login-hero { margin: 3rem 0; }
.login-left h1 { font-size: 2.75rem; font-weight: 800; margin-bottom: 1.25rem; letter-spacing: -0.04em; line-height: 1.1; max-width: 480px; color: var(--gray-900); }
.login-left .login-hero p { font-size: 1.05rem; color: var(--gray-500); max-width: 420px; line-height: 1.6; margin: 0; }

.login-features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
    max-width: 500px;
}

.login-feature { display: flex; align-items: center; gap: 0.875rem; font-size: 0.875rem; color: var(--gray-600); font-weight: 600; }
.login-feature-icon { width: 36px; height: 36px; background: white; border: 1.5px solid var(--gray-200); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--brand-600); font-size: 1rem; transition: all 0.2s; }
.login-feature:hover .login-feature-icon { border-color: var(--brand-600); background: var(--brand-50); transform: translateY(-2px); }

.login-footer-left { margin-top: auto; font-size: 0.75rem; color: var(--gray-400); font-weight: 500; }

.login-right {
    width: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem;
    background: white;
    flex-shrink: 0;
}

.login-box {
    width: 100%;
    max-width: 360px;
}
.login-box h2 { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.4rem; color: var(--gray-900); letter-spacing: -0.025em; }
.login-box .login-sub { color: var(--gray-500); margin-bottom: 2rem; font-size: 0.9rem; }

.btn-login {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--bs-border-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: 0 4px 6px -1px rgba(37,99,235,0.15), 0 2px 4px -2px rgba(37,99,235,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login:hover {
    background: var(--primary-dark);
    box-shadow: 0 10px 15px -3px rgba(37,99,235,0.25), 0 4px 6px -4px rgba(37,99,235,0.15);
    transform: translateY(-2px);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* SSO Login Button */
.sso-login-section {
    margin-bottom: 1.5rem;
}

.btn-sso {
    width: 100%;
    padding: 0.875rem;
    background: white;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--bs-border-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-sso:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.btn-sso:active {
    transform: translateY(0);
}

.btn-sso:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.sso-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.sso-divider::before,
.sso-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-300);
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .sidebar-overlay.visible { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .lineage-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .page-body  { padding: 1rem; }
    .topbar     { padding: 0 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
    .form-row   { grid-template-columns: 1fr; }
    .permissions-grid { grid-template-columns: 1fr; }
    .card-header { flex-direction: column; align-items: flex-start; padding: 0.875rem 1.25rem; }
    .filters-row { flex-wrap: wrap; width: 100%; }
    .search-input { min-width: unset; width: 100%; }
    .filter-select-dropdown { width: 100%; }
    .msg-bubble { max-width: 85%; }
}

@media (max-width: 480px) {
    .stats-grid  { grid-template-columns: 1fr; }
    .login-left  { display: none; }
    .login-right { width: 100%; }
    .page-body   { padding: 0.875rem; }
}

/* ════════════════════════════════════════════════════════════
   STATUS & AUTH PAGES (Centered Layouts)
   ════════════════════════════════════════════════════════════ */

.centered-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, #e2e8f0 100%);
    position: relative;
    overflow-y: auto;
}

.status-card {
    background: #ffffff;
    padding: 3rem;
    border-radius: var(--bs-border-radius-2xl);
    box-shadow: var(--shadow-xl);
    max-width: 540px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.status-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    margin-bottom: 2rem;
}

.status-icon-primary { background: var(--brand-50); color: var(--brand-600); }
.status-icon-danger  { background: var(--danger-light); color: var(--danger); }
.status-icon-warning { background: var(--warning-light); color: var(--warning); }
.status-icon-success { background: var(--success-light); color: var(--success); }

.status-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.status-message {
    font-size: 1rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.status-details {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    color: var(--gray-700);
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.status-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.status-footer {
    margin-top: 3rem;
    font-size: 0.82rem;
    color: var(--gray-400);
}

/* ════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════ */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-column { display: flex; flex-direction: column; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--gray-500); }

/* ════════════════════════════════════════════════════════════
   PAGE: ASSETS
   ════════════════════════════════════════════════════════════ */

/* Locked (no-access) asset rows */
.asset-row-locked td { opacity: 0.6; }
.asset-row-locked { background: var(--gray-50); }
.locked-field { color: var(--gray-400); font-size: 0.85rem; }

/* Description preview hover effects */
.description-preview:hover {
    color: var(--blue-600) !important;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

/* Description popup styles */
.description-popup-overlay { backdrop-filter: blur(4px); }
.description-popup-content { font-family: inherit; }
.description-popup-content h3 { font-weight: 600; }
.description-popup-content button:hover { background-color: #f3f4f6 !important; color: #374151 !important; }

/* Request Access button */
.btn-request-access {
    background: #ffffff; 
    color: #c2410c; 
    border: 1.5px solid #fed7aa;
    font-size: 0.75rem; 
    padding: 0.2rem 0.6rem; 
    border-radius: 6px;
    cursor: pointer; 
    font-family: inherit; 
    white-space: nowrap;
    transition: all 0.15s;
}
.btn-request-access:hover { background: #fff7ed; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

/* Pending Requests badge button */
.btn-pending-requests {
    background: #ffffff; 
    color: #92400e; 
    border: 1.5px solid #fde68a;
    font-size: 0.72rem; 
    padding: 0.2rem 0.55rem; 
    border-radius: 6px;
    cursor: pointer; 
    font-family: inherit; 
    white-space: nowrap;
    transition: all 0.15s;
}
.btn-pending-requests:hover { background: #fef3c7; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

/* Assets card header layout */
.assets-card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%;
}

/* ════════════════════════════════════════════════════════════
   PAGE: CHAT
   ════════════════════════════════════════════════════════════ */

.chat-layout {
    display: flex;
    height: calc(100vh - 120px);
    gap: 20px;
    position: relative;
}

.chat-agents-sidebar {
    width: 280px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.chat-agents-sidebar.collapsed {
    width: 0;
    opacity: 0;
    border-right: none;
}

.chat-sidebar-toggle {
    position: absolute;
    left: 280px;
    top: 20px;
    z-index: 101;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                background-color 0.2s ease, 
                border-color 0.2s ease, 
                box-shadow 0.2s ease,
                transform 0.2s ease;
    box-shadow: var(--shadow-sm);
    color: var(--gray-600);
    font-size: 1.1rem;
}

.chat-sidebar-toggle:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.chat-sidebar-toggle:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), var(--shadow-sm);
}

.chat-sidebar-toggle:active {
    transform: translateY(0) scale(0.95);
    background: var(--gray-100);
}

.chat-agents-sidebar.collapsed + .chat-sidebar-toggle { left: 10px; }

.chat-agents-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.chat-agents-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
}

.chat-agents-header .btn-icon {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.chat-agents-header .btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.chat-agents-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.chat-agent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.chat-agent-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chat-agent-item.active {
    background: var(--brand-50);
    border-color: var(--brand-300);
    color: var(--brand-700);
}

.chat-agent-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-agent-item.active .chat-agent-icon {
    background: var(--brand-100);
    color: var(--brand-600);
}

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

.chat-agent-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-agent-scope {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-agents-loading {
    padding: 20px;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.chat-agents-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
    background: white;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

@media (max-width: 1024px) {
    .chat-agents-sidebar {
        position: absolute;
        left: 0; top: 0; bottom: 0;
        z-index: 100;
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    .chat-agents-sidebar.collapsed { transform: translateX(-100%); }
    .chat-sidebar-toggle {
        left: 10px; top: 10px; z-index: 101;
        width: 40px; height: 40px; font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(4px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    .chat-agents-sidebar:not(.collapsed) + .chat-sidebar-toggle { left: 260px; }
    .chat-main { width: 100%; }
}

.src-drawer-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.35);
    z-index: 300; opacity: 0; pointer-events: none; transition: opacity 0.22s;
}
.src-drawer-overlay.open { opacity: 1; pointer-events: auto; }
.src-drawer {
    position: fixed; right: 0; top: 0; bottom: 0; width: 480px; max-width: 92vw;
    background: #fff; z-index: 301; display: flex; flex-direction: column;
    box-shadow: -4px 0 40px rgba(15,23,42,0.14);
    transform: translateX(100%); transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}
.src-drawer.open { transform: translateX(0); }
.src-drawer-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; padding: 20px 20px 16px; border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
}
.src-drawer-close {
    background: none; border: none; cursor: pointer; font-size: 1rem;
    color: var(--gray-400); padding: 2px 6px; border-radius: 6px;
    flex-shrink: 0; transition: background 0.15s;
}
.src-drawer-close:hover { background: var(--gray-100); color: var(--gray-800); }
.src-drawer-relevance {
    padding: 14px 20px; border-bottom: 1px solid var(--gray-100); flex-shrink: 0;
}
.src-rel-bar {
    flex: 1; height: 6px; background: var(--gray-100); border-radius: 99px; overflow: hidden;
}
.src-rel-fill { height: 100%; background: var(--success); border-radius: 99px; transition: width 0.4s ease; }
.src-drawer-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.src-drawer-section { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); }
.src-drawer-section:last-child { border-bottom: none; }
.src-drawer-section-label {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--gray-400); margin-bottom: 8px;
}
.src-drawer-snippet {
    margin: 0; font-size: 0.8rem; line-height: 1.7; color: var(--gray-700);
    white-space: pre-wrap; word-break: break-word;
    background: var(--gray-50); border: 1px solid var(--gray-100);
    border-radius: 8px; padding: 12px 14px; font-family: inherit;
    max-height: 360px; overflow-y: auto;
}
.src-drawer-footer {
    padding: 14px 20px; border-top: 1px solid var(--gray-100);
    display: flex; gap: 8px; flex-shrink: 0;
}
mark.src-hl {
    background: #fef08a; color: #713f12;
    border-radius: 2px; padding: 0 1px;
    font-style: inherit; font-weight: 600;
}
.src-filters {
    display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap;
}
.src-filter-select {
    font-size: 0.72rem; padding: 3px 24px 3px 8px; border-radius: 6px;
    border: 1px solid var(--gray-200); background: var(--gray-50);
    color: var(--gray-700); cursor: pointer; font-family: inherit;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center;
    transition: border-color 0.15s;
}
.src-filter-select:focus { outline: none; border-color: var(--primary); }
.src-chips { display: flex; flex-direction: column; gap: 5px; }

.hash-picker-item {
    display: flex; align-items: center; gap: 8px; padding: 9px 14px;
    cursor: pointer; font-size: 0.84rem; border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}
.hash-picker-item:last-child { border-bottom: none; }
.hash-picker-item.hp-active,
.hash-picker-item:hover { background: var(--brand-50); }
#agentHashPicker::before {
    content: "# Agents";
    display: block; padding: 6px 14px 4px; font-size: 0.7rem;
    font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    color: #94a3b8; border-bottom: 1px solid #f1f5f9;
}

/* API Keys Specific */
.grid-keys-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 0.75rem; }
.new-key-alert { margin-top: 1rem; padding: 0.75rem; border: 1px solid #f59e0b; border-radius: 8px; background: #fffbeb; }

/* Runtime Settings Specific */
.search-input-settings { width: 320px; }
.settings-banner { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); font-size: 0.82rem; color: var(--gray-600); }
.col-w-260 { width: 260px; }
.col-w-90 { width: 90px; }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.runtime-settings-table { table-layout: fixed; }
.runtime-settings-table th, .runtime-settings-table td { vertical-align: top; }
.setting-pre { margin: 0; max-width: 420px; max-height: 140px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; line-height: 1.35; padding: 0.35rem;     background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; }
.setting-pre-example { max-width: 340px; color: #334155; }
.setting-actions { display: grid; grid-template-columns: 1fr; gap: 0.35rem; min-width: 180px; }
.setting-action-btn { width: 100%; justify-content: center; }

/* Access Requests Specific */
.tab-bar { display: flex; gap: 0.5rem; border-bottom: 2px solid var(--gray-200); padding-bottom: 0; }
.tab-btn { background: none; border: none; padding: 0.5rem 1rem; cursor: pointer; font-weight: 500; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--gray-800); border-bottom-color: var(--gray-300); }

.select-status-mine { width: 140px; }
.select-status-all { width: 150px; }
.card-w-540 { max-width: 540px; }

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.status-pending  { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-denied   { background: #fee2e2; color: #991b1b; }
.status-revoked  { background: #f1f5f9; color: #475569; }

/* Consolidation Utilities */
.modal-confirm-box { max-width: 420px; width: 92vw; }
.modal-input-box { max-width: 460px; width: 92vw; }
.modal-text { margin: 0; white-space: pre-line; color: var(--gray-600); font-size: 0.9rem; line-height: 1.6; }
.code-badge { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-family: monospace; }

/* Connectors Specific */
.connector-icon-box { width: 40px; height: 40px; border-radius: 8px; background: #f97316; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.notice-banner { padding: 0.875rem 1.25rem; border-bottom: 1px solid #fcd34d; font-size: 0.85rem; background: #fffbeb; }
.col-w-170 { width: 170px; }
.col-w-140 { width: 140px; }
.col-w-180 { width: 180px; }
.col-w-110 { width: 110px; }
.col-w-80 { width: 80px; }
.col-w-60 { width: 60px; }
.modal-w-760 { width: min(760px, 96vw); }
.min-w-180 { min-width: 180px; }
.fs-sm { font-size: 0.85rem; }


/* ── Assets Page Consolidated (Part 2) ── */
.assets-header-title {
    display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
}
.assets-header-title h2 {
    margin: 0; font-size: 0.95rem; font-weight: 700;
    color: var(--gray-900); white-space: nowrap;
}
.assets-filters-row {
    display: flex; align-items: center; gap: 0.5rem;
    flex: 1; min-width: 0; flex-wrap: wrap;
}
.assets-search-input {
    height: 34px; padding: 0 0.75rem;
    border: 1.5px solid var(--gray-200); border-radius: 7px;
    font-size: 0.82rem; color: var(--gray-700);
    font-family: inherit; min-width: 180px; flex: 1;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.assets-search-input::placeholder { color: var(--gray-400); }
.assets-search-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.assets-filter-select {
    height: 34px; padding: 0 28px 0 10px;
    border: 1.5px solid var(--gray-200); border-radius: 7px;
    font-size: 0.82rem; color: var(--gray-700);
    font-family: inherit; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.assets-filter-select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.assets-filter-select:hover { border-color: var(--gray-300); }
.assets-header-actions {
    display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0;
}
.assets-header-actions .btn { height: 34px; }

/* Domain filter count badge */
.domain-count-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 18px; padding: 0 5px;
    background: rgba(0,0,0,0.12); color: inherit;
    border-radius: 20px; font-size: 0.7rem; font-weight: 700;
    margin-left: 4px; line-height: 1;
}
.filter-btn.active .domain-count-badge {
    background: rgba(255,255,255,0.3); color: #fff;
}

/* Asset row highlight (from drawer "View in Catalog" link) */
@keyframes asset-highlight-pulse {
    0%   { background: #ede9fe; }
    60%  { background: #ede9fe; }
    100% { background: transparent; }
}
.asset-row-highlight { animation: asset-highlight-pulse 3s ease forwards; }

/* Embed status button — looks like a badge but is clickable */
.embed-status-btn {
    cursor: pointer;
    border: none;
    font: inherit;
    white-space: nowrap;
    transition: opacity 0.15s, transform 0.1s;
}
.embed-status-btn:hover { opacity: 0.8; transform: scale(1.03); }
.badge-orange { background: #fff7ed; color: #c2410c; }

/* Keep row action buttons aligned and responsive on all viewport widths */
.asset-actions-cell {
    min-width: 260px;
}

.asset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.asset-actions .btn {
    white-space: nowrap;
    min-height: 30px;
    justify-content: center;
}

.asset-actions .icon-only-btn {
    width: 34px;
    min-width: 34px;
    padding-left: 0;
    padding-right: 0;
    font-size: 0.9rem;
}

@media (max-width: 1200px) {
    .asset-actions-cell { min-width: 240px; }
}

@media (max-width: 768px) {
    .asset-actions-cell { min-width: 220px; }
    .asset-actions { gap: 0.3rem; }
}

.chunk-job-bar {
    align-items: center;
    flex-wrap: wrap;
}

.chunk-job-bar .chunk-job-action {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Asset Description Popup (JS-Injected) ── */
.description-popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
}

.description-popup-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    position: relative;
}

.description-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.description-popup-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.description-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.description-popup-close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.description-popup-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--gray-700);
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    max-height: 50vh;
    overflow-y: auto;
}

.description-popup-footer {
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--gray-400);
    text-align: right;
}

.overflow-hidden { overflow: hidden !important; }
