/* Peterman V4.1 — Clean Frontend Styles */
/* Almost Magic Tech Lab Design System */

:root {
    --midnight: #0A0E14;
    --surface: #111620;
    --card: #171D2A;
    --border: #232B3A;
    --gold: #C9944A;
    --gold-hover: #D4A55E;
    --gold-dim: rgba(201, 148, 74, 0.15);
    --text: #E8E6E3;
    --text-muted: #7A8299;
    --success: #4ADE80;
    --warning: #FBBF24;
    --error: #EF4444;
    --info: #60A5FA;
    --font: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

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

img,
svg,
pre,
code,
input,
button {
    max-width: 100%;
}

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--midnight);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

.app-container {
    height: 100vh;
    position: relative;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr) 310px;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

/* Header */
.header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-width: 0;
}

.header-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.logo-icon {
    width: 40px; height: 40px;
    background: var(--gold);
    color: var(--midnight);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px;
}

.brand-seal {
    background: rgba(201, 148, 74, 0.08);
    border: 1px solid rgba(201, 148, 74, 0.34);
    padding: 6px;
}

.brand-seal img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.brand-lockup {
    display: block;
    width: 92px;
    height: 46px;
    object-fit: contain;
    object-position: left center;
}

.brand-tagline { font-size: 11px; color: var(--text-muted); overflow-wrap: anywhere; }

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

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted);
}
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--error); }
.status-dot.degraded { background: var(--warning); }

/* Navigation */
.sidebar {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: rgba(17, 22, 32, 0.96);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    min-width: 0;
    max-width: none;
}

.sidebar a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: var(--radius);
    white-space: normal;
    display: block;
}

.sidebar a:hover {
    color: var(--text);
    background: var(--card);
}

.helper-proof {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.nav-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(10, 14, 20, 0.54);
    overflow: hidden;
}

.nav-group summary {
    list-style: none;
    cursor: pointer;
    padding: 10px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: "+"; float: right; color: var(--text-muted); }
.nav-group[open] summary::after { content: "-"; }
.nav-group a { border-top: 1px solid var(--border); }

/* Main */
.main {
    grid-column: 2;
    grid-row: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
    min-width: 0;
}

.workspace-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.workspace-tab {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.workspace-tab.active {
    border-color: var(--gold);
    background: var(--gold-dim);
    color: var(--text);
}

.workspace-hidden { display: none !important; }

.context-rail {
    grid-column: 3;
    grid-row: 2;
    border-left: 1px solid var(--border);
    background: rgba(17, 22, 32, 0.96);
    padding: 12px;
    overflow-y: auto;
}

.rail-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(10, 14, 20, 0.54);
    margin-bottom: 10px;
    overflow: hidden;
}

.rail-box[hidden] { display: none; }

.rail-box summary {
    list-style: none;
    cursor: pointer;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    padding: 10px;
}

.rail-box summary::-webkit-details-marker { display: none; }
.rail-box summary::after { content: "+"; float: right; color: var(--text-muted); }
.rail-box[open] summary::after { content: "-"; }

.rail-box p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    padding: 0 10px 10px;
}

/* Sections */
.section {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 18px;
    min-width: 0;
}

.narrative-card {
    padding: 22px;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.narrative-card h2,
.academy h2,
.evidence-vault h2 {
    font-size: 22px;
    line-height: 1.25;
    margin: 6px 0 10px;
    overflow-wrap: anywhere;
}

.narrative-card p,
.lab-card p,
.academy p,
.evidence-vault p,
.floating-chat p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
}

.eyebrow {
    color: var(--gold);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: uppercase;
}

.pulse-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.pulse-links a,
.lab-card a {
    color: var(--gold);
    font-size: 12px;
    text-decoration: none;
}

.lab-map,
.academy-grid,
.receipt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.lab-card,
.academy article,
.receipt-grid article {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-width: 0;
}

.lab-card span {
    color: var(--gold);
    font-size: 11px;
    font-weight: 600;
}

.lab-card h3,
.academy h3,
.receipt-grid h3 {
    font-size: 15px;
    margin: 7px 0;
}

.academy,
.evidence-vault,
.mani100-gates {
    margin-bottom: 28px;
}

