:root {
  --admin-page: #ececee;
  --admin-card: #fafafa;
  --admin-table-header: #e1e2e6;
  --admin-ink: #25262b;
  --admin-muted: #62646d;
  --admin-line: #d4d5d9;
  --admin-primary: #555861;
  --admin-edit: #237846;
  --admin-add: #2865a1;
  --admin-delete: #b23737;
  --admin-focus: #a65b13;
  --admin-link: #344e9c;
  --admin-pending: #fff0f0;
  --admin-shadow: #0002;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--admin-page);
  color: var(--admin-ink);
  font:
    16px/1.5 system-ui,
    sans-serif;
}
[hidden] {
  display: none !important;
}
header,
main,
footer {
  margin: auto;
}
main,
footer {
  width: 74%;
  max-width: 1700px;
  padding: 24px 0;
}
#admin-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  background: var(--admin-page);
  border-bottom: 1px solid var(--admin-line);
}
.admin-topbar,
#admin-navigation {
  width: 74%;
  max-width: 1700px;
  margin: auto;
}
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
}
.brand {
  color: var(--admin-ink);
  font-weight: 800;
  font-size: 29px;
  text-decoration: none;
  letter-spacing: -1px;
}
.brand > span {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
}
.badge {
  font-size: 12px;
  border: 1px solid var(--admin-line);
  padding: 5px 12px;
  border-radius: 20px;
}
#admin-navigation {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: auto;
  max-height: min(65vh, 48rem);
  overscroll-behavior-inline: contain;
  padding: 4px 0 12px;
}
#admin-navigation button {
  flex: none;
  white-space: nowrap;
  margin: 0;
}
.design-tabs {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex: none;
}
.collection-nav-gap {
  display: flex;
  margin-left: 34px;
  flex: none;
}
button {
  font: inherit;
  border: 1px solid var(--admin-line);
  background: var(--admin-primary);
  color: var(--admin-card);
  border-radius: 7px;
  padding: 8px 12px;
  cursor: pointer;
  min-height: 38px;
}
button:hover {
  filter: brightness(0.94);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button[role="tab"][aria-selected="false"],
.secondary {
  background: var(--admin-card);
  color: var(--admin-primary);
}
:focus-visible {
  outline: 3px solid var(--admin-focus);
  outline-offset: 3px;
}
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 7px;
  margin: 2px;
  color: var(--admin-primary);
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  flex: none;
}
.action-button .ui-icon {
  margin: 0;
}
.action-edit,
.action-save {
  color: var(--admin-edit);
}
.action-add,
.action-import {
  color: var(--admin-add);
}
.action-delete,
.action-logout {
  color: var(--admin-delete);
}
.ui-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  flex-shrink: 0;
  margin-right: 6px;
}
h1 {
  font-size: 30px;
  margin: 12px 0 20px;
}
h2 {
  font-size: 22px;
  margin: 10px 0 18px;
}
h3 {
  font-size: 16px;
  margin: 8px 0;
}
.panel {
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 24px;
  min-width: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 400;
  padding: 9px;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  background: var(--admin-card);
  color: var(--admin-ink);
  margin-top: 5px;
}
textarea {
  resize: vertical;
}
.help,
.empty {
  font-size: 13px;
  color: var(--admin-muted);
}
summary {
  cursor: pointer;
  font-weight: 600;
}
details > form {
  margin-top: 16px;
}
.catalog-heading,
.entity-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.catalog-heading h2,
.entity-heading h2 {
  margin-right: auto;
}
.catalog-heading select {
  width: auto;
  max-width: 220px;
  margin: 0;
}
.catalog-heading #catalog-state {
  font-size: 12px;
  color: var(--admin-muted);
}
.definition-create,
#catalog-transfer {
  margin: 16px 0;
}
.definition-create > summary {
  padding: 4px 0;
}
.definition-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.definition-flags label {
  display: flex;
  align-items: center;
  gap: 7px;
}
.definition-flags input {
  width: auto;
  margin: 0;
  accent-color: var(--admin-edit);
}
.definition-pagination,
.pagination,
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.definition-pagination p {
  margin-right: auto;
}
.admin-toolbar {
  justify-content: flex-end;
}
#entity-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
#entity-search {
  margin: 0;
}
.entity-create {
  margin: 8px 0 16px;
}
.compact-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}
.table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(65vh, 48rem);
  overscroll-behavior-inline: contain;
}
.data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  text-align: left;
  border-bottom: 1px solid var(--admin-line);
  padding: 9px 8px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 44px;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--admin-table-header);
  color: var(--admin-muted);
  font-weight: 600;
  overflow: visible;
}
.table-inputs {
  min-width: 1050px;
}
.table-buffers {
  min-width: 1280px;
}
.table-final_tags {
  min-width: 1540px;
}
.table-definitions {
  min-width: 1100px;
}
.table-entities {
  min-width: 800px;
}
.table-admin-issues {
  min-width: 1100px;
}
.cell-text,
.reference-link {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reference-link {
  font-weight: 650;
  color: var(--admin-link);
  text-decoration: none;
}
.reference-link:hover {
  text-decoration: underline;
}
.date-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.muted-id {
  font-size: 10px;
  color: var(--admin-muted);
  font-weight: 400;
}
.column-sort {
  background: transparent;
  color: inherit;
  border: 0;
  padding: 0;
  font-size: inherit;
  font-weight: 700;
  min-height: 28px;
}
.column-filter {
  display: inline-block;
  margin-left: 5px;
  font-size: 12px;
  vertical-align: middle;
}
.column-filter summary {
  list-style: none;
}
.column-filter summary::-webkit-details-marker {
  display: none;
}
.column-filter .ui-icon {
  width: 16px;
  height: 16px;
  margin: 0;
}
.column-filter[open] {
  position: fixed;
  right: auto;
  width: 220px;
  max-width: calc(100vw - 16px);
  max-height: min(300px, calc(100vh - 24px));
  overflow-y: auto;
  z-index: 20;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  padding: 12px;
  border-radius: 8px;
  min-width: 190px;
  box-shadow: 0 5px 18px var(--admin-shadow);
}
.column-filter label {
  display: block;
  white-space: normal;
}
.column-filter input,
.column-filter select {
  width: 180px;
}
.definition-pending {
  background: var(--admin-pending);
}
#definitions[aria-busy="true"] {
  opacity: 0.6;
}
.dashboard-grid {
  display: grid;
  gap: 14px;
  margin: 16px 0;
}
.dashboard-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dashboard-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.palette-grid,
.icon-reference-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0;
}
.color-reference {
  min-width: 190px;
  flex: 1;
}
.color-reference span {
  display: block;
  width: 100%;
  height: 42px;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
}
.color-reference code {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.icon-reference-grid > div {
  display: flex;
  align-items: center;
  min-width: 130px;
}
.instrument-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.instrument-gallery figure {
  margin: 0;
  text-align: center;
  padding: 12px;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
}
.instrument-gallery figcaption {
  font-size: 12px;
}
#status {
  position: sticky;
  bottom: 8px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  padding: 12px;
  border-radius: 8px;
  z-index: 40;
}
#status:empty {
  display: none;
}
footer {
  font-size: 12px;
  color: var(--admin-muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 1200px) {
  main,
  footer,
  .admin-topbar,
  #admin-navigation {
    width: 90%;
  }
  .dashboard-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 650px) {
  main,
  footer,
  .admin-topbar,
  #admin-navigation {
    width: calc(100% - 24px);
  }
  .panel {
    padding: 14px;
  }
  .brand {
    font-size: 24px;
  }
  .admin-topbar {
    padding: 8px 0;
  }
  .dashboard-three,
  .dashboard-four {
    grid-template-columns: 1fr;
  }
  .catalog-heading {
    align-items: stretch;
  }
  #admin-navigation button {
    font-size: 12px;
    padding: 7px 9px;
  }
  .compact-filters > * {
    flex: 1;
    min-width: 130px;
  }
}

