/* Valiss AI Visibility Audit — design system
 *
 * Editorial / paper aesthetic: warm cream backgrounds, pure-white cards,
 * deep forest green brand, matte sage accent, Playfair Display serif for
 * the wordmark and main headings, Inter for body and UI.
 *
 * Brand colours pulled from the Valiss logo:
 *   Deep forest (#143E2D)  — logo, primary headings, decorative stripes
 *   Matte sage  (#2D7A5C)  — buttons, charts, score positives, links
 *   Cream paper (#FAF8F2)  — page background
 */

:root {
    /* Surfaces */
    --bg:        #FAF8F2;
    --surface-1: #FFFFFF;
    --surface-2: #F4F1E8;
    --surface-3: #EAE6D9;
    --line:      #E0DCD0;
    --line-soft: #EDE9DC;

    /* Text — readable on the paper background */
    --text:        #143E2D;   /* deep brand green for headings */
    --text-body:   #1F2A24;   /* near-black for body */
    --text-muted:  #5A6B5F;
    --text-dim:    #8A968F;

    /* Brand + accent */
    --brand:        #143E2D;
    --brand-tint:   rgba(20, 62, 45, 0.06);
    --accent:        #2D7A5C;
    --accent-strong: #3A8A6A;
    --accent-soft:   rgba(45, 122, 92, 0.10);

    /* Status (used sparingly) */
    --warn:      #B58A4B;
    --warn-soft: rgba(181, 138, 75, 0.12);
    --bad:       #B85F5F;
    --bad-soft:  rgba(184, 95, 95, 0.10);

    /* Effects */
    --shadow:      0 18px 40px rgba(20, 62, 45, 0.10);
    --shadow-soft: 0 4px 14px rgba(20, 62, 45, 0.06);

    /* Type families */
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Playfair Display', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    color: var(--text-body);
    background: var(--bg);
    line-height: 1.6;
    font-feature-settings: "tnum" 1, "ss01" 1;
}

h1, h2, h3, h4 {
    color: var(--text);
    margin: 0 0 0.4em;
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.01em;
}
h1 { font-size: 2.1rem; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }
.muted { color: var(--text-muted); font-size: 0.92rem; }
.lead  { color: var(--text-muted); font-size: 1.06rem; line-height: 1.65; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s ease; }
a:hover { color: var(--brand); border-bottom-color: var(--accent); }

.hidden { display: none !important; }

/* ============== login page ============== */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 20%, rgba(45, 122, 92, 0.06), transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(20, 62, 45, 0.06), transparent 60%),
        var(--bg);
}
.login-shell {
    text-align: center;
    padding: 32px 24px;
    width: 100%;
    max-width: 440px;
}
.login-card {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 44px 40px 36px;
    box-shadow: var(--shadow);
}
.login-mark {
    width: 72px; height: 72px;
    margin: 0 auto 18px;
    border-radius: 16px;
    background: var(--brand);
    color: var(--bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 40px;
    line-height: 1;
}
.login-mark .dot { color: var(--accent-strong); margin-left: 1px; }
.login-wordmark {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 2.6rem;
    color: var(--brand);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}
.login-tag {
    color: var(--text-muted);
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0 0 28px;
}
.login-error {
    background: var(--bad-soft);
    color: var(--bad);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 18px;
    text-align: left;
}
.login-form {
    display: flex; flex-direction: column; gap: 14px;
    text-align: left;
    margin-top: 12px;
}
.login-submit {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    font-size: 0.95rem;
}
.login-foot {
    color: var(--text-dim);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 28px;
}

/* ============== topbar ============== */

.topbar {
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    color: var(--text);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    display: flex; align-items: center; gap: 14px;
}
.brand-mark {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 22px;
    line-height: 1;
}
.brand-mark .v { transform: translate(0, -1px); }
.brand-mark .dot { color: var(--accent-strong); margin-left: 1px; }
.brand-name {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--brand);
    letter-spacing: -0.005em;
    line-height: 1;
}
.brand-name em {
    font-family: var(--font-sans);
    font-style: normal;
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.topbar-actions { display: flex; gap: 8px; }

/* ============== buttons ============== */

.btn {
    border: 1px solid transparent;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--brand);
    color: var(--bg);
    border-color: var(--brand);
}
.btn-primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    box-shadow: 0 8px 22px rgba(20, 62, 45, 0.22);
}
.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}
.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--surface-3);
}
.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}
.btn-close:hover { color: var(--text); }

/* ============== layout ============== */

