:root {
  color-scheme: light;
  --paper: #f5f7f4;
  --surface: #fff;
  --ink: #142721;
  --muted: #4f635b;
  --line: #d4dfd8;
  --accent: #155843;
  --focus: #167553;
  --radius: 14px;
  font: 16px/1.55 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; }
.frame { width: min(100% - 2rem, 66rem); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .brand, .card-heading, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.topbar-inner { min-height: 4.5rem; padding-block: .5rem; }
.brand { justify-content: flex-start; font-weight: 700; line-height: 1.25; }
.brand-detail { font-size: .875rem; font-weight: 500; color: var(--muted); }
.main { flex: 1; padding-block: clamp(2rem, 8vw, 6rem) 3rem; }
.footer {
  border-top: 1px solid var(--line);
  padding-block: 1rem;
  color: var(--muted);
  font-size: .8rem;
  flex-wrap: wrap;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 5vw, 2rem);
}
.access { max-width: 28rem; margin-inline: auto; box-shadow: 0 10px 32px #1427210a; }
.eyebrow {
  color: var(--accent);
  font: 700 .75rem/1.5 ui-monospace, monospace;
  letter-spacing: .075em;
  text-transform: uppercase;
  margin-bottom: .75rem;
}
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.65rem, 5vw, 2.2rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.1rem; }
.intro, #bootstrap-message { color: var(--muted); margin-top: .65rem; }
form, #retry { margin-top: 1.5rem; }
label { display: block; margin-bottom: .4rem; font-size: .875rem; font-weight: 650; }
input, .button {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
input { width: 100%; padding: .5rem .7rem; border-color: #8d9e95; }
select { width: 100%; min-height: 2.75rem; padding: .45rem .7rem; border: 1px solid #8d9e95; border-radius: 8px; background: white; color: var(--ink); font: inherit; }
input[aria-invalid="true"] { border-color: #a52b26; }
.button { padding: .45rem .9rem; font-size: .875rem; font-weight: 650; cursor: pointer; }
.button.primary { width: 100%; background: var(--accent); color: white; border-color: var(--accent); margin-top: 1rem; }
.button.primary:hover { background: #104333; }
.button.secondary { background: var(--surface); color: var(--ink); }
.button.secondary:hover { background: var(--paper); }
.button:disabled { opacity: .7; cursor: wait; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.feedback:not(:empty) { padding: .55rem .75rem; margin-top: .75rem; border-radius: 8px; font-size: .875rem; }
.error:not(:empty) { background: #fff0ee; color: #882821; }
.feedback.info:not(:empty) { background: #eaf4ed; color: #214938; }
.session-card { max-width: 36rem; margin-top: 1.5rem; }
.projects-card, .status-card { margin-top: 1.5rem; }
.status-card h3 { font-size: 1rem; margin: .75rem 0 .25rem; }
.status-card ul { margin: .25rem 0 .75rem; overflow-wrap: anywhere; }
.databases-card { margin-top: 1.5rem; }
.card-heading { flex-wrap: wrap; }
.badge { border-radius: 1rem; background: #e5f4e9; color: #15503b; padding: .15rem .65rem; font-size: .8rem; }
.details { margin-top: .9rem; }
.details div {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  justify-content: space-between;
  padding-block: .65rem;
  border-top: 1px solid var(--line);
}
dt { color: var(--muted); }
dd { font-weight: 600; }
.projects-card > form { margin-top: 1.5rem; }
.create-row { display: flex; align-items: stretch; gap: .65rem; }
.create-row .button.primary { width: auto; min-width: 10rem; margin-top: 0; }
.field-help { color: var(--muted); font-size: .8rem; margin-top: .4rem; }
.project-list { margin-top: 1rem; }
.empty-projects { color: var(--muted); padding-block: .8rem; }
.project-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.project-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .8rem; border-bottom: 1px solid var(--line); }
.project-slug { font-weight: 650; overflow-wrap: anywhere; }
.project-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.database-list { margin-top: 1rem; }
.database-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.database-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .8rem; border-bottom: 1px solid var(--line); }
.database-name { display: block; overflow-wrap: anywhere; }
.database-list-state { display: block; color: var(--muted); font-size: .82rem; }
.database-detail { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.branch-list { margin-top: 1rem; }
.branch-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.branch-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .8rem; border-bottom: 1px solid var(--line); }
.branch-name { display: block; overflow-wrap: anywhere; }
.branch-list-state { display: block; color: var(--muted); font-size: .82rem; }
.branch-create-grid { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(10rem, .8fr) auto; gap: .65rem; }
.branch-create-grid .button.primary { width: auto; min-width: 10rem; margin-top: 0; }
.branch-detail { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.branch-meta { margin-top: .45rem; color: var(--muted); overflow-wrap: anywhere; }
.branch-credentials { margin-top: .75rem; }
.branch-credentials .endpoint-detail { justify-items: stretch; }
.branch-credentials label { margin: .2rem 0 -.35rem; }
.branch-credentials input { max-width: 24rem; font-family: ui-monospace, monospace; }
.branch-credentials .button { justify-self: start; }
.database-meta { margin-top: .5rem; color: var(--muted); }
.public-endpoint-panel, .compute-panel, .credentials-panel { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1.1rem; }
.branches-panel { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1.1rem; }
.public-endpoint-panel h3, .compute-panel h3, .credentials-panel h3 { font-size: 1rem; }
.branches-panel h3 { font-size: 1rem; }
.public-endpoint-panel p { margin-top: .4rem; color: var(--muted); }
.private-endpoint-disclosure { width: 100%; border-top: 1px solid var(--line); padding-top: .75rem; }
.private-endpoint-disclosure > summary { cursor: pointer; color: var(--muted); font-size: .85rem; font-weight: 650; }
.private-endpoint-disclosure[open] .endpoint-detail { margin-top: .75rem; }
.public-connection-detail { width: 100%; }
.public-connection-detail p { max-width: 70ch; }
.compute-panel .project-actions { justify-content: flex-start; margin-top: .8rem; }
.credentials-panel .card-heading { align-items: flex-start; }
.credential-fields { margin-top: .9rem; }
.credential-fields > div { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(0, 2fr); gap: .5rem; padding-block: .65rem; border-top: 1px solid var(--line); }
.credential-value { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.credential-value input { width: min(100%, 22rem); font-family: ui-monospace, monospace; }
.endpoint-detail { display: grid; justify-items: start; gap: .55rem; margin-top: 1rem; padding: 1rem; border-radius: 10px; background: var(--paper); }
.endpoint-detail h4 { margin: 0; font-size: .92rem; }
.endpoint-uri { max-width: 100%; overflow-wrap: anywhere; font: .85rem/1.5 ui-monospace, monospace; }
.public-endpoint-note { font-weight: 650; }
.recovery-button { margin-top: .5rem; }
.confirm-copy { font-size: .875rem; font-weight: 600; }
.button.danger { color: white; background: #882821; border-color: #882821; }
.button.danger-outline { color: #882821; background: var(--surface); border-color: #c98b86; }
.button.danger:hover { background: #6e1f1b; }
.button.danger-outline:hover { background: #fff0ee; }
@media (max-width: 36rem) {
  .create-row { align-items: stretch; flex-direction: column; }
  .create-row .button.primary { width: 100%; }
  .project-item { align-items: stretch; }
  .project-actions { justify-content: flex-start; }
  .confirm-copy { flex-basis: 100%; }
  .database-item { align-items: stretch; }
  .database-item .project-actions { justify-content: flex-start; }
  .branch-item { align-items: stretch; }
  .branch-item .project-actions { justify-content: flex-start; }
  .branch-create-grid { grid-template-columns: 1fr; }
  .branch-create-grid .button.primary { width: 100%; }
  .credential-fields > div { grid-template-columns: 1fr; }
  .credentials-panel .card-heading { align-items: stretch; }
}
