/* ---------- admin: Content tab (js/28-admin-content.js) ----------
   Builds on 22-admin.css: the same cards, tables, inputs and status dots. The editor
   is a form beside a stack of side cards (checks, preview, changes, versions); it goes
   two-column at the same 1100px container width as the dashboard's 12-column grid. */

.adm-range[hidden] {
    display: none;
}

.ac-nav {
    margin: 22px 0 18px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.ac-nav .chip {
    white-space: nowrap;
}

#acRoot .adm-grid + .adm-note {
    margin-top: 16px;
}

.ac-count {
    display: inline-block;
    min-width: 1.5em;
    padding: 0 5px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font: 600 .7rem 'IBM Plex Mono', monospace;
    text-align: center;
}

.ac-foot {
    margin: 14px 0 0;
}

/* ---------- editor header ---------- */
.ac-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px 18px;
    margin-bottom: 18px;
}

.ac-title {
    flex: 1 1 320px;
    min-width: 0;
}

.ac-title h2 {
    margin: 2px 0 0;
    font-size: 1.7rem;
    line-height: 1.15;
}

.ac-head-state {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.ac-banner {
    border: 1px solid var(--border-strong);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: var(--bg-raised);
    padding: 10px 14px;
    margin: 0 0 14px;
    font-size: .88rem;
}

.ac-banner ul {
    margin: 6px 0 0 1.1em;
    padding: 0;
}

.ac-banner.is-warn { border-left-color: var(--gold); background: var(--gold-soft); }
.ac-banner.is-info { border-left-color: var(--ink-blue); }
.ac-banner.is-drop { border-left-color: var(--danger); background: var(--danger-soft); }

/* ---------- editor layout ---------- */
.ac-editor {
    display: grid;
    gap: 18px;
    align-items: start;
}

.ac-side {
    display: grid;
    gap: 18px;
    min-width: 0;
}

/* The dashboard's grid spans would open implicit columns in these one-column stacks. */
.ac-editor > .adm-card,
.ac-side > .adm-card {
    grid-column: auto;
}

@container adm (min-width: 1100px) {
    .ac-editor {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    }

    .ac-form {
        position: sticky;
        top: 16px;
    }
}

/* ---------- form ---------- */
.ac-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
    min-width: 0;
}

.ac-field > span,
.ac-field-label,
.ac-options legend {
    font: 600 .66rem 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}

.ac-field small {
    font-size: .76rem;
    color: var(--text-muted);
}

.ac-field textarea {
    resize: vertical;
    line-height: 1.5;
}

.ac-field .adm-input:disabled,
.ac-options:disabled .adm-input {
    opacity: .75;
    cursor: not-allowed;
}

.ac-row3 {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
}

.ac-grow {
    flex: 1 1 220px;
}

.ac-options {
    border: none;
    padding: 0;
    margin: 0 0 14px;
    min-width: 0;
}

.ac-options legend {
    padding: 0;
    margin-bottom: 6px;
}

.ac-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

/* Options are often a full legal sentence, so they wrap and grow rather than scroll sideways. */
.ac-option .adm-input {
    flex: 1;
    min-width: 0;
    resize: vertical;
    line-height: 1.45;
    field-sizing: content;
    min-height: 2.4em;
}

.ac-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    width: 52px;
    padding: 7px 8px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
}

.ac-option.is-key .ac-key {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

.ac-option.is-key .adm-input {
    border-color: var(--success);
}

.ac-linked {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ac-chiplink {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    font-size: .82rem;
    padding: 6px 10px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
}

.ac-chiplink:hover {
    border-color: var(--accent);
}

/* ---------- Handouts and Blog fields ---------- */
.ac-field.ac-check > span:last-child {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    font: inherit;
    font-size: .88rem;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text);
}

.ac-file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 10px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    min-width: 0;
}

.ac-file code {
    font: 600 .82rem 'IBM Plex Mono', monospace;
    overflow-wrap: anywhere;
}

