:root {
    --brand-blue: #1f5c9d;
    --sidebar: #22292f;
    --sidebar-active: #0f151a;
    --line: #dde5ee;
    --soft-line: #edf2f7;
    --page-bg: #eef3f7;
    --text: #1d2731;
    --muted: #687789;
    --teal: #58c6c6;
    --blue: #67a9f5;
    --green: #64d286;
    --red: #ff8c8c;
    --ui-font: Inter, "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
    --button-font: Inter, "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
}

html,
body {
    background: var(--page-bg);
    color: var(--text);
    font-family: var(--ui-font);
    font-size: 13px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a,
.btn-link {
    color: #1d67b1;
}

button {
    font: inherit;
}

input[type="number"],
.number-input,
.number-cell,
td.number-cell,
th.number-cell {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.btn-primary {
    background-color: var(--brand-blue);
    border-color: #184c84;
    color: #fff;
}

.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.22rem #78aee8;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.workspace {
    background: #fff;
    min-height: calc(100vh - 36px);
}

.auth-route-loading {
    align-items: center;
    background: #eef3f7;
    color: #1f5c9d;
    display: flex;
    gap: 12px;
    justify-content: center;
    min-height: 100vh;
}

.auth-route-spinner {
    animation: authRouteSpin 0.8s linear infinite;
    border: 2px solid rgba(31, 92, 157, 0.2);
    border-radius: 999px;
    border-top-color: #1f5c9d;
    display: inline-block;
    height: 22px;
    width: 22px;
}

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

.access-denied-page {
    align-items: center;
    display: flex;
    justify-content: center;
    padding: 24px;
}

.access-denied-panel {
    align-items: center;
    border: 1px solid #d8e4f2;
    display: grid;
    gap: 8px;
    justify-items: center;
    max-width: 420px;
    padding: 30px;
    text-align: center;
}

.access-denied-panel strong {
    color: #17395f;
    font-size: 20px;
}

.access-denied-panel p {
    color: #63758a;
    margin: 0;
}

.access-denied-icon {
    background: #1f5c9d;
    display: inline-block;
    height: 32px;
    width: 32px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a5 5 0 0 0-5 5v3H5v12h14V10h-2V7a5 5 0 0 0-5-5zm-3 8V7a3 3 0 0 1 6 0v3H9zm2 5h2v3h-2v-3z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a5 5 0 0 0-5 5v3H5v12h14V10h-2V7a5 5 0 0 0-5-5zm-3 8V7a3 3 0 0 1 6 0v3H9zm2 5h2v3h-2v-3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.workspace-toolbar {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 18px;
}

.view-path {
    align-items: center;
    display: flex;
    gap: 10px;
    min-width: 0;
}

.view-path a,
.view-path button {
    background: transparent;
    border: 0;
    color: #2a6cb5;
    font-weight: 600;
    padding: 0;
    text-decoration: none;
}

.view-path span {
    color: #a0adba;
}

.toolbar-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.scale-control {
    align-items: center;
    color: #5d7fa8;
    display: flex;
    font-size: 9px;
    font-weight: 700;
    gap: 7px;
    min-width: 150px;
}

.scale-track {
    background: repeating-linear-gradient(90deg, #a9c1df 0 2px, transparent 2px 19px);
    height: 18px;
    position: relative;
    width: 108px;
}

.scale-track span {
    background: #1f5c9d;
    border-radius: 50%;
    height: 8px;
    position: absolute;
    right: 2px;
    top: 5px;
    width: 8px;
}

.primary-action,
.icon-action {
    background: #fff;
    border: 1px solid #9ebbe0;
    color: #1f5c9d;
    font-size: 12px;
    font-weight: 700;
    height: 30px;
}

.primary-action {
    min-width: 88px;
}

.icon-action {
    min-width: 30px;
}

.board {
    display: grid;
    grid-template-columns: minmax(290px, 36%) minmax(520px, 64%);
    overflow-x: auto;
}

.task-table,
.timeline {
    min-width: 0;
}

.table-header,
.timeline-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    color: #5b6878;
    font-size: 10px;
    font-weight: 800;
    height: 44px;
    text-transform: uppercase;
}

.table-header {
    border-right: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 44px;
}

.table-header span {
    align-items: center;
    display: flex;
    padding: 0 10px;
}

.table-header span:last-child {
    border-left: 1px solid var(--line);
    justify-content: flex-end;
}

.task-row {
    border-bottom: 1px solid var(--soft-line);
    border-right: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 44px;
    height: 31px;
}

.task-row.group-row {
    background: #fbfdff;
    color: #1f5c9d;
    font-weight: 700;
}

.task-title {
    align-items: center;
    display: flex;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.task-title span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-toggle {
    align-items: center;
    border: 1px solid #b9c7d6;
    color: #63809f;
    display: inline-flex;
    font-size: 10px;
    height: 11px;
    justify-content: center;
    margin-right: 6px;
    width: 11px;
}

.task-percent {
    align-items: center;
    border-left: 1px solid var(--soft-line);
    color: #2f3945;
    display: flex;
    justify-content: flex-end;
    padding-right: 10px;
}

.timeline-header {
    display: grid;
    grid-template-rows: 18px 26px;
}

.month-label {
    align-items: center;
    color: #1f2935;
    display: flex;
    font-size: 10px;
    font-weight: 800;
    padding-left: 8px;
    text-transform: none;
}

.day-row {
    display: grid;
    grid-template-columns: repeat(31, minmax(18px, 1fr));
}

.day-row span {
    align-items: center;
    border-left: 1px solid #eef3f7;
    color: #334154;
    display: flex;
    font-size: 10px;
    justify-content: center;
}

.day-row span.weekend {
    color: #e25a5a;
}

.timeline-body {
    background-image:
        repeating-linear-gradient(90deg, rgba(239, 244, 249, 0.9) 0 1px, transparent 1px calc(100% / 31)),
        repeating-linear-gradient(90deg, rgba(222, 244, 248, 0.6) 0 calc(100% / 31), transparent calc(100% / 31) calc((100% / 31) * 7));
}

.timeline-row {
    border-bottom: 1px solid var(--soft-line);
    height: 31px;
    position: relative;
}

.timeline-row.group-row {
    background: rgba(251, 253, 255, 0.7);
}

.timeline-bar {
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    display: flex;
    height: 14px;
    left: 0;
    margin-left: calc(var(--start) * 1%);
    overflow: visible;
    padding-left: 4px;
    position: absolute;
    top: 8px;
    width: calc(var(--span) * 1%);
}

.timeline-bar span {
    color: #3b4a59;
    font-size: 10px;
    font-weight: 600;
    margin-left: calc(100% + 4px);
    white-space: nowrap;
}

.timeline-bar.teal {
    background: rgba(88, 198, 198, 0.58);
    border-color: #58c6c6;
}

.timeline-bar.blue {
    background: rgba(103, 169, 245, 0.5);
    border-color: #67a9f5;
}

.timeline-bar.green {
    background: rgba(100, 210, 134, 0.74);
    border-color: #64d286;
}

.timeline-bar.warning {
    background: linear-gradient(90deg, var(--green) 0 45%, var(--red) 45% 100%);
    border-color: #ed9a9a;
}

.stage-summary {
    background: #f5f8fb;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    padding: 14px 18px;
}

.stage-summary article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px;
}

.stage-summary span {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.stage-summary strong {
    color: var(--text);
    display: block;
    font-size: 22px;
    line-height: 1.2;
    margin: 4px 0 8px;
}

.metric-track {
    background: #e6edf5;
    height: 5px;
}

.metric-track span {
    background: var(--teal);
    display: block;
    height: 100%;
}

.page-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 22px 24px;
}

.eyebrow {
    color: #5a728f;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.page-header h1 {
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.lede {
    color: var(--muted);
    font-size: 13px;
    max-width: 820px;
    margin: 6px 0 0;
}

.module-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    padding: 18px;
}

.module-card,
.workflow-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 14px;
}

.module-label {
    color: #5a728f;
    display: block;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.module-card h2,
.workflow-panel h2 {
    color: var(--text);
    font-size: 16px;
    margin: 0 0 6px;
}

.module-card p,
.section-title p {
    color: var(--muted);
    margin: 0;
}

.workflow-panel {
    margin: 18px;
}

.section-title {
    margin-bottom: 14px;
}

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

.stage-pill {
    background: #f8fbff;
    border: 1px solid #c7d7e8;
    border-radius: 3px;
    color: #243242;
    font-weight: 700;
    padding: 7px 10px;
}

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

.check-list span {
    background: #f8fbff;
    border-left: 4px solid var(--brand-blue);
    color: #243242;
    padding: 8px 10px;
}

@media (max-width: 980px) {
    .workspace-toolbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 14px;
    }

    .toolbar-actions {
        flex-wrap: wrap;
    }

    .board {
        grid-template-columns: 320px 640px;
    }
}
