/* ─────────────────────────────────────────────────────────────────────────
   Discovery Engine — Style Sheet
   Dark theme aligned with CRM Analytics styleguide (slate-900 base)
   ───────────────────────────────────────────────────────────────────────── */

/* ── Custom Properties ─────────────────────────────────────────────────── */
:root {
    /* Base colors */
    --bg:            #0f172a;   /* slate-900  — page background */
    --bg-elevated:   #162033;   /* slightly lighter — modal scrim */
    --surface:       #1e293b;   /* slate-800  — cards, panels */
    --surface-hover: #334155;   /* slate-700  — hover states */
    --border:        #334155;   /* slate-700  — borders */
    --border-subtle: #1e293b;   /* inset borders */

    /* Sidebar */
    --sidebar-bg:    #131929;   /* deeper than surface */

    /* Accent — indigo (as specified in task) */
    --accent:        #6366f1;
    --accent-hover:  #4f46e5;
    --accent-muted:  rgba(99, 102, 241, 0.15);
    --accent-faint:  rgba(99, 102, 241, 0.08);

    /* Semantic */
    --success:       #22c55e;
    --success-muted: rgba(34, 197, 94, 0.15);
    --warning:       #f59e0b;
    --warning-muted: rgba(245, 158, 11, 0.15);
    --error:         #ef4444;
    --error-muted:   rgba(239, 68, 68, 0.15);
    --info:          #06b6d4;

    /* Text */
    --text-primary:  #f8fafc;
    --text-secondary:#94a3b8;
    --text-muted:    #64748b;
    --text-code:     #e2e8f0;

    /* Chat bubbles */
    --bubble-user:   #6366f1;
    --bubble-user-text: #ffffff;
    --bubble-assistant: #1e293b;
    --bubble-assistant-text: #f8fafc;

    /* Typography */
    --font-ui:    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono:  "JetBrains Mono", "Fira Code", "SF Mono", monospace;

    /* Layout */
    --sidebar-width:  240px;
    --diagram-width:  380px;
    --radius:         8px;
    --radius-sm:      5px;
    --radius-lg:      12px;

    /* Timing */
    --transition:     150ms ease;
    --transition-slow:300ms ease;
}

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

html, body {
    height: 100%;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100%;
}

/* ── Screen Management ──────────────────────────────────────────────────── */
.screen {
    display: none;
    height: 100%;
    animation: fadeIn var(--transition-slow) ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

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

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

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

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

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

.btn-secondary:hover:not(:disabled) {
    background: #3e4f66;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-large {
    padding: 12px 28px;
    font-size: 15px;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

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

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.form-input {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-faint);
}

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

.form-error {
    padding: 8px 12px;
    background: var(--error-muted);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 13px;
}

.hidden { display: none !important; }

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#login-section {
    justify-content: center;
    align-items: center;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(99,102,241,0.07) 0%, transparent 70%);
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
}

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

.login-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.login-form {
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WELCOME SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#welcome-section {
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 30% at 50% 0%, rgba(99,102,241,0.06) 0%, transparent 60%);
}

.welcome-wrapper {
    width: 100%;
    max-width: 900px;
    padding: 64px 24px 48px;
}

.welcome-header {
    text-align: center;
    margin-bottom: 48px;
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.welcome-lead {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Capability cards grid */
.welcome-cta {
    text-align: center;
    margin-bottom: 24px;
}
.welcome-cta .btn-secondary {
    margin-left: 8px;
}

/* Model Configuration Panel */
.model-config-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.model-config-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: color var(--transition), background var(--transition);
}

.model-config-summary::-webkit-details-marker { display: none; }

.model-config-summary:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.model-config-chevron {
    margin-left: auto;
    transition: transform var(--transition);
    color: var(--text-muted);
}

.model-config-panel[open] .model-config-chevron {
    transform: rotate(180deg);
}

.model-config-body {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.model-config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

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

.model-config-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

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

.model-config-select:focus {
    border-color: var(--accent);
}

/* Presets table */
.model-presets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: var(--text-secondary);
}

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

.model-presets-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.model-presets-table tr:last-child td {
    border-bottom: none;
}

.model-presets-table td:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

/* Sidebar model info footer */
.sidebar-model-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-model-row {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    display: flex;
    gap: 4px;
}

.sidebar-model-key {
    color: var(--text-muted);
    opacity: 0.7;
}

.sidebar-model-cost {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT SCREEN — 3-column layout
   ═══════════════════════════════════════════════════════════════════════════ */
#chat-section {
    overflow: hidden;
}

.chat-layout {
    display: grid;
    grid-template-columns: 1fr var(--diagram-width);
    height: 100%;
    overflow: hidden;
    transition: grid-template-columns 600ms ease;
}

/* Adaptive layout — chat-dominant vs graph-dominant. Host shell only. */
.chat-layout[data-layout="chat-dominant"] {
    grid-template-columns: 1fr 0.67fr;
}

.chat-layout[data-layout="graph-dominant"] {
    grid-template-columns: 0.67fr 1fr;
}

.wizard-property-frame {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.wizard-phase-strip {
    margin-top: 10px;
}

.wizard-phase-strip .phase-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.wizard-phase-strip .phase-item {
    padding: 4px 8px;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border-subtle);
}
a.sidebar-header {
    color: inherit;
    text-decoration: none;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.phases-section {
    padding: 20px 16px 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.phases-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.phase-list {
    display: flex;
    flex-direction: column;
}

.phase-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.phase-item.active {
    background: var(--accent-faint);
}

.phase-item.complete .phase-indicator {
    background: var(--success);
    border-color: var(--success);
}

.phase-item.complete .phase-indicator::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    margin: auto;
}

.phase-item.active .phase-indicator {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-faint);
}

.phase-item.active .phase-indicator::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    margin: auto;
}

.phase-indicator {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-slow);
}

.phase-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.phase-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.phase-item.active .phase-name,
.phase-item.complete .phase-name {
    color: var(--text-primary);
}

.phase-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.phase-connector {
    width: 2px;
    height: 12px;
    background: var(--border);
    margin-left: 18px;
    border-radius: 1px;
}

/* Phase state classes (replace legacy active/complete) */
.phase-item.phase-current {
    background: var(--accent-faint);
}

.phase-item.phase-current .phase-indicator {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-faint);
}

.phase-item.phase-current .phase-indicator::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    margin: auto;
}

.phase-item.phase-current .phase-name {
    color: var(--text-primary);
    font-weight: 600;
}

.phase-item.phase-completed .phase-indicator {
    background: var(--success);
    border-color: var(--success);
}

.phase-item.phase-completed .phase-indicator::after {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: white;
    font-weight: 700;
    line-height: 1;
}

.phase-item.phase-completed .phase-name {
    color: var(--text-primary);
}

.phase-item.phase-completed .phase-annotation {
    font-size: 10px;
    color: var(--success);
    font-family: var(--font-mono);
    display: block;
}

.phase-item.phase-upcoming {
    opacity: 0.55;
}

.phase-item.phase-upcoming .phase-indicator {
    border-color: var(--border);
    background: transparent;
}

.phase-item.phase-skipped .phase-indicator {
    border-color: var(--text-muted);
}

.phase-item.phase-skipped .phase-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.phase-item.phase-skipped .phase-indicator::after {
    content: '⊘';
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phase-annotation {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
}

/* Horizontal divider between team and review phases */
.phase-divider-line {
    height: 1px;
    background: var(--border);
    margin: 8px 10px;
    border-radius: 1px;
}

/* Cost tracker */
.cost-tracker {
    margin: 0 12px 16px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    flex-shrink: 0;
}

.cost-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.cost-value {
    font-size: 20px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
    margin-bottom: 4px;
}

.cost-tokens {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.cost-bar-bg {
    height: 3px;
    background: var(--bg);
    border-radius: 2px;
    margin: 10px 0 4px;
    overflow: hidden;
}

.cost-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width var(--transition-slow);
}

.cost-max-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

/* ── Chat Pane ──────────────────────────────────────────────────────────── */
.chat-pane {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
}

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

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.chat-status {
    font-size: 11px;
    color: var(--text-muted);
}

.message-list {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.message-list::-webkit-scrollbar { width: 6px; }
.message-list::-webkit-scrollbar-track { background: transparent; }
.message-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.message-list-inner {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 20px;
}

/* Message bubbles */
.message {
    display: flex;
    gap: 10px;
    max-width: 80%;
    animation: messageFadeIn 200ms ease;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 4px;
}

.message.user .message-avatar {
    background: var(--accent);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.55;
    max-width: 100%;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--bubble-user);
    color: var(--bubble-user-text);
    border-bottom-right-radius: 4px;
}

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

/* A "> " line in a chat message (the played-back owner summary). */
.message-bubble .chat-quote {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    padding: 2px 0 2px 10px;
    border-left: 3px solid var(--border);
    color: var(--text-secondary, inherit);
}

/* Deterministic "Saved to the draft: ..." line after an update_summary. */
.message-bubble .chat-saved-note {
    color: var(--success);
    font-weight: 600;
}
.message-bubble .chat-saved-note.is-unsaved {
    color: var(--error);
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

/* Typing indicator */
.typing-indicator .message-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-5px); }
}

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

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 6px 4px 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-faint);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    padding: 8px 0;
    max-height: 120px;
    overflow-y: auto;
}

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

