:root {
  --ink: #17241f;
  --muted: #64736d;
  --canvas: #f4f2eb;
  --surface: #fffefa;
  --line: #dcded7;
  --accent: #176c57;
  --accent-soft: #e0eee8;
  --danger: #9f332d;
  --danger-soft: #f9e5e1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { min-width: 320px; overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.topbar {
  height: 64px; display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
  background: #fdfcf7; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .65rem; min-width: max-content; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  color: white; background: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .03em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: .94rem; }
.brand small { color: var(--muted); font-size: .7rem; margin-top: .08rem; }
.product-nav { display: flex; align-items: center; gap: .25rem; }
.product-nav a, .product-nav span { padding: .42rem .62rem; border-radius: 8px; font-size: .8rem; color: var(--muted); text-decoration: none; }
.product-nav a[aria-current="page"] { color: white; background: var(--accent); }
.product-nav span { opacity: .58; cursor: not-allowed; }
.repository-nav { display: flex; align-items: center; gap: .18rem; padding: .18rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.product-nav .repository-label { padding-inline: .5rem .38rem; color: var(--ink); font-weight: 750; opacity: 1; cursor: default; }
.product-nav .repository-label::after { content: "›"; margin-left: .45rem; color: var(--muted); }
.topbar-status { display: flex; align-items: center; gap: .6rem; margin-left: auto; font-size: .78rem; }
.actor-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { border-radius: 999px; padding: .18rem .55rem; background: #e8ebe8; color: var(--muted); }
.status-badge.is-ready { background: var(--accent-soft); color: var(--accent); }
.status-badge.is-error { background: var(--danger-soft); color: var(--danger); }

.gate { height: calc(100% - 64px); display: grid; place-items: center; padding: 1.5rem; }
.gate-card { width: min(520px, 100%); padding: 2rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 50px rgb(22 43 35 / .08); }
.gate-card h1 { margin: .2rem 0 .6rem; }
.gate-card p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.gate-card .button { margin: .35rem; }

.admin-shell { height: calc(100% - 64px); display: grid; grid-template-columns: minmax(220px, 270px) minmax(360px, 1.15fr) minmax(360px, .95fr); }
.sidebar, .catalog, .inspector { min-height: 0; overflow: auto; border-right: 1px solid var(--line); }
.sidebar { padding: 1rem; background: #faf9f4; }
.sidebar section + section { margin-top: 1.4rem; }
.catalog { display: flex; flex-direction: column; background: var(--surface); }
.inspector { border-right: 0; padding: 1rem; background: var(--canvas); }
.eyebrow { margin: 0 0 .25rem; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.field { display: grid; gap: .28rem; margin: .75rem 0; }
.field span { color: var(--muted); font-size: .76rem; font-weight: 650; }
.field input, .field select { width: 100%; padding: .55rem .62rem; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.field input:focus, .field select:focus { outline: 2px solid #8cc2b3; outline-offset: 1px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: .6rem; }
.section-heading h2 { margin: 0; font-size: .92rem; }
.text-button { padding: 0; border: 0; color: var(--accent); background: none; cursor: pointer; font-size: .72rem; }
.muted { color: var(--muted); font-size: .76rem; line-height: 1.5; }
.facet-list { display: grid; gap: .36rem; }
.facet-item { padding: .48rem .56rem; border: 1px solid var(--line); border-radius: 8px; background: white; }
.facet-item strong, .facet-item small { display: block; }
.facet-item strong { font-size: .77rem; overflow-wrap: anywhere; }
.facet-item small { margin-top: .12rem; color: var(--muted); font-size: .66rem; }
.boundary-note { padding: .72rem; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--accent-soft); font-size: .76rem; }
.boundary-note p { margin: .3rem 0 0; line-height: 1.5; color: #31574c; }

.catalog-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.catalog-heading h1 { margin: 0; font-size: 1.15rem; }
.catalog-meta { display: grid; justify-items: end; gap: .15rem; color: var(--muted); font-size: .7rem; }
.record-list { flex: 1 1 auto; overflow: auto; }
.record-row { width: 100%; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .72rem 1rem; border: 0; border-bottom: 1px solid #ecece7; color: inherit; background: white; text-align: left; cursor: pointer; }
.record-row:hover { background: #f4faf7; }
.record-row[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.type-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--accent); background: #edf5f1; font-size: .67rem; font-weight: 850; letter-spacing: .04em; }
.record-main { min-width: 0; }
.record-main strong, .record-main code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-main strong { font-size: .86rem; }
.record-main code { margin-top: .16rem; color: var(--muted); font-size: .68rem; }
.record-aside { display: grid; justify-items: end; gap: .14rem; color: var(--muted); font-size: .66rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: .7rem; padding: .7rem; border-top: 1px solid var(--line); background: #faf9f4; }
.pager span { min-width: 4.5rem; text-align: center; font-size: .75rem; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 34px; padding: .42rem .72rem; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; cursor: pointer; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { color: white; border-color: var(--accent); background: var(--accent); }
.button-secondary { color: var(--ink); background: white; }
.button-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.loading, .empty, .notice { margin: 1rem; padding: .8rem; border-radius: 9px; font-size: .8rem; }
.loading { color: var(--muted); background: #f2f4f2; }
.empty { color: var(--muted); text-align: center; }
.notice.is-error { color: var(--danger); background: var(--danger-soft); }

.inspector-empty { display: grid; place-items: start; align-content: center; min-height: 100%; max-width: 28rem; margin: auto; }
.inspector-empty h2 { margin: .1rem 0; }
.inspector-empty p:last-child { color: var(--muted); line-height: 1.55; }
.inspector-heading { display: flex; justify-content: space-between; align-items: start; gap: .8rem; }
.inspector-heading h2 { margin: .12rem 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.inspector-heading code { color: var(--muted); font-size: .68rem; overflow-wrap: anywhere; }
.tabs { display: flex; flex-wrap: wrap; gap: .2rem; margin: 1rem 0 .7rem; border-bottom: 1px solid var(--line); }
.tabs button { padding: .45rem .55rem; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: none; cursor: pointer; font-size: .74rem; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-color: var(--accent); font-weight: 750; }
.tab-panel h3 { margin: .8rem 0 .4rem; font-size: .78rem; }
.xml-view { min-height: 300px; max-height: calc(100vh - 210px); margin: 0; padding: .8rem; overflow: auto; border: 1px solid #293f37; border-radius: 10px; color: #dce9e4; background: #17251f; font: .72rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.metadata-list { display: grid; grid-template-columns: minmax(100px, .4fr) minmax(0, 1fr); gap: 0; margin: 0; border: 1px solid var(--line); border-radius: 10px; background: white; overflow: hidden; }
.metadata-list dt, .metadata-list dd { margin: 0; padding: .46rem .58rem; border-bottom: 1px solid #ecece7; font-size: .74rem; overflow-wrap: anywhere; }
.metadata-list dt { color: var(--muted); background: #faf9f4; }
.stack { display: grid; gap: .42rem; }
.stack-item { padding: .6rem; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: .74rem; line-height: 1.5; overflow-wrap: anywhere; }

.tab-panel > p { font-size: .8rem; line-height: 1.6; }
.description-root, .xml-location { overflow-wrap: anywhere; font: .72rem/1.5 ui-monospace, Consolas, monospace; }
.description-group { margin-block: .65rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.description-group > summary { padding: .7rem; font-size: .82rem; font-weight: 650; cursor: pointer; }
.description-entries { padding: 0 .7rem .3rem; }
.description-entry { padding-block: .65rem; border-top: 1px solid var(--line); }
.description-entry-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.description-entry-heading code { min-width: 0; overflow-wrap: anywhere; font-size: .78rem; }
.source-locate { flex: 0 0 auto; font-size: .72rem; }
.description-value { margin: .5rem 0; white-space: pre-wrap; overflow-wrap: anywhere; font: .8rem/1.55 ui-monospace, Consolas, monospace; }
.description-attributes { display: grid; grid-template-columns: minmax(65px, max-content) minmax(0, 1fr); gap: .25rem .65rem; font: .7rem/1.5 ui-monospace, Consolas, monospace; }
.description-attributes dt, .description-attributes dd { margin: 0; overflow-wrap: anywhere; }
.description-source { font-size: .7rem; color: var(--muted); }
.description-source summary { padding-block: .3rem; cursor: pointer; }
.description-source code { display: block; margin-block: .3rem; overflow-wrap: anywhere; }
.xml-source-highlight { color: #fff; background: #446656; box-shadow: 0 0 0 1px #a2d4bb; }
.source-locate:focus-visible, summary:focus-visible, .tabs button:focus-visible, .xml-view:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 1100px) {
  body { overflow: auto; }
  .admin-shell { height: auto; min-height: calc(100vh - 64px); grid-template-columns: minmax(210px, 250px) 1fr; }
  .inspector { grid-column: 1 / -1; min-height: 520px; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; padding-block: .6rem; }
  .product-nav { order: 3; width: 100%; overflow-x: auto; }
  .admin-shell { display: block; }
  .sidebar, .catalog, .inspector { min-height: 460px; border-right: 0; border-bottom: 1px solid var(--line); }
  .topbar-status { margin-left: 0; }
}

.portal-page, .users-page { min-height: 100%; overflow: auto; }
.portal-shell { width: min(1180px, 100%); margin: 0 auto; padding: clamp(1.25rem, 4vw, 3rem); }
.portal-hero { max-width: 760px; margin-bottom: 1.5rem; }
.portal-hero h1 { margin: .2rem 0 .6rem; font-size: clamp(1.8rem, 4vw, 3rem); }
.portal-hero > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.workspace-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 1rem; }
.workspace-card { min-width: 0; padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 30px rgb(22 43 35 / .05); }
.workspace-card-heading { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.workspace-card h2 { margin: 0; font-size: 1.15rem; }
.workspace-card > code { display: block; margin: .35rem 0 1rem; color: var(--muted); overflow-wrap: anywhere; }
.role-badge { flex: none; padding: .22rem .5rem; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: .7rem; font-weight: 750; }
.portal-functions { display: grid; gap: .5rem; }
.portal-function { display: grid; gap: .12rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 9px; color: inherit; text-decoration: none; }
.portal-function:hover { border-color: var(--accent); background: #f4faf7; }
.portal-function strong { font-size: .85rem; }
.portal-function small { color: var(--muted); font-size: .72rem; }
.members-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.member-header, .member-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) 90px; align-items: center; gap: 1rem; padding: .8rem 1rem; }
.member-header { color: var(--muted); background: #faf9f4; font-size: .72rem; }
.member-row { border-top: 1px solid var(--line); }
.member-row strong, .member-row small { display: block; overflow-wrap: anywhere; }
.member-row small { margin-top: .15rem; color: var(--muted); }
.member-row select, .member-row button { min-height: 38px; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font: inherit; }
.member-row button { cursor: pointer; }
@media (max-width: 650px) {
  .member-header { display: none; }
  .member-row { grid-template-columns: 1fr; gap: .55rem; }
  .member-row button { justify-self: start; }
}

.semantic-status { font-weight: 700; color: var(--accent, #0b776b); }
.semantic-relation { margin: 1rem 0; padding: 1rem; border: 1px solid #d7dfdc; border-radius: .7rem; min-width: 0; }
.semantic-participants { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: .7rem; }
.semantic-participant { min-width: 0; padding: .8rem; background: #f3f5f2; border-radius: .5rem; }
.semantic-participant h5 { font-size: 1rem; margin: 0 0 .4rem; }
.semantic-participant p { margin: .4rem 0; overflow-wrap: anywhere; }
.semantic-targets { margin: .4rem 0; padding-left: 1.25rem; }
.semantic-targets li { margin: .5rem 0; }
.semantic-targets code, .semantic-targets a, .semantic-arc code { overflow-wrap: anywhere; word-break: break-word; }
.semantic-targets .button { display: inline-block; margin: .3rem .3rem .3rem 0; min-height: 2.2rem; }
.semantic-arc { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .7rem 0; border-bottom: 1px solid #d7dfdc; }
.semantic-relation h3, .semantic-relation h4 { overflow-wrap: anywhere; }
/* Quota values are projections of server policy and receipts, never local authority. */
.quota-form { display:flex; flex-wrap:wrap; align-items:end; gap:.75rem; padding:1rem; min-width:0; }
.quota-form > strong,.quota-form > p,.quota-form > small { flex-basis:100%; margin:0; overflow-wrap:anywhere; }
.quota-form label { display:flex; flex-direction:column; gap:.25rem; max-width:100%; }
.quota-form input[type="text"] { width:12rem; max-width:100%; box-sizing:border-box; }
.quota-form input[type="checkbox"] { align-self:start; }
.member-row .quota-form { padding:1rem 0; }
