/*
 * TPC design layer on top of vendored Bootstrap 5. Bootstrap still provides the grid, forms and
 * utilities used by the tenant wizard/detail pages; everything here gives the console its look:
 * a dark sidebar, quiet cards, pill badges and status callouts.
 */

:root {
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;
    --line: #e5e7eb;
    --line-2: #eef0f4;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f8fafc;

    --blue: #2448d8;
    --blue-hover: #1d3bb8;
    --blue-soft: #eef2fe;
    --blue-line: #c7d4fb;
    --green: #15803d;
    --green-soft: #e9f7ef;
    --red: #b91c1c;
    --red-soft: #fdf0f0;
    --red-line: #f5c2c2;
    --amber: #a16207;
    --amber-soft: #fdf6e3;
    --amber-line: #f1dca4;
    --violet: #6d28d9;
    --violet-soft: #f3effd;

    --side-bg: #0f172a;
    --side-ink: #cbd5e1;
    --side-muted: #8391a7;
    --side-hover: #1a2438;
    --side-active: #1e293b;
    --side-line: #2a364c;

    --radius: 12px;
    --radius-sm: 8px;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --sans: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    --bs-primary: var(--blue);
    --bs-primary-rgb: 36, 72, 216;
    --bs-body-font-family: var(--sans);
    --bs-body-color: var(--ink);
    --bs-border-color: var(--line);
    --bs-link-color: var(--blue);
    --bs-link-color-rgb: 36, 72, 216;
    --bs-link-hover-color: var(--blue-hover);
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

code, .mono {
    font-family: var(--mono);
}

code {
    color: var(--ink-2);
    font-size: .86em;
}

a {
    color: var(--blue);
}

.icon {
    width: 18px;
    height: 18px;
    flex: none;
}

/* ── App shell ───────────────────────────────────────── */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    background: var(--side-bg);
    color: var(--side-ink);
    display: flex;
    flex-direction: column;
    padding: 20px 12px 16px;
    z-index: 10;
    overflow-y: auto;
}

.page {
    margin-left: 232px;
    padding: 32px 32px 48px;
    min-height: 100vh;
}

.page-narrow {
    max-width: 1040px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
    color: #fff;
    text-decoration: none;
}

.brand:hover {
    color: #fff;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-size: 15px;
}

.brand-text small {
    color: var(--side-muted);
    font-size: 12px;
}

.side-status {
    margin: 0 2px 20px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.side-status-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.side-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.side-status.down {
    background: #2a1018;
    border: 1px solid #5f1d27;
    color: #fde2e2;
}

.side-status.down .dot {
    background: #f87171;
}

.side-status.down a {
    color: #fca5a5;
    font-size: 12.5px;
}

.side-status-note {
    color: #f3b4b4;
    font-size: 12px;
}

.side-status.up {
    background: transparent;
    border: 1px solid var(--side-line);
    color: var(--side-ink);
    padding: 7px 12px;
}

.side-status.up .dot {
    background: #4ade80;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-label {
    color: var(--side-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 14px 10px 8px;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    color: var(--side-ink);
    text-decoration: none;
    font-weight: 500;
}

.side-nav a:hover {
    background: var(--side-hover);
    color: #fff;
}

.side-nav a.active {
    background: var(--side-active);
    border-color: var(--side-line);
    color: #fff;
    font-weight: 600;
}

.side-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 8px 0;
    border-top: 1px solid var(--side-line);
}

.side-user form {
    margin: 0 0 0 auto;
}

.side-user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.side-user-text strong {
    color: #fff;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-user-text small {
    color: var(--side-muted);
    font-size: 12px;
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #334155;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex: none;
}

.avatar.light {
    background: var(--blue-soft);
    color: var(--blue);
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--side-ink);
}

.icon-button:hover {
    background: var(--side-hover);
    color: #fff;
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
        padding: 14px 16px;
    }

    .side-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .side-label {
        display: none;
    }

    .side-user {
        margin-top: 12px;
    }

    .page {
        margin-left: 0;
        padding: 24px 16px 40px;
    }
}

/* ── Page header ─────────────────────────────────────── */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.page-head h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0 0 4px;
}

.page-head p {
    color: #475569;
    margin: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 10px;
}

.back-link .icon {
    width: 16px;
    height: 16px;
}

/* ── Buttons ─────────────────────────────────────────── */