.chat-input:disabled {
    cursor: not-allowed;
}

.btn-send {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    background: var(--accent);
    border: none;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    margin-bottom: 2px;
}

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

.btn-send:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-send:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.chat-input-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.chat-input-hint kbd {
    background: var(--surface-hover);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 10px;
}

/* ── Diagram Pane ───────────────────────────────────────────────────────── */
.diagram-pane {
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border);
    overflow: hidden;
}

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

.diagram-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.diagram-confidence {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.confidence-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-slow);
}

.confidence-dot.early   { background: var(--text-muted); }
.confidence-dot.partial { background: var(--warning); }
.confidence-dot.high    { background: var(--success); }

.diagram-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 300px;
}

.diagram-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BLUEPRINT SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#blueprint-section {
    overflow: hidden;
}

.blueprint-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

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

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

.blueprint-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

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

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

.blueprint-body {
    flex: 1;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 0;
    overflow: hidden;
}

.blueprint-diagram-card {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--sidebar-bg);
    overflow: hidden;
}

.blueprint-diagram-header {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.blueprint-diagram-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.blueprint-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}

.blueprint-cards::-webkit-scrollbar { width: 6px; }
.blueprint-cards::-webkit-scrollbar-track { background: transparent; }
.blueprint-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.blueprint-card {
    border-bottom: 1px solid var(--border);
}

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

.blueprint-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.blueprint-card-count {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.blueprint-card-body {
    padding: 12px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blueprint-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 0;
}

/* Stage items */
.stage-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition);
}

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

.stage-item.hard-conversion {
    border-left: 3px solid var(--success);
}

.stage-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.stage-order {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-muted);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono);
    flex-shrink: 0;
    margin-top: 1px;
}

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

.stage-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.stage-events {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage-reason {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
    font-style: italic;
}

.stage-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

/* Dimension items */
.dimension-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.dimension-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.dimension-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dimension-type {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--info);
    background: rgba(6,182,212,0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.dimension-reason {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* Dataset items */
.dataset-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.dataset-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--warning-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dataset-info { flex: 1; }

.dataset-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.dataset-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.dataset-cadence {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

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

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

.badge-info {
    background: rgba(6,182,212,0.15);
    color: var(--info);
}

.badge-muted {
    background: rgba(148,163,184,0.1);
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUCCESS SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#success-section {
    justify-content: center;
    align-items: center;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(34,197,94,0.05) 0%, transparent 70%);
}

.success-wrapper {
    width: 100%;
    max-width: 520px;
    padding: 24px;
    text-align: center;
}

.success-icon {
    margin-bottom: 24px;
    animation: successPop 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.success-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.success-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 36px;
}

.success-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: border-color var(--transition-slow);
}

.result-card.ok   { border-color: rgba(34,197,94,0.4); }
.result-card.warn { border-color: rgba(245,158,11,0.4); }
.result-card.err  { border-color: rgba(239,68,68,0.4); }

.result-store-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.result-store-status {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.result-card.ok .result-store-status   { color: var(--success); }
.result-card.warn .result-store-status { color: var(--warning); }
.result-card.err .result-store-status  { color: var(--error); }

.success-summary {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: left;
    margin-bottom: 28px;
    line-height: 1.7;
    min-height: 0;
}

.success-summary:empty { display: none; }

.success-actions {
    display: flex;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   APPROVAL 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: 100;
    animation: fadeIn 150ms ease;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 460px;
    margin: 24px;
    animation: slideIn 200ms ease;
}

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

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

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

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition), background var(--transition);
}

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

.modal-body {
    padding: 20px 24px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-store-list {
    list-style: none;
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-store-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-primary);
}

.store-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.store-dot.ch { background: #f59e0b; }
.store-dot.fk { background: #06b6d4; }
.store-dot.wv { background: #8b5cf6; }

.modal-warning {
    font-size: 12px;
    color: var(--warning);
    padding: 10px 12px;
    background: var(--warning-muted);
    border-radius: var(--radius-sm);
    margin-top: 14px;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-primary);
    min-width: 240px;
    max-width: 360px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    animation: toastIn 200ms ease;
}

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

.toast-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--accent); }

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

@keyframes toastOut {
    to { transform: translateX(12px); opacity: 0; }
}

.toast.leaving {
    animation: toastOut 200ms ease forwards;
}

/* ═══════════════════════════════════════════════════════════════════════════
   D3 DIAGRAM STYLES
   ═══════════════════════════════════════════════════════════════════════════ */
.d3-stage-node rect {
    transition: fill 200ms ease, stroke 200ms ease;
}

.d3-stage-node:hover rect {
    filter: brightness(1.15);
}

.d3-tooltip {
    position: absolute;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    pointer-events: none;
    z-index: 50;
    max-width: 200px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    line-height: 1.5;
}

.d3-tooltip strong {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 3px;
}

.d3-tooltip span {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   INSPECT PANEL (node detail slide-in)
   ═══════════════════════════════════════════════════════════════════════════ */
.inspect-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 300ms ease;
    z-index: 10;
}

.inspect-panel.visible {
    transform: translateX(0);
}

.inspect-panel.hidden {
    transform: translateX(100%);
}

.inspect-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
}

.inspect-close:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.inspect-panel h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    margin-top: 8px;
}

.inspect-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.inspect-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.inspect-badge.active { background: rgba(16,185,129,0.2); color: #10b981; }
.inspect-badge.novel { background: rgba(239,68,68,0.2); color: #ef4444; }

.inspect-field {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.5;
}

.inspect-field .label {
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 4px;
}

.inspect-section {
    margin-top: 12px;
}

.inspect-hint {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: rgba(99,102,241,0.1);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORCE-DIRECTED GRAPH NODE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */
.entity-node { cursor: pointer; }
.entity-node:hover { filter: brightness(1.2); }

.node-label {
    fill: white;
    font-size: 10px;
    text-anchor: middle;
    pointer-events: none;
    font-family: var(--font-ui);
}

.category-bg {
    fill-opacity: 0.06;
    stroke-opacity: 0.2;
    stroke-dasharray: 6 3;
}

.category-label {
    fill-opacity: 0.5;
    font-size: 11px;
    font-weight: 600;
    text-anchor: middle;
    font-family: var(--font-ui);
}

/* Tool call indicator chips in chat */
.tool-call-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    margin: 0.25rem 0;
}

.tool-chip {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(99,102,241,0.15);
    color: var(--accent);
}

/* Phase divider in chat */
.phase-divider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.phase-divider::before,
.phase-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BLUEPRINT CATEGORY CARDS (v2 — ontology-based)
   ═══════════════════════════════════════════════════════════════════════════ */
.blueprint-category {
    margin-bottom: 20px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.blueprint-category h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: capitalize;
    margin-bottom: 12px;
}

.blueprint-entity-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.blueprint-entity-card strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.data-mode-badge {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--info);
    background: rgba(6,182,212,0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.source-badge {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--warning);
    background: var(--warning-muted);
    padding: 2px 6px;
    border-radius: 3px;
}

.blueprint-entity-card small {
    font-size: 11px;
    color: var(--text-muted);
    width: 100%;
}

.blueprint-novel-card {
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid rgba(245,158,11,0.3);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.blueprint-novel-card strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 3px;
}

.blueprint-novel-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.blueprint-novel-card small {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.blueprint-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REVIEW SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#review-section {
    overflow: hidden;
}

.review-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

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

.review-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.review-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

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

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

.review-body {
    flex: 1;
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    overflow: hidden;
}

.review-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px;
}

/* Left — Scorecard */
.review-scorecard {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--sidebar-bg);
    overflow-y: auto;
}

.scorecard-header {
    padding: 14px 16px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.scorecard-depths {
    padding: 12px 12px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scorecard-depth {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
    border: 1px solid transparent;
}

.scorecard-depth:hover {
    background: var(--surface-hover);
}

.scorecard-depth.active {
    background: var(--accent-faint);
    border-color: var(--accent-muted);
}

.scorecard-depth-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.scorecard-depth-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.scorecard-depth-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.scorecard-depth-score {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.scorecard-dots {
    display: flex;
    gap: 4px;
    margin-bottom: 5px;
}

.score-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background var(--transition);
}

.score-dot.filled  { background: var(--accent); }
.score-dot.empty   { background: var(--border); }

.scorecard-depth-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.scorecard-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 12px 0;
}

.scorecard-stats {
    padding: 12px;
}

.scorecard-overall {
    text-align: center;
    margin-bottom: 12px;
}

.scorecard-overall-pct {
    display: block;
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.scorecard-overall-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.scorecard-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.scorecard-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 3px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Middle — Business View */
.review-business-view {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.business-view-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--sidebar-bg);
}

.business-view-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.business-view-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bv-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: border-color var(--transition);
}

.bv-card:hover {
    border-color: var(--accent-muted);
}

.bv-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bv-rel-arrow {
    color: var(--accent);
    font-size: 16px;
}

.bv-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.bv-stat {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.bv-stat-label {
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 4px;
}

.bv-warning .bv-stat-label { color: var(--warning); }

.bv-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.bv-actions { margin-top: 6px; }

.bv-deepen-link {
    font-size: 11px;
    color: var(--primary);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 200ms;
}
.bv-deepen-link:hover { opacity: 1; text-decoration: underline; }

.bv-group {
    margin-bottom: 12px;
}

.bv-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-left: 2px;
}

