:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #5e6a66;
  --line: #d9e2dc;
  --panel: #ffffff;
  --soft: #f5f8f4;
  --field: #fbfcfa;
  --green: #2f684e;
  --green-dark: #174936;
  --gold: #b7791f;
  --red: #a13a31;
  --blue: #2d5f8b;
  --shadow: 0 18px 45px rgba(25, 42, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--green-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

button {
  cursor: pointer;
}

.boot-fallback {
  display: grid;
  place-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.boot-fallback h1 {
  font-size: 3rem;
}

.boot-fallback p {
  color: var(--muted);
}

.lead-popover {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: grid;
  width: min(440px, 100%);
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.gate-copy {
  padding: 0;
}

.gate-copy h1 {
  font-size: 2.25rem;
  line-height: 1.03;
}

.gate-copy .lead {
  margin-top: 12px;
  font-size: 0.98rem;
}

.lead-popover h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.1;
}

.compact-signup {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  backdrop-filter: none;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

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

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: 4.2rem;
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 16px;
  font-size: 1rem;
}

.lead {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.6;
}

.signup,
.info-panel,
.comments,
.table-wrap {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.signup {
  display: grid;
  gap: 20px;
  padding: 24px;
  backdrop-filter: blur(14px);
}

label,
fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

label,
legend {
  color: #24332f;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 104, 78, 0.16);
}

.primary-action,
.ghost-button,
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.primary-action {
  min-height: 46px;
  border: 1px solid var(--green-dark);
  background: var(--green-dark);
  color: white;
  padding: 11px 16px;
}

.primary-action:hover,
.ghost-button:hover,
.row-action:hover {
  filter: brightness(0.96);
  text-decoration: none;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ghost-button,
.row-action {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
  padding: 8px 12px;
}

.form-error {
  min-height: 22px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

.microcopy {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 12px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 248, 244, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
}

.brand-logo {
  display: block;
  width: 76px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  max-width: 42vw;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-note {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.workspace {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.overview,
.detail-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.overview h1,
.detail-head h1 {
  font-size: 3.4rem;
}

.index-hero-copy {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.index-logo {
  display: block;
  width: min(260px, 100%);
  height: auto;
  object-fit: contain;
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 180px;
  gap: 12px;
  margin: 22px 0;
}

.table-wrap {
  overflow-x: auto;
  box-shadow: none;
}

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

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

th {
  background: #eef4ef;
  color: #24332f;
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  line-height: 1.45;
}

tbody tr:hover td {
  background: #fbfdf9;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.sort-button span {
  color: var(--green);
  font-size: 1rem;
}

.table-title {
  display: block;
  color: var(--ink);
  font-weight: 850;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.version,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.version.current,
.status-pill.current {
  background: #e5f3ec;
  color: #19523a;
}

.version.review,
.status-pill.review {
  background: #fff0db;
  color: #8a4d12;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.back-link {
  display: inline-flex;
  margin-bottom: 16px;
  font-weight: 800;
}

.detail-grid,
.document-grid {
  display: grid;
  gap: 16px;
}

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

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

dl {
  display: grid;
  gap: 13px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
}

.plain-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.wait-meter {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.wait-meter div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee9;
}

.wait-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.document-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0;
}

.featured-documents {
  margin: 22px 0 12px;
}

.document-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.document-card h2 {
  margin: 0 0 4px;
}

.document-frame {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: #eef4ef;
}

.document-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.current-rules-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--green);
  border-radius: 8px;
  background: #fff;
  padding: 16px 18px;
}

.current-rules-callout .eyebrow {
  margin-bottom: 6px;
}

.current-rules-callout h2 {
  margin: 0;
  font-size: 1.05rem;
}

.current-rules-callout p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.current-rules-callout .primary-action {
  flex: 0 0 auto;
}

.comments {
  margin-top: 18px;
  padding: 20px;
  box-shadow: none;
}

.comments-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.comments-head h2 {
  margin: 0;
}

.comments-head span {
  color: var(--muted);
  font-weight: 800;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(240px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
}

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

.comment {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  padding: 14px;
}

.comment div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.comment time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.comment p {
  margin: 0;
  color: #33443f;
  line-height: 1.55;
}

@media (max-width: 940px) {
  .detail-grid,
  .document-grid,
  .comment-form {
    grid-template-columns: 1fr;
  }

  .overview,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .index-hero-copy {
    grid-template-columns: 180px minmax(0, 1fr);
  }

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

  .current-rules-callout {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 3.25rem;
  }

  .overview h1,
  .detail-head h1 {
    font-size: 2.7rem;
  }
}

@media (max-width: 650px) {
  .lead-popover {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .signup {
    padding: 18px;
  }

  .compact-signup {
    padding: 0;
  }

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

  .topbar nav {
    justify-content: flex-start;
    width: 100%;
  }

  .workspace {
    width: min(100% - 22px, 1220px);
    padding-top: 24px;
  }

  .index-hero-copy {
    grid-template-columns: 1fr;
  }

  .index-logo {
    width: min(280px, 100%);
  }

  h1,
  .overview h1,
  .detail-head h1 {
    font-size: 2.35rem;
    line-height: 1.02;
  }

  dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .primary-action,
  .ghost-button,
  .row-action {
    width: 100%;
  }
}
