:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #63716d;
  --line: #d8e1dc;
  --paper: #fbfcf9;
  --panel: #ffffff;
  --green: #16836a;
  --green-soft: #dff3ec;
  --yellow: #e5ab2e;
  --yellow-soft: #fff3cf;
  --red: #c85848;
  --red-soft: #ffe4df;
  --teal: #1d6f7b;
  --shadow: 0 18px 50px rgba(24, 33, 31, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(223, 243, 236, 0.8), rgba(251, 252, 249, 0) 340px),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: rgba(251, 252, 249, 0.9);
  border-bottom: 1px solid rgba(216, 225, 220, 0.8);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.topnav {
  display: flex;
  gap: 8px;
}

.topnav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

.topnav a:hover {
  background: var(--green-soft);
  color: var(--ink);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 1.35rem;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
  gap: clamp(18px, 3vw, 32px);
  width: min(1360px, calc(100vw - 32px));
  margin: 26px auto 108px;
}

.project-panel,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.project-panel {
  align-self: start;
  padding: clamp(16px, 2.4vw, 24px);
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(2rem, 4vw, 4.7rem);
  line-height: 0.9;
}

.status-pill {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

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

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

.photo-frame figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.upload-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.upload-button,
.bottom-bar button,
.pro-button,
.material-list button {
  min-height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.upload-button.secondary {
  background: var(--yellow-soft);
  color: #79560e;
}

.quick-notes {
  margin-top: 18px;
}

.quick-notes label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.quick-notes textarea {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  line-height: 1.45;
}

.result-panel {
  padding: clamp(16px, 2.4vw, 26px);
}

.triage-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(223, 243, 236, 0.92), rgba(255, 243, 207, 0.72)),
    #f5faf4;
}

.triage-banner p {
  max-width: 64ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.5;
}

.confidence {
  display: grid;
  width: 112px;
  aspect-ratio: 1;
  place-items: center;
  align-content: center;
  border: 1px solid rgba(22, 131, 106, 0.24);
  border-radius: 999px;
  background: white;
}

.confidence strong {
  color: var(--green);
  font-size: 1.65rem;
  line-height: 1;
}

.confidence span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.metric {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: clamp(1rem, 2vw, 1.28rem);
}

.alert {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-left: 5px solid var(--yellow);
  border-radius: 8px;
  background: var(--yellow-soft);
}

.alert p {
  margin: 0;
  color: #66480c;
  line-height: 1.42;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f4;
}

.tab {
  min-height: 42px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(24, 33, 31, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
}

.steps label {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.steps label::before {
  content: counter(step);
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 900;
}

.steps input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.steps strong {
  display: block;
  margin-bottom: 4px;
}

.steps span {
  color: var(--muted);
  line-height: 1.45;
}

.steps input:checked + span {
  color: #8a9692;
  text-decoration: line-through;
}

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

.material-list article {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.material-list p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.material-list button {
  min-width: 64px;
  padding: 0 14px;
  background: var(--teal);
}

.item-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.item-dot.green {
  background: var(--green);
}

.item-dot.yellow {
  background: var(--yellow);
}

.item-dot.red {
  background: var(--red);
}

.stop-list {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.stop-list li {
  padding: 14px 14px 14px 42px;
  border: 1px solid #ffd1c8;
  border-radius: 8px;
  background: var(--red-soft);
  color: #693128;
  line-height: 1.42;
  position: relative;
}

.stop-list li::before {
  content: "!";
  position: absolute;
  left: 14px;
  top: 14px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-size: 0.8rem;
  font-weight: 900;
}

.pro-button {
  width: 100%;
  background: var(--red);
}

.bottom-bar {
  position: fixed;
  right: 50%;
  bottom: 18px;
  z-index: 20;
  display: flex;
  gap: 10px;
  width: min(720px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  transform: translateX(50%);
  backdrop-filter: blur(16px);
}

.bottom-bar button {
  flex: 1;
  background: #eef3ef;
  color: var(--ink);
}

.bottom-bar .primary {
  background: var(--green);
  color: white;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .topnav {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: min(720px, calc(100vw - 24px));
    margin-top: 16px;
  }

  h1 {
    max-width: 16ch;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 12px;
  }

  .brand small {
    display: none;
  }

  .project-header,
  .triage-banner {
    grid-template-columns: 1fr;
  }

  .project-header {
    display: grid;
  }

  .confidence {
    width: 96px;
  }

  .summary-grid,
  .upload-strip,
  .tabs {
    grid-template-columns: 1fr;
  }

  .material-list article {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .material-list button {
    grid-column: 2;
  }
}