/* Right — Artifacts */
.review-artifacts {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    background: var(--sidebar-bg);
    overflow: hidden;
}

.artifacts-header {
    padding: 14px 16px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.artifacts-list {
    flex: 1;
    overflow-y: auto;
}

.artifact-row {
    border-bottom: 1px solid var(--border-subtle);
}

.artifact-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}

.artifact-row-header:hover {
    background: var(--surface-hover);
}

.artifact-name {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
}

.artifact-stores {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.store-indicator {
    width: 22px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.store-indicator.present {
    background: var(--accent-muted);
    color: var(--accent);
}

.store-indicator.absent {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    opacity: 0.5;
}

.artifact-chevron {
    color: var(--text-muted);
    font-size: 16px;
    transition: transform var(--transition);
    flex-shrink: 0;
}

.artifact-chevron.open {
    transform: rotate(90deg);
}

.artifact-detail {
    padding: 10px 14px 14px;
    background: var(--surface);
    border-top: 1px solid var(--border-subtle);
}

.artifact-section {
    margin-bottom: 10px;
}

.artifact-section-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.artifact-section-label.ch { color: #f59e0b; }
.artifact-section-label.fg { color: #06b6d4; }
.artifact-section-label.wv { color: #8b5cf6; }

.artifact-kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    font-size: 11px;
}

.kv-key {
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.kv-val {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
    word-break: break-all;
}

.kv-val em {
    color: var(--text-muted);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCRIPT VIEWER MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.script-viewer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    animation: fadeIn 150ms ease;
}

.script-viewer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 200ms ease;
}

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

.script-viewer-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.script-viewer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.script-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--sidebar-bg);
}

.script-tab {
    padding: 10px 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}

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

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

.script-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.script-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 200px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    gap: 8px;
}

.script-step {
    border-bottom: 1px solid var(--border-subtle);
}

.script-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--sidebar-bg);
    flex-wrap: wrap;
}

.script-step-num {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    width: 28px;
}

.script-step-store {
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.script-step-op {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.script-step-rows {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 3px;
}

.script-step-phase {
    font-size: 10px;
    color: var(--accent);
    font-family: var(--font-mono);
    background: var(--accent-faint);
    padding: 2px 6px;
    border-radius: 3px;
}

.script-code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-code);
    background: var(--bg);
    padding: 14px 20px;
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
    border-left: 2px solid var(--border-subtle);
    margin-left: 20px;
    margin-right: 20px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EXECUTE SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#execute-section {
    overflow: hidden;
}

.execute-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

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

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

.execute-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

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

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

.execute-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.execute-step-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.execute-step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color var(--transition);
}

.execute-step.running {
    border-color: var(--accent);
}

.execute-step.complete {
    border-color: rgba(34, 197, 94, 0.4);
}

.execute-step.failed {
    border-color: rgba(239, 68, 68, 0.4);
}

.execute-step.execute-step-empty {
    opacity: 0.4;
    min-height: 0;
    border-color: transparent;
}

.execute-step.execute-step-empty .execute-step-row {
    padding: 6px 16px;
    cursor: default;
}

.execute-step.execute-step-empty .execute-step-op {
    font-style: italic;
    color: #64748b;
}

.execute-step.execute-step-empty .execute-step-chevron {
    display: none;
}

.execute-step-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}

.execute-step-row:hover {
    background: var(--surface-hover);
}

.step-status-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    border: 2px solid var(--border);
    color: var(--text-muted);
    transition: all var(--transition);
}

.execute-step.running .step-status-icon {
    border-color: var(--accent);
    color: var(--accent);
    animation: spin 1s linear infinite;
}

.execute-step.complete .step-status-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.execute-step.failed .step-status-icon {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.execute-step-num {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    width: 28px;
    flex-shrink: 0;
}

.execute-step-store {
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
    text-align: center;
    min-width: 28px;
}

.execute-step-script-preview {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 16px 8px 52px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
}

.execute-step-op {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.execute-step-rows {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    flex-shrink: 0;
}

.execute-step-chevron {
    color: var(--text-muted);
    font-size: 16px;
    transition: transform var(--transition);
    flex-shrink: 0;
}

.execute-step-chevron.open {
    transform: rotate(90deg);
}

.execute-step-detail {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg);
}

.execute-step-script {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-code);
    padding: 12px 16px;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

.execute-step-error {
    padding: 12px 16px;
    background: var(--error-muted);
    border-top: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 12px;
    color: var(--error);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.execute-step-error-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.execute-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.execute-footer-stats {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.execute-footer-actions {
    display: flex;
    gap: 10px;
}

.execute-completion-card {
    margin: 16px 24px;
    background: var(--success-muted);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    padding: 20px 24px;
    text-align: center;
}

.execute-completion-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 8px;
}

.execute-completion-stats {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.execute-completion-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ── Go to Review button in chat ────────────────────────────────────────── */
.chat-input-hints {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-go-review {
    font-size: 12px;
    color: #6366f1;
}

.btn-go-review:hover {
    color: #818cf8;
}

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

/* Collapse diagram pane below 1200px */
@media (max-width: 1200px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
    .diagram-pane {
        display: none;
    }
}

/* Collapse sidebar below 768px */
@media (max-width: 768px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .snapshot-grid {
        grid-template-columns: 1fr;
    }
    .blueprint-body {
        grid-template-columns: 1fr;
    }
    .blueprint-diagram-card {
        display: none;
    }
    .success-results {
        grid-template-columns: 1fr;
    }
    .welcome-wrapper {
        padding: 32px 16px;
    }
}

/* ── Scrollbar global ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* ── Selection ──────────────────────────────────────────────────────────── */
::selection {
    background: var(--accent-muted);
    color: var(--text-primary);
}

/* ── Structured Choice Buttons ─────────────────────────────────────────── */
/* ── Model Selector ────────────────────────────────────────────────────── */
.model-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    justify-content: center;
}
.model-label {
    font-size: 13px;
    color: var(--text-secondary);
}
.model-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}
.model-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Markdown Tables ────────────────────────────────────────────────────── */
.md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 13px;
}
.md-table th, .md-table td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}
.md-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}
.md-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.choice-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 10px 0 4px 0;
    font-style: italic;
}
.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 0 0;
}
.choice-btn, .check-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
}
.choice-btn:hover, .check-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}
.choice-btn.selected, .check-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.choice-btn:disabled, .check-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.choice-submit-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    margin-top: 12px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.15s ease;
}
.choice-submit-btn:hover {
    background: var(--accent);
    color: white;
}
.choice-submit-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ═══════════════════════════════════════════════════════════════════════════
   INFERENCE PROGRESS
   ═══════════════════════════════════════════════════════════════════════════ */
.inference-progress {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 8px 0;
    align-self: flex-start;
    width: 100%;
    max-width: 480px;
    animation: messageFadeIn 200ms ease;
}

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

.inference-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.inference-pct {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 600;
}

.inference-bar-bg {
    height: 3px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.inference-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 300ms ease;
}

.inference-steps {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.inference-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.step-icon {
    font-size: 11px;
    width: 14px;
    flex-shrink: 0;
    text-align: center;
}

.step-label {
    color: var(--text-secondary);
}

.step-completed .step-icon { color: var(--success); }
.step-completed .step-label { color: var(--text-primary); }

.step-running .step-icon {
    color: var(--accent);
    animation: pulse 1s ease-in-out infinite;
}
.step-running .step-label { color: var(--text-primary); }

.step-pending .step-icon { color: var(--text-muted); }
.step-pending .step-label { color: var(--text-muted); }

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

.inference-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--success-muted);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    margin: 6px 0;
    align-self: flex-start;
    animation: messageFadeIn 200ms ease;
}

.inference-summary-icon {
    color: var(--success);
    font-size: 13px;
}

.inference-summary-text {
    color: var(--success);
    font-weight: 500;
}

/* ── btn-sm ─────────────────────────────────────────────────────────────── */
.btn.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* ── Next Phase Button ─────────────────────────────────────────────────── */
.btn-next-phase {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.btn-next-phase:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}
.btn-next-phase:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.wizard-advance-reason {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Welcome Screen Snapshots ──────────────────────────────────────────── */
.welcome-snapshots {
    margin: 32px 0 0;
}

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

.snapshot-empty-hint {
    color: #64748b;
    font-size: 14px;
    text-align: center;
    padding: 24px 0;
}

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

.snapshot-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s ease;
    position: relative;
}

.snapshot-card:hover {
    border-color: #3b82f6;
}