a {
  color: var(--admin-link);
}

.collection-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.collection-tabs button[aria-selected="true"] {
  background: var(--admin-primary);
  color: white;
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--admin-focus);
}
.collection-tabs button[aria-selected="false"] {
  background: var(--admin-card);
  color: var(--admin-ink);
  border-color: var(--admin-line);
}
.title-metric {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: .8rem;
  font-size: .85em;
  font-weight: 400;
}
.list-heading {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.list-heading h2 { margin: 0; }
.metric-successful .ui-icon { color: var(--admin-edit); }
.metric-errors .ui-icon { color: var(--admin-delete); }
.metric-queued .ui-icon { color: var(--admin-muted); }
[role="tabpanel"][aria-busy="true"] {
  cursor: progress;
}
.collection-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 12px;
  white-space: nowrap;
}
.collection-source input[type="checkbox"] { margin: 0; }

/* Shared diagnostic disclosures: compact rows; readable evidence only when opened. */
.http-diagnostic { min-width: 0; }
.http-diagnostic p { margin: .25rem 0; white-space: normal; overflow-wrap: anywhere; }
.http-diagnostic pre { max-width: 100%; max-height: 22rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.http-diagnostic summary { cursor: pointer; }

.definition-type { display: inline-flex; align-items: center; gap: .35rem; }
.definition-properties-cell { overflow: visible !important; }
.definition-properties { white-space: nowrap; }
.text-disclosure summary { cursor: pointer; display: list-item; list-style-position: inside; font-weight: 400; }
.text-disclosure[open] .text-disclosure-body { white-space: pre-wrap; overflow-wrap: anywhere; padding-top: .5rem; }
.text-disclosure-body { display: none; }
.text-disclosure[open] .text-disclosure-body { display: block; }
.definition-notes-cell { vertical-align: top; }
.definition-metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(7rem,1fr)); gap: 1rem; margin: 1rem 0; }
.definition-metrics > div { border: 1px solid var(--admin-line); border-radius: .5rem; padding: 1rem; }
.definition-metrics span, .definition-metrics strong { display: block; }
.definition-metrics strong { font-size: 1.6rem; }
.definition-detail-fields { display: grid; grid-template-columns: 13rem minmax(0,1fr); gap: .75rem 1rem; }
.definition-detail-fields dt { font-weight: 600; }
.definition-detail-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.design-table-example { max-height: 14rem; margin-bottom: 1rem; }
@media(max-width:600px) { .definition-detail-fields { grid-template-columns: 1fr; gap: .35rem; } .definition-detail-fields dd { margin-bottom: .75rem; } }

