/* Color tokens */

:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #fff;
  --surface-2: #eef2f3;
  --text: #172126;
  --muted: #647178;
  --line: #d8e0e3;
  --accent: #176b5b;
  --accent-soft: #dff3ed;
  --danger: #b42318;
  --warning: #98600a;
  --ok: #17803d;
  --series-1: #176b5b;
  --series-2: #a15c00;
  --series-3: #9f2d20;
  --series-4: #4969ad;
  --series-5: #7c4dab;
  --shadow: 0 1px 3px #102a3320;
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}



/* Chrome and controls */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
}
a:hover { text-decoration: underline; }

button,
input,
select {
  max-width: 100%;
  font: inherit;
  color: inherit;
}

button,
.button {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
}

button.small {
  padding: 0.25rem 0.45rem;
  font-size: 0.75rem;
}

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

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

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

main:focus,
main:focus-visible {
  outline: none;
}

.skip {
  position: fixed;
  top: 0;
  left: 1rem;
  z-index: 100;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  padding: 0.6rem;
  background: var(--surface);
}

.skip:focus {
  top: 1rem;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  height: 58px;
  padding: 0 max(1rem, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  flex: 0 0 auto;
  gap: 0.55rem;
  align-items: center;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  place-items: center;
}

.topbar nav {
  display: flex;
  flex: 1 1 auto;
  gap: 0.25rem;
  min-width: 0;
}

.topbar nav a {
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.topbar nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

#identity {
  display: flex;
  flex: 0 0 auto;
  gap: 0.6rem;
  align-items: center;
  color: var(--muted);
}

main {
  max-width: 1240px;
  margin: auto;
  padding: 1.5rem;
}

/* Shared layout */

.page-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-head h1 {
  margin: 0;
  font-size: 1.65rem;
}

.eyebrow,
.muted {
  color: var(--muted);
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.span-12 {
  grid-column: span 12;
}

.span-8 {
  grid-column: span 8;
}

.span-6 {
  grid-column: span 6;
}

.span-4 {
  grid-column: span 4;
}

.card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.9rem;
  font-size: 1rem;
}

.card h3 {
  margin: 0;
  font-size: 0.88rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.item {
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.item:first-child {
  padding-top: 0;
  border-top: 0;
}

.title {
  font-weight: 650;
}

.mono,
code,
pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.break {
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.82rem;
}

.status::before {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.status.running::before,
.status.live::before,
.status.ready::before,
.status.active::before,
.status.ok::before {
  background: var(--ok);
}

.status.failed::before,
.status.suspended::before,
.status.error::before,
.status.blocked::before,
.status.out_of_disk::before {
  background: var(--danger);
}

.status.pending::before,
.status.building::before,
.status.deploying::before,
.status.provisioning::before,
.status.starting::before,
.status.failing_over::before,
.status.deleting::before {
  background: var(--warning);
}

.pill {
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.78rem;
}

.empty,
.error,
.loading {
  padding: 1rem;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.error {
  border-left: 3px solid var(--danger);
  color: var(--danger);
}

form.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

input,
select {
  min-height: 36px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
}

/* Home and organization */

.token-list {
  margin-top: 1.25rem;
}

.token-list h3 {
  margin-bottom: 0.65rem;
}

.usage-row {
  display: grid;
  grid-template-columns: 150px minmax(90px, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

progress {
  width: 100%;
  accent-color: var(--accent);
}

progress.warning {
  accent-color: var(--warning);
}

progress.danger {
  accent-color: var(--danger);
}

.usage-value {
  white-space: nowrap;
}

.info {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.success {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--line));
  border-radius: 8px;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}

.billing-grid { margin: 1rem 0; }
.billing-grid .card { position: relative; }
.plan-price { margin-bottom: 0.7rem; font-size: 1.3rem; font-weight: 700; }
.current-plan { display: inline-flex; margin-top: 0.8rem; }
.plan-actions { margin-top: 0.8rem; }

.event-row time,
.nowrap { white-space: nowrap; }

.event-row .title { min-width: 0; }

.instance-list { display: grid; gap: 0.55rem; }
.instance-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 0.7rem; align-items: center; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.instance-row code { overflow-wrap: anywhere; }
.instance-row button { grid-column: 2; grid-row: 1; }
.instance-row .instance-state, .instance-row .muted { grid-column: 1 / -1; }
.instance-state { display: inline-flex; align-items: center; gap: 0.4rem; }
.instance-state i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--warning); flex: 0 0 auto; }
.instance-state.running i { background: var(--ok); }
.instance-state.crashing i, .instance-state.out_of_memory i, .instance-state.failed i { background: var(--danger); }
.instance-crash { grid-column: 2 / -1; }
.condition { display: grid; grid-template-columns: 1rem minmax(7rem, auto) 1fr; gap: 0.45rem; align-items: baseline; }
.condition.ok > :first-child { color: var(--ok); }
.condition.bad > :first-child, .error-text { color: var(--danger); }
.other-space.current { border-left: 3px solid var(--accent); padding-left: 0.65rem; }
.compact { gap: 0.25rem; }

/* Application */

.image-ref {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  min-width: 0;
}

.image-ref code {
  overflow-wrap: anywhere;
}

.deployment-image {
  margin: 0.45rem 0;
  color: var(--muted);
}

.logs {
  min-height: 3.25rem;
  max-height: 340px;
  margin: 0;
  overflow: auto;
  padding: 0.75rem;
  border-radius: 7px;
  background: #0d1416;
  color: #d7e3e5;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: normal;
}

.logs.placeholder {
  color: #93a4a8;
}

.log-toolbar { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.log-toolbar input[type="search"] { min-width: 11rem; flex: 1; }
.chip { border-radius: 999px; padding: 0.3rem 0.75rem; font-size: 0.82rem; }
.chip[aria-pressed="true"] { background: var(--accent-soft, var(--surface-2)); border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="false"] { opacity: 0.6; text-decoration: line-through; }
.log-checks { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; }
.log-checks label { white-space: nowrap; }
.log-line { display: grid; grid-template-columns: 5.5rem minmax(6.5rem, auto) 1fr; gap: 0.65rem; padding: 0.08rem 0.35rem; border-left: 3px solid transparent; }
.log-line.stderr { border-left-color: #ff6b6b; }
.log-line time { color: #9cafb4; font-variant-numeric: tabular-nums; }
.log-tag { font-weight: 700; white-space: nowrap; }
.source-app .log-tag { color: #70b7ff; }
.source-db .log-tag { color: #75dfb2; }
.source-build .log-tag { color: #e6c76b; }
.source-platform .log-tag { color: #cf9fff; }
.log-message { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.log-message mark { color: #111; background: #ffe174; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.chart {
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart-head {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  justify-content: space-between;
}

.chart-head h3 {
  color: var(--muted);
  font-size: 0.8rem;
}

.chart-head strong {
  font-size: 0.8rem;
  text-align: right;
}

.chart-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem;
}

.chart svg {
  display: block;
  width: 100%;
  height: 110px;
}

.chart polyline {
  fill: none;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.series-0 {
  stroke: var(--series-1);
  background: var(--series-1);
}

.series-1 {
  stroke: var(--series-2);
  background: var(--series-2);
}

.series-2 {
  stroke: var(--series-3);
  background: var(--series-3);
}

.series-3 {
  stroke: var(--series-4);
  background: var(--series-4);
}

.series-4 {
  stroke: var(--series-5);
  background: var(--series-5);
}

.axis-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.25rem 0;
  color: var(--muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.legend span {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.legend i {
  display: inline-block;
  width: 0.65rem;
  height: 0.2rem;
}

.breadcrumbs {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumbs a {
  text-decoration: none;
}

/* Operator console and feedback */

.unlocked {
  color: var(--ok);
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  border-radius: 7px;
  background: var(--text);
  box-shadow: var(--shadow);
  color: var(--bg);
}

.hero {
  max-width: 520px;
  margin: 12vh auto;
  padding: 2.5rem;
  text-align: center;
}

.hero h1 {
  margin: 0.4rem;
  font-size: 2.3rem;
}

.secret {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent-soft);
  user-select: all;
}

/* Responsive layout */

@media (max-width: 760px) {
  .topbar {
    gap: 0.4rem;
    height: 56px;
    padding: 0.55rem 0.75rem;
  }

  .brand {
    font-size: 0.95rem;
  }

  .brand-mark {
    width: 25px;
    height: 25px;
  }

  .topbar nav {
    justify-content: flex-start;
  }

  .topbar nav a {
    padding: 0.4rem 0.5rem;
  }

  #identity .login {
    display: none;
  }

  #identity button {
    padding: 0.45rem 0.55rem;
    white-space: nowrap;
  }

  main {
    padding: 1rem;
  }

  .span-8,
  .span-6,
  .span-4 {
    grid-column: span 12;
  }

  .page-head {
    flex-direction: column;
  }

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

  .usage-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .usage-row progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .usage-value {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .event-row { align-items: flex-start; }
  .event-row time { font-size: 0.76rem; text-align: right; flex: 0 0 auto; }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    position: absolute;
    clip: rect(0 0 0 0);
  }

  tr {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--line);
  }

  td {
    padding: 0.25rem 0;
    overflow-wrap: anywhere;
    border: 0;
  }

  td::before {
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    content: attr(data-label) ": ";
  }
}

@media (max-width: 410px) {
  .topbar {
    padding-inline: 0.5rem;
  }

  .brand {
    gap: 0.35rem;
  }

  .topbar nav {
    gap: 0;
  }

  .topbar nav a {
    padding-inline: 0.4rem;
  }
}

.instance-summary { margin-bottom: 0.5rem; }
table.instances td { vertical-align: middle; }
table.instances td.num { text-align: right; }

/* The metrics card fills its row; charts stretch to use the height. */
.card:has(> .metrics-panel) { display: flex; flex-direction: column; height: 100%; }
.metrics-panel { flex: 1; display: flex; flex-direction: column; }
.metrics-panel .chart-grid { flex: 1; grid-auto-rows: 1fr; }
.metrics-panel .chart { display: flex; flex-direction: column; }
.metrics-panel .chart-body { flex: 1; }
.metrics-panel .chart svg { height: 100%; min-height: 110px; }

/* Apps Manager layout */
:root { --border: #d5dde5; --background: #f4f6f8; --success: #198754; --accent: #1769c2; --accent-soft: #eaf2fc; --bg: #f4f6f8; --text: #172b3a; --muted: #66788a; --line: #d5dde5; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.workspace { min-width: 0; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1.25rem .8rem; border-right: 1px solid var(--border); background: var(--surface); z-index: 20; }
.sidebar .brand { display: flex; margin-bottom: 1.6rem; font-size: 1.15rem; font-weight: 750; }
.side-label { margin: 1.2rem .6rem .45rem; color: #8091a2; font-size: .68rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.side-label.first { margin-top: .5rem; }
.org-switcher { width: 100%; }
.side-links { display: grid; gap: .15rem; }
.side-link { display: flex; align-items: center; gap: .55rem; min-height: 2.35rem; padding: .45rem .6rem; border-radius: .45rem; color: var(--text); text-decoration: none; }
.side-link:hover { background: var(--background); }
.side-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.side-link.nested { min-height: 1.9rem; margin-left: 1.4rem; padding-left: .8rem; border-left: 1px solid var(--border); border-radius: 0; font-size: .84rem; }
.side-link .count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.state-dot { width: .55rem; height: .55rem; flex: none; display: inline-block; border-radius: 50%; background: var(--muted); }
.state-dot.running, .state-dot.ready, .state-dot.live { background: var(--success); }
.state-dot.starting, .state-dot.provisioning, .state-dot.deploying, .state-dot.pending { background: var(--warning); }
.state-dot.crashed, .state-dot.failed, .state-dot.error { background: var(--danger); }
.topbar { position: sticky; top: 0; z-index: 15; min-height: 60px; display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem; border: 0; background: #132d43; color: #fff; }
.top-brand { display: inline-flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-size: 1.05rem; font-weight: 750; white-space: nowrap; }
.top-brand > span:last-child { padding-left: .7rem; border-left: 1px solid #ffffff38; color: #c6d2dd; font-size: .85rem; font-weight: 450; }
.brand-glyph { font-size: 1.35rem; }
.topbar .breadcrumbs { min-width: 0; flex: 1; display: flex; gap: .55rem; align-items: center; overflow: hidden; white-space: nowrap; }
.topbar .breadcrumbs a, .topbar .breadcrumbs span { overflow: hidden; color: #d9e5ef; text-overflow: ellipsis; }
.topbar #identity, .topbar #identity a { color: #e8f0f6; }
.topbar button { border-color: #ffffff35; background: transparent; color: #fff; }
.menu-button { display: none; }
#identity { display: flex; gap: .65rem; align-items: center; }
#content { width: min(100%, 1248px); margin: 0 auto; padding: 2.25rem 1.5rem 4rem; }
.entity-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1.25rem; }
.entity-title { display: flex; align-items: center; gap: .7rem; }
.entity-title h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.02em; }
.entity-meta { margin-top: .45rem; color: var(--muted); }
.tabs { display: flex; gap: .15rem; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 1.75rem; }
.tab { padding: .75rem .9rem; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-color: var(--accent); font-weight: 650; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 1.4rem; }
.summary-tile { min-height: 112px; padding: 1.15rem 1.25rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.summary-tile > strong { display: block; margin-top: .6rem; font-size: 1.75rem; line-height: 1.1; letter-spacing: -.025em; }
.tile-detail { margin-top: .65rem; color: var(--muted); font-size: .78rem; }
.quota-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: .8rem; margin: 1rem 0 1.75rem; }
.quota { min-width: 0; }
.quota .row { font-size: .8rem; }
.quota progress { width: 100%; }
.space-grid, .org-grid, .market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.space-card, .org-card, .market-tile { display: block; padding: 1.15rem; border: 1px solid var(--border); border-radius: .65rem; background: var(--surface); color: var(--text); text-decoration: none; }
.space-card:hover, .org-card:hover, .market-tile:hover { border-color: var(--accent); }
.state-counts { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1rem 0; font-size: .86rem; }
.state-counts span { display: inline-flex; align-items: center; gap: .35rem; }
.section-stack { display: grid; gap: 1.25rem; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1.25rem; }
.panel { padding: 1.15rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.panel > h2:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: -.2rem 0 1rem; }
.panel-head h2 { margin: 0; font-size: 1rem; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-head { min-height: 58px; margin: 0; padding: .8rem 1.2rem; border-bottom: 1px solid var(--border); }
.table-panel .table-wrap { border: 0; border-radius: 0; }
.table-panel table { margin: 0; }
.strong-link { font-weight: 650; text-decoration: none; }
.cli-hint { display: flex; align-items: center; gap: .9rem; margin-top: 1.5rem; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.cli-hint code { flex: 1; }
.copy-command { padding: .25rem .5rem; font-size: .75rem; }
.metrics-page .chart { min-height: 240px; background: var(--surface); }
.metrics-page .chart svg { min-height: 160px; }
.logs { background: #132d43; color: #dbe9f4; }
table th { padding: .75rem 1rem; background: #f8fafc; color: #5f7183; font-size: .7rem; letter-spacing: .025em; text-transform: uppercase; }
table td { padding: .85rem 1rem; }

.full-logs .logs { min-height: 58vh; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { min-width: 680px; }
.sort-button { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: inherit; }
.copy-row { display: flex; gap: .5rem; align-items: flex-start; }
.code-snippet { flex: 1; white-space: pre-wrap; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(82vw, 280px); transform: translateX(-105%); transition: transform .18s ease; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  body.menu-open .sidebar { transform: translateX(0); }
  .menu-button { display: inline-flex; }
  #content { padding: 1.4rem 1rem 3rem; }
  .quota-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .entity-head { flex-direction: column; }
  .top-brand > span:last-child { display: none; }
}

@media (max-width: 420px) {
  .topbar { padding-inline: .75rem; }
  #identity .login { display: none; }
  .quota-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .cli-hint { align-items: flex-start; flex-wrap: wrap; }
}

/* Target frame and compact responsive overrides. */
.topbar { position: sticky; top: 0; z-index: 30; width: 100%; min-height: 60px; padding: 0 1.5rem; background: #132d43; color: #fff; }
.topbar-spacer { flex: 1; }
.shell { min-height: calc(100vh - 60px); grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: relative; top: 0; align-self: stretch; min-height: calc(100vh - 60px); height: auto; }
.brand-mark { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.top-brand > span:last-child { display: inline; padding-left: 0; border-left: 0; color: inherit; font-size: inherit; font-weight: inherit; }
.side-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.breadcrumbs { width: min(calc(100% - 3rem), 1200px); min-width: 0; display: flex; gap: .65rem; align-items: center; margin: 0 auto; padding: 2rem 0 0; color: var(--muted); overflow: hidden; white-space: nowrap; }
.breadcrumbs a { color: var(--accent); }
.home-crumb { color: var(--muted) !important; font-size: 1.1rem; }
#content { min-width: 0; padding-top: 1.5rem; overflow: hidden; }
.topbar #identity, .topbar #identity a { color: #e8f0f6; }
.account-menu { position: relative; }
.account-menu summary { display: flex; gap: .55rem; align-items: center; cursor: pointer; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.avatar { display: grid; width: 30px; height: 30px; border-radius: 50%; background: #4c6c87; place-items: center; font-size: .72rem; font-weight: 700; }
.account-popover { position: absolute; top: calc(100% + .75rem); right: 0; width: 150px; padding: .4rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.account-popover a, .account-popover button { display: flex; width: 100%; padding: .55rem .65rem; border: 0; color: var(--text) !important; background: transparent; }
.help-button { width: 28px; height: 28px; justify-content: center; padding: 0; border-radius: 50%; }
.state-dot.healthy, .state-dot.succeeded, .state-dot.mapped, .state-dot.bound { background: var(--success); }
.state-dot.degraded { background: var(--warning); }
.status-pill { display: inline-flex; gap: .4rem; align-items: center; padding: .18rem .45rem; border-radius: 4px; background: #e9f6ee; color: var(--success); font-size: .75rem; }
.status-pill.crashed, .status-pill.failed, .status-pill.error { background: #fdecea; color: var(--danger); }
.status-pill.pending, .status-pill.starting, .status-pill.provisioning { background: #fff3d6; color: var(--warning); }
.status-pill.stopped { background: var(--surface-2); color: var(--muted); }
.org-summary { display: grid; grid-template-columns: minmax(300px, 1.4fr) 2fr; gap: 2rem; align-items: center; margin: 1rem 0 1.4rem; }
.memory-summary progress { width: 100%; margin: .65rem 0 .35rem; }
.org-counts { display: grid; grid-template-columns: repeat(4, 1fr); border-left: 1px solid var(--border); }
.org-counts .summary-tile { min-height: 0; border: 0; background: transparent; }
.badge { display: inline-flex; padding: .18rem .45rem; border: 1px solid var(--border); border-radius: 4px; background: #f7f9fb; color: var(--muted); font-size: .75rem; }
.instance-summary { display: flex; gap: .65rem; align-items: center; margin-bottom: .8rem; color: var(--muted); }
.panel-footer { margin: 1rem -1.15rem -1.15rem; padding: .8rem 1.15rem; border-top: 1px solid var(--border); }
.route-row, .service-row { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--border); }
.app-secondary { grid-template-columns: 1fr 1fr; }
.app-primary { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.runtime-panel { min-width: 0; overflow: hidden; }
.runtime-panel .table-wrap { width: 100%; overflow-x: auto; }
.runtime-panel table.instances { min-width: 620px; }
.runtime-panel table.instances th, .runtime-panel table.instances td { white-space: nowrap; }
.runtime-panel table.instances th, .runtime-panel table.instances td { padding-inline: .65rem; }
.runtime-panel table.instances th:last-child, .runtime-panel table.instances td:last-child { width: 8.5rem; white-space: normal; }
.deployment-card { min-width: 0; }
.deployment-details { display: grid; gap: .5rem; min-width: 0; }
.deployment-detail { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .65rem; align-items: center; min-width: 0; }
.deployment-detail .detail-value { min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.deployment-detail .copy-command { flex: none; }

.scale-dialog { width: min(420px, calc(100vw - 2rem)); padding: 1.3rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.scale-dialog label { display: grid; gap: .35rem; margin: .8rem 0; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { position: fixed; inset: 60px auto 0 0; width: min(82vw, 280px); min-height: 0; height: calc(100vh - 60px); transform: translateX(-105%); transition: transform .18s ease; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  body.menu-open .sidebar { transform: translateX(0); }
  .menu-button { display: inline-flex; }
  .app-primary, .app-secondary, .org-summary { grid-template-columns: 1fr; }
  .org-counts { border-top: 1px solid var(--border); border-left: 0; }
}

@media (max-width: 420px) {
  .top-brand > span:last-child { display: inline; }
  .org-counts { grid-template-columns: repeat(2, 1fr); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .summary-tile { min-height: 114px; padding: 1rem; }
  .summary-tile > strong { font-size: 1.55rem; }
  .breadcrumbs { width: calc(100% - 2rem); }
  #content { width: 100%; padding-inline: 1rem; }
  .workspace, .section-stack, .panel, .table-panel { min-width: 0; max-width: 100%; }
  .table-wrap { display: block; width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody { display: table; }
  .table-wrap thead { position: static; clip: auto; }
  .table-wrap tr { display: table-row; padding: 0; }
  .table-wrap th, .table-wrap td { display: table-cell; min-width: 105px; padding: .65rem .75rem; white-space: nowrap; }
  .table-wrap td::before { content: none; }
  .entity-head .actions { width: 100%; }
}

.wallet-page .billing-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wallet-page > .card { margin-bottom: 1rem; }
.wallet-page label { display: block; margin: .75rem 0; }
.wallet-page label > input:not([type="checkbox"]), .wallet-page label > select { display: block; margin-top: .35rem; max-width: 24rem; width: 100%; }
.wallet-page pre { overflow-x: auto; padding: 1rem; }
@media (max-width: 800px) { .wallet-page .billing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .wallet-page .billing-grid { grid-template-columns: 1fr; } }

/* Landing-page light theme. Shared by the dashboard and read-only demo. */
:root {
  color-scheme: light;
  --bg: #fff; --background: #f7f7f4;
  --surface: #fff; --surface-2: #efefeb;
  --text: #0d0d0d; --muted: #55585f;
  --line: #e3e3dd; --border: var(--line);
  --accent: #2442c9; --accent-soft: #ece6ff;
  --ok: #176b38; --success: var(--ok);
  --warning: #7a4a00; --danger: #a51d37;
  --mint: #dcf3e4; --lemon: #fff3c4; --pink: #ffe2ee;
  --lilac: #ece6ff; --sky: #dcecff;
  --ink-panel: #111216; --ink-text: #eef0f4;
  --shadow: 0 8px 24px #0d0d0d08;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}
body { -webkit-font-smoothing: antialiased; }
::selection { background: #c9d6ff; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, .button { min-height: 40px; padding: .6rem 1.1rem; border-radius: 999px; border-color: #8a8a84; background: #fff; color: var(--text); font-weight: 600; }
button:hover, .button:hover { background: var(--surface-2); border-color: var(--text); text-decoration: none; }
button.primary, .button.primary { background: var(--text); border-color: var(--text); color: #fff; }
button.primary:hover, .button.primary:hover { background: #2b2b2b; border-color: #2b2b2b; }
button.small, .copy-command { min-height: 32px; padding: .3rem .7rem; }
.sort-button { min-height: 0; padding: 0; border-radius: 0; }
.topbar { background: #fff; color: var(--text); border-bottom: 1px solid var(--line); height: auto; min-height: 72px; padding: .75rem 1.75rem; }
.top-brand, .topbar #identity, .topbar #identity a { color: var(--text); }
.topbar button { background: #fff; color: var(--text); border-color: #8a8a84; }
.brand-mark { width: 28px; height: 28px; flex: none; background: #0d0d0d; border-radius: 7px; stroke: none; }
.shell { min-height: calc(100vh - 72px); }
.sidebar { background: #f7f7f4; padding: 1.5rem 1rem; min-height: calc(100vh - 72px); }
.side-label { color: var(--muted); letter-spacing: .06em; }
.side-link { border-radius: 12px; padding: .65rem .75rem; overflow-wrap: anywhere; }
.side-link:hover { background: var(--surface-2); }
.side-link.active { background: var(--lilac); color: var(--text); }
.side-link.nested { border-radius: 0; }
.avatar { background: var(--lilac); color: #3a2f6b; }
.account-popover { border-radius: 16px; }
.breadcrumbs { padding-top: 2.25rem; }
#content { padding-bottom: 4rem; overflow: visible; }
h1, h2, h3 { letter-spacing: -.025em; }
.entity-title h1, .page-head h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.15; letter-spacing: -.045em; }
.entity-head, .page-head { margin-bottom: 1.75rem; }
.grid, .section-stack, .split { gap: 1.5rem; }
.card, .panel, .space-card, .org-card, .market-tile, .summary-tile { border-radius: 20px; padding: 1.5rem; box-shadow: none; }
.table-panel { padding: 0; }
.summary-grid { gap: 1.25rem; }
.summary-grid > :nth-child(4n+1) { background: var(--mint); }
.summary-grid > :nth-child(4n+2) { background: var(--sky); }
.summary-grid > :nth-child(4n+3) { background: var(--lilac); }
.summary-grid > :nth-child(4n+4) { background: var(--lemon); }
.org-counts .summary-tile { background: transparent; }
.panel-footer { margin: 1rem -1.5rem -1.5rem; padding: 1rem 1.5rem; }
.chart { border-radius: 14px; padding: 1rem; }
.tabs { gap: .5rem; }
.tab.active { color: var(--text); border-color: var(--text); }
.status, .status-pill { width: fit-content; max-width: 100%; padding: .25rem .65rem; border-radius: 999px; background: var(--sky); color: #24426a; }
.status:is(.running,.live,.ready,.active,.ok,.healthy,.succeeded,.mapped,.bound),
.status-pill { background: var(--mint); color: var(--ok); }
.status:is(.pending,.building,.deploying,.provisioning,.starting,.failing_over,.deleting,.degraded),
.status-pill:is(.pending,.building,.deploying,.provisioning,.starting,.failing_over,.deleting,.degraded) { background: var(--lemon); color: var(--warning); }
.status:is(.failed,.suspended,.error,.blocked,.out_of_disk,.crashed,.crashing,.out_of_memory),
.status-pill:is(.failed,.suspended,.error,.blocked,.out_of_disk,.crashed,.crashing,.out_of_memory) { background: var(--pink); color: var(--danger); }
.status-pill.stopped { background: var(--surface-2); color: var(--muted); }
.status:is(.healthy,.succeeded,.mapped,.bound)::before { background: var(--ok); }
.status:is(.crashed,.crashing,.out_of_memory)::before { background: var(--danger); }
.status.degraded::before { background: var(--warning); }
.badge, .pill { border-radius: 999px; background: var(--lilac); color: #3a2f6b; }
.info, .loading, .empty { background: var(--sky); color: #24426a; border-radius: 14px; }
.success { background: var(--mint); color: var(--ok); border-radius: 14px; }
.error { background: var(--pink); color: var(--danger); border-radius: 14px; }
.secret { background: var(--lilac); color: var(--text); overflow-wrap: anywhere; border-radius: 14px; }
input, select { border-color: #8a8a84; border-radius: 10px; min-height: 40px; }
input[type="checkbox"] { min-height: auto; accent-color: var(--text); }
table th { background: var(--background); color: var(--muted); }
.logs, .code-snippet, pre, .cli-hint { background: var(--ink-panel); color: var(--ink-text); border-color: #2a2c33; border-radius: 14px; }
pre { max-width: 100%; padding: 1rem; overflow: auto; }
.logs { padding: 1rem; }
.cli-hint .muted { color: #b1b6c2; }
.chip[aria-pressed="false"] { opacity: 1; color: var(--muted); }
.logs.placeholder, .log-line time { color: #b1b6c2; }
.code-snippet { padding: 1rem; min-width: 0; overflow-wrap: anywhere; }
.cli-hint code { min-width: 0; overflow-wrap: anywhere; }
.cli-hint button { background: transparent; color: var(--ink-text); border-color: #787d89; }
.cli-hint button:hover { background: #2a2c33; }
.toast { max-width: calc(100vw - 2rem); overflow-wrap: anywhere; border-radius: 14px; }
.entity-title, .entity-meta, .row > *, .panel-head > *, .instance-summary, .copy-row { min-width: 0; overflow-wrap: anywhere; }
.route-row, .service-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.space-grid, .org-grid, .market-grid { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.table-wrap { min-width: 0; }
@media (max-width: 900px) {
  .sidebar { inset: 72px auto 0 0; height: calc(100vh - 72px); min-height: 0; }
  .org-summary { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .topbar { gap: .65rem; padding: .75rem 1rem; flex-wrap: wrap; }
  .topbar-spacer { min-width: 0; }
  #identity { min-width: 0; }
  .breadcrumbs { white-space: normal; overflow-wrap: anywhere; flex-wrap: wrap; padding-top: 1.5rem; }
  .card, .panel, .space-card, .org-card, .market-tile, .summary-tile { padding: 1.25rem; }
  .table-panel { padding: 0; }
  .panel-footer { margin-inline: -1.25rem; margin-bottom: -1.25rem; padding-inline: 1.25rem; }
  .row, .panel-head, .chart-head, .instance-summary { flex-wrap: wrap; }
  .route-row, .service-row, .condition { grid-template-columns: minmax(0, 1fr); }
  .log-line { grid-template-columns: auto minmax(0, 1fr); }
  .log-message { grid-column: 1 / -1; }
  .summary-grid { gap: .75rem; }
  .hero { padding: 1.25rem; }
  .table-wrap { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