.snapshot-card-removing {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.snapshot-card-name {
    font-size: 14px;
    font-weight: 500;
    color: #f8fafc;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.snapshot-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.snapshot-badge-draft     { background: rgba(6, 182, 212, 0.15);   color: #06b6d4; }
.snapshot-badge-executed  { background: rgba(34, 197, 94, 0.15);   color: #22c55e; }
.snapshot-badge-failed    { background: rgba(239, 68, 68, 0.15);   color: #ef4444; }
.snapshot-badge-deleted   { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

.snapshot-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
}

.snapshot-card-version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.snapshot-card-date {}

.snapshot-card-entities {
    color: #94a3b8;
}

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

.snapshot-action-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.snapshot-action-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.snapshot-action-delete:hover {
    color: #ef4444;
}

.snapshot-card-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 0;
    font-size: 12px;
    color: #f59e0b;
    border-top: 1px solid #334155;
    margin-top: 8px;
}

.snapshot-card-confirm span {
    flex: 1;
}

.snapshot-confirm-yes {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.snapshot-confirm-no {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.snapshot-rename-input {
    background: #0f172a;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    color: #f8fafc;
    font-size: 14px;
    font-weight: 500;
    padding: 2px 6px;
    outline: none;
    width: 100%;
    flex: 1;
}

/* ── Refining indicator in sidebar ────────────────────────────────────── */
.sidebar-refining-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #f59e0b;
    padding: 3px 8px;
    background: rgba(245, 158, 11, 0.12);
    border-radius: 10px;
    margin-top: 8px;
    width: fit-content;
}

.sidebar-refining-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
    animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENTITY CHAT PANEL (Inspector — Task 8)
   Slide-in panel on the right side of the graph explorer.
   ═══════════════════════════════════════════════════════════════════════════ */

.entity-chat-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 360px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transform: translateX(0);
    transition: transform var(--transition-slow);
}

.entity-chat-panel.visible {
    transform: translateX(0);
}

.entity-chat-panel.hidden {
    transform: translateX(100%);
}

/* Header */
.entity-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 16px 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.entity-chat-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.entity-chat-title h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Summary section */
.entity-chat-summary {
    padding: 10px 16px 8px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* Message list */
.entity-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.entity-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.entity-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.entity-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Individual messages */
.ec-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.ec-message-user {
    flex-direction: row-reverse;
}

.ec-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.ec-avatar-user {
    background: var(--accent);
    color: #fff;
}

.ec-avatar-assistant {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.ec-bubble {
    max-width: 240px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.ec-bubble code {
    font-family: var(--font-mono);
    font-size: 11px;
    background: rgba(0,0,0,0.25);
    padding: 1px 4px;
    border-radius: 3px;
}

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

.ec-bubble-assistant {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-bottom-left-radius: 3px;
}

/* Typing bubble (3 bouncing dots inside assistant bubble) */
.ec-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
}

/* Change chips */
.ec-change-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.ec-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
}

/* Input area */
.entity-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

.entity-chat-input-area textarea {
    flex: 1;
    resize: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.4;
    padding: 8px 10px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.entity-chat-input-area textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-faint);
}

.entity-chat-input-area textarea::placeholder {
    color: var(--text-muted);
}

.btn-send {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
}

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

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

/* Footer */
.entity-chat-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.entity-chat-footer .btn-primary {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-ui);
    font-weight: 500;
    transition: background var(--transition), opacity var(--transition);
}

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

.entity-chat-footer .btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

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

.cost-tracker {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Toast notification */
.ec-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: #22c55e;
    color: #fff;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius);
    z-index: 9999;
    opacity: 0;
    transition: opacity 300ms ease, transform 300ms ease;
    pointer-events: none;
    white-space: nowrap;
}

.ec-toast.ec-toast-error {
    background: var(--error);
}

.ec-toast.ec-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Quality tab */
.quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.quality-header h2 {
    font-family: Inter, system-ui, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.quality-gauge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    color: #6366f1;
}
.quality-gauge .gauge-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid #e2e8f0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.quality-section {
    margin-bottom: 24px;
}
.quality-section h3 {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px 0;
}
.quality-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
}
.quality-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid #e2e8f0;
    color: #64748b;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.quality-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}
