:root {
    color-scheme: light dark;
    --bg: #0f1419;
    --panel: #1a2332;
    --panel-border: #2d3a4d;
    --text: #e8eef7;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger-bg: #3f1d24;
    --danger-text: #fecaca;
    --success-bg: #14352a;
    --success-text: #bbf7d0;
    --warning-bg: #3a2f14;
    --warning-text: #fde68a;
    font-family: "Segoe UI", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.18), transparent 40%),
        var(--bg);
    color: var(--text);
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.25rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.subtitle {
    margin: 0;
    color: var(--muted);
}

.build-meta {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.messages {
    margin: 1.5rem 0;
}

.message {
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.message-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.drop-zone {
    margin-top: 2rem;
    padding: 3rem 1.5rem;
    border: 2px dashed var(--panel-border);
    border-radius: 1rem;
    background: var(--panel);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: #1f2a3d;
    outline: none;
}

.drop-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
}

.drop-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.drop-hint,
.selected-file {
    margin: 0;
    color: var(--muted);
}

.selected-file {
    margin-top: 1rem;
    color: var(--text);
    word-break: break-all;
}

.drop-zone.busy {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.status {
    margin: 1.25rem 0 0;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
}

.status-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--text);
}

.status-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.result-panel {
    margin-top: 2rem;
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    background: var(--panel);
    overflow: hidden;
}

.result-notice {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--panel-border);
    font-size: 0.95rem;
    line-height: 1.45;
}

.result-notice-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.result-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--panel-border);
}

.result-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.result-summary {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.result-report {
    padding: 1rem 1.25rem 1.25rem;
}

.summary-totals {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary-line {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.summary-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.parse-debug-section {
    width: 100vw;
    margin-top: 1.5rem;
    margin-left: calc(50% - 50vw);
    padding: 0 1.25rem 1.5rem;
}

.parse-debug-section-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.parse-debug-accordion {
    margin: 0;
}

.parse-debug-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    background: #ffffff;
}

.parse-debug-summary::-webkit-details-marker {
    display: none;
}

.parse-debug-summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.35rem;
    color: #64748b;
    transition: transform 0.15s ease;
}

.parse-debug-accordion[open] > .parse-debug-summary::before {
    transform: rotate(90deg);
}

.parse-debug-body {
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.parse-debug-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

.parse-debug-badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.parse-debug-count {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
}

.parse-debug-hint {
    margin: 0.85rem 0;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.4;
}

.parse-debug-table-wrap {
    overflow-x: auto;
}

.parse-debug-table {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.parse-debug-table th,
.parse-debug-table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    color: #0f172a;
}

.parse-debug-table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.parse-debug-table tbody tr:last-child td {
    border-bottom: none;
}

.parse-debug-id {
    width: 7rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: #1d4ed8;
    white-space: nowrap;
}

.parse-debug-requirement-cell {
    min-width: 16rem;
    width: 22%;
}

.parse-debug-chapter {
    font-weight: 600;
    line-height: 1.35;
}

.parse-debug-text {
    margin-top: 0.35rem;
    color: #64748b;
    line-height: 1.4;
}

.parse-debug-comments-cell {
    width: 68%;
}

.parse-debug-comments-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.78rem;
    background: #f8fafc;
}

.parse-debug-comments-table th,
.parse-debug-comments-table td {
    padding: 0.45rem 0.55rem;
    border: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
    color: #0f172a;
}

.parse-debug-comments-table thead th {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.parse-debug-empty {
    color: #64748b;
}

.total-badge {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
}

.status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge-approved {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.status-badge-needs-more-work {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
}

.status-badge-not-reviewed {
    background: rgba(148, 163, 184, 0.18);
    color: var(--muted);
}

.status-badge-neutral {
    background: rgba(148, 163, 184, 0.12);
    color: var(--muted);
}

.review-section {
    margin-top: 1.25rem;
}

.review-section-title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.item-state-badge {
    display: inline-block;
    margin-bottom: 0.4rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.item-state-badge-commented {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

.review-plain-dash {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.total-badge-commented {
    background: rgba(59, 130, 246, 0.12);
}

.total-badge-uncommented {
    background: rgba(148, 163, 184, 0.12);
}

.reviewer-details {
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.row-uncommented {
    opacity: 0.82;
}

.review-table-uncommented td {
    color: var(--muted);
}

.review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.review-table th,
.review-table td {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--panel-border);
    text-align: left;
    vertical-align: top;
}

.review-table th {
    background: rgba(59, 130, 246, 0.08);
    font-weight: 600;
}

.review-item-cell {
    word-break: break-word;
    line-height: 1.4;
}

.footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
}

.footer-note {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f4f7fb;
        --panel: #ffffff;
        --panel-border: #cbd5e1;
        --text: #0f172a;
        --muted: #64748b;
        --danger-bg: #fee2e2;
        --danger-text: #991b1b;
        --warning-bg: #fef3c7;
        --warning-text: #92400e;
    }

    body {
        background:
            radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 45%),
            var(--bg);
    }

    .drop-zone:hover,
    .drop-zone:focus-visible,
    .drop-zone.drag-over {
        background: #f8fbff;
    }

    .status-badge-approved {
        color: #15803d;
    }

    .status-badge-needs-more-work {
        color: #b45309;
    }

    .item-state-badge-commented {
        color: #1d4ed8;
    }
}
