:root {
    --primary: #0073bb;
    --primary-dark: #005a94;
    --success: #1d8102;
    --warning: #ff9900;
    --danger: #d13212;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #16191f;
    --text-muted: #687078;
    --border: #d5dbdb;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 { font-size: 1.8rem; color: var(--primary); }
header .subtitle { color: var(--text-muted); }

.screen { display: none; }
.screen.active { display: block; }

h2 { margin-bottom: 1rem; font-size: 1.4rem; }

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}

.form-group small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-primary, .btn-secondary {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:focus { outline: 2px solid var(--primary-dark); outline-offset: 2px; }

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover { background: #f0f8ff; }

.error-msg {
    color: var(--danger);
    margin-top: 0.5rem;
    min-height: 1.2rem;
}

/* Progress */
.progress-bar {
    background: var(--border);
    border-radius: var(--radius);
    height: 12px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
    border-radius: var(--radius);
}

/* Area grid */
.area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.area-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.area-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.area-card .status { font-size: 0.9rem; color: var(--text-muted); }
.area-card .score { font-size: 1.5rem; font-weight: 700; }

.area-card.complete { border-left: 4px solid var(--success); }
.area-card.pending { border-left: 4px solid var(--border); }
.area-card.needs-input { border-left: 4px solid var(--warning); }
.area-card.scanning { border-left: 4px solid var(--primary); }

/* Results */
.results-header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.results-header .pillar-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
}

.results-header .band { font-size: 1.2rem; color: var(--text-muted); }

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.result-card h3 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.result-card .level { font-size: 0.85rem; color: var(--text-muted); }
.result-card .bar-container {
    background: var(--border);
    border-radius: 4px;
    height: 8px;
    margin-top: 0.5rem;
}

.result-card .bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

#results-recommendations {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

#results-recommendations h3 { margin-bottom: 0.5rem; }
#results-recommendations ul { padding-left: 1.2rem; }
#results-recommendations li { margin-bottom: 0.5rem; }

/* Human input questions */
.question-group {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.question-group h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.question-group label {
    display: block;
    padding: 0.4rem 0;
    cursor: pointer;
}

.question-group input[type="radio"] { margin-right: 0.5rem; }

/* Pillar label in results */
.results-header .pillar-label {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.results-header .pillar-score .score-unit {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-muted);
}

.results-header .score-explanation {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0.8rem auto 0;
    line-height: 1.5;
    text-align: left;
}

.color-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Pillar context label on progress screen */
.pillar-context {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

/* Clickable result cards */
.result-card.clickable {
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.result-card.clickable:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.result-card.clickable:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.result-card .expand-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.3rem;
}

.result-card .card-detail {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.card-detail h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* Maturity level breakdown */
.level-list {
    margin-bottom: 1rem;
}

.level-row {
    padding: 0.3rem 0;
    font-size: 0.85rem;
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.level-row.achieved { color: var(--success); }
.level-row.current { color: var(--primary); font-weight: 600; }
.level-row.future { color: var(--text-muted); }

.level-marker { width: 1.2rem; text-align: center; flex-shrink: 0; }
.level-num { font-weight: 600; width: 1.5rem; flex-shrink: 0; }
.level-label { font-weight: 600; min-width: 5rem; }
.level-desc { font-weight: 400; }

/* Improvement steps */
.improvement-steps {
    margin-top: 0.5rem;
}

.improvement-steps ol {
    padding-left: 1.2rem;
    font-size: 0.85rem;
}

.improvement-steps li {
    margin-bottom: 0.3rem;
    color: var(--text);
}

@media (max-width: 600px) {
    .area-grid, .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Detailed Maturity Metrics */
.detailed-metrics {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.btn-metrics {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-metrics:hover {
    background: var(--primary-dark);
}

.metrics-panel {
    margin-top: 1rem;
}

.metrics-panel h4 {
    margin: 1rem 0 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.metrics-table th {
    text-align: left;
    padding: 0.4rem 0.6rem;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-muted);
}

.metrics-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.mini-bar {
    width: 100%;
    height: 8px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.signal-yes { color: var(--success); font-weight: 700; }
.signal-no { color: var(--danger); font-weight: 700; }

.signal-row-yes td { background: #f0faf0; }
.signal-row-no td { background: #fef6f4; }

.pipeline-list {
    list-style: disc;
    padding-left: 1.5rem;
    font-size: 0.85rem;
}

.pipeline-list li {
    margin-bottom: 0.25rem;
}

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

/* DORA Readiness Panel */
.dora-readiness {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.dora-readiness h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}
.dora-intro {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}
.dora-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}
.dora-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
}
.dora-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}
.dora-card-header h4 {
    font-size: 0.95rem;
    margin: 0;
}
.dora-level {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}
.dora-high { background: #e6f4ea; color: #1d8102; }
.dora-medium { background: #fff3e0; color: #b36b00; }
.dora-low { background: #fde8e8; color: #d13212; }
.dora-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.dora-bar-container {
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    margin-bottom: 0.6rem;
    overflow: hidden;
}
.dora-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.dora-signals {
    font-size: 0.8rem;
}
.dora-signal-row {
    padding: 2px 0;
}
.dora-signal-row.signal-row-yes { color: var(--text); }
.dora-signal-row.signal-row-no { color: var(--text-muted); }


/* Results two-column layout */
.results-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.results-main {
    flex: 1;
    min-width: 0;
}
.pillar-sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.pillar-sidebar h3 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    text-align: center;
}
.sidebar-tile {
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}
.sidebar-tile:last-child {
    margin-bottom: 0;
}
.sidebar-tile.active {
    background: #f0f8ff;
    border-color: var(--primary);
    border-width: 2px;
}
.sidebar-tile.upcoming {
    background: #f9f9f9;
    opacity: 0.55;
}
.sidebar-tile-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.15rem;
}
.sidebar-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}
.sidebar-tile.active .sidebar-num {
    color: var(--primary);
    background: #dceefb;
}
.sidebar-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}
.sidebar-tile.upcoming .sidebar-name {
    color: var(--text-muted);
}
.sidebar-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}
.sidebar-score {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
}
.active-score {
    background: #e6f4ea;
    color: #1d8102;
}
.upcoming-score {
    background: #e8e8e8;
    color: #999;
    font-weight: 500;
}

/* Responsive: stack on small screens */
@media (max-width: 800px) {
    .results-layout {
        flex-direction: column;
    }
    .pillar-sidebar {
        width: 100%;
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.5rem;
    }
    .pillar-sidebar h3 {
        grid-column: 1 / -1;
    }
}
/* ===== Screen 6: Improvement Roadmap ===== */

/* Two-column layout: cards on left, impact summary on right */
.roadmap-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.roadmap-items {
    flex: 1;
    min-width: 0;
}

/* Roadmap card — matches result-card style with left accent border */
.roadmap-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--border);
    transition: border-color 0.2s, background 0.2s;
}

.roadmap-card.selected {
    border-left-color: var(--primary);
    background: #f0f8ff;
}

.roadmap-card.disabled {
    background: #f9f9f9;
    opacity: 0.6;
}

.roadmap-card-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.roadmap-checkbox {
    margin-right: 0.6rem;
}

.roadmap-levels {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.roadmap-description {
    font-size: 0.9rem;
    margin-top: 0.4rem;
    line-height: 1.5;
}

.roadmap-effort {
    font-weight: 600;
    color: var(--primary);
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

.roadmap-delta {
    font-weight: 600;
    color: var(--success);
    margin-top: 0.2rem;
    font-size: 0.9rem;
}

.roadmap-max-level {
    font-style: italic;
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

/* Impact Summary — sticky panel on right */
.impact-summary {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.impact-summary h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.impact-score,
.impact-band,
.impact-effort,
.impact-benefits {
    margin-bottom: 0.6rem;
}

.impact-label {
    font-weight: 600;
}

.impact-current {
    color: var(--text-muted);
}

.impact-projected {
    color: var(--success);
    font-weight: 600;
}

.impact-no-change {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.6rem;
}

.impact-benefits ul {
    list-style: disc;
    padding-left: 1.2rem;
    margin-top: 0.3rem;
}

.impact-benefits li {
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

/* "Generate Improvement Roadmap" button spacing */
#btn-roadmap {
    margin-top: 1.5rem;
}

/* Responsive: stack on small screens */
@media (max-width: 800px) {
    .roadmap-layout {
        flex-direction: column;
    }
    .impact-summary {
        width: 100%;
        position: static;
    }
}

.impact-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.3rem;
    line-height: 1.4;
}
/* Form sections */
.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type {
    border-bottom: none;
}
.form-section-title {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

/* Repo entries */
.repo-entry {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    margin-bottom: 0.75rem;
}
.repo-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.repo-entry-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.repo-primary-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: #dceefb;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}
.btn-remove-repo {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
}
.btn-remove-repo:hover {
    color: #a00;
}
.btn-add-repo {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}