.quality-table tr:hover {
    background: #f8fafc;
}
.score-bar-container {
    width: 120px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.score-bar-fill.high { background: #10b981; }
.score-bar-fill.medium { background: #f59e0b; }
.score-bar-fill.low { background: #ef4444; }
.gap-chip {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    background: #fef3c7;
    color: #92400e;
    border-radius: 4px;
    font-size: 12px;
}
.quality-rec-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fff;
}
.quality-rec-item .rec-text {
    font-size: 14px;
    color: #1e293b;
}
.quality-rec-item .btn-deepen {
    padding: 4px 12px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
.quality-rec-item .btn-deepen:hover {
    background: #4f46e5;
}
.quality-loading {
    text-align: center;
    padding: 32px;
    color: #64748b;
    font-size: 14px;
}
.quality-error {
    text-align: center;
    padding: 16px;
    color: #ef4444;
    background: #fef2f2;
    border-radius: 8px;
    font-size: 14px;
}

/* ========== Changelog panel ========== */
.changelog-section {
    margin-top: 24px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}
.changelog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.changelog-toggle-btn {
    background: none;
    border: none;
    font-family: Inter, system-ui, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
}
.changelog-toggle-btn:hover {
    color: #6366f1;
}
.changelog-count-badge {
    background: #6366f1;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}
.changelog-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.changelog-filter-chip {
    padding: 4px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    font-family: Inter, system-ui, sans-serif;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}
.changelog-filter-chip:hover {
    border-color: #6366f1;
    color: #6366f1;
}
.changelog-filter-chip.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.changelog-timeline {
    padding-left: 20px;
    border-left: 2px solid #e2e8f0;
    margin-left: 8px;
}
.changelog-entry {
    position: relative;
    padding: 8px 0 8px 16px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    color: #1e293b;
}
.changelog-entry::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e2e8f0;
}
.changelog-entry.action-added::before { background: #10b981; }
.changelog-entry.action-modified::before { background: #f59e0b; }
.changelog-entry.action-removed::before { background: #ef4444; }
.changelog-entry.action-pending::before { background: #6366f1; }
.changelog-entry .entry-action-icon {
    font-size: 14px;
    margin-right: 4px;
}
.changelog-entry .entry-target {
    font-weight: 600;
}
.changelog-entry .entry-field-change {
    color: #64748b;
    font-size: 13px;
    margin-top: 2px;
}
.changelog-entry .entry-field-change .old-val {
    text-decoration: line-through;
    color: #ef4444;
}
.changelog-entry .entry-field-change .new-val {
    color: #10b981;
}
.changelog-entry .entry-confidence {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}
.changelog-entry .entry-confidence.high { background: #d1fae5; color: #065f46; }
.changelog-entry .entry-confidence.medium { background: #fef3c7; color: #92400e; }
.changelog-entry .entry-confidence.low { background: #fef2f2; color: #991b1b; }
.changelog-entry .entry-reason {
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
    margin-top: 2px;
}
.changelog-entry .entry-source {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.changelog-pending {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.changelog-pending h4 {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #4338ca;
    margin: 0 0 8px 0;
}
.changelog-pending .btn-review-pending {
    padding: 4px 12px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}
.changelog-empty {
    text-align: center;
    padding: 16px;
    color: #94a3b8;
    font-size: 14px;
    font-style: italic;
}

/* ========== Health tab ========== */
.health-section {
    margin-bottom: 32px;
}
.health-section h2 {
    font-family: Inter, system-ui, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 16px 0;
}
.health-depth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.health-depth-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.health-depth-card .depth-name {
    font-family: Inter, system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 8px;
}
.health-depth-card .depth-score {
    font-size: 28px;
    font-weight: 700;
}
.health-depth-card .depth-score.high { color: #10b981; }
.health-depth-card .depth-score.medium { color: #f59e0b; }
.health-depth-card .depth-score.low { color: #ef4444; }
.health-completeness-row {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    color: #1e293b;
}
.health-completeness-row .completeness-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}
.health-completeness-row .completeness-stat .stat-label {
    color: #64748b;
}
.health-completeness-row .completeness-stat .stat-value {
    font-weight: 600;
}
.health-stores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.health-store-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}
.health-store-card .store-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.health-store-card .store-name {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}
.health-store-card .store-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.health-store-card .store-status.green { background: #10b981; }
.health-store-card .store-status.yellow { background: #f59e0b; }
.health-store-card .store-status.red { background: #ef4444; }
.health-store-card .store-counts {
    font-family: Inter, system-ui, sans-serif;
    font-size: 13px;
    color: #64748b;
}
.health-sync-row {
    margin-bottom: 20px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    color: #1e293b;
}
.health-pipeline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}
.pipeline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-family: Inter, system-ui, sans-serif;
    font-size: 13px;
}
.pipeline-row .pipeline-name {
    color: #1e293b;
    font-weight: 500;
}
.pipeline-row .pipeline-last-run {
    color: #64748b;
}
.pipeline-row .badge-stale {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.health-reconciliation-row {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    color: #1e293b;
}
.health-reconciliation-row .recon-summary {
    font-weight: 600;
    margin-bottom: 8px;
}
.health-reconciliation-row .recon-failures {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    display: none;
}
.health-reconciliation-row .recon-failures.has-failures {
    display: block;
}
.health-reconciliation-row .recon-failure-item {
    font-size: 13px;
    color: #991b1b;
    padding: 2px 0;
}
.health-unavailable {
    text-align: center;
    padding: 24px;
    color: #94a3b8;
    font-size: 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #e2e8f0;
}

/* ── Discovery Tracking (GitLab !104) ──────────────────────────────────── */
.login-tracking-link {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.login-tracking-link a {
    color: var(--accent);
    font-weight: 600;
}
.tracking-page {
    height: 100%;
    overflow: auto;
    padding: 28px 32px 64px;
    max-width: 1200px;
}
.tracking-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.tracking-kicker {
    margin: 0 0 4px;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.tracking-title {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
}
.tracking-version-link {
    margin: 8px 0 0;
}
.tracking-version-link a,
.tracking-property-picks a {
    color: var(--accent);
    font-weight: 600;
}
.tracking-ids {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.tracking-ids summary {
    cursor: pointer;
}
.tracking-property-picks {
    list-style: none;
    margin: 12px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tracking-observed {
    font-variant-numeric: tabular-nums;
}
.tracking-lead,
.tracking-note {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 6px;
}
.tracking-form {
    margin-bottom: 16px;
}
.tracking-form-row,
.tracking-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
}
.tracking-form-row .form-input,
.tracking-toolbar .form-input {
    flex: 1;
    font-family: var(--font-mono);
}
.tracking-toolbar {
    margin: 16px 0 8px;
    max-width: 420px;
}
.tracking-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 12px 0;
}
.tracking-meta-grid div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}
.tracking-meta-grid dt {
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}
.tracking-meta-grid dd {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    word-break: break-all;
}
.tracking-platform {
    margin-top: 28px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.tracking-platform h2,
#tracking-table h2 {
    font-size: 18px;
    margin: 18px 0 6px;
}
.tracking-platform h3 {
    font-size: 15px;
    margin: 18px 0 4px;
}
.tracking-platform h4 {
    font-size: 13px;
    margin: 14px 0 2px;
    color: var(--text-secondary);
    font-weight: 600;
}
.tracking-always-on {
    margin-top: 6px;
}
.tracking-always-on > summary {
    cursor: pointer;
    color: var(--text-primary);
    font-size: 13px;
}
.tracking-field-table {
    margin-top: 8px;
}
.tracking-entity {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.tracking-entity h3 {
    font-size: 16px;
    margin: 0;
}
.tracking-status {
    margin-top: 12px;
}
.tracking-status h4 {
    font-size: 13px;
    margin: 0 0 4px;
}
.tracking-alias-label {
    margin: 6px 0 0;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.tracking-aliases {
    margin: 4px 0 0;
    padding-left: 18px;
}
.tracking-aliases li {
    margin: 4px 0;
}
.tracking-shared-attrs {
    margin-top: 4px;
}
.tracking-click-hint {
    display: block;
    margin-top: 4px;
    max-width: 36ch;
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
    font-weight: 400;
}
.tracking-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin-top: 8px;
}
.tracking-chips li {
    background: var(--accent-muted);
    border-radius: 999px;
    padding: 2px 10px;
}
.tracking-warning {
    background: var(--warning-muted);
    color: var(--warning);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin: 8px 0;
}
.tracking-evidence {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.45;
    max-width: 72ch;
}
.tracking-evidence strong {
    font-weight: 700;
}
.tracking-evidence[data-evidence="quiet"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.tracking-evidence[data-evidence="broken"] {
    background: var(--warning-muted);
    color: var(--warning);
}
.tracking-table-scroll {
    overflow-x: auto;
}
.tracking-table .mono,
.tracking-attr-table .mono {
    font-family: var(--font-mono);
    font-size: 12px;
}
.tracking-attrs {
    margin-top: 4px;
}
.tracking-attrs summary {
    cursor: pointer;
    color: var(--text-secondary);
}
.tracking-attr-table {
    margin-top: 8px;
    min-width: 520px;
}
.tracking-empty,
.tracking-muted {
    color: var(--text-muted);
}
.tracking-page code {
    font-family: var(--font-mono);
    font-size: 12px;
}

/* ── Settings (GitLab !120) ────────────────────────────────────────────── */
#settings-section {
    overflow: hidden;
    background: var(--bg);
}
#settings-section.screen.active {
    overflow: hidden;
}
.settings-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 32px 20px 0;
    box-sizing: border-box;
    overflow: hidden;
}
.settings-chrome {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    background: var(--bg);
    padding-bottom: 4px;
}
.settings-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 64px;
}
.settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.settings-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: visible;
    /* inset line avoids tab margin-bottom:-1px vs border (1px scrollH fight) */
    box-shadow: inset 0 -1px 0 var(--border);
    border-bottom: none;
    margin: 0 0 20px;
}
.settings-tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px 12px;
    margin: 0;
    cursor: pointer;
    white-space: nowrap;
}
.settings-tab:hover {
    color: var(--text-primary);
}
.settings-tab[aria-selected="true"] {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
    background: var(--accent-faint);
}
.settings-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
.settings-panel-title {
    font-size: 18px;
    margin: 0 0 6px;
}
.settings-panel-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px;
}
.settings-panel[hidden] {
    display: none;
}
.portfolio-advanced {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--text-muted);
}
.portfolio-advanced summary {
    cursor: pointer;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.mcp-card > summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
details.mcp-card:not([open]) > summary {
    margin-bottom: 0;
}
.connect-band {
    margin-bottom: 28px;
}
.connect-band > h2,
.connect-band > h3 {
    font-size: 13px;
    letter-spacing: 0.08em;
    margin: 0 0 10px;
    color: var(--text-muted);
}
.client-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 12px;
}
.client-tabs button[aria-selected="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.connect-snippet {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.45;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 0 0 10px;
}
.settings-lead {
    margin: 8px 0 0;
    text-align: left;
}
.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 16px;
}
.settings-card h2 {
    font-size: 18px;
    margin: 0 0 8px;
}
.settings-card h3,
.settings-card h4 {
    font-size: 14px;
    margin: 0 0 6px;
}
.settings-kicker {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0 0 8px;
}
.settings-note {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 12px;
}
.settings-note.form-error {
    color: var(--error);
}
.settings-note.settings-gap {
    color: var(--text-primary);
    background: var(--warning-muted);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}
.machine-reader-table-wrap {
    margin-bottom: 16px;
    min-width: 0;
    max-width: 100%;
}
.machine-reader-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.machine-reader-table th,
.machine-reader-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
}
.machine-reader-table td:last-child {
    white-space: normal;
}
.machine-reader-table td:last-child .btn {
    margin: 0 6px 6px 0;
}
.machine-reader-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.machine-reader-table code {
    font-family: var(--font-mono);
    font-size: 12px;
}
.reader-roster {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    min-width: 0;
    max-width: 100%;
}
.reader-roster-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    min-width: 0;
}
.reader-roster-row.is-new {
    background: var(--accent-faint);
    border-radius: 8px;
    padding-left: 12px;
    padding-right: 12px;
}
.reader-roster-ids {
    margin-top: 6px;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}
.reader-roster-name {
    margin: 0 0 8px;
    font-weight: 600;
    overflow-wrap: break-word;
}
.reader-roster-fields {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 6px;
    margin: 0;
    min-width: 0;
}
.reader-roster-fields dt {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.reader-roster-fields dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: break-word;
    white-space: normal;
}
.reader-roster-fields code {
    font-family: var(--font-mono);
    font-size: 12px;
}
.reader-roster-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.machine-reader-form {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.machine-reader-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.machine-reader-secret {
    background: var(--warning-muted);
    border: 1px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
}
.mcp-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 0 0 16px;
    background: rgba(15, 23, 42, 0.35);
}
.mcp-card h3 {
    margin: 0 0 6px;
    font-size: 14px;
}
.mcp-smoke,
.mcp-smoke-once {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 12px;
    line-height: 1.4;
    margin: 8px 0;
}
.mcp-bullets {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 13px;
}
.machine-reader-advanced {
    margin: 8px 0 14px;
}
.machine-reader-properties {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.machine-reader-property,
.machine-reader-limit {
    font-size: 13px;
    color: var(--text-secondary);
}
.snapshot-scope-note {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 8px;
}
.welcome-snapshot-cta {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.machine-reader-secret-title {
    font-weight: 600;
    margin: 0 0 8px;
}
.secret-row {
    display: grid;
    grid-template-columns: minmax(0, 140px) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    min-width: 0;
    max-width: 100%;
}
.secret-row .form-input,
.secret-row input {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}
.secret-row label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}
.grant-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}
.portfolio-badge {
    display: inline-block;
    margin: 6px 0 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.portfolio-badge-production {
    background: var(--success-muted);
    color: var(--success);
}
.portfolio-badge-dogfood {
    background: var(--warning-muted);
    color: var(--warning);
}
.portfolio-badge-row {
    margin: 0 0 8px;
}
.portfolio-business {
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 12px;
}
.business-workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.business-master-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.business-master-bar .settings-kicker {
    margin: 0;
}
.business-master-search {
    flex: 1 1 180px;
    max-width: 280px;
    margin: 0;
}
.business-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.business-picker-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
}
.business-picker-tab:hover {
    color: var(--text-primary);
}
.business-picker-tab[aria-selected="true"] {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--accent-faint);
}
.business-picker-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.business-picker-tab .portfolio-badge {
    margin: 0;
}
.business-detail[hidden] {
    display: none;
}
.business-detail .portfolio-business {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}
.business-master #portfolio-create-business-toggle {
    margin-left: auto;
}
.portfolio-property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}
.portfolio-property-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    background: var(--surface, transparent);
}
.portfolio-property-card.is-focused {
    outline: 2px solid var(--accent, #6366f1);
}
.portfolio-property-edit {
    display: none;
    margin-top: 10px;
}
.portfolio-property-card.is-open .portfolio-property-edit {
    display: block;
}
.portfolio-property {
    margin: 10px 0 12px 8px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
}
.ontology-graph-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    grid-column: 1 / -1;
}
.ontology-graph-actions .tracking-note {
    margin: 0;
    flex: 1 1 220px;
}
.ontology-graph-job {
    flex: 1 1 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-primary);
}
.ontology-graph-job p {
    margin: 0 0 6px;
}
.ontology-graph-job-line,
.ontology-graph-change {
    font-weight: 700;
}
.ontology-graph-assign-path,
.ontology-assign-path {
    margin: 0 0 8px;
}
#ontology-graph-assign-btn {
    margin: 0 0 8px;
}
#ontology-graph-assign-btn[hidden] {
    display: none;
}
.ontology-assign-name {
    background: var(--accent-muted);
    color: var(--text-primary);
    border: 0;
    border-radius: 999px;
    padding: 2px 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.ontology-node.is-unassigned circle {
    stroke-dasharray: 4 3;
}
.ontology-import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 12px;
}
.ontology-draft-aside {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
}
.portfolio-property-title {
    margin: 0 0 4px;
    font-weight: 600;
}
.portfolio-hosts {
    margin: 0 0 8px;
    padding-left: 18px;
}
.portfolio-hosts li {
    margin-bottom: 6px;
}
.portfolio-actions,
.portfolio-host-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.portfolio-host-form .form-input {
    max-width: 280px;
}
.portfolio-id {
    margin-left: 6px;
    color: var(--text-muted);
    font-size: 11px;
}
.portfolio-rename {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 8px;
}
.portfolio-rename .form-label {
    flex: 1 0 100%;
    margin: 0;
}
.portfolio-rename .form-input {
    flex: 1 1 200px;
    max-width: 360px;
}
.portfolio-immutable {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 8px;
}
.portfolio-immutable .settings-kicker {
    margin: 0;
}
.portfolio-field-note {
    flex: 1 0 100%;
    margin: 0 0 8px;
}
@media (max-width: 720px) {
    .machine-reader-form-row,
    .secret-row,
    .settings-header {
        grid-template-columns: 1fr;
        display: grid;
    }
    .settings-tab {
        padding: 10px 12px 12px;
    }
}

/* ── Ontologies list (GitLab !163) ─────────────────────────────────────── */
.discovery-shell-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    margin: 0 0 20px;
}
.discovery-shell-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 14px 12px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.discovery-shell-nav a:hover {
    color: var(--text-primary);
}
.discovery-shell-nav a[aria-current="page"] {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

/* Left context: Home, then Business → Property, then Properties / Ontologies / Tracking, then Admin (GitLab !182–!185, !207) */
.discovery-shell {
    display: none;
    height: 100%;
}
.discovery-shell.is-open {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    height: 100%;
    background: var(--bg);
}
.discovery-shell-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}
.discovery-shell-main > .screen.active {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow-y: auto;
}
.discovery-breadcrumb {
    flex: 0 0 auto;
    padding: 14px 28px 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.discovery-breadcrumb[hidden] {
    display: none !important;
}
.discovery-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}
.discovery-breadcrumb li {
    display: inline-flex;
    align-items: center;
}
.discovery-breadcrumb li:not(:last-child)::after {
    content: "→";
    margin: 0 8px;
    color: var(--text-muted);
}
.discovery-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}
.discovery-breadcrumb a:hover {
    color: var(--text-primary);
}
.discovery-breadcrumb [aria-current="page"] {
    color: var(--text-primary);
    font-weight: 600;
}
.context-nav {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 14px 16px;
    overflow-y: auto;
}
.context-brand {
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 0 8px 8px;
}
a.context-brand {
    color: inherit;
    text-decoration: none;
}
.context-kicker {
    display: block;
    margin: 12px 0 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.context-stack .form-input {
    width: 100%;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.context-scope {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin-bottom: 8px;
}
.context-scope button {
    flex: 1;
    text-align: center;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.context-scope button:first-child {
    border-radius: 8px 0 0 8px;
}
.context-scope button:last-child {
    border-radius: 0 8px 8px 0;
    margin-left: -1px;
}
.context-scope button:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.context-scope button[aria-pressed="true"] {
    background: var(--accent-muted);
    color: var(--text-primary);
}
#context-property.is-inactive,
#context-property[hidden] {
    display: none;
}
.business-catalogue-empty-phase {
    color: var(--text-muted);
}
.context-plane {
    margin: 16px 8px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.context-planes > a[data-discovery-nav="welcome"] {
    margin-bottom: 4px;
}
.context-planes > a[data-discovery-nav="properties"] {
    margin-top: 8px;
}
.context-planes a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}
.context-planes a[hidden] {
    display: none !important;
}
.context-planes a:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.context-planes a[aria-current="page"] {
    background: var(--accent-muted);
    color: var(--text-primary);
}
.context-session {
    margin-top: auto;
    padding: 12px 8px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
.context-session[hidden] {
    display: none;
}
.context-principal-name {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}
.context-sign-out {
    appearance: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
}
.context-sign-out:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.welcome-wrapper.welcome-dashboard {
    padding-top: 28px;
}
.welcome-dashboard .welcome-header {
    text-align: left;
    margin-bottom: 12px;
}
.welcome-dashboard .welcome-lead {
    margin: 0;
    max-width: 42rem;
}
.welcome-dashboard .welcome-title {
    font-size: 24px;
    margin-bottom: 8px;
}
.welcome-primary {
    margin: 4px 0 20px;
}
.welcome-dashboard .welcome-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
/* .btn sets display, which beats the user-agent [hidden] rule. All-scope
   Home hides the secondary Open properties control with this attribute. */
#welcome-open-properties[hidden],
#welcome-open-properties-outcome[hidden] {
    display: none;
}
.welcome-open-properties-outcome {
    flex-basis: 100%;
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.welcome-section-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.welcome-status-outcome {
    margin: 0 0 8px;
    color: var(--text-secondary);
    font-size: 13px;
    max-width: 42rem;
}
.welcome-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}
.welcome-metrics li {
    min-width: 0;
}
.welcome-metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
button.welcome-metric {
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
button.welcome-metric[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.welcome-metric strong {
    display: block;
    font-size: 28px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.welcome-metric span {
    color: var(--text-secondary);
    font-size: 13px;
}
.welcome-catalogue {
    margin-bottom: 24px;
}
.ontology-pipeline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
}
.ontology-pipeline-step {
    font-size: 12px;
    color: var(--text-muted);
}
.ontology-pipeline-step.is-done {
    color: var(--success);
}
.ontology-pipeline-step.is-current {
    color: var(--text-primary);
    font-weight: 700;
}
.ontology-canvas {
    min-width: 0;
}
.ontology-canvas .ontology-view-toggle {
    margin-bottom: 8px;
}
@media (max-width: 800px) {
    .discovery-shell.is-open {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100%;
        overflow: auto;
    }
    .context-nav {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .discovery-shell-main {
        height: auto;
        overflow: visible;
    }
    .discovery-shell-main > .screen.active {
        overflow: visible;
    }
    .welcome-metrics {
        grid-template-columns: 1fr;
    }
}
#ontologies-section,
#properties-section,
#ontology-open-section {
    overflow-y: auto;
    background: var(--bg);
    align-items: center;
}
.ontologies-page {
    width: 100%;
    max-width: min(1100px, 100%);
    min-width: 0;
    padding: 28px 32px 64px;
}
.ontologies-page .tracking-top {
    flex-wrap: wrap;
    min-width: 0;
}
.ontologies-page .tracking-top > div:first-child {
    min-width: 0;
    flex: 1 1 16rem;
}
.ontologies-create-gate {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    max-width: 28rem;
    min-width: 0;
}
.ontologies-create-reason {
    margin: 0;
    text-align: right;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}
.ontologies-create-reason[hidden] {
    display: none !important;
}
.ontologies-create-reason a {
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}
#ontologies-empty a {
    color: var(--accent);
    font-weight: 600;
}
.ontologies-filter {
    margin: 8px 0 16px;
    max-width: 420px;
}
.ontologies-filter .form-input {
    width: 100%;
    margin-top: 4px;
}
.ontologies-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}
.ontologies-table th,
.ontologies-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}
.ontology-catalogue-table .ontology-col-object { width: 34%; }
.ontology-catalogue-table .ontology-col-property { width: 16%; }
.ontology-catalogue-table .ontology-col-status { width: 16%; }
.ontology-catalogue-table .ontology-col-version { width: 18%; }
.ontology-catalogue-table .ontology-col-materialize { width: 16%; }
.ontology-entity-list .ontology-col-object { width: 22%; }
.ontology-entity-list .ontology-col-attributes { width: 30%; }
.ontology-entity-list .ontology-col-statuses { width: 24%; }
.ontology-entity-list .ontology-col-events { width: 24%; }
#ontologies-table,
#ontology-outline {
    min-width: 0;
    max-width: 100%;
}
.ontologies-table tbody tr:hover {
    background: var(--surface-hover);
}
.ontology-open-link {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    max-width: 100%;
    white-space: normal;
}
.ontology-instance-name,
.ontology-instance-identity {
    display: block;
    overflow-wrap: anywhere;
    white-space: normal;
}
.ontology-instance-identity {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}
.ontology-instance-identity[data-version-role="draft"] {
    color: #c7d2fe;
}
.ontology-instance-identity[data-version-role="live"] {
    color: var(--text-primary);
}
.ontology-open-link:hover {
    color: #a5b4fc;
}
.discovery-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.discovery-link:hover {
    color: #a5b4fc;
    text-decoration: underline;
}
.discovery-link,
#welcome-section a:not([class]),
#properties-section a:not([class]),
#ontologies-section a:not([class]),
#ontology-open-section a:not([class]),
#property-home-section a:not([class]),
#property-versions-section a:not([class]) {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.discovery-link:hover,
#welcome-section a:not([class]):hover,
#properties-section a:not([class]):hover,
#ontologies-section a:not([class]):hover,
#ontology-open-section a:not([class]):hover,
#property-home-section a:not([class]):hover,
#property-versions-section a:not([class]):hover {
    color: #a5b4fc;
    text-decoration: underline;
}
.ontology-property-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}
.ontology-property-slug-aside {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}
.property-test-mark {
    display: inline-flex;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--warning-muted);
    color: var(--warning);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.property-test-separator td,
