:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #d8dee8;
  --text: #18202d;
  --muted: #667085;
  --accent: #176a5f;
  --accent-strong: #0f5149;
  --accent-soft: #e7f5f1;
  --warning: #9a5b00;
  --danger: #b42318;
  --ok: #0f7a48;
  --shadow: 0 1px 2px rgba(16, 24, 40, 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;
  font-size: 14px;
  line-height: 1.5;
}

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

h1,
h2 {
  margin: 0 0 16px;
  line-height: 1.2;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  background: #0d1524;
  color: #f9fafb;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 700;
}

.brand__mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 18px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.brand__mark img {
  display: block;
  width: 28px;
  height: 28px;
}

.brand__word {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  letter-spacing: 0;
}

.brand__primary {
  color: #ffffff;
  font-size: 15px;
  font-weight: 760;
}

.brand__secondary {
  color: #9fd8cf;
  font-size: 14px;
  font-weight: 650;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #d1d5db;
  font-size: 13px;
}

.topbar__link {
  color: #e5e7eb;
  font-weight: 650;
}

.topbar__link:hover {
  color: #ffffff;
}

.language-switcher {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.language-switcher a {
  min-width: 34px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #d1d5db;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.language-switcher a.is-active {
  background: #ffffff;
  color: #0d1524;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 10px 12px;
  color: var(--text);
  border-bottom: 2px solid transparent;
}

.tabs a:hover,
.tabs a.is-active {
  border-color: var(--accent);
}

.tabs a.is-active {
  color: var(--accent-strong);
  font-weight: 700;
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 24px;
  align-items: center;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef8f5 100%);
  box-shadow: var(--shadow);
}

.page-hero--simple {
  grid-template-columns: 1fr;
}

.page-hero h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: 28px;
}

.page-hero p,
.workflow-band p,
.support-card p,
.step-card p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.hero-meter {
  display: grid;
  place-items: center;
  min-height: 132px;
  border: 1px solid #b9d6c8;
  border-radius: 8px;
  background: #ffffff;
}

.hero-meter__value {
  color: var(--accent-strong);
  font-size: 34px;
  font-weight: 780;
}

.hero-meter__label {
  color: var(--muted);
  font-size: 12px;
}

.operation-steps,
.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.step-card,
.support-card {
  display: flex;
  gap: 14px;
  min-height: 170px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.step-card--ok {
  border-color: #b9d6c8;
}

.step-card--warning,
.step-card--danger {
  border-color: #efd8a7;
}

.step-card--danger {
  border-color: #f4b8b2;
}

.step-card__number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 780;
}

