:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #15302d;
  background: #dfe9e7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #dce9e7, #eef3f2); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
#app { min-height: 100vh; background: #f6f8f8; }

.screen { min-height: 100vh; padding: 20px 18px 112px; }
.login { display: grid; align-content: center; gap: 24px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: white; background: #0f766e; font-size: 24px; box-shadow: 0 8px 24px #0f766e35; }
.brand h1, .brand p { margin: 0; }
.brand h1 { font-size: 20px; }
.brand p { color: #667b78; font-size: 13px; margin-top: 2px; }

.hero h2 { font-size: 30px; line-height: 1.12; margin: 0 0 10px; }
.hero p { color: #667b78; line-height: 1.55; margin: 0; }
.card { background: white; border: 1px solid #dce6e4; border-radius: 20px; padding: 17px; box-shadow: 0 9px 30px #274a4310; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label, .section-label { color: #516763; font-size: 13px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid #cbd9d6; border-radius: 13px; padding: 13px 14px; background: #fbfdfd; color: #15302d; outline: none; }
input:focus, textarea:focus { border-color: #0f766e; box-shadow: 0 0 0 3px #0f766e18; }
textarea { resize: vertical; min-height: 92px; }

.primary, .secondary, .ghost, .danger { border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 800; }
.primary { width: 100%; color: white; background: #0f766e; box-shadow: 0 7px 18px #0f766e30; }
.secondary { color: #0f766e; background: #e6f2f0; }
.ghost { color: #36534f; background: transparent; padding-inline: 8px; }
.danger { color: #a23b35; background: #fff0ee; }
.primary:active, .secondary:active, .ghost:active { transform: translateY(1px); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 21px; }
.topbar small { display: block; color: #728581; margin-top: 3px; }
.back { width: 42px; height: 42px; border: 0; border-radius: 14px; background: white; color: #173a35; font-size: 22px; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: #dcefeb; color: #0f766e; font-weight: 900; }

.date-pill { display: inline-flex; align-items: center; gap: 8px; color: #0f766e; background: #e2f1ee; border-radius: 999px; padding: 7px 11px; font-size: 13px; font-weight: 800; }
.choice-grid { display: grid; gap: 13px; margin-top: 20px; }
.choice { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 13px; width: 100%; text-align: left; border: 1px solid #dbe7e5; border-radius: 19px; padding: 15px; background: white; color: inherit; }
.choice-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; font-size: 24px; background: #e8f4f2; }
.choice strong { display: block; font-size: 16px; }
.choice span { color: #71827f; font-size: 13px; margin-top: 3px; }
.choice-arrow { color: #0f766e; font-size: 20px; }

.summary { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0 18px; }
.metric { flex: 1; border-radius: 17px; background: #173f39; color: white; padding: 14px; }
.metric.alt { background: white; color: #173f39; border: 1px solid #dce6e4; }
.metric b { display: block; font-size: 23px; }
.metric span { font-size: 12px; opacity: .76; }
.progress { height: 7px; border-radius: 99px; background: #dce7e5; overflow: hidden; margin-bottom: 18px; }
.progress > div { height: 100%; background: #18a999; border-radius: inherit; }
.sort-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -5px 0 14px; color: #617672; font-size: 12px; font-weight: 700; }
.sort-toolbar > div { display: flex; padding: 3px; border-radius: 11px; background: #e5ecea; }
.sort-toolbar button { border: 0; border-radius: 8px; padding: 7px 10px; background: transparent; color: #526a66; font-size: 12px; font-weight: 800; }
.sort-toolbar button.active { background: white; color: #0f766e; box-shadow: 0 2px 8px #234b4418; }
.unit-tools { margin-bottom: 14px; }
.unit-tools .sort-toolbar { margin-bottom: 9px; }
.add-unit-button { width: 100%; }

.visit-list { display: grid; gap: 11px; }
.visit { width: 100%; text-align: left; border: 1px solid #dce6e4; border-radius: 18px; background: white; padding: 15px; color: inherit; }
.visit-head { display: flex; justify-content: space-between; gap: 10px; }
.visit h3 { margin: 0; font-size: 16px; }
.visit p { margin: 5px 0 0; color: #6a7d79; font-size: 13px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 13px; }
.badge { padding: 5px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; background: #edf3f2; color: #49625e; }
.badge.gas { background: #fff0d8; color: #8d5c0c; }
.badge.chimney { background: #e7edfb; color: #3d5793; }
.badge.done { background: #dff4e9; color: #27784d; }

.unit-header { margin-bottom: 16px; }
.unit-header h2 { margin: 0 0 5px; font-size: 24px; }
.unit-header p { margin: 0; color: #6b7f7b; }
.protocol-list { display: grid; gap: 12px; }
.protocol-card { display: grid; grid-template-columns: 45px 1fr auto; align-items: center; gap: 12px; border: 1px solid #dce6e4; background: white; border-radius: 18px; padding: 15px; }
.protocol-card .icon { display: grid; place-items: center; height: 45px; border-radius: 13px; background: #edf5f3; font-size: 21px; }
.protocol-card h3 { margin: 0; font-size: 15px; }
.protocol-card p { margin: 4px 0 0; color: #71827f; font-size: 12px; }
.protocol-card button { border: 0; border-radius: 11px; padding: 9px 11px; background: #0f766e; color: white; font-weight: 800; }

.notice { padding: 13px; border-radius: 14px; background: #e8f4f2; color: #245b54; font-size: 13px; line-height: 1.45; margin-bottom: 16px; }
.quick-ok { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #daf2e6; border: 1px solid #b8e3cf; border-radius: 16px; padding: 14px; margin-bottom: 17px; }
.quick-ok strong { display: block; color: #236a48; }
.quick-ok span { display: block; color: #56806c; font-size: 12px; margin-top: 3px; }
.quick-ok button { border: 0; border-radius: 11px; color: white; background: #27845b; padding: 10px 12px; font-weight: 800; white-space: nowrap; }
.special-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: -7px 0 17px; }
.special-actions button { width: 100%; }

.form-section { margin-top: 18px; }
.form-section h2 { font-size: 16px; margin: 0 0 10px; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check { display: flex; gap: 9px; align-items: center; padding: 11px; border: 1px solid #dae5e3; border-radius: 13px; background: white; font-size: 13px; }
.check input { width: 18px; height: 18px; padding: 0; accent-color: #0f766e; }
.inspection-row { background: white; border: 1px solid #dce6e4; border-radius: 16px; padding: 13px; margin-bottom: 9px; }
.inspection-row > strong { display: block; font-size: 14px; margin-bottom: 10px; }
.segments { display: flex; gap: 6px; overflow-x: auto; }
.segments label { flex: 1; min-width: max-content; }
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments span { display: block; text-align: center; padding: 9px 10px; border-radius: 10px; background: #edf2f1; color: #536a66; font-size: 12px; font-weight: 700; }
.segments input:checked + span { color: white; background: #0f766e; }
.segments input[value="bad"]:checked + span { background: #bd443b; }
.segments input[value="none"]:checked + span { color: #445d59; background: #dfe7e5; }

.signature { width: 100%; height: 170px; display: block; border: 1px dashed #91aaa6; border-radius: 15px; background: white; touch-action: none; }
.signature-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.outcome-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.outcome-actions button { border: 1px solid #e2c8c5; border-radius: 13px; padding: 12px 9px; color: #8f3f39; background: #fff7f6; font-weight: 800; }
.outcome-actions button.active { color: white; background: #b84940; border-color: #b84940; box-shadow: 0 5px 14px #b8494030; }
.outcome-hint { margin: 7px 2px 0; color: #7b8c89; font-size: 11px; }
.is-hidden { display: none; }
.worker-stamp { display: grid; grid-template-columns: 125px 1fr; align-items: center; gap: 13px; padding: 14px; border: 1px solid #cbdad7; border-radius: 15px; background: white; }
.worker-stamp-mark { padding: 9px 6px; text-align: center; color: #315f58; border: 2px solid #4f7c75; border-radius: 50%; font-size: 9px; line-height: 1.35; transform: rotate(-2deg); }
.worker-stamp-mark strong { font-size: 10px; }
.worker-stamp > div:last-child { display: grid; gap: 4px; }
.worker-stamp span { color: #71837f; font-size: 11px; line-height: 1.35; }
.worker-stamp em { margin-top: 5px; color: #365954; font-family: cursive; }
.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 13px 18px calc(13px + env(safe-area-inset-bottom)); background: #ffffffed; border-top: 1px solid #dce6e4; backdrop-filter: blur(12px); }
.sticky-actions button { flex: 1; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 90px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 36px); padding: 11px 15px; border-radius: 12px; color: white; background: #183d38; box-shadow: 0 12px 30px #102a2660; font-size: 13px; }
.login-error { min-height: 18px; margin: 2px 0 10px; color: #a33f38; font-size: 13px; font-weight: 700; }

@media (min-width: 700px) {
  body { padding: 26px 0; }
  #app { width: 430px; min-height: calc(100vh - 52px); margin: 0 auto; border-radius: 30px; overflow: hidden; box-shadow: 0 28px 90px #19393333; }
  .screen { min-height: calc(100vh - 52px); }
  .sticky-actions { width: 430px; left: 50%; right: auto; transform: translateX(-50%); bottom: 26px; border-radius: 0 0 30px 30px; }
  .toast { bottom: 112px; }
  .unit-tools { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
  .unit-tools .sort-toolbar { margin: 0; }
  .add-unit-button { width: auto; }
}