.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--radius-sm);
    --bs-btn-padding-x: 14px;
    --bs-btn-padding-y: 8px;
    --bs-btn-font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn .icon {
    width: 16px;
    height: 16px;
}

.btn-sm {
    --bs-btn-padding-x: 10px;
    --bs-btn-padding-y: 5px;
    --bs-btn-font-size: 13px;
}

.btn-primary {
    --bs-btn-bg: var(--blue);
    --bs-btn-border-color: var(--blue);
    --bs-btn-hover-bg: var(--blue-hover);
    --bs-btn-hover-border-color: var(--blue-hover);
    --bs-btn-active-bg: var(--blue-hover);
    --bs-btn-active-border-color: var(--blue-hover);
    --bs-btn-disabled-bg: var(--blue);
    --bs-btn-disabled-border-color: var(--blue);
}

.btn-outline-secondary,
.btn-light,
.btn-quiet {
    --bs-btn-color: var(--ink);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: #d9dde5;
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--surface-2);
    --bs-btn-hover-border-color: #c5cad4;
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-bg: #eef1f5;
    --bs-btn-active-border-color: #c5cad4;
    --bs-btn-font-weight: 500;
}

.btn-outline-danger,
.btn-danger-quiet {
    --bs-btn-color: var(--red);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--red-line);
    --bs-btn-hover-color: var(--red);
    --bs-btn-hover-bg: var(--red-soft);
    --bs-btn-hover-border-color: #eaa5a5;
    --bs-btn-active-color: var(--red);
    --bs-btn-active-bg: var(--red-soft);
    --bs-btn-active-border-color: #eaa5a5;
    --bs-btn-disabled-color: #e08b8b;
    --bs-btn-disabled-bg: var(--surface);
    --bs-btn-disabled-border-color: #f6dada;
    --bs-btn-font-weight: 500;
}

.btn-link {
    --bs-btn-font-weight: 600;
    text-decoration: none;
}

/* ── Cards / panels ──────────────────────────────────── */

.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.panel {
    padding: 24px;
    margin-bottom: 20px;
}

.panel-flush {
    padding: 0;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-flush > .panel-head {
    padding: 20px 20px 0;
}

.panel h2,
.panel-title {
    font-size: 19px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-sub {
    color: var(--muted);
    font-size: 14px;
    margin: 2px 0 0;
}

.panel-lead {
    color: #475569;
    max-width: 700px;
    margin: -6px 0 18px;
}

.panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line-2);
    padding-top: 16px;
    margin-top: 20px;
}

/* ── Pills (badges) ──────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
}

.pill-success { background: var(--green-soft); color: var(--green); }
.pill-danger { background: var(--red-soft); color: var(--red); }
.pill-warning { background: var(--amber-soft); color: var(--amber); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-muted { background: transparent; color: var(--muted); font-weight: 500; padding: 2px 0; }

.chip {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--ink-2);
    white-space: nowrap;
}

.code-tag {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: .02em;
    color: var(--muted);
    text-transform: uppercase;
}

/* ── Notices (callouts) ──────────────────────────────── */

.notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 13px 16px;
    border-radius: 10px;
    border: 1px solid;
    margin-bottom: 20px;
    font-size: 14.5px;
}

.notice > .icon {
    margin-top: 1px;
}

.notice a {
    font-weight: 600;
}

