/* === i60.Rag — Refined Utilitarian Dark === */

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

:root {
    --bg: #111113;
    --bg-raised: #18181b;
    --bg-surface: #1e1e22;
    --bg-hover: #27272b;
    --bg-active: #2c2c31;
    --border: #2e2e33;
    --border-subtle: #232328;
    --text: #ececef;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-faint: #3f3f46;
    --accent: #e8a230;
    --accent-hover: #d4922a;
    --accent-soft: rgba(232, 162, 48, 0.12);
    --accent-glow: rgba(232, 162, 48, 0.06);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --transition: 150ms ease;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes slideToast {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.8); opacity: 0; }
}

/* === LOGIN === */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, var(--accent-glow) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(52, 211, 153, 0.03) 0%, transparent 40%);
    pointer-events: none;
}

.login-card {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 380px;
    animation: scaleIn 0.4s ease;
    z-index: 1;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-dot {
    color: var(--accent);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 32px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-card input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition);
}

.login-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.login-card input::placeholder { color: var(--text-faint); }

.login-btn {
    width: 100%;
    margin-top: 8px;
    padding: 11px !important;
    font-size: 0.9rem !important;
    justify-content: center;
}

.login-error {
    color: var(--danger);
    font-size: 0.82rem;
    min-height: 1.2em;
    margin-top: 8px;
    text-align: center;
}

/* === APP LAYOUT === */
.app-layout {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* === ICON RAIL === */
.rail {
    width: 60px;
    background: var(--bg-raised);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 12px 0;
    animation: fadeIn 0.3s ease;
}

.rail-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.rail-logo {
    padding: 8px 0 14px;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border-subtle);
    width: 100%;
    margin-bottom: 6px;
}

.rail-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    padding: 0 8px;
}

.rail-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    position: relative;
}

.rail-link svg { opacity: 0.5; transition: opacity var(--transition); }
.rail-link:hover { background: var(--bg-hover); color: var(--text); }
.rail-link:hover svg { opacity: 0.9; }
.rail-link.active { background: var(--bg-active); color: var(--text); }
.rail-link.active svg { opacity: 1; color: var(--accent); }

/* Tooltip on hover */
.rail-link::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface);
    color: var(--text);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 200;
}

.rail-link:hover::after { opacity: 1; }

.rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-bottom: 4px;
}

.health-indicator {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.health-indicator.connected { background: var(--success); }
.health-indicator.disconnected { background: var(--danger); }

.health-indicator.connected .health-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--success);
    animation: dotPulse 2s infinite;
}

/* === MAIN PANEL === */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* === TOP BAR === */
.topbar {
    height: 52px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

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

.topbar-title {
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

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

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* Scope Selector (top bar) */
.scope-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.scope-selector select {
    padding: 5px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition);
    max-width: 220px;
}

.scope-selector select:focus { border-color: var(--accent); }

/* User Menu (top bar) */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.user-menu-trigger:hover { background: var(--bg-hover); border-color: var(--border); }

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-menu-trigger span {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.15s ease;
    z-index: 100;
}

.user-dropdown.open { display: block; }

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

.dropdown-item:hover { background: var(--bg-hover); color: var(--text); }
.dropdown-item.dropdown-danger:hover { background: var(--danger-soft); color: var(--danger); }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font);
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #111;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

