:root {
  --ink: #142033;
  --muted: #64748b;
  --line: #d8e0ea;
  --soft: #f4f7fb;
  --paper: #ffffff;
  --blue: #2563eb;
  --navy: #111827;
  --orange: #f97316;
  --brown: #9a3412;
  --green: #0f766e;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: #eef1f5;
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

button:disabled {
  opacity: 0.45;
}

.sync-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
}

.sync-panel h3 {
  margin: 0;
  font-size: 16px;
}

.sync-panel p {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sync-panel .sync-status {
  margin-bottom: 0;
  font-weight: 800;
}

.sync-panel .sync-status.error {
  color: #b42318;
}

.sync-confirmation {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #f0be72;
  border-radius: 12px;
  background: #fff8ec;
}

.sync-confirmation h4 {
  margin: 0;
  color: #73411a;
  font-size: 0.98rem;
}

.sync-confirmation p {
  margin: 7px 0 0;
}

.sync-confirmation-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.sync-confirmation-actions button {
  min-height: 44px;
}

.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
}

.app-shell {
  max-width: 980px;
  min-height: 100svh;
  margin: 0 auto;
  padding: 14px 14px 88px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -14px -14px 0;
  padding: 14px;
  background: rgba(238, 241, 245, 0.96);
  backdrop-filter: blur(12px);
}

.offline-status {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid #9ac7b9;
  border-radius: 12px;
  background: #eef9f5;
  color: #0c5f51;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.5;
}

.offline-status.error {
  border-color: #e5ad77;
  background: #fff7ed;
  color: #8a3b12;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions button:not(.icon-button) {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.app-view,
.workspace-view {
  display: none;
}

.app-view.active,
.workspace-view.active {
  display: block;
}

.auth-view {
  min-height: calc(100svh - 120px);
  place-items: center;
}

.auth-view.active {
  display: grid;
}

.auth-card {
  width: min(100%, 520px);
  max-width: 100%;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-card .notice {
  min-height: 42px;
  margin: 0;
}

.auth-card .notice.error {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fef2f2;
}

.case-list-view {
  padding-top: 12px;
}

.case-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.case-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.case-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.case-card strong,
.empty-state strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.case-card span,
.empty-state span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.case-card-meta {
  min-width: 96px;
  text-align: right;
}

.case-card-meta span:first-child {
  color: var(--blue);
  font-size: 19px;
  font-weight: 900;
}

.empty-state {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #fff;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(64px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
}

.step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
  padding: 8px 6px;
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
}

.step span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: #94a3b8;
  font-size: 12px;
}

.step.active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.step.active span {
  background: var(--blue);
}

.screen {
  display: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.screen.active {
  display: block;
}

.screen-head {
  margin-bottom: 18px;
}

.screen-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 900;
}

label.wide {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 148px;
  margin-top: 14px;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
}

.upload-box input {
  display: none;
}

.upload-box span {
  color: var(--blue);
  font-size: 22px;
  font-weight: 900;
}

.upload-box small {
  color: var(--muted);
  font-weight: 800;
}

.shooting-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.shooting-guide {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.shooting-guide strong {
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.shooting-guide span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  font-weight: 800;
}

.photo-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.photo-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.photo-card.photo-status-draft_applied {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f7fffc;
}

.photo-card.photo-status-out_of_scope {
  opacity: 0.72;
  background: #f1f5f9;
}

.photo-thumb {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  overflow: hidden;
  border-radius: 8px;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-controls {
  display: grid;
  gap: 10px;
}

.photo-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 10px;
  align-items: center;
}

.photo-card-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.photo-card-head select {
  min-height: 40px;
  padding: 8px 10px;
}

.photo-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.photo-field-grid .wide {
  grid-column: 1 / -1;
}

.photo-guide {
  padding: 10px 12px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #ecfdf5;
  color: #14532d;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 800;
}

.photo-actions {
  display: flex;
  justify-content: flex-end;
}

.photo-empty {
  display: grid;
  gap: 6px;
}

.photo-empty strong {
  color: var(--ink);
}

.photo-empty span {
  color: var(--muted);
}

.hidden-file-input {
  display: none;
}

.checklist-summary {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.checklist-summary strong {
  display: block;
  color: var(--blue);
  font-size: 20px;
}

.checklist-summary span {
  color: var(--muted);
  font-weight: 900;
}

.checklist-progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.checklist-progress-bar span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.place-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.room-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.room-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.room-card.complete {
  border-color: rgba(15, 118, 110, 0.35);
}

.room-card-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
}

.room-toggle {
  min-height: 42px;
  padding: 0;
}

.room-card-head input {
  min-height: 42px;
}

.room-status {
  min-width: 78px;
  text-align: right;
}

.room-status strong {
  display: block;
  color: var(--green);
  font-size: 16px;
}

.room-status span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.category-list {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.category-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.category-card.status-captured {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f7fffc;
}

.category-card.status-not_applicable {
  background: #f1f5f9;
}

.category-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.category-card h3,
.missed-check h3 {
  margin: 0;
  font-size: 17px;
}

.category-card p,
.missed-check p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
}

.category-card-head > span {
  align-self: flex-start;
  padding: 6px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.representative-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #e2e8f0;
  aspect-ratio: 3 / 4;
}

.representative-thumb img,
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.representative-photo {
  display: grid;
  gap: 8px;
}

.photo-single-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.photo-single-actions span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.danger-button {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.category-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.camera-open {
  overflow: hidden;
}

.camera-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.92);
}

