/* Page shell: grow the content region, then keep the footer in normal flow. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.admin-layout { flex: 1; width: 100%; align-items: start; }
.site-nav, .site-footer { flex-shrink: 0; }
.site-footer { margin-block-start: auto; }
#status:empty { display: none; }

.admin-layout {
  padding-block: var(--space-7) var(--space-9);
  gap: var(--space-7);
}
main,
aside,
.group {
  min-width: 0;
}
aside nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}
aside .hint {
  margin-block-start: var(--space-7);
}
.toolbar,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-3);
  margin-block: var(--space-4);
}
.toolbar .field {
  flex: 1;
  min-width: 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-block-end: var(--space-3);
}
.editor {
  width: 100%;
  min-height: calc(var(--space-10) * 3);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}
pre {
  white-space: pre;
  overflow-wrap: normal;
  max-height: calc(var(--space-10) * 6);
  overflow: auto;
  padding: var(--space-4);
  background: var(--tone-1);
  border-radius: var(--leaf-sm);
}
pre.code-preview {
  color: var(--text);
}
.json-key {
  color: var(--accent);
}
.json-string {
  color: var(--success);
}
.json-number {
  color: var(--info);
}
.json-literal {
  color: var(--warning);
}
td,
th {
  overflow-wrap: anywhere;
  text-align: start;
}
.table .path-cell {
  min-width: calc(var(--space-10) * 2);
}
.detail {
  margin-block: var(--space-7);
}
.details-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-5);
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  overflow-wrap: anywhere;
}
section {
  margin-block-end: var(--space-8);
}
input[type="file"] {
  max-width: 100%;
}
progress {
  width: 100%;
}
[hidden] {
  display: none !important;
}
@media (max-width: 960px) {
  .admin-layout {
    display: block;
  }
  aside nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  aside .hint {
    margin-block: var(--space-3);
  }
}
@media (max-width: 600px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .details-list {
    display: block;
  }
  dd {
    margin-block-end: var(--space-3);
  }
}

/* App/admin template: structural styles use the shared design tokens. */
.toolbar { align-items: flex-end; }
.toolbar .field { margin-block-end: 0; }
.admin-menu { display: none; }
#navigation a { justify-content: flex-start; text-decoration: none; }
#navigation a[aria-current="page"] { background: var(--tone-2); color: var(--text); }
.branch-summary { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-block: var(--space-6) var(--space-3); }
.branch-summary h2 { margin: 0; font-size: var(--fs-2xl); }
.tree-name { display: inline-flex; align-items: center; gap: var(--space-3); min-height: var(--control-h); max-width: 100%; font-weight: 500; }
.tree-marker { color: var(--muted); flex-shrink: 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.breadcrumbs > :not(:last-child)::after { content: "/"; margin-inline-start: var(--space-3); color: var(--muted); }
#identity { max-width: calc(var(--space-10) * 3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) {
  .admin-menu { display: inline-flex; margin-block-end: var(--space-3); }
  aside #navigation { display: none; }
  .admin-menu[aria-expanded="true"] + #navigation { display: flex; flex-direction: column; }
  aside .hint { display: none; }
  .branch-summary { align-items: flex-start; flex-direction: column; gap: var(--space-1); }
}
#navigation a { min-height: var(--control-h); padding-inline: var(--space-3); border-radius: var(--leaf-sm); color: var(--muted); }
#navigation a:hover { color: var(--text); background: var(--tone-1); border-radius: var(--leaf-sm-flip); }
.overview-counters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin-block: var(--space-7); }
.overview-counters h3 { font-size: var(--fs-ui); color: var(--muted); font-weight: 500; margin: 0; }
.metric-value { margin-block: var(--space-2) 0; font-size: var(--fs-3xl); font-variant-numeric: tabular-nums; }
.brand.brand-missing .brand-app { display: inline; border: 0; padding-inline-start: 0; margin-inline-start: 0; }
@media (max-width: 600px) { .overview-counters { grid-template-columns: 1fr; } }

