:root {
  color-scheme: light;
  --brand: #b50018;
  --brand-dark: #7f0013;
  --ink: #172026;
  --muted: #5d6975;
  --line: #dfe4ea;
  --surface: #ffffff;
  --soft: #f5f7f9;
  --green: #2f8f5b;
  --amber: #bf7a12;
  --shadow: 0 24px 60px rgba(23, 32, 38, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--soft);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
  background:
    linear-gradient(140deg, rgba(181, 0, 24, 0.08), transparent 34%),
    linear-gradient(320deg, rgba(47, 143, 91, 0.10), transparent 30%),
    var(--soft);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 32px;
  align-items: stretch;
}

.brand-panel,
.login-card,
.panel {
  border: 1px solid rgba(223, 228, 234, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.brand-panel {
  min-height: 560px;
  display: grid;
  align-content: center;
  padding: 56px;
  overflow: hidden;
  position: relative;
}

.brand-panel::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -120px;
  width: 360px;
  height: 360px;
  border: 42px solid rgba(181, 0, 24, 0.08);
  border-radius: 50%;
}

.brand-logo {
  width: min(260px, 58vw);
  height: auto;
  margin-bottom: 40px;
}

.brand-copy {
  max-width: 560px;
  position: relative;
  z-index: 1;
}

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

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.35rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.brand-copy p:last-child,
.welcome-band p:last-child {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.login-card {
  align-self: center;
  padding: 32px;
}

.login-card__header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.app-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 8px;
  background:
    radial-gradient(circle at 36% 25%, #fff 0 4px, transparent 5px),
    linear-gradient(135deg, var(--brand), var(--brand-dark));
  position: relative;
}

.app-mark::before,
.app-mark::after {
  content: "";
  position: absolute;
  background: #fff;
}

.app-mark::before {
  left: 15px;
  bottom: 11px;
  width: 20px;
  height: 24px;
  border-radius: 3px 3px 0 0;
}

.app-mark::after {
  left: 22px;
  top: 12px;
  width: 20px;
  height: 9px;
  border-radius: 12px;
  background: #8fd0a5;
  transform: rotate(-25deg);
}

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #d7dee5;
  border-radius: 8px;
  background: #f7fafc;
  color: var(--ink);
}

.alert--error {
  border-color: rgba(181, 0, 24, 0.28);
  background: rgba(181, 0, 24, 0.08);
  color: var(--brand-dark);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: #34404b;
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.login-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(181, 0, 24, 0.12);
}

.login-form button,
.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.login-form button {
  margin-top: 14px;
}

.button--ghost {
  min-height: 38px;
  border-color: #d7dee5;
  background: #fff;
  color: var(--brand);
}

.login-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.topbar__brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.topbar__nav {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.topbar__nav a {
  padding: 9px 12px;
  border-radius: 8px;
  color: #34404b;
  text-decoration: none;
}

.topbar__nav a[aria-current="page"] {
  background: rgba(181, 0, 24, 0.08);
  color: var(--brand);
  font-weight: 700;
}

.topbar__nav a[aria-disabled="true"] {
  color: #98a2ad;
  pointer-events: none;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #34404b;
  font-size: 0.94rem;
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.welcome-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 36px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.welcome-band h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.6rem);
}

.metric {
  min-width: 190px;
  padding: 20px;
  border-radius: 8px;
  background: #172026;
  color: #fff;
  text-align: center;
}

.metric span {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
}

.metric small {
  color: #c7d0d8;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  margin-top: 24px;
}

.panel {
  padding: 24px;
  box-shadow: none;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #4b5662;
  font-size: 0.82rem;
  text-transform: uppercase;
}

td {
  color: #27323c;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(47, 143, 91, 0.12);
  color: #1f6f44;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.empty-state {
  margin-bottom: 0;
  color: var(--muted);
}

.next-list {
  margin: 18px 0 0;
  padding-left: 18px;
  color: #3e4a56;
}

.next-list li + li {
  margin-top: 10px;
}

@media (max-width: 880px) {
  .login-page {
    padding: 18px;
  }

  .login-shell,
  .content-grid,
  .welcome-band {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: auto;
    padding: 32px;
  }

  .brand-logo {
    width: 170px;
    margin-bottom: 28px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
  }

  .topbar__nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .topbar__user {
    width: 100%;
    justify-content: space-between;
  }

  .metric {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .login-card,
  .brand-panel,
  .welcome-band,
  .panel {
    padding: 22px;
  }

  .brand-copy p:last-child,
  .welcome-band p:last-child {
    font-size: 1rem;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar__brand span {
    max-width: 210px;
  }

  .workspace {
    width: min(100% - 20px, 1180px);
    margin-top: 16px;
  }
}

.alert--success {
  border-color: rgba(47, 143, 91, 0.28);
  background: rgba(47, 143, 91, 0.10);
  color: #1f6f44;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 28px 0 4px;
}

.page-heading h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.page-heading p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.step-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}

.step-banner span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 6px 10px;
  background: rgba(23, 32, 38, 0.22);
  font-weight: 700;
}

.content-grid--wide {
  grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
}

.panel--spaced {
  margin-top: 24px;
}

.data-form,
.inventory-form {
  display: grid;
  gap: 16px;
}

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

.data-form--compact {
  grid-template-columns: 1fr;
  align-items: start;
}

.data-form--compact button {
  justify-self: start;
  min-width: 172px;
}

.data-form label,
.inventory-form label,
.form-row label {
  display: grid;
  gap: 7px;
  color: #34404b;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
}

.data-form input,
.data-form select,
.data-form textarea,
.inventory-form input,
.inventory-form select,
.inventory-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.data-form textarea,
.inventory-form textarea {
  resize: vertical;
}

.data-form input:focus,
.data-form select:focus,
.data-form textarea:focus,
.inventory-form input:focus,
.inventory-form select:focus,
.inventory-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(181, 0, 24, 0.12);
}

