/* === Conexxus Advisory — ID2Bytes Brand === */

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1C1C1C;
    margin: 0;
}

h1, h2, h3, h4, h5 {
    color: #164373;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #164373;
}

a.brand-name {
    text-decoration: none;
    color: inherit;
}

a.brand-name:hover {
    color: rgba(255, 255, 255, 0.8);
}

.btn-primary {
    color: #fff;
    background-color: #164373;
    border-color: #164373;
}

.btn-primary:hover {
    background-color: #0f3058;
    border-color: #0f3058;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #164373;
}

/* === Landing Page === */

.landing .hero {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid #164373;
}

.landing .hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.landing .hero .lead {
    color: #3A3A3C;
    max-width: 600px;
    margin: 0 auto;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.module-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.module-card:not(.disabled) {
    display: flex;
    flex-direction: column;
}

.module-card:not(.disabled) p {
    flex: 1;
}

.module-card:hover:not(.disabled) {
    border-color: #164373;
}

.module-card.disabled {
    opacity: 0.6;
}

.steps {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.step {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.step-num {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #164373;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step p {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}

.zero-knowledge {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid #164373;
}

/* === Advisory Page — Wizard Flow === */

.wizard-container {
    max-width: 960px;
    margin: 0 auto;
}

.wizard-step-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.wizard-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 80px;
}

.step-circle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #dee2e6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background-color 0.2s, color 0.2s;
}

.wizard-step-item.active .step-circle {
    background: #164373;
    color: white;
}

.wizard-step-item.complete .step-circle {
    background: #198754;
    color: white;
}

.step-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    white-space: nowrap;
}

.wizard-step-item.active .step-label {
    color: #164373;
    font-weight: 600;
}

.wizard-step-item.complete .step-label {
    color: #198754;
}

.step-connector {
    width: 3rem;
    height: 2px;
    background: #dee2e6;
    margin: 0 0.5rem;
    margin-bottom: 1.25rem;
    transition: background-color 0.2s;
}

.step-connector.complete {
    background: #198754;
}

/* Step 1: Preset grid */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.preset-card {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.preset-card:hover {
    border-color: #164373;
    box-shadow: 0 2px 8px rgba(22, 67, 115, 0.12);
}

.preset-card h5 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.preset-card p {
    margin: 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.preset-card.blank {
    border-style: dashed;
    text-align: center;
    color: #6c757d;
}

.preset-card.blank:hover {
    border-color: #164373;
    color: #164373;
}

/* Step 2: Multi-column param grid */
.param-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
}

.param-grid .full-width {
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .param-grid {
        grid-template-columns: 1fr;
    }
}

/* Step 3: Trigger step */
.trigger-step {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

.trigger-step textarea {
    text-align: left;
    font-size: 1rem;
    min-height: 100px;
}

.trigger-step .hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* Step 4: Full-width output */
.analysis-step {
    max-width: 100%;
}

.analysis-step .chain-panels {
    max-width: 100%;
}

/* Wizard navigation */
.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.wizard-nav .btn {
    min-width: 120px;
}

.empty-state {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 3rem 2rem;
    text-align: center;
}

.auth-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

.auth-buttons .btn {
    padding: 0.5rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 6px;
    text-decoration: none;
}

/* === Parameter Form === */

.parameter-form .form-group {
    margin-bottom: 0.75rem;
}

.parameter-form label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #3A3A3C;
    margin-bottom: 0.2rem;
    display: block;
}

.parameter-form .form-control,
.parameter-form .form-select {
    font-size: 0.875rem;
    padding: 0.35rem 0.5rem;
}

.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-row .half {
    flex: 1;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #6c757d;
}

/* === Chain Panels === */

.chain-panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chain-panel {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.chain-panel.active {
    border-color: #164373;
    box-shadow: 0 0 0 1px #164373;
}

.chain-panel.complete {
    border-color: #198754;
}

.chain-panel.locked {
    opacity: 0.5;
}

.panel-header {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.875rem;
    font-weight: 600;
}

.chain-panel.active .panel-header {
    background: #164373;
    color: white;
    border-bottom-color: #164373;
}

.chain-panel.complete .panel-header {
    background: #d1e7dd;
    border-bottom-color: #198754;
}

.panel-body {
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.panel-body .waiting {
    color: #6c757d;
    font-style: italic;
}

.panel-body .locked-text {
    color: #adb5bd;
    font-style: italic;
}

.check-mark {
    color: #198754;
    font-weight: bold;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Chain Result (Markdown) === */

.chain-result-content {
    font-size: 0.875rem;
    line-height: 1.6;
}

.chain-result-content h1,
.chain-result-content h2,
.chain-result-content h3 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.chain-result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.8rem;
}

.chain-result-content th,
.chain-result-content td {
    border: 1px solid #dee2e6;
    padding: 0.35rem 0.5rem;
}

.chain-result-content th {
    background: #f8f9fa;
}

.chain-result-content ul, .chain-result-content ol {
    padding-left: 1.5rem;
}

.chain-result-content td:empty::after {
    content: "—";
    color: #adb5bd;
}

.chain-result-content strong {
    color: #164373;
}

/* === Profile Selector === */

.profile-selector {
    margin-bottom: 1.5rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.profile-card {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}

.profile-card:hover {
    border-color: #164373;
    box-shadow: 0 2px 8px rgba(22, 67, 115, 0.12);
}

.profile-card.active {
    border-color: #164373;
    background: #f0f5fb;
}

.profile-card h5 {
    margin: 0 0 0.25rem;
    font-size: 0.9rem;
}

.profile-card p {
    margin: 0;
    font-size: 0.75rem;
    color: #6c757d;
}

.profile-card.new-profile {
    border-style: dashed;
    text-align: center;
    color: #6c757d;
}

.profile-card.new-profile:hover {
    border-color: #164373;
    color: #164373;
}

.profile-card .btn-edit,
.profile-card .btn-delete {
    position: absolute;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-card:hover .btn-edit,
.profile-card:hover .btn-delete {
    opacity: 0.6;
}

.profile-card .btn-edit:hover,
.profile-card .btn-delete:hover {
    opacity: 1;
}

.profile-card .btn-edit {
    top: 4px;
    right: 24px;
    color: #164373;
}

.profile-card .btn-delete {
    top: 4px;
    right: 4px;
    color: #dc3545;
}

.alert-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.alert-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.profile-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.step1-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: #6c757d;
    font-size: 0.85rem;
}

.step1-divider::before,
.step1-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #dee2e6;
}

.step1-divider span {
    padding: 0 1rem;
}

.saved-simulations {
    margin-top: 1.5rem;
}

.saved-simulations h5 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.preset-card.saved {
    border-color: #b8daff;
    background: #f8fbff;
}

/* === Profile Editor === */

.profile-editor {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

/* === Decision Board === */

.decision-board {
    margin-top: 0.5rem;
}

/* Decision groups */

.decision-group {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.decision-group-header {
    padding: 0.6rem 0.75rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.decision-group-header:hover {
    background: #f0f2f5;
}

.decision-group-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.decision-group-toggle {
    font-size: 0.7rem;
    color: #6c757d;
    width: 0.9rem;
    flex-shrink: 0;
}

.decision-group-count {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

.decision-group-trigger {
    font-size: 0.8rem;
    color: #3A3A3C;
    margin-top: 0.25rem;
    padding-left: 1.4rem;
}

.decision-group-link {
    font-size: 0.75rem;
    padding: 0;
    margin-top: 0.15rem;
    margin-left: 1.4rem;
    text-decoration: none;
}

.decision-group-link:hover {
    text-decoration: underline;
}

.decision-group > .decision-list {
    border-top: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

.decision-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.decision-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    font-size: 0.85rem;
}

.decision-item.status-pending {
    border-left: 3px solid #ffc107;
}

.decision-item.status-approved {
    border-left: 3px solid #198754;
    background: #f8fff8;
}

.decision-item.status-deferred {
    border-left: 3px solid #6c757d;
    opacity: 0.7;
}

.decision-item.status-dismissed {
    border-left: 3px solid #dc3545;
    opacity: 0.5;
    text-decoration: line-through;
}

.decision-item.status-done {
    border-left: 3px solid #198754;
    opacity: 0.6;
    text-decoration: line-through;
}

.decision-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.decision-status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: #e9ecef;
    white-space: nowrap;
}

.decision-text {
    flex: 1;
}

.decision-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.decision-actions .btn {
    padding: 0.15rem 0.35rem;
    font-size: 0.75rem;
    min-width: auto;
}

.decision-add-form .form-control {
    font-size: 0.85rem;
}

/* === Extracted Actions (post-analysis) === */

.extracted-actions {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1.5rem;
    background: #f8fff8;
}

.extracted-actions h5 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.action-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    cursor: pointer;
}

.action-check input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

/* === Profile Page === */

.profile-page {
    max-width: 900px;
    margin: 0 auto;
}

.profile-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.profile-page-header h2 {
    margin-bottom: 0.25rem;
}

.profile-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: #164373;
}

.tab-btn.active {
    color: #164373;
    border-bottom-color: #164373;
    font-weight: 600;
}

.tab-badge {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-left: 0.35rem;
    vertical-align: top;
}

.tab-content {
    min-height: 200px;
}

/* Trajectory list */

.trajectory-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.trajectory-entry {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.trajectory-entry.expanded {
    border-color: #164373;
}

.trajectory-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.trajectory-header:hover {
    background: #f8f9fa;
}

.trajectory-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.trajectory-date {
    font-size: 0.75rem;
    color: #6c757d;
    margin-left: auto;
}

.trajectory-module {
    font-size: 0.75rem;
    font-weight: 600;
    color: #164373;
    background: #e7f1ff;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
}

.trajectory-decisions {
    font-size: 0.7rem;
    color: #fff;
    background: #164373;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
}

.trajectory-trigger {
    font-size: 0.85rem;
}

.trajectory-traj-link {
    font-size: 0.7rem;
    padding: 0;
    text-decoration: none;
    color: #164373;
    white-space: nowrap;
}

.trajectory-traj-link:hover {
    text-decoration: underline;
}

.trajectory-analysis {
    border-top: 1px solid #dee2e6;
    padding: 1rem;
    background: #fafbfc;
}

.trajectory-pass {
    margin-bottom: 1.5rem;
}

.trajectory-pass h5 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3A3A3C;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.35rem;
    margin-bottom: 0.75rem;
}

.trajectory-pass .chain-result-content {
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
}

.trajectory-result-meta {
    font-size: 0.75rem;
    text-align: right;
    margin-top: 0.5rem;
}

/* Profile summary grid */

.profile-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.summary-label {
    font-weight: 600;
    color: #3A3A3C;
}

@media (max-width: 700px) {
    .profile-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* === Profiles Listing Page === */

.profiles-page {
    max-width: 900px;
    margin: 0 auto;
}

.profile-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.profile-list-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.profile-list-card:hover {
    border-color: #164373;
    box-shadow: 0 2px 8px rgba(22, 67, 115, 0.12);
}

.profile-list-card h4 {
    margin-bottom: 0.25rem;
}

.profile-list-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.profile-list-meta .trajectory-count {
    color: #164373;
    font-weight: 500;
}

.profile-list-meta .decision-count {
    color: #dc3545;
    font-weight: 500;
}

/* === Vault Manager === */

.vault-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.vault-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
    border-radius: 4px;
}

.vault-item.selected {
    background: #e7f1ff;
}

.vault-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* === Inference Settings === */

.inference-settings .form-group {
    margin-bottom: 0.75rem;
}

.model-list {
    max-height: 120px;
    overflow-y: auto;
}

.settings-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === Form validation === */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* === Error UI === */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    background: #b32121;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #164373;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* === Narrative Trajectory Board === */

.trajectory-board {
    margin-top: 0.5rem;
}

.narr-trajectory-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    border-left: 3px solid #dee2e6;
}

.narr-trajectory-card.state-active {
    border-left-color: #164373;
}

.narr-trajectory-card.state-resting {
    border-left-color: #6c757d;
}

.narr-trajectory-card.state-settled {
    border-left-color: #198754;
}

.narr-trajectory-card-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.narr-trajectory-card-header:hover {
    background: #f8f9fa;
}

.narr-trajectory-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.narr-trajectory-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.narr-trajectory-state-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    white-space: nowrap;
}

.narr-trajectory-state-badge.state-active {
    background: #e7f1ff;
    color: #164373;
}

.narr-trajectory-state-badge.state-resting {
    background: #e9ecef;
    color: #6c757d;
}

.narr-trajectory-state-badge.state-settled {
    background: #d1e7dd;
    color: #198754;
}

.narr-trajectory-body {
    border-top: 1px solid #dee2e6;
    padding: 1rem;
    background: #fafbfc;
}

.narr-trajectory-section {
    margin-bottom: 1.25rem;
}

.narr-trajectory-section h5 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3A3A3C;
    margin-bottom: 0.5rem;
}

.narr-trajectory-starting-position {
    font-style: italic;
    padding: 0.5rem 0.75rem;
    background: #f0f5fb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.5;
}

.narr-trajectory-starting-position:hover {
    background: #e7f1ff;
}

/* Path timeline */

.narr-trajectory-path {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid #dee2e6;
}

.narr-trajectory-path-entry {
    padding: 0.5rem 0 0.5rem 0.75rem;
    font-size: 0.85rem;
    position: relative;
}

.narr-trajectory-path-entry::before {
    content: "";
    position: absolute;
    left: -1.35rem;
    top: 0.75rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #164373;
    border: 2px solid white;
}

.narr-trajectory-path-date {
    font-size: 0.7rem;
    color: #6c757d;
    margin-right: 0.5rem;
}

.narr-trajectory-path-source {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    background: #e9ecef;
    color: #6c757d;
    margin-right: 0.35rem;
    text-transform: uppercase;
}

.narr-trajectory-path-content {
    color: #3A3A3C;
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Unresolved questions */

.narr-trajectory-unresolved {
    list-style: none;
    padding: 0;
    margin: 0;
}

.narr-trajectory-unresolved li {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.narr-trajectory-unresolved li::before {
    content: "?";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: #ffc107;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    flex-shrink: 0;
}

/* Connected analyses */

.narr-trajectory-connected {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.narr-trajectory-connected-link {
    padding: 0.15rem 0.35rem;
    font-size: 0.8rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.narr-trajectory-connected-link:hover {
    text-decoration: underline;
}

/* Path entry links */

.narr-trajectory-path-link {
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: #164373;
}

.narr-trajectory-path-link:hover {
    text-decoration: underline;
}

.narr-trajectory-path-entry.linked {
    cursor: default;
}

/* Footer */

.narr-trajectory-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
    margin-top: 0.5rem;
}

.narr-trajectory-state-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.narr-trajectory-state-toggle .btn {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
}

/* Create form */

.narr-trajectory-create-form {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
}

.narr-trajectory-create-form h5 {
    margin-bottom: 0.75rem;
}

/* Add path entry form */

.narr-trajectory-add-path {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
}

/* === Decision Note & Resolution Form === */

.decision-text-block {
    flex: 1;
}

.decision-note {
    font-size: 0.75rem;
    font-style: italic;
    color: #6c757d;
    margin-top: 0.15rem;
    line-height: 1.3;
}

.decision-resolve-form {
    padding: 0.5rem 0.75rem 0.75rem;
    background: #f8f9fa;
    border-top: 1px dashed #dee2e6;
}

.decision-resolve-form .form-control {
    font-size: 0.8rem;
}

.decision-resolve-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.decision-resolve-actions .btn {
    font-size: 0.75rem;
}

/* === Tab badge variant (info) === */

/* === Onboarding Page === */

.onboarding-page {
    max-width: 560px;
    margin: 0 auto;
}

.onboarding-hero {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid #164373;
}

.onboarding-hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.onboarding-hero .lead {
    color: #3A3A3C;
    max-width: 480px;
    margin: 0 auto;
}

.onboarding-options {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.onboarding-tabs {
    display: flex;
    border-bottom: 2px solid #dee2e6;
}

.onboarding-tabs .tab-btn {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
}

.onboarding-form {
    padding: 1.5rem;
}

.onboarding-form .form-group {
    margin-bottom: 1rem;
}

.onboarding-form .form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3A3A3C;
    margin-bottom: 0.25rem;
    display: block;
}

.onboarding-form .btn-primary {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
}

.onboarding-hint {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.75rem;
    text-align: center;
}

.onboarding-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.onboarding-key-created {
    border: 2px solid #198754;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.onboarding-key-created h3 {
    color: #198754;
    margin-bottom: 0.5rem;
}

.key-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.key-display code {
    font-size: 0.95rem;
    word-break: break-all;
    color: #164373;
}

.key-warning {
    font-size: 0.8rem;
    color: #dc3545;
    font-weight: 500;
    margin-bottom: 1rem;
}

.btn-outline {
    border: 1px solid #164373;
    color: #164373;
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-outline:hover {
    background: #164373;
    color: white;
}

/* === Tab badge variant (info) === */

.tab-badge-info {
    background: #164373;
    color: white;
    border-radius: 50%;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-left: 0.35rem;
    vertical-align: top;
}

/* === Landing Page (GTM) === */

.landing-page {
    max-width: 100%;
}

/* Hero */

.lp-hero {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
    background: linear-gradient(180deg, #f0f5fb 0%, #fff 100%);
    border-bottom: 2px solid #164373;
}

.lp-hero-inner {
    max-width: 680px;
    margin: 0 auto;
}

.lp-hero h1 {
    font-size: 2.25rem;
    color: #164373;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.lp-subtitle {
    font-size: 1.1rem;
    color: #3A3A3C;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.lp-hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.lp-hero-note {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.75rem;
}

.btn-lg {
    padding: 0.65rem 2rem;
    font-size: 1rem;
    border-radius: 6px;
}

/* Compact hero for authenticated users */

.hero-compact {
    text-align: center;
    padding: 1.5rem 0 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #164373;
}

.hero-compact h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.hero-compact .lead {
    color: #6c757d;
    margin: 0;
}

/* Scenario cards (authenticated homepage) */

.scenario-section {
    margin-bottom: 2rem;
}

.scenario-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e9ecef;
}

.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.scenario-card {
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-decoration: none;
    color: #1C1C1C;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.scenario-card:hover {
    border-color: #164373;
    box-shadow: 0 2px 8px rgba(22, 67, 115, 0.1);
    text-decoration: none;
    color: #1C1C1C;
}

.scenario-card h5 {
    font-size: 0.9rem;
    margin: 0 0 0.25rem;
}

.scenario-card p {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
    line-height: 1.3;
}

/* Sections */

.lp-section {
    padding: 2.5rem 1rem;
    max-width: 960px;
    margin: 0 auto;
}

.lp-section-alt {
    background: #f8f9fa;
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

.lp-section-alt > h2,
.lp-section-alt > p,
.lp-section-alt > .lp-steps,
.lp-section-alt > .lp-modules,
.lp-section-alt > .lp-api-info {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.lp-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Problem section */

.lp-problem-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.lp-problem-item {
    text-align: center;
    padding: 1rem;
}

.lp-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.lp-problem-item h4 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.lp-problem-item p {
    font-size: 0.9rem;
    color: #3A3A3C;
    margin: 0;
}

.lp-problem-conclusion {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    color: #3A3A3C;
    font-size: 0.95rem;
    line-height: 1.6;
    border-top: 1px solid #dee2e6;
    padding-top: 1.25rem;
}

/* Steps */

.lp-steps {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.lp-step {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    min-width: 220px;
}

.lp-step-num {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #164373;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.lp-step strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #164373;
}

.lp-step p {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}

/* Features */

.lp-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.lp-feature {
    padding: 1.25rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.lp-feature:hover {
    border-color: #164373;
}

.lp-feature h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.lp-feature p {
    font-size: 0.9rem;
    color: #3A3A3C;
    margin: 0;
    line-height: 1.5;
}

/* Modules */

.lp-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.lp-module {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
    border-left: 3px solid #164373;
}

.lp-module h4 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.lp-module p {
    font-size: 0.875rem;
    color: #3A3A3C;
    margin: 0;
    line-height: 1.5;
}

.lp-module-soon {
    border-left-color: #dee2e6;
    border-style: dashed;
    opacity: 0.75;
}

/* Pricing */

.lp-pricing-intro {
    text-align: center;
    color: #3A3A3C;
    margin-bottom: 2rem;
}

.lp-pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: start;
}

.lp-plan {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
}

.lp-plan-featured {
    border-color: #164373;
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(22, 67, 115, 0.12);
}

.lp-plan-badge {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: #164373;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.75rem;
    border-radius: 3px;
    white-space: nowrap;
}

.lp-plan-header {
    margin-bottom: 1rem;
    text-align: center;
}

.lp-plan-header h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.lp-plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
}

.lp-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #164373;
}

.lp-price-period {
    font-size: 0.85rem;
    color: #6c757d;
}

.lp-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex: 1;
}

.lp-plan-features li {
    font-size: 0.85rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f0f0f0;
    color: #3A3A3C;
}

.lp-plan-features li::before {
    content: "\2713 ";
    color: #198754;
    font-weight: bold;
    margin-right: 0.35rem;
}

.lp-plan-cta {
    text-align: center;
    display: block;
    width: 100%;
}

/* API section */

.lp-api-info p {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 1.5rem;
    color: #3A3A3C;
    line-height: 1.6;
}

.lp-api-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.lp-api-features > div {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.lp-api-features strong {
    display: block;
    color: #164373;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.lp-api-features p {
    font-size: 0.85rem;
    text-align: left;
    margin: 0;
}

/* CTA section */

.lp-cta-section {
    text-align: center;
    padding: 3rem 1rem;
}

.lp-cta-section h2 {
    margin-bottom: 0.75rem;
}

.lp-cta-section p {
    max-width: 500px;
    margin: 0 auto 1.5rem;
    color: #3A3A3C;
}

/* Disclaimer */

.lp-disclaimer {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
    border-top: 1px solid #dee2e6;
}

.lp-disclaimer a {
    color: #6c757d;
}

/* Responsive */

@media (max-width: 900px) {
    .lp-pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .lp-hero h1 {
        font-size: 1.75rem;
    }

    .lp-problem-grid {
        grid-template-columns: 1fr;
    }

    .lp-features {
        grid-template-columns: 1fr;
    }

    .lp-pricing-grid {
        grid-template-columns: 1fr;
    }

    .lp-api-features {
        grid-template-columns: 1fr;
    }

    .lp-steps {
        flex-direction: column;
    }
}