.academy-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.academy-links a {
    color: var(--gold);
    font-size: 12px;
    text-decoration: none;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.link-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.section-header-row a,
.gate-card a {
    color: var(--gold);
    font-size: 12px;
    text-decoration: none;
}

.link-note {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.gate-summary {
    color: var(--muted);
    font-size: 13px;
    margin: 10px 0 14px;
}

.gate-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.compact-list {
    max-height: 560px;
    overflow: auto;
    padding-right: 4px;
}

.gate-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.gate-card h3 {
    font-size: 14px;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}

.gate-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    margin: 6px 0;
    overflow-wrap: anywhere;
}

.gate-status {
    display: inline-block;
    color: var(--gold);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.workbench-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.mini-button {
    border: 1px solid rgba(201, 148, 74, 0.36);
    background: rgba(17, 22, 32, 0.86);
    color: var(--text);
    border-radius: var(--radius);
    padding: 8px 11px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.mini-button:hover,
.mini-button:focus {
    border-color: var(--gold);
    color: var(--gold);
    outline: none;
}

.workbench-row h3 {
    line-height: 1.35;
}

.model-routing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.model-tier-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.model-tier-card h3 {
    font-size: 15px;
    margin: 6px 0 8px;
}

.model-tier-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    margin: 6px 0;
}

.report-preview {
    white-space: pre-wrap;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    max-height: 260px;
    overflow: auto;
}

.receipt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.receipt-actions a {
    color: var(--gold);
    font-size: 12px;
    text-decoration: none;
}

.floating-chat {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: min(340px, calc(100vw - 36px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
    z-index: 20;
}

.chat-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--border);
}

.chat-tab {
    padding: 10px 8px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 12px;
    cursor: pointer;
}

.chat-tab.active {
    color: var(--midnight);
    background: var(--gold);
}

.chat-panel {
    display: none;
    padding: 14px;
}

.chat-panel.active {
    display: block;
}

@media (max-width: 640px) {
    html,
    body,
    .app-container,
    .main {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-container {
        width: min(100vw, 390px);
        max-width: 390px;
    }

    .header {
        flex-wrap: wrap;
        gap: 10px;
        width: min(100vw, 390px);
        max-width: 390px;
    }

    .header-status {
        margin-left: auto;
    }

    .main {
        padding: 16px;
        padding-bottom: 190px;
    }

    .section {
        width: 100%;
        max-width: min(calc(100vw - 32px), 358px);
        min-width: 0;
    }

    .sidebar {
        padding: 8px 16px;
    }

    .narrative-card {
        padding: 18px;
    }

    .narrative-card,
    .lab-card,
    .academy article,
    .receipt-grid article {
        overflow-wrap: anywhere;
    }

    .narrative-card h2,
    .academy h2,
    .evidence-vault h2 {
        font-size: 22px;
        word-break: break-word;
    }

    .workspace-tabs {
        flex-wrap: wrap;
        overflow-x: hidden;
        max-width: 100%;
    }

    .workspace-tab {
        flex: 1 1 calc(50% - 8px);
        white-space: normal;
        max-width: min(calc(100vw - 32px), 358px);
    }

    .lab-map,
    .academy-grid,
    .receipt-grid,
    .score-cards,
    .overview-grid {
        grid-template-columns: 1fr;
    }

    .floating-chat {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-width: min(calc(100vw - 24px), 366px);
        overflow: hidden;
    }

    .chat-tabs {
        min-width: 0;
    }

    .chat-tab {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .chat-panel {
        padding: 10px 12px;
    }
}

/* Domain Input */
.domain-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 200px);
}

.domain-input-container { text-align: center; }

.domain-input-container h1 {
    font-size: 32px; font-weight: 600; margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted); font-size: 15px; margin-bottom: 32px;
    max-width: 500px; margin-left: auto; margin-right: auto;
}

.domain-form { max-width: 600px; margin: 0 auto; }

.input-wrapper {
    display: flex; gap: 12px; margin-bottom: 16px;
}

.input-wrapper input {
    flex: 1;
    padding: 14px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
}

.input-wrapper input:focus {
    outline: none; border-color: var(--gold);
}

.checkbox-label {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 13px; color: var(--text-muted);
    cursor: pointer;
}

.checkbox-label input { accent-color: var(--gold); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 12px 24px;
    border: none; border-radius: var(--radius);
    font-family: var(--font); font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
}

.btn-gold { background: var(--gold); color: var(--midnight); }
.btn-gold:hover { background: var(--gold-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-large { padding: 14px 28px; font-size: 15px; }
.btn-small { padding: 6px 12px; font-size: 12px; }

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

/* Loading */
.loading-section { text-align: center; padding: 40px 0; }

.loading-spinner {
    width: 48px; height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}

.loading-spinner.large { width: 64px; height: 64px; border-width: 4px; }

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

#loadingTitle { font-size: 24px; margin-bottom: 8px; }
#loadingSubtitle { color: var(--text-muted); margin-bottom: 40px; }

.progress-steps {
    max-width: 400px; margin: 0 auto; text-align: left;
}

.step {
    display: flex; align-items: flex-start; gap: 16px;
    padding: 16px; margin-bottom: 8px;
    background: var(--card); border-radius: var(--radius);
    opacity: 0.5; transition: all var(--transition);
}

.step.active { opacity: 1; border-left: 3px solid var(--gold); }
.step.completed { opacity: 0.7; }

.step-icon { font-size: 24px; }

.step-name { font-weight: 500; margin-bottom: 2px; }
.step-status { font-size: 12px; color: var(--text-muted); }

/* Results */
.results-container { max-width: 1100px; margin: 0 auto; }

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

.domain-display { display: flex; flex-direction: column; gap: 4px; }
.domain-url { font-size: 28px; font-weight: 600; }
.audit-date { font-size: 13px; color: var(--text-muted); }

/* Score Circle */
.score-circle { position: relative; width: 120px; height: 120px; }
.score-circle svg { transform: rotate(-90deg); }
.score-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.score-progress {
    fill: none; stroke: var(--gold); stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283; stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease;
}

.score-value {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}

#scoreNumber { font-size: 32px; font-weight: 700; }
.score-label { font-size: 12px; color: var(--text-muted); }

/* Score Cards */
.score-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 32px;
}

.score-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}

.score-card-header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.score-card-icon { font-size: 24px; }
.score-card-score { font-size: 24px; font-weight: 700; }
.score-card-label { font-size: 12px; color: var(--text-muted); }
.score-card-detail { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.score-card-link {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(201, 148, 74, 0.08);
    color: var(--accent);
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.score-card-link:hover {
    border-color: var(--accent);
    background: rgba(201, 148, 74, 0.14);
}

/* Tabs */
.results-tabs {
    display: flex; gap: 4px;
    background: var(--surface); border-radius: var(--radius);
    padding: 4px; margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px; background: none; border: none;
    color: var(--text-muted); font-family: var(--font); font-size: 13px;
    cursor: pointer; border-radius: var(--radius);
    transition: all var(--transition); white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.active { background: var(--gold); color: var(--midnight); font-weight: 500; }

/* Tab Panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Overview Grid */
.overview-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px; margin-bottom: 32px;
}

.overview-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}

.overview-card h3 { font-size: 14px; margin-bottom: 8px; }
.mini-score { font-size: 28px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.overview-card-actions,
.overall-score-actions,
.status-drilldown-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.overall-score-actions {
    max-width: 220px;
}

.overview-card-actions .score-card-link,
.overall-score-actions .score-card-link,
.status-drilldown-actions .score-card-link {
    flex: 1 1 120px;
    width: auto;
}

.status-drilldown-actions {
    margin-bottom: 20px;
}

/* Issues & Recommendations */
.issues-section, .recommendations-section {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
}

.issues-section h3 { font-size: 16px; margin-bottom: 16px; color: var(--error); }
.recommendations-section h3 { font-size: 16px; margin-bottom: 16px; color: var(--gold); }

.issues-list li, .recommendations-list li {
    padding: 8px 0; border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.issues-list li:last-child, .recommendations-list li:last-child { border-bottom: none; }

/* Meta Comparison */
.meta-comparison {
    display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
}

.meta-column h4 { font-size: 14px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.meta-column.optimised h4 { color: var(--gold); }

.meta-item { margin-bottom: 16px; }
.meta-item label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.meta-value {
    background: var(--surface); padding: 10px 12px;
    border-radius: var(--radius); font-size: 13px;
    word-break: break-word; margin-bottom: 8px;
}

/* Schema Status */
.schema-status { margin-bottom: 24px; }

.schema-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; background: var(--card); border-radius: var(--radius);
    margin-bottom: 8px;
}

.schema-icon { font-size: 20px; }
.schema-name { flex: 1; }
.schema-status { font-size: 12px; padding: 4px 8px; border-radius: 4px; }
.schema-status.present { background: rgba(74, 222, 128, 0.1); color: var(--success); }
.schema-status.missing { background: rgba(239, 68, 68, 0.1); color: var(--error); }

.schema-code { background: var(--surface); padding: 20px; border-radius: var(--radius); }
.schema-code pre { overflow-x: auto; font-size: 12px; }

/* Sitemap */
.sitemap-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

.sitemap-item {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
}

.sitemap-item label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.sitemap-status, .sitemap-value { font-size: 14px; font-weight: 500; }
.sitemap-status.present { color: var(--success); }
.sitemap-status.missing { color: var(--error); }

/* AI Scores */
.ai-scores {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

.ai-model-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
    text-align: center;
}

.model-name { font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.model-score { font-size: 28px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.ai-model-card .score-card-link { justify-content: center; }
.model-bar, .ranking-bar {
    height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.bar-fill { height: 100%; background: var(--gold); width: 0; transition: width 1s ease; }

.ai-tips, .optimization-tips { background: var(--card); border-radius: var(--radius-lg); padding: 20px; }
.ai-tips h4, .optimization-tips h4 { font-size: 14px; margin-bottom: 12px; }
.ai-tips li, .optimization-tips li {
    padding: 8px 0; font-size: 13px; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

/* LLM Rankings */
.llm-rankings { margin-bottom: 24px; }

.ranking-item {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 8px;
}

.ranking-keyword { font-weight: 500; margin-bottom: 8px; }
.ranking-score { display: flex; align-items: center; gap: 12px; }
.ranking-position { font-size: 20px; font-weight: 700; color: var(--gold); }
.ranking-bar { flex: 1; }
.ranking-drilldown-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ranking-drilldown-actions .score-card-link {
    flex: 1 1 140px;
    width: auto;
}

.live-proof-panel {
    display: grid;
    gap: 10px;
    margin: 14px 0;
}

.mini-button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

/* Content Generation */
.content-actions {
    display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
}

.generated-content { background: var(--card); border-radius: var(--radius-lg); padding: 24px; }
.draft-boundary-note {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 4px 0 14px;
}
.content-preview {
    background: var(--surface); padding: 20px; border-radius: var(--radius);
    font-size: 14px; line-height: 1.6; margin-bottom: 16px;
    max-height: 400px; overflow-y: auto;
}

/* Results Actions */
.results-actions {
    display: flex; justify-content: center; gap: 16px; margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* Toast */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px; z-index: 1000;
}

.toast {
    background: var(--card); border: 1px solid var(--border);
    border-left: 3px solid var(--gold); border-radius: var(--radius);
    padding: 12px 16px; font-size: 13px; animation: slideIn 0.3s ease;
}

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

/* Empty State */
.empty-state { color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px; }

/* Responsive */
@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-container {
        width: 100vw;
        max-width: 100vw;
        height: auto;
        min-height: 100vh;
        display: block;
        overflow-x: hidden;
    }
    .header { padding: 12px 16px; }
    .sidebar,
    .main,
    .context-rail {
        width: 100vw;
        max-width: 100vw;
        border-left: 0;
        border-right: 0;
    }
    .sidebar {
        max-height: none;
        border-bottom: 1px solid var(--border);
    }
    .main { padding: 16px; overflow-x: hidden; }
    .context-rail {
        border-top: 1px solid var(--border);
        max-width: 100%;
        overflow-x: hidden;
    }
    .brand-lockup { width: 76px; height: 38px; }
    .brand-tagline { font-size: 10px; }
    .input-wrapper { flex-direction: column; }
    .domain-input-container h1 { font-size: 24px; }
    .results-header { flex-direction: column; gap: 16px; align-items: flex-start; }
    .meta-comparison { grid-template-columns: 1fr; }
    .results-actions { flex-direction: column; }
    .model-routing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .app-container,
    .header,
    .sidebar,
    .main,
    .context-rail {
        width: min(100vw, 390px);
        max-width: 390px;
    }

    .section {
        max-width: min(calc(100vw - 32px), 358px);
    }

    .workspace-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .workspace-tab {
        width: 100%;
        max-width: 100%;
    }
}
/* Brand records use the existing workbench palette and spacing. */
#brand-records .brand-form { display: grid; gap: 0.6rem; max-width: 36rem; margin-bottom: 1.25rem; }
#brand-records input, #brand-records select { width: 100%; max-width: 36rem; padding: 0.75rem; background: #121922; color: #f1f3f5; border: 1px solid #788494; border-radius: 6px; font: inherit; box-sizing: border-box; }
#brand-records input:focus-visible, #brand-records select:focus-visible { outline: 2px solid #C9944A; outline-offset: 3px; }
#brandDetails { margin-top: 1rem; overflow-wrap: anywhere; }
@media (max-width: 768px) {
    .floating-chat { position: static; width: auto; max-width: none; margin: 16px; }
}