/* Explicit vertical rhythm: adjacent headings, forms and actions must not touch. */
#view { display: flex; flex-direction: column; gap: var(--space-5); }
#view > *, .storage-tier > *, .path-builder > * { margin-block: 0; }
.storage-tier, .path-builder { display: flex; flex-direction: column; gap: var(--space-4); }
.storage-tiers { align-items: start; }
.storage-tier .details-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.file-selection { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-4); }
.upload-filename { overflow-wrap: anywhere; min-width: 0; }
.upload { display: flex; flex-direction: column; gap: var(--space-4); }
.upload .field { margin: 0; }
.path-parameters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.path-parameters .field { margin: 0; }
.path-setup > :not(summary) { margin-block-start: var(--space-4); }
.detail > * + *, .detail > div > * + * { margin-block-start: var(--space-4); }
@media (max-width: 600px) {
  .path-parameters { grid-template-columns: 1fr; }
  .file-selection { align-items: flex-start; flex-direction: column; }
  .storage-tier .details-list { display: block; }
}
.storage-tier > .button, .path-builder > .button { align-self: flex-start; }
#view > .button { align-self: flex-start; }
#view .notice, #view summary { overflow-wrap: anywhere; }
.path-builder .select, .path-builder .field, .path-parameters .field { min-width: 0; max-width: 100%; }
.table th { overflow-wrap: normal; white-space: nowrap; }
.explorer-listing .tree-name { min-width: calc(var(--space-10) * 2); }
.table .badge { white-space: nowrap; }
@media (max-width: 600px) {
  .toolbar { align-items: stretch; }
  .explorer-listing th:nth-child(4), .explorer-listing td:nth-child(4) { display: none; }
}
.table { min-width: calc(var(--space-10) * 8); }
.explorer-listing .table { min-width: 100%; }
.storage-inventory td:first-child, .storage-inventory th:first-child { min-width: calc(var(--space-10) * 2); }

