/* messaging admin — small additions on top of Bootstrap 5. */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: 2rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .06);
}

.auth-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: .75rem;
    background: var(--bs-dark);
    color: #fff;
    font-size: 1.5rem;
}

/* One-time token reveal: must read as "copy this now, it will not be shown again". */
.token-reveal {
    font-family: var(--bs-font-monospace);
    font-size: .95rem;
    word-break: break-all;
    background: var(--bs-tertiary-bg);
    border: 1px dashed var(--bs-border-color);
    border-radius: .375rem;
    padding: .75rem;
}

.permission-key {
    font-family: var(--bs-font-monospace);
    font-size: .85rem;
}

.table-tokens td {
    vertical-align: middle;
}

/*
 * CakePHP's FormHelper emits validation errors as <div class="error-message">,
 * a class Bootstrap knows nothing about — so they rendered as plain body text,
 * larger and darker than the help text beneath them and reading as prose rather
 * than as a problem. Match Bootstrap's own invalid-feedback treatment.
 */
.error-message {
    color: var(--bs-danger-text-emphasis, #b02a37);
    font-size: .875em;
    margin-top: .25rem;
}

/*
 * Rendered Markdown for the API reference page.
 *
 * Bootstrap styles very little of what a Markdown converter emits -- tables
 * arrive unclassed, and headings inside a card need their own rhythm -- so the
 * generated document is scoped under .api-reference and given it here.
 */
.api-reference {
    max-width: 62rem;
}

.api-reference > h1:first-child {
    display: none; /* the page heading above already says it */
}

.api-reference h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2.25rem 0 .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.api-reference h2:first-of-type {
    margin-top: .5rem;
}

.api-reference h3 {
    font-size: .98rem;
    font-weight: 600;
    margin: 1.6rem 0 .5rem;
}

.api-reference p,
.api-reference li {
    font-size: .94rem;
    line-height: 1.65;
}

.api-reference code {
    font-size: .86em;
    background: var(--bs-tertiary-bg);
    padding: .1em .35em;
    border-radius: 3px;
    color: var(--bs-emphasis-color);
}

.api-reference pre {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    padding: .9rem 1rem;
    overflow-x: auto;
    font-size: .82rem;
    line-height: 1.55;
}

.api-reference pre code {
    background: none;
    padding: 0;
}

/* Tables arrive unclassed from the converter, so they are styled by element. */
.api-reference table {
    width: 100%;
    margin-bottom: 1.25rem;
    font-size: .85rem;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    display: block;
    overflow-x: auto;
}

.api-reference thead th {
    text-align: left;
    font-weight: 600;
    background: var(--bs-tertiary-bg);
    border-bottom: 2px solid var(--bs-border-color);
    padding: .45rem .6rem;
    white-space: nowrap;
}

.api-reference tbody td {
    border-bottom: 1px solid var(--bs-border-color);
    padding: .45rem .6rem;
    vertical-align: top;
}

.api-reference blockquote {
    border-left: 3px solid var(--bs-border-color);
    padding: .25rem 0 .25rem 1rem;
    margin: 0 0 1.25rem;
    color: var(--bs-secondary-color);
    font-size: .92rem;
}


}

/*
 * Audit log.
 *
 * The table is for scanning: one line per entry, payloads behind a modal. The
 * previous version inlined JSON into a cell, which made every row a different
 * height and none of them readable.
 */
.audit-table {
    font-size: .85rem;
}

.audit-table thead th {
    font-size: .7rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    font-weight: 600;
    white-space: nowrap;
}

.audit-table td {
    vertical-align: middle;
}

.audit-table tbody tr:hover {
    background: var(--bs-tertiary-bg);
}

.audit-subject {
    font-family: var(--bs-font-monospace);
    font-size: .8rem;
}

.audit-fields {
    font-size: .74rem;
}

/* ---- detail modal ---- */

.audit-meta {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .3rem 1.25rem;
    margin: 0 0 1.5rem;
    font-size: .85rem;
}

.audit-meta dt {
    color: var(--bs-secondary-color);
    font-weight: 500;
    white-space: nowrap;
}

.audit-meta dd {
    margin: 0;
    font-family: var(--bs-font-monospace);
    font-size: .8rem;
    word-break: break-all;
}

#audit-modal-payloads section {
    margin-bottom: 1.5rem;
}

#audit-modal-payloads h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    margin: 0 0 .4rem;
}

#audit-modal-payloads pre {
    margin: 0;
    padding: .8rem 1rem;
    max-height: 30rem;
    overflow: auto;
    font-size: .78rem;
    line-height: 1.55;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .25rem;
}