p.property-test-separator {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-top: 14px;
}
.portfolio-property-grid > .property-test-separator {
    grid-column: 1 / -1;
}
.ontologies-desc {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 400;
}
.ontology-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
}
.ontology-badge-draft {
    background: var(--accent-muted);
    color: #c7d2fe;
}
.ontology-badge-published,
.ontology-phase-published,
.ontology-phase-data_ready {
    background: var(--success-muted);
    color: var(--success);
}
.ontology-phase-draft {
    background: var(--accent-muted);
    color: #c7d2fe;
}
.chat-tooling {
    margin: 0 16px 12px;
    flex-shrink: 0;
}
.ontology-materialize-job {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}
.ontology-row-grouped {
    background: rgba(99, 102, 241, 0.06);
}
.ontology-row-draft .ontology-open-link,
.ontology-draft-link {
    color: #c7d2fe;
}
.ontology-draft-line {
    display: block;
    margin-top: 6px;
}
.ontology-state-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}
.ontology-draft-version {
    color: #c7d2fe;
    font-weight: 600;
}
.ontology-materialize {
    font-weight: 600;
    font-size: 13px;
}
.ontology-materialize-data_ready { color: var(--success); }
.ontology-materialize-applying { color: var(--info); }
.ontology-materialize-pending { color: var(--warning); }
.ontology-materialize-failed { color: var(--error); }
.properties-start {
    margin: 8px 0 24px;
}
.properties-start-actions,
.properties-form-exit {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 12px;
    align-items: center;
}
.ontology-unbound-tray {
    margin-top: 12px;
}
.ontology-unbound-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: 240px;
    overflow: auto;
}
.ontology-unbound-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 8px;
}
.ontology-tray-connect {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
    width: 100%;
}
#properties-create-panel[hidden],
#properties-attach-panel[hidden],
#properties-empty-cta[hidden],
#properties-create-open[hidden],
#ontologies-create[hidden],
#ontologies-shelf-note[hidden],
#machine-reader-used-note[hidden] {
    display: none;
}
.ontologies-create {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.ontologies-create-or {
    color: var(--text-muted);
    font-size: 13px;
}
#ontology-open-import {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
}
#ontology-open-back {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.ontology-open-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.ontology-open-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}
.ontology-open-version {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-secondary);
}
.ontology-draft-next {
    display: block;
    margin-top: 4px;
    color: #c7d2fe;
    font-size: 12px;
}
.ontology-open-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
#ontology-publish[hidden] {
    display: none !important;
}
.ontology-materialize-strip {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin: 8px 0 16px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.ontology-materialize-steps {
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}
.ontology-step {
    position: relative;
    padding: 4px 16px 4px 0;
    margin-right: 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}
.ontology-step + .ontology-step::before {
    content: "→";
    position: absolute;
    left: -16px;
    color: var(--text-muted);
    font-weight: 400;
}
.ontology-step.is-done,
.ontology-step.is-current {
    color: var(--text-primary);
}
.ontology-step.is-current {
    color: var(--warning);
}
.ontology-materialize-data_ready .ontology-step.is-current {
    color: var(--success);
}
.ontology-materialize-applying .ontology-step.is-current {
    color: var(--info);
}
.ontology-materialize-failed {
    margin: 0;
    color: var(--error);
    font-weight: 700;
}
.ontology-materialize-detail {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.ontology-view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.ontology-view-toggle button {
    background: transparent;
    color: var(--text-secondary);
    border: 0;
    padding: 8px 16px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.ontology-view-toggle button[aria-selected="true"] {
    background: var(--accent-muted);
    color: var(--text-primary);
}
.ontology-open-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: 16px;
    align-items: start;
    min-width: 0;
    max-width: 100%;
}
.ontology-graph {
    width: 100%;
    height: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.ontology-node {
    cursor: pointer;
}
.ontology-node circle {
    fill: var(--bg);
    stroke: var(--accent);
    stroke-width: 2;
}
.ontology-node.is-selected circle {
    stroke: var(--success);
    stroke-width: 3;
}
.ontology-node text,
.ontology-edge-label,
.ontology-edge-missing {
    fill: var(--text-primary);
    font-size: 11px;
}
.ontology-node text {
    text-anchor: middle;
    pointer-events: none;
}
.ontology-edge {
    stroke: var(--text-muted);
    stroke-width: 1.5;
}
.ontology-edge-label {
    fill: var(--text-secondary);
    text-anchor: middle;
    pointer-events: none;
}
.ontology-edge-label-bg {
    fill: var(--surface);
    pointer-events: none;
}
.ontology-park-band {
    fill: var(--bg);
    stroke: var(--border);
}
.ontology-park-label {
    fill: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
}
.ontology-outline-empty,
.ontology-panel-empty {
    margin: 0;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
}
#ontology-side-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: sticky;
    top: 72px;
    min-width: 0;
    overflow-wrap: anywhere;
}
.ontology-panel-title {
    margin: 0 0 4px;
    font-size: 18px;
}
.ontology-panel-desc,
.ontology-panel-meta {
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 13px;
}
.ontology-panel-section {
    margin: 14px 0 0;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ontology-panel-list {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--text-primary);
    font-size: 13px;
}
.ontology-panel-list li + li {
    margin-top: 4px;
}
.ontology-alias {
    color: var(--text-secondary);
}
.ontologies-table tr.is-selected {
    background: var(--accent-muted);
}
.ontology-rel-title {
    margin: 16px 0 8px;
    font-size: 14px;
}
.ontology-rel-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
}
@media (max-width: 800px) {
    .ontology-open-layout {
        grid-template-columns: 1fr;
    }
    #ontology-side-panel {
        position: static;
    }
}
.ontology-open-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.ontology-open-controls .ontology-view-toggle,
.ontology-mode-switch {
    margin-bottom: 0;
}
.ontology-mode-switch {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: visible;
}
.ontology-quality,
.ontology-breaks,
.ontology-it-works,
.ontology-lessons {
    max-width: 100%;
    overflow-x: hidden;
}
.ontology-quality-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ontology-quality-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.ontology-quality-sentence {
    flex: 1 1 16rem;
    min-width: 0;
}
.ontology-quality-neutral {
    color: var(--text-secondary);
}
.ontology-quality-banner,
.ontology-breaking-line,
.ontology-it-works,
.ontology-result-lead {
    margin: 8px 0;
}
.ontology-jev-tag {
    font-weight: 600;
}
.ontology-breaks-empty {
    margin: 0;
}
.ontology-mode-switch button {
    background: transparent;
    color: var(--text-secondary);
    border: 0;
    border-left: 1px solid var(--border);
    padding: 8px 16px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.ontology-mode-switch button:first-child {
    border-left: 0;
}
.ontology-mode-switch button[aria-selected="true"] {
    background: var(--accent-muted);
    color: var(--text-primary);
}
.ontology-mode-panel {
    margin-top: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
}
.ontology-mode-panel p {
    margin: 0 0 12px;
}
.ontology-import-json {
    min-height: 120px;
    width: 100%;
    margin-bottom: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
#ontology-import-file {
    display: block;
    margin-bottom: 12px;
}
.ontology-chat-log {
    min-height: 48px;
    margin: 8px 0 12px;
    color: var(--text-primary);
}
.ontology-versions-note,
.ontology-versions-status {
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 13px;
}
.ontology-versions-status:empty {
    display: none;
}
.ontology-versions-proof {
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.ontology-version-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 16px;
}
.ontology-version-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ontology-version-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.ontology-copy-draft {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}
.ontology-copy-confirm {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    max-width: 22rem;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.35;
}
.ontology-version-row.is-selected {
    border-color: var(--accent);
    background: var(--accent-muted);
}
.ontology-version-select {
    flex: 1;
    text-align: left;
    background: transparent;
    color: var(--text-primary);
    border: 0;
    padding: 4px;
    font: inherit;
    cursor: pointer;
}
.ontology-version-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
}
.ontology-version-badge-draft { background: var(--accent-muted); color: #c7d2fe; }
.ontology-version-badge-active { background: var(--success-muted); color: var(--success); }
.ontology-version-badge-publishing { background: var(--info-muted, var(--accent-muted)); color: var(--info); }
.ontology-version-badge-failed { background: var(--error-muted); color: var(--error); }
.ontology-version-badge-superseded { color: var(--text-muted); }
.ontology-version-live {
    margin-left: 8px;
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
}
.ontology-version-error {
    margin: 0 0 8px;
    color: var(--error);
    font-size: 13px;
}
.ontology-version-detail[hidden] {
    display: none;
}
/* #449: failed rows say what failed, with [See what failed] and Retry. */
.ontology-failure-line {
    display: block;
    margin-top: 4px;
    color: var(--error);
    font-size: 13px;
    line-height: 1.45;
}
.ontology-see-failure {
    margin-left: 6px;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}
.ontology-failure-panel {
    display: block;
    margin-top: 6px;
    padding: 8px 10px;
    border-left: 3px solid var(--error);
    background: var(--error-muted);
    color: var(--text-primary, inherit);
}
.ontology-failure-panel[hidden] {
    display: none;
}
.ontology-failure-retry,
.ontology-failure-open-draft,
.ontology-failure-start-draft {
    margin-left: 8px;
}
.ontology-failure-reason[hidden] {
    display: none;
}
/* Vendor, HTTP code and raw error: collapsed, never in the owner sentence. */
.ontology-failure-details {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.ontology-failure-details > summary {
    cursor: pointer;
    font-weight: 600;
}
.ontology-failure-details-text {
    display: block;
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}
.ontology-version-failure {
    padding: 0 12px 8px;
}
/* GitLab #335 / NEW-1 and !287. The hosted wizard is the ontology page's
   work area. The property header above is the frame. This column is the
   conversation: current phase only, no second title bar, inferred model
   out of the column until it has entities. The transcript floor fits the
   opening greeting without a nested 900px box, and Model Configuration
   keeps its summary row (it must not shrink into an empty scrollbar). */
#ontology-wizard-host > #chat-section.ontology-wizard-hosted {
    display: block;
    position: relative;
    height: auto;
    min-height: 0;
    animation: none;
    overflow: visible;
}
#ontology-wizard-host .chat-layout {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    min-width: 0;
    overflow: visible;
}
#ontology-mode-panel.ontology-wizard-work {
    margin-top: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
}
#ontology-mode-panel.ontology-wizard-work #ontology-wizard-note {
    margin: 0 0 12px;
    max-width: 42rem;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}
