:root {
  color-scheme: light;
  --bg: #f4f3ed;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: rgba(17, 24, 39, 0.12);
  --green: #0d3b2e;
  --lime: #b8ff4d;
  --amber: #f6b73c;
  --red: #ef4444;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.12);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(184, 255, 77, 0.26), transparent 34%),
    linear-gradient(160deg, #f8f7f1 0%, var(--bg) 52%, #e9eee8 100%);
}

body.dark {
  color-scheme: dark;
  --bg: #0b1114;
  --panel: rgba(20, 31, 34, 0.82);
  --panel-solid: #111b1f;
  --ink: #f8fafc;
  --muted: #a3aeb8;
  --line: rgba(255, 255, 255, 0.13);
  --green: #b8ff4d;
  --lime: #b8ff4d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  background:
    radial-gradient(circle at 12% 0%, rgba(184, 255, 77, 0.16), transparent 35%),
    linear-gradient(160deg, #071012 0%, #101719 100%);
}

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

button { cursor: pointer; }

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.app-shell {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 12px;
  backdrop-filter: blur(14px);
}

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

h1 {
  font-size: clamp(1.75rem, 8vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(2rem, 10vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

h3 {
  font-size: 1rem;
}

.eyebrow {
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-panel,
.panel,
.decision-card,
.metric-card,
.action-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  border-radius: 28px;
  padding: 26px;
  margin: 4px 0 16px;
}

.hero-panel p:last-child {
  color: var(--muted);
  margin-top: 14px;
  max-width: 46rem;
  font-weight: 650;
  line-height: 1.45;
}

.install-card h3 {
  margin: 4px 0 8px;
  font-size: 1.2rem;
}

.install-card p:last-child {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

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

.metric-grid.compact {
  margin-bottom: 0;
}

.metric-card {
  border-radius: var(--radius);
  padding: 16px;
  min-height: 98px;
}

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

.metric-card strong {
  display: block;
  font-size: clamp(1.35rem, 7vw, 2.1rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.metric-card.highlight {
  background: linear-gradient(135deg, var(--green), #0f5a43);
  color: #fff;
}

body.dark .metric-card.highlight {
  color: #071012;
  background: linear-gradient(135deg, var(--lime), #d7ff8b);
}

.metric-card.highlight span {
  color: currentColor;
  opacity: 0.72;
}

.metric-card.wide {
  grid-column: 1 / -1;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.action-card,
.primary-button,
.text-button,
.icon-button {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  font-weight: 900;
}

.action-card {
  color: var(--ink);
  padding: 18px;
  text-align: left;
}

.primary-button {
  color: #fff;
  background: var(--green);
  padding: 0 20px;
}

body.dark .primary-button {
  color: #071012;
}

.text-button {
  color: var(--green);
  background: transparent;
  padding: 0 10px;
}

.text-button.danger {
  color: var(--red);
}

.icon-button {
  width: 48px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
}

.panel,
.decision-card {
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 12px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--panel-solid);
  padding: 12px 14px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(184, 255, 77, 0.18);
}

.upload-box {
  min-height: 132px;
  place-content: center;
  text-align: center;
  border: 1px dashed var(--green);
  border-radius: 18px;
  background: color-mix(in srgb, var(--lime) 12%, transparent);
  padding: 18px;
}

.upload-box input {
  display: none;
}

.upload-box span {
  color: var(--ink);
  font-size: 1rem;
}

.upload-box small {
  font-weight: 700;
}

.ocr-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  margin: -5px 0 0;
}

.ocr-status.is-working {
  color: var(--green);
}

.ocr-status.is-error {
  color: var(--red);
}

.preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
}

.hidden {
  display: none !important;
}

.decision-card.accept {
  border-color: rgba(34, 197, 94, 0.45);
}

.decision-card.maybe {
  border-color: rgba(246, 183, 60, 0.58);
}

.decision-card.decline {
  border-color: rgba(239, 68, 68, 0.45);
}

.decision-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 10px 0;
}

.decision-head strong {
  font-size: clamp(2rem, 10vw, 4rem);
  line-height: 1;
}

.decision-head span {
  display: grid;
  place-items: center;
  width: 70px;
  aspect-ratio: 1;
  border-radius: 999px;
  color: #071012;
  background: var(--lime);
  font-size: 1.45rem;
  font-weight: 950;
}

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

.empty {
  color: var(--muted);
  padding: 12px 0;
  font-weight: 750;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-solid);
  padding: 14px;
}

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

.list-item span,
.list-item small {
  color: var(--muted);
  font-weight: 700;
}

.item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.item-actions .text-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.form-grid.is-editing {
  border-color: color-mix(in srgb, var(--lime) 60%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lime) 22%, transparent);
}

.pill {
  border-radius: 999px;
  padding: 7px 10px;
  color: #071012;
  background: var(--lime);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.pill.decline { color: #fff; background: var(--red); }
.pill.maybe { color: #1f1300; background: var(--amber); }

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-row input {
  width: 22px;
  min-height: 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  width: min(96vw, 720px);
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel-solid) 86%, transparent);
  box-shadow: var(--shadow);
  padding: 6px;
  backdrop-filter: blur(18px);
}

.nav-button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 900;
}

.nav-button.active {
  color: #071012;
  background: var(--lime);
}

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

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

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

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

  .form-grid .upload-box,
  .form-grid .ocr-status,
  .form-grid .preview,
  .form-grid textarea,
  .form-grid .primary-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .bottom-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .app-shell {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }
}