.notice-info { background: #f1f5fe; border-color: #d3ddfa; color: var(--ink); }
.notice-info > .icon { color: var(--blue); }
.notice-success { background: var(--green-soft); border-color: #bfe6cd; color: #14532d; }
.notice-success > .icon { color: var(--green); }
.notice-danger { background: var(--red-soft); border-color: var(--red-line); color: #7f1d1d; }
.notice-danger > .icon { color: var(--red); }
.notice-warning { background: var(--amber-soft); border-color: var(--amber-line); color: #713f12; }
.notice-warning > .icon { color: var(--amber); }

.notice-secret {
    background: var(--surface);
    border-color: var(--blue-line);
    flex-wrap: wrap;
}

.secret {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 15px;
    padding: 4px 6px 4px 12px;
    border: 1px dashed var(--blue-line);
    border-radius: 8px;
    background: var(--blue-soft);
}

/* ── Forms ───────────────────────────────────────────── */

.form-label,
.field-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border-color: #d9dde5;
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 15px;
}

.form-control:focus,
.form-select:focus {
    border-color: #8ea4f0;
    box-shadow: 0 0 0 3px rgba(36, 72, 216, .14);
}

.form-control.is-invalid {
    border-color: #dc2626;
    background-image: none;
    padding-right: 12px;
}

.field-error {
    color: var(--red);
    font-size: 13px;
    margin-top: 6px;
}

.form-text {
    color: var(--muted);
    font-size: 13px;
}

.form-text code,
.field-error code {
    font-size: .95em;
}

/* Segmented control built from radios. */
.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #eef0f4;
    border-radius: 10px;
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented label {
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
}

.segmented input:checked + label {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .1);
}

.segmented input:focus-visible + label {
    outline: 2px solid #8ea4f0;
}

.segmented.inline {
    display: inline-flex;
}

/* Radio cards. */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.choice {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    background: var(--surface);
}

.choice input {
    margin-top: 3px;
    accent-color: var(--blue);
    width: 16px;
    height: 16px;
    flex: none;
}

.choice strong {
    display: block;
    font-weight: 600;
}

.choice small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.choice:has(input:checked) {
    border: 2px solid var(--blue);
    background: #f7f9ff;
    padding: 15px 17px;
}

/* Toggle switch (a checkbox). */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}

.switch input {
    appearance: none;
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    cursor: pointer;
    transition: background .15s;
    margin: 0;
}

.switch input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform .15s;
}

.switch input:checked {
    background: var(--blue);
}

.switch input:checked::after {
    transform: translateX(16px);
}

.switch input:focus-visible {
    outline: 2px solid #8ea4f0;
    outline-offset: 2px;
}

/* ── Tables ──────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}

.data-table th {
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    background: var(--surface-2);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td {
    background: #fafbfc;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    --bs-table-hover-bg: #fafbfc;
}

.table > thead.table-light th,
.table thead th {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.who {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    white-space: nowrap;
}

.row-actions form {
    margin: 0;
}

/* Skeleton rows while CyIAM is unreachable. */
.skeleton-row {
    display: grid;
    grid-template-columns: 2.2fr 1.6fr 1fr 1.6fr 1fr;
    gap: 24px;
    padding: 20px 16px;
    border-top: 1px solid var(--line-2);
}

.skeleton-row span {
    height: 10px;
    border-radius: 999px;
    background: #edf0f4;
}

/* ── Settings ────────────────────────────────────────── */

.settings-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.subnav {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.subnav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 14.5px;
}

.subnav a:hover {
    background: #eceff3;
}

@media (max-width: 900px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .subnav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.status-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    margin-bottom: 20px;
}

.status-box.down {
    background: var(--red-soft);
    border-color: var(--red-line);
}

.status-box.up {
    background: #f4fbf6;
    border-color: #cbead6;
}

.status-box-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 4px;
}

.status-box .endpoint {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--ink);
}

.status-box .why {
    color: #475569;
    font-size: 13px;
    margin-top: 2px;
}

.key-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 12px;
}

.key-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.key-id {
    font-family: var(--mono);
    font-size: 17px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-meta {
    color: #475569;
    font-size: 14px;
    margin-top: 2px;
}

.key-facts {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 6px 12px;
    margin: 16px 0 0;
    font-size: 13.5px;
}

.key-facts dt {
    color: var(--muted);
    font-weight: 400;
}

.key-facts dd {
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.key-facts .fingerprint {
    font-family: var(--mono);
    font-size: 12.5px;
    word-break: break-all;
}

.copy-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0 2px;
    line-height: 1;
}

.copy-btn .icon {
    width: 15px;
    height: 15px;
}

.copy-btn:hover,
.copy-btn.copied {
    color: var(--blue);
}

details.disclosure > summary {
    list-style: none;
    cursor: pointer;
    color: var(--blue);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

details.disclosure > summary::-webkit-details-marker {
    display: none;
}

details.disclosure > summary::before {
    content: "";
    border: 5px solid transparent;
    border-left: 7px solid currentColor;
    border-right: 0;
    transition: transform .15s;
}

details.disclosure[open] > summary::before {
    transform: rotate(90deg);
}

details.disclosure > .disclosure-body {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line-2);
}

/* ── Email ───────────────────────────────────────────── */

.template-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-top: 1px solid var(--line-2);
}

.tile-icon {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--violet-soft);
    color: var(--violet);
    flex: none;
}

.template-row .grow {
    flex: 1;
    min-width: 0;
}

.template-row .title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-weight: 600;
}

.template-row .desc {
    color: #475569;
    font-size: 14px;
}