.container {
    max-width: 1180px;
    margin: 36px auto;
    padding: 0 32px 80px;
}
.panel {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
}
.footer {
    color: var(--text-dim);
    text-align: center;
    padding: 32px 20px;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.footer .dot { color: var(--accent); margin: 0 8px; }

/* ============== form ============== */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-row-wide { grid-column: 1 / -1; }
.form-row span {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.form-row em {
    color: var(--text-dim);
    font-style: normal;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
}
.form-row input, .form-row select {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.95rem;
    background: var(--surface-1);
    color: var(--text-body);
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235A6B5F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.form-row input::placeholder { color: var(--text-dim); }
.form-row input:focus, .form-row select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

/* ============== loading overlay ============== */

.loading {
    position: fixed; inset: 0;
    background: rgba(20, 62, 45, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.loading-card {
    background: var(--surface-1);
    border: 1px solid var(--line);
    padding: 36px 40px;
    border-radius: 16px;
    text-align: center;
    width: 380px;
    box-shadow: var(--shadow);
}
.loading-card h2 { margin-bottom: 6px; }
.loading-card p { color: var(--text-muted); }
.spinner {
    width: 48px; height: 48px;
    border: 3px solid var(--surface-3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loading-steps {
    text-align: left;
    margin: 18px 0 0;
    padding: 0 0 0 24px;
    color: var(--text-muted);
}
#loading-steps li.active { color: var(--accent); font-weight: 600; }
#loading-steps li.done   { color: var(--text-dim); text-decoration: line-through; }

/* ============== results header ============== */

.results-header {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 32px 36px;
    margin-bottom: 18px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 28px;
    align-items: center;
    box-shadow: var(--shadow-soft);
}
.results-meta h2 { margin: 0 0 4px; font-size: 1.85rem; }
.results-meta a { color: var(--text-muted); font-size: 0.92rem; word-break: break-all; }
.results-meta a:hover { color: var(--accent); }
.result-industry {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px;
}
.result-industry .chip {
    background: var(--surface-2);
    color: var(--text);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--line);
}
.results-radar { display: flex; align-items: center; justify-content: center; }
.results-radar svg { display: block; }
.results-score { display: flex; align-items: center; gap: 16px; }
.score-text { line-height: 1.2; }
.grade {
    font-family: var(--font-serif);
    font-size: 3rem; font-weight: 700;
    color: var(--brand);
    letter-spacing: -0.03em;
}
#score-arc { transition: stroke-dashoffset 1s ease; }

/* ============== AI strategic reading ============== */

.commentary {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 0 0 18px;
    box-shadow: var(--shadow-soft);
}
.commentary-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}
.commentary p {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    line-height: 1.65;
    color: var(--text-body);
    margin: 0 0 12px;
}
.commentary p:last-child { margin-bottom: 0; }

/* ============== pillars ============== */

.pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    grid-auto-rows: min-content;
    align-items: start;
    gap: 16px;
    margin-bottom: 24px;
}
.pillar-card {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px 24px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    align-self: start;
    box-shadow: var(--shadow-soft);
}
.pillar-card:hover { border-color: var(--surface-3); }
.pillar-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    cursor: pointer;
    user-select: none;
}
.pillar-caret {
    width: 20px; height: 20px;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.15s ease;
    flex-shrink: 0;
}
.pillar-card.expanded .pillar-caret { transform: rotate(180deg); color: var(--accent); }
.pillar-num {
    background: var(--brand);
    color: var(--bg);
    width: 28px; height: 28px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-serif);
    font-weight: 600; font-size: 0.95rem;
}
.pillar-title { flex: 1; font-weight: 600; color: var(--text); font-size: 1rem; font-family: var(--font-serif); }
.pillar-score {
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}
.bar {
    margin-top: 12px;
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.6s ease;
    border-radius: 999px;
}
.bar-fill.warn { background: var(--warn); }
.bar-fill.poor { background: var(--bad); }

.pillar-checks {
    display: none;
    margin-top: 18px; padding-top: 18px;
    border-top: 1px solid var(--line);
}
.pillar-card.expanded .pillar-checks { display: block; }

.check { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.check:last-child { border-bottom: none; }
.check-head {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    margin-bottom: 8px;
}
.check-name { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.check-score {
    background: var(--surface-2); color: var(--text);
    padding: 2px 10px; border-radius: 999px;
    font-size: 0.82rem; font-weight: 600;
    border: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}
.check-score-na {
    background: transparent; color: var(--text-dim);
    border-color: var(--line);
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}
.check.check-na .check-name { color: var(--text-muted); }
.check.check-na .check-list { color: var(--text-dim); }
.check-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-muted); font-size: 0.9rem; }
.check-list li { margin-bottom: 4px; }
.check-recs {
    margin-top: 10px;
    padding: 12px 14px;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    font-size: 0.9rem;
}
.check-recs strong { color: var(--text); display: block; margin-bottom: 6px; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; }
.check-recs ul { margin: 0; padding-left: 18px; color: var(--text-muted); }

/* ============== competitive comparison ============== */

.sub-h {
    color: var(--text); font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin: 26px 0 14px;
    font-weight: 600;
    font-family: var(--font-sans);
}
.scoreboard { display: flex; flex-direction: column; gap: 10px; }
.scoreboard-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 2fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-1);
}
.scoreboard-client {
    border-color: var(--accent);
    background: linear-gradient(90deg, var(--accent-soft), transparent 65%);
}
.scoreboard-competitor { border-color: var(--surface-3); }
.sb-name {
    display: flex; align-items: center; gap: 10px;
    font-weight: 600; color: var(--text);
    min-width: 0;
}
.sb-name span:nth-child(2) {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}
.scoreboard-client .sb-dot { background: var(--accent); }
.scoreboard-competitor .sb-dot { background: var(--warn); }
.sb-kind {
    font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-dim); font-weight: 700;
    background: var(--surface-2); padding: 2px 8px; border-radius: 999px;
}
.sb-bar {
    height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
}
.sb-bar-fill {
    height: 100%; background: var(--text-dim);
    transition: width 0.6s ease;
    border-radius: 999px;
}
.scoreboard-client .sb-bar-fill { background: var(--accent); }
.scoreboard-competitor .sb-bar-fill { background: var(--warn); }
.sb-stats {
    font-size: 0.85rem; color: var(--text-muted);
    display: flex; gap: 14px; flex-wrap: wrap;
    justify-content: flex-end;
    font-variant-numeric: tabular-nums;
}
.sb-stats strong { color: var(--text); }

