:root {
  --navy: #01144d;
  --navy-2: #0a2670;
  --ink: #13203a;
  --muted: #61708a;
  --line: #dbe2ee;
  --line-strong: #c3cede;
  --paper: #ffffff;
  --canvas: #f3f6fb;
  --blue-soft: #e9effb;
  --blue-soft-2: #f5f8fe;
  --green: #147a52;
  --green-soft: #e8f6ef;
  --amber: #9a6100;
  --amber-soft: #fff4d9;
  --red: #b42318;
  --red-soft: #ffebe8;
  --shadow: 0 8px 24px rgba(1, 20, 77, .07);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", YuGothic, Meiryo, system-ui, sans-serif;
  padding-bottom: 92px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(20, 104, 211, .35);
  outline-offset: 2px;
}

button:disabled { cursor: not-allowed; opacity: .5; }

a { color: var(--navy); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 11px max(16px, calc((100vw - 1080px) / 2));
  color: #fff;
  background: var(--navy);
  box-shadow: 0 3px 14px rgba(1, 20, 77, .18);
}

.topbar__brand, .topbar__actions, .sheet-toolbar__top, .sheet-controls, .sheet-hints,
.area-card__heading, .area-card__actions, .row-heading, .row-actions, .input-with-next,
.section-title-line, .summary-toolbar, .modal-actions, .photo-gallery, .form-actions {
  display: flex;
  align-items: center;
}

.topbar__brand { gap: 10px; min-width: 0; }
.topbar__actions { gap: 8px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 11px;
  color: var(--navy);
  background: #fff;
  font-size: 22px;
  font-weight: 800;
}
.brand-title { font-size: 18px; font-weight: 800; letter-spacing: .02em; }
.brand-subtitle { color: rgba(255, 255, 255, .76); font-size: 11px; white-space: nowrap; }

.offline-badge {
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 4px 8px;
  color: rgba(255, 255, 255, .9);
  font-size: 11px;
  white-space: nowrap;
}
.offline-badge.is-offline { color: #ffdda1; border-color: rgba(255, 221, 161, .65); }
.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  font-size: 20px;
}

