/* MX Admin (docs/spec-mx-admin.md): the screens share one frame — sections on the left, the screen on the right —,
   state shown as pills and stat tiles, tables that scroll inside their box. */
.adm {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    padding-block: 0.5rem 2rem;
}

.adm-nav {
    position: sticky;
    top: 0.5rem;
    display: grid;
    gap: 2px;
    font-size: 0.88rem;
}

.adm-nav .adm-sep {
    padding: 0.8rem 0.6rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mx-muted);
}

.adm-nav a {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--mx-radius-sm);
    color: var(--mx-ink-soft) !important;
    text-decoration: none;
}

.adm-nav a:hover { background: var(--mx-mist); }

/* The client worked on, then its advertiser: above the sections, which follow them. */
.adm-scope {
    display: grid;
    gap: 0.45rem;
    padding: 0.6rem;
    border: 1px solid var(--mx-line);
    border-radius: var(--mx-radius-sm);
    background: var(--mx-surface);
}
.adm-scope label { display: grid; gap: 0.15rem; margin: 0; }
.adm-scope label span { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mx-muted); }
.adm-scope-name { font-weight: 700; color: var(--mx-ink); }
.adm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; }
.adm-card {
    display: grid;
    gap: 0.35rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--mx-line);
    border-radius: var(--mx-radius-sm);
    background: var(--mx-surface);
    text-align: left;
    color: inherit;
}
.adm-card:hover { border-color: var(--mx-admin); }
.adm-card.on { border-color: var(--mx-admin); background: var(--mx-admin-tint); }
.adm-card b { font-size: 1.05rem; color: var(--mx-ink); }
.adm-nav a.active { background: var(--mx-admin-tint); color: var(--mx-ink) !important; font-weight: 700; }
.adm-nav small { color: var(--mx-muted); }

.adm-main { min-width: 0; display: grid; gap: 1.1rem; align-content: start; }

.adm-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.6rem 1rem; }
.adm-head .adm-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.7rem; }
.adm-stat {
    display: block;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--mx-line);
    border-radius: var(--mx-radius-sm);
    background: var(--mx-surface);
    color: inherit !important;
    text-decoration: none;
}
.adm-stat b { display: block; font-size: 1.5rem; line-height: 1.2; color: var(--mx-ink); font-variant-numeric: tabular-nums; }
.adm-stat span { font-size: 0.78rem; color: var(--mx-muted); }
a.adm-stat:hover { border-color: var(--mx-admin); }

.adm-box {
    border: 1px solid var(--mx-line);
    border-radius: var(--mx-radius-sm);
    background: var(--mx-surface);
    padding: 0.9rem 1rem;
    min-width: 0;
}
.adm-box h3 { font-size: 0.95rem; font-weight: 700; color: var(--mx-ink); margin: 0 0 0.6rem; }