.others-section { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.others-label { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 8px; font-weight: 600; }
.others-list { display: flex; flex-wrap: wrap; gap: 6px; }
.other-pill {
    background: var(--surface-2);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line);
}

.prompt-comparisons { display: flex; flex-direction: column; gap: 14px; }
.prompt-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-1);
    padding: 20px 22px;
}
.prompt-text {
    font-style: italic;
    color: var(--text);
    font-family: var(--font-serif);
    font-weight: 500;
    margin-bottom: 14px;
    font-size: 1.05rem;
    line-height: 1.5;
}
.prompt-engines { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.prompt-engine {
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 10px;
    padding: 14px 16px;
}
.prompt-engine-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.prompt-client-pos { font-size: 0.82rem; color: var(--accent); font-weight: 600; }
.prompt-client-missing { color: var(--text-dim); }

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line-soft);
}
.rank:last-child { border-bottom: none; }
.rank-num {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--surface-1); color: var(--text-muted);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.78rem;
    flex-shrink: 0;
    border: 1px solid var(--line);
}
.rank-name { color: var(--text); font-weight: 500; flex: 1; }
.rank-badge {
    font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.1em; padding: 2px 7px; border-radius: 999px;
    font-weight: 700;
}
.rank-badge-client { background: var(--accent); color: var(--bg); }
.rank-badge-competitor { background: var(--warn); color: #3F2F0F; }
.rank-client {
    background: var(--accent-soft); border-radius: 8px; margin: 0 -8px; padding: 6px 8px;
}
.rank-client .rank-num { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.rank-client .rank-name { color: var(--text); font-weight: 600; }
.rank-competitor .rank-num { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }

/* ============== LLM responses ============== */

.engine-tabs { display: flex; gap: 6px; margin: 14px 0 18px; flex-wrap: wrap; }
.engine-tab {
    background: var(--surface-2); color: var(--text-muted);
    border: 1px solid var(--line);
    padding: 8px 14px; border-radius: 999px;
    cursor: pointer; font-size: 0.85rem; font-weight: 600;
    font-family: inherit;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.engine-tab:hover { color: var(--text); }
.engine-tab.active {
    background: var(--brand);
    color: var(--bg);
    border-color: var(--brand);
}

.llm-card {
    border: 1px solid var(--line); border-radius: 12px;
    padding: 18px 20px; margin-bottom: 14px;
    background: var(--surface-1);
}
.llm-card .meta {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    color: var(--text-muted); font-size: 0.82rem; margin-bottom: 8px;
}
.badge {
    display: inline-block;
    padding: 2px 9px; border-radius: 999px;
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em;
}
.badge.mention   { background: var(--accent-soft); color: var(--accent); }
.badge.no-mention { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line); }
.badge.error     { background: var(--bad-soft); color: var(--bad); }
.badge.positive  { background: var(--accent-soft); color: var(--accent); }
.badge.negative  { background: var(--bad-soft); color: var(--bad); }
.badge.neutral   { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--line); }
.badge.engine    { background: var(--brand); color: var(--bg); }
.badge.category  { background: var(--warn-soft); color: var(--warn); }

.llm-prompt {
    font-style: italic; color: var(--text);
    font-family: var(--font-serif);
    margin: 4px 0 8px;
    font-size: 1rem;
}
.llm-text {
    background: var(--surface-2);
    border-radius: 8px;
    padding: 14px 16px;
    white-space: pre-wrap;
    color: var(--text-body);
    font-size: 0.92rem;
    line-height: 1.6;
    border: 1px solid var(--line);
}
.llm-text.error-text { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* ============== action plan ============== */

/* ============== competitor scorecard ============== */

.comp-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.comp-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) 3fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-1);
}
.comp-row-client {
    border-color: var(--accent);
    background: linear-gradient(90deg, var(--accent-soft), transparent 65%);
}
.comp-row-err {
    grid-template-columns: minmax(220px, 1fr) 1fr;
    border-style: dashed;
    color: var(--text-muted);
}
.comp-name-block { min-width: 0; }
.comp-name {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--text);
    font-size: 1.05rem;
    overflow: hidden; text-overflow: ellipsis;
}
.comp-kind {
    font-family: var(--font-sans);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-left: 8px;
    background: var(--surface-2);
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--line);
}
.comp-row-client .comp-kind { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.comp-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.comp-bar {
    height: 10px; background: var(--surface-2);
    border-radius: 999px; overflow: hidden;
}
.comp-bar-fill {
    height: 100%; background: var(--text-dim);
    border-radius: 999px;
    transition: width 0.6s ease;
}
.comp-row-client .comp-bar-fill { background: var(--accent); }
.comp-score {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
}
.comp-pct {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--text);
}
.comp-err { color: var(--text-muted); font-size: 0.88rem; }

