:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ink: #17202a;
    --muted: #68747f;
    --navy: #173f5f;
    --paper: #fff;
    --warm: #f5f3ed;
}

body {
    margin: 0;
    background: var(--warm);
    color: var(--ink);
    padding-bottom: 5.75rem;
}

.pull-refresh-status {
    background: var(--navy);
    border-radius: 999px;
    box-shadow: 0 0.25rem 1rem rgb(23 32 42 / 18%);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    left: 50%;
    padding: 0.55rem 0.9rem;
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top));
    transform: translateX(-50%);
    z-index: 100;
}

.pull-refresh-status[hidden] {
    display: none;
}

.site-header,
main {
    box-sizing: border-box;
    margin-inline: auto;
    max-width: 72rem;
    padding: 1rem;
}

.site-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-top: max(1rem, env(safe-area-inset-top));
}

.site-header a {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}

.wordmark {
    align-items: center;
    display: inline-flex;
    gap: 0.55rem;
}

.wordmark-logo {
    flex: 0 0 auto;
    height: 2rem;
    object-fit: contain;
    width: 2rem;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.site-header nav a {
    color: #56616c;
    font-size: 0.9rem;
    font-weight: 600;
}

.wordmark-label span {
    font-weight: 500;
}

.auth-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 1rem rgb(23 32 42 / 8%);
    display: grid;
    gap: 0.75rem;
    margin-inline: auto;
    max-width: 28rem;
    padding: 1.25rem;
}

button,
input,
select,
textarea {
    box-sizing: border-box;
    font: inherit;
    padding: 0.65rem 0.75rem;
}

button,
input,
select {
    min-height: 2.75rem;
}

button,
.button-link {
    background: #173f5f;
    border: 0;
    border-radius: 0.5rem;
    box-sizing: border-box;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
}

