:root {
    color-scheme: light;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #172033;
    background: #f2f5f9;
}

* { box-sizing: border-box; }

body { margin: 0; }

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px max(24px, calc((100% - 960px) / 2));
    border-bottom: 1px solid #dbe2ea;
    background: #fff;
}

.site-nav a { color: #243650; text-decoration: none; font-weight: 650; }
.site-nav .brand { display: inline-flex; align-items: center; }
.site-nav .brand img { display: block; width: auto; height: 48px; object-fit: contain; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links > a { position: relative; padding-block: 8px; }
.nav-links > a.nav-active { color: #355bad; }
.nav-links > a.nav-active::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
}

.nav-logout { display: block; }
.nav-logout button {
    padding: 0;
    border-radius: 0;
    color: #243650;
    background: transparent;
    font-weight: 650;
}

.container {
    width: min(960px, calc(100% - 32px));
    margin: 64px auto;
}

.card {
    padding: 32px;
    border: 1px solid #dbe2ea;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(20, 35, 60, .08);
}

.login-card { max-width: 440px; margin: 12vh auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 0; }
.eyebrow { color: #4361a8; font-weight: 700; }
h1 { margin: 8px 0 16px; }
h2 { margin-top: 0; }
form { display: grid; gap: 10px; }
label { margin-top: 8px; font-weight: 650; }
input, textarea, select { width: 100%; padding: 12px; border: 1px solid #b8c2d1; border-radius: 8px; font: inherit; }
button { padding: 12px 18px; border: 0; border-radius: 8px; color: #fff; background: #3157a4; font: inherit; font-weight: 700; cursor: pointer; }
button.secondary { background: #4e5b70; }
button.danger { background: #a83b3b; }
.error { padding: 10px 12px; border-radius: 8px; color: #8a1c1c; background: #ffebeb; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; }
dt { font-weight: 700; }
dd { margin: 0; }

.section-gap { margin-top: 24px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stats div { padding: 20px; border-radius: 12px; background: #f4f7fb; }
.stats strong, .stats span { display: block; }
.stats strong { margin-bottom: 4px; color: #3157a4; font-size: 2rem; }
.list { display: grid; }
.project-list { display: grid; gap: 16px; }
.project-card { display: grid; gap: 14px; padding: 20px; border: 1px solid #dbe2ea; border-radius: 12px; color: inherit; background: #fff; text-decoration: none; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.project-card:hover { transform: translateY(-2px); border-color: #9cb0d5; box-shadow: 0 8px 22px rgba(20, 35, 60, .09); }
.project-card-heading, .project-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.project-card h3 { margin: 5px 0 0; font-size: 1.05rem; line-height: 1.4; }
.project-code { color: #4361a8; font-weight: 750; }
.completion-value { color: #3157a4; font-size: 1.5rem; white-space: nowrap; }
.progress { height: 9px; overflow: hidden; border-radius: 999px; background: #e7ecf3; }
.progress span { display: block; height: 100%; border-radius: inherit; background: #4168b2; }
.project-card-footer { color: #647087; font-size: .92rem; }
.list-item, .task-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 4px; border-bottom: 1px solid #e5eaf0; color: inherit; text-decoration: none; }
.list-item:last-child, .task-row:last-child { border-bottom: 0; }
.list-item small, .task-row small { display: block; margin-top: 5px; color: #647087; }
.align-right { display: grid; justify-items: end; gap: 6px; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; color: #31527d; background: #e9f0fa; font-size: .86rem; white-space: nowrap; }
.badge.completed { color: #17633b; background: #dff4e7; font-weight: 750; }
.notification-count { display: inline-grid; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; place-items: center; border-radius: 999px; color: #fff; background: #b3261e; font-size: .75rem; }
.notification-panel { margin-bottom: 24px; padding: 22px; border: 1px solid #efc36b; border-left: 5px solid #d69b36; border-radius: 12px; background: #fff8e8; }
.notification-panel h2 { margin-bottom: 6px; }
.notification-panel > p { margin-top: 0; }
.notification-panel a { display: grid; gap: 4px; margin-top: 12px; padding: 12px; border-radius: 8px; color: #172033; background: #fff; text-decoration: none; }
.notification-panel a span { color: #647087; }
.response-required { display: grid; gap: 8px; border-left-color: #b3261e; }
.response-status { width: fit-content; padding: 4px 8px; border-radius: 999px; color: #8a1c1c; background: #ffdddd; font-size: .82rem; font-weight: 700; }
.response-note { display: grid; gap: 8px; margin-top: 12px; padding: 14px; border-left: 3px solid #2f8a57; background: #eef8f2; }
.response-note small { color: #647087; }
.response-form { border: 1px solid #efc36b; background: #fffaf0; }
.text-link { color: #3157a4; text-decoration: none; font-weight: 650; }
.button-link { display: inline-block; margin-top: 22px; padding: 11px 16px; border-radius: 8px; color: #fff; background: #3157a4; text-decoration: none; font-weight: 700; }
.task-table { display: grid; }
.task-row { display: grid; grid-template-columns: minmax(240px, 2fr) 1fr 100px 150px; }
.task-row.subtask { padding-left: 28px; }
.task-row.subtask strong::before { content: '↳ '; color: #7a879b; }
.report { padding: 18px 0; border-bottom: 1px solid #e5eaf0; }
.report:last-child { border-bottom: 0; }
.review-note { padding: 12px; border-left: 3px solid #d69b36; background: #fff8e8; }
.review-form { margin-top: 18px; padding: 16px; border-radius: 10px; background: #f5f7fa; }
.actions { display: flex; gap: 10px; }
.form-card { max-width: 700px; }
.project-information { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.project-information .card { box-shadow: none; }
.message { margin-bottom: 20px; padding: 12px 16px; border-radius: 8px; background: #e9f0fa; }
.message.success { color: #17633b; background: #e5f6ec; }
.message.error { color: #8a1c1c; background: #ffebeb; }
.muted { color: #647087; }

@media (max-width: 760px) {
    .container { margin-top: 32px; }
    .topbar, .page-heading, .site-nav { align-items: flex-start; flex-direction: column; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .project-information { grid-template-columns: 1fr; }
    .task-row { grid-template-columns: 1fr; gap: 6px; }
    .nav-links { flex-wrap: wrap; gap: 14px; }
    .site-nav .brand img { width: auto; height: 40px; }
    .project-card-heading, .project-card-footer { align-items: flex-start; flex-direction: column; gap: 10px; }
}

.project-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.project-controls > div { flex: 1 1 160px; }
.project-controls label { display: block; margin: 0 0 6px; }
.project-metrics { display: flex; flex-wrap: wrap; gap: 10px 20px; color: #647087; font-size: .9rem; }
.project-metrics .overdue { color: #a32b25; }

.project-title-link { color: inherit; text-decoration: none; }
.project-title-link:hover { text-decoration: underline; }
.project-notifications { display: flex; align-items: center; gap: 12px; }
.report-notification { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; background: #ffebeb; color: #9b241e; font-weight: 750; text-decoration: none; }
.report-notification:hover { background: #ffdddd; }
.report-inbox-item { padding: 18px 0; border-bottom: 1px solid #e5eaf0; }
.report-inbox-item.unread .report-inbox-title { font-weight: 750; }
.unread-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #b3261e; margin-right: 6px; }
.project-card { position: relative; }
.project-title-link::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }
.project-title-link:focus-visible::after { outline: 3px solid #3157a4; outline-offset: 3px; }
.report-notification { position: relative; z-index: 1; }
.report-inbox-title { font-weight: 400; }

.project-chart-scroll { overflow-x: auto; padding: 34px 8px 48px 0; }
.project-chart { display: flex; gap: 14px; min-width: calc(60px + var(--project-count) * 100px); }
.chart-scale { flex: 0 0 44px; height: 240px; display: flex; flex-direction: column; justify-content: space-between; color: #647087; font-size: .8rem; text-align: right; }
.chart-scale span { line-height: 0; }
.chart-columns { display: flex; flex: 1; height: 240px; border-bottom: 1px solid #b8c2d1; background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), #e5eaf0 calc(25% - 1px), #e5eaf0 25%); }
.chart-column { position: relative; display: flex; flex: 1; align-items: flex-end; justify-content: center; min-width: 100px; color: #3157a4; text-decoration: none; }
.chart-bar { position: relative; display: block; width: 52%; max-width: 84px; height: var(--completion); border-radius: 7px 7px 0 0; background: linear-gradient(to top, #3157a4, #6a8ed4); border-top: 2px solid #4168b2; }
.chart-value { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 8px; font-size: .95rem; white-space: nowrap; }
.chart-code { position: absolute; top: 100%; left: 0; right: 0; padding: 12px 4px 0; text-align: center; font-size: .85rem; font-weight: 700; overflow-wrap: anywhere; }
.chart-column:hover .chart-bar, .chart-column:focus-visible .chart-bar { background: #23488f; }
.chart-column:focus-visible { outline: 2px solid #3157a4; outline-offset: 4px; }
.chart-complete .chart-bar { background: #2f8a57; border-color: #2f8a57; }
.chart-complete .chart-value { color: #17633b; }
.chart-hint { margin-bottom: 0; font-size: .85rem; }
.employee-chart-scroll { overflow-x: auto; padding: 34px 8px 12px 0; }
.employee-chart { display: flex; gap: 14px; min-width: calc(58px + var(--employee-count) * 156px); }
.employee-chart-columns { display: grid; grid-template-columns: repeat(var(--employee-count), minmax(0, 1fr)); flex: 1; background: repeating-linear-gradient(to top, transparent 0, transparent 59px, #e5eaf0 59px, #e5eaf0 60px) left top / 100% 240px no-repeat; }
.employee-chart-column { min-width: 0; color: #3157a4; }
.employee-chart-bar-space { display: flex; align-items: flex-end; justify-content: center; height: 240px; border-bottom: 1px solid #b8c2d1; }
.employee-chart-column:hover .chart-bar { filter: brightness(1.08); }
.employee-chart-label { display: flex; flex-direction: column; gap: 6px; padding: 14px 10px 0; text-align: center; font-size: .8rem; overflow-wrap: anywhere; }
.employee-chart-label > strong { color: #172033; line-height: 1.45; }

.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.person-card { display: flex; align-items: center; gap: 20px; padding: 24px; }
.person-photo { flex: 0 0 96px; width: 96px; height: 112px; object-fit: cover; border-radius: 12px; background: #edf2fa; }
.person-placeholder { display: grid; place-items: center; color: #7a8eaf; }
.person-info { min-width: 0; overflow-wrap: anywhere; }
.person-info h2 { margin: 0 0 8px; font-size: 1.08rem; line-height: 1.45; }
.person-info p { margin: 0; color: #647087; line-height: 1.5; }
@media (max-width: 760px) { .people-grid { grid-template-columns: 1fr; } .person-card { padding: 18px; gap: 16px; } }
.language-switcher { margin: 0; background: #f2f5f9; }
.language-switcher button { padding: 6px 12px; font-size: .85rem; color: #3157a4; background: transparent; }
.language-switcher button[aria-pressed="true"] { background: #3157a4; color: #fff; }

.employee-chart-self { background: rgba(49, 87, 164, .08); outline: 2px solid #3157a4; outline-offset: -2px; border-radius: 8px; }

/* Purchases */
.purchase-filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.purchase-filters p { flex: 1 1 140px; margin: 0; }
.purchase-filters label { display: block; margin-bottom: 8px; }
.purchase-item { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.purchase-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.purchase-photo { max-width: 100%; width: 240px; max-height: 200px; object-fit: contain; border-radius: 10px; }
.purchase-row { min-width: 0; margin: 16px 0; padding: 20px; border: 1px solid #dbe2ea; border-radius: 12px; }
.purchase-row input[type=checkbox] { width: auto; }
.purchase-actions { display: flex; align-items: center; gap: 24px; margin: 20px 0; }
.table-scroll { overflow-x: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; }
.table-scroll th, .table-scroll td { text-align: left; padding: 12px; border-bottom: 1px solid #e5eaf0; }
/* Keep purchase details on one line, with wrapping reserved for item names. */
.table-scroll .purchase-list-table th,
.table-scroll .purchase-list-table td {
    border: 1px solid #cbd5e1;
    vertical-align: middle;
    white-space: nowrap;
}
.purchase-list-table th { background: #f2f5f9; }
.purchase-list-table tr.purchase-unpaid > td { background-color: #fee2e2; }
.purchase-list-table .purchase-item { margin: 0; }
.purchase-list-table .purchase-item + .purchase-item { margin-top: 12px; }
.purchase-list-table .purchase-item > a { flex: 0 0 56px; }
.purchase-list-table .purchase-thumb { display: block; }
.purchase-list-table .purchase-item-name {
    flex: 0 0 260px;
    width: 260px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
}
.errorlist { color: #a02020; }
@media (max-width: 1100px) { .site-nav, .nav-links { flex-wrap: wrap; gap: 16px; } }
@media (max-width: 600px) { .purchase-editor .card { padding: 16px; } .purchase-row { padding: 12px; } }

.software-field-inactive { opacity: .5; }
.purchase-row input:disabled { background: #eef1f5; cursor: not-allowed; }

/* USD project columns with a common zero baseline. */
.project-columns-scroll { overflow-x: auto; padding: 6px 0; }
.project-columns { list-style: none; margin: 0; padding: 0; display: flex; min-width: 100%; width: max-content; }
.project-column { flex: 1 0 155px; width: 155px; text-align: center; }
.project-column-plot { height: 320px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #aebbd0; background: repeating-linear-gradient(to top, transparent 0, transparent 79px, #e0e7f0 79px, #e0e7f0 80px); }
.project-column-bar { position: relative; width: 52%; max-width: 120px; border-radius: 10px 10px 0 0; border-top: 3px solid #4c70b5; background: linear-gradient(#7092d1, #3157a4); }
.project-column-bar.is-zero { border-top-width: 2px; }
.project-column-value { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 10px; color: #3157a4; font-size: 1rem; white-space: nowrap; }
.project-column-code { display: block; margin-top: 16px; color: #3157a4; font-size: 1.1rem; }
.project-column-missing { color: #647087; width: 140px; padding-bottom: 12px; }
.project-column-missing small { display: block; margin-top: 6px; }
@media (max-width: 600px) { .project-column-plot { height: 240px; background-size: auto 60px; } }

.reference-row { padding: 18px 0; border-bottom: 1px solid #dbe2ea; overflow-wrap: anywhere; }
.reference-row h2 { font-size: 1.1rem; margin-bottom: 8px; }
.reference-viewer { width: 100%; height: 78vh; min-height: 400px; border: 1px solid #dbe2ea; border-radius: 12px; background: #fff; }
/* Keep navigation on one line; narrow screens can scroll horizontally. */
.site-nav { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 24px; padding-inline: 24px; overflow-x: auto; }
.site-nav .brand { flex-shrink: 0; }
.nav-links { flex-wrap: nowrap; flex-shrink: 0; gap: 20px; white-space: nowrap; }
.nav-links > a, .nav-logout { flex-shrink: 0; }