/* ============== content gaps ============== */

.gap-card {
    border: 1px solid var(--line);
    border-left: 3px solid var(--bad);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 12px;
    background: var(--surface-1);
}
.gap-head {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 10px;
}
.gap-cat {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    padding: 3px 10px; border-radius: 999px;
}
.gap-cat-brand { background: var(--bad-soft); color: var(--bad); }
.gap-cat-category { background: var(--warn-soft); color: var(--warn); }
.gap-prompt {
    font-style: italic; color: var(--text);
    font-family: var(--font-serif);
    margin-bottom: 8px; font-size: 1rem;
    line-height: 1.5;
}
.gap-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.gap-reason {
    background: var(--surface-2); color: var(--text-muted);
    padding: 2px 9px; border-radius: 999px;
    font-size: 0.78rem; border: 1px solid var(--line);
}
.gap-preview {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
    background: var(--surface-2);
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--line);
}
.gap-preview-label {
    font-weight: 700;
    color: var(--text);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-right: 6px;
}

/* ============== citation map ============== */

.citations-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    margin-top: 14px;
}
.cite-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-1);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.cite-row:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
}
.cite-favicon {
    width: 18px; height: 18px; flex-shrink: 0; border-radius: 3px;
}
.cite-domain {
    flex: 1; min-width: 0;
    font-weight: 600; font-size: 0.92rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cite-count {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.cite-engines { display: flex; gap: 4px; }
.cite-engine {
    background: var(--brand);
    color: var(--bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* ============== review sentiment heatmap ============== */

.reviews-sw {
    display: flex; flex-direction: column; gap: 8px;
    margin: 14px 0 22px;
}
.sw-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sw-label {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--text-muted);
    min-width: 90px;
}
.sw-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 4px;
}
.sw-strength { background: var(--accent-soft); color: var(--accent); }
.sw-weakness { background: var(--bad-soft); color: var(--bad); }

.heatmap {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 8px;
    font-size: 0.92rem;
}
.heatmap th {
    background: var(--surface-2);
    padding: 10px 12px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--line);
}
.heatmap th.hm-cell-col { text-align: center; width: 90px; }
.heatmap th.hm-quote-col { width: 35%; }
.heatmap td {
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
.hm-theme {
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-serif);
}
.hm-cell {
    text-align: center;
    width: 90px;
    background: var(--surface-1);
}
.hm-cell-active {
    color: white;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    border-radius: 6px;
    position: relative;
}
.hm-cell-active::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 6px;
    background: var(--cell-bg, var(--accent));
    opacity: calc(0.30 + var(--intensity, 0.5) * 0.70);
    pointer-events: none;
}
.hm-cell-active .hm-freq {
    position: relative;
    z-index: 1;
    color: white;
    font-size: 0.92rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.hm-positive-cell.hm-cell-active { --cell-bg: var(--accent); }
.hm-neutral-cell.hm-cell-active  { --cell-bg: var(--text-muted); }
.hm-negative-cell.hm-cell-active { --cell-bg: var(--bad); }

.hm-quote {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ============== visibility lift simulator ============== */

.lift-track-wrap {
    padding: 36px 24px 90px;
    margin-top: 16px;
}
.lift-track {
    position: relative;
    height: 6px;
    background: linear-gradient(90deg, var(--surface-3), var(--surface-2));
    border-radius: 999px;
    margin: 0 16px;
}
.lift-stage {
    position: absolute;
    transform: translateX(-50%);
    top: 0;
}
.lift-marker {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--stage-color, var(--accent));
    border: 3px solid var(--surface-1);
    box-shadow: 0 0 0 1px var(--stage-color, var(--accent));
    margin-top: -6px;
}
.lift-label {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
}
.lift-label-name {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--stage-color, var(--accent));
    margin-bottom: 6px;
}
.lift-label-pct {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}
.lift-label-score {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.lift-delta {
    color: var(--accent);
    font-weight: 700;
    margin-left: 4px;
}

.tier-distribution { margin-bottom: 22px; }
.dist-bar {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.dist-seg {
    color: var(--bg);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
    transition: width 0.6s ease;
    min-width: 24px;
    font-variant-numeric: tabular-nums;
}
.dist-seg span { padding: 0 6px; }
.dist-legend {
    display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap;
    font-size: 0.78rem; font-weight: 600; color: var(--text);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.dist-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dist-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.tier {
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    background: var(--surface-1);
    box-shadow: var(--shadow-soft);
}
.tier.tier-scale  { border-left-color: var(--accent); }
.tier.tier-surge  { border-left-color: var(--warn); }
.tier.tier-summit { border-left-color: var(--brand); }
.tier-head {
    display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.tier-head h3 {
    margin: 0;
    letter-spacing: 0.18em;
    font-size: 0.95rem;
    text-transform: uppercase;
    font-family: var(--font-sans);
    color: var(--brand);
}
.tier-sub { color: var(--text-muted); font-size: 0.88rem; }
.tier ul { margin: 0; padding-left: 20px; color: var(--text-body); }
.tier li { margin-bottom: 8px; }
.tier li::marker { color: var(--text-dim); }
.tier .impact { color: var(--text-dim); font-size: 0.78rem; margin-left: 8px; }

/* ============== history & health side panels ============== */

.history {
    position: fixed;
    top: 0; right: 0;
    width: 380px;
    height: 100vh;
    background: var(--surface-1);
    border-left: 1px solid var(--line);
    box-shadow: -10px 0 30px rgba(20, 62, 45, 0.10);
    z-index: 80;
    overflow-y: auto;
}
.history header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0;
    background: var(--surface-1);
}
.history h3 { margin: 0; font-size: 1.15rem; }
.history ul { list-style: none; margin: 0; padding: 0; }
.history li {
    padding: 16px 24px;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    transition: background 0.1s ease;
}
.history li:hover { background: var(--surface-2); }
.history .h-client { font-family: var(--font-serif); font-weight: 600; color: var(--text); font-size: 1.05rem; }
.history .h-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.history .h-score {
    display: inline-block;
    background: var(--surface-2); color: var(--text);
    padding: 2px 10px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 700; margin-top: 4px;
    border: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}
#health-body { padding: 20px 24px; }
.health-row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.health-row:last-child { border-bottom: none; }
.health-row .name { font-weight: 600; color: var(--text); font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; }
.health-row .ok { color: var(--accent); font-weight: 600; }
.health-row .err { color: var(--bad); white-space: pre-wrap; font-size: 0.85rem; margin-top: 4px; }

/* ============== responsive ============== */

@media (max-width: 800px) {
    .form-grid { grid-template-columns: 1fr; }
    .results-header { grid-template-columns: 1fr; text-align: center; }
    .results-meta a { word-break: break-all; }
    .results-radar { justify-content: center; }
    .results-score { justify-content: center; }
    .history { width: 100%; }
    .topbar { padding: 14px 20px; }
    .container { padding: 0 20px 60px; }
}

::selection { background: var(--accent); color: var(--bg); }