.auth-wrap { position: relative; display: grid; place-items: center; padding-block: var(--space-10); flex: 1; }
.auth-card { position: relative; width: 100%; max-width: 400px; padding: max(30px, var(--space-7)); background: var(--tone-1); border-radius: var(--leaf-lg); }
.auth-card > * + * { margin-block-start: var(--space-4); }
.alias-inventory .table { min-width: calc(var(--space-10) * 14); }
.alias-inventory td:first-child { min-width: calc(var(--space-10) * 2); }
.alias-inventory td:nth-child(2) { min-width: calc(var(--space-10) * 3); }
.alias-content { display: grid; min-width: calc(var(--space-10) * 4); grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.route-inventory .table { min-width: calc(var(--space-10) * 14); }
.route-inventory td:first-child, .route-inventory td:nth-child(2) { min-width: calc(var(--space-10) * 3); }

.input-actions { display: flex; align-items: start; gap: var(--space-2); min-width: 0; }
.input-actions > .input { flex: 1; min-width: 0; }
.input-actions > .button { flex-shrink: 0; }
.copy-value { display: inline-flex; align-items: start; gap: var(--space-2); max-width: 100%; min-width: 0; }
.copy-text, .details-list dd { min-width: 0; overflow-wrap: anywhere; }
.table-wrap { position: relative; max-width: 100%; min-width: 0; overflow-x: auto; }
.copy-control { position: relative; display: inline-flex; flex-shrink: 0; align-items: start; gap: var(--space-2); }
.copy-control:has(.error-text) { flex-wrap: wrap; flex-shrink: 1; min-width: 0; max-width: 100%; }
.copy-control .error-text { min-width: 0; overflow-wrap: anywhere; }
.copy-button svg { width: var(--fs-lg); height: var(--fs-lg); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.copy-button.is-copied { color: var(--success); }
.copy-block { position: relative; min-width: 0; }
.copy-block > .copy-control { position: absolute; inset-block-start: var(--space-2); inset-inline-end: var(--space-2); }
.copy-block > pre { margin: 0; padding-block-start: calc(var(--control-h) + var(--space-3)); }
/* The list grows naturally up to a limit. A small list has no scrollbar;
   breadth uses explicit pages, and depth never increases indentation. */
dialog.option-dialog { width: calc(100% - var(--page-pad) * 2); max-width: calc(var(--space-10) * 6); max-height: calc(100dvh - var(--space-7)); padding: var(--space-6); }
dialog.option-dialog[open] { display: flex; flex-direction: column; }
.option-dialog h2 { margin: 0; font-size: var(--fs-xl); }
#confirmation h2 { font-size: var(--fs-xl); }
.option-dialog > .hint { margin-block: var(--space-3); }
.option-dialog > .notice { flex-shrink: 0; }
.option-dialog .picker-body { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.option-dialog .dialog-actions { flex-shrink: 0; margin-block-start: var(--space-4); }
.option-dialog .toolbar, .option-dialog .hint, .option-dialog .field { margin: 0; }
.picker-options { list-style: none; margin: 0; padding: 0; }
.picker-options { max-height: calc(var(--control-h) * 8); overflow: auto; flex-shrink: 0; }
.picker-option-row { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.picker-option { display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: start; text-align: start; overflow-wrap: anywhere; white-space: normal; }
.path-viewport { position: relative; max-height: calc(var(--control-h) * 8); overflow: auto; overscroll-behavior: contain; min-width: 0; flex-shrink: 0; }
.path-viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.path-rows { list-style: none; margin: 0; padding: 0; }
.path-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-2); min-width: 0; }
.path-row + .path-row { border-block-start: 1px solid var(--line); }
.path-identity { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: start; }
.path-name { min-width: 0; max-width: 100%; overflow-wrap: anywhere; text-align: start; white-space: normal; }
.path-identity > .button { padding-inline: var(--space-2); }
.path-identity > .hint { padding-inline: var(--space-2); }
.path-actions, .browser-pages, .browser-current { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.browser-pages { justify-content: space-between; }
.browser-current:empty { display: none; }
.picker-jump > summary { cursor: pointer; min-height: var(--control-h); display: list-item; align-content: center; color: var(--muted); }
.picker-jump > .toolbar { margin-block-start: var(--space-3); }
.path-trail { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-2); min-width: 0; }
.path-trail > .button { min-width: 0; max-width: 100%; padding-inline: var(--space-2); overflow-wrap: anywhere; white-space: normal; }
.path-trail .path-crumb[aria-current] { color: var(--text); text-decoration: none; }
.path-trail > span { display: inline-flex; align-items: center; min-height: var(--control-h); padding-inline: var(--space-2); min-width: 0; overflow-wrap: anywhere; }
.path-trail .ancestor-field { flex: 1; min-width: 0; max-width: 100%; }
.ancestor-field .select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.explorer-viewport { max-height: calc(var(--control-h) * 11); overflow: auto; overscroll-behavior: contain; }
.explorer-viewport .table-wrap { overflow: visible; }
.explorer-viewport .table { width: 100%; }
.explorer-listing .path-trail { margin-block-end: var(--space-4); }
.control-tooltip { position: fixed; inset: auto; width: max-content; max-width: calc(100vw - var(--space-4)); margin: 0; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--leaf-xs); background: var(--tone-3); color: var(--text); font-family: var(--font-sans); font-size: var(--fs-xs); line-height: 1.5; pointer-events: none; overflow-wrap: anywhere; }
@media (forced-colors: active) { .control-tooltip { outline: 1px solid CanvasText; } }
.schema-options { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.schema-options > .field { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  dialog.option-dialog { padding: var(--space-4); }
  .copy-value { gap: var(--space-1); }
}

/* Human-readable data is the default; raw JSON is an explicit alternative. */
.page-heading, .heading-with-help { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.page-heading h1, .heading-with-help > :is(h2,h3) { margin: 0; min-width: 0; }
.help-control { display: inline-flex; position: relative; flex-shrink: 0; }
.help-button svg { width: var(--fs-lg); height: var(--fs-lg); fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.help-popover { position: fixed; inset: auto; width: min(calc(100vw - var(--page-pad) * 2), calc(var(--space-10) * 5)); max-height: calc(100dvh - var(--space-7)); overflow: auto; margin: 0; padding: var(--space-5); border: 0; border-radius: var(--leaf-lg); background: var(--tone-2); color: var(--text); font-family: var(--font-sans); }
.help-popover p { margin-block: 0 var(--space-4); overflow-wrap: anywhere; }
.field-with-help { display: flex; align-items: end; gap: var(--space-2); min-width: 0; }
.field-with-help > .field { flex: 1; min-width: 0; margin: 0; }
.data-inspector, .representation-body, .structured-collection, .value-editor { min-width: 0; max-width: 100%; }
.representation-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-block-end: var(--space-3); }
.readable-details { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); margin-block: 0; }
.readable-details > :is(dt,dd) { min-width: 0; overflow-wrap: anywhere; }
.readable-details dd > .data-inspector { margin-block-end: var(--space-3); }
.readable-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.numeric { font-variant-numeric: tabular-nums; }
.structured-list { margin: 0; padding-inline-start: var(--space-6); max-height: calc(var(--control-h) * 8); overflow: auto; }
.structured-list li { padding-block: var(--space-2); overflow-wrap: anywhere; }
.structured-group { min-width: 0; }
.structured-group > summary { min-height: var(--control-h); align-content: center; overflow-wrap: anywhere; }
.structured-group > :not(summary) { margin-block-start: var(--space-3); }
.structured-collection > .button { margin-block-start: var(--space-3); }
.application-summary, .decision-summary, .value-editor { display: flex; flex-direction: column; gap: var(--space-4); }
.application-summary > *, .decision-summary > *, .value-editor > * { margin-block: 0; }
.access-rule { margin: 0; padding-block: var(--space-4); }
.access-rule + .access-rule { border-block-start: 1px solid var(--line); }
.access-rule > .details-list { margin-block-start: var(--space-3); }
.value-field-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(var(--space-10) * 4 + var(--space-5) * 2)), 1fr)); gap: var(--space-4); min-width: 0; }
.value-field-group > *, .value-fields, .value-fields > .field { min-width: 0; margin: 0; }
.value-editor label > span { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .help-popover::backdrop { background: color-mix(in srgb, var(--veil) var(--veil-alpha), transparent); backdrop-filter: blur(calc(var(--space-3) / 2)); }
}
@media (prefers-reduced-transparency: reduce) { .help-popover::backdrop { backdrop-filter: none; } }
@media (forced-colors: active) { .help-popover { outline: 1px solid CanvasText; } }

/* Development navigation wraps instead of overflowing on a narrow viewport. */
.development-nav { height: auto; min-height: var(--nav-h); }
.development-nav > .container { min-height: var(--nav-h); flex-wrap: wrap; gap: var(--space-3); }
.development-nav .nav-actions { flex-wrap: wrap; gap: var(--space-3); }

/* Give nested JSON values the same usable width as their labels. */
.structured-fields { margin: 0; }
.structured-field { min-width: 0; padding-block: var(--space-1); }
.structured-field + .structured-field { border-block-start: 1px solid var(--line); }
.structured-field > :is(dt, dd) { overflow-wrap: anywhere; }
.structured-group .structured-list, .representation-body .structured-list {
  padding-inline-start: 0;
  list-style-position: inside;
  max-height: none;
  overflow: visible;
}

/* Keep all signed-in actions visible when the full logo and controls cannot fit. */
@media (max-width: 420px) {
  .site-nav .container:has(.launcher) {
    height: auto;
    min-height: var(--nav-h);
    flex-wrap: wrap;
    gap: 0;
  }
}