.camera-panel.active {
  display: grid;
  place-items: center;
}

.camera-panel-inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: min(100%, 520px);
  height: min(100%, 860px);
  color: #fff;
}

.camera-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.camera-head p,
.camera-head h3 {
  margin: 0;
}

.camera-head p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 900;
}

.camera-head h3 {
  margin-top: 4px;
  font-size: 20px;
}

.camera-head strong {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.camera-view {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #020617;
}

.camera-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.6;
  text-align: center;
}

.camera-error.active {
  display: grid;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 86px 1fr;
  gap: 10px;
  align-items: center;
}

.camera-actions button {
  min-height: 54px;
}

.camera-shutter {
  width: 86px;
  height: 86px;
  min-height: 86px;
  padding: 0;
  border: 6px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 5px #1d4ed8;
}

.camera-shutter:disabled {
  opacity: 0.45;
}

.category-gallery {
  display: grid;
  gap: 10px;
}

.gallery-bottom-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  padding-top: 4px;
  background: linear-gradient(180deg, rgba(251, 252, 254, 0), #fbfcfe 28%);
}

.gallery-bottom-actions button {
  width: 100%;
  min-height: 48px;
}

.gallery-photo {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gallery-thumb {
  display: grid;
  place-items: center;
  width: 110px;
  min-height: 142px;
  overflow: hidden;
  border-radius: 8px;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.gallery-photo-controls {
  display: grid;
  gap: 8px;
}

.gallery-photo-controls strong {
  overflow-wrap: anywhere;
}

.missed-check {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #fdba74;
  border-radius: 8px;
  background: #fff7ed;
}

.missed-check.complete {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f7fffc;
}

.missed-check ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: #7c2d12;
  font-weight: 900;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.draft-basis {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.draft-basis h3 {
  margin: 0;
  font-size: 18px;
}

.draft-basis p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 800;
}

.draft-basis-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.draft-generated {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  text-align: right;
}

.draft-basis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.draft-basis-grid div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.draft-basis-grid strong {
  display: block;
  color: var(--blue);
  font-size: 24px;
  line-height: 1;
}

.draft-basis-grid span,
.draft-mode-counts span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.draft-mode-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.draft-mode-counts span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
}

.draft-note-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 800;
}

.draft-missing {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.editor-section {
  margin-top: 16px;
}

.editor-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.editor-section h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.editor-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.room-editor-list {
  display: grid;
  gap: 14px;
}

.room-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.room-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-editor-head h4 {
  margin: 0 0 4px;
  font-size: 17px;
}

.room-editor-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.room-editor-thumbs {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 78px;
}

.room-editor-thumbs img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.room-editor-thumbs span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.room-adjust-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.room-adjust-box strong {
  display: block;
  margin-bottom: 4px;
}

.room-adjust-box span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.room-adjust-controls {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 80px;
  gap: 8px;
  align-items: end;
}

.room-adjust-controls button {
  min-height: 46px;
}

.adjust-reason {
  display: block;
}

.room-item-group {
  display: grid;
  gap: 8px;
}

.room-item-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-item-group-head h5 {
  margin: 0;
  font-size: 14px;
}

.room-item-group-head button {
  min-height: 38px;
  padding: 8px 12px;
}

.small-notice {
  padding: 10px;
  font-size: 12px;
}

.edit-list {
  display: grid;
  gap: 10px;
}

.item-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.item-card.just-added {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
  animation: item-added-pulse 0.7s ease-out;
}

@keyframes item-added-pulse {
  from { transform: scale(0.985); }
  to { transform: scale(1); }
}

.item-add-feedback {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 520px);
  padding: 12px 16px;
  transform: translateX(-50%);
  border: 1px solid #1d4ed8;
  border-radius: 10px;
  color: #fff;
  background: #1d4ed8;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
}

