@font-face {
    font-family: "DM Sans";
    src: url("dm-sans.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
}

@font-face {
    font-family: "Fraunces";
    src: url("fraunces.woff2") format("woff2");
    font-weight: 500 700;
    font-display: swap;
}

:root {
    color-scheme: light;
    --green: #1d5743;
    --green-dark: #124332;
    --navy: #172f48;
    --cream: #f4efe3;
    --paper: #fffefa;
    --sage: #e7ede4;
    --ink: #38493f;
    --muted: #536259;
    --border: #c9c3b3;
    --line: #dfdace;
    --warning: #77500c;
    --warning-bg: #faedcf;
    --radius: 12px;
    --sans: "DM Sans", system-ui, sans-serif;
    --serif: "Fraunces", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--cream); font: 1rem/1.5 var(--sans); }
h1, h2, h3, p, ul, dl { margin: 0; }
h1, h2, .brand span { color: var(--navy); font-family: var(--serif); line-height: 1.13; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 650; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.85rem); font-weight: 650; letter-spacing: -.028em; }
h3 { color: var(--navy); font-size: 1rem; }
p { overflow-wrap: anywhere; }
a { color: var(--green); text-underline-offset: .19em; }
a:hover { color: var(--green-dark); }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #356e57; outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 20; padding: .6rem .9rem; background: var(--paper); clip-path: inset(50%); }
.skip-link:focus { clip-path: none; }
.icon { flex: 0 0 auto; width: 1.28rem; height: 1.28rem; vertical-align: middle; }
.stack { display: grid; gap: .9rem; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.align-start { align-items: start; }
.grow { flex: 1 1 15rem; }
.narrow { max-width: 48rem; }
.muted { color: var(--muted); }
.block { display: block; }
.full { grid-column: 1 / -1; }
.empty { padding: 1rem 0; color: var(--muted); }
.preline { white-space: pre-line; }
.strong { font-weight: 700; }
.eyebrow { font-size: .79rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--green); }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 15.65rem minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow: auto; display: flex; flex-direction: column; padding: 1.1rem .95rem .95rem; border-right: 1px solid var(--line); background: #fcfaf4; }
.brand { display: grid; justify-items: center; gap: .15rem; padding: .05rem .5rem 1.15rem; border-bottom: 1px solid var(--border); text-decoration: none; }
.brand img { width: 9.6rem; height: auto; mix-blend-mode: multiply; }
.brand span { font-weight: 650; font-size: 1.48rem; letter-spacing: -.035em; }
.side-nav { display: grid; gap: .24rem; padding-top: 1rem; }
.side-nav a, .mobile-nav a { min-height: 48px; display: flex; align-items: center; gap: .8rem; padding: .55rem .8rem; border-radius: 8px; color: var(--navy); text-decoration: none; font-size: .97rem; font-weight: 550; }
.side-nav a:hover, .mobile-nav a:hover { background: #eff1e9; }
.side-nav a[aria-current], .mobile-nav a[aria-current] { color: var(--green-dark); background: #dce8dc; font-weight: 700; }
.sidebar-bottom { margin-top: auto; padding-top: 1.15rem; }
.account { display: flex; gap: .65rem; align-items: center; border-top: 1px solid var(--line); padding: .85rem .25rem .3rem; text-decoration: none; color: var(--navy); }
.account small { display: block; color: var(--muted); }
.avatar { display: grid; place-items: center; flex: 0 0 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--sage); color: var(--green); font-weight: 700; }
.text-button { display: inline-flex; align-items: center; min-height: 44px; margin-left: .1rem; padding: 0 .25rem; border: 0; background: transparent; color: var(--green); text-decoration: underline; text-underline-offset: .2em; }
.mobile-nav, .logout-mobile { display: none; }
.account-return .button { width: 100%; color: var(--green-dark); }
.account-return .icon { transform: rotate(180deg); }
.masthead { display: flex; gap: .8rem; justify-content: space-between; align-items: center; min-height: 75px; padding: .7rem clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); background: #fbf8f0; }
.masthead-title { display: flex; align-items: center; gap: .55rem; font: 650 1.44rem/1.1 var(--serif); color: var(--navy); white-space: nowrap; }
.masthead-title img { display: none; }
.masthead-actions { display: flex; align-items: center; gap: .65rem; }
.demo-badge { font-size: .77rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 2rem; padding: .2rem .62rem; white-space: nowrap; }
.content { max-width: 100rem; margin: 0 auto; padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 2.5rem; }
.content:focus { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.25rem; margin-bottom: 1.35rem; }
.page-head p { margin-top: .38rem; font-size: 1rem; color: var(--muted); }
.page-head .eyebrow { margin: 0 0 .38rem; }
.page-head > .button { flex-shrink: 0; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin: -.45rem 0 .25rem; font-weight: 650; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1rem, 2vw, 1.35rem); background: var(--paper); }
.panel > h2, .panel-head { margin-bottom: .9rem; }
.panel > p + form, .panel > p + .button { margin-top: .85rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.panel-head a { font-size: .875rem; font-weight: 650; }
.section-space { margin-top: 1rem; }

.button { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .45rem; justify-self: start; min-height: 44px; padding: .52rem .86rem; border: 1px solid #a4b5a8; border-radius: 8px; color: var(--green-dark); background: #f5f7f0; font-weight: 700; text-decoration: none; text-align: center; line-height: 1.25; }
.button:hover { background: var(--sage); }
.button.primary { border-color: var(--green); background: var(--green); color: #fff; }
.button.primary:hover { background: var(--green-dark); }
.button.danger { color: #8e3528; background: #fff8f4; border-color: #d9b7aa; }
.button:disabled { cursor: wait; opacity: .7; }
.button-group, .status-stack { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.job-card .status-stack { justify-content: flex-end; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; margin-bottom: 1rem; }
label { display: grid; gap: .32rem; min-width: 0; color: var(--navy); font-size: .91rem; font-weight: 700; }
input:not([type=hidden]), select, textarea { width: 100%; min-width: 0; min-height: 44px; padding: .56rem .66rem; border: 1px solid #aaa797; border-radius: 7px; color: var(--navy); background: #fffefa; font: 1rem/1.35 var(--sans); }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: 1.18rem; min-height: 1.18rem; padding: 0; margin: 0; accent-color: var(--green); }
input[type=file] { padding: .4rem; font-size: .9rem; }
input[type=file]::file-selector-button { border: 0; border-radius: 4px; padding: .35rem .55rem; margin-right: .45rem; background: var(--sage); color: var(--green-dark); font-weight: 700; cursor: pointer; }
select { appearance: none; padding-right: 2rem; background-image: url("chevron.svg"); background-position: right .6rem center; background-size: 1rem; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.check { display: flex; flex-direction: row; align-items: center; gap: .55rem; min-height: 44px; }
.field-help { color: var(--muted); font-size: .87rem; font-weight: 400; }

.notice { display: block; padding: .68rem .85rem; margin: 0 0 .85rem; border-radius: 8px; background: var(--sage); color: var(--green-dark); }
.notice.warning { background: var(--warning-bg); color: var(--warning); }
.notice.success { background: #e2efe0; }
.notice ul { padding-left: 1.3rem; }
.notice:last-child { margin-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .2rem .62rem; background: var(--sage); color: var(--green-dark); font-size: .81rem; font-weight: 700; line-height: 1.25; }
.status.green { background: #e1edde; color: #24523c; }
.status.blue { background: #e7eef3; color: #244a64; }
.status.amber { background: #faebcd; color: #704b11; }
.status.muted { background: #eeeae1; color: #534f43; }

.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .63rem .75rem; color: var(--navy); vertical-align: middle; }
th { background: #e5ece3; font-size: .84rem; font-weight: 700; white-space: nowrap; }
td { border-top: 1px solid var(--line); font-size: .93rem; }
td a { font-weight: 700; }
td.empty { padding: .9rem; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .85rem; font-size: .9rem; }
.detail-box { border: 1px solid var(--line); border-radius: 8px; }
.detail-box > summary { padding: .65rem .8rem; color: var(--navy); min-height: 44px; }
.detail-box > summary span { margin-left: .45rem; font-size: .85rem; color: var(--muted); }
.details-content { padding: .7rem .8rem .85rem; border-top: 1px solid var(--line); }
.record-list { margin: 0 0 .8rem; padding: 0; list-style: none; }
.record-list li { display: grid; gap: .12rem; padding: .6rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.record-list li:last-child { border-bottom: 0; }
.record-list strong { color: var(--navy); }

.sign-in { display: grid; align-items: center; justify-items: center; min-height: 100dvh; padding: 1rem; }
.login-panel { width: min(100%, 27rem); padding: clamp(1.25rem, 5vw, 2.35rem); border: 1px solid var(--border); border-radius: 16px; background: var(--paper); }
.login-logo { width: 9rem; margin: 0 0 .95rem; mix-blend-mode: multiply; }
.login-panel > p { margin: .5rem 0 1.25rem; }
.login-panel .button { width: 100%; }
.phone-install { margin-top: 1rem; }

@media (display-mode: standalone) {
    .phone-install { display: none; }
}

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.metric { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem .72rem; min-height: 104px; padding: .88rem; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); color: var(--navy); text-decoration: none; }
.metric:hover { background: #f4f7ef; border-color: #8b9e8c; }
.metric-icon { display: grid; place-items: center; width: 2.42rem; height: 2.42rem; border-radius: 7px; background: var(--sage); color: var(--green-dark); grid-row: span 2; }
.metric-label { font-size: .87rem; font-weight: 650; line-height: 1.2; align-self: start; }
.metric-value { font: 650 2.4rem/1 var(--serif); color: var(--navy); letter-spacing: -.055em; }
.dashboard-secondary { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.dashboard-secondary .record-list { margin: 0; }
.review-card { display: grid; grid-template-columns: auto 1fr; gap: .6rem; padding: .74rem; border-radius: 8px; color: var(--warning); background: var(--warning-bg); text-decoration: none; }
.review-card + .review-card { margin-top: .55rem; }
.review-card:hover { color: var(--warning); background: #f6e6c3; }
.review-card small { display: block; color: #624d28; }

.job-cards { display: grid; gap: .65rem; }
.job-filters { margin-bottom: .7rem; }
.job-filters summary { min-height: 44px; padding: .55rem 0; color: var(--green-dark); font-weight: 700; }
.job-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; padding: .85rem; gap: .32rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--paper); }
.job-card a { color: var(--navy); font-weight: 700; }
.job-card .job-address { grid-column: 1 / -1; font-size: 1.02rem; font-weight: 700; color: var(--navy); }
.job-card p { grid-column: 1 / -1; font-size: .92rem; }
.job-card .button { color: var(--green-dark); }
.job-card .button.primary { color: #fff; }
.job-card aside { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: .55rem; margin-top: .2rem; }
.mobile-job-list { display: none; }
.job-detail { grid-template-columns: minmax(0, 1.42fr) minmax(15rem, .85fr); align-items: start; }
.job-detail > * { min-width: 0; }
.fact-list { display: grid; gap: .6rem; }
.fact-list div { display: grid; gap: .08rem; }
.fact-list dt { color: var(--muted); font-size: .79rem; font-weight: 700; }
.fact-list dd { margin: 0; color: var(--navy); overflow-wrap: anywhere; }
.request-box { border: 1px solid #d7e0d4; border-radius: 8px; overflow: hidden; }
.request-box h2 { padding: .55rem .7rem; border-bottom: 1px solid #d7e0d4; background: var(--sage); font: 700 .94rem/1.2 var(--sans); letter-spacing: 0; }
.request-box > div { padding: .65rem .7rem; }
.request-box p + p { margin-top: .3rem; }
.action-row { min-width: 0; margin: 0; padding: .6rem .7rem .75rem; border: 1px solid var(--line); border-radius: 8px; }
.action-row legend { padding: 0 .33rem; color: var(--navy); font-weight: 700; }
.action-row > div { align-items: start; }
.action-row .button { margin-top: .6rem; }
.evidence-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); }
.evidence-grid a { display: block; }
.evidence-grid img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 7px; }
.visit-photo-viewer { box-sizing: border-box; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; background: #101820; padding: max(.65rem, env(safe-area-inset-top)) max(.65rem, env(safe-area-inset-right)) max(.65rem, env(safe-area-inset-bottom)) max(.65rem, env(safe-area-inset-left)); }
.visit-photo-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .5rem; }
.visit-photo-viewer form { justify-self: end; }
.visit-photo-viewer .photo-close { width: 48px; height: 48px; padding: 0; font-size: 2rem; border-radius: 50%; }
.visit-photo-viewer img { width: 100%; height: 100%; object-fit: contain; }
.sticky-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.visit-entry { border-top: 1px solid var(--line); padding: .7rem 0 0; }
.visit-entry ul { padding-left: 1.25rem; }
.action-details { margin-top: .5rem; color: var(--green-dark); }
.action-details summary { min-height: 44px; padding: .56rem 0; font-weight: 650; }
.sticky-actions progress { accent-color: var(--green); max-width: 100%; }
.sticky-actions [data-progress-status]:empty { display: none; }
.message-list { display: grid; gap: .5rem; list-style: none; padding: 0; }
.message-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .55rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); text-decoration: none; }
.message-row:hover { background: var(--sage); }
.message-copy { display: grid; min-width: 0; overflow-wrap: anywhere; }
.message-copy > span { color: var(--muted); font-size: .84rem; }
.message-row .status-stack { justify-content: flex-end; }
.mail-proposals { margin-bottom: .85rem; }
.mail-body { overflow: auto; overflow-wrap: anywhere; max-height: 60vh; border: 1px solid var(--line); border-radius: 8px; padding: .8rem; }

@media (max-width: 1050px) {
    .app-shell { grid-template-columns: 13rem minmax(0, 1fr); }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    body.sign-in { padding-top: max(1rem, env(safe-area-inset-top)); padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
    .app-shell { padding-top: env(safe-area-inset-top); }
    .app-shell { display: block; }
    .sidebar { display: none; }
    .masthead { min-height: 61px; padding: .5rem .95rem; }
    .masthead-title { font-size: 1.18rem; }
    .masthead-title img { display: block; width: 2.25rem; border-radius: 3px; }
    .masthead-actions .button { padding-inline: .6rem; }
    .masthead-actions .button .icon { width: 1rem; }
    .demo-badge { padding-inline: .48rem; }
    .content { padding: 1.1rem .92rem calc(5.6rem + env(safe-area-inset-bottom)); }
    .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; gap: .15rem; padding: .32rem .45rem calc(.32rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #fcfaf4; }
    .mobile-nav a { flex: 1 1 0; justify-content: center; flex-direction: column; gap: .06rem; padding: .28rem .15rem; min-height: 46px; font-size: .73rem; }
    .mobile-nav a .icon { width: 1.2rem; height: 1.2rem; }
    .mobile-nav .account-return { flex: 1 1 0; min-width: 0; }
    .mobile-nav .account-return .button { flex-direction: column; gap: .06rem; padding: .28rem .1rem; min-height: 46px; height: 100%; font-size: .73rem; line-height: 1.15; }
    .mobile-nav .account-return .icon { width: 1.2rem; height: 1.2rem; }
    .logout-mobile { display: block; margin-top: 1rem; }
    .page-head { align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
    .page-head p { margin-top: .25rem; }
    .grid-two, .job-detail, .dashboard-secondary { grid-template-columns: 1fr; }
    .metric-grid { gap: .55rem; }
    .metric { min-height: 82px; gap: .2rem .5rem; padding: .6rem; }
    .metric-icon { width: 1.9rem; height: 1.9rem; }
    .metric-icon .icon { width: 1rem; height: 1rem; }
    .metric-label { font-size: .8rem; }
    .metric-value { font-size: 1.95rem; }
    .desktop-job-list { display: none; }
    .mobile-job-list { display: grid; }
    .message-row { grid-template-columns: auto minmax(0, 1fr); }
    .message-row .status-stack { grid-column: 2; justify-content: flex-start; }
    .dashboard-secondary .message-row > .icon { display: none; }
    .completion-panel { padding-bottom: .65rem; }
    .completion-panel > form > .form-grid { grid-template-columns: minmax(0, 1fr); }
    .sticky-actions { position: sticky; bottom: calc(3.75rem + env(safe-area-inset-bottom)); z-index: 3; padding: .52rem; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
    .sticky-actions .button { width: 100%; }
}

@media (max-width: 390px) {
    .masthead-actions { gap: .3rem; }
    .masthead-actions .demo-badge { font-size: .68rem; }
    .masthead-title { gap: .3rem; font-size: 1.08rem; }
    .masthead-title img { width: 1.95rem; }
    .form-grid { gap: .62rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