a {
    color: #175d8d;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.page-heading,
.section-heading,
.card-heading {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.page-heading {
    margin-block: 1rem 1.5rem;
}

.page-heading h1 {
    margin-bottom: 0;
}

.eyebrow,
.field-label {
    color: #68747f;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}

.panel,
.project-card,
.truth-panel {
    background: #fff;
    border: 1px solid #e5e8eb;
    border-radius: 0.75rem;
    box-shadow: 0 0.2rem 0.8rem rgb(23 32 42 / 5%);
    padding: 1.1rem;
}

.two-column,
.detail-grid,
.project-grid,
.activity-grid,
.form-grid {
    display: grid;
    gap: 1rem;
}

.two-column,
.activity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid,
.project-grid {
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.form-grid {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.project-card {
    color: inherit;
    display: block;
    text-decoration: none;
}

.project-card:hover {
    border-color: #aabfce;
}

.project-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

.status {
    background: #edf1f4;
    border-radius: 999px;
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
    text-transform: capitalize;
}

.status-on_track { background: #e0f4e7; color: #1e6940; }
.status-attention { background: #fff2ca; color: #765a00; }
.status-at_risk { background: #fde4e4; color: #922727; }

.compact-facts,
.fact-strip {
    display: grid;
    gap: 0.7rem;
}

.compact-facts div {
    display: grid;
    gap: 0.1rem;
}

.compact-facts dt,
.fact-strip span {
    color: #68747f;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.compact-facts dd {
    margin: 0;
}

.truth-panel {
    display: grid;
    gap: 1rem;
}

.truth-block:not(:last-child) {
    border-bottom: 1px solid #edf0f2;
    padding-bottom: 1rem;
}

.lead {
    font-size: 1.2rem;
    line-height: 1.55;
}

.fact-strip {
    grid-template-columns: repeat(4, 1fr);
    margin-block: 1rem;
}

.fact-strip div {
    background: #eaf0f4;
    border-radius: 0.6rem;
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem;
    text-transform: capitalize;
}

.status-edit-action {
    display: flex;
    justify-content: flex-end;
    margin-top: -0.35rem;
}

.stack-form,
.stack-form label {
    display: grid;
    gap: 0.45rem;
}

.stack-form {
    gap: 0.85rem;
}

.wide-form {
    max-width: 54rem;
}

.compact-form {
    margin-top: 0.8rem;
}

.check-label {
    align-items: center;
    display: flex !important;
    grid-template-columns: auto 1fr;
}

.check-label input {
    min-height: auto;
}

.record-list,
.timeline-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.record-list li,
.timeline-list li {
    border-bottom: 1px solid #edf0f2;
    display: grid;
    gap: 0.25rem;
    padding-block: 0.75rem;
}

.timeline-list span,
.muted {
    color: #68747f;
}

.timeline-list .is-complete strong {
    text-decoration: line-through;
}

.activity-wide {
    grid-column: 1 / -1;
}

.small-button {
    font-size: 0.8rem;
    justify-self: start;
    min-height: 2rem;
    padding: 0.35rem 0.6rem;
}

.section-gap,
.section-heading,
.archive-form {
    margin-top: 1.5rem;
}

.preserve-lines {
    white-space: pre-line;
}

.secondary {
    background: #e2e9ee;
    color: #173f5f;
}

.text-button {
    background: transparent;
    color: #7c3434;
    padding-inline: 0;
}

.empty-state,
.page-intro {
    max-width: 40rem;
}

details summary {
    color: #175d8d;
    cursor: pointer;
    font-weight: 700;
    margin-top: 0.9rem;
}

.update-capture {
    margin-bottom: 1rem;
}

.notice {
    background: #e9f3f8;
    border-left: 0.3rem solid #2d719c;
    border-radius: 0.4rem;
    padding: 1rem;
}

.notice-error {
    background: #fff0e8;
    border-left-color: #b65c2b;
}

.notice form {
    margin-top: 0.75rem;
}

.proposal-choice {
    align-items: start;
    border: 1px solid #dce3e8;
    border-radius: 0.5rem;
    display: grid !important;
    gap: 0.7rem !important;
    grid-template-columns: auto 1fr;
    padding: 0.8rem;
}

.proposal-choice input {
    min-height: auto;
    margin-top: 0.2rem;
}

.proposal-choice span,
.proposal-choice small {
    display: grid;
    gap: 0.25rem;
}

.email-source {
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.candidate-fieldset {
    border: 0;
    display: grid;
    gap: 0.7rem;
    margin: 0;
    padding: 0;
}

.candidate-fieldset legend {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.app-nav {
    backdrop-filter: blur(1rem);
    background: rgb(255 255 255 / 92%);
    border: 1px solid #dce2e6;
    border-radius: 1rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    box-shadow: 0 0.5rem 2rem rgb(23 32 42 / 15%);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    left: 50%;
    max-width: 34rem;
    padding: 0.35rem;
    position: fixed;
    transform: translateX(-50%);
    width: calc(100% - 1.5rem);
    z-index: 20;
}

.app-nav a {
    align-items: center;
    border-radius: 0.7rem;
    color: #68747f;
    display: flex;
    flex-direction: column;
    font-size: 0.72rem;
    font-weight: 700;
    gap: 0.15rem;
    min-height: 2.75rem;
    justify-content: center;
    text-decoration: none;
}

.app-nav a span {
    font-size: 1.05rem;
    line-height: 1;
}

.app-nav a[aria-current="page"] {
    background: #e6eef3;
    color: var(--navy);
}

.today-heading {
    align-items: end;
}

.today-heading .page-intro {
    margin-bottom: 0;
}

.review-start-form button {
    white-space: nowrap;
}

.attention-list,
.review-history,
.recap-grid {
    display: grid;
    gap: 0.8rem;
}

.attention-card {
    align-items: center;
    background: var(--paper);
    border: 1px solid #e0e3e5;
    border-radius: 0.8rem;
    display: grid;
    gap: 0.9rem;
    grid-template-columns: 0.35rem 1fr auto;
    min-width: 0;
    overflow: hidden;
    padding: 1rem 1rem 1rem 0;
}

.attention-card h2 {
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
}

.attention-card h2 a {
    color: inherit;
    text-decoration: none;
}

.attention-card p:last-child {
    margin-bottom: 0;
}

.attention-marker {
    align-self: stretch;
    background: #7893a5;
    border-radius: 0 0.4rem 0.4rem 0;
}

.attention-approval .attention-marker,
.attention-blocker .attention-marker {
    background: #b44e43;
}

.attention-email .attention-marker,
.attention-due .attention-marker {
    background: #d59a29;
}

.attention-priority .attention-marker {
    background: var(--navy);
}

.next-actions-panel {
    margin-top: 1rem;
}

.next-actions-panel h2 {
    margin-bottom: 0.55rem;
}

.next-action-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.next-action-item + .next-action-item {
    border-top: 1px solid #edf0f2;
}

.next-action-item a {
    align-items: center;
    color: inherit;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr auto;
    padding-block: 0.75rem;
    text-decoration: none;
}

.next-action-item strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.card-arrow {
    align-items: center;
    color: #72818b;
    display: flex;
    font-size: 1.8rem;
    height: 2.75rem;
    justify-content: center;
    text-decoration: none;
    width: 2.75rem;
}

.calm-state {
    border-left: 0.35rem solid #4f8967;
}

.review-progress {
    margin: 0 auto 1rem;
    max-width: 42rem;
}

.review-progress div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.review-progress span {
    color: var(--muted);
}

.review-progress progress {
    accent-color: var(--navy);
    display: block;
    height: 0.45rem;
    width: 100%;
}

.review-card {
    background: var(--paper);
    border: 1px solid #e0e3e5;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 2rem rgb(23 32 42 / 7%);
    margin-inline: auto;
    max-width: 42rem;
    padding: clamp(1rem, 4vw, 2rem);
}

.review-card h1 {
    font-size: clamp(1.6rem, 6vw, 2.25rem);
    overflow-wrap: anywhere;
}

.review-reason {
    color: #44525d;
    font-size: 1.05rem;
    line-height: 1.55;
}

.review-facts {
    background: #f1f4f5;
    border-radius: 0.7rem;
    display: grid;
    gap: 0.75rem;
    margin-block: 1.25rem;
    padding: 0.9rem;
}

.review-facts div {
    display: grid;
    gap: 0.15rem;
}

.review-facts span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.review-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.review-actions > form button {
    width: 100%;
}

.review-choice {
    border: 1px solid #dce3e8;
    border-radius: 0.65rem;
    padding: 0 0.85rem 0.75rem;
}

.review-choice summary {
    min-height: 2.75rem;
    padding-top: 0.85rem;
}

.review-secondary-actions {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(2, 1fr);
}

.review-secondary-actions button {
    width: 100%;
}

.recap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-recap-form {
    max-width: 46rem;
}

.ask-panel,
.answer-card {
    max-width: 46rem;
}

.answer-card {
    background: #173f5f;
    border-radius: 1rem;
    color: #fff;
    margin-top: 1rem;
    padding: clamp(1rem, 4vw, 1.5rem);
}

.answer-card .eyebrow,
.answer-card .field-label,
.answer-card .muted {
    color: #c9d8e2;
}

.answer-card a {
    color: #fff1bd;
}

.answer-text {
    font-size: 1.1rem;
    line-height: 1.6;
}

.certainty {
    background: rgb(255 255 255 / 14%);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.3rem 0.6rem;
    text-transform: uppercase;
}

.certainty-inferred,
.certainty-stale,
.certainty-unknown {
    background: #fff1bd;
    color: #614d00;
}

.answer-sources {
    border-top: 1px solid rgb(255 255 255 / 18%);
    margin-top: 1rem;
    padding-top: 1rem;
}

.answer-sources ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

@media (max-width: 42rem) {
    .site-header,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-header nav {
        gap: 0.6rem;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        width: 100%;
    }

    .site-header nav a {
        white-space: nowrap;
    }

    .two-column,
    .activity-grid {
        grid-template-columns: 1fr;
    }

    .fact-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .activity-wide {
        grid-column: auto;
    }

    .button-link {
        width: 100%;
    }

    .review-start-form,
    .review-start-form button {
        width: 100%;
    }

    .recap-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 22rem) {
    .site-header,
    main {
        padding-inline: 0.75rem;
    }

    .wordmark-label span {
        display: none;
    }

    .attention-card {
        gap: 0.65rem;
        padding-right: 0.4rem;
    }

    .review-secondary-actions {
        grid-template-columns: 1fr;
    }

    .app-nav {
        width: calc(100% - 0.75rem);
    }
}
