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

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #232733;
    --border: #2e3345;
    --text: #e2e4ed;
    --text-muted: #8b8fa3;
    --accent: #6c8cff;
    --green: #2ea043;
    --green-bg: rgba(46, 160, 67, 0.15);
    --green-text: #56d364;
    --red: #da3633;
    --red-bg: rgba(218, 54, 51, 0.15);
    --red-text: #f85149;
    --yellow-bg: rgba(210, 153, 34, 0.12);
    --yellow-text: #e3b341;
    --blue-bg: rgba(56, 139, 253, 0.12);
    --blue-text: #58a6ff;

    --sug-del-bg: rgba(245, 158, 11, 0.18);
    --sug-del-text: #fbbf24;
    --sug-ins-bg: rgba(6, 182, 212, 0.18);
    --sug-ins-text: #22d3ee;
    --sug-notapplied-bg: rgba(245, 158, 11, 0.08);
    --sug-notapplied-border: rgba(245, 158, 11, 0.35);

    --radius: 10px;
}

/* ── Light theme ──────────────────────────────────────────── */
[data-theme="light"] {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface2: #f1f3f5;
    --border: #dce0e5;
    --text: #1a1d27;
    --text-muted: #5f6577;
    --accent: #4a6cf7;
    --green: #1a7f37;
    --green-bg: rgba(26, 127, 55, 0.08);
    --green-text: #1a7f37;
    --red: #cf222e;
    --red-bg: rgba(207, 34, 46, 0.08);
    --red-text: #cf222e;
    --yellow-bg: rgba(154, 103, 0, 0.08);
    --yellow-text: #7a5200;
    --blue-bg: rgba(9, 105, 218, 0.08);
    --blue-text: #0969da;

    --sug-del-bg: rgba(154, 103, 0, 0.1);
    --sug-del-text: #8a5e00;
    --sug-ins-bg: rgba(6, 148, 162, 0.1);
    --sug-ins-text: #0e7c86;
    --sug-notapplied-bg: rgba(154, 103, 0, 0.06);
    --sug-notapplied-border: rgba(154, 103, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* ── Theme toggle button ─────────────────────────────────── */
.theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--surface);
}

header { text-align: center; padding: 2rem 1rem 0.5rem; }
header h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.subtitle { color: var(--text-muted); margin-top: 0.3rem; font-size: 0.95rem; }

main { max-width: 1200px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }

/* Steps indicator */
.steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}
.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all 0.3s;
}
.step.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.step.done {
    color: var(--green-text);
    border-color: var(--green);
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(255,255,255,0.15);
}

/* Step panels */
.step-panel { animation: fadeIn 0.3s ease; }
.step-panel h2 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.step-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }

/* Drop zone */
.drop-zone {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    max-width: 500px;
    margin: 0 auto;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--surface2); }
.drop-zone.has-file { border-color: var(--green); border-style: solid; }
.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-label { font-weight: 600; font-size: 1.1rem; margin-bottom: 0.25rem; }
.drop-hint { color: var(--text-muted); font-size: 0.85rem; }
.file-name { margin-top: 0.75rem; font-size: 0.85rem; color: var(--green-text); word-break: break-all; }

/* Buttons */
.actions { text-align: center; margin-top: 1.5rem; display: flex; gap: 0.75rem; justify-content: center; }

button {
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 2rem;
    font-weight: 600;
    transition: background 0.2s, opacity 0.2s, filter 0.2s;
    background: var(--accent);
    color: #fff;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:not(:disabled):hover { filter: brightness(1.15); }
.btn-secondary {
    background: var(--surface2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text); }

/* Loading / Error */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.progress-wrapper {
    width: 100%;
    max-width: 420px;
}
.progress-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    justify-content: center;
}
#progressPct {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 3em;
    text-align: right;
    color: var(--accent);
}
.progress-track {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    width: 0%;
    transition: width 0.35s ease;
}
.spinner {
    width: 22px; height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
    background: var(--red-bg);
    color: var(--red-text);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Color cards (Step 2) */
.color-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}
.color-swatch {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.color-info { min-width: 0; }
.color-info .count { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.color-samples {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.color-samples .sample {
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin: 2px 4px 2px 0;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.color-meaning select {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    min-width: 180px;
}
.color-meaning select:focus { outline: none; border-color: var(--accent); }

/* Suggestion panel */
.suggestion-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.suggestion-panel h3 { font-size: 1rem; margin-bottom: 0.75rem; }

.suggestion-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.sug-stat {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border);
}
.sug-stat .num { font-weight: 700; font-size: 1.1rem; }
.sug-stat.applied { border-color: var(--green); }
.sug-stat.applied .num { color: var(--green-text); }
.sug-stat.not-applied { border-color: var(--red); }
.sug-stat.not-applied .num { color: var(--red-text); }

.suggestion-list {
    max-height: 400px;
    overflow-y: auto;
}
.sug-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0.6rem;
    align-items: start;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.83rem;
    line-height: 1.5;
}
.sug-item:last-child { border-bottom: none; }
.sug-icon { font-size: 1.1rem; text-align: center; padding-top: 2px; }
.sug-text { word-break: break-word; }
.sug-text .para-ctx { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }
.sug-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}
.sug-badge.applied { background: var(--green-bg); color: var(--green-text); }
.sug-badge.not-applied { background: var(--red-bg); color: var(--red-text); }
.sug-badge.note { background: var(--blue-bg); color: var(--blue-text); }

/* Filter tabs for suggestions */
.sug-filters {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}
.sug-filter-btn {
    background: var(--surface2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}
.sug-filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Stats bar */
.stats-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    font-size: 0.83rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.stat-chip .num { font-weight: 700; font-size: 1rem; }
.stat-chip.added .num { color: var(--green-text); }
.stat-chip.deleted .num { color: var(--red-text); }
.stat-chip.changed .num { color: var(--yellow-text); }

/* View toggle */
.view-toggle { display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: center; flex-wrap: wrap; }
.view-btn {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
}
.view-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.download-btn {
    background: var(--surface);
    color: var(--green-text);
    border: 1px solid var(--green);
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
}
.download-btn:hover { background: var(--green-bg); }
.download-btn.pdf { color: var(--blue-text); border-color: var(--blue-text); }
.download-btn.pdf:hover { background: var(--blue-bg); }

/* Diff container */
.diff-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 0 1rem 0;
}

.diff-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border);
    font-size: 0.86rem;
    line-height: 1.7;
}
.diff-row:last-child { border-bottom: none; }
.diff-cell { padding: 0.3rem 0.8rem; white-space: pre-wrap; word-break: break-word; min-height: 1.7em; }
.diff-cell.left { border-right: 1px solid var(--border); }
.diff-row.equal .diff-cell { color: var(--text-muted); }