.template-row .subject {
    font-size: 14px;
}

.preview-stage {
    background: #f1f3f6;
    padding: 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.mail-frame {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.mail-headers {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 4px 12px;
    padding: 12px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}

.mail-headers dt {
    color: var(--muted);
    font-weight: 400;
}

.mail-headers dd {
    margin: 0;
}

.mail-frame iframe {
    display: block;
    width: 100%;
    min-height: 380px;
    border: 0;
}

.preview-note {
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 14px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    border: 1px solid #d9dde5;
    border-bottom: 0;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--surface-2);
}

.editor-toolbar button {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 13px;
    color: var(--ink-2);
}

.editor-toolbar button:hover {
    background: #fff;
    border-color: var(--line);
}

.editor-toolbar .sep {
    width: 1px;
    background: var(--line);
    margin: 2px 4px;
}

.wysiwyg {
    border: 1px solid #d9dde5;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 16px;
    min-height: 300px;
    background: #fff;
    overflow: auto;
}

.wysiwyg:focus {
    outline: 3px solid rgba(36, 72, 216, .14);
    border-color: #8ea4f0;
}

.source-area {
    width: 100%;
    min-height: 340px;
    font-family: var(--mono);
    font-size: .85rem;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.placeholder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.placeholder-list button {
    font-family: var(--mono);
    font-size: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 6px;
    padding: 2px 7px;
    color: var(--ink-2);
}

.placeholder-list button:hover {
    border-color: var(--blue-line);
    color: var(--blue);
}

/* ── Audit ───────────────────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.stat span {
    color: #475569;
    font-size: 13.5px;
}

.stat strong {
    display: block;
    font-size: 24px;
    font-weight: 700;
    margin-top: 2px;
}

.stat.bad strong {
    color: var(--red);
}

@media (max-width: 760px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-chips a {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #d9dde5;
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    background: var(--surface);
}

.filter-chips a:hover {
    border-color: #b9c0cc;
}

.filter-chips a.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--ink-2);
    margin: 0;
    cursor: pointer;
}

.check-inline input {
    accent-color: var(--blue);
    width: 15px;
    height: 15px;
}

.day-head {
    display: flex;
    justify-content: space-between;
    padding: 9px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
    font-weight: 600;
}

.day-head small {
    color: var(--muted);
    font-weight: 400;
}

.event {
    display: grid;
    grid-template-columns: 56px minmax(170px, 1.3fr) minmax(110px, .9fr) minmax(0, 3fr) 84px;
    gap: 16px;
    align-items: start;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-2);
    font-size: 14px;
}

.event.failed {
    background: #fffbfb;
}

.event-time {
    font-family: var(--mono);
    color: #475569;
    padding-top: 2px;
}

.event-what {
    display: flex;
    gap: 10px;
}

.event-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    flex: none;
    background: #f1f5f9;
    color: #475569;
}

.event-icon .icon {
    width: 15px;
    height: 15px;
}

.event-icon.license { background: var(--blue-soft); color: var(--blue); }
.event-icon.building { background: var(--green-soft); color: var(--green); }
.event-icon.mail { background: var(--violet-soft); color: var(--violet); }
.event-icon.key { background: var(--amber-soft); color: var(--amber); }

.event-title {
    font-weight: 600;
    line-height: 1.3;
}

.event-target {
    padding-top: 2px;
    word-break: break-word;
}

.event-detail .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.event-fix {
    color: #b45309;
    font-size: 13px;
    margin-top: 4px;
}

.event-outcome {
    text-align: right;
}

.event-actor {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 2px;
}

@media (max-width: 900px) {
    .event {
        grid-template-columns: 48px 1fr;
    }

    .event-target,
    .event-detail,
    .event-outcome {
        grid-column: 2;
        text-align: left;
    }
}

.pager {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

/* ── Unreachable state (tenants) ─────────────────────── */

.outage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
}

.outage-main {
    display: flex;
    gap: 16px;
}

.outage-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--red-soft);
    color: #dc2626;
    flex: none;
}

.outage h2 {
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 6px;
}

.outage p {
    color: #475569;
    margin: 0 0 10px;
}

.outage-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13.5px;
    color: #475569;
    margin-bottom: 16px;
}

.outage-facts code {
    color: var(--ink);
}

.outage-causes {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px;
    font-size: 13.5px;
    color: var(--ink-2);
}

.outage-causes h3 {
    font-size: 11.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #475569;
    font-weight: 600;
    margin: 0 0 8px;
}

