:root {
  --bg: #f3efe7;
  --surface: #fffdf8;
  --surface-alt: #f8f4ec;
  --ink: #173126;
  --muted: #5f7066;
  --brand: #0f5c45;
  --brand-strong: #0b4736;
  --brand-soft: #dce9e1;
  --accent: #f0c96a;
  --border: rgba(15, 92, 69, 0.12);
  --shadow: 0 16px 40px rgba(11, 44, 32, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #ecf0e9 0%, var(--bg) 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand);
}

.topbar strong,
h1,
h2 {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

main {
  display: grid;
  gap: 16px;
}

.card {
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
  padding: 20px;
}

.compact-pad {
  padding-bottom: 14px;
}

.brand-surface {
  background: linear-gradient(160deg, var(--brand) 0%, #0c4b39 100%);
  color: #f9f6ef;
}

.brand-surface .eyebrow,
.brand-surface .subtle {
  color: rgba(249, 246, 239, 0.8);
}

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
}

.brand-mark {
  width: 88px;
  height: 88px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  background: rgba(249, 246, 239, 0.14);
  border: 1px solid rgba(249, 246, 239, 0.2);
  font-weight: 800;
  font-size: 1.15rem;
}

.brand-mark span {
  line-height: 1;
}

.brand-mushroom {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: #f6f1e8;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.96;
}

.subtle,
small {
  color: var(--muted);
}

.action-grid,
.export-actions {
  display: grid;
  gap: 12px;
}

.primary-action,
.secondary-action,
.text-button,
.bag-card,
.chip,
.log-row {
  min-height: 56px;
  border-radius: 18px;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.primary-action,
.secondary-action {
  padding: 0 18px;
  font-weight: 700;
}

.primary-action {
  background: var(--brand);
  color: #f8f5ee;
}

.primary-action:disabled,
.secondary-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary-action {
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--border);
}

.text-button {
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
}

.full-width {
  width: 100%;
}

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

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

.bag-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bag-add {
  min-height: 44px;
  padding: 0 6px;
  background: transparent;
  color: var(--brand);
  font-weight: 800;
  text-transform: lowercase;
}

.bag-card {
  background: linear-gradient(180deg, #fdfbf5, #eef3ee);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.bag-pick {
  width: 100%;
  min-height: 92px;
  background: transparent;
  text-align: left;
  color: var(--brand-strong);
  display: grid;
  gap: 6px;
}

.bag-pick strong {
  font-size: 1.05rem;
}

.bag-index {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bag-edit {
  min-height: 42px;
  border-radius: 14px;
  background: rgba(15, 92, 69, 0.08);
  color: var(--brand);
  font-weight: 700;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 16px;
}

.step {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.step span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8ece7;
  font-weight: 700;
}

.step.active span,
.step.done span {
  background: var(--brand);
  color: #fff;
}

.flow-panel {
  display: grid;
  gap: 18px;
}

.photo-drop {
  position: relative;
  min-height: 280px;
  border-radius: var(--radius-lg);
  border: 2px dashed rgba(15, 92, 69, 0.35);
  background: linear-gradient(180deg, #fbfaf7, #f1f5ef);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  gap: 10px;
  overflow: hidden;
}

.photo-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.photo-drop.has-photo {
  padding: 0;
}

.photo-drop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-drop.has-photo strong,
.photo-drop.has-photo span {
  position: absolute;
  left: 14px;
  color: white;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}

.photo-drop.has-photo strong {
  bottom: 34px;
}

.photo-drop.has-photo span {
  bottom: 14px;
}

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

.field-block label {
  font-weight: 700;
}

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

.required-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 92, 69, 0.1);
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.muted-block {
  padding: 14px;
  border-radius: 18px;
  background: rgba(15, 92, 69, 0.04);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 0 16px;
  min-height: 48px;
  background: white;
  border: 1px solid rgba(15, 92, 69, 0.12);
  color: var(--ink);
}

.chip.selected {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

input[type='text'],
input[type='number'],
textarea {
  width: 100%;
  min-height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(15, 92, 69, 0.16);
  background: #fff;
  padding: 14px 16px;
  color: var(--ink);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.co2-block {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15, 92, 69, 0.06), rgba(15, 92, 69, 0.02));
  border: 1px solid rgba(15, 92, 69, 0.12);
}

.co2-input {
  min-height: 72px !important;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

.co2-input::placeholder {
  color: rgba(23, 49, 38, 0.35);
}

.sticky-actions {
  position: sticky;
  bottom: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
  padding-top: 8px;
}

.split-actions {
  margin-top: 12px;
}

.review-grid {
  display: grid;
  gap: 16px;
}

.review-photo {
  min-height: 200px;
  border-radius: 20px;
  background: #eef1ea;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.review-photo.missing-photo {
  border: 2px dashed rgba(15, 92, 69, 0.25);
}

.notice {
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.notice.success {
  background: rgba(15, 92, 69, 0.08);
  color: var(--brand-strong);
}

.notice.error {
  background: rgba(174, 57, 40, 0.12);
  color: #8c2d20;
}

.summary-list,
.detail-list {
  display: grid;
  gap: 10px;
}

.summary-list div,
.detail-list div {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(15, 92, 69, 0.08);
}

.summary-list dt,
.detail-list dt {
  font-size: 0.82rem;
  color: var(--muted);
}

.summary-list dd,
.detail-list dd {
  margin: 0;
  font-weight: 600;
}

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

.log-row {
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: linear-gradient(180deg, #fff, #f5f6f1);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.log-row span {
  display: block;
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--muted);
}

.empty-state {
  margin: 0;
  padding: 24px 0 8px;
  color: var(--muted);
}

.detail-photo {
  border-radius: 20px;
  margin-bottom: 18px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.check-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 34, 26, 0.42);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 40;
}

.modal-card {
  width: min(100%, 420px);
  background: var(--surface);
  border-radius: 26px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(8, 31, 23, 0.24);
  display: grid;
  gap: 14px;
}

.modal-input {
  min-height: 60px !important;
  font-size: 1.05rem;
}

@media (hover: hover) {
  .primary-action:hover,
  .secondary-action:hover,
  .bag-pick:hover,
  .bag-edit:hover,
  .chip:hover,
  .log-row:hover {
    transform: translateY(-1px);
  }
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .bag-grid,
  .sticky-actions,
  .log-row {
    grid-template-columns: 1fr;
  }

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

  .status-pill {
    width: 100%;
  }
}
