:root {
    color-scheme: light dark;
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1a1d21;
    --muted: #5f6672;
    --border: #dde1e6;
    --accent: #212d6f;
    --accent-teal: #167a82;
    --header-bg: #161d4d;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --card: #1e2126;
        --text: #eceef1;
        --muted: #9aa2ad;
        --border: #33373f;
        --accent: #6b80e0;
        --accent-teal: #4fd3db;
        --header-bg: #161d4d;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--muted);
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.mode-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem;
    margin-bottom: 1.5rem;
    gap: 0.25rem;
}

.toggle-option {
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--muted);
}

.toggle-option.active {
    background: var(--accent);
    color: #fff;
}

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

fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1rem 0.25rem;
    margin: 0 0 1.25rem;
}

legend {
    padding: 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    padding: 0.55rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 1rem;
}

button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

button:hover { opacity: 0.92; }

.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fbe4e4;
    color: #7a1f1f;
    border: 1px solid #e8b4b4;
}

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

.table-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.table-actions {
    display: flex;
    gap: 1rem;
}

.btn-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.btn-link:hover { text-decoration: underline; }

.btn-danger { color: #a11c1c; }

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.severity-badge {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.severity-badge.severity-none,
.severity-badge.severity-low { background: #d7f0f1; color: #0f5f65; }
.severity-badge.severity-medium { background: #fff2cc; color: #8a6600; }
.severity-badge.severity-high { background: #ffe1cc; color: #a34a00; }
.severity-badge.severity-critical { background: #fbdada; color: #a11c1c; }

code {
    font-size: 0.85em;
}

.hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 0;
}

.wizard-metric {
    margin-bottom: 0.5rem;
}

.wizard-q {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--border);
}

.wizard-q label {
    font-size: 0.88rem;
}

.wizard-q select {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    max-width: 420px;
}

.wizard-result {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 1rem;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
}

.btn-secondary:hover { opacity: 0.85; }

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.alert-pips {
    background: #fff2cc;
    color: #8a6600;
    border: 1px solid #f0d98c;
}

.pips-flag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #fff2cc;
    color: #8a6600;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: help;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--muted);
}

.vuln-id-row {
    display: flex;
    gap: 0.6rem;
}

.vuln-id-row input {
    flex: 1;
}

.vuln-id-row .btn-secondary {
    margin-bottom: 0;
    white-space: nowrap;
}

/* Live score preview */
.preview-panel {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    margin-bottom: 1.25rem;
    min-height: 2.4rem;
}

.preview-panel.preview-ready {
    border-color: var(--accent-teal);
}

.preview-placeholder {
    color: var(--muted);
    font-size: 0.85rem;
}

.preview-score {
    font-size: 1.6rem;
    font-weight: 700;
}

.preview-vector {
    font-size: 0.8rem;
    color: var(--muted);
    overflow-x: auto;
}

/* Wizard progress */
.wizard-progress-track {
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.wizard-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s ease;
}

#wizard-progress-text {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

/* Status pills in fieldset legends */
.status-pill {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    vertical-align: middle;
}

.status-pill.status-pending {
    background: var(--border);
    color: var(--muted);
}

.status-pill.status-resolved {
    background: #d7f0f1;
    color: #0f5f65;
}

/* Guidance tooltip next to CIA questions */
.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05rem;
    height: 1.05rem;
    margin-left: 0.35rem;
    border-radius: 50%;
    background: var(--border);
    color: var(--muted);
    font-size: 0.68rem;
    font-style: italic;
    font-weight: 700;
    font-family: Georgia, serif;
    cursor: help;
    vertical-align: middle;
}

.info-tip .tip-content {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.4rem);
    transform: translateX(-50%);
    width: 260px;
    padding: 0.6rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--muted);
    z-index: 10;
    cursor: default;
}

.info-tip:hover .tip-content,
.info-tip:focus .tip-content,
.info-tip:focus-within .tip-content {
    display: block;
}

.info-tip .tip-content p {
    margin: 0.3rem 0;
}

.info-tip .tip-content strong {
    color: var(--text);
}

/* Collapsible CIA categories, two per row */
#wizard-CIA {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
    align-items: start;
}

@media (max-width: 680px) {
    #wizard-CIA {
        grid-template-columns: 1fr;
    }
}

#wizard-CIA #cia-result {
    grid-column: 1 / -1;
}

.cia-category {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 1rem;
    margin-bottom: 1rem;
}

.cia-category summary {
    padding: 0.8rem 0;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.cia-category.resolved summary {
    color: var(--accent-teal);
}

.cia-category.resolved summary::before {
    content: "✓ ";
}

.cia-category-body {
    padding-bottom: 0.8rem;
}

/* Header / branding: navy band, logo and title/subtitle share one row */
.site-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: -2.5rem -1.25rem 1.5rem;
    padding: 1.5rem 1.25rem;
    background: var(--header-bg);
    border-radius: 0 0 10px 10px;
}

.site-header .logo {
    height: 4.25rem;
    width: auto;
    flex-shrink: 0;
}

.site-header-text {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.site-header h1 {
    margin: 0 0 0.2rem;
    color: #fff;
}

.site-header .subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
}

.mode-description {
    margin-bottom: 0.75rem;
}

.mode-description p {
    color: var(--muted);
    font-size: 0.88rem;
    margin: 0;
}

.mode-description a {
    color: var(--accent);
}

/* Footer */
.site-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.site-footer .disclaimer {
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--muted);
    max-width: 760px;
    margin: 0 0 0.9rem;
}

.footer-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0;
}

.footer-meta a {
    color: var(--accent);
    text-decoration: none;
}

.footer-meta a:hover {
    text-decoration: underline;
}

/* Placeholder / coming-soon page */
.coming-soon {
    text-align: center;
    padding: 3.5rem 1.5rem;
}

.coming-soon p {
    font-size: 1.05rem;
    color: var(--muted);
    margin: 0 0 1.5rem;
}

.coming-soon .btn-cta {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1.4rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.coming-soon .btn-cta:hover {
    opacity: 0.9;
}
