/* M43 Admin: layout for the owner's control center. Tokens, buttons, cards, tables and inputs come from the platform's
   helios.css; the sign-in page from its auth-layout.css. */
[hidden] { display: none !important; }
html, body { height: auto; min-height: 100%; }
* { box-sizing: border-box; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--h-sun-2); outline-offset: 2px; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; color: var(--h-ink); font: 700 28px/1 "Space Grotesk", "Helvetica Neue", sans-serif; letter-spacing: -.075em; }
.wordmark img { width: 34px; height: 34px; }
.product { margin-left: 8px; padding-left: 14px; border-left: 1px solid var(--h-line-2); font-size: 15px; color: var(--h-muted); }
.entry-foot { font-weight: 600; font-size: .7rem; letter-spacing: .11em; text-transform: uppercase; color: var(--h-muted); }
.entry-photo { background-image: url("/brand/m43-orion.webp"); background-size: cover; background-position: center; }
.entry-body .entry-primary { margin-top: 26px; width: 100%; justify-content: center; min-height: 46px; }
#notice { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; background: #fdecea; color: var(--h-crit); overflow-wrap: anywhere; }
#notice[data-kind="ok"] { background: #e8f5ee; color: #17663c; }
#notice:empty { display: none; }

.adm { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.adm-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 14px 16px; border-right: 1px solid var(--h-line); background: var(--h-surface); }
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 16px; color: var(--h-muted); }
.adm-brand img { width: 34px; height: 34px; }
.adm-brand b { color: var(--h-ink); font-family: "Space Grotesk", sans-serif; letter-spacing: -.05em; font-size: 20px; }
#tabs { display: flex; flex-direction: column; gap: 2px; }
#tabs button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--h-muted); font-size: 14px; text-align: left; transition: background .15s var(--h-ease), color .15s; }
#tabs button:hover { background: var(--h-sunk); color: var(--h-ink); }
#tabs [aria-current="page"] { background: var(--h-sun-soft); color: var(--h-ink); font-weight: 500; }
#tabs [aria-current="page"] .adm-ico { color: var(--h-sun-3); }
.adm-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.adm-user { margin-top: auto; display: grid; gap: 1px; padding: 12px 8px 0; border-top: 1px solid var(--h-line); font-size: 13px; overflow-wrap: anywhere; }
.adm-user small { color: var(--h-muted); }
.adm-user button { justify-self: start; margin: 6px 0 0 -8px; }
.adm-main { min-width: 0; padding: 18px clamp(18px, 3vw, 44px) 60px; }
.adm-top { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px; font-size: 12.5px; color: var(--h-muted); }
.adm-env { display: inline-flex; align-items: center; gap: 7px; }
.adm-env::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--h-warn); }
#content { max-width: 1360px; }
#view { transition: opacity .15s; }
#view[aria-busy="true"] { opacity: .55; }
.adm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.adm-head h1, .adm-head p { margin: 0; }
.adm-head p { margin-top: 3px; max-width: 64ch; }
.adm-hero { display: flex; gap: 14px; align-items: center; }
.adm-hero .adm-avatar { width: 52px; height: 52px; font-size: 17px; border-radius: 14px; }
.adm-hero .adm-pills { margin-top: 6px; }
.adm-back { margin: -8px 0 8px -10px; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.adm-actions.is-left { justify-content: flex-start; margin-top: 16px; }
.adm-danger { color: var(--h-crit); border: 1px solid #f1c5c0; background: var(--h-surface); }
.adm-danger:hover { background: #fdecea; }
.adm-stack { display: grid; gap: 16px; }
.adm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.adm-grid2.is-wide { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.adm-stack > .adm-grid2 { margin: 0; }
.adm-card { margin: 0 0 16px; min-width: 0; }
.adm-stack > .adm-card, .adm-grid2 > .adm-card { margin: 0; }
.adm-card h2 { margin: 0; }
.adm-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; min-height: 30px; }
.adm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; border: 1px solid var(--h-line); border-radius: var(--h-radius); background: var(--h-surface); overflow: hidden; }
.adm-kpis.is-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.adm-stack > .adm-kpis { margin: 0; }
.adm-kpi { display: grid; gap: 3px; align-content: start; padding: 16px 18px; border: 0; box-shadow: 1px 0 0 var(--h-line), 0 1px 0 var(--h-line); background: var(--h-surface); text-align: left; color: inherit; min-width: 0; }
button.adm-kpi:hover { background: var(--h-sun-wash); }
.adm-kpi strong { font-size: 22px; line-height: 1.2; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.adm-kpi small { color: var(--h-muted); font-size: 12.5px; }
.adm-kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 8px 20px; margin: 0; font-size: 14px; }
.adm-kv dt { color: var(--h-muted); }
.adm-kv dd { margin: 0; overflow-wrap: anywhere; }
.adm-pills { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.adm-pill { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; background: var(--h-sunk); color: var(--h-ink-2); font-size: 12px; line-height: 1.6; white-space: nowrap; }
.adm-pill[data-tone="ok"] { background: #e4f4ea; color: #17663c; }
.adm-pill[data-tone="warn"] { background: var(--h-warn-soft); color: var(--h-warn-3); }
.adm-pill[data-tone="crit"] { background: #fdecea; color: var(--h-crit); }
.adm-pill[data-tone="epc"] { background: var(--h-sun-soft); color: var(--h-sun-3); }
.adm-pill[data-tone="provider"] { background: #efeafb; color: #4b3a8c; }
.adm-id { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.adm-id b { display: block; font-weight: 500; }
.adm-id small { display: block; color: var(--h-muted); font-size: 12.5px; }
.adm-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--h-sunk); color: var(--h-sun-3); font-size: 12px; font-weight: 600; object-fit: contain; }
.adm-table { border: 1px solid var(--h-line); border-radius: var(--h-radius-sm); background: var(--h-surface); overflow-x: auto; }
.adm-card .adm-table { border: 0; margin: 0 calc(-1 * var(--adm-bleed, 0px)); }
.adm-table table { width: 100%; border-collapse: collapse; }
.adm-table th { font-size: 12px; font-weight: 500; color: var(--h-muted); text-align: left; white-space: nowrap; }
.adm-table th button { border: 0; background: none; padding: 0; color: inherit; font-weight: inherit; }
.adm-table th button:hover { color: var(--h-ink); }
.adm-table th[aria-sort="ascending"] button::after { content: " ↑"; }
.adm-table th[aria-sort="descending"] button::after { content: " ↓"; }
.adm-table th, .adm-table td { padding: 10px 14px; border-bottom: 1px solid var(--h-line); vertical-align: middle; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table td .adm-actions { flex-wrap: nowrap; }
.adm-table tr.is-link { cursor: pointer; }
.adm-table tr.is-link:hover td, .adm-table tr.is-link:focus-visible td { background: var(--h-sun-wash); }
.adm-table code, .adm-kv code { font-family: var(--h-mono); font-size: 12.5px; }
.adm-empty { margin: 0; padding: 22px 0; color: var(--h-muted); }
.adm-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.adm-filters select.h-input, .adm-period { width: auto; min-width: 150px; }
.adm-filters input[type="search"] { width: 260px; max-width: 100%; margin-left: auto; }
.adm-check { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; }
.adm-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 16px; border-radius: 12px; background: var(--h-sunk); width: max-content; max-width: 100%; }
.adm-filters .adm-tabs { margin: 0; }
.adm-tabs button { border: 0; border-radius: 9px; background: none; padding: 6px 13px; color: var(--h-muted); font-size: 13.5px; }
.adm-tabs button:hover { color: var(--h-ink); }
.adm-tabs [aria-selected="true"] { background: var(--h-surface); color: var(--h-ink); box-shadow: 0 1px 2px rgb(11 18 32 / .1); }
.adm-alert { padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--h-warn-line); border-radius: 12px; background: var(--h-warn-soft); color: var(--h-warn-3); font-size: 14px; }
.adm-link { border-color: var(--h-sun-line); background: var(--h-sun-wash); }
.adm-linkrow { display: flex; gap: 8px; margin-top: 10px; }
.adm-linkrow .h-input { flex: 1; min-width: 0; font-family: var(--h-mono); font-size: 12.5px; }
.adm-services, .adm-feed { list-style: none; margin: 0; padding: 0; }
.adm-services li, .adm-feed li { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--h-line); font-size: 14px; }
.adm-services li:last-child, .adm-feed li:last-child { border-bottom: 0; }
.adm-services i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--h-crit); }
.adm-services i[data-ok="true"] { background: #2c9a5f; }
.adm-services span, .adm-feed span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.adm-services b, .adm-feed b { font-weight: 500; }
.adm-services span small { display: block; }
.adm-services small, .adm-feed small { color: var(--h-muted); font-size: 12.5px; white-space: nowrap; }
.adm-services span small { white-space: normal; }
.adm-figure { margin: 0; }
.adm-chart { display: block; width: 100%; height: auto; }
.adm-chart .grid { stroke: var(--h-line); }
.adm-chart text { font-size: 11px; fill: var(--h-muted); }
.adm-figure figcaption { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; color: var(--h-muted); }
.adm-figure i, .adm-swatches i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; }
.adm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.adm-provider[data-active="true"] { border-color: var(--h-sun-line); box-shadow: 0 0 0 3px var(--h-sun-soft); }
.adm-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 5px; }
.adm-brandbox { display: flex; gap: 14px; align-items: center; padding: 16px; border: 1px solid; border-left-width: 5px; border-radius: 12px; }
.adm-brandbox img { width: 52px; height: 52px; object-fit: contain; }
.adm-brandbox small { display: block; color: var(--h-muted); }
.adm-swatches { display: flex; gap: 18px; margin: 12px 0; font-size: 12.5px; color: var(--h-muted); }
.adm-meter { margin-bottom: 14px; font-size: 13.5px; }
.adm-meter > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.adm-meter b { font-weight: 500; }
.adm-meter .bar { height: 6px; border-radius: 99px; background: var(--h-sunk-2); overflow: hidden; }
.adm-meter .bar i { display: block; height: 100%; border-radius: 99px; background: var(--h-sun-2); }
.adm-meter .bar i[data-high="true"] { background: var(--h-crit); }

