:root {
  --ink: #17211f;
  --muted: #5d6b68;
  --line: #d7dfdc;
  --panel: #ffffff;
  --wash: #eef4f1;
  --accent: #176a68;
  --accent-strong: #0d4f4d;
  --amber: #b16618;
  --danger: #9c2b2b;
  --shadow: 0 16px 48px rgba(23, 33, 31, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(238, 244, 241, 0.94), rgba(246, 248, 247, 0.98)),
    repeating-linear-gradient(90deg, rgba(23, 106, 104, 0.08) 0 1px, transparent 1px 88px);
}

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

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: stretch;
  min-height: 320px;
}

.intro > div:first-child {
  display: flex;
  min-height: 320px;
  flex-direction: column;
  justify-content: center;
  padding: 36px 0;
}

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

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

h1 {
  max-width: 850px;
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 6vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lede {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.system-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.system-card {
  display: grid;
  gap: 16px;
  align-content: center;
  padding: 22px;
}

.panel {
  margin-top: 20px;
  padding: 22px;
}

.panel.compact {
  margin-top: 0;
}

.panel-heading {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: start;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.panel p {
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.45;
}

label {
  display: grid;
  gap: 7px;
  color: #2f3d3a;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bfcac7;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  min-height: 190px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
  tab-size: 2;
}

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #bfcac7;
  border-radius: 6px;
  background: #fff;
}

.inline-input input {
  border: 0;
  border-radius: 0;
}

.inline-input span {
  padding: 0 11px;
  color: var(--muted);
  font-weight: 800;
}

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

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary,
button.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
}

button.secondary:hover,
button.ghost:hover {
  background: var(--wash);
}

.message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--danger);
  font-weight: 700;
}

.results {
  display: grid;
  gap: 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.4rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

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

td input,
td select {
  min-height: 36px;
  padding: 6px 8px;
}

td .row-remove {
  min-height: 36px;
  width: 100%;
  padding: 0 8px;
}

th {
  background: #f4f7f5;
  color: #2f3d3a;
  font-size: 0.8rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.number {
  text-align: right;
  white-space: nowrap;
}

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

.warning-list li {
  border-left: 4px solid var(--amber);
  padding: 10px 12px;
  background: #fff8ef;
}

.plain-english {
  display: grid;
  gap: 10px;
  color: #2f3d3a;
  line-height: 1.55;
}

.ok {
  color: #1e6a2d;
}

.bad {
  color: var(--danger);
}

@media (max-width: 920px) {
  .intro,
  .settings-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .intro > div:first-child {
    min-height: 260px;
    padding: 16px 0;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 12px;
  }

  h1 {
    font-size: 2.35rem;
    line-height: 1;
  }

  .panel,
  .system-card {
    padding: 16px;
  }

  .panel-heading,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    display: grid;
  }
}