.item-card.excluded {
  opacity: 0.65;
  background: #f1f5f9;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.item-grid .name-field,
.item-grid .note-field {
  grid-column: span 2;
}

.item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.checkline input {
  width: 18px;
  min-height: 18px;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.price-wheel-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.price-wheel-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.price-wheel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.price-wheel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.price-wheel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wheel-label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.wheel-shell {
  position: relative;
  overflow: hidden;
  border: 2px solid #1f2937;
  border-radius: 8px;
  background: #f8fafc;
}

.wheel-shell::before {
  position: absolute;
  top: 54px;
  right: 0;
  left: 0;
  z-index: 0;
  height: 54px;
  background: #1d4ed8;
  content: "";
}

.wheel-shell::after {
  position: absolute;
  top: 54px;
  right: 10px;
  left: 10px;
  z-index: 2;
  height: 54px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  content: "";
  pointer-events: none;
}

.wheel-window {
  position: relative;
  z-index: 1;
  height: 162px;
  overflow-y: auto;
  padding: 54px 0;
  background: transparent;
  scroll-snap-type: y mandatory;
  scroll-padding-block: 54px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
}

.wheel-window::-webkit-scrollbar {
  display: none;
}

.wheel-value {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  padding: 6px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
  scroll-snap-align: center;
  user-select: none;
}

.wheel-value.current {
  color: #fff;
  font-size: 24px;
}

.wheel-value:not(.current) {
  font-size: 15px;
}

.wheel-range {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.metric-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.metric-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric-card span {
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.document-scroll {
  overflow: auto;
  max-height: 74svh;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dbe2ea;
}

.output-status {
  margin: -4px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.sheet {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  padding: 30px 38px;
  background: #fff;
  color: var(--ink);
  transform-origin: top left;
}

.estimate-sheet {
  display: flex;
  flex-direction: column;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding-bottom: 14px;
  border-bottom: 4px solid #202b3d;
}

.sheet h2 {
  margin: 0 0 6px;
  font-size: 32px;
}

.sheet .sub {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.date-box {
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 800;
}

.comparison {
  margin: 18px 0 14px;
  border: 4px solid #1f2937;
  border-radius: 8px;
  overflow: hidden;
}

.comparison-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.doc-metric {
  padding: 14px 16px;
}

.estimate-sheet .doc-metric {
  padding: 22px 20px;
  min-height: 142px;
}

.doc-metric:first-child {
  background: #eef4ff;
  border-right: 3px solid #1f2937;
}

.doc-metric:last-child {
  background: #fff4e8;
}

.doc-label {
  display: block;
  margin-bottom: 4px;
  color: #263244;
  font-size: 16px;
  font-weight: 900;
}

.doc-value {
  display: block;
  color: #0f172a;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 900;
  white-space: nowrap;
}

.estimate-sheet .doc-value {
  font-size: 46px;
}

.doc-metric:last-child .doc-value {
  color: var(--brown);
}

.doc-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.equation-strip {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  color: #fff;
  background: #111827;
  border-top: 3px solid #1f2937;
}

.equation {
  padding: 12px 16px;
  font-size: 23px;
  font-weight: 900;
  white-space: nowrap;
}

.result {
  display: grid;
  place-items: center;
  padding: 10px;
  background: var(--brown);
  font-size: 28px;
  font-weight: 900;
  text-align: center;
}

.load-visual {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.load-title {
  margin-bottom: 7px;
  color: #263244;
  font-size: 14px;
  font-weight: 900;
}

.load-bar {
  display: grid;
  min-height: 38px;
  border: 2px solid #1f2937;
  border-radius: 6px;
  overflow: hidden;
}

.load-segment {
  display: grid;
  place-items: center;
  padding: 5px;
  color: #fff;
  background: var(--blue);
  border-right: 2px solid #fff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.load-segment:nth-child(even) {
  background: #1d4ed8;
}

.load-segment.partial {
  background: var(--orange);
  border-right: 0;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.estimate-info-grid {
  grid-template-columns: 0.9fr 1.6fr;
}

.doc-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7fb;
}

.doc-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.doc-card span {
  font-size: 20px;
  font-weight: 900;
}

.doc-section {
  margin-top: 13px;
}

.estimate-sheet .doc-section {
  margin-top: 20px;
}

.doc-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  font-size: 18px;
}

.doc-section h3::before {
  content: "";
  width: 7px;
  height: 22px;
  border-radius: 2px;
  background: var(--blue);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.estimate-sheet .doc-table {
  font-size: 15px;
}

.doc-table th {
  padding: 8px;
  color: #fff;
  background: #263244;
  text-align: left;
}

.doc-table td {
  padding: 7px 8px;
  border: 1px solid var(--line);
  line-height: 1.35;
}

.estimate-sheet .doc-table th {
  padding: 11px 10px;
}

.estimate-sheet .doc-table td {
  padding: 12px 10px;
}

.doc-table tr:nth-child(even) td {
  background: #f8fafc;
}

.amount {
  text-align: right;
  white-space: nowrap;
  font-weight: 900;
}

.center {
  text-align: center;
}

.grand-row td {
  color: #fff;
  background: var(--brown) !important;
  font-size: 20px;
  font-weight: 900;
}

.note-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 13px;
  line-height: 1.5;
}

.estimate-sheet .note-box {
  min-height: 72px;
  margin-top: 20px;
  padding: 14px 16px;
  font-size: 14px;
}

.company-box {
  margin-top: 14px;
  margin-left: auto;
  width: 310px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-top: 4px solid #202b3d;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  font-weight: 800;
}

.estimate-sheet .company-box {
  margin-top: auto;
  width: 100%;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: center;
  font-size: 13px;
}

.company-name {
  display: block;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.2;
}

.estimate-sheet .company-name {
  margin: 0;
  padding: 0 16px 0 0;
  border-right: 1px solid #cbd5e1;
  border-bottom: 0;
  font-size: 18px;
  white-space: nowrap;
}

.company-details {
  display: grid;
  gap: 5px;
  margin: 0;
}

.estimate-sheet .company-details {
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
  row-gap: 7px;
}

.company-detail {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
}

.estimate-sheet .company-detail {
  grid-template-columns: 42px 1fr;
}

.estimate-sheet .company-detail.address {
  grid-column: 1 / -1;
  grid-template-columns: 52px 1fr;
}

.company-detail span,
.company-detail strong {
  margin: 0;
}

.company-detail span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.company-detail strong {
  color: #263244;
  font-weight: 900;
}

.company-detail:not(.address) strong {
  white-space: nowrap;
}

/* 書類ごとの役割を明確にするための帳票レイアウト */
.volume-sheet,
.estimate-sheet {
  display: flex;
  flex-direction: column;
  border-top: 10px solid #0f766e;
}

.estimate-sheet {
  border-top-color: var(--brown);
}

.volume-sheet .sheet-header {
  border-bottom-color: #0f766e;
}

.estimate-sheet .sheet-header {
  border-bottom-color: var(--brown);
}

.volume-sheet h2 {
  color: #0f766e;
}

.estimate-sheet h2 {
  color: #7c2d12;
}

.document-code {
  margin-top: 7px;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}

.volume-sheet .comparison {
  border-color: #0f766e;
}

.volume-sheet .doc-metric:first-child {
  background: #ecfdf5;
  border-right-color: #0f766e;
}

.volume-sheet .doc-metric:last-child {
  background: #f0fdfa;
}

.volume-sheet .doc-metric:last-child .doc-value {
  color: #0f766e;
}

.volume-sheet .equation-strip {
  background: #115e59;
  border-top-color: #0f766e;
}

.volume-sheet .result {
  background: #0f766e;
}

.volume-sheet .doc-section h3::before {
  background: #0f766e;
}

.volume-sheet .doc-table th {
  background: #115e59;
}

.volume-sheet .doc-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.volume-confirmation-box,
.estimate-confirmation-box {
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
}

.volume-confirmation-box {
  margin-top: auto;
  border-color: #99d8cf;
  background: #f0fdfa;
}

.estimate-confirmation-box {
  margin-top: auto;
  border-color: #fed7aa;
  background: #fff7ed;
}

.volume-confirmation-box h3,
.estimate-confirmation-box h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.volume-confirmation-box h3 {
  color: #0f766e;
}

.estimate-confirmation-box h3 {
  color: #9a3412;
}

.volume-confirmation-box p,
.estimate-confirmation-box p {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.65;
}

.confirmation-line {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1.6fr;
  gap: 10px;
  margin-top: 18px;
}

.confirmation-line span {
  min-height: 38px;
  border-bottom: 1px solid #5eead4;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.volume-sheet .company-box {
  margin-top: 16px;
  border-top-color: #0f766e;
}

.estimate-sheet .company-box {
  margin-top: 16px;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #fdba74;
  border-radius: 8px;
  color: #7c2d12;
  background: #fff7ed;
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(238, 241, 245, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  width: min(45vw, 220px);
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px 10px 88px;
  }

  .topbar {
    margin: -12px -10px 0;
    padding: 12px 10px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions button:not(.icon-button) {
    min-height: 38px;
    padding: 7px 8px;
    font-size: 12px;
  }

  h1 { font-size: 25px; }
  h2 { font-size: 22px; }

  .auth-card,
  .case-list-head {
    padding: 14px;
  }

  .case-list-head,
  .case-card {
    grid-template-columns: 1fr;
  }

  .case-list-head {
    display: grid;
  }

  .case-card-meta {
    display: flex;
    justify-content: space-between;
    min-width: 0;
    text-align: left;
  }

  .case-card button {
    width: 100%;
  }

  .stepper {
    grid-template-columns: repeat(6, 76px);
  }

  .screen {
    padding: 14px;
  }

  .form-grid,
  .summary-panel,
  .item-grid,
  .draft-basis-grid,
  .shooting-guide-grid,
  .photo-field-grid,
  .place-actions,
  .price-wheel-grid {
    grid-template-columns: 1fr;
  }

  .room-card-head {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .room-card-head > button[data-remove-room] {
    grid-column: 2 / -1;
    width: 100%;
  }

  .category-card-head {
    display: grid;
  }

  .category-actions button {
    flex: 1 1 130px;
  }

  .gallery-photo {
    grid-template-columns: 1fr;
  }

  .gallery-thumb {
    width: 100%;
    min-height: 0;
    aspect-ratio: 3 / 4;
  }

  .draft-basis-head {
    display: grid;
  }

  .draft-generated {
    white-space: normal;
  }

  .editor-section-head,
  .room-editor-head {
    display: grid;
  }

  .room-editor-thumbs {
    justify-content: flex-start;
  }

  .room-adjust-controls {
    grid-template-columns: 1fr;
  }

  label.wide,
  .item-grid .name-field,
  .item-grid .note-field,
  .photo-field-grid .wide {
    grid-column: auto;
  }

  .photo-card {
    grid-template-columns: 1fr;
  }

  .photo-thumb {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 3 / 4;
  }

  .photo-card-head {
    grid-template-columns: 1fr;
  }

  .document-scroll {
    max-height: 68svh;
  }

  .sheet {
    transform: scale(0.42);
    margin-right: -460px;
    margin-bottom: -648px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    width: 210mm;
    margin: 0;
    background: #fff;
  }

  .topbar,
  .stepper,
  .screen-head,
  .action-row,
  .bottom-nav,
  .notice {
    display: none !important;
  }

  .app-shell,
  .screen,
  .document-scroll {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  .screen:not(.active) {
    display: none;
  }

  .sheet {
    width: 210mm;
    /* iPhoneの印刷画面では、A4ぴったりの高さを指定すると
       丸め誤差で次の空白ページが追加されることがあるため、下側に余白を残す。 */
    min-height: 292mm;
    transform: none;
    margin: 0;
    box-shadow: none;
    break-after: auto;
    page-break-after: auto;
  }

  .sheet:not(:last-child) {
    break-after: page;
    page-break-after: always;
  }
}
