:root {
  color-scheme: light;
  --bg: #fffaf1;
  --panel: #ffffff;
  --text: #282318;
  --muted: #746c5e;
  --line: #e8dfcf;
  --brand: #e99a22;
  --brand-dark: #7b4700;
  --brand-soft: #fff0cf;
  --green: #18734a;
  --green-soft: #dff4e7;
  --danger: #a83a32;
  --danger-soft: #fae4e1;
  --warning: #76520d;
  --warning-soft: #fff3c9;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, .camera-button { min-height: 48px; border-radius: 12px; padding: 12px 16px; border: 1px solid transparent; font-weight: 700; cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .camera-button:focus-within { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

.app-shell { width: min(100%, 720px); margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.app-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 1.25rem; }
.brand-text { display: grid; }
.brand-text span, .small-text { color: var(--muted); font-size: .9rem; }
.link-button { margin-left: auto; background: transparent; color: var(--muted); padding-inline: 8px; min-height: 42px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .9rem; }
.progress-track { height: 8px; margin: 8px 0 22px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-track div { height: 100%; width: 0; background: var(--brand); transition: width .25s ease; }

.screen { display: none; }
.screen.active { display: block; }
h1 { margin: 10px 0 6px; font-size: clamp(1.7rem, 6vw, 2.35rem); line-height: 1.1; }
.lead { color: var(--muted); margin: 0 0 22px; line-height: 1.45; }
.badge { display: inline-block; background: var(--brand-soft); color: var(--brand-dark); padding: 7px 11px; border-radius: 999px; font-weight: 700; }
.job-details { margin: 24px 0; }
.job-details div, .summary-list div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.job-details dt { color: var(--muted); }
.job-details dd { margin: 0; font-weight: 700; }

.primary { background: var(--text); color: var(--panel); }
.secondary { background: var(--panel); color: var(--text); border-color: var(--line); }
.ready { background: var(--green); color: white; }
.full { width: 100%; }
.grow { flex: 1; }
.screen-actions { display: flex; gap: 10px; margin-top: 24px; }
.top-space { margin-top: 24px; }

.item-list { display: grid; gap: 4px; }
.photo-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.photo-thumb { width: 46px; height: 46px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-copy { min-width: 0; display: grid; }
.photo-copy span { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camera-button { display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.camera-dialog { width: min(calc(100% - 24px), 680px); max-height: calc(100dvh - 24px); padding: 14px; border: 0; border-radius: 20px; background: var(--panel); color: var(--text); }
.camera-dialog::backdrop { background: rgba(0, 0, 0, .82); }
.form-dialog { width: min(calc(100% - 24px), 560px); max-height: calc(100dvh - 24px); overflow: auto; padding: 20px; border: 0; border-radius: 20px; background: var(--panel); color: var(--text); }
.form-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.camera-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.camera-close { min-width: 44px; min-height: 44px; padding: 4px; background: transparent; color: var(--text); font-size: 1.8rem; }
.camera-stage { width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 14px; background: #000; }
.camera-stage video, .camera-stage canvas { width: 100%; height: 100%; object-fit: cover; }
.camera-message { color: var(--muted); text-align: center; margin: 12px 0; }
.camera-actions { display: flex; gap: 10px; }

.check-section { margin-top: 20px; }
.check-section h2 { color: var(--muted); font-size: 1rem; margin: 0 0 4px; }
.check-row { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); }
.check-row span { display: grid; gap: 3px; }
.check-row small { color: var(--muted); line-height: 1.35; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.choice { background: var(--panel); color: var(--text); border-color: var(--line); min-height: 58px; }
.choice.selected, .supply-options button.selected { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.supply-item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.supply-item strong { display: block; margin-bottom: 9px; }
.supply-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.supply-options button { min-height: 42px; padding: 8px; background: var(--panel); color: var(--text); border-color: var(--line); font-size: .9rem; }

.form-section { display: grid; gap: 9px; margin-top: 18px; }
.form-section label:not(.camera-button) { margin-top: 6px; font-weight: 700; }
select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 13px; }
input[type="email"], input[type="password"], input[type="datetime-local"] { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 13px; }
textarea { resize: vertical; }
.auth-view { max-width: 440px; margin: 8vh auto 0; }
.auth-brand { display: flex; gap: 11px; align-items: center; margin-bottom: 36px; }
.auth-brand > div:last-child { display: grid; }
.auth-brand span { color: var(--muted); }
.auth-link { margin: 4px auto 0; color: var(--brand-dark); }
.error-text { color: var(--danger); font-weight: 700; }
.empty-list { color: var(--muted); padding: 18px 0; }
.cleaning-card { padding: 15px 0; border-bottom: 1px solid var(--line); }
.cleaning-card strong, .cleaning-card span { display: block; }
.cleaning-card span { color: var(--muted); margin: 4px 0 10px; }
.cleaning-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.cleaning-progress { margin: 12px 0; }
.cleaning-progress-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.cleaning-progress-head span { margin: 0; color: var(--text); }
.cleaning-progress-track { height: 10px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: var(--line); }
.cleaning-progress-track div { height: 100%; border-radius: inherit; background: var(--brand); }
.cleaning-stages { font-size: .88rem; line-height: 1.5; }
.notification-panel { margin: 0 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.notification-panel .small-text { margin: 9px 0 0; }
.admin-photo-gallery { display: grid; gap: 18px; }
.admin-photo-section { border-top: 1px solid var(--line); padding-top: 15px; }
.admin-photo-section h3 { margin: 0 0 10px; }
.admin-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.comparison-heading { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; color: var(--brand-dark); text-align: center; }
.admin-comparison-row { border-top: 1px solid var(--line); padding-top: 15px; }
.admin-comparison-row h3 { margin: 0 0 10px; }
.admin-comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.admin-photo-card { margin: 0; }
.admin-photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--line); }
.admin-photo-card figcaption { color: var(--muted); font-size: .82rem; margin-top: 5px; }
.comparison-label { display: none; font-weight: 800; color: var(--brand-dark); margin-bottom: 5px; }
.missing-photo div { display: grid; place-items: center; min-height: 140px; border-radius: 12px; background: var(--line); color: var(--muted); text-align: center; padding: 10px; }
.photo-gallery-dialog { width: min(calc(100% - 24px), 760px); }
.admin-report-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.admin-report-summary div { display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: var(--brand-soft); }
.admin-report-summary span { color: var(--muted); font-size: .82rem; }
.admin-report-section { border-top: 2px solid var(--line); padding-top: 18px; margin-top: 18px; }
.admin-report-section > h3 { margin: 0 0 12px; font-size: 1.25rem; }
.admin-report-list { display: grid; }
.admin-report-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-report-list > div > span:nth-child(2):not(.supply-level) { display: grid; flex: 1; }
.admin-report-list small, .report-issue small { color: var(--muted); }
.report-check { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--line); color: var(--muted); font-weight: 800; }
.report-check.done { background: var(--green-soft); color: var(--green); }
.supply-level { padding: 6px 9px; border-radius: 999px; background: var(--line); font-weight: 700; font-size: .84rem; }
.supply-level.out { background: var(--danger-soft); color: var(--danger); }
.supply-level.low { background: var(--warning-soft); color: var(--warning); }
.supply-level.sufficient { background: var(--green-soft); color: var(--green); }
.report-issue { padding: 13px; margin-bottom: 10px; border-radius: 12px; background: var(--warning-soft); }
.report-issue.major { background: var(--danger-soft); }
.report-issue p { margin: 6px 0; }
.report-ok { padding: 12px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-weight: 700; }
.summary-list { margin: 18px 0 24px; }
.center { text-align: center; }
.result-mark { width: 92px; height: 92px; display: grid; place-items: center; margin: 20px auto; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 2.8rem; font-weight: 800; }
.result-mark.blocked { background: var(--danger-soft); color: var(--danger); }
.notice { padding: 12px; border-radius: 12px; margin: 0 0 16px; background: var(--green-soft); color: var(--green); }
.notice.warning { background: var(--warning-soft); color: var(--warning); }
.hidden { display: none !important; }

@media (max-width: 540px) {
  .photo-item { grid-template-columns: 42px minmax(0, 1fr); }
  .photo-item .camera-button { grid-column: 1 / -1; width: 100%; }
  .choice-grid { grid-template-columns: 1fr; }
  .comparison-heading { display: none; }
  .comparison-label { display: block; }
  .admin-photo-grid { grid-template-columns: 1fr; }
  .admin-report-summary { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg:#191713; --panel:#25221c; --text:#f6efe2; --muted:#bdb3a3; --line:#403a30; --brand-soft:#49330e; --brand-dark:#ffd28b; --green-soft:#173d2d; --danger-soft:#4d2421; --warning-soft:#49390f; }
}