/* Unexpected (not suggested) – red/green */
.diff-row.unexpected_delete .left { background: var(--red-bg); }
.diff-row.unexpected_insert .right { background: var(--green-bg); }
.diff-row.unexpected_change .left { background: var(--red-bg); }
.diff-row.unexpected_change .right { background: var(--green-bg); }

/* Suggested (was in colored segments) – amber/cyan */
.diff-row.suggested_delete .left { background: var(--sug-del-bg); }
.diff-row.suggested_insert .right { background: var(--sug-ins-bg); }
.diff-row.suggested_change .left { background: var(--sug-del-bg); }
.diff-row.suggested_change .right { background: var(--sug-ins-bg); }

/* Suggested but not applied – subtle amber border */
.diff-row.suggested_not_applied .diff-cell {
    border-left: 3px solid var(--sug-notapplied-border);
    background: var(--sug-notapplied-bg);
    color: var(--text-muted);
}

.inline-row {
    padding: 0.3rem 0.8rem;
    font-size: 0.86rem;
    line-height: 1.7;
    border-bottom: 1px solid var(--border);
    white-space: pre-wrap;
    word-break: break-word;
}
.inline-row:last-child { border-bottom: none; }
.inline-row.equal { color: var(--text-muted); }

.inline-row.unexpected_delete { background: var(--red-bg); }
.inline-row.unexpected_insert { background: var(--green-bg); }
.inline-row.unexpected_change-old { background: var(--red-bg); }
.inline-row.unexpected_change-new { background: var(--green-bg); }

.inline-row.suggested_delete { background: var(--sug-del-bg); }
.inline-row.suggested_insert { background: var(--sug-ins-bg); }
.inline-row.suggested_change-old { background: var(--sug-del-bg); }
.inline-row.suggested_change-new { background: var(--sug-ins-bg); }

.inline-row.suggested_not_applied {
    border-left: 3px solid var(--sug-notapplied-border);
    background: var(--sug-notapplied-bg);
    color: var(--text-muted);
}

