:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9dee7;
    --accent: #0b67d1;
    --accent-strong: #084f9d;
    --ok: #147d4d;
    --warn: #9a6400;
    --danger: #b42318;
    --soft-ok: #e8f7ef;
    --soft-warn: #fff4d6;
    --soft-danger: #fde8e7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

button,
input {
    font: inherit;
}

button {
    min-height: 38px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 600;
}

button:hover:not(:disabled) {
    background: var(--accent-strong);
}

button:disabled {
    border-color: #c7ced9;
    background: #d7dde6;
    color: #778396;
    cursor: not-allowed;
}

.secondary-button,
.ghost-button {
    border-color: var(--line);
    background: #fff;
    color: var(--accent);
}

.secondary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
    border-color: var(--accent);
    background: #eef5ff;
    color: var(--accent-strong);
}

.ghost-button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

input {
    min-height: 38px;
    width: 150px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 10px;
    background: #fff;
}

label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.app-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0;
}

.topbar p {
    margin: 2px 0 0;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    background: #e9eef8;
    color: #26476f;
    padding: 0 12px;
    font-weight: 700;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 14px;
    margin-bottom: 14px;
}

.panel h2 {
    margin: 0 0 10px;
    font-size: 16px;
    letter-spacing: 0;
}

.control-row {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
}

.flow-panel {
    padding: 10px;
}

.flow-stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.flow-step {
    display: flex;
    align-items: center;
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 8px;
    gap: 8px;
}

.flow-step.complete {
    border-color: #b8e2c9;
    background: var(--soft-ok);
}

.flow-step.attention,
.flow-step.ready {
    border-color: #f1c36d;
    background: var(--soft-warn);
}

.flow-step.blocked,
.flow-step.locked {
    border-color: #f0b8b4;
    background: var(--soft-danger);
}

.flow-step.pending {
    background: #f7f9fc;
}

.flow-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e6edf7;
    color: #344054;
    font-weight: 800;
}

.flow-step-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.flow-step-copy strong,
.flow-step-copy em {
    overflow-wrap: anywhere;
}

