:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5d6b66;
  --line: #d8e0dc;
  --paper: #f4f7f6;
  --panel: #ffffff;
  --sun: #ffd45a;
  --green: #2f7d5b;
  --blue: #2e6fbd;
  --violet: #7656b7;
  --shadow: 0 18px 45px rgba(23, 32, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

textarea {
  resize: vertical;
}

input {
  color: var(--ink);
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
}

.topbar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: 0 auto 14px;
  max-width: 1440px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.05;
  margin-bottom: 0;
}

.icon-button {
  align-items: center;
  background: var(--ink);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 22px;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.icon-button.subtle {
  background: #edf2f0;
  color: var(--ink);
}

.summary-strip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 auto 14px;
  max-width: 1440px;
}

.summary-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 70px;
  padding: 12px;
}

.summary-tile strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.summary-tile span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

.board {
  display: grid;
  gap: 12px;
  grid-auto-columns: minmax(280px, 84vw);
  grid-auto-flow: column;
  margin: 0 auto;
  max-width: 1440px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
}

.column {
  background: #e8efec;
  border: 1px solid #d4ded9;
  border-radius: 8px;
  min-height: 62vh;
  overflow: hidden;
  scroll-snap-align: start;
}

.column-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.58);
  border-bottom: 1px solid #d4ded9;
  display: flex;
  justify-content: space-between;
  padding: 11px 12px;
}

.column-header h2 {
  font-size: 15px;
  margin: 0;
}

.count {
  align-items: center;
  background: #fff;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  min-width: 24px;
  padding: 0 8px;
}

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

.job-card {
  background: var(--panel);
  border: 1px solid rgba(23, 32, 27, 0.08);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(23, 32, 27, 0.06);
  cursor: pointer;
  min-height: 156px;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.job-card:active {
  transform: scale(0.99);
}

.card-top {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.job-card h3 {
  font-size: 16px;
  line-height: 1.25;
  margin: 0 0 8px;
}

.pill {
  background: #eef3f0;
  border-radius: 999px;
  color: var(--ink);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 10px;
}

.progress-track {
  background: #e6ede9;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  background: var(--green);
  height: 100%;
}

.card-footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: space-between;
  margin-top: 9px;
}

.drawer {
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 180ms ease;
  z-index: 20;
}

.drawer.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-backdrop {
  background: rgba(23, 32, 27, 0.38);
  inset: 0;
  position: absolute;
}

.drawer-panel {
  background: var(--panel);
  border-radius: 8px 8px 0 0;
  bottom: 0;
  box-shadow: var(--shadow);
  left: 0;
  max-height: 88vh;
  overflow: hidden;
  position: absolute;
  right: 0;
  transform: translateY(18px);
  transition: transform 180ms ease;
}

.drawer.open .drawer-panel {
  transform: translateY(0);
}

.drawer-grip {
  background: #cbd7d1;
  border-radius: 999px;
  height: 4px;
  margin: 8px auto;
  width: 44px;
}

.drawer-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 8px 16px 14px;
}

.drawer-header h2 {
  font-size: 20px;
  line-height: 1.15;
  margin: 0;
}

.drawer-content {
  max-height: calc(88vh - 102px);
  overflow-y: auto;
  padding: 14px 16px max(24px, env(safe-area-inset-bottom));
}

.detail-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-bottom: 16px;
}

.detail {
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.detail span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.detail strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.stage-select {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.field-block {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.field-block span,
.photo-header strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.field-block textarea {
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  line-height: 1.35;
  min-height: 88px;
  padding: 10px;
  width: 100%;
}

.primary-action,
.secondary-action,
.upload-button {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
}

.primary-action {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: #fff;
  margin-bottom: 14px;
  width: 100%;
}

.secondary-action,
.upload-button {
  background: #eef3f0;
  border: 1px solid var(--line);
  color: var(--ink);
  margin-bottom: 16px;
}

.photo-section {
  margin-bottom: 16px;
}

.photo-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.upload-button {
  margin-bottom: 0;
}

.upload-button input {
  display: none;
}

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

.photo-thumb {
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  overflow: hidden;
}

.photo-thumb img {
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  width: 100%;
}

.photo-thumb figcaption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  padding: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-button {
  background: #eef3f0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  min-height: 42px;
}

.stage-button.active {
  background: var(--ink);
  color: #fff;
}

.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  align-items: flex-start;
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 48px;
  padding: 11px;
}

.check-box {
  align-items: center;
  border: 2px solid #9ba2a9;
  border-radius: 6px;
  color: #fff;
  display: flex;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.check-item.done .check-box {
  background: var(--green);
  border-color: var(--green);
}

.check-item.done .check-text {
  color: #69727c;
  text-decoration: line-through;
}

.check-text {
  font-size: 14px;
  line-height: 1.35;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 18px 12px;
}

.access-gate {
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(23, 32, 27, 0.06);
  max-width: 420px;
  padding: 18px;
  width: min(420px, 100%);
}

.access-gate h2 {
  font-size: 22px;
  line-height: 1.15;
  margin: 0 0 18px;
}

.field-block input {
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px;
  width: 100%;
}

.access-error {
  color: #a4382c;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 0;
}

@media (min-width: 760px) {
  .app-shell {
    padding-left: 24px;
    padding-right: 24px;
  }

  .summary-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .board {
    grid-auto-columns: minmax(292px, 1fr);
  }

  .drawer-panel {
    border-radius: 8px;
    bottom: 22px;
    left: auto;
    max-width: 480px;
    right: 22px;
    top: 22px;
  }

  .drawer-content {
    max-height: calc(100vh - 142px);
  }
}
