/*
 * The console's components, written from the gateway's style guide
 * (vaubaan/gateway docs/spec/style-guide.md §4, §5) with the copied tokens
 * only — no raw colour, no raw size. Layout: Supabase's project management
 * with gateways in place of projects (ADR console-supabase-layout-gateway-design-system).
 */

@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/geist-sans/Geist-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/geist-sans/Geist-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/static/fonts/geist-mono/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
:root {
  --font-geist-sans: 'Geist';
  --font-geist-mono: 'Geist Mono';
}

/* ───── The shell: a side navigation, a page column ───── */
.shell {
  display: flex;
  min-height: 100vh;
}
.side {
  width: var(--side-width);
  flex: none;
  background: var(--paper-side);
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-half);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  font-weight: var(--weight-strong);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  letter-spacing: var(--tracking-title);
}
.brand:hover {
  text-decoration: none;
}
.brand-sub {
  color: var(--ink-3);
  font-weight: var(--weight-regular);
}
.side-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3);
  height: var(--control-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--ink-2);
  transition:
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}
.side-entry:hover {
  background: var(--hover);
  text-decoration: none;
  color: var(--ink);
}
.side-entry.is-current {
  background: var(--fill);
  color: var(--ink);
  font-weight: var(--weight-strong);
}
.side-count {
  background: var(--warn);
  color: var(--on-warn);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  padding: 0 var(--space-2);
}
.side-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.person {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  flex-wrap: wrap;
}
.person-name {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}
.side-link {
  color: var(--ink-3);
  font-size: var(--text-xs);
}
.avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--hue-1);
  color: var(--on-hue);
  font-size: 10px;
  font-weight: var(--weight-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme {
  background: none;
  border: 0;
  color: var(--ink-3);
  font-size: var(--text-xs);
  text-align: left;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}
.theme:hover {
  background: var(--hover);
}

.main {
  flex: 1;
  min-width: 0;
  padding: var(--page-pad-top) var(--page-pad-x) var(--page-pad-bottom);
  max-width: calc(var(--page-max) + 2 * var(--page-pad-x));
}
.measure-narrow {
  max-width: calc(var(--page-max-narrow) + 2 * var(--page-pad-x));
}
.measure-wide {
  max-width: calc(var(--page-max-wide) + 2 * var(--page-pad-x));
}
.page-foot {
  margin-top: var(--section-gap);
  color: var(--ink-4);
  font-size: var(--text-xs);
}

/* ───── Page header ───── */
.page-header {
  margin-bottom: var(--section-gap);
}
.where {
  font-size: var(--text-xs);
  color: var(--ink-3);
  margin-bottom: var(--space-2);
}
.where-sep {
  margin: 0 var(--space-2);
  color: var(--ink-4);
}
.page-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.page-actions {
  display: flex;
  gap: var(--space-2);
}
.lede {
  color: var(--ink-3);
  font-size: var(--text-sm);
  max-width: var(--measure);
}
.section {
  margin-top: var(--section-gap);
}

/* ───── Buttons: primary, secondary, ghost, danger (red words, never a red fill) ───── */
.btn {
  display: inline-flex;
  align-items: center;
  height: var(--control-md);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
  white-space: nowrap;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}
.btn:hover {
  text-decoration: none;
  background: var(--hover);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent-ink);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  font-weight: var(--weight-regular);
}
.btn-danger {
  color: var(--bad);
  border-color: var(--line);
}
.btn-danger:hover {
  background: var(--bad-soft);
  border-color: var(--bad-line);
}
.btn-sm {
  height: var(--control-sm);
  font-size: var(--text-xs);
}
.inline {
  display: inline;
}
.actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* ───── Forms ───── */
.form,
.form-inline {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-start;
  max-width: var(--measure);
}
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}
.field-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
}
.field-hint {
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.input {
  height: var(--control-lg);
  padding: 0 var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  font-size: var(--text-sm);
  width: 100%;
  max-width: 420px;
}
.input-sm {
  height: var(--control-sm);
  width: auto;
  font-size: var(--text-xs);
  padding: 0 var(--space-2);
}
.input::placeholder {
  color: var(--ink-4);
}
.choice {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.choice-entry {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
}
.choice-entry.is-disabled {
  color: var(--ink-4);
}
.danger-zone {
  padding: var(--space-4);
  border: 1px solid var(--bad-line);
  border-radius: var(--radius-lg);
}
.signin {
  max-width: 420px;
  margin: var(--space-12) auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ───── Rows, tables, facts ───── */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-4);
  padding: var(--row-y) 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.row-title {
  font-weight: var(--weight-strong);
}
.row-facts {
  grid-column: 1;
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.row form {
  grid-row: 1 / span 2;
  grid-column: 2;
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  color: var(--ink-3);
  padding: var(--cell-y) var(--cell-x);
  border-bottom: 1px solid var(--line-strong);
}
.table td {
  padding: var(--cell-y) var(--cell-x);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table-end {
  text-align: right;
}
.table .is-exception td {
  background: var(--warn-soft);
}
.ident {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin: 0;
}
.facts div {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.facts dt {
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.facts dd {
  margin: 0;
  font-size: var(--text-sm);
}

/* ───── Status mark: a dot beside a word ───── */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.status .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--ink-4);
}
.status-ok .dot {
  background: var(--ok);
}
.status-bad .dot {
  background: var(--bad);
}
.status-wait .dot {
  background: var(--warn);
}

/* ───── The one filled box, callouts, code, empty ───── */
.box {
  background: var(--paper-side);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.callout {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
  border: 1px solid var(--line);
  background: var(--fill);
}
.callout-done {
  background: var(--ok-soft);
  border-color: var(--ok-line);
}
.callout-needs-you {
  background: var(--warn-soft);
  border-color: var(--warn-line);
}
.callout-stopped {
  background: var(--bad-soft);
  border-color: var(--bad-line);
}
.callout-next {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.code {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
}
.code code {
  flex: 1;
  overflow-wrap: anywhere;
  font-size: var(--text-xs);
}
.code .btn {
  color: var(--code-ink);
  background: var(--code-btn);
  border-color: var(--code-btn-line);
}
.empty {
  padding: var(--space-8) 0;
  color: var(--ink-2);
  max-width: var(--measure);
}

/* ───── Provisioning steps ───── */
.steps {
  list-style: none;
  margin: var(--space-4) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-4);
}
.step::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line-strong);
  flex: none;
}
.step.is-done {
  color: var(--ink-3);
}
.step.is-done::before {
  background: var(--ok);
  border-color: var(--ok);
}
.step.is-current {
  color: var(--ink);
  font-weight: var(--weight-strong);
}
.step.is-current::before {
  background: var(--accent);
  border-color: var(--accent);
}
.step.is-failed::before {
  background: var(--bad);
  border-color: var(--bad);
}

/* ───── Narrow windows: the navigation becomes a bar at the top ───── */
@media (max-width: 760px) {
  .shell {
    flex-direction: column;
  }
  .side {
    width: auto;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
  }
  .brand {
    margin: 0 var(--space-2) 0 0;
  }
  .side-foot {
    margin-left: auto;
    border: 0;
    padding: 0;
    flex-direction: row;
    align-items: center;
  }
  .main {
    padding: var(--space-5) var(--space-4) var(--space-10);
  }
}