.app-shell { width: min(1080px, 100%); margin: 0 auto; padding: 14px 14px 0; }
.sheet-toolbar {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.sheet-toolbar__top { justify-content: space-between; gap: 14px; }
.eyebrow {
  margin: 0 0 3px;
  color: var(--navy-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
}
h1 { margin: 0; color: var(--navy); font-size: 20px; line-height: 1.3; }
h2 { margin: 0; color: var(--navy); font-size: 18px; line-height: 1.35; }
h3 { margin: 0; color: var(--navy); font-size: 15px; }
.save-status { color: var(--muted); font-size: 12px; white-space: nowrap; }
.sheet-controls { flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.sheet-select-label { flex: 0 0 100%; color: var(--muted); font-size: 12px; font-weight: 700; }
.sheet-controls select { flex: 1 1 240px; min-width: 0; }
.sheet-hints { flex-wrap: wrap; gap: 5px 14px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.sheet-hints span::before { content: "✓"; margin-right: 4px; color: var(--green); font-weight: 800; }

.quick-nav {
  position: sticky;
  top: 68px;
  z-index: 20;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 12px 0;
  padding: 3px 0 7px;
  scrollbar-width: none;
}
.quick-nav::-webkit-scrollbar { display: none; }
.quick-nav a {
  flex: 0 0 auto;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy);
  background: rgba(255, 255, 255, .95);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 3px 8px rgba(1, 20, 77, .04);
}

section.card, .area-card, .info-banner {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.card { padding: 18px; }
.card-header, .section-title-line { justify-content: space-between; gap: 12px; }
.card-header { margin-bottom: 13px; }
.section-title-line { margin-bottom: 10px; }
.section-help, .muted, small { color: var(--muted); }
.section-help { margin: 3px 0 0; font-size: 12px; }
.section-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: block; min-width: 0; margin: 0 0 10px; }
.field > span, .field-label {
  display: block;
  margin: 0 0 5px;
  color: #34445f;
  font-size: 12px;
  font-weight: 700;
}
.field--wide { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  padding: 9px 11px;
}
input::placeholder, textarea::placeholder { color: #9aa7ba; }
textarea { min-height: 78px; resize: vertical; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #596b86 50%), linear-gradient(135deg, #596b86 50%, transparent 50%);
  background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 32px;
}
.input-with-next { gap: 5px; }
.input-with-next input { flex: 1 1 auto; min-width: 0; }
.next-button {
  flex: 0 0 auto;
  min-height: 43px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--navy);
  background: var(--blue-soft-2);
  font-size: 11px;
  font-weight: 800;
}

button, .primary-button, .secondary-button, .danger-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 12px;
  font-weight: 800;
  line-height: 1.2;
}
.primary-button { color: #fff; background: var(--navy); }
.secondary-button { border-color: var(--line-strong); color: var(--navy); background: #fff; }
.danger-button { border-color: #f1c8c5; color: var(--red); background: #fff; }
.small-button { min-height: 34px; padding: 6px 9px; border-color: var(--line-strong); color: var(--navy); background: #fff; font-size: 12px; }
.small-button--primary { border-color: var(--navy); color: #fff; background: var(--navy); }
.small-button--danger { color: var(--red); border-color: #efc5c2; }
.text-button { min-height: auto; padding: 2px 4px; border: 0; color: var(--navy-2); background: transparent; font-size: 12px; }

.area-card { overflow: hidden; }
.area-card.is-excluded { border-color: #d8c89d; background: #fffdf6; }
.area-card__heading { justify-content: space-between; gap: 8px; padding: 14px 15px; background: #fff; }
.area-card.is-excluded .area-card__heading { background: #fffaf0; }
.area-card__title-button {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  gap: 9px;
  padding: 0;
  border: 0;
  color: var(--navy);
  background: transparent;
  text-align: left;
}
.chevron { display: inline-block; width: 17px; transition: transform .18s ease; }
.area-card.is-collapsed .chevron { transform: rotate(-90deg); }
.area-card__title { font-size: 17px; font-weight: 850; }
.area-card__unit { color: var(--muted); font-size: 11px; font-weight: 700; }
.area-card__actions { flex: 0 0 auto; gap: 4px; }
.area-card__body { padding: 0 15px 16px; }
.area-card.is-collapsed .area-card__body { display: none; }
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf1f7;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.status-chip.is-done { color: var(--green); background: var(--green-soft); }
.status-chip.is-excluded { color: var(--amber); background: var(--amber-soft); }
.area-card__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 0 0;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--navy);
  background: var(--blue-soft-2);
}
.area-card__total span { color: var(--muted); font-size: 12px; font-weight: 700; }
.area-card__total strong { font-size: 18px; }

.row-list { display: grid; gap: 9px; }
.measure-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--blue-soft-2);
}
.measure-row__top { align-items: flex-start; justify-content: space-between; gap: 8px; }
.row-heading { flex: 1 1 auto; gap: 7px; min-width: 0; }
.row-heading strong { color: var(--navy); font-size: 13px; }
.row-heading .row-number { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: #fff; background: var(--navy); font-size: 11px; font-weight: 800; }
.row-actions { flex: 0 0 auto; gap: 3px; }
.row-actions button { min-height: 31px; padding: 5px 7px; font-size: 11px; }
.measure-row .field { margin-bottom: 5px; }
.measure-row .grid { gap: 7px; }
.measure-row__calc { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.measure-row__calc strong { color: var(--navy); font-size: 14px; }
.row-divider { height: 1px; margin: 5px 0 10px; background: var(--line); }

.subhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 15px 0 8px; }
.subhead strong { color: var(--navy); font-size: 14px; }
.form-actions { flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.form-actions--end { justify-content: flex-end; }
.add-row-button { width: 100%; border: 1px dashed #9fb1cc; color: var(--navy); background: #fbfdff; }
.empty-state { padding: 15px 10px; border: 1px dashed #b9c6d8; border-radius: 10px; color: var(--muted); background: #fbfdff; text-align: center; font-size: 13px; }

.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-bottom: 12px; padding: 4px; border-radius: 11px; background: var(--blue-soft); }
.segmented button { min-height: 39px; border: 0; border-radius: 8px; color: var(--navy); background: transparent; font-size: 12px; }
.segmented button.is-active { color: #fff; background: var(--navy); box-shadow: 0 2px 5px rgba(1,20,77,.18); }
.formula-box { margin: 10px 0; padding: 11px 12px; border-left: 3px solid var(--navy-2); border-radius: 0 10px 10px 0; color: #34445f; background: var(--blue-soft-2); font-size: 12px; }
.formula-box strong { display: block; color: var(--navy); font-size: 15px; }
.pitch-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.readonly-field { padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f4f7fb; }
.readonly-field small { display: block; margin-bottom: 2px; }
.readonly-field strong { color: var(--navy); }

.choice-field { min-width: 0; margin: 0 0 10px; }
.choice-field--wide { grid-column: 1 / -1; }
.choice-field .field-label { margin-bottom: 5px; }
.choice-grid { display: grid; gap: 7px; }
.roof-shape-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.opening-preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 84px;
  gap: 3px;
  padding: 7px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--navy);
  background: #fff;
  text-align: center;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.choice-card:active { transform: translateY(1px); }
.choice-card.is-selected {
  border-color: var(--navy);
  background: var(--blue-soft);
  box-shadow: 0 0 0 2px rgba(1, 20, 77, .1);
}
.choice-card--roof { min-height: 90px; }
.choice-card--roof .choice-card__icon { flex: 0 0 54px; }
.choice-card--roof .choice-card__copy { min-width: 0; flex: 1; text-align: left; }
.choice-card__icon { display: grid; place-items: center; width: 54px; height: 38px; color: var(--navy); }
.choice-card--opening { min-height: 78px; }
.choice-card--opening .choice-card__icon { width: 40px; height: 30px; }
.choice-card__icon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.choice-card__icon img.icon-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.condition-chip__icon { width: 36px; height: 34px; }
.condition-chip__icon img.icon-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.location-diagram__visual img.location-diagram__img { display: block; width: 100%; height: auto; }
.choice-card--roof .choice-card__icon { height: 46px; }
.choice-card__label { display: block; color: var(--navy); font-size: 12px; font-weight: 800; line-height: 1.25; }
.choice-card small { display: block; color: var(--muted); font-size: 10px; line-height: 1.15; }

.location-diagram {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 11px;
  padding: 9px 10px;
  border: 1px solid #cbd8ed;
  border-radius: 12px;
  background: var(--blue-soft-2);
}
.location-diagram__visual { flex: 0 0 118px; color: var(--navy); }
.location-diagram__visual svg { display: block; width: 100%; height: auto; }
.diagram-faint, .diagram-highlight, .diagram-highlight-alt, .diagram-highlight-soft, .diagram-faint-fill { stroke-linecap: round; stroke-linejoin: round; }
.diagram-faint { fill: none; stroke: #b7c4d8; stroke-width: 2; }
.diagram-faint-fill { fill: #f4f7fb; stroke: #c4d0e2; stroke-width: 1.2; }
.diagram-highlight { fill: var(--navy); stroke: var(--navy); stroke-width: 1.2; }
.diagram-highlight-alt { fill: #5576ae; stroke: #5576ae; stroke-width: 1.2; }
.diagram-highlight-soft { fill: #8ca8d1; stroke: #8ca8d1; stroke-width: 1.2; }
.location-diagram__text { min-width: 0; }
.location-diagram__text strong { display: block; margin-bottom: 2px; color: var(--navy); font-size: 12px; }
.location-diagram__text p { margin: 0; color: #425572; font-size: 11px; line-height: 1.45; }
.diagram-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; color: #425572; font-size: 10px; line-height: 1.35; }
.diagram-legend span { display: inline-flex; align-items: center; gap: 4px; }
.diagram-key { display: inline-block; width: 13px; height: 3px; border-radius: 3px; background: var(--navy); }
.diagram-key--alt { background: #5576ae; }

.condition-panel { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.condition-title { margin: 0 0 7px; color: var(--navy); font-size: 12px; font-weight: 800; }
.condition-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.condition-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 35px; padding: 5px 9px 5px 7px; border: 1px solid var(--line-strong); border-radius: 999px; color: #43526c; background: #fff; font-size: 12px; font-weight: 700; }
.condition-chip__icon { display: grid; place-items: center; width: 23px; height: 22px; color: var(--navy-2); }
.condition-chip__icon-svg { display: block; width: 100%; height: 100%; }
.condition-chip__label { line-height: 1.2; }
.condition-chip.is-on { border-color: #e0a5a0; color: var(--red); background: var(--red-soft); }
.condition-chip.is-on .condition-chip__icon { color: var(--red); }
.direct-entry { margin-top: 13px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.direct-entry__title { margin: 0 0 7px; color: var(--navy); font-size: 12px; font-weight: 800; }
.direct-entry__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.direct-entry .field { margin: 0; }
.direct-entry .field > span { font-size: 11px; }

.photo-strip { margin-top: 9px; }
.photo-gallery { flex-wrap: wrap; gap: 7px; }
.photo-thumb { position: relative; width: 68px; height: 68px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #eef2f7; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb button { position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 22px; height: 22px; min-height: 22px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: rgba(1, 20, 77, .82); font-size: 14px; }
.photo-add { min-height: 34px; padding: 6px 9px; border: 1px dashed #9fb1cc; border-radius: 9px; color: var(--navy); background: #fbfdff; font-size: 12px; font-weight: 800; }

.checklist { display: grid; gap: 7px; }
.checklist label { display: flex; align-items: center; gap: 8px; color: #34445f; font-size: 13px; }
.checklist input { width: 18px; min-height: 18px; accent-color: var(--navy); }
.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #f2d59e;
  border-radius: 11px;
  color: #6d4a00;
  background: #fff9e9;
  font-size: 12px;
}
.notice strong { display: block; margin-bottom: 2px; color: #664600; }
.notice--blue { border-color: #b7caee; color: #294878; background: #eff5ff; }

.material-table, .takeoff-table, .summary-table { width: 100%; border-collapse: collapse; }
.material-table th, .material-table td, .takeoff-table th, .takeoff-table td, .summary-table th, .summary-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.material-table th, .takeoff-table th, .summary-table th { color: var(--muted); font-size: 11px; font-weight: 800; text-align: left; }
.material-table td, .takeoff-table td, .summary-table td { font-size: 12px; }
.material-table .field, .takeoff-table .field { margin: 0; }
.material-table input, .material-table select, .takeoff-table input { min-height: 35px; padding: 6px 7px; font-size: 12px; }
.material-table .align-right, .takeoff-table .align-right, .summary-table .align-right { text-align: right; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 590px; }
.takeoff-table input.name-edit { min-width: 145px; }
.sub-total-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 12px; padding: 11px 12px; border-radius: 10px; color: var(--navy); background: var(--blue-soft-2); }
.sub-total-line span { color: var(--muted); font-size: 12px; }
.sub-total-line strong { font-size: 17px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.metric { padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--blue-soft-2); }
.metric span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.metric strong { display: block; margin-top: 3px; color: var(--navy); font-size: 18px; }

.paint-lines { display: grid; gap: 8px; }
.paint-line { padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdff; }
.paint-line__top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 7px; }
.paint-line__bottom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 5px; }
.paint-line .field { margin: 0; }
.paint-line .field > span { font-size: 11px; }
.paint-line .field small { display: block; margin-top: 4px; font-size: 10px; }
.paint-line__label { margin-bottom: 6px; color: var(--navy); font-size: 12px; font-weight: 800; }
.paint-summary { margin-top: 13px; }
.paint-summary h3 { margin-bottom: 7px; }
.paint-summary__empty { color: var(--muted); font-size: 12px; }

.info-banner { padding: 13px 15px; color: #2e466f; background: #eef4ff; }
.info-banner strong { display: block; margin-bottom: 2px; color: var(--navy); }
.info-banner p { margin: 0; font-size: 12px; }

.bottom-total {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 9px max(10px, calc((100vw - 1080px) / 2)); calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -5px 18px rgba(1, 20, 77, .09);
  backdrop-filter: blur(8px);
}
.bottom-total div { min-width: 0; text-align: center; }
.bottom-total span { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.bottom-total strong { display: block; overflow: hidden; color: var(--navy); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.toast {
  position: fixed;
  right: 14px;
  bottom: 88px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 28px));
  padding: 10px 13px;
  border-radius: 10px;
  color: #fff;
  background: rgba(1, 20, 77, .94);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .18s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(1, 20, 77, .52); }
.modal { width: min(520px, 100%); max-height: min(760px, calc(100vh - 32px)); overflow: auto; padding: 18px; border-radius: 17px; background: #fff; box-shadow: 0 18px 60px rgba(1, 20, 77, .24); }
.modal h2 { margin-bottom: 13px; }
.modal-actions { justify-content: flex-end; gap: 7px; margin-top: 12px; }

@media (min-width: 720px) {
  .app-shell { padding-top: 20px; }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .area-card__body { padding-left: 20px; padding-right: 20px; }
  .row-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .measure-row--wide { grid-column: 1 / -1; }
  .bottom-total { padding-left: max(18px, calc((100vw - 1080px) / 2)); padding-right: max(18px, calc((100vw - 1080px) / 2)); }
}

@media (max-width: 430px) {
  .topbar { min-height: 62px; padding: 10px 12px; }
  .quick-nav { top: 62px; }
  .brand-title { font-size: 16px; }
  .brand-subtitle { font-size: 10px; }
  .brand-mark { width: 34px; height: 34px; font-size: 19px; }
  .sheet-toolbar { padding: 14px; }
  .sheet-toolbar__top { align-items: flex-start; flex-direction: column; gap: 4px; }
  .grid, .grid--3, .pitch-line { grid-template-columns: 1fr; }
  .roof-shape-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .opening-preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .choice-card { min-height: 76px; padding: 5px 3px; border-radius: 9px; }
  .choice-card--roof { min-height: 86px; }
  .choice-card--roof .choice-card__icon { flex-basis: 40px; width: 40px; height: 30px; }
  .choice-card__icon { width: 43px; height: 31px; }
  .choice-card--opening .choice-card__icon { width: 34px; height: 26px; }
  .choice-card__label { font-size: 10px; }
  .choice-card small { font-size: 9px; }
  .location-diagram { align-items: flex-start; padding: 8px; }
  .location-diagram__visual { flex-basis: 96px; }
  .location-diagram__text p { font-size: 10px; }
  .paint-line__top, .paint-line__bottom { grid-template-columns: 1fr; }
  .area-card__heading { padding: 12px; }
  .area-card__body { padding: 0 12px 13px; }
  .area-card__actions .small-button { padding: 5px 6px; }
}

.backup-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.modal-overlay { position: fixed; inset: 0; background: rgba(1, 20, 77, 0.45); display: grid; place-items: center; padding: 20px; z-index: 60; }
.modal-card { background: #fff; border-radius: 14px; padding: 20px; max-width: 420px; width: 100%; box-shadow: 0 12px 32px rgba(1, 20, 77, 0.25); }
.modal-card p { margin: 8px 0 4px; }

/* ===== v014: report ===== */
.report-overlay { display: block; overflow-y: auto; place-items: initial; padding: 16px 12px 40px; }
.report-actions { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; justify-content: flex-end; padding: 8px 0; }
.report-sheet { background: #fff; color: #122; max-width: 760px; margin: 0 auto; padding: 28px 26px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.report-head { border-bottom: 3px solid #01144D; padding-bottom: 10px; margin-bottom: 14px; }
.report-head h2 { margin: 0 0 4px; font-size: 22px; color: #01144D; }
.report-head p { margin: 0; font-size: 12px; color: #456; }
.report-sheet h3 { margin: 18px 0 8px; font-size: 15px; color: #01144D; border-left: 4px solid #01144D; padding-left: 8px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th, .report-table td { border: 1px solid #b9c4d6; padding: 6px 8px; text-align: left; vertical-align: top; }
.report-table th { background: #eef2f9; color: #01144D; white-space: nowrap; }
.report-table .align-right { text-align: right; }
.report-total { font-weight: 700; margin: 10px 0 0; font-size: 13px; }
.report-note { font-size: 11px; color: #567; margin: 6px 0 0; }
.report-memo { color: #345; }
.report-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.report-photos figure { margin: 0; }
.report-photos img { width: 100%; height: 110px; object-fit: cover; border: 1px solid #ccd; border-radius: 4px; }
.report-photos figcaption { font-size: 11px; color: #345; margin-top: 2px; }
.report-foot { margin-top: 20px; border-top: 1px solid #ccd; padding-top: 8px; }

@media print {
  body.report-open .topbar,
  body.report-open .app-shell,
  body.report-open .bottom-total,
  body.report-open .toast,
  body.report-open #photoPicker,
  body.report-open #backupPicker { display: none !important; }
  body.report-open .report-overlay { position: static; overflow: visible; background: #fff; padding: 0; }
  body.report-open .report-actions { display: none !important; }
  body.report-open .report-sheet { box-shadow: none; border-radius: 0; max-width: none; padding: 0; }
  body.report-open .report-photos img { height: 90px; }
}

/* ===== v015: field mode ===== */
.field-mode-button { min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.55); background: transparent; color: #fff; font-size: 12px; font-weight: 700; }
.field-mode-button.is-on { background: #fac330; border-color: #fac330; color: #01144d; }
body.field-mode { --ink: #060d1f; --muted: #33445e; --line: #aebdd2; --line-strong: #8496b3; --canvas: #e9eef6; font-size: 16.5px; }
body.field-mode input, body.field-mode select, body.field-mode textarea { min-height: 50px; font-size: 17px; border-width: 2px; color: #060d1f; }
body.field-mode textarea { min-height: 76px; }
body.field-mode .small-button { min-height: 48px; font-size: 14px; padding: 10px 14px; }
body.field-mode .primary-button, body.field-mode .secondary-button, body.field-mode .danger-button { min-height: 52px; font-size: 16px; }
body.field-mode .condition-chip { min-height: 48px; font-size: 14px; padding: 8px 12px 8px 10px; }
body.field-mode .photo-add { min-height: 60px; font-size: 15px; }
body.field-mode .next-button { min-width: 54px; min-height: 50px; font-size: 14px; }
body.field-mode .quick-nav a { padding: 12px 16px; font-size: 15px; }
body.field-mode .bottom-total strong { font-size: 19px; }
body.field-mode .field-mode-button { min-height: 44px; font-size: 13px; }

/* ===== v016: backup status ===== */
.backup-status { font-weight: 700; font-size: 13px; margin: 8px 0 0; }
.backup-status.is-warn { color: var(--amber); }
.backup-status.is-ok { color: var(--green); }

/* ===== v017: estimate linkage ===== */
.linkage-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); font-size: 12px; font-weight: 700; color: var(--muted); }

/* ===== v018: progress / custom items ===== */
.progress-strip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.progress-strip__label { font-size: 12px; font-weight: 700; color: var(--navy); margin-right: 2px; }
.progress-chip { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--ink); font-size: 12px; font-weight: 700; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; background: var(--blue-soft-2); }
.custom-items { margin-top: 14px; }
.custom-item-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.custom-item-row .custom-item-name { flex: 1 1 auto; min-width: 0; }
.custom-item-row .custom-item-qty { width: 84px; }
.custom-item-row select { width: 70px; }

/* ===== v019: guide / sample ===== */
.guide-card { max-width: 440px; text-align: left; }
.guide-list { margin: 10px 0 14px; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.sample-banner { border-color: var(--amber); background: var(--amber-soft); }

.card, .area-card { scroll-margin-top: 150px; }