.outage-causes ul {
    margin: 0;
    padding-left: 18px;
}

.outage-causes li + li {
    margin-top: 6px;
}

@media (max-width: 900px) {
    .outage {
        grid-template-columns: 1fr;
    }
}

/* ── Login ───────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--side-bg);
    padding: 24px 16px;
}

.login-card {
    width: 380px;
    max-width: 100%;
    background: var(--surface);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

.login-card .brand {
    color: var(--ink);
    padding: 0 0 20px;
}

.login-card .brand-text small {
    color: var(--muted);
}

/* ── Shared bits used by the tenant pages ────────────── */

.kv {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line-2);
}

.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; word-break: break-all; text-align: right; }
.kv .v.mono { font-family: var(--mono); }

.alert {
    border-radius: 10px;
    font-size: 14.5px;
}

.stepper {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 0 0 1.25rem;
}

.stepper li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: .875rem;
    font-weight: 600;
}

.stepper li .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #eef2f7;
    color: var(--muted);
    font-size: .75rem;
}

.stepper li.active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.stepper li.active .num { background: var(--blue); color: #fff; }
.stepper li.done { border-color: #bbf7d0; color: var(--green); background: #f0fdf4; }
.stepper li.done .num { background: #16a34a; color: #fff; }

.tenant-logo {
    height: 48px;
    max-width: 120px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px;
    background: #fff;
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
}

/* ── Bootstrap components on the tenant pages, in the console's palette ── */

.card-body {
    padding: 22px 24px;
}

.card-body > h2.h5,
.card-body > .h5 {
    font-size: 17px;
    font-weight: 600;
}

.badge {
    font-weight: 600;
    font-size: 12.5px;
    padding: 4px 9px;
    border-radius: 999px;
}

.badge.text-bg-success { background: var(--green-soft) !important; color: var(--green) !important; }
.badge.text-bg-warning { background: var(--amber-soft) !important; color: var(--amber) !important; }
.badge.text-bg-danger { background: var(--red-soft) !important; color: var(--red) !important; }
.badge.text-bg-info { background: var(--blue-soft) !important; color: var(--blue) !important; }
.badge.text-bg-secondary,
.badge.text-bg-light { background: #f1f5f9 !important; color: #475569 !important; border: 0 !important; }
.badge.text-bg-primary { background: var(--blue-soft) !important; color: var(--blue) !important; }

.alert-success { background: var(--green-soft); border-color: #bfe6cd; color: #14532d; }
.alert-danger { background: var(--red-soft); border-color: var(--red-line); color: #7f1d1d; }
.alert-warning { background: var(--amber-soft); border-color: var(--amber-line); color: #713f12; }
.alert-info { background: #f1f5fe; border-color: #d3ddfa; color: var(--ink); }

.page-head .text-muted code {
    color: var(--ink-2);
}

/* ── Tenant list ─────────────────────────────────────── */

.side-status.up {
    background: #0e2a1c;
    border: 1px solid #1d5a37;
    color: #86efac;
    padding: 9px 12px;
}

.pill .icon {
    width: 12px;
    height: 12px;
    stroke-width: 2.6;
}

.notice-action {
    align-items: center;
}

.notice .grow {
    flex: 1;
    min-width: 0;
}

.notice-actions {
    display: flex;
    gap: 8px;
    flex: none;
}

@media (max-width: 760px) {
    .notice-action {
        flex-wrap: wrap;
    }
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 360px;
    min-width: 200px;
}

.search-box .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted);
    pointer-events: none;
}

.search-box .form-control {
    padding-left: 36px;
}

.tenant-table td {
    padding-top: 12px;
    padding-bottom: 12px;
}

.tenant-name {
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}

.tenant-name:hover {
    color: var(--blue);
    text-decoration: underline;
}

.tenant-slug {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--muted);
}

.modules {
    display: inline-flex;
    gap: 5px;
}

.mod {
    padding: 1px 7px;
    border-radius: 5px;
    background: var(--blue-soft);
    color: #2340b0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
}

.usage {
    min-width: 96px;
    max-width: 120px;
}

.usage-nums {
    font-size: 14px;
    color: #475569;
    white-space: nowrap;
}

.usage-nums strong {
    color: var(--ink);
    font-weight: 600;
}

.usage-bar {
    height: 3px;
    border-radius: 999px;
    background: #e8ebf0;
    margin-top: 5px;
    overflow: hidden;
}

.usage-bar span {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: 999px;
    background: var(--blue);
}

.usage-bar span.warn {
    background: #c2410c;
}

.usage-bar span.crit {
    background: #dc2626;
}

.list-foot {
    padding: 12px 16px;
    border-top: 1px solid var(--line-2);
    margin: 0;
}

/* ── Auth pages (sign-in, password reset, error) ─────── */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 440px) 1fr;
}

.auth-panel {
    background: var(--side-bg);
    color: var(--side-ink);
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.auth-panel .brand {
    padding: 0;
}

.auth-pitch {
    margin: auto 0;
}

.auth-pitch h2 {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -.01em;
    margin: 0 0 24px;
}

.auth-pitch ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-pitch li {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-pitch li .icon {
    width: 32px;
    height: 32px;
    padding: 7px;
    border-radius: 8px;
    background: var(--side-active);
    border: 1px solid var(--side-line);
    color: #93a8f6;
}

.auth-foot {
    color: var(--side-muted);
    font-size: 12.5px;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .06);
}

.auth-card h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0 0 6px;
}

.auth-lead {
    color: #475569;
    margin: 0 0 24px;
}

.auth-help {
    color: var(--muted);
    font-size: 13.5px;
    margin: 20px 0 0;
    text-align: center;
}

.auth-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--blue-soft);
    color: var(--blue);
    margin-bottom: 16px;
}

.auth-icon.bad {
    background: var(--red-soft);
    color: #dc2626;
}

.btn-lg-auth {
    --bs-btn-padding-y: 10px;
    --bs-btn-font-size: 15px;
}

@media (max-width: 860px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        padding: 20px 16px;
        gap: 0;
    }

    .auth-pitch,
    .auth-foot {
        display: none;
    }
}

