:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #eef3f6;
  --text: #17202a;
  --muted: #607080;
  --line: #d7e0e7;
  --accent: #146c5c;
  --accent-dark: #0d4d42;
  --warn: #9a5b13;
  --disabled: #76828f;
  --shadow: 0 10px 28px rgba(18, 31, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: #10252c;
  color: #f5fafb;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #dceee8;
  color: var(--accent-dark);
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: #6f8191;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #a9c2c8;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

h2 {
  margin-bottom: 10px;
  font-size: 2rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 4px;
  font-size: 1.2rem;
}

h4 {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

nav {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #dbe8eb;
  text-decoration: none;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

main {
  padding: 28px;
}

.hero,
.section {
  max-width: 1220px;
  margin: 0 auto 22px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero p {
  max-width: 760px;
  color: var(--muted);
}

.status-panel {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.banner {
  max-width: 1220px;
  margin: 0 auto 18px;
  padding: 12px 16px;
  border: 1px solid #e3b56f;
  border-radius: 8px;
  background: #fff3df;
  color: #6f3d08;
  font-weight: 700;
}

.status-panel span:last-child {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.status-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--accent);
}

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

.section-heading {
  margin-bottom: 16px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 28px;
}

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

.area-card,
.module-card {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.area-card p,
.module-card li,
.relationship-node span,
.validation-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.module-groups {
  display: grid;
  gap: 12px;
}

.module-card {
  min-height: auto;
}

.module-card ul,
.question-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.module-card li,
.validation-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.module-card li:first-child,
.validation-row:first-child {
  border-top: 0;
}

.badge {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.enabled {
  color: #0f4c3f;
  background: #dceee8;
}

.badge.disabled {
  color: #485563;
  background: #e7ebef;
}

.badge.draft,
.badge.pending {
  color: #6f3d08;
  background: #fff3df;
}

.badge.active,
.badge.verified {
  color: #0f4c3f;
  background: #dceee8;
}

.badge.failed {
  color: #7f1d1d;
  background: #fde8e8;
}

.badge.completed {
  color: #394b59;
  background: #dde8ef;
}

.badge.archived {
  color: #5c4550;
  background: #f1e5eb;
}

.question-list li {
  padding: 10px 12px;
  border-left: 3px solid var(--warn);
  background: #fff8ed;
  color: #4b3a24;
}

.relationship-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.relationship-node {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.relationship-node strong,
.relationship-node span {
  display: block;
}

.connector {
  display: none;
}

.validation-list,
.doc-links {
  display: grid;
  gap: 8px;
}

.validation-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

code {
  color: var(--accent-dark);
  font-weight: 700;
}

.doc-links a {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.doc-links a:hover {
  border-color: #9ab8b0;
  background: #f2faf7;
}

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

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

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

th {
  color: #40515f;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

td a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.table-note {
  display: block;
  max-width: 260px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.button-link,
.foundation-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--accent-dark);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.foundation-form {
  display: grid;
  gap: 12px;
}

.foundation-form label {
  display: grid;
  gap: 6px;
  color: #40515f;
  font-size: 0.9rem;
  font-weight: 700;
}

.foundation-form input,
.foundation-form select,
.foundation-form textarea,
td input,
td select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.foundation-form input,
.foundation-form select,
td input,
td select {
  min-height: 42px;
}

.foundation-form textarea {
  min-height: 104px;
  resize: vertical;
}

.inline-form {
  grid-template-columns: minmax(220px, 1fr) 180px 140px auto;
  align-items: end;
  margin-bottom: 16px;
}

.season-create-form {
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) 150px 150px 150px auto;
  align-items: end;
  margin-bottom: 16px;
}

.identity-create-form {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  align-items: end;
  margin-bottom: 16px;
}

.season-table td:nth-child(4) {
  min-width: 170px;
}

.season-table td:nth-child(4) input + input {
  margin-top: 8px;
}

.identity-table td:first-child input + input,
.identity-table td:nth-child(4) input + input {
  margin-top: 8px;
}

.disabled-state {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fa;
}

.disabled-state p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.disabled-state a {
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid #9aa8b4;
  border-radius: 8px;
  color: #40515f;
  font-weight: 700;
  text-decoration: none;
}

.checkbox-label,
.table-check,
.module-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.checkbox-label input,
.table-check input,
.module-toggle input {
  width: auto;
  min-height: auto;
}

td button,
.module-card button {
  min-height: 36px;
  margin: 2px 4px 2px 0;
  padding: 8px 10px;
  border: 1px solid var(--accent-dark);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent-dark);
  font-weight: 700;
  cursor: pointer;
}

td button:hover,
.module-card button:hover {
  background: #f2faf7;
}

.editable-modules .module-card li {
  align-items: center;
}

.swatch-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(100px, 1fr));
  gap: 12px;
  align-content: start;
}

.color-swatch {
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .hero,
  .two-column,
  .inline-form,
  .season-create-form,
  .identity-create-form {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  main {
    padding: 16px;
  }

  .section,
  .hero {
    padding: 18px;
  }

  nav {
    grid-template-columns: 1fr 1fr;
  }

  .area-grid,
  .relationship-map {
    grid-template-columns: 1fr;
  }

  .disabled-state {
    align-items: flex-start;
    flex-direction: column;
  }
}