/* Unexpected (default) word-level diffs: red / green */
.wd-delete { background: rgba(218,54,51,0.3); color: var(--red-text); text-decoration: line-through; border-radius: 3px; padding: 0 2px; }
.wd-insert { background: rgba(46,160,67,0.3); color: var(--green-text); border-radius: 3px; padding: 0 2px; }
/* Suggested word-level diffs: amber / cyan */
.wd-delete.sug { background: rgba(245,158,11,0.35); color: #fbbf24; }
.wd-insert.sug { background: rgba(6,182,212,0.35); color: #22d3ee; }
/* Suggested removal NOT applied: amber dashed underline + subtle bg */
.wd-sug-na {
    background: rgba(245,158,11,0.12);
    text-decoration: underline wavy rgba(245,158,11,0.7);
    text-underline-offset: 2px;
    border-radius: 3px;
    padding: 0 2px;
}
.cd-delete { background: rgba(218,54,51,0.45); text-decoration: line-through; border-radius: 2px; }
.cd-insert { background: rgba(46,160,67,0.45); border-radius: 2px; }
.cd-delete.sug { background: rgba(245,158,11,0.5); color: #fbbf24; }
.cd-insert.sug { background: rgba(6,182,212,0.5); color: #22d3ee; }

.ln {
    display: inline-block;
    width: 3em;
    text-align: right;
    color: var(--text-muted);
    opacity: 0.5;
    margin-right: 0.6rem;
    user-select: none;
    font-size: 0.76rem;
}

.page-sep {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.65rem 0 0.35rem;
    padding: 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.page-sep::before,
.page-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}
.page-sep span {
    white-space: nowrap;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    opacity: 1;
}

/* Diff filter panel */
.diff-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

/* Preset buttons row */
.filter-presets {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.preset-btn {
    background: var(--surface2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    border-radius: 6px;
}
.preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Filter groups */
.filter-group { margin-bottom: 0.6rem; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}
.filter-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.filter-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    transition: all 0.15s;
    user-select: none;
}
.filter-check:has(input:checked) {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(108, 140, 255, 0.08);
}
.filter-check input[type="checkbox"] {
    width: 14px; height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}
.check-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
    width: 1em;
    text-align: center;
}
.check-label { white-space: nowrap; }
.check-cnt {
    font-weight: 700;
    font-size: 0.7rem;
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 4px;
    min-width: 18px;
    text-align: center;
    margin-left: auto;
}

/* Color-coded filter checks */
.filter-check.sug-ok:has(input:checked) { border-color: var(--sug-del-text); background: rgba(245,158,11,0.12); }
.filter-check.sug-ok .check-icon { color: var(--green-text); }
.filter-check.sug-fail:has(input:checked) { border-color: #f87171; background: rgba(248,113,113,0.1); }
.filter-check.sug-fail .check-icon { color: var(--red-text); }
.filter-check.note-tag:has(input:checked) { border-color: var(--blue-text); background: var(--blue-bg); }
.filter-check.note-tag .check-icon { color: var(--blue-text); }
.filter-check.unexp-del:has(input:checked) { border-color: var(--red); background: var(--red-bg); }
.filter-check.unexp-del .check-icon { color: var(--red-text); }
.filter-check.unexp-ins:has(input:checked) { border-color: var(--green); background: var(--green-bg); }
.filter-check.unexp-ins .check-icon { color: var(--green-text); }
.filter-check.unexp-chg:has(input:checked) { border-color: var(--yellow-text); background: var(--yellow-bg); }
.filter-check.unexp-chg .check-icon { color: var(--yellow-text); }
.filter-check.eq-tag:has(input:checked) { border-color: var(--text-muted); }
.filter-check.empty-tag:has(input:checked) { border-color: #94a3b8; background: rgba(148,163,184,0.1); }
.filter-check.empty-tag .check-icon { color: #94a3b8; }
.filter-check.ws-tag:has(input:checked) { border-color: #a78bfa; background: rgba(167,139,250,0.1); }
.filter-check.ws-tag .check-icon { color: #a78bfa; }

/* Filter counter */
.filter-counter {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
}

/* Filtered out rows */
.diff-row.filtered-out, .inline-row.filtered-out { display: none !important; }

/* Category tags shown on each diff row */
.cat-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-right: 0.4rem;
    vertical-align: middle;
}
.cat-tag {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
    line-height: 1.4;
}
.cat-tag.sug { background: rgba(245,158,11,0.2); color: var(--sug-del-text); }
.cat-tag.unexp { background: var(--red-bg); color: var(--red-text); }
.cat-tag.sug-na { background: rgba(245,158,11,0.12); color: var(--sug-del-text); }
.cat-tag.note-t { background: var(--blue-bg); color: var(--blue-text); }
.cat-tag.stamp-warn {
    background: rgba(245, 158, 11, 0.2);
    color: #b45309;
    font-weight: 600;
}
[data-theme="light"] .cat-tag.stamp-warn { color: #92400e; background: rgba(245, 158, 11, 0.18); }

/* PDF generation: report wrapper */
#pdfReport { position: absolute; left: -9999px; top: 0; }

@media (max-width: 700px) {
    .diff-row { grid-template-columns: 1fr; }
    .diff-cell.left { border-right: none; border-bottom: 1px solid var(--border); }
    .color-card { grid-template-columns: 1fr; }
}

/* New compare button */
.new-compare-btn {
    background: #8b1a2b;
    color: #fff;
    border: 1px solid #8b1a2b;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    margin-left: auto;
}
.new-compare-btn:hover {
    background: #a52238;
    border-color: #a52238;
}

.export-tracker-btn {
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
}
.export-tracker-btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}
.export-tracker-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.header-link {
    color: #a5b4fc;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border: 1px solid #4338ca;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.header-link:hover {
    background: #312e81;
    color: #c7d2fe;
}
.header-link.login {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.header-link.login:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}
.header-link.logout {
    color: #fca5a5;
    border-color: #7f1d1d;
}
.header-link.logout:hover {
    background: #450a0a;
    color: #fecaca;
}
.user-menu-wrap {
    position: relative;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid #4338ca;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #c7d2fe;
    background: rgba(67, 56, 202, 0.15);
    cursor: pointer;
    transition: background 0.15s;
}
.user-chip:hover { background: rgba(67, 56, 202, 0.28); }
.user-caret {
    margin-left: 0.15rem;
    transition: transform 0.2s;
}
.user-dropdown:not(.hidden) ~ .user-chip .user-caret,
.user-menu-wrap .user-chip:focus .user-caret { transform: rotate(180deg); }
.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: 1000;
    padding: 0.4rem 0;
    animation: udFadeIn 0.15s ease;
}
@keyframes udFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.user-dropdown.hidden { display: none; }
.ud-item {
    display: block;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.12s;
}
.ud-item:hover { background: rgba(99,102,241,0.08); }
.ud-divider {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0;
}
.ud-logout { color: #ef4444; }
.ud-logout:hover { background: rgba(239,68,68,0.08); }
.user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

/* Filled fields (template mode) */
.filled-fields-card {
    background: #2a2416;
    border: 1px solid #6b5620;
    border-left: 4px solid #e3b341;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 0 1rem 0;
    color: #f1e4b7;
}
.filled-fields-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: #f7d270;
}
.filled-fields-card .hint {
    font-size: 0.8rem;
    font-weight: normal;
    color: #d4b766;
    margin-left: 0.5rem;
}
.filled-fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    table-layout: fixed;
}
.filled-fields-table th,
.filled-fields-table td {
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid #4a3d1f;
}
.filled-fields-table th {
    color: #f7d270;
    font-weight: 600;
    width: 30%;
}
.filled-fields-table td {
    color: #fff4cf;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 0;
}
.filled-fields-table tbody tr:last-child td {
    border-bottom: none;
}

/* Unfilled fields (template mode) */
.unfilled-fields-card {
    background: #2a1d1d;
    border: 1px solid #6b3a3a;
    border-left: 4px solid #b84a4a;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 0 1rem 0;
    color: #f0d6d6;
}
.unfilled-fields-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: #f2b7b7;
}
.unfilled-fields-card .hint {
    font-size: 0.8rem;
    font-weight: normal;
    color: #d99595;
    margin-left: 0.5rem;
}
.unfilled-fields-list {
    margin: 0;
    padding-left: 1.25rem;
    columns: 2;
    column-gap: 2rem;
    font-size: 0.92rem;
}
.unfilled-fields-list li {
    break-inside: avoid;
    margin-bottom: 0.35rem;
    color: #e8c6c6;
}

/* ----- Table-aware diff cards (DOCX × JPEG) ----- */
.table-diff-card,
.extra-tables-card {
    background: #18232e;
    border: 1px solid #2c4355;
    border-left: 4px solid #4a9fe0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 0 1rem 0;
    color: #d7e4ef;
}
.extra-tables-card {
    border-left-color: #b48ae0;
    background: #221a2e;
    border-color: #463657;
}
.table-diff-card h3,
.extra-tables-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: #9cc6ea;
}
.extra-tables-card h3 { color: #c7a5ea; }
.table-diff-card .hint,
.extra-tables-card .hint {
    font-size: 0.8rem;
    font-weight: normal;
    color: #7ea8c6;
    margin-left: 0.5rem;
}
.tdiff-block {
    margin-bottom: 1rem;
    padding: 0.6rem 0.8rem;
    background: #121b24;
    border-radius: 6px;
    border: 1px solid #243644;
}
.tdiff-block.tdiff-missing {
    border-color: #6b3a3a;
    background: #201313;
}
.tdiff-block h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: #b9d1e5;
}
.tdiff-missing-note {
    margin: 0;
    font-size: 0.88rem;
    color: #e0a0a0;
    font-style: italic;
}
.tdiff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.tdiff-table th,
.tdiff-table td {
    text-align: left;
    padding: 0.35rem 0.55rem;
    border-bottom: 1px solid #253747;
    vertical-align: top;
}
.tdiff-table th {
    color: #9cc6ea;
    font-weight: 600;
}
.tdiff-table tbody tr:last-child td {
    border-bottom: none;
}
.tdiff-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    letter-spacing: 0.03em;
}
.tdiff-badge.filled {
    background: #14402b;
    color: #7de0a7;
    border: 1px solid #276e48;
}
.tdiff-badge.changed {
    background: #3a2c12;
    color: #ffcf7a;
    border: 1px solid #7a5a24;
}
.tdiff-old {
    color: #a8a8a8;
    text-decoration: line-through;
    text-decoration-color: #74554a;
}
.tdiff-new {
    color: #f0e8c8;
    font-weight: 500;
}
.tdiff-footnote {
    margin: 0.4rem 0 0 0;
    font-size: 0.82rem;
    color: #8aa8bf;
    font-style: italic;
}

.extra-table-block {
    margin-bottom: 0.8rem;
    padding: 0.5rem 0.7rem;
    background: #1a1424;
    border: 1px solid #3a2b4a;
    border-radius: 6px;
}
.extra-table-block h4 {
    margin: 0 0 0.4rem 0;
    font-size: 0.95rem;
    color: #d0b5ef;
}
.extra-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.extra-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #342246;
    color: #ead7f5;
}
.extra-table tr:last-child td { border-bottom: none; }

@media (max-width: 700px) {
    .unfilled-fields-list { columns: 1; }
}

/* ── Risk badges ────────────────────────────────────────────── */
.risk-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    vertical-align: middle;
    letter-spacing: 0.02em;
}
.risk-badge.alici       { background: #064e3b; color: #6ee7b7; }
.risk-badge.satici      { background: #7f1d1d; color: #fca5a5; }
.risk-badge.her_ikisi   { background: #78350f; color: #fcd34d; }
.risk-badge.redaksiyonel{ background: #374151; color: #9ca3af; }
.risk-badge.belirsiz    { background: #1f2937; color: #6b7280; }
.risk-badge.kritik      { font-weight: 700; box-shadow: 0 0 0 1px currentColor; }

/* ── Executive summary card ────────────────────────────────── */
.executive-summary-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #1e293b 100%);
    border: 1px solid #4338ca;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
}
.executive-summary-card h3 {
    margin: 0 0 0.5rem 0;
    color: #a5b4fc;
    font-size: 1rem;
}
.summary-text {
    color: #e0e7ff;
    font-size: 0.95rem;
    line-height: 1.6;
}
.critical-findings h4 {
    margin: 0.8rem 0 0.4rem;
    color: #fbbf24;
    font-size: 0.9rem;
}
.critical-findings ul {
    margin: 0;
    padding-left: 1.4rem;
    color: #fde68a;
    font-size: 0.9rem;
    line-height: 1.5;
}
.summary-loading {
    color: #94a3b8;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid #4338ca;
    border-top-color: #a5b4fc;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* ── QA bar ────────────────────────────────────────────────── */
.qa-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}
.qa-bar input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.92rem;
}
.qa-bar input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.25);
}
.qa-bar button {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    background: #4338ca;
    color: #e0e7ff;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}
.qa-bar button:hover { background: #4f46e5; }

.qa-answer {
    background: #1e1b4b;
    border: 1px solid #3730a3;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    color: #e0e7ff;
    font-size: 0.92rem;
    line-height: 1.6;
}
.qa-answer-text { margin-bottom: 0.5rem; }
.qa-sources { font-size: 0.84rem; color: #94a3b8; }
.qa-source {
    margin: 0.3rem 0;
    padding: 0.3rem 0.5rem;
    background: #0f172a;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    max-height: 3em;
    overflow: hidden;
}
.qa-error { color: #fca5a5; }

/* ── Emsal panel ───────────────────────────────────────────── */
.emsal-panel {
    background: #1a1a2e;
    border: 1px solid #312e81;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-top: 1rem;
}
.emsal-panel h3 {
    margin: 0 0 0.7rem 0;
    color: #c4b5fd;
    font-size: 1rem;
}
.emsal-row {
    padding: 0.4rem 0;
    border-bottom: 1px solid #1e1b4b;
    color: #e0e7ff;
    font-size: 0.9rem;
}
.emsal-row:last-child { border-bottom: none; }
.emsal-outlier {
    display: inline-block;
    background: #991b1b;
    color: #fecaca;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
}
.emsal-stats {
    color: #6b7280;
    font-size: 0.8rem;
    margin-left: 8px;
}

/* ── LLM toggle ────────────────────────────────────────────── */
.llm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
    margin-left: 0.5rem;
}
.llm-toggle input[type="checkbox"] {
    accent-color: #6366f1;
    width: 14px;
    height: 14px;
}

/* ── Light theme: hardcoded-color overrides ───────────────── */
[data-theme="light"] .header-link {
    color: #4338ca;
    border-color: #c7d2fe;
}
[data-theme="light"] .header-link:hover {
    background: #eef2ff;
    color: #3730a3;
}
[data-theme="light"] .header-link.login {
    background: #4a6cf7;
    border-color: #4a6cf7;
    color: #fff;
}
[data-theme="light"] .header-link.login:hover {
    background: #3b5de7;
    border-color: #3b5de7;
}
[data-theme="light"] .header-link.logout {
    color: #cf222e;
    border-color: #fecaca;
}
[data-theme="light"] .header-link.logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}
[data-theme="light"] .user-chip {
    border-color: #c7d2fe;
    color: #4338ca;
    background: rgba(99, 102, 241, 0.06);
}
[data-theme="light"] .user-chip:hover { background: rgba(99, 102, 241, 0.14); }
[data-theme="light"] .user-dropdown {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
[data-theme="light"] .ud-item { color: #1f2937; }
[data-theme="light"] .ud-item:hover { background: rgba(99,102,241,0.06); }
[data-theme="light"] .ud-logout { color: #dc2626; }

[data-theme="light"] .new-compare-btn {
    background: #dc2626;
    border-color: #dc2626;
}
[data-theme="light"] .new-compare-btn:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
[data-theme="light"] .export-tracker-btn {
    background: #2563eb;
    border-color: #2563eb;
}
[data-theme="light"] .export-tracker-btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

[data-theme="light"] .filled-fields-card {
    background: #fffbeb;
    border-color: #f59e0b;
    border-left-color: #d97706;
    color: #78350f;
}
[data-theme="light"] .filled-fields-card h3 { color: #92400e; }
[data-theme="light"] .filled-fields-card .hint { color: #b45309; }
[data-theme="light"] .filled-fields-table th { color: #92400e; }
[data-theme="light"] .filled-fields-table td { color: #451a03; border-bottom-color: #fde68a; }

[data-theme="light"] .unfilled-fields-card {
    background: #fef2f2;
    border-color: #fca5a5;
    border-left-color: #dc2626;
    color: #7f1d1d;
}
[data-theme="light"] .unfilled-fields-card h3 { color: #991b1b; }
[data-theme="light"] .unfilled-fields-card .hint { color: #b91c1c; }
[data-theme="light"] .unfilled-fields-list li { color: #7f1d1d; }

[data-theme="light"] .table-diff-card,
[data-theme="light"] .extra-tables-card {
    background: #eff6ff;
    border-color: #93c5fd;
    border-left-color: #3b82f6;
    color: #1e3a5f;
}
[data-theme="light"] .extra-tables-card {
    background: #f5f3ff;
    border-color: #c4b5fd;
    border-left-color: #8b5cf6;
}
[data-theme="light"] .table-diff-card h3 { color: #1d4ed8; }
[data-theme="light"] .extra-tables-card h3 { color: #6d28d9; }
[data-theme="light"] .table-diff-card .hint { color: #2563eb; }
[data-theme="light"] .tdiff-block {
    background: #f8fafc;
    border-color: #bfdbfe;
}
[data-theme="light"] .tdiff-block.tdiff-missing {
    background: #fef2f2;
    border-color: #fca5a5;
}
[data-theme="light"] .tdiff-block h4 { color: #1e40af; }
[data-theme="light"] .tdiff-missing-note { color: #b91c1c; }
[data-theme="light"] .tdiff-table th { color: #1d4ed8; }
[data-theme="light"] .tdiff-table td { border-bottom-color: #e2e8f0; }
[data-theme="light"] .tdiff-badge.filled { background: #dcfce7; color: #166534; border-color: #86efac; }
[data-theme="light"] .tdiff-badge.changed { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
[data-theme="light"] .tdiff-old { color: #6b7280; text-decoration-color: #d1d5db; }
[data-theme="light"] .tdiff-new { color: #1f2937; }
[data-theme="light"] .tdiff-footnote { color: #6b7280; }
[data-theme="light"] .extra-table-block {
    background: #faf5ff;
    border-color: #e9d5ff;
}
[data-theme="light"] .extra-table-block h4 { color: #6d28d9; }
[data-theme="light"] .extra-table td { color: #374151; border-bottom-color: #e9d5ff; }

[data-theme="light"] .executive-summary-card {
    background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 100%);
    border-color: #a5b4fc;
}
[data-theme="light"] .executive-summary-card h3 { color: #4338ca; }
[data-theme="light"] .summary-text { color: #1e293b; }
[data-theme="light"] .critical-findings h4 { color: #92400e; }
[data-theme="light"] .critical-findings ul { color: #78350f; }
[data-theme="light"] .summary-loading { color: #64748b; }
[data-theme="light"] .spinner-sm { border-color: #c7d2fe; border-top-color: #4338ca; }

[data-theme="light"] .qa-bar input {
    background: #fff;
    border-color: #d1d5db;
    color: #1f2937;
}
[data-theme="light"] .qa-bar input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
[data-theme="light"] .qa-bar button {
    background: #4a6cf7;
    color: #fff;
}
[data-theme="light"] .qa-bar button:hover { background: #3b5de7; }
[data-theme="light"] .qa-answer {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #1e293b;
}
[data-theme="light"] .qa-sources { color: #64748b; }
[data-theme="light"] .qa-source { background: #f8fafc; }
[data-theme="light"] .qa-error { color: #dc2626; }

[data-theme="light"] .emsal-panel {
    background: #f5f3ff;
    border-color: #c4b5fd;
}
[data-theme="light"] .emsal-panel h3 { color: #6d28d9; }
[data-theme="light"] .emsal-row { color: #1e293b; border-bottom-color: #e9d5ff; }
[data-theme="light"] .emsal-outlier { background: #fef2f2; color: #dc2626; }
[data-theme="light"] .emsal-stats { color: #6b7280; }

[data-theme="light"] .llm-toggle { color: #64748b; }
[data-theme="light"] .llm-toggle input[type="checkbox"] { accent-color: #4a6cf7; }

[data-theme="light"] .risk-badge.alici       { background: #dcfce7; color: #166534; }
[data-theme="light"] .risk-badge.satici      { background: #fef2f2; color: #b91c1c; }
[data-theme="light"] .risk-badge.her_ikisi   { background: #fef3c7; color: #92400e; }
[data-theme="light"] .risk-badge.redaksiyonel{ background: #f3f4f6; color: #4b5563; }
[data-theme="light"] .risk-badge.belirsiz    { background: #f9fafb; color: #6b7280; }

[data-theme="light"] .wd-delete { background: rgba(207,34,46,0.12); color: #cf222e; }
[data-theme="light"] .wd-insert { background: rgba(26,127,55,0.12); color: #1a7f37; }
[data-theme="light"] .wd-delete.sug { background: rgba(154,103,0,0.15); color: #8a5e00; }
[data-theme="light"] .wd-insert.sug { background: rgba(6,148,162,0.15); color: #0e7c86; }
[data-theme="light"] .cd-delete { background: rgba(207,34,46,0.18); }
[data-theme="light"] .cd-insert { background: rgba(26,127,55,0.18); }
[data-theme="light"] .cd-delete.sug { background: rgba(154,103,0,0.22); color: #8a5e00; }
[data-theme="light"] .cd-insert.sug { background: rgba(6,148,162,0.22); color: #0e7c86; }
[data-theme="light"] .wd-sug-na {
    background: rgba(154,103,0,0.06);
    text-decoration-color: rgba(154,103,0,0.6);
}

[data-theme="light"] .check-cnt { background: rgba(0,0,0,0.05); }
[data-theme="light"] .step-num { background: rgba(0,0,0,0.08); }

/* ── Wizard styles ────────────────────────────────────────── */
.wizard-phase { animation: fadeIn 0.3s ease; }

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.template-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.template-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.template-icon { font-size: 2.2rem; flex-shrink: 0; }
.template-info h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.template-info p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

.wiz-loading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
    padding: 2rem 0;
    justify-content: center;
}
.wiz-empty { color: var(--text-muted); text-align: center; padding: 2rem; }

.wizard-header { margin-bottom: 1.5rem; }
.wizard-header h2 { margin-bottom: 0.75rem; }

.wizard-steps {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.wiz-step-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.wiz-step-pill.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.wiz-step-pill.done {
    color: var(--green-text);
    border-color: var(--green);
}

.wizard-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.wiz-field { margin-bottom: 1.25rem; }
.wiz-field:last-child { margin-bottom: 0; }
.wiz-field.wiz-error .wiz-input,
.wiz-field.wiz-error .wiz-select { border-color: var(--red) !important; }

.wiz-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text);
}
.wiz-label .req { color: var(--red-text); }

.wiz-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.wiz-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(106, 140, 255, 0.15);
}
.wiz-textarea { min-height: 80px; resize: vertical; }
.wiz-select { cursor: pointer; }

.wiz-radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.wiz-radio {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text);
}
.wiz-radio input { accent-color: var(--accent); }
.wiz-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text);
}
.wiz-checkbox input { accent-color: var(--accent); }

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.preview-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.legal-notice {
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #92750a;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}
.preview-doc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.preview-doc-tab {
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.18s;
}
.preview-doc-tab:hover { color: var(--text); }
.preview-doc-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.preview-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    min-height: 300px;
}
.preview-doc h3 {
    font-size: 1rem;
    margin: 1.2rem 0 0.5rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3rem;
}
.preview-doc h3:first-child { margin-top: 0; }
.preview-doc p {
    font-size: 0.92rem;
    line-height: 1.7;
    margin-bottom: 0.4rem;
    white-space: pre-wrap;
    color: var(--text);
}

@media print {
    body { background: #fff; color: #000; }
    .steps, .actions, .view-toggle, header, .qa-bar, .emsal-panel { display: none; }
}


/* ── AI Tabs ─────────────────────────────────────────────────────────────────── */
.ai-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.2rem;
}

.ai-tab {
    padding: 0.7rem 1.4rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.ai-tab:hover { color: var(--text); }
.ai-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.ai-tab-content { animation: fadeIn 0.2s; }
.ai-tab-content.hidden { display: none; }

/* ── AI Score ────────────────────────────────────────────────────────────────── */
.ai-score {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    background: var(--surface2);
}

.score-num { font-size: 2.8rem; font-weight: 700; }
.score-label { font-size: 1rem; color: var(--text-muted); }
.score-good .score-num { color: #22c55e; }
.score-mid .score-num { color: #f59e0b; }
.score-bad .score-num { color: #ef4444; }

/* ── AI Risk Cards ───────────────────────────────────────────────────────────── */
.ai-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.2rem 0 0.6rem;
    color: var(--text);
}

.ai-risk-card, .ai-missing-card {
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    border-radius: 8px;
    border-left: 4px solid var(--border);
    background: var(--surface2);
}

.ai-risk-card.risk-yuksek { border-left-color: #ef4444; }
.ai-risk-card.risk-orta { border-left-color: #f59e0b; }
.ai-risk-card.risk-dusuk { border-left-color: #3b82f6; }

.ai-missing-card.missing-kritik { border-left-color: #ef4444; }
.ai-missing-card.missing-onemli { border-left-color: #f59e0b; }
.ai-missing-card.missing-tavsiye { border-left-color: #3b82f6; }

.risk-header, .missing-header {
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.risk-severity, .missing-importance {
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--border);
    color: var(--text-muted);
    font-weight: 700;
}

.risk-desc, .risk-suggestion, .missing-suggestion {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.3rem 0;
}

.risk-suggestion strong, .missing-suggestion strong { color: var(--accent); }

/* ── AI Summary Cards ────────────────────────────────────────────────────────── */
.ai-summary-card {
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    border-radius: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
}

.summary-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--accent);
}

.summary-plain {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
    margin: 0;
}

/* ── AI Chat Box ─────────────────────────────────────────────────────────────── */
.ai-chat-box {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.8rem;
    background: var(--surface2);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.ai-chat-box input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
}

.ai-chat-box input:focus { outline: none; border-color: var(--accent); }

.ai-chat-box button {
    padding: 0.6rem 1.2rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ai-chat-box button:hover { opacity: 0.85; }
.ai-chat-box button:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-chat-status {
    padding: 0.5rem 0.8rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-chat-status.hidden { display: none; }
.chat-success { color: #22c55e; }
.chat-error { color: #ef4444; }

.ai-note {
    padding: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

.ai-note.error { color: #ef4444; }

/* ── Analiz Page ─────────────────────────────────────────────────────────────── */
.analiz-section { max-width: 900px; margin: 0 auto; }

.analiz-upload-box {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.analiz-upload-box.drag-over {
    border-color: var(--accent);
    background: rgba(74, 108, 247, 0.05);
}

.upload-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.upload-text { color: var(--text-muted); margin-bottom: 0.8rem; }

.upload-btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.upload-btn:hover { opacity: 0.85; }
.upload-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.6rem; }

.analiz-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.analiz-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border);
}

.analiz-divider span {
    background: var(--bg);
    padding: 0 1rem;
    position: relative;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.analiz-paste textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 120px;
}

.analiz-paste textarea:focus { outline: none; border-color: var(--accent); }

.analiz-paste .btn-primary {
    margin-top: 0.8rem;
    padding: 0.7rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
}

.analiz-paste .btn-primary:hover { opacity: 0.85; }

.analiz-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.analiz-result-header h2 { margin: 0; }

.analiz-result-header .btn-secondary {
    padding: 0.5rem 1rem;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.analiz-result-header .btn-secondary:hover { border-color: var(--accent); }

/* ── Analizlerim page ────────────────────────────────────────────────────────── */
.analiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.analiz-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.analiz-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.1);
}

.analiz-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.analiz-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.analiz-card-delete {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
}

.analiz-card-delete:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.analiz-card-score {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.analiz-card-score .score-num { font-size: 2rem; font-weight: 700; }
.analiz-card-score .score-label { font-size: 0.85rem; color: var(--text-muted); }
.analiz-card-score.score-good .score-num { color: #22c55e; }
.analiz-card-score.score-mid .score-num { color: #f59e0b; }
.analiz-card-score.score-bad .score-num { color: #ef4444; }

.analiz-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.analiz-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.analiz-empty .btn-primary {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.7rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
}

.analiz-result-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}


/* ══════════════════════════════════════════════════════════════════════════════
   SITE HEADER
   ══════════════════════════════════════════════════════════════════════════════ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo img {
    height: 36px;
    width: auto;
    border-radius: 6px;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.logo-text .logo-r {
    color: #e11d48;
}

.logo-text .logo-l {
    color: #2563eb;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.main-nav .nav-link {
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
}

.main-nav .nav-link:hover {
    color: var(--text);
    background: var(--surface2);
}

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

.btn-outline {
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
}

.btn-outline:hover { border-color: var(--accent); background: rgba(108, 140, 255, 0.08); }

.btn-primary {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.88; }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-lg { padding: 0.75rem 1.8rem; font-size: 1rem; }

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s;
}

.mobile-menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.mobile-menu-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

.mobile-nav {
    display: none;
    padding: 0.8rem 1.5rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.mobile-nav .nav-link {
    display: block;
    padding: 0.6rem 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.mobile-nav .nav-link:last-child { border-bottom: none; }
.mobile-nav .nav-link:hover { color: var(--text); }
.mobile-nav:not(.hidden) { display: block; }

@media (max-width: 768px) {
    .main-nav { display: none; }
    .header-actions { display: none; }
    .mobile-menu-toggle { display: flex; }
}


/* ══════════════════════════════════════════════════════════════════════════════
   SITE FOOTER
   ══════════════════════════════════════════════════════════════════════════════ */

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
}

@media (max-width: 768px) {
    .footer-container { grid-template-columns: 1fr; gap: 2rem; }
}

.footer-brand { display: flex; flex-direction: column; gap: 0.8rem; }
.footer-desc { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; max-width: 280px; }

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

@media (max-width: 600px) { .footer-links { grid-template-columns: 1fr 1fr; } }

.footer-col h4 {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.8rem;
}

.footer-col a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    padding: 0.3rem 0;
    transition: color 0.2s;
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1.2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}


/* ══════════════════════════════════════════════════════════════════════════════
   HERO SLIDER
   ══════════════════════════════════════════════════════════════════════════════ */

.hero-slider {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 4rem;
    overflow: visible;
}

.slider-track { position: relative; min-height: 380px; }

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.slide.active { opacity: 1; pointer-events: auto; position: relative; }

.slide-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    min-height: 340px;
}

@media (max-width: 768px) {
    .slide-content { grid-template-columns: 1fr; gap: 1.5rem; min-height: auto; }
    .slide-visual { display: none; }
}

.slide-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(108, 140, 255, 0.15);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.slide-text h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.slide-text p {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    max-width: 480px;
}

.slide-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon-large {
    font-size: 8rem;
    opacity: 0.6;
    filter: grayscale(0.3);
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 5;
}

.slider-arrow:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.slider-prev { left: -50px; }
.slider-next { right: -50px; }

@media (max-width: 900px) {
    .slider-prev { left: 0; }
    .slider-next { right: 0; }
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.dot.active { background: var(--accent); transform: scale(1.4); }
.dot:hover { background: var(--accent); }


/* ══════════════════════════════════════════════════════════════════════════════
   FEATURES SECTION
   ══════════════════════════════════════════════════════════════════════════════ */

.features-section {
    max-width: 1280px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.section-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .features-grid { grid-template-columns: 1fr; } }

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.8rem 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.feature-card-icon {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}


/* ══════════════════════════════════════════════════════════════════════════════
   CTA SECTION
   ══════════════════════════════════════════════════════════════════════════════ */

.cta-section {
    text-align: center;
    padding: 4rem 1.5rem;
    margin: 2rem auto;
    max-width: 700px;
}

.cta-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.8rem;
}

.cta-section p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}


/* ══════════════════════════════════════════════════════════════════════════════
   CONTACT PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

.contact-section {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.contact-section h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.contact-icon { font-size: 1.8rem; }
.contact-item h3 { font-size: 0.95rem; color: var(--text); margin-bottom: 0.2rem; }
.contact-item p { font-size: 0.9rem; color: var(--text-muted); }

.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; font-weight: 500; }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 100px; }


/* ══════════════════════════════════════════════════════════════════════════════
   SITE MAIN
   ══════════════════════════════════════════════════════════════════════════════ */

.site-main { min-height: 60vh; }


/* ══════════════════════════════════════════════════════════════════════════════
   UNDER CONSTRUCTION PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

.wip-section {
    text-align: center;
    padding: 6rem 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.wip-icon { font-size: 5rem; margin-bottom: 1.5rem; }

.wip-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

.wip-section p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* ── Dashboard (landing page, logged-in users) ── */
.dashboard-section {
    max-width: 1280px;
    margin: 2.5rem auto 1rem;
    padding: 0 1.5rem;
}
.dash-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}
.dash-tab {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.dash-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.dash-panel.hidden { display: none; }
.dash-loading, .dash-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-size: 0.95rem;
}
.dash-empty a { color: var(--accent); margin-left: 0.3rem; }
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.dash-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, border-color 0.2s;
    background: var(--bg-card, var(--surface));
}
.dash-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(99,102,241,0.12);
}
.dash-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.55rem;
}
.dash-card-icon { font-size: 1.5rem; }
.dash-card-score {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
}
.score-good { background: rgba(34,197,94,0.15); color: #16a34a; }
.score-mid  { background: rgba(250,204,21,0.18); color: #a16207; }
.score-bad  { background: rgba(239,68,68,0.13); color: #dc2626; }
.dash-card-status {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.12rem 0.5rem;
    border-radius: 6px;
}
.status-active     { background: rgba(34,197,94,0.15); color: #16a34a; }
.status-expired    { background: rgba(239,68,68,0.13); color: #dc2626; }
.status-draft      { background: rgba(156,163,175,0.18); color: #6b7280; }
.status-terminated { background: rgba(239,68,68,0.13); color: #dc2626; }
.dash-card-title {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-card-date, .dash-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.dash-card-meta { display: flex; gap: 0.75rem; }
.dash-more {
    text-align: center;
    margin-top: 1rem;
}
[data-theme="light"] .dash-card { background: #fff; }
[data-theme="light"] .score-good { color: #15803d; }
[data-theme="light"] .score-mid { color: #92400e; }
[data-theme="light"] .score-bad { color: #b91c1c; }

/* ===== Auth / Pricing / Account / Legal (RedLine billing) ===== */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
    margin-right: 0.75rem;
    font-size: 0.9rem;
}
.header-nav a {
    color: var(--text-muted, #9ca3af);
    text-decoration: none;
}
.header-nav a:hover { color: var(--text, #e5e7eb); }
.header-nav .nav-cta {
    background: var(--accent, #3b82f6);
    color: #fff !important;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
}
.quota-chip {
    background: rgba(59,130,246,0.15);
    color: #60a5fa !important;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 1rem;
}
.footer-links a {
    color: var(--text-muted, #9ca3af);
    font-size: 0.85rem;
    text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }

.auth-card, .account-card {
    max-width: 420px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 16px;
    background: var(--card-bg, #1f2937);
    border: 1px solid var(--border, #374151);
}
.auth-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.auth-sub { color: var(--text-muted, #9ca3af); margin-bottom: 1.25rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.auth-form input {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border, #374151);
    background: var(--input-bg, #111827);
    color: var(--text, #e5e7eb);
}
.auth-form button, .auth-card button, .plan-card button {
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 10px;
    background: #3b82f6;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.auth-form button:hover, .plan-card button:hover { filter: brightness(1.08); }
.auth-links, .auth-legal { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); text-align: center; }
.auth-links a, .auth-legal a { color: #60a5fa; }
.auth-divider {
    display: flex; align-items: center; gap: 0.75rem;
    margin: 1.25rem 0; color: var(--text-muted); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border, #374151);
}
.btn-google, .btn-secondary, .btn-danger {
    display: inline-block;
    text-align: center;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--border, #374151);
    color: var(--text, #e5e7eb);
    background: transparent;
    cursor: pointer;
}
.btn-google { width: 100%; box-sizing: border-box; }
.btn-danger { border-color: #ef4444; color: #f87171; }
.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash-stack { max-width: 960px; margin: 0 auto; padding: 0.75rem 1.25rem 0; }
.flash-info { background: rgba(59,130,246,0.15); color: #93c5fd; }
.flash-error, .auth-card .error { background: rgba(239,68,68,0.15); color: #fca5a5; padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; }

.verify-banner {
    background: rgba(245, 158, 11, 0.12);
    border-bottom: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--text, #e5e7eb);
}
.verify-banner-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    font-size: 0.92rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}
.verify-banner-form { margin: 0; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.text-muted { opacity: 0.75; font-size: 0.9em; }

[data-theme="light"] .verify-banner {
    background: rgba(245, 158, 11, 0.15);
    color: #92400e;
}

.pricing-page { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }
.pricing-page h1 { text-align: center; }
.pricing-sub { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; }
.quota-banner {
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(59,130,246,0.12);
    margin-bottom: 1.5rem;
}
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}
.plan-card {
    position: relative;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border, #374151);
    background: var(--card-bg, #1f2937);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.plan-card.featured { border-color: #3b82f6; box-shadow: 0 0 0 1px rgba(59,130,246,0.35); }
.plan-card.current { outline: 2px solid #22c55e; }
.plan-badge {
    position: absolute; top: 0.75rem; right: 0.75rem;
    background: #3b82f6; color: #fff; font-size: 0.7rem;
    padding: 0.2rem 0.5rem; border-radius: 999px; font-weight: 700;
}
.plan-price { font-size: 2rem; font-weight: 800; }
.plan-price span { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
.plan-card ul { margin: 0; padding-left: 1.1rem; color: var(--text-muted); flex: 1; }
.plan-card form, .plan-card > a, .plan-card > button { margin-top: auto; }
.plan-card button, .plan-card .btn-secondary { width: 100%; box-sizing: border-box; }

.account-dl { display: grid; grid-template-columns: 140px 1fr; gap: 0.5rem 1rem; }
.account-dl dt { color: var(--text-muted); }
.account-dl dd { margin: 0; }

.admin-page { max-width: 960px; margin: 2rem auto; padding: 0 1rem 3rem; }
.admin-page-wide { max-width: 1100px; }
.admin-header h1 { margin: 0 0 0.25rem; }
.admin-tabs { display: flex; gap: 0.5rem; margin: 1rem 0 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.admin-tab {
    padding: 0.45rem 0.85rem;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}
.admin-tab.active { color: inherit; background: var(--surface); border: 1px solid var(--border); border-bottom-color: var(--surface); margin-bottom: -1px; }
.admin-section { margin: 1.75rem 0; }
.admin-section h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.admin-hint { font-size: 0.85rem; font-weight: 400; }
.admin-footnote { font-size: 0.85rem; margin: 0.65rem 0 0; }
.admin-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.85rem; margin: 1.25rem 0; }
.admin-two-col { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1rem; margin: 1.25rem 0; }
@media (max-width: 800px) { .admin-two-col { grid-template-columns: 1fr; } }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.admin-subhead { font-size: 0.95rem; margin: 1rem 0 0.5rem; color: var(--text-muted); }
.admin-metrics-table th, .admin-metrics-table td { white-space: nowrap; }
.admin-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 140px;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.admin-chart-bar {
    flex: 1;
    min-width: 0;
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    border-radius: 3px 3px 0 0;
    position: relative;
    min-height: 2px;
}
.admin-chart-val {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding-bottom: 2px;
}
.admin-chart-labels {
    display: flex;
    gap: 3px;
    margin-top: 0.35rem;
}
.admin-chart-labels span {
    flex: 1;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    min-width: 0;
    overflow: hidden;
}
.admin-stats { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.25rem 0; }
.admin-stat {
    min-width: 120px;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.admin-stat-val { display: block; font-size: 1.5rem; font-weight: 700; }
.admin-stat-label { color: var(--text-muted); font-size: 0.85rem; }
.admin-plan-summary { margin: 0 0 1rem; font-size: 0.9rem; }
.admin-search { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-search input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit;
}
.admin-table-wrap { overflow-x: auto; margin: 1rem 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.admin-table th { color: var(--text-muted); font-weight: 600; }
.admin-pagination { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.admin-panel {
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.admin-panel h2, .admin-page h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }
.admin-form { display: grid; gap: 0.75rem; max-width: 360px; }
.admin-form label { display: grid; gap: 0.35rem; font-size: 0.9rem; }
.admin-form select, .admin-form input[type="text"] {
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: inherit;
}
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.admin-inline-form { display: inline; margin-left: 0.5rem; }
.admin-dl dd { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.btn-sm { padding: 0.35rem 0.65rem !important; font-size: 0.85rem !important; }

.legal-page {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1rem 3rem;
    line-height: 1.7;
}
.legal-page h1 { margin-bottom: 1rem; }
.legal-page h2 { margin-top: 1.5rem; font-size: 1.15rem; }

.lock-banner {
    margin: 0.75rem 0 1rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(239,68,68,0.18), rgba(59,130,246,0.18));
    border: 1px solid rgba(239,68,68,0.35);
}
.lock-banner-inner { font-size: 0.95rem; }
.lock-cta {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    background: #3b82f6;
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
}

[data-theme="light"] .auth-card,
[data-theme="light"] .plan-card,
[data-theme="light"] .account-card {
    background: #fff;
    border-color: #e5e7eb;
}
[data-theme="light"] .auth-form input {
    background: #f9fafb;
    color: #111827;
    border-color: #d1d5db;
}
[data-theme="light"] .quota-chip { color: #1d4ed8 !important; background: rgba(37,99,235,0.1); }