.flow-step-copy em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.summary-card {
    min-height: 86px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.summary-card span,
.summary-card em {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    overflow-wrap: anywhere;
}

.summary-card strong {
    display: block;
    margin: 4px 0;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.template-confirmation {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 12px;
    margin: 0 0 14px;
}

.template-confirmation.needs-confirmation {
    border-color: #f1c36d;
    background: var(--soft-warn);
}

.template-confirmation.confirmed {
    border-color: #b8e2c9;
    background: var(--soft-ok);
}

.template-confirmation-header,
.template-confirmation-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.template-confirmation-header span,
.template-confirmation-header strong,
.template-confirmation-header em,
.template-confirmation-metric span,
.template-confirmation-metric strong {
    display: block;
    overflow-wrap: anywhere;
}

.template-confirmation-header span,
.template-confirmation-header em,
.template-confirmation-metric span,
.template-confirmation-guardrails,
.muted {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.template-confirmation-header strong,
.template-confirmation-metric strong {
    margin-top: 2px;
    font-size: 16px;
    line-height: 1.25;
}

.template-confirmation-status {
    flex: 0 0 auto;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: 3px 8px;
    font-weight: 700;
    white-space: nowrap;
}

.template-confirmation-links {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.template-confirmation-links a {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.template-confirmation-guardrails {
    margin: 0;
    padding-left: 18px;
}

.template-confirmation button {
    justify-self: start;
}

.status,
.message {
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 10px;
}

.status.neutral,
.message.info {
    background: #eef2f7;
    color: #344054;
}

.status.ok,
.message.ok {
    background: var(--soft-ok);
    color: var(--ok);
}

.status.warn,
.message.warn {
    background: var(--soft-warn);
    color: var(--warn);
}

.status.error,
.message.error {
    background: var(--soft-danger);
    color: var(--danger);
}

.message-list {
    display: grid;
    gap: 8px;
}

.message ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.message li {
    margin: 3px 0;
    overflow-wrap: anywhere;
}

.attention-acknowledgement {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border: 1px solid #f4c167;
    border-radius: 6px;
    background: #fff8e7;
    color: var(--warn);
    padding: 10px 12px;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.4;
}

.attention-acknowledgement input {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
}

.attention-acknowledgement span {
    overflow-wrap: anywhere;
}

.critical-input-editor {
    display: grid;
    gap: 10px;
}

.critical-input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.critical-input-toolbar strong,
.critical-input-toolbar span {
    display: block;
    overflow-wrap: anywhere;
}

.critical-input-toolbar span {
    color: var(--muted);
    font-size: 12px;
}

.critical-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.critical-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.critical-input-row.complete {
    border-color: #b8e2c9;
    background: var(--soft-ok);
}

.critical-input-row.attention {
    border-color: #f1c36d;
    background: var(--soft-warn);
}

.critical-input-row strong,
.critical-input-row span,
.critical-input-row em {
    display: block;
    overflow-wrap: anywhere;
}

.critical-input-row span,
.critical-input-row em,
.critical-input-actions span {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.critical-input-row label {
    text-transform: none;
}

.critical-input-row input {
    width: 100%;
}

.critical-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.critical-input-actions span {
    flex: 1 1 220px;
}

.role-assignment-editor {
    display: grid;
    gap: 10px;
}

.role-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.role-editor-toolbar strong,
.role-editor-toolbar span {
    display: block;
    overflow-wrap: anywhere;
}

.role-editor-toolbar span {
    color: var(--muted);
    font-size: 12px;
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.role-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.role-row.complete {
    border-color: #b8e2c9;
    background: var(--soft-ok);
}

.role-row.attention {
    border-color: #f1c36d;
    background: var(--soft-warn);
}

.role-row strong,
.role-row span,
.role-row em {
    display: block;
    overflow-wrap: anywhere;
}

.role-row span,
.role-row em,
.role-actions span {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.role-row label {
    text-transform: none;
}

.role-row input {
    width: 100%;
}

.role-actions {
    display: flex;
    align-items: center;
    grid-column: 1 / -1;
    gap: 8px;
    flex-wrap: wrap;
}

.role-actions span {
    flex: 1 1 180px;
}

.deadline-editor {
    display: grid;
    gap: 10px;
}

.deadline-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.deadline-editor-toolbar strong,
.deadline-editor-toolbar span {
    display: block;
    overflow-wrap: anywhere;
}

.deadline-editor-toolbar span {
    color: var(--muted);
    font-size: 12px;
}

.deadline-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.deadline-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 154px;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.deadline-row.complete {
    border-color: #b8e2c9;
    background: var(--soft-ok);
}

.deadline-row.attention {
    border-color: #f1c36d;
    background: var(--soft-warn);
}

.deadline-row strong,
.deadline-row span,
.deadline-row em {
    display: block;
    overflow-wrap: anywhere;
}

.deadline-row span,
.deadline-row em,
.deadline-actions span {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.deadline-row label {
    text-transform: none;
}

.deadline-row input {
    width: 100%;
}

.deadline-actions {
    display: flex;
    align-items: center;
    grid-column: 1 / -1;
    gap: 8px;
    flex-wrap: wrap;
}

.deadline-actions span {
    flex: 1 1 180px;
}

.preview-grid {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 8px 12px;
}

.preview-grid dt {
    color: var(--muted);
    font-weight: 700;
}

.preview-grid dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.preview-empty {
    color: var(--muted);
}

.department-preview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.department-preview-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.department-preview-card header,
.department-preview-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.department-preview-card header span,
.department-preview-card header strong,
.department-preview-card header em,
.department-preview-meta span {
    display: block;
    overflow-wrap: anywhere;
}

.department-preview-card header span,
.department-preview-card header em,
.department-preview-meta span,
.package-detail span,
.package-detail em,
.package-detail small,
.package-detail-more {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.department-preview-card header strong {
    font-size: 15px;
    line-height: 1.25;
}

.department-preview-meta {
    margin: 8px 0;
}

.package-detail-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.package-detail {
    border-top: 1px solid var(--line);
    padding-top: 6px;
}

.package-detail strong,
.package-detail span,
.package-detail em,
.package-detail small {
    display: block;
    overflow-wrap: anywhere;
}

.package-detail strong {
    font-size: 13px;
}

.package-detail-more {
    border-top: 1px solid var(--line);
    padding-top: 6px;
    font-weight: 700;
}

.task-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.task-item {
    min-height: 148px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    background: #fbfcfe;
}

.task-item strong {
    display: block;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.task-item span {
    color: var(--muted);
}

.package-preview {
    display: grid;
    gap: 3px;
    margin: 8px 0 0;
    padding-left: 18px;
    color: #344054;
    font-size: 13px;
}

.package-preview li {
    overflow-wrap: anywhere;
}

.progress-list {
    margin: 0;
    padding-left: 22px;
}

.progress-list li {
    margin: 6px 0;
}

.result-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.outcome-box {
    display: grid;
    gap: 4px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
    margin-bottom: 10px;
    color: var(--muted);
}

.outcome-box strong,
.outcome-box span {
    overflow-wrap: anywhere;
}

.outcome-box.complete {
    border-color: #b8e2c9;
    background: var(--soft-ok);
    color: var(--ok);
}

.outcome-box.attention {
    border-color: #f1c36d;
    background: var(--soft-warn);
    color: var(--warn);
}

.result-links a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--accent);
    padding: 0 10px;
    text-decoration: none;
    font-weight: 700;
}

.launch-result-summary {
    display: grid;
    gap: 10px;
    color: var(--text);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 10px;
}

.launch-result-summary.complete .result-header {
    border-color: #b8e2c9;
}

.launch-result-summary.attention .result-header {
    border-color: #f1c36d;
}

.result-header span,
.result-header strong,
.result-header a {
    overflow-wrap: anywhere;
}

.result-header span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.result-header strong {
    display: block;
    font-size: 16px;
}

.result-project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    padding: 0 12px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.result-project-link.muted {
    border-color: var(--line);
    color: var(--muted);
}

.result-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.result-metric {
    min-height: 82px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

.result-metric span,
.result-metric strong,
.result-metric em {
    display: block;
    overflow-wrap: anywhere;
}

.result-metric span,
.result-metric em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.result-metric strong {
    margin: 2px 0;
    font-size: 22px;
    line-height: 1.2;
}

.result-task-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.result-task-links a,
.result-task-links > div {
    display: grid;
    gap: 2px;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 8px 10px;
    color: var(--text);
    text-decoration: none;
}

.result-task-links a:hover {
    border-color: var(--accent);
    background: #eef5ff;
}

.result-task-links strong,
.result-task-links span {
    overflow-wrap: anywhere;
}

.result-task-links span,
.result-empty {
    color: var(--muted);
    font-size: 12px;
}

.result-attention {
    border: 1px solid #f1c36d;
    border-radius: 8px;
    background: var(--soft-warn);
    padding: 10px;
}

.result-attention.complete {
    border-color: #b8e2c9;
    background: var(--soft-ok);
    color: var(--ok);
}

.result-attention strong,
.result-attention span,
.result-attention em {
    display: block;
    overflow-wrap: anywhere;
}

.result-attention ul {
    display: grid;
    gap: 6px;
    margin: 8px 0 0;
    padding-left: 18px;
}

.result-attention li {
    overflow-wrap: anywhere;
}

.result-attention em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.result-next {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.result-next-steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 22px;
}

.result-next-steps li {
    overflow-wrap: anywhere;
}

.result-next-steps strong,
.result-next-steps span,
.result-next-steps a {
    display: block;
    overflow-wrap: anywhere;
}

.result-next-steps a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.result-next-steps span {
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 760px) {
    .layout,
    .task-list,
    .role-grid,
    .critical-input-grid,
    .deadline-grid,
    .flow-stepper,
    .summary-grid,
    .department-preview,
    .result-metrics,
    .result-task-links {
        grid-template-columns: 1fr;
    }

    .critical-input-toolbar,
    .role-editor-toolbar,
    .deadline-editor-toolbar,
    .role-row,
    .deadline-row {
        grid-template-columns: 1fr;
    }

    .critical-input-toolbar,
    .role-editor-toolbar,
    .deadline-editor-toolbar,
    .template-confirmation-header,
    .template-confirmation-body {
        align-items: stretch;
        flex-direction: column;
    }

    .template-confirmation-links {
        justify-content: flex-start;
    }

    .department-preview-card header,
    .department-preview-meta {
        flex-direction: column;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .result-header {
        align-items: stretch;
        flex-direction: column;
    }

    .result-project-link {
        width: 100%;
        white-space: normal;
    }

    input,
    button {
        width: 100%;
    }

    .control-row {
        align-items: stretch;
    }
}
