:root {
  color-scheme: light;
  --cp-bg: #f7f4ef;
  --cp-bg-elevated: #fcfbf8;
  --cp-surface: #ffffff;
  --cp-surface-soft: #f5f5f5;
  --cp-border: #dedede;
  --cp-border-strong: #919191;
  --cp-text: #242424;
  --cp-text-muted: #5c5c5c;
  --cp-text-soft: #6f6f6f;
  --cp-accent: #b11f4b;
  --cp-accent-hover: #9a1a41;
  --cp-accent-soft: rgba(177, 31, 75, 0.08);
  --cp-accent-fg: #ffffff;
  --cp-success: #16a34a;
  --cp-danger: #dc2626;
  --cp-warning: #f59e0b;
  --cp-link: #0078d4;
  --cp-shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
  --cp-overlay: rgba(255, 255, 255, 0.8);
  --cp-panel: rgba(255, 255, 255, 0.86);
  --cp-panel-strong: rgba(255, 255, 255, 0.96);
  --cp-sheen: rgba(255, 255, 255, 0.55);
  --cp-highlight: rgba(177, 31, 75, 0.12);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --cp-bg: #3d3b3a;
  --cp-bg-elevated: #343231;
  --cp-surface: #292929;
  --cp-surface-soft: #2e2e2e;
  --cp-border: #474747;
  --cp-border-strong: #5f5f5f;
  --cp-text: #dedede;
  --cp-text-muted: #919191;
  --cp-text-soft: #b0b0b0;
  --cp-accent: #fd8ea1;
  --cp-accent-hover: #fb7b91;
  --cp-accent-soft: rgba(253, 142, 161, 0.14);
  --cp-accent-fg: #1a1a1a;
  --cp-success: #4ade80;
  --cp-danger: #f87171;
  --cp-warning: #fbbf24;
  --cp-link: #4da6ff;
  --cp-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --cp-overlay: rgba(41, 41, 41, 0.88);
  --cp-panel: rgba(41, 41, 41, 0.72);
  --cp-panel-strong: rgba(41, 41, 41, 0.96);
  --cp-sheen: rgba(255, 255, 255, 0.04);
  --cp-highlight: rgba(253, 142, 161, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cp-bg);
  color: var(--cp-text);
  font-family: "Segoe UI", Aptos, Calibri, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
summary {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

code,
.log,
.stage-tech {
  font-family: Consolas, "Courier New", Courier, monospace;
}

code {
  padding: 0.18rem 0.4rem;
  border-radius: 0.25rem;
  background: var(--cp-surface-soft);
  color: var(--cp-text);
  font-size: 0.82rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--cp-border);
  background: var(--cp-panel-strong);
}

.header-inner,
.footer-inner,
main {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--cp-text);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 3px solid var(--cp-accent);
  color: var(--cp-accent);
}

.brand-mark > span:first-child {
  position: absolute;
  top: 11px;
  right: -3px;
  width: 28px;
  border-top: 3px solid currentColor;
}

.brand-mark > span:last-child {
  position: absolute;
  right: 10px;
  bottom: -3px;
  height: 28px;
  border-right: 3px solid currentColor;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--cp-text-muted);
  font-size: 0.76rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cp-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cp-border-strong);
}

.status[data-state="signed-in"] .status-dot {
  background: var(--cp-success);
}

.status[data-state="error"] .status-dot {
  background: var(--cp-danger);
}

.btn {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  cursor: pointer;
  font-weight: 650;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.btn:focus-visible,
summary:focus-visible,
.brand:focus-visible {
  outline: 3px solid var(--cp-highlight);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--cp-accent);
  color: var(--cp-accent-fg);
}

.btn-primary:hover {
  background: var(--cp-accent-hover);
}

.btn-secondary {
  border-color: var(--cp-border);
  background: var(--cp-surface);
}

.btn-secondary:hover {
  border-color: var(--cp-border-strong);
}

