:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-muted: #f8f8f9;
  --border: #dfe2e6;
  --border-strong: #c8ccd1;
  --text: #191b1f;
  --muted: #666b73;
  --quiet: #8a9099;
  --accent: #e86424;
  --accent-hover: #c94f16;
  --green: #177a4d;
  --green-bg: #eaf6ef;
  --red: #b42318;
  --red-bg: #fff1ef;
  --amber: #8a5b00;
  --amber-bg: #fff7df;
  --focus: rgba(232, 100, 36, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
.profile-card {
  border-radius: 6px;
}

button {
  min-height: 42px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

button.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

button.secondary:hover:not(:disabled) {
  background: #eef0f2;
  border-color: #aaafb7;
}

button.danger {
  background: var(--surface);
  border-color: #e5b5b0;
  color: var(--red);
}

button.danger:hover:not(:disabled) {
  background: var(--red-bg);
  border-color: #d77a72;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
  outline: none;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #393d43;
  font-size: 13px;
  font-weight: 650;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  background: #181a1e;
  border-bottom: 3px solid var(--accent);
  color: #fff;
}

.topbar-inner {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
}

.environment {
  color: #bfc3c9;
  font-size: 13px;
}

.page-heading {
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-top: 30px;
  padding-bottom: 30px;
}

.page-heading p {
  margin-bottom: 0;
}

.kicker,
.profile-code {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.kicker {
  margin-bottom: 7px;
}

.page-summary,
.subscription-heading > p:last-child {
  color: var(--muted);
}

.service-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 650;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #24a56a;
  box-shadow: 0 0 0 4px rgba(36, 165, 106, 0.14);
}

.access-band {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.access-inner {
  display: grid;
  grid-template-columns: minmax(360px, 620px) minmax(260px, 1fr);
  gap: 42px;
  align-items: center;
  padding-top: 22px;
  padding-bottom: 22px;
}

.field p,
.access-field p {
  margin: 6px 0 0;
  color: var(--quiet);
  font-size: 12px;
}

.input-with-action,
.input-with-actions {
  display: grid;
  gap: 8px;
}

.input-with-action {
  grid-template-columns: minmax(0, 1fr) auto;
}

.input-with-actions {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.message {
  min-height: 42px;
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
  background: var(--surface-muted);
}

.message.is-success {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-bg);
}

.message.is-error {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.profiles-section {
  padding-top: 36px;
  padding-bottom: 46px;
}

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

.section-heading time {
  color: var(--quiet);
  font-size: 12px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.profile-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.profile-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  min-height: 51px;
}

.profile-code {
  display: block;
  margin-bottom: 4px;
}

.profile-state {
  flex: none;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.profile-state.is-idle {
  background: #eff1f3;
  color: var(--muted);
}

.profile-state.is-ready {
  background: var(--green-bg);
  color: var(--green);
}

.profile-state.is-empty,
.profile-state.is-error {
  background: var(--amber-bg);
  color: var(--amber);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 20px -20px 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.metrics div {
  min-width: 0;
  padding: 14px 12px;
  text-align: center;
}

.metrics div + div {
  border-left: 1px solid var(--border);
}

.metrics dt {
  color: var(--quiet);
  font-size: 11px;
}

.metrics dd {
  margin: 4px 0 0;
  font-size: 21px;
  font-weight: 720;
}

.metadata {
  margin-bottom: 14px;
}

.metadata div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  font-size: 12px;
}

.metadata dt {
  color: var(--quiet);
}

.metadata dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #464a51;
  text-align: right;
}

.endpoint-list {
  display: flex;
  min-height: 26px;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 18px;
}

.endpoint-list span {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-muted);
  color: #4f545c;
  padding: 3px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.profile-actions button {
  min-width: 0;
  padding-right: 8px;
  padding-left: 8px;
  white-space: nowrap;
}

.subscription-band {
  background: #eceef1;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.subscription-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 54px;
  padding-top: 38px;
  padding-bottom: 42px;
}

.subscription-heading > p:last-child {
  margin-top: 10px;
  font-size: 13px;
}

.subscription-tool {
  min-width: 0;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--muted);
  padding: 7px 18px;
  font-size: 13px;
}

.segmented button + button {
  border-left: 1px solid var(--border);
}

.segmented button:hover,
.segmented button.is-selected {
  background: #272a30;
  color: #fff;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}

.url-output {
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 23, 0.72);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.modal-body {
  margin-top: 18px;
  text-align: center;
}

.qr-box {
  display: inline-flex;
  min-width: 220px;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px;
}

.qr-text {
  margin: 14px 0 0;
  color: var(--quiet);
  font-size: 11px;
  overflow-wrap: anywhere;
}

footer {
  background: var(--surface);
}

.footer-inner {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--quiet);
  font-size: 12px;
}

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

  .profile-card {
    display: grid;
    grid-template-columns: minmax(190px, 0.7fr) minmax(300px, 1.3fr);
    column-gap: 22px;
  }

  .metrics,
  .profile-actions {
    grid-column: 1;
  }

  .metadata,
  .endpoint-list {
    grid-column: 2;
  }

  .metadata {
    grid-row: 1 / span 2;
    align-self: end;
  }

  .endpoint-list {
    grid-row: 3;
  }

  .metrics {
    margin-right: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .page-heading,
  .section-heading,
  .footer-inner {
    align-items: flex-start;
  }

  .page-heading,
  .access-inner,
  .subscription-layout {
    grid-template-columns: 1fr;
  }

  .page-heading {
    min-height: 0;
    flex-direction: column;
    padding-top: 26px;
    padding-bottom: 26px;
  }

  .access-inner {
    gap: 14px;
  }

  .subscription-layout {
    gap: 20px;
  }

  .profile-card {
    display: flex;
  }

  .metrics,
  .metadata,
  .endpoint-list,
  .profile-actions {
    grid-column: auto;
    grid-row: auto;
  }

  .metrics {
    margin-right: -20px;
  }

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

@media (max-width: 520px) {
  h1 {
    font-size: 27px;
  }

  .environment {
    display: none;
  }

  .input-with-action,
  .input-with-actions {
    grid-template-columns: 1fr;
  }

  .input-with-actions button,
  .profile-actions button {
    width: 100%;
  }

  .section-heading,
  .footer-inner {
    flex-direction: column;
    gap: 7px;
  }

  .segmented {
    display: grid;
    width: 100%;
  }

  .segmented button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }
}
