: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; }
.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; gap: .2rem; margin: 1rem 0 .7rem; overflow-x: auto; 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; }

@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; }
}