dialog { width: min(560px, 94vw); max-height: 90vh; overflow: auto; padding: 26px; border: 1px solid var(--h-line); border-radius: 18px; background: var(--h-surface); color: var(--h-ink); box-shadow: 0 24px 80px rgb(11 18 32 / .22); }
dialog::backdrop { background: rgb(11 18 32 / .42); }
dialog h2 { margin: 0 0 4px; font-size: 20px; font-weight: 500; letter-spacing: -.015em; }
dialog .h-small { margin: 0 0 8px; }
dialog .h-small:empty { display: none; }
#fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.adm-field { grid-column: 1 / -1; display: grid; gap: 5px; margin: 0; padding: 0; border: 0; font-size: 13.5px; align-content: start; }
.adm-field.is-half { grid-column: auto; }
.adm-field > span, .adm-field legend { font-weight: 500; padding: 0; }
.adm-field small { color: var(--h-muted); font-size: 12.5px; }
.adm-field .h-input, .adm-field .h-textarea { width: 100%; }
.adm-field input[type="color"] { width: 64px; height: 38px; padding: 2px; border: 1px solid var(--h-line-2); border-radius: 10px; background: var(--h-surface); }
.adm-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }
.adm-checks label { display: inline-flex; gap: 8px; align-items: center; }
#form-error { margin: 14px 0 0; color: var(--h-crit); font-size: 13.5px; }
#form-error:empty { display: none; }
dialog .adm-actions { margin-top: 20px; }

@media (max-width: 1100px) { .adm-kpis.is-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .adm-grid2, .adm-grid2.is-wide { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .adm-side { position: static; height: auto; gap: 12px; padding: 14px 14px 10px; border-right: 0; border-bottom: 1px solid var(--h-line); }
  #tabs { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  #tabs button { width: auto; white-space: nowrap; }
  .adm-user { display: flex; align-items: center; gap: 10px; margin: 0; padding-top: 8px; }
  .adm-user button { margin: 0 0 0 auto; }
  .adm-main { padding: 16px 16px 48px; }
  .adm-filters input[type="search"] { width: 100%; margin: 0; }
  .adm-linkrow { flex-wrap: wrap; }
  .adm-linkrow .h-input { flex-basis: 100%; }
}
@media (max-width: 480px) {
  .adm-kpis { grid-template-columns: 1fr 1fr; }
  .adm-kpi { padding: 13px 14px; }
  .adm-kpi strong { font-size: 18px; }
  .adm-kv { grid-template-columns: 1fr; gap: 2px; }
  .adm-kv dd { margin-bottom: 8px; }
  #fields { grid-template-columns: 1fr; }
  .adm-field.is-half { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