.btn-ghost {
    background: none;
    color: var(--text-muted);
    padding: 7px 10px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

.btn-danger {
    background: none;
    color: var(--danger);
    border: 1px solid transparent;
    padding: 5px 10px;
    font-size: 0.78rem;
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-send {
    background: var(--accent);
    color: #111;
    border-radius: 50%;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-send:hover { background: var(--accent-hover); }
.btn-send:disabled { opacity: 0.3; }

.btn-back {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    display: flex;
    transition: all var(--transition);
}
.btn-back:hover { color: var(--text); background: var(--bg-hover); }

/* === INPUTS === */
.input {
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition);
}

.input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.input::placeholder { color: var(--text-faint); }
.input-full { width: 100%; }

select.input { cursor: pointer; }

/* === MAIN CONTENT === */
.content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

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

.tab-toolbar {
    padding: 12px 28px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    background: var(--bg);
}

.tab-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* === CHAT === */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.welcome-message {
    text-align: center;
    padding: 80px 20px 40px;
    color: var(--text-muted);
    animation: slideUp 0.5s ease;
}

.welcome-icon {
    margin-bottom: 20px;
    opacity: 0.5;
}

.welcome-message h2 {
    color: var(--text);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.welcome-message p {
    max-width: 420px;
    margin: 0 auto;
    font-size: 0.88rem;
    line-height: 1.6;
}

.chat-message {
    max-width: 740px;
    margin: 0 auto 16px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    line-height: 1.7;
    font-size: 0.9rem;
    animation: slideUp 0.25s ease;
}

.chat-message.user {
    background: var(--accent);
    color: #111;
    margin-left: auto;
    max-width: 520px;
    border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
    font-weight: 450;
}

.chat-message.assistant {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
}

.chat-message .answer-text {
    white-space: pre-wrap;
}

.chat-message .sources {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chat-message .sources strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.chat-message .sources .source-item {
    margin-top: 4px;
    padding: 4px 0;
}

.answer-meta {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.chat-message .confidence-badge,
.chat-message .strategy-badge,
.chat-message .llm-calls-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.strategy-badge { background: var(--accent-soft); color: var(--accent); }
.llm-calls-badge { background: var(--bg-hover); color: var(--text-muted); }

.confidence-high { background: var(--success-soft); color: var(--success); }
.confidence-medium { background: var(--warning-soft); color: var(--warning); }
.confidence-low { background: var(--danger-soft); color: var(--danger); }

.chat-message.loading {
    color: var(--text-muted);
    font-style: italic;
    animation: pulse 1.5s ease infinite;
}

.chat-input-wrapper {
    padding: 16px 28px 20px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-input {
    max-width: 740px;
    margin: 0 auto;
}

.chat-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input input {
    flex: 1;
    padding: 11px 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 100px;
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition);
}

.chat-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chat-input input::placeholder { color: var(--text-faint); }

.chat-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-left: 4px;
}

.chat-options select {
    padding: 4px 8px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 100px;
    font-size: 0.75rem;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
}

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

/* === LIBRARY === */
.library-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.collection-card {
    padding: 18px 20px;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    animation: slideUp 0.3s ease both;
}

.collection-card:hover {
    border-color: var(--accent);
    background: var(--bg-surface);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.collection-card .col-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 6px;
}

.collection-card .col-name {
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

.collection-card .col-org {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
}

.collection-card .col-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.collection-card .col-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-faint);
}

.collection-card .col-meta .doc-count {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
}

/* Document Panel */
.document-panel {
    animation: fadeIn 0.2s ease;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-title h3 {
    font-size: 1rem;
    font-weight: 600;
}

.panel-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--accent-soft);
    color: var(--accent);
}

.document-list { /* used for both library docs and standalone */ }

.document-card {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: all var(--transition);
    animation: slideUp 0.2s ease both;
}

.document-card:hover { border-color: var(--border); }

.document-card .doc-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
}

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

.document-card .doc-name {
    font-weight: 500;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-card .doc-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-right: 4px;
}

.status-completed { background: var(--success-soft); color: var(--success); }
.status-processing { background: var(--accent-soft); color: var(--accent); }
.status-pending { background: var(--warning-soft); color: var(--warning); }
.status-failed { background: var(--danger-soft); color: var(--danger); }

/* === EMPTY STATES === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    grid-column: 1 / -1;
}

.empty-state svg { margin-bottom: 4px; }

.empty-state span {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.empty-state small {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* === GRAPH === */
.graph-view {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.entity-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.entity-card {
    padding: 12px 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

.entity-card:hover { border-color: var(--border); background: var(--bg-surface); }
.entity-card.selected { border-color: var(--accent); background: var(--bg-surface); }

.entity-card .entity-name { font-weight: 500; font-size: 0.88rem; }

.entity-card .entity-type {
    display: inline-flex;
    padding: 1px 7px;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 500;
    background: var(--accent-soft);
    color: var(--accent);
    margin-left: 8px;
    vertical-align: middle;
}

.entity-card .entity-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.relationship-panel {
    width: 340px;
    border-left: 1px solid var(--border-subtle);
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
    background: var(--bg-raised);
    animation: fadeIn 0.2s ease;
}

.relationship-panel h3 { font-size: 1rem; margin-bottom: 4px; }
.relationship-panel > p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 20px; }

.relationship-panel h4 {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.rel-card {
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.rel-card .rel-type { color: var(--accent); font-weight: 500; }
.rel-card .rel-desc { color: var(--text-muted); margin-top: 2px; }
.rel-card .rel-entities { color: var(--text); margin-top: 2px; }

/* === EVALUATION === */
.eval-body {
    flex: 1;
    overflow-y: auto;
}

.new-example-form {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-subtle);
    animation: slideDown 0.2s ease;
}

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

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group textarea.input {
    resize: vertical;
    min-height: 60px;
    font-family: var(--font);
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.eval-dashboard {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-subtle);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.metric-card {
    padding: 18px;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-align: center;
}

.metric-card .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.metric-card .metric-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.metric-card .metric-target {
    font-size: 0.7rem;
    margin-top: 6px;
}

.metric-pass { color: var(--success); }
.metric-fail { color: var(--danger); }

.eval-results {
    max-height: 300px;
    overflow-y: auto;
}

.eval-result-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.eval-result-row .result-question {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eval-result-row .result-scores {
    display: flex;
    gap: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.eval-result-row .result-scores span { min-width: 48px; text-align: right; }

.golden-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.golden-card {
    padding: 14px 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.golden-card .golden-q {
    font-weight: 500;
    font-size: 0.88rem;
    margin-bottom: 4px;
}

.golden-card .golden-a {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    max-height: 60px;
    overflow: hidden;
}

/* === ADMIN === */
.admin-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.org-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    padding: 20px;
    animation: slideUp 0.3s ease both;
}

.org-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
}

.org-name { font-weight: 600; font-size: 1rem; }

.org-slug {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 4px;
}

.org-keys { margin-bottom: 12px; }

.key-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 0.82rem;
}

.key-prefix {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 0.8rem;
}

.key-name { color: var(--text-secondary); flex: 1; }

.key-status {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
}

.key-status.active { background: var(--success-soft); color: var(--success); }
.key-status.inactive { background: var(--danger-soft); color: var(--danger); }

.key-used {
    font-size: 0.72rem;
    color: var(--text-faint);
}

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

.empty-state-inline {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 420px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease;
}

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

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

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

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

.modal-body {
    padding: 20px 24px 24px;
}

.modal-body .form-group { margin-bottom: 14px; }
.modal-body .form-group:last-child { margin-bottom: 0; }

.modal-body .form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-body .form-group input,
.modal-body .form-group select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition);
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.modal-body .form-group input::placeholder { color: var(--text-faint); }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    font-weight: 500;
    z-index: 2000;
    animation: slideToast 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    background: var(--success);
    color: #111;
}

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

/* === UPLOAD DROP ZONE (inside modal) === */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-surface);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone p { color: var(--text-muted); font-size: 0.88rem; }
.drop-zone .file-types { font-size: 0.75rem; margin-top: 6px; color: var(--text-faint); }

.upload-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    animation: slideUp 0.2s ease;
}

.upload-controls .selected-file-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === STAGGER ANIMATIONS === */
.collection-card:nth-child(1) { animation-delay: 0ms; }
.collection-card:nth-child(2) { animation-delay: 40ms; }
.collection-card:nth-child(3) { animation-delay: 80ms; }
.collection-card:nth-child(4) { animation-delay: 120ms; }
.collection-card:nth-child(5) { animation-delay: 160ms; }
.collection-card:nth-child(6) { animation-delay: 200ms; }

.document-card:nth-child(1) { animation-delay: 0ms; }
.document-card:nth-child(2) { animation-delay: 30ms; }
.document-card:nth-child(3) { animation-delay: 60ms; }
.document-card:nth-child(4) { animation-delay: 90ms; }
.document-card:nth-child(5) { animation-delay: 120ms; }

.org-card:nth-child(1) { animation-delay: 0ms; }
.org-card:nth-child(2) { animation-delay: 60ms; }
.org-card:nth-child(3) { animation-delay: 120ms; }