#ontology-wizard-host .chat-pane {
    overflow: visible;
    background: transparent;
    min-width: 0;
    height: auto;
    max-height: none;
    min-height: min-content;
}
#ontology-wizard-host .chat-header {
    align-items: stretch;
    gap: 8px;
    padding: 0 0 8px;
    border-bottom: 0;
    background: transparent;
}
#ontology-wizard-host .chat-header-info,
#ontology-wizard-host .phases-label,
#ontology-wizard-host .wizard-phase-strip .phase-item:not(.phase-current) {
    display: none;
}
#ontology-wizard-host .wizard-phase-strip.phases-section {
    flex: 0 0 auto;
    width: 100%;
    max-height: none;
    margin-top: 0;
    padding: 0;
    overflow: visible;
}
#ontology-wizard-host .wizard-phase-strip .phase-item.phase-current {
    padding: 0;
    background: transparent;
}
#ontology-wizard-host .model-config-panel.chat-tooling {
    order: 4;
    flex: 0 0 auto;
    min-height: 2.75rem;
    max-height: none;
    overflow: visible;
}
#ontology-wizard-host .model-config-panel.chat-tooling[open] .model-config-body {
    max-height: 9rem;
    overflow: auto;
}
#ontology-wizard-host .message-list {
    order: 2;
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    min-height: 10rem;
    overflow: visible;
}
#ontology-wizard-host .chat-input-area {
    order: 3;
    padding: 12px 0 0;
    border-top: 0;
    background: transparent;
}
/* Saved Configurations stay in the ontology page scroll. An inner
   max-height plus flex-shrink clipped the heading and ate the wheel. */