.ac-file .adm-sub {
    flex: 1 1 160px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ac-file label.btn {
    cursor: pointer;
}

.ac-file label.btn.is-disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* The Handouts row renders with the page's own styles; only its outer spacing changes. */
.ac-matprev {
    margin: 0;
}

.ac-post h4 {
    margin: 8px 0 4px;
    font-size: 1.2rem;
}

.ac-post .post-detail-body {
    margin-top: 12px;
    font-size: .92rem;
}

/* ---------- actions ---------- */
.ac-actions {
    border-top: 1px dashed var(--border-strong);
    padding-top: 14px;
    margin-top: 6px;
}

.ac-btns {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.ac-textbtn {
    font: inherit;
    font-size: .84rem;
    background: none;
    border: none;
    padding: 4px 2px;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.ac-textbtn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.ac-textbtn.is-danger {
    color: var(--danger);
}

.ac-flash {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--success-soft);
    color: var(--success);
    font-size: .86rem;
    font-weight: 600;
}

.ac-why {
    font-size: .84rem;
    color: var(--text-muted);
    margin: 10px 0 0;
}

.ac-attest {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px dashed var(--gold);
    border-radius: var(--radius);
    font-size: .86rem;
}

.ac-attest input {
    margin-top: 3px;
}

/* ---------- side cards ---------- */
.ac-checks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
    font-size: .85rem;
}

.ac-checks li {
    padding-left: 12px;
    border-left: 3px solid var(--border-strong);
}

.ac-checks b {
    font: 600 .64rem 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    margin-right: 4px;
}

.ac-checks .is-error { border-left-color: var(--danger); }
.ac-checks .is-error b { color: var(--danger); }
.ac-checks .is-warn,
.ac-checks .is-law { border-left-color: var(--gold); }
.ac-checks .is-warn b,
.ac-checks .is-law b { color: var(--gold); }
.ac-checks .is-file { border-left-color: var(--gold); }
.ac-checks .is-file b { color: var(--gold); }
.ac-checks .is-ok { border-left-color: var(--success); color: var(--success); }
.ac-checks .is-info b { color: var(--ink-blue); }
.ac-checks .is-server { color: var(--text-muted); border-left-style: dashed; }

.ac-preview {
    font-size: .92rem;
}

.ac-stem {
    margin: 0 0 10px;
    font-weight: 600;
}

.ac-prev-opts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.ac-prev-opts li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.ac-prev-opts li > b {
    font-family: 'IBM Plex Mono', monospace;
}

.ac-prev-opts li > span {
    flex: 1;
    min-width: 0;
}

.ac-prev-opts li.is-key {
    border-color: var(--success);
}

.ac-prev-opts em {
    font: 600 .62rem 'IBM Plex Mono', monospace;
    font-style: normal;
    text-transform: uppercase;
    color: var(--success);
}

.ac-kp h4 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.ac-kp p {
    margin: 0 0 10px;
}

.ac-diff {
    display: grid;
    gap: 10px;
    margin: 0;
    font-size: .85rem;
}

.ac-diff dt {
    font: 600 .64rem 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ac-diff dd {
    margin: 2px 0 0;
    display: grid;
    gap: 4px;
}

.ac-diff del,
.ac-diff ins {
    display: block;
    padding: 4px 8px;
    border-radius: var(--radius);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.ac-diff del {
    background: var(--danger-soft);
}

.ac-diff del::before { content: '\2212  '; color: var(--danger); font-weight: 700; }

.ac-diff ins {
    background: var(--success-soft);
}

.ac-diff ins::before { content: '+  '; color: var(--success); font-weight: 700; }

/* outranks the two-column log the dashboard sets at 1100px */
.adm-log.ac-versions {
    columns: 1;
}

/* ---------- reports ---------- */
.ac-reports {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.ac-reports li {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: var(--bg);
}

.ac-reports li.is-closed {
    opacity: .7;
}

.ac-reports p {
    margin: 6px 0;
}

.ac-report-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}

.ac-report-head .adm-status {
    margin-left: auto;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
    .ac-head-state {
        align-items: flex-start;
    }

    .ac-field .adm-input,
    .ac-option .adm-input {
        font-size: 16px;
    }

    .ac-btns .btn {
        min-height: 44px;
    }
}

@media (max-width: 560px) {
    .ac-title h2 {
        font-size: 1.4rem;
    }

    .ac-btns .btn {
        flex: 1 1 auto;
    }
}
