:root {
    --bg: #0c0e14;
    --surface: #151820;
    --surface-2: #1c2030;
    --border: #252a3a;
    --text: #e8eaf0;
    --text-dim: #8892a8;
    --text-muted: #5a6280;
    --accent: #6c8aff;
    --accent-glow: rgba(108, 138, 255, 0.15);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-w: 340px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============= SIDEBAR ============= */

.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    gap: 24px;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.brand h1 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 1px;
}

/* ============= FORM ============= */

.form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.input-row {
    display: flex;
    gap: 8px;
}

.input-row input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition);
}

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

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

.input-row button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), transform 0.1s;
    position: relative;
    overflow: hidden;
}

.input-row button:hover {
    background: #5a7af0;
}

.input-row button:active {
    transform: scale(0.97);
}

.input-row button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.input-row button:disabled .btn-text {
    opacity: 0;
}

.input-row button:disabled .btn-spinner {
    display: block;
}

.btn-spinner {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============= TOGGLE ============= */

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px !important;
    text-transform: none !important;
    color: var(--text-dim) !important;
    letter-spacing: 0 !important;
}

.toggle input {
    display: none;
}

.toggle-track {
    width: 34px;
    height: 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    position: relative;
    transition: background var(--transition), border-color var(--transition);
    flex-shrink: 0;
}

.toggle-track::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--transition), background var(--transition);
}

.toggle input:checked ~ .toggle-track {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.toggle input:checked ~ .toggle-track::after {
    transform: translateX(16px);
    background: var(--accent);
}

/* ============= CARDS ============= */

.cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-label {
    font-size: 12px;
    color: var(--text-dim);
}

.card-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-value.mono {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.card-row {
    display: flex;
    gap: 8px;
}

.card.compact {
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
}

.card.compact .card-value {
    font-size: 18px;
    font-weight: 700;
}

/* ============= SCORE RING ============= */

.score-block {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
}

.score-ring {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--surface-2);
    stroke-width: 5;
}

.score-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s;
}

.score-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.score-label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-status {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-top: 2px;
}

/* ============= SIDEBAR FOOTER ============= */

.sidebar-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-preview {
    background: var(--surface-2);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.badge-published {
    background: rgba(74, 222, 128, 0.12);
    color: var(--success);
    border: 1px solid rgba(74, 222, 128, 0.25);
}

.timing {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ============= MAIN CONTENT ============= */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.report-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.report-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-title-row h2 {
    font-size: 16px;
    font-weight: 600;
}

.status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status.idle {
    background: var(--surface-2);
    color: var(--text-dim);
}

.status.loading {
    background: rgba(108, 138, 255, 0.12);
    color: var(--accent);
    animation: pulse 1.5s ease infinite;
}

.status.done {
    background: rgba(74, 222, 128, 0.12);
    color: var(--success);
}

.status.error {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
}

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

/* ============= REPORT BODY ============= */

.report-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.placeholder {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-dim);
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder p {
    font-size: 15px;
    line-height: 1.5;
}

.placeholder-sub {
    font-size: 13px !important;
    color: var(--text-muted) !important;
    margin-top: 8px;
}

/* ============= REPORT SECTIONS ============= */

.report-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 760px;
}

.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeIn 0.4s ease;
}

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

.section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.section-emoji {
    font-size: 18px;
    line-height: 1;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text);
}

.section-body {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.section-body p {
    margin: 0 0 12px 0;
    line-height: 1.7;
}

.section-body p:last-child {
    margin-bottom: 0;
}

.section-body .line-key {
    color: var(--text-dim);
}

.section-body .line-val {
    color: var(--text);
    font-weight: 500;
}

.section.accent-green .section-head {
    border-bottom-color: rgba(74, 222, 128, 0.2);
}

.section.accent-blue .section-head {
    border-bottom-color: rgba(108, 138, 255, 0.2);
}

.section.accent-yellow .section-head {
    border-bottom-color: rgba(251, 191, 36, 0.2);
}

.section.accent-red .section-head {
    border-bottom-color: rgba(248, 113, 113, 0.2);
}

/* raw fallback */
.report-raw {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    font-family: 'Inter', monospace;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
    max-width: 760px;
}

/* ============= COPY BUTTON ============= */

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    margin-left: auto;
    cursor: pointer;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--text);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    border-color: var(--success);
    color: var(--success);
    background: rgba(74, 222, 128, 0.08);
}

/* ============= RESPONSIVE ============= */

@media (max-width: 800px) {
    .shell {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
    }

    .main-content {
        min-height: 50vh;
    }
}