/* Entity editor and row actions share compact geometry across admin pages. */
.entity-editor { display: grid; grid-template-columns: minmax(9rem,1fr) 9rem minmax(12rem,3fr) 8rem auto; gap: 12px; align-items: end; }
.entity-editor label { min-width: 0; margin-bottom: 0; }
.entity-editor input, .entity-editor select { margin-bottom: 0; }
.entity-editor > button { margin-bottom: 0; }
.entity-actions { display: inline-flex; gap: 4px; align-items: center; }
.action-quiet { border: 0; background: transparent; margin: 0; }
.entity-detail h2 { display: flex; gap: 8px; align-items: center; overflow-wrap: anywhere; }
.entity-detail dd { white-space: pre-wrap; }
.table-entities { min-width: 850px; }
@media(max-width: 1000px) { .entity-editor { grid-template-columns: 1fr 1fr; } .entity-editor > button { justify-self: end; grid-column: -2 / -1; } }
@media(max-width: 480px) { .entity-editor { grid-template-columns: minmax(0,1fr); } .entity-editor > button { grid-column: 1; } .entity-heading { flex-wrap: wrap; } #entity-search-form { min-width: 0; width: 100%; } #entity-search { min-width: 0; } }

.tag-definition-reference { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tag-definition-reference .reference-link { flex: 1; min-width: 0; }
.tag-revision { flex: none; font-size: 11px; color: var(--admin-muted); font-variant-numeric: tabular-nums; }

.engine-work-summary { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem 1rem; margin:.75rem 0; }
.engine-work-summary > strong { color:var(--admin-ink); }
.engine-work-summary > span { font-size:.85rem; white-space:pre; }

.auth-panel form{display:grid;gap:.75rem;max-width:34rem}.auth-panel label{display:grid;gap:.3rem}.auth-links{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.75rem}.auth-preview{display:grid;gap:1rem}.auth-panel [role="alert"]{color:#b23737}

/* Reference-only index and asset comparisons are not part of the public payload. */
.identity-preview{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:24px;padding:20px;background:var(--surface,var(--admin-card));color:var(--ink,var(--admin-ink));border:1px solid var(--line,var(--admin-line));border-radius:12px;min-width:0}
.identity-preview figure{margin:0;display:grid;align-content:start;gap:16px;min-width:0}
.identity-preview .zikme-logo img{width:240px}
.identity-preview figcaption{font-size:13px;color:var(--muted,var(--admin-muted))}
.identity-preview p{grid-column:1/-1;margin:0;font-size:13px;line-height:1.6}
.design-index,.asset-policy{margin:20px 0;padding:16px;border:1px solid var(--line,var(--admin-line));border-radius:12px;min-width:0}
.design-index ul{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));gap:12px;list-style:none;padding:0;margin:0}.design-index li{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}.design-index li span,.asset-policy p{font-size:13px;line-height:1.6}

.design-index a{color:var(--admin-ink);font-weight:700;text-decoration:underline;text-underline-offset:3px}
.design-index a:focus-visible{outline:3px solid var(--admin-ink);outline-offset:4px;border-radius:2px}
[data-design-anchor]{scroll-margin-top:10rem}
[data-design-anchor]:target,[data-design-anchor]:focus{outline:3px solid var(--orange,var(--admin-focus));outline-offset:4px}

.instrument-gallery .instrument-artwork{margin:0 auto 8px}

/* Shared Admin Design column filters keep controls mounted during async reads. */
.tag-column-filters{display:flex;align-items:end;gap:.75rem;margin:.5rem 0;flex-wrap:wrap}
.tag-column-filters label,.tag-browser th label{display:flex;flex-direction:column;gap:.25rem;font-size:.75rem;font-weight:normal}
.tag-browser th input{width:100%;min-width:7rem;box-sizing:border-box;margin-top:.35rem;min-height:2.75rem}
.tag-browser th label{font-size:0}
.tag-browser th input{font-size:.9rem}
.tag-browser nav{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap;margin:.5rem 0}
.tag-browser .column-sort{min-height:2.75rem}
.tag-browser[aria-busy="true"] tbody{opacity:.55}
.tag-browser table{min-width:75rem}
.tag-column-filters select{min-height:2.75rem}