/* Inline email edit under an operator's name. */
.inline-edit > summary {
    list-style: none;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--muted);
}

.inline-edit > summary::-webkit-details-marker {
    display: none;
}

.inline-edit > summary:hover {
    color: var(--blue);
}

.inline-edit .missing {
    color: var(--amber);
}

.inline-edit-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.inline-edit-form .form-control {
    width: 220px;
    padding: 5px 9px;
    font-size: 13px;
}

/* ── Tenant detail / result / wizard ─────────────────── */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.detail-grid > .panel {
    margin-bottom: 20px;
}

@media (max-width: 1000px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.stat .usage {
    max-width: none;
    margin-top: 6px;
}

.stat .usage-nums {
    font-size: 15px;
}

.stat .usage-nums strong {
    font-size: 20px;
    font-weight: 700;
}

.facts {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 10px 16px;
    margin: 0;
    font-size: 14.5px;
}

.facts dt {
    color: var(--muted);
    font-weight: 400;
}

.facts dd {
    margin: 0;
    min-width: 0;
    word-break: break-word;
}

@media (max-width: 560px) {
    .facts {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .facts dd {
        margin-bottom: 10px;
    }
}

.cap-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.cap-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--muted);
}

.cap-list li + li {
    border-top: 1px solid var(--line-2);
}

.cap-list li small {
    margin-left: auto;
    font-size: 13px;
}

.cap-list li.on {
    color: var(--ink);
}

.cap-list li.on small {
    color: var(--green);
    font-weight: 600;
}

.cap-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
}

.cap-list li.on .cap-dot {
    background: #22c55e;
}

.admin-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line-2);
}

.admin-row .grow {
    flex: 1;
    min-width: 0;
}

.success-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    border-color: #bfe6cd;
    background: linear-gradient(0deg, #fff, #f4fbf6);
}

.success-hero > div:nth-child(2) {
    flex: 1;
    min-width: 240px;
}

.success-hero h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px;
}

.success-hero p {
    color: #475569;
    margin: 0;
}

.hero-icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green);
}

.hero-icon .icon {
    width: 24px;
    height: 24px;
    stroke-width: 2.6;
}

.next-steps {
    margin: 0;
    padding-left: 20px;
    color: var(--ink-2);
}

.next-steps li + li {
    margin-top: 6px;
}

.step-title {
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 16px;
}

.wizard-step {
    margin-bottom: 0;
}

/* Wizard progress as a connected step bar. */
.stepper {
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 20px;
}

.stepper li {
    flex: 1;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 9px 12px;
}

.stepper li.active {
    background: var(--blue-soft);
}

.stepper li.done {
    background: transparent;
}