main {
  padding-bottom: 80px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: 64px;
  align-items: center;
  min-height: 430px;
  padding: 60px 0;
  border-bottom: 1px solid var(--cp-border);
}

.hero-content {
  max-width: 700px;
}

.eyebrow,
.panel-kicker,
.hero-card-label {
  margin: 0 0 10px;
  color: var(--cp-accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 24px;
  font-size: clamp(2.5rem, 5vw, 4.4rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero-lead {
  max-width: 600px;
  margin-bottom: 28px;
  color: var(--cp-text-muted);
  font-size: 1.14rem;
  line-height: 1.7;
}

.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.trust-list span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cp-text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.trust-list svg {
  width: 17px;
  color: var(--cp-accent);
}

.hero-card {
  display: flex;
  gap: 20px;
  padding: 28px;
  border-top: 4px solid var(--cp-accent);
  background: var(--cp-surface);
  box-shadow: 0 1px 2px var(--cp-border);
}

.shield-icon,
.panel-icon,
.admin-icon,
.summary-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--cp-accent);
}

.shield-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--cp-accent-soft);
}

.shield-icon svg {
  width: 27px;
}

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

.hero-card p:last-child {
  margin: 0;
  color: var(--cp-text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.section {
  padding: 60px 0 0;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.65fr);
  align-items: end;
  gap: 48px;
  margin-bottom: 28px;
}

.section-heading h2,
.gated h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.16;
}

.section-heading > p,
.section-heading-actions > p {
  margin: 0;
  color: var(--cp-text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.section-heading-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-refresh[hidden] {
  display: none;
}

.btn-refresh svg {
  width: 17px;
}

.btn-refresh[aria-busy="true"] svg {
  animation: refresh-spin 800ms linear infinite;
}

@keyframes refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-refresh[aria-busy="true"] svg {
    animation: none;
  }
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  display: flex;
  gap: 18px;
  min-height: 204px;
  padding: 24px;
  border: 1px solid var(--cp-border);
  border-radius: 16px;
  background: var(--cp-surface);
  box-shadow: 0 1px 2px var(--cp-border);
}

.panel-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.625rem;
  background: var(--cp-accent-soft);
}

.panel-icon svg,
.admin-icon svg {
  width: 23px;
}

