:root { font-family: system-ui, sans-serif; color: #172c28; background: #f7f6f2; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; }
header { display: flex; align-items: center; justify-content: space-between; padding: 24px 6vw; border-bottom: 1px solid #dedfd7; }
header a { color: inherit; text-decoration: none; font-size: 22px; font-weight: 800; letter-spacing: -1px; }
header a span { font-size: 14px; font-weight: 400; letter-spacing: 0; color: #606d64; }
.demo-tag { font-size: 12px; border: 1px solid #c9d0c2; border-radius: 20px; padding: 5px 12px; }
main { width: min(100% - 40px, 880px); margin: 12vh auto 64px; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.8px; color: #526950; }
h1 { font-size: clamp(32px, 6vw, 54px); font-weight: 600; letter-spacing: -2px; line-height: 1.1; margin: 16px 0; }
.intro { color: #627068; margin-bottom: 32px; }
#roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
button, input { font: inherit; }
.role { width: 100%; text-align: left; padding: 24px; border-radius: 16px; border: 1px solid #d8dcd0; color: inherit; background: #fffefa; cursor: pointer; display: flex; flex-direction: column; gap: 22px; transition: transform .2s, border-color .2s, background .2s; }
.role:hover { border-color: #5f7860; transform: translateY(-4px); }
.role[aria-pressed="true"] { background: #e6eddb; border-color: #516f41; transform: translateY(-8px); }
.role svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.role strong { font-weight: 600; font-size: 19px; }
:focus-visible { outline: 3px solid #587947; outline-offset: 4px; }
form { margin-top: 28px; max-width: 420px; }
label { display: block; font-size: 14px; margin-bottom: 8px; }
input { width: 100%; padding: 14px; border-radius: 8px; border: 1px solid #a8b39f; background: white; }
.submit { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 18px; margin-top: 12px; border: none; border-radius: 8px; color: white; background: #244c35; cursor: pointer; }
.submit:disabled { opacity: .6; cursor: wait; }
#error { color: #a33226; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  header { padding: 20px; }
  header a span { display: none; }
  main { margin-top: 48px; }
  #roles { grid-template-columns: 1fr; gap: 12px; }
  .role { flex-direction: row; align-items: center; padding: 20px; gap: 18px; }
  .role[aria-pressed="true"] { transform: translateY(-4px); }
  .role:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .role { transition: none; } }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
#connection-status { font-size: 12px; color: #627068; }
#connection-status[data-connection="connected"] { color: #32633a; }
.panel { margin-top: 24px; padding: 24px; border: 1px solid #d8dcd0; border-radius: 16px; background: #fffefa; }
h2 { font-size: 21px; font-weight: 600; margin: 0 0 20px; letter-spacing: -.5px; }
h3 { font-size: 14px; font-weight: 600; }
textarea { width: 100%; resize: vertical; font: inherit; padding: 12px; border: 1px solid #a8b39f; border-radius: 8px; background: white; }
.hint { font-size: 13px; color: #627068; line-height: 1.5; }
.status-tag { display: inline-block; font-size: 12px; color: #47623f; background: #e6eddb; padding: 5px 10px; border-radius: 20px; }
#notification-list { list-style: none; padding: 0; margin: 0; }
#detail-photo { width: 100%; max-height: 55vh; object-fit: contain; border-radius: 12px; background: #e8ebe1; }
#detail-contractor-note, #detail-client-note { white-space: pre-wrap; overflow-wrap: anywhere; }
#workflow-error { color: #a33226; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.contractor-mode header, .contractor-mode .workspace-bar, .contractor-mode #workspace-heading, .contractor-mode #workspace-intro, .contractor-mode #workspace > .panel:not(#contractor-panel) { display: none; }
.contractor-mode main { margin: 0; width: 100%; }
.contractor-mode #workspace { min-height: var(--contractor-height, 100dvh); }
.contractor-mode #contractor-panel { margin: 0; padding: 0; border: 0; border-radius: 0; height: var(--contractor-height, 100dvh); background: #f7f6f2; display: flex; flex-direction: column; overflow: hidden; }
#completion-form { display: flex; flex: 1; flex-direction: column; min-height: 0; width: 100%; max-width: none; margin: 0; }
#camera-stage { flex: 1; position: relative; background: #15221c; min-height: 0; overflow: hidden; }
#camera { height: 100%; width: 100%; object-fit: cover; position: absolute; inset: 0; }
.camera-overlay { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: max(24px, env(safe-area-inset-top)) 24px; color: white; background: linear-gradient(#0008, transparent); }
.camera-overlay span:first-child { font-weight: 800; font-size: 22px; letter-spacing: -1px; }
.camera-overlay span:last-child { font-size: 13px; padding-top: 5px; }
#camera-message { color: white; position: absolute; top: 40%; width: 100%; padding: 24px; text-align: center; }
.camera-controls { position: absolute; bottom: 0; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 32px 24px max(32px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #000a); }
.choose-photo, .camera-spacer { width: 95px; color: white; font-size: 13px; cursor: pointer; }
#shutter { flex-shrink: 0; width: 78px; height: 78px; padding: 5px; border: 3px solid white; border-radius: 50%; background: transparent; cursor: pointer; }
#shutter span { display: block; width: 100%; height: 100%; background: white; border-radius: 50%; }
#shutter:disabled { opacity: .4; }
#capture-review { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 16px; gap: 16px; animation: review-rise .25s ease-out; }
.photo-card { flex: 1 1 42%; min-height: 80px; position: relative; overflow: hidden; border-radius: 16px; background: #15221c; }
#captured-photo { width: 100%; height: 100%; position: absolute; object-fit: contain; }
#retake { position: absolute; top: 12px; right: 12px; border: 1px solid #fff8; background: #15221ccc; color: white; padding: 8px 12px; border-radius: 20px; cursor: pointer; font-size: 13px; }
.note-entry { flex: 0 1 30%; display: flex; flex-direction: column; min-height: 100px; }
.note-entry textarea { flex: 1; min-height: 45px; resize: none; }
.note-entry .hint { margin: 8px 0 0; }
.capture-submit { padding-bottom: env(safe-area-inset-bottom); }
.capture-submit .submit { margin: 0; min-height: 54px; }
.contractor-mode #workflow-error { position: fixed; top: 0; left: 0; right: 0; margin: 0; z-index: 5; padding: 16px; background: #fff1e9; }
#upload-result { position: absolute; top: 70px; margin: 0 16px; padding: 12px 16px; border-radius: 8px; background: #e6eddb; color: #244c35; z-index: 2; font-size: 14px; }
@keyframes review-rise { from { opacity: .3; transform: translateY(48px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 700px) { .contractor-mode #contractor-panel { width: min(100%, 520px); margin: 0 auto; } }
@media (max-width: 600px) { .panel { padding: 18px; } }
@media (prefers-reduced-motion: reduce) { #capture-review { animation: none; } }

.workspace-mode main { margin: 24px auto 48px; width: min(100% - 40px, 920px); }
body[data-role="office"] { --nav-background: #244c35; --nav-muted: #d9e9dc; }
body[data-role="client"] { --nav-background: #274a68; --nav-muted: #dbe9f5; }
.workspace-mode header { position: sticky; top: 0; z-index: 15; background: var(--nav-background, #f7f6f2); color: #fffefa; border-bottom-color: transparent; }
.workspace-mode header a span, .workspace-mode header #connection-status { color: var(--nav-muted); }
.workspace-mode header #notifications-toggle { background: #ffffff12; color: #fffefa; border-color: #ffffff55; }
.workspace-mode header #notifications-toggle:hover { background: #ffffff26; }
.workspace-mode header :focus-visible { outline-color: #fffefa; }
.header-actions { display: flex; align-items: center; gap: 14px; }
#current-role { display: inline-flex; align-items: center; padding: 8px 12px; border: 1px solid #cbd5c2; border-radius: 8px; font-size: 14px; font-weight: 650; white-space: nowrap; }
.workspace-mode #current-role { color: #fffefa; background: #ffffff12; border-color: #ffffff55; }
.page-heading { margin-bottom: 24px; flex-wrap: wrap; }
.list-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#wipe-database { border: 1px solid #d7b2a7; background: #fff1e9; color: #963b2e; font-size: 13px; cursor: pointer; padding: 9px 14px; border-radius: 8px; }
#wipe-database:disabled { opacity: .6; cursor: wait; }
#wipe-result { color: #47623f; font-size: 14px; }
.page-heading h1, #detail-heading { font-size: 34px; margin: 0; letter-spacing: -1px; }
#refresh-jobs { border: 1px solid #d8dcd0; background: #fffefa; color: #244c35; font-size: 13px; cursor: pointer; padding: 9px 14px; border-radius: 8px; }
#pending-heading { margin-bottom: 12px; font-size: 17px; }
.job-count { display: inline-block; font-size: 12px; font-weight: 500; background: #e6eddb; color: #47623f; padding: 3px 8px; border-radius: 20px; vertical-align: middle; margin-left: 6px; }
.job-list { overflow: hidden; border: 1px solid #d8dcd0; border-radius: 12px; background: #fffefa; }
.job-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 16px; color: inherit; text-decoration: none; border-bottom: 1px solid #e5e7dd; }
.job-row:last-child { border-bottom: 0; }
.job-row:hover { background: #f0f3e9; }
.job-row-content { min-width: 0; }
.job-row-content strong { font-size: 16px; font-weight: 600; }
.job-row .job-note, .job-row .office-note { margin: 5px 0 0; color: #627068; font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.job-row .office-note { color: #47623f; }
.job-photo { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #e8ebe1; }
.empty-list { padding: 24px; margin: 0; color: #627068; font-size: 14px; }
#completed-section { margin-top: 28px; border-top: 1px solid #d8dcd0; }
#completed-section summary { padding: 20px 0; font-size: 17px; font-weight: 600; cursor: pointer; }
#back-to-jobs { display: inline-block; color: #47623f; font-size: 14px; text-decoration: none; margin: 0 0 24px; }
#job-detail-page { max-width: 720px; }
#detail-status { margin: 12px 0 20px; }
#job-detail-page h3 { margin-top: 24px; }
#detail-heading:focus { outline: none; }
#notifications-toggle { position: relative; width: 44px; height: 44px; border: 1px solid #d8dcd0; border-radius: 50%; background: #fffefa; color: #244c35; display: grid; place-items: center; cursor: pointer; }
#notifications-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#notifications-panel, #latest-notification { position: fixed; z-index: 20; right: 6vw; top: 82px; width: min(360px, calc(100vw - 32px)); background: #fffefa; border: 1px solid #cbd5c2; border-radius: 14px; box-shadow: 0 12px 40px #172c2824; }
#notifications-panel { padding: 18px; max-height: min(65vh, 520px); overflow-y: auto; }
#notifications-heading { font-size: 17px; margin: 0; }
#close-notifications, .dismiss-notification { border: 0; background: transparent; font-size: 24px; color: #627068; cursor: pointer; width: 36px; height: 36px; flex-shrink: 0; }
#notification-list li { margin-top: 10px; border-radius: 8px; background: #f1f4ea; }
#notification-list a { display: block; padding: 14px; color: #244c35; text-decoration: none; font-size: 14px; line-height: 1.5; }
#latest-notification { display: flex; align-items: flex-start; gap: 8px; padding: 14px; background: #e6eddb; }
#latest-notification::before { content: ''; position: absolute; top: -7px; right: 15px; width: 12px; height: 12px; background: #e6eddb; border-top: 1px solid #cbd5c2; border-left: 1px solid #cbd5c2; transform: rotate(45deg); }
#latest-notification a { flex: 1; padding: 6px 0; color: #244c35; font-size: 14px; line-height: 1.5; text-decoration: none; }
.contractor-mode main { margin: 0; width: 100%; }
@media (max-width: 600px) {
  .workspace-mode main { margin-top: 20px; }
  .contractor-mode main { margin: 0; }
  .header-actions { gap: 10px; }
  #current-role { font-size: 12px; padding: 8px 10px; }
  .job-row { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .job-photo { width: 52px; height: 52px; grid-row: span 2; }
  .job-row .status-tag { grid-column: 2; justify-self: start; }
  #notifications-panel, #latest-notification { right: 16px; top: 80px; }
}