.form-span {
  grid-column: 1 / -1;
}

.inventory-form {
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.form-row,
.check-panel,
.form-actions {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-column: 1 / -1;
  gap: 0;
}

.form-row > label,
.check-panel > legend {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 13px 14px;
  background: #6999a7;
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
}

.form-row > input,
.form-row > select,
.form-row > textarea,
.check-panel > .empty-state,
.check-panel > label,
.form-actions {
  margin: 0;
  border-radius: 0;
  border: 0;
  background: #d7f4eb;
}

.form-row > input,
.form-row > select,
.form-row > textarea {
  min-height: 44px;
}

.check-panel {
  border: 0;
  padding: 0;
}

.check-panel label,
.check-panel .empty-state {
  display: block;
  padding: 6px 14px;
  color: #2e6371;
  font-weight: 700;
}

.check-panel label:first-of-type,
.check-panel .empty-state {
  padding-top: 12px;
}

.check-panel label:last-child,
.check-panel .empty-state {
  padding-bottom: 12px;
}

.check-panel input[type="checkbox"] {
  width: 16px;
  min-height: auto;
  margin: 0 6px 0 0;
  accent-color: var(--brand);
}

.form-actions {
  display: flex;
  justify-content: center;
  padding: 14px;
}

.form-actions button,
.data-form button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.inline-form {
  margin: 0;
}

.inline-form button {
  white-space: nowrap;
}

.status-pill--off {
  background: rgba(93, 105, 117, 0.14);
  color: #5d6975;
}

@media (max-width: 1040px) {
  .content-grid--wide,
  .data-form--compact {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar__nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .inventory-form,
  .form-row,
  .check-panel,
  .form-actions {
    display: block;
  }

  .form-row > label,
  .check-panel > legend {
    min-height: 42px;
  }

  .step-banner {
    align-items: stretch;
    flex-direction: column;
  }
}

.metric--small {
  min-width: 128px;
  padding: 12px 14px;
}

.metric--small span {
  font-size: 1.35rem;
}

.inventory-workspace {
  width: min(1240px, calc(100% - 32px));
}

.inventory-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  margin-bottom: 24px;
  padding: 34px;
  border: 1px solid rgba(223, 228, 234, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(181, 0, 24, 0.08), transparent 42%),
    linear-gradient(315deg, rgba(47, 143, 91, 0.10), transparent 36%),
    #fff;
}

.inventory-hero h1 {
  margin-bottom: 12px;
  font-size: clamp(2.25rem, 4vw, 4rem);
}

.inventory-hero p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.stepper {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper__item {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: #fff;
  color: #5d6975;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.stepper__item span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #edf1f4;
  color: #5d6975;
  font-size: 0.78rem;
}

.stepper__item--active {
  border-color: rgba(181, 0, 24, 0.28);
  background: rgba(181, 0, 24, 0.08);
  color: var(--brand);
}

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

.inventory-builder {
  display: grid;
  gap: 18px;
}

.form-section {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.form-section--highlight {
  border-color: rgba(181, 0, 24, 0.18);
  box-shadow: 0 18px 38px rgba(23, 32, 38, 0.08);
}

.form-section__title {
  display: grid;
  align-content: start;
  gap: 12px;
}

.form-section__title h2 {
  margin-bottom: 6px;
  font-size: 1.22rem;
}

.form-section__title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.section-number {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(181, 0, 24, 0.08);
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 900;
}

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

.field {
  display: grid;
  grid-column: span 3;
  gap: 8px;
  min-width: 0;
  color: #34404b;
  font-size: 0.9rem;
  font-weight: 800;
}

.field--third {
  grid-column: span 2;
}

.field--wide {
  grid-column: span 4;
}

.field--full {
  grid-column: 1 / -1;
}

.field span {
  line-height: 1.25;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(181, 0, 24, 0.12);
}

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

.selection-box {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.selection-box legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 900;
}

.option-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.option-card {
  display: grid;
  grid-template-columns: auto 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px;
  border: 1px solid #dbe2e8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.option-card:hover {
  border-color: rgba(181, 0, 24, 0.35);
}

.option-card input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}

.option-card__abbr {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(181, 0, 24, 0.08);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
}

.option-card--pollutant .option-card__abbr {
  background: rgba(47, 143, 91, 0.12);
  color: #1f6f44;
}

.option-card__name {
  min-width: 0;
  color: #34404b;
  font-weight: 700;
}

.builder-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 30px rgba(23, 32, 38, 0.10);
}

.builder-actions div {
  display: grid;
  gap: 2px;
}

.builder-actions span {
  color: var(--muted);
  font-size: 0.9rem;
}

.builder-actions button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 11px 18px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 1040px) {
  .inventory-hero,
  .form-section,
  .selection-grid {
    grid-template-columns: 1fr;
  }

  .selection-grid {
    grid-column: 1;
  }

  .stepper {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .inventory-hero,
  .form-section {
    padding: 22px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field,
  .field--third,
  .field--wide,
  .field--full {
    grid-column: 1;
  }

  .option-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .option-card__abbr {
    grid-column: 2;
    justify-self: start;
  }

  .option-card__name {
    grid-column: 2;
  }

  .builder-actions {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }
}

.panel__header--stacked {
  align-items: stretch;
  flex-direction: column;
}

.inventory-list-panel {
  overflow: hidden;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px auto auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.search-form label {
  display: grid;
  gap: 7px;
  color: #34404b;
  font-size: 0.88rem;
  font-weight: 800;
}

.search-form input,
.search-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.search-form input:focus,
.search-form select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(181, 0, 24, 0.12);
}

.search-form button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 900px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  .search-form .button,
  .search-form button {
    width: 100%;
  }
}

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

.conditions-summary div {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.conditions-summary strong {
  color: var(--brand);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.conditions-summary span {
  color: var(--ink);
  font-weight: 800;
}

.editable-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.editable-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
}

.editable-table th {
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.editable-table td {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.editable-table td:first-child span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.editable-table input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.editable-table input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(181, 0, 24, 0.12);
}

.meteo-table {
  min-width: 760px;
}

@media (max-width: 820px) {
  .conditions-summary {
    grid-template-columns: 1fr;
  }
}

.stage-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 22px;
}

.stage-nav__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 9px;
  min-height: 78px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.stage-nav__item span {
  grid-row: span 2;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #edf1f4;
  color: #5d6975;
  font-weight: 900;
}

.stage-nav__item strong {
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.15;
}

.stage-nav__item small {
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.15;
}

.stage-nav__item--active {
  border-color: rgba(181, 0, 24, 0.32);
  background: rgba(181, 0, 24, 0.08);
}

.stage-nav__item--active span {
  background: var(--brand);
  color: #fff;
}

.stage-nav__item--done span {
  background: var(--green);
  color: #fff;
}

.stage-nav__item--locked {
  color: #7b858f;
  cursor: not-allowed;
  opacity: 0.76;
}

.stage-nav__item--locked span {
  background: #e6eaee;
  color: #98a2ad;
}

.stage-placeholder p:last-child {
  max-width: 760px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .stage-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .stage-nav {
    grid-template-columns: 1fr;
  }
}

.stage-three-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.stage-three-form {
  grid-template-columns: 1fr;
  align-content: start;
}

.stage-three-form .form-section__title {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.form-button-row {
  justify-items: start;
}

.form-button-row button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.road-fields {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid rgba(47, 143, 91, 0.22);
  border-radius: 8px;
  background: rgba(47, 143, 91, 0.07);
}

.road-fields[hidden] {
  display: none;
}

.group-board {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.group-board__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.group-board__header h2 {
  margin-bottom: 0;
}

.group-board__header span,
.process-count {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(181, 0, 24, 0.08);
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

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

.group-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
}

.group-card header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.group-card h3,
.process-card h4 {
  margin: 0;
  line-height: 1.2;
}

.group-card header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.code-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 5px 9px;
  background: var(--brand);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.code-badge--soft {
  background: rgba(47, 143, 91, 0.12);
  color: #1f6f44;
}

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

.process-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #f8fafb;
}

.process-card > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.process-meta div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.process-meta dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.process-meta dd {
  margin: 0;
  color: #27323c;
  font-weight: 800;
  overflow-wrap: anywhere;
}

@media (max-width: 1060px) {
  .stage-three-layout,
  .group-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .group-board,
  .group-card {
    padding: 18px;
  }

  .group-board__header,
  .process-card > div:first-child {
    align-items: stretch;
    flex-direction: column;
  }

  .process-meta {
    grid-template-columns: 1fr;
  }
}
.group-card__header,
.process-card__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.record-actions {
  display: flex;
  gap: 8px;
  align-items: start;
  justify-content: end;
  flex-wrap: wrap;
}

.record-actions--inline {
  margin-left: auto;
}

.edit-disclosure {
  position: relative;
}

.edit-disclosure summary,
.button-danger {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  color: #34404b;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.edit-disclosure summary::-webkit-details-marker {
  display: none;
}

.edit-disclosure[open] summary {
  border-color: rgba(181, 0, 24, 0.32);
  background: rgba(181, 0, 24, 0.08);
  color: var(--brand);
}

.button-danger {
  border-color: rgba(181, 0, 24, 0.28);
  color: var(--brand);
}

.button-danger:hover {
  background: rgba(181, 0, 24, 0.08);
}

.delete-form {
  margin: 0;
}

.compact-edit-form {
  position: absolute;
  right: 0;
  z-index: 6;
  display: grid;
  width: min(420px, calc(100vw - 40px));
  gap: 10px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(23, 32, 38, 0.18);
}

.compact-edit-form label {
  display: grid;
  gap: 6px;
  color: #34404b;
  font-size: 0.82rem;
  font-weight: 900;
}

.compact-edit-form input,
.compact-edit-form select,
.compact-edit-form textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd3dc;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.compact-edit-form textarea {
  resize: vertical;
}

.compact-edit-form input:focus,
.compact-edit-form select:focus,
.compact-edit-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(181, 0, 24, 0.12);
}

.compact-edit-form button[type="submit"] {
  justify-self: start;
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.compact-road-fields {
  display: grid;
  gap: 10px;
  padding: 10px;
}

@media (max-width: 720px) {
  .group-card__header,
  .process-card__header {
    grid-template-columns: 1fr;
  }

  .record-actions,
  .record-actions--inline {
    justify-content: start;
    margin-left: 0;
  }

  .compact-edit-form {
    left: 0;
    right: auto;
    width: min(100%, calc(100vw - 40px));
  }
}
/* stage-three-action-overrides */
.group-card header.group-card__header,
.process-card > div:first-child.process-card__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

@media (max-width: 720px) {
  .group-card header.group-card__header,
  .process-card > div:first-child.process-card__header {
    grid-template-columns: 1fr;
  }
}