#ontology-wizard-host #wizard-snapshots-section {
    order: 5;
    flex: 0 0 auto;
    height: auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
}
#ontology-wizard-host .diagram-pane {
    display: none;
    border-left: 0;
    border-top: 1px solid var(--border);
    min-height: 0;
    max-height: 16rem;
}
#ontology-wizard-host .diagram-pane.diagram-has-content {
    display: flex;
}
/* No internal "Inferred Model" chrome on the hosted wizard (cc35297 recheck):
   the entities speak for themselves under the conversation. */
#ontology-wizard-host .diagram-header {
    display: none;
}
#ontology-wizard-host .diagram-pane.diagram-has-content .diagram-container {
    min-height: 10rem;
    flex: 1 1 auto;
}
#ontology-wizard-host .chat-input-wrapper {
    flex-wrap: wrap;
}
/* Chrome paints a textarea placeholder on one line and clips it. The
   mirror wraps in the same grid cell; the native placeholder stays for
   assistive tech and is not painted. */
#ontology-wizard-host .chat-input-field {
    display: grid;
    flex: 1 1 100%;
    min-width: 0;
}
#ontology-wizard-host .chat-input,
#ontology-wizard-host .chat-input-mirror {
    grid-area: 1 / 1;
}
#ontology-wizard-host .chat-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    min-height: 4.5em;
}
#ontology-wizard-host .chat-input::placeholder {
    color: transparent;
    white-space: normal;
}
#ontology-wizard-host .chat-input-mirror {
    margin: 0;
    padding: 8px 0;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.5;
    white-space: normal;
    pointer-events: none;
    align-self: start;
}
#ontology-wizard-host .chat-input:not(:placeholder-shown) + .chat-input-mirror {
    visibility: hidden;
}

/* Property home — GitLab !219 !220 !235 !282 !284 !252. Fits at 1280 CSS. */
.property-home {
    max-width: 960px;
    min-width: 0;
}
.property-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}
.property-home-edit[hidden] {
    display: none;
}
.property-home-edit {
    margin: 8px 0 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
}
ul.property-home-domains,
.property-home-versions {
    margin: 8px 0 12px;
    padding-left: 18px;
}
ul.property-home-domains li {
    margin-bottom: 6px;
}
ul.property-home-domains li[data-just-added="true"] {
    font-weight: 650;
}
.property-domain-confirm {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--success, #22c55e);
    background: var(--success-muted, rgba(34, 197, 94, 0.15));
    color: var(--success, #22c55e);
    font-weight: 600;
}
.property-domain-confirm[hidden] {
    display: none;
}
.property-remove-guard {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    max-width: 36rem;
}
.property-remove-guard summary {
    cursor: pointer;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.property-domain-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.property-domain-overlay.is-open {
    display: flex;
}
.property-domain-overlay .modal {
    width: min(440px, 100%);
}
.property-domain-overlay .form-input {
    margin-bottom: 12px;
}
.portfolio-property-card .portfolio-actions {
    min-width: 0;
}

/* Result (lead + It works card) sits with the Graph/List result, not the shared header (tip H1/H2). */
.ontology-result {
    grid-column: 1 / -1;
    min-width: 0;
}
.ontology-result:empty {
    display: none;
}
.ontology-live-draft-line a {
    margin-left: 4px;
}
.ontology-loading-note {
    margin: 8px 0;
}

/* Non-production deploy chip (Staging). Neutral, never the green Production chip. */
.portfolio-badge-environment {
    background: transparent;
    color: var(--text-secondary, #cbd5e1);
    border: 1px solid currentColor;
}

/* The hidden attribute loses to any rule that sets display (.btn is
   inline-flex, .ontology-graph-actions is flex). Live v2 kept showing a
   greyed canvas Publish and the Quality tab kept the job box because
   el.hidden = true was overridden (tip2 R1). */
.btn[hidden],
#ontology-graph-actions[hidden],
#ontology-graph-job[hidden],
#ontology-graph-status[hidden],
#ontology-graph-publish-path[hidden],
#ontology-graph-assign[hidden],
#ontology-breaks[hidden],
#ontology-side-panel[hidden] {
    display: none !important;
}
.ontology-quality-question {
    display: block;
    color: var(--text-primary);
}
.ontology-quality-status {
    display: block;
}
.ontology-open-layout.is-quality {
    grid-template-columns: minmax(0, 1fr);
}
.ontology-quality-row.is-focused {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    background: var(--accent-muted);
    border-radius: var(--radius);
}

/* tip6 item 3: the open-page title stays on one line at 1280. The full
   identity is on the line below and in the title attribute. */
.ontology-open-title-row { flex-wrap: nowrap; min-width: 0; }
.ontology-open-heading { max-width: 100%; }
#ontology-open-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* tip7 item 1: the Quiet / Broken sentence is on the one top status line
   (the In use box no longer repeats it), so the top line carries its look. */
#tracking-live-status[data-evidence] {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    max-width: 72ch;
}
#tracking-live-status[data-evidence="quiet"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
#tracking-live-status[data-evidence="broken"] {
    background: var(--warning-muted);
    color: var(--warning);
}

/* tip8 item 2: the Draft card says a draft that matches live is not counted. */
.welcome-metric .welcome-metric-help {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
}
/* One plain line under a data state that needs a why (cc35297 recheck). */
.ontology-materialize-why {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

/* #470: a pill with no words is never shown (e.g. the title pill on the cross-business screen). */
.ontology-badge:empty {
    display: none;
}