.adm-table-wrap { overflow-x: auto; border: 1px solid var(--mx-line); border-radius: var(--mx-radius-sm); background: var(--mx-surface); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.adm-table th, .adm-table td { padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--mx-line); text-align: left; vertical-align: top; }
.adm-table th { background: var(--mx-mist); color: var(--mx-ink); font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table tr.adm-click { cursor: pointer; }
.adm-table tr.adm-click:hover td { background: var(--mx-mist); }
.adm-table code { font-size: 0.8rem; }

.adm-pill { display: inline-block; padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.adm-pill.ok { color: #1f7a4f; background: #e2f3ea; }
.adm-pill.warn { color: #8a5200; background: #fbefd9; }
.adm-pill.bad { color: #a12a22; background: #fbe4e2; }
.adm-pill.idle { color: var(--mx-muted); background: var(--mx-mist); }
.adm-pill.info { color: var(--mx-admin-ink); background: var(--mx-admin-tint); }

.adm-todo { display: grid; gap: 0.4rem; }
.adm-todo a, .adm-todo div {
    display: block;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--mx-line);
    border-left: 3px solid #d89a2b;
    border-radius: var(--mx-radius-sm);
    background: var(--mx-surface);
    color: var(--mx-ink-soft) !important;
    text-decoration: none;
    font-size: 0.86rem;
}
.adm-todo .error { border-left-color: #c8443a; }
.adm-todo b { color: var(--mx-ink); }

.adm-tabs { display: flex; flex-wrap: wrap; gap: 0.2rem; border-bottom: 1px solid var(--mx-line); }
.adm-tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.86rem;
    color: var(--mx-muted);
}
.adm-tabs button.on { color: var(--mx-ink); font-weight: 700; border-bottom-color: var(--mx-admin); }
/* The tabs of an universe in groups: the declaration, the exploitation, the rest. */
.adm-tab-set { display: flex; flex-wrap: wrap; gap: 0.2rem; align-items: center; padding-left: 0.7rem; border-left: 1px solid var(--mx-line); }
.adm-tab-set:first-child { padding-left: 0; border-left: 0; }
.adm-tab-group { padding-right: 0.2rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mx-muted); }

.adm-muted { color: var(--mx-muted); font-size: 0.84rem; }
.adm-error { color: #a12a22; font-size: 0.86rem; }
.adm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem 1rem; align-items: end; }
.adm-form label { display: grid; gap: 0.2rem; font-size: 0.8rem; color: var(--mx-muted); }
.adm-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.adm-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--mx-mist); font-size: 0.78rem; }
.adm-chip button { border: 0; background: none; padding: 0; line-height: 1; color: var(--mx-muted); }
.adm-bar { height: 6px; min-width: 70px; border-radius: 3px; background: var(--mx-mist); overflow: hidden; }
.adm-bar i { display: block; height: 100%; background: var(--mx-admin); }
.adm-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.adm-filters .form-control, .adm-filters .form-select { width: auto; min-width: 12rem; }

@media (max-width: 860px) {
    .adm { grid-template-columns: minmax(0, 1fr); }
    .adm-nav { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .adm-nav .adm-sep { grid-column: 1 / -1; }
}

/* MX Manager, T1: the bases and what the universes do not read. */
.adm-good { color: #1f7a4d; font-weight: 600; }
.adm-bad { color: #a33; font-weight: 600; }
.adm-dim td { color: var(--mx-muted); }
.adm-num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-check { display: inline-flex; align-items: center; gap: 4px; font-size: 0.84rem; }
.adm-section { margin: 10px 0; }
.adm-section summary { cursor: pointer; }
.adm-report { white-space: pre-wrap; font-size: 0.8rem; max-height: 36rem; overflow: auto; padding: 10px; border: 1px solid var(--mx-line); border-radius: 6px; background: var(--mx-surface); }
.adm-add { margin: 10px 0 16px; padding: 12px; border: 1px solid var(--mx-accent-line); border-radius: 8px; background: var(--mx-surface); display: flex; flex-direction: column; gap: 10px; }
.adm-add h3 { margin: 0; font-size: 1rem; }
.adm-add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 8px 14px; }
.adm-add-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; }
.adm-inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.adm-inline .form-control, .adm-inline .form-select { width: auto; min-width: 6rem; }

.adm-media { font-size: 1rem; font-weight: 700; margin: 1.2rem 0 0.4rem; }

/* T4a: the tasks of MX Manager. */
.adm-task-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.8rem; }
.adm-task-kind { display: flex; flex-direction: column; gap: 0.4rem; margin: 0; }
.adm-task-kind h3 { font-size: 0.95rem; margin: 0; }
.adm-task-kind p { margin: 0; font-size: 0.8rem; }
.adm-task-kind .btn { align-self: flex-start; margin-top: auto; }
.adm-task-param { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.78rem; }
.adm-task-log { max-height: 420px; overflow: auto; background: var(--mx-mist); padding: 0.6rem; font-size: 0.74rem; white-space: pre-wrap; margin: 0; }
.adm-table tr.adm-selected td { background: var(--mx-mist); }
.adm-compact { margin: 0.2rem 0; padding-left: 1.1rem; font-size: 0.8rem; }
.adm-inline .adm-narrow { min-width: 0; width: auto; }

/* MX Manager: no second menu — the client and advertiser chosen in a bar above the page. */
.adm.adm-manager { display: block; }
.adm.adm-manager .adm-nav { position: static; width: auto; height: auto; border: 0; border-bottom: 1px solid var(--mx-line); background: transparent; padding: 0 0 0.5rem; margin-bottom: 0.75rem; }
.adm.adm-manager .adm-scope { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.adm.adm-manager .adm-scope label { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.adm.adm-manager .adm-scope .form-select { width: auto; min-width: 12rem; }

/* S1: a source's fields × universes. */
.adm-matrix td[class^="adm-cell-"] { text-align: center; font-weight: 700; }
.adm-matrix .adm-cell-same { color: #1f7a4f; }
.adm-matrix .adm-cell-different { color: #8a5200; background: #fbefd9; }
.adm-matrix .adm-cell-missing { background: var(--mx-mist); }
.adm-matrix th { white-space: normal; min-width: 7rem; }

/* T6: a trunk's views and the table of its states — the state said by the view in bold on a tint, the trunk's plain. */
.adm-tronc th.adm-tronc-client { text-align: center; border-bottom: 2px solid var(--mx-line); }
.adm-tronc td.adm-tronc-cell { text-align: center; white-space: nowrap; }
.adm-tronc .adm-tronc-trunk { color: var(--mx-muted); }
.adm-tronc .adm-tronc-view { font-weight: 700; color: var(--mx-admin-ink); background: var(--mx-admin-tint); }
.adm-tronc .adm-tronc-closed.adm-tronc-view { color: #a12a22; background: #fbe4e2; }
.adm-tronc .adm-tronc-kept { outline: 1px dashed currentColor; outline-offset: -3px; }
.adm-tronc .adm-tronc-none { background: var(--mx-mist); }
.adm-table tr.adm-tronc-reader td:first-child { padding-left: 1.6rem; }
.adm-tronc td.adm-click { cursor: pointer; }
/* The table of the states stays narrow: a view's column of a fixed width (its title on three short lines at most, whole in
   its tooltip), the field's column held at the left while the table scrolls across, the heads held at the top. */
.adm-tronc { width: auto; }
.adm-tronc thead tr:first-child th { top: 0; height: 2.1rem; z-index: 3; }
.adm-tronc thead tr:nth-child(2) th { top: 2.1rem; z-index: 3; }
.adm-tronc th.adm-tronc-client { max-width: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-tronc th.adm-tronc-col, .adm-tronc td.adm-tronc-cell { width: 5.5rem; min-width: 5.5rem; max-width: 5.5rem; padding-left: .3rem; padding-right: .3rem; }
.adm-tronc th.adm-tronc-col { white-space: normal; font-size: .76rem; line-height: 1.15; vertical-align: bottom; }
.adm-tronc .adm-tronc-name { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.adm-tronc .adm-tronc-default { width: 5rem; min-width: 5rem; white-space: nowrap; }
.adm-tronc .adm-tronc-field { position: sticky; left: 0; z-index: 2; background: var(--mx-surface); min-width: 12rem; max-width: 18rem; white-space: normal; box-shadow: 1px 0 0 var(--mx-line); }
/* Above the client headers that scroll under it: as specific as the header rows' rule, and more. */
.adm-tronc thead tr:first-child th.adm-tronc-field { z-index: 4; background: var(--mx-mist); }
.adm-tronc-filters { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .5rem; }
.adm-tronc-filters input[type="search"] { max-width: 18rem; }
/* A field's state chosen in place: a small panel floating where it is put, the table does not move. */
.adm-state-anchor { position: relative; display: inline-block; width: 0; height: 0; vertical-align: top; }
.adm-state-picker { position: absolute; top: 1.3rem; left: -3rem; z-index: 30; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center;
    width: max-content; max-width: 24rem; padding: .35rem .45rem; font-weight: 400; text-align: left; white-space: nowrap;
    background: var(--mx-surface); border: 1px solid var(--mx-line); border-radius: var(--mx-radius-sm); box-shadow: 0 4px 14px rgba(0, 0, 0, .14); }
.adm-state-picker .btn { white-space: nowrap; }
.adm-state-left .adm-state-picker { left: auto; right: 0; }
.adm-state-picker .adm-state-note { flex-basis: 100%; white-space: normal; }
.adm-profile-filter { max-width: 14rem; }
.adm-tronc-of { font-weight: 600; color: var(--mx-admin-ink); }
.adm-task-follow .adm-task-log { max-height: 40vh; }