.step-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.step-card__title {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.step-card__title h2,
.support-card h2,
.workflow-band h2 {
  margin: 0;
}

.step-card .button {
  align-self: flex-start;
  margin-top: auto;
}

.workflow-band {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  margin-bottom: 18px;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.workflow-band--action {
  border-color: #b9d6c8;
  background: linear-gradient(135deg, #ffffff 0%, #f6fbf9 100%);
}

.workflow-band__content {
  min-width: 0;
}

.workflow-band__status {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.support-card {
  flex-direction: column;
}

.support-card--recommended {
  border-color: #b9d6c8;
  background: #fbfffd;
}

.support-card__tag {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.support-card .button {
  align-self: flex-start;
  margin-top: auto;
}

.cutover-lane {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.cutover-lane__item {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow);
}

.cutover-lane__item:hover,
.cutover-lane__item.is-active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.panel--narrow {
  max-width: 440px;
  margin: 48px auto;
}

.auth-brand {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 61, 94, 0.16);
  overflow: hidden;
}

.auth-brand img {
  display: block;
  width: 44px;
  height: 44px;
}

.auth-reason {
  margin: -4px 0 16px;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

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

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

.metric__value {
  display: block;
  font-size: 28px;
  font-weight: 700;
}

.metric__label {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.split > * {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading--compact {
  margin-top: 20px;
  margin-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

th {
  background: #f1f4f8;
  color: #344054;
  font-weight: 650;
}

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

.mono {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.secret {
  padding: 10px 12px;
  background: #f1f4f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge--ok {
  background: #e7f6ee;
  color: var(--ok);
}

.badge--muted {
  background: #f2f4f7;
  color: var(--muted);
}

.badge--warning {
  background: #fff7e6;
  color: #9a5b00;
}

.badge--danger {
  background: #fff1f0;
  color: var(--danger);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.button:hover,
button:hover,
.button.is-active {
  border-color: var(--accent);
}

.button.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

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

.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
}

.inline-form,
.actions form {
  display: inline;
}

.actions,
.stacked-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stacked-actions {
  max-width: 420px;
}

.compact-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.compact-form input[type="password"] {
  width: 170px;
}

.compact-form input[name="host"] {
  width: 260px;
}

.compact-form input[name="name"] {
  width: 200px;
}

.compact-form select[name="mode"] {
  width: 150px;
}

.compact-form input[name="reportPath"] {
  width: 250px;
}

.compact-form--stack {
  align-items: stretch;
  flex-direction: column;
}

.compact-form--stack input,
.compact-form--stack select,
.compact-form--stack button {
  width: 100%;
}

.compact-form--danger {
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.compact-form--danger .subtle {
  flex-basis: 100%;
  max-width: 320px;
}

.checkbox-set {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  min-width: 220px;
}

.checkbox-set label {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.acme-form {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.4fr)
    minmax(150px, 1fr)
    minmax(130px, 0.7fr)
    auto
    auto
    minmax(190px, 1.2fr)
    auto
    auto;
  align-items: end;
}

.acme-form input,
.acme-form select {
  width: 100% !important;
}

.acme-form .check-line {
  align-self: center;
  white-space: nowrap;
}

.public-check-form input[name="httpPort"],
.public-check-form input[name="httpsPort"] {
  width: 96px;
}

.public-check-form input[name="path"],
.public-check-form input[name="timeoutMs"] {
  width: 170px;
}

.public-check-form input[name="site"],
.public-check-form input[name="blockedPorts"] {
  width: 260px;
}

.evidence-check-form input[name="acmePreflightReport"],
.evidence-check-form input[name="readinessReport"],
.evidence-check-form input[name="publicReport"],
.cutover-status-form input[name="acmePreflightReport"],
.cutover-status-form input[name="readinessReport"],
.cutover-status-form input[name="publicReport"],
.cutover-status-form input[name="rollbackReport"] {
  width: 320px;
}

.evidence-check-form input[name="expectedSiteCount"],
.cutover-status-form input[name="expectedSiteCount"] {
  width: 120px;
}

.evidence-check-form input[name="blockedPorts"],
.cutover-status-form input[name="blockedPorts"] {
  width: 260px;
}

.cutover-status-form select[name="phase"] {
  width: 160px;
}

.rollback-plan-form {
  align-items: center;
}

.step-list,
.command-list {
  margin: 0;
  padding-left: 20px;
}

.step-list li,
.command-list li {
  margin: 8px 0;
}

.command-list code {
  white-space: normal;
  word-break: break-word;
}

.guide-rail {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: guide-step;
}

.guide-rail li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  counter-increment: guide-step;
}

.guide-rail li::before {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 780;
  content: counter(guide-step);
}

.guide-rail strong,
.guide-rail span {
  grid-column: 2;
}

.guide-rail strong {
  align-self: end;
}

.guide-rail span {
  align-self: start;
  color: var(--muted);
  font-size: 12px;
}

.guide-rail .button {
  grid-row: 1 / span 2;
  grid-column: 3;
}

.command-chip {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1f4f8;
}

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

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

label span {
  display: block;
  margin-bottom: 5px;
  color: #344054;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  min-height: 0;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.policy-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.check-tile {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.check-tile input {
  margin-top: 3px;
}

.check-tile strong,
.check-tile small {
  display: block;
}

.check-tile small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.form-section {
  grid-column: 1 / -1;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.form-section legend {
  padding: 0 8px 0 0;
  color: #344054;
  font-weight: 700;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.notice {
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid #b9d6c8;
  border-radius: 6px;
  background: #eef8f3;
  color: var(--accent-strong);
}

.notice--error {
  border-color: #f4b8b2;
  background: #fff1f0;
  color: var(--danger);
}

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

.site-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.site-card h2,
.site-card p {
  margin: 0;
}

.site-card p {
  margin: 8px 0 10px;
  color: var(--muted);
}

.site-card__heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.site-card .button {
  align-self: flex-start;
  margin-top: 18px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  margin-top: 6px;
  color: var(--muted);
}

.qr-box {
  display: grid;
  place-items: center;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.qr-box img {
  width: 220px;
  height: 220px;
}

.status-code {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 40px;
  font-weight: 700;
}

@media (max-width: 820px) {
  .topbar,
  .section-heading,
  .workflow-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    padding: 14px 16px;
  }

  .topbar__meta {
    flex-wrap: wrap;
    gap: 8px 12px;
    width: 100%;
    font-size: 12px;
  }

  .shell {
    padding: 16px;
  }

  .tabs {
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0 -16px 18px;
    padding: 0 16px 4px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .tabs a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .page-hero,
  .site-card-grid,
  .metrics,
  .operation-steps,
  .support-grid,
  .cutover-lane,
  .split,
  .policy-grid,
  .form-grid--wide {
    grid-template-columns: 1fr;
  }

  .workflow-band__status {
    justify-content: flex-start;
  }

  .checkbox-set {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .compact-form {
    align-items: stretch;
  }

  .compact-form label,
  .compact-form input,
  .compact-form select,
  .compact-form button,
  .compact-form .button {
    width: 100% !important;
  }

  .compact-form input[type="checkbox"],
  .compact-form input[type="radio"] {
    width: auto !important;
  }

  .compact-form .check-line {
    width: auto !important;
  }

  .acme-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .acme-form .check-line {
    width: 100% !important;
    white-space: normal;
  }

  .guide-rail li {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .guide-rail .button {
    grid-row: auto;
    grid-column: 1 / -1;
  }

  table {
    display: block;
    overflow-x: auto;
  }

  table.responsive-table {
    display: block;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  table.responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  table.responsive-table tbody,
  table.responsive-table tr,
  table.responsive-table td {
    display: block;
    width: 100%;
  }

  table.responsive-table tr {
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  table.responsive-table tr:last-child {
    margin-bottom: 0;
  }

  table.responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.36fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f6;
    overflow-wrap: break-word;
    word-break: normal;
  }

  table.responsive-table td > * {
    min-width: 0;
  }

  table.responsive-table td:last-child {
    border-bottom: 0;
  }

  table.responsive-table td::before {
    color: #667085;
    font-size: 12px;
    font-weight: 700;
    content: attr(data-label);
  }

  table.responsive-table td.responsive-table__span,
  table.responsive-table td[colspan] {
    display: block;
  }

  table.responsive-table td.responsive-table__span::before,
  table.responsive-table td[colspan]::before {
    display: none;
  }

  table.responsive-table td.actions,
  table.responsive-table td.stacked-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    max-width: none;
  }

  table.responsive-table td.actions::before,
  table.responsive-table td.stacked-actions::before {
    flex: 0 0 100%;
  }

  table.responsive-table td.actions .button,
  table.responsive-table td.actions button {
    flex: 1 1 120px;
  }

  table.responsive-table td.stacked-actions > form,
  table.responsive-table td.stacked-actions .checkbox-set {
    width: 100%;
  }

  table.responsive-table td.stacked-actions .button,
  table.responsive-table td.stacked-actions button {
    flex: 0 0 auto;
  }
}