.panel-body {
  min-width: 0;
  flex: 1;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-kicker {
  margin-bottom: 4px;
}

.panel-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-state,
.permission-badge {
  padding: 4px 8px;
  border-radius: 0.625rem;
  background: var(--cp-surface-soft);
  color: var(--cp-text-muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.kv {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 10px 16px;
  margin: 0;
}

.kv dt {
  color: var(--cp-text-muted);
  font-size: 0.78rem;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  font-weight: 600;
}

.kv-empty {
  grid-column: 1 / -1;
  color: var(--cp-text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.gated {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  margin-top: 20px;
  padding: 28px;
  border: 1px solid var(--cp-accent);
  border-radius: 16px;
  background: var(--cp-accent-soft);
}

.gated[hidden] {
  display: none;
}

.admin-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cp-surface);
}

.gated h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.gated p {
  margin: 0;
  color: var(--cp-text-muted);
}

.permission-badge {
  background: var(--cp-surface);
  color: var(--cp-accent);
}

.journey-section {
  margin-top: 60px;
  padding-top: 60px;
  border-top: 1px solid var(--cp-border);
}

.stages {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: 140px;
  padding: 20px 16px;
  border: 1px solid var(--cp-border);
  border-radius: 16px;
  background: var(--cp-surface);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.stage-active {
  border-color: var(--cp-accent);
  box-shadow: 0 0 0 3px var(--cp-accent-soft);
}

.stage-index {
  color: var(--cp-accent);
  font-size: 0.75rem;
  font-weight: 750;
}

.stage-name,
.stage-detail,
.stage-tech {
  display: block;
}

.stage-name {
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.stage-detail {
  min-height: 42px;
  color: var(--cp-text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.stage-tech {
  margin-top: 12px;
  color: var(--cp-text-soft);
  font-size: 0.66rem;
}

.stage-link {
  color: var(--cp-border-strong);
}

.stage-link svg {
  width: 20px;
}

.technical-details {
  margin-top: 60px;
  border: 1px solid var(--cp-border);
  border-radius: 16px;
  background: var(--cp-surface);
  overflow: hidden;
}

.technical-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding: 0 24px;
  cursor: pointer;
  list-style: none;
  font-size: 0.94rem;
  font-weight: 700;
}

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

.technical-details summary > span:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary-icon svg {
  width: 20px;
}

.summary-meta {
  color: var(--cp-text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.details-content {
  padding: 0 24px 24px;
  border-top: 1px solid var(--cp-border);
}

.gateway-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  color: var(--cp-text-muted);
  font-size: 0.8rem;
}

.log {
  min-height: 74px;
  max-height: 220px;
  margin: 0;
  padding: 16px;
  overflow-y: auto;
  border-radius: 0.625rem;
  background: var(--cp-surface-soft);
  color: var(--cp-text-muted);
  font-size: 0.73rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

footer {
  border-top: 1px solid var(--cp-border);
  background: var(--cp-surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  color: var(--cp-text-muted);
  font-size: 0.8rem;
}

.footer-inner p {
  margin: 0;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cp-text);
  font-weight: 650;
}

.brand-mark-small {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  border-width: 2px;
}

.brand-mark-small > span:first-child {
  top: 7px;
  right: -2px;
  width: 19px;
  border-width: 2px;
}

.brand-mark-small > span:last-child {
  right: 7px;
  bottom: -2px;
  height: 19px;
  border-width: 2px;
}

@media (max-width: 940px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .hero-card {
    max-width: 620px;
  }

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

  .stage-link {
    display: none;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .footer-inner,
  main {
    width: min(100% - 32px, 1180px);
  }

  .header-inner {
    min-height: 68px;
  }

  .brand-copy small,
  .status {
    display: none;
  }

  .btn {
    min-height: 38px;
    padding-inline: 14px;
    font-size: 0.82rem;
  }

  .hero {
    min-height: auto;
    padding: 52px 0;
  }

  h1 {
    font-size: clamp(2.35rem, 11vw, 3.4rem);
  }

  .section {
    padding-top: 56px;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .panels,
  .stages {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  .gated {
    grid-template-columns: auto 1fr;
  }

  .permission-badge {
    grid-column: 2;
    justify-self: start;
  }

  .journey-section {
    margin-top: 56px;
    padding-top: 56px;
  }

  .stage {
    min-height: auto;
  }

  .stage-detail {
    min-height: auto;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 24px 0;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .brand-mark > span:first-child {
    top: 9px;
    width: 23px;
  }

  .brand-mark > span:last-child {
    right: 8px;
    height: 23px;
  }

  .brand-copy strong {
    font-size: 0.9rem;
  }

  .btn-secondary {
    padding-inline: 10px;
  }

  .hero-card,
  .panel {
    padding: 22px;
  }

  .panel {
    flex-direction: column;
  }

  .technical-details summary,
  .details-content {
    padding-inline: 18px;
  }

  .gateway-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .stage {
    transition: none;
  }
}

/* Items (CRUD) panel */
.section[hidden] {
  display: none;
}

.item-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.item-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--cp-text-muted);
}

.item-form input {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--cp-border);
  border-radius: 8px;
  background: var(--cp-surface);
  color: var(--cp-text);
  font: inherit;
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--cp-border);
  border-radius: 8px;
}

.item-text {
  display: grid;
  overflow-wrap: anywhere;
}

.item-text span {
  color: var(--cp-text-muted);
  font-size: 0.9rem;
}

.item-done .item-text strong {
  text-decoration: line-through;
  color: var(--cp-text-soft);
}

.btn-small {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

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

.btn-danger {
  margin-top: 0.75rem;
  background: #b42318;
  color: #fff;
  border-color: #b42318;
}

.btn-danger:hover {
  background: #912018;
}

