/* ──────────────────────────────────────────────────────────────────
 * App-specific overrides. The brand baseline + chrome are owned by
 * @genesis/ui (tokens.css + payer-audit.css). Keep this file slim;
 * if you find yourself adding > 60 lines, push the pattern upstream
 * into genesis-ui instead.
 * ────────────────────────────────────────────────────────────────── */

/* Content root inside <gn-app-shell>. Every page renders it, so it carries the
 * gutter for all of them. Set it here and nowhere else. Never pad a page.
 *
 * The shell mounts with content-padding="0". <gn-page-header> is a full-bleed
 * bar, with its own padding, a border-bottom and a surface background. The
 * shell pads its whole default slot, header included. That zero is why the
 * gutter has to live here. 24px lines the body up with the page header's
 * title. The 768px step matches the shell's own.
 *
 * The shell also mounts with content-fill, so the default slot is a flex
 * column. flex: 1 0 auto grows the root to the footer on a short page and
 * keeps a tall page at its content height. */
.app-main {
    flex: 1 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
@media (max-width: 768px) {
    .app-main { padding: 1rem; }
}

/* Gateway/dev sessions have no in-app logout — hide the profile
 * popover's logout row (see base.html) */
gn-user-profile.no-logout::part(logout) {
    display: none;
}

/* KPI grid above <gn-content-table> on home.html */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Login column — constrains form width inside .az-split-form's flex-center */
.az-login-column { width: 100%; max-width: 360px; }

/* Form primitives — genesis-ui does not ship a <gn-input>; raw <input>
 * styled against the brand tokens covers the login + small forms case. */
.az-form { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.az-field { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.az-field__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--az-on-surface);
}
.az-input {
    width: 100%;
    box-sizing: border-box;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--az-outline-variant);
    border-radius: var(--az-radius-md, 6px);
    background: var(--az-surface);
    color: var(--az-on-surface);
    font: 400 14px var(--az-font-body);
}
.az-input:focus {
    outline: 2px solid var(--az-primary);
    outline-offset: -1px;
    border-color: var(--az-primary);
}

/* Inline banner — for high-visibility full-bleed alerts, use
 * <gn-attention-banner> from genesis-ui instead. */
.az-banner {
    padding: 10px 14px;
    border-radius: var(--az-radius-md, 6px);
    font-size: 14px;
    margin: 0 0 12px;
}
.az-banner--error { background: #fdecee; color: #7a0d18; border: 1px solid #f5c2c7; }

/* Microsoft SSO button — matches the .az-split-form column visually */
.az-ms-sso-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid var(--az-outline-variant);
    border-radius: var(--az-radius-md, 6px);
    background: var(--az-surface);
    color: var(--az-on-surface);
    font: 500 14px var(--az-font-body);
    text-decoration: none;
    cursor: pointer;
}
.az-ms-sso-btn:hover { background: var(--gn-primary-light, #ede4fa); }

/* Login "or sign in with credentials" rule */
.az-form-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--az-on-surface-variant);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.az-form-divider::before,
.az-form-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--az-outline-variant);
}
.az-form-divider span { padding: 0 12px; }

/* Section heading above <gn-content-table> blocks */
.az-section-title {
    font-size: var(--az-body-md);
    font-weight: var(--az-weight-medium);
    color: var(--az-on-surface);
    margin: 0 0 8px;
}

/* Audit-log filter bar + Settings edit form — flex row of .az-field columns + button */
.audit-filter-bar,
.config-edit-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 0;
    margin: 0 0 8px;
}
.audit-filter-bar .az-field,
.config-edit-form .az-field { flex: 1 1 160px; min-width: 0; }

/* AI markdown output container — neutral surface, rounded corners */
.ai-output {
    background: var(--az-surface);
    border: 1px solid var(--az-outline-variant);
    border-radius: var(--az-radius-md, 6px);
    padding: 16px;
    line-height: 1.55;
}
/* Evidence page — list beside document, both filling the viewport. */
.evidence-layout {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 1fr;
    gap: 16px;
    height: calc(100vh - 190px);
    min-height: 420px;
}
.evidence-side { overflow-y: auto; }
.evidence-doc { min-width: 0; }
.evidence-doc gn-pdf-preview { height: 100%; }
.evidence-cites { display: flex; flex-direction: column; gap: 4px; }
.evidence-cite {
    text-align: left;
    font: inherit;
    font-size: 12.5px;
    padding: 7px 9px;
    border: 1px solid var(--az-outline-variant);
    border-radius: 6px;
    background: var(--az-surface);
    color: var(--az-on-surface);
    cursor: pointer;
}
.evidence-cite:hover { border-color: var(--az-primary); }

@media (max-width: 860px) {
    .evidence-layout { grid-template-columns: 1fr; height: auto; }
    .evidence-doc { height: 70vh; }
}

/* ── App-specific additions (autonomize-performance) ─────────────── */
.az-banner--ok { background: #e8f5ee; color: #0f5132; border: 1px solid #badbcc; }
.az-hint { font-size: 13px; color: var(--az-on-surface-variant); margin: 4px 0 8px; }
/* Two-column admin layout: list left, forms right; stacks on narrow screens */
.split-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 24px; align-items: start; }
@media (max-width: 960px) { .split-2 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.az-card { border: 1px solid var(--az-outline-variant); border-radius: var(--az-radius-md, 6px); background: var(--az-surface); padding: 16px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
