:root {
    color-scheme: dark;
    --accent: #f40552;
    --accent-2: #ff3f83;
    --header: #0c3554;
    --bg: #07111d;
    --bg-deep: #040b13;
    --surface: rgba(10, 22, 36, .88);
    --surface-strong: rgba(8, 18, 31, .96);
    --surface-soft: rgba(255, 255, 255, .045);
    --border: rgba(255, 255, 255, .11);
    --border-strong: rgba(255, 255, 255, .18);
    --text: #f7f9fc;
    --muted: #94a3b8;
    --muted-2: #67778d;
    --success: #5ee6a8;
    --warning: #f5c76e;
    --danger: #ff617e;
    --shadow: 0 28px 90px rgba(0, 0, 0, .42);
    --radius: 18px;
    --radius-sm: 11px;
    --idms-background: var(--idms-fallback);
    --idms-pattern-size: cover;
    --idms-pattern-duration: 0s;
    --idms-pattern-shift-x: 560px;
    --idms-pattern-shift-y: 315px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg-deep);
    font-family: "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    overflow-x: hidden;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(244, 5, 82, .42); color: #fff; }

.background-stage {
    position: fixed;
    inset: 0;
    z-index: -3;
    background-color: #07111d;
    background-image: var(--idms-background), var(--idms-fallback);
    background-size: var(--idms-pattern-size), cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    filter: saturate(.78) contrast(1.06);
    transform: scale(1.015);
}
.background-shade {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 10%, rgba(12, 53, 84, .52), transparent 38%),
        radial-gradient(circle at 78% 18%, rgba(244, 5, 82, .14), transparent 34%),
        linear-gradient(180deg, rgba(4, 10, 18, .58) 0%, rgba(4, 10, 18, .83) 58%, rgba(4, 10, 18, .94) 100%);
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Montserrat", "Rubik", sans-serif; letter-spacing: -.025em; }
h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.04; margin-bottom: 12px; font-weight: 600; }
h2 { font-size: 24px; line-height: 1.15; margin-bottom: 8px; font-weight: 600; }
p { color: var(--muted); }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.eyebrow {
    display: inline-block;
    margin-bottom: 9px;
    color: #b5c4d7;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .17em;
    text-transform: uppercase;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 72px;
    border-bottom: 1px solid var(--border);
    background: rgba(5, 14, 24, .82);
    backdrop-filter: blur(20px) saturate(1.2);
}
.topbar::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(244, 5, 82, .5), transparent);
    opacity: .5;
}
.topbar-inner {
    width: min(1450px, calc(100% - 40px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { width: 128px; height: auto; display: block; }
.topnav { display: flex; align-items: center; gap: 10px; }
.topnav > a:not(.button):not(.user-chip) {
    padding: 9px 12px;
    color: #c8d2df;
    text-decoration: none;
    border-radius: 9px;
}
.topnav > a:not(.button):not(.user-chip):hover { background: rgba(255,255,255,.055); color: #fff; }
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px 6px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #eaf0f7;
    text-decoration: none;
    background: rgba(255,255,255,.035);
}
.user-chip-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-fallback { display: inline-grid; place-items: center; background: rgba(244,5,82,.18); color: #fff; font-weight: 700; border: 1px solid rgba(244,5,82,.35); }

.page-shell {
    width: min(1450px, calc(100% - 40px));
    min-height: calc(100vh - 142px);
    margin: 0 auto;
    padding: 44px 0 64px;
}
.auth-screen .page-shell {
    width: 100%;
    min-height: 100vh;
    padding: 32px;
    display: grid;
    place-items: center;
}
.footer {
    width: min(1450px, calc(100% - 40px));
    margin: 0 auto;
    padding: 18px 0 30px;
    color: #64748b;
    font-size: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(13, 28, 45, .92), rgba(7, 18, 31, .92));
    box-shadow: 0 18px 55px rgba(0,0,0,.22);
    backdrop-filter: blur(18px);
}

.button,
.oauth-primary-action,
.oauth-secondary-action,
.oauth-cancel-action,
.oauth-close-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    background: linear-gradient(180deg, #ff1762, var(--accent));
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(244,5,82,.22), inset 0 1px 0 rgba(255,255,255,.16);
    transition: transform .18s ease, filter .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover,
.oauth-primary-action:hover { transform: translateY(-1px); filter: brightness(1.07); }
.button:active,
.oauth-primary-action:active { transform: translateY(0); }
.button-secondary,
.oauth-secondary-action,
.oauth-cancel-action,
.oauth-close-link {
    background: rgba(255,255,255,.04);
    border-color: var(--border-strong);
    box-shadow: none;
    color: #eef4fb;
}
.button-secondary:hover,
.oauth-secondary-action:hover,
.oauth-cancel-action:hover,
.oauth-close-link:hover { background: rgba(255,255,255,.075); border-color: rgba(255,255,255,.26); }
.button-danger { background: rgba(255, 62, 97, .10); border-color: rgba(255, 79, 111, .42); color: #ff8da3; box-shadow: none; }
.button-danger:hover { background: rgba(255, 62, 97, .18); }
.button-small { min-height: 34px; padding: 8px 12px; font-size: 12px; border-radius: 8px; }
.button-large { min-height: 50px; padding: 13px 19px; font-size: 14px; }
.button-wide { width: 100%; }
.text-button { border: 0; padding: 6px; background: none; cursor: pointer; font-weight: 600; }
.danger-text { color: #ff8098; }
.text-link, .back-link { color: #c8d5e4; text-decoration: none; }
.text-link:hover, .back-link:hover { color: #fff; }
.back-link { display: inline-flex; margin-bottom: 18px; font-size: 13px; }

.flash {
    margin: 0 0 18px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(14, 28, 44, .95);
    font-size: 13px;
}
.flash-success { border-color: rgba(94,230,168,.32); color: #b9f8d8; }
.flash-error { border-color: rgba(255,97,126,.35); color: #ffc1cd; background: rgba(73,18,34,.66); }
.persistent-warning { margin-bottom: 22px; }
.persistent-warning strong { margin-right: 5px; }

/* Gateway */
.gateway-screen .background-shade {
    background:
        radial-gradient(circle at 17% 18%, rgba(12,53,84,.62), transparent 37%),
        radial-gradient(circle at 79% 22%, rgba(244,5,82,.19), transparent 30%),
        linear-gradient(100deg, rgba(3,9,16,.72), rgba(3,9,16,.84));
}
.gateway-shell { width: min(1180px, 100%); }
.gateway-brand { display: flex; align-items: center; gap: 20px; margin-bottom: 58px; }
.gateway-logo { width: 150px; height: auto; }
.gateway-brand > span { padding-left: 20px; border-left: 1px solid rgba(255,255,255,.18); color: #8fa1b6; font-size: 10px; letter-spacing: .18em; font-weight: 700; }
.gateway-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); gap: 64px; align-items: center; }
.gateway-copy h1 { max-width: 710px; margin-bottom: 22px; font-size: clamp(48px, 6vw, 78px); font-weight: 600; letter-spacing: -.055em; }
.gateway-copy > p { max-width: 680px; font-size: 17px; line-height: 1.7; color: #b3c1d1; }
.gateway-actions { display: flex; gap: 11px; margin-top: 30px; flex-wrap: wrap; }
.gateway-trust { display: flex; flex-wrap: wrap; gap: 18px 26px; margin-top: 30px; color: #9fb0c3; font-size: 12px; }
.gateway-trust span { display: flex; align-items: center; gap: 8px; }
.gateway-trust i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(94,230,168,.08); }
.gateway-info { padding: 24px; }
.gateway-info-head { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.gateway-info-head strong, .gateway-info-head small { display: block; }
.gateway-info-head small { color: var(--muted); margin-top: 2px; }
.live-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 7px rgba(94,230,168,.09), 0 0 24px rgba(94,230,168,.35); }
.gateway-info-row { display: flex; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 12px; }
.gateway-info-row span { color: var(--muted); }
.gateway-info-row code, .gateway-info-row strong { color: #dce7f2; font-size: 11px; text-align: right; }
.gateway-info-note { margin: 18px 0 0; font-size: 12px; }

/* Auth and OAuth */
.auth-card,
.oauth-card,
.restricted-card,
.status-card {
    width: min(560px, 100%);
    padding: 34px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(10,23,38,.97), rgba(5,14,24,.97));
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
}
.auth-brand, .oauth-brand, .restricted-brand { display: flex; justify-content: center; margin-bottom: 28px; }
.auth-logo, .oauth-brand-logo, .restricted-logo { width: 155px; height: auto; }
.auth-card h1, .restricted-card h1 { text-align: center; font-size: 34px; }
.auth-card > p, .restricted-card > p { text-align: center; }
.cfx-login-copy { margin: 0 0 24px; padding: 0; list-style: none; text-align: center; color: var(--muted); }
.login-help { margin-top: 18px; text-align: center; color: #72849a; font-size: 11px; }
.stack-actions { display: grid; gap: 9px; }
.cancel-button { display: block; text-align: center; padding: 8px; color: #8fa0b4; text-decoration: none; }
.error-note { display: block; margin-top: 16px; color: #75869a; text-align: center; }
.status-code, .restricted-code { display: block; margin-bottom: 12px; color: #ff85a1; font-size: 10px; font-weight: 700; letter-spacing: .18em; text-align: center; }
.restricted-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 25px; padding-top: 17px; border-top: 1px solid var(--border); color: #75869a; font-size: 11px; }
.restricted-meta code { color: #aab7c5; }

.oauth-screen .page-shell { padding: 40px 20px; }
.oauth-card { width: min(610px, 100%); padding: 34px 38px; }
.oauth-kicker { margin: -9px 0 24px; color: #778ba3; font-size: 9px; font-weight: 700; letter-spacing: .22em; text-align: center; }
.oauth-state-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 18px; border: 1px solid rgba(244,5,82,.48); border-radius: 13px; background: rgba(244,5,82,.08); }
.oauth-state-icon span::before, .oauth-state-icon span::after { content: ""; display: block; width: 15px; height: 1px; background: #ff7a9d; transform: rotate(45deg); }
.oauth-state-icon span::after { margin-top: -1px; transform: rotate(-45deg); }
.oauth-card h1 { margin-bottom: 12px; font-size: 32px; text-align: center; }
.oauth-lead { max-width: 490px; margin: 0 auto 24px; color: #a9b7c7; text-align: center; }
.oauth-request-details { margin: 18px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.025); }
.oauth-request-details summary { padding: 12px 14px; color: #bac8d7; cursor: pointer; font-size: 12px; }
.oauth-request-details > div { padding: 0 14px 13px; }
.oauth-detail-row { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 12px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.06); }
.oauth-detail-row span { color: #7f91a6; font-size: 11px; }
.oauth-detail-row code { overflow-wrap: anywhere; color: #d4deea; font-size: 11px; }
.oauth-admin-actions { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--border); }
.oauth-admin-actions > span { display: block; margin-bottom: 9px; color: #65778d; font-size: 9px; font-weight: 700; letter-spacing: .15em; text-align: center; text-transform: uppercase; }
.oauth-primary-action, .oauth-secondary-action, .oauth-close-link { width: 100%; margin-top: 9px; }
.oauth-security-note { margin: 18px 0 0; color: #64758a; font-size: 10px; text-align: center; }
.oauth-close-link-bordered { margin-top: 20px; }
.oauth-consent-card { width: min(640px,100%); }
.oauth-app-identity { display: flex; gap: 16px; align-items: center; margin: 4px 0 19px; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.035); }
.oauth-client-logo-shell { flex: 0 0 auto; }
.oauth-client-logo { width: 58px; height: 58px; border-radius: 13px; object-fit: cover; }
.app-logo-fallback { display: inline-grid; place-items: center; background: linear-gradient(145deg, rgba(244,5,82,.24), rgba(12,53,84,.48)); border: 1px solid rgba(255,255,255,.12); color: #fff; font-weight: 700; }
.oauth-app-copy h1 { margin: 0 0 4px; text-align: left; font-size: 24px; }
.oauth-app-origin { color: #7f91a6; font-size: 11px; }
.oauth-consent-lead { text-align: left; margin-left: 0; }
.oauth-section-label { display: block; margin-bottom: 10px; color: #7f91a6; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.oauth-permissions ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.oauth-permission { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; padding: 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 11px; background: rgba(255,255,255,.025); }
.oauth-permission strong, .oauth-permission small { display: block; }
.oauth-permission small { margin-top: 2px; color: #8092a7; font-size: 11px; }
.oauth-permission-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: rgba(244,5,82,.11); border: 1px solid rgba(244,5,82,.22); }
.oauth-permission-icon::after { content: "•"; color: #ff799b; font-size: 24px; line-height: 1; }
.oauth-account { display: flex; align-items: center; gap: 11px; margin: 18px 0; padding: 13px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07); }
.oauth-account-avatar { width: 39px; height: 39px; border-radius: 50%; object-fit: cover; }
.oauth-account div { min-width: 0; flex: 1; }
.oauth-account small, .oauth-account strong { display: block; }
.oauth-account small { color: #74869b; font-size: 10px; }
.oauth-account a { color: #b9c7d6; font-size: 11px; text-decoration: none; }
.oauth-decision-form { display: grid; gap: 8px; }
.oauth-decision-form .oauth-primary-action, .oauth-decision-form .oauth-cancel-action { width: 100%; margin: 0; }

/* Admin */
.keymaster-layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-sidebar {
    position: sticky;
    top: 98px;
    display: grid;
    gap: 5px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(7, 18, 31, .86);
    box-shadow: 0 16px 50px rgba(0,0,0,.22);
    backdrop-filter: blur(18px);
}
.sidebar-title { padding: 10px 10px 15px; margin-bottom: 4px; border-bottom: 1px solid var(--border); color: #fff; font-family: "Montserrat", sans-serif; font-size: 14px; font-weight: 700; }
.sidebar-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 12px; border-radius: 9px; color: #93a5b8; text-decoration: none; font-size: 13px; }
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-link.active { color: #fff; background: linear-gradient(90deg, rgba(244,5,82,.16), rgba(244,5,82,.055)); box-shadow: inset 3px 0 0 var(--accent); }
.admin-nav-count { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.07); color: #9fb0c3; font-size: 10px; text-align: center; }
.admin-content { min-width: 0; }
.admin-heading, .form-heading, .section-heading, .panel-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.admin-heading { margin-bottom: 24px; }
.admin-heading h1, .form-heading h1 { margin-bottom: 7px; }
.admin-heading p, .form-heading p { margin-bottom: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.stats-grid article { padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: rgba(8,20,34,.85); }
.stats-grid strong { display: block; margin-bottom: 4px; font-family: "Montserrat", sans-serif; font-size: 31px; }
.stats-grid span { color: #7f91a6; font-size: 12px; }
.table-panel { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 17px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.065); vertical-align: middle; }
th { color: #708398; background: rgba(255,255,255,.025); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
td { color: #bdc9d6; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.018); }
.table-actions { text-align: right; white-space: nowrap; }
.app-cell, .identity-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.app-cell > div, .identity-cell > div { min-width: 0; }
.app-cell strong, .app-cell code, .identity-cell strong, .identity-cell span { display: block; }
.app-cell strong, .identity-cell strong { color: #f0f4f8; font-size: 13px; }
.app-cell code, .identity-cell span { margin-top: 2px; color: #708297; font-size: 10px; overflow-wrap: anywhere; }
.table-app-logo, .table-user-avatar { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.table-user-avatar { border-radius: 50%; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.04); color: #9daec0; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-pill.enabled, .status-pill.status-enabled { border-color: rgba(94,230,168,.3); background: rgba(94,230,168,.08); color: #89efbd; }
.status-pill.disabled, .status-pill.status-disabled { border-color: rgba(255,97,126,.3); background: rgba(255,97,126,.08); color: #ff8fa4; }
.audit-panel { margin-top: 16px; padding: 20px; }
.section-heading { align-items: center; margin-bottom: 15px; }
.section-heading h2 { margin: 0; }
.audit-list { display: grid; }
.audit-item { display: flex; justify-content: space-between; gap: 18px; padding: 13px 2px; border-top: 1px solid rgba(255,255,255,.065); }
.audit-item:first-child { border-top: 0; }
.audit-item strong, .audit-item span { display: block; }
.audit-item strong { font-size: 12px; }
.audit-item span, .audit-item time { color: #718399; font-size: 10px; }
.empty-state { padding: 32px 20px; text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: #dce5ee; }
.empty-state span { margin-top: 4px; color: #718399; font-size: 11px; }
.detail-list { padding: 2px 20px 20px; }
.panel-toolbar { padding: 20px; }
.panel-toolbar h2 { margin: 0; }
.detail-row { display: flex; justify-content: space-between; gap: 18px; padding: 13px 0; border-top: 1px solid rgba(255,255,255,.06); }
.detail-row > span { color: #9caec0; font-size: 12px; }
.detail-row code { color: #8799ad; font-size: 10px; overflow-wrap: anywhere; }

/* Forms / client management */
.form-page { width: min(980px, 100%); margin: 0 auto; }
.form-heading { margin-bottom: 22px; }
.form-heading { display: block; }
.app-manage-heading { display: flex; align-items: center; }
.manage-app-logo { width: 78px; height: 78px; border-radius: 17px; object-fit: cover; flex: 0 0 auto; }
.application-form { padding: 24px; }
.application-form + .application-form { margin-top: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid label, .application-form > label { display: grid; gap: 7px; }
.form-grid label > span, .application-form label > span, fieldset legend, .credential-label { color: #9fb0c3; font-size: 11px; font-weight: 600; }
.form-grid label small, .application-form label small { color: #65778c; font-size: 10px; line-height: 1.45; }
.full-field { grid-column: 1 / -1; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
    width: 100%;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    outline: none;
    background: rgba(3,12,22,.72);
    color: #f5f8fb;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.18);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { min-height: 112px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: rgba(244,5,82,.68); box-shadow: 0 0 0 3px rgba(244,5,82,.10); background: rgba(4,14,25,.9); }
.application-form fieldset { margin: 20px 0 0; padding: 0; border: 0; }
.application-form fieldset legend { width: 100%; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid rgba(255,255,255,.07); text-transform: uppercase; letter-spacing: .08em; }
.checkbox-row { display: flex !important; grid-template-columns: none !important; flex-direction: row !important; align-items: flex-start; gap: 11px !important; padding: 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; background: rgba(255,255,255,.022); }
.checkbox-row + .checkbox-row { margin-top: 8px; }
.checkbox-row input { margin: 3px 0 0; accent-color: var(--accent); }
.checkbox-row span { display: block; }
.checkbox-row strong, .checkbox-row small { display: block; }
.checkbox-row strong { color: #e4ebf2; font-size: 12px; }
.checkbox-row small { margin-top: 2px; color: #6f8297; font-size: 10px; }
.toggle-box { margin-top: 12px; }
.first-party-note { margin-top: 8px; color: #6d8095; font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.client-type-fieldset { margin-top: 0 !important; }
.client-type-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.client-type-card { position: relative; display: grid !important; grid-template-columns: auto 1fr !important; gap: 12px !important; min-height: 112px; padding: 16px !important; border: 1px solid rgba(255,255,255,.10); border-radius: 13px; background: rgba(255,255,255,.025); cursor: pointer; }
.client-type-card:has(input:checked) { border-color: rgba(244,5,82,.55); background: linear-gradient(145deg, rgba(244,5,82,.10), rgba(12,53,84,.12)); box-shadow: inset 0 0 0 1px rgba(244,5,82,.12); }
.client-type-card input { position: absolute; opacity: 0; pointer-events: none; }
.client-type-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 11px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: #e6edf5; font-size: 9px !important; letter-spacing: .06em; font-weight: 800; }
.client-type-card strong, .client-type-card small { display: block; }
.client-type-card strong { color: #f0f4f8; font-size: 12px; }
.client-type-card small { margin-top: 5px; color: #75879c; font-size: 10px; }
.advanced-fields { margin-top: 18px; padding: 14px 0 0; border-top: 1px solid rgba(255,255,255,.07); }
.advanced-fields summary { color: #8fa1b5; font-size: 11px; cursor: pointer; }
.advanced-fields .form-grid { margin-top: 13px; }
.credentials-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0,.8fr) minmax(0,.8fr); gap: 12px; margin-bottom: 14px; }
.credentials-grid > article { padding: 18px; min-width: 0; }
.credentials-grid > article > span { display: block; margin-bottom: 8px; color: #7f91a6; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.credentials-grid > article > strong { display: block; font-size: 14px; }
.credentials-grid > article > small { display: block; margin-top: 6px; color: #6e8095; font-size: 10px; }
.secret-status-card .status-pill { margin-bottom: 2px; }
.copy-field { display: flex; align-items: stretch; min-width: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.11); border-radius: 9px; background: rgba(2,10,18,.72); }
.copy-field code { min-width: 0; flex: 1; padding: 10px 11px; color: #dbe7f2; font-size: 10px; overflow-wrap: anywhere; }
.copy-button { flex: 0 0 auto; padding: 8px 11px; border: 0; border-left: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.045); color: #a9b7c6; font-size: 10px; font-weight: 700; cursor: pointer; }
.copy-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.integration-panel { margin-bottom: 14px; padding: 20px; }
.endpoint-list { border: 1px solid rgba(255,255,255,.07); border-radius: 11px; overflow: hidden; }
.endpoint-row { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 16px; padding: 11px 13px; border-top: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.018); }
.endpoint-row:first-child { border-top: 0; }
.endpoint-row span { color: #788ba0; font-size: 10px; }
.endpoint-row code { color: #c9d6e4; font-size: 10px; overflow-wrap: anywhere; }
.uri-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; align-items: center; }
.uri-list .credential-label { width: 100%; margin-bottom: 2px; }
.uri-chip { padding: 6px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 7px; background: rgba(255,255,255,.03); color: #91a4b8; font-size: 9px; overflow-wrap: anywhere; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 14px; padding: 20px; border-color: rgba(255,97,126,.18); }
.danger-zone h2 { margin-bottom: 3px; font-size: 18px; }
.danger-zone p { margin: 0; font-size: 11px; }
.danger-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Credential receipt */
.credentials-page .form-page, .receipt-page { width: min(1000px, 100%); margin: 0 auto; }
.receipt-hero { display: flex; justify-content: space-between; align-items: center; gap: 25px; padding: 24px; margin-bottom: 14px; border-color: rgba(94,230,168,.18); }
.receipt-hero h1 { font-size: 31px; }
.receipt-hero p { margin-bottom: 0; }
.receipt-status { display: inline-flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid rgba(94,230,168,.24); border-radius: 999px; color: #9cf1c6; background: rgba(94,230,168,.06); font-size: 10px; font-weight: 700; white-space: nowrap; }
.receipt-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px rgba(94,230,168,.55); }
.credentials-receipt-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.credential-card { padding: 20px; border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(180deg, rgba(11,25,41,.94), rgba(7,17,29,.94)); min-width: 0; }
.credential-card-secret { border-color: rgba(244,5,82,.30); box-shadow: inset 0 0 35px rgba(244,5,82,.035); }
.credential-card-public { border-color: rgba(94,230,168,.18); }
.credential-card > strong { display: block; margin: 8px 0 6px; font-size: 18px; }
.credential-card p { margin: 10px 0 0; font-size: 10px; }
.credential-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.one-time-badge { padding: 4px 7px; border: 1px solid rgba(244,5,82,.34); border-radius: 999px; color: #ff83a1; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.copy-field-large code { padding: 13px; font-size: 11px; }
.credential-export { padding: 20px; }
.credential-export pre { margin: 0; padding: 15px; max-height: 330px; overflow: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(2,8,15,.72); color: #c9d8e6; font-size: 10px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.receipt-actions { margin-top: 14px; }

/* Account */
.account-grid { display: grid; grid-template-columns: minmax(280px, .65fr) minmax(0,1.35fr); gap: 16px; width: min(1050px,100%); margin: 0 auto; }
.account-grid > .panel { padding: 24px; }
.profile-panel { display: flex; align-items: center; gap: 18px; align-self: start; }
.profile-avatar { width: 78px; height: 78px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.profile-panel h1 { margin: 0 0 5px; font-size: 28px; }
.profile-panel p { margin: 0 0 10px; }
.connected-list { display: grid; gap: 8px; }
.connected-app { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 11px; background: rgba(255,255,255,.024); }
.connected-app-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.connected-app strong, .connected-app span { display: block; }
.connected-app strong { font-size: 12px; }
.connected-app span { margin-top: 2px; color: #718398; font-size: 10px; }

@media (max-width: 1050px) {
    .gateway-grid { grid-template-columns: 1fr; gap: 34px; }
    .gateway-copy h1 { max-width: 820px; }
    .gateway-info { width: min(590px,100%); }
    .keymaster-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; display: flex; overflow-x: auto; padding: 9px; }
    .sidebar-title { display: none; }
    .sidebar-link { flex: 0 0 auto; }
    .credentials-grid { grid-template-columns: 1fr 1fr; }
    .credentials-grid > article:first-child { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
    .topbar-inner, .page-shell, .footer { width: min(100% - 24px, 1450px); }
    .topbar-inner { min-height: 64px; }
    .topbar { min-height: 64px; }
    .topnav > a:not(.button):not(.user-chip) { display: none; }
    .brand-logo { width: 110px; }
    .page-shell { padding-top: 26px; }
    .auth-screen .page-shell { padding: 18px; }
    .gateway-brand { margin-bottom: 35px; }
    .gateway-brand > span { display: none; }
    .gateway-copy h1 { font-size: clamp(42px, 13vw, 62px); }
    .gateway-copy > p { font-size: 15px; }
    .gateway-actions { display: grid; grid-template-columns: 1fr; }
    .gateway-actions .button { width: 100%; }
    .auth-card, .oauth-card, .restricted-card, .status-card { padding: 26px 20px; border-radius: 15px; }
    .oauth-card { width: min(600px,100%); }
    .stats-grid, .form-grid, .client-type-grid, .credentials-receipt-grid, .account-grid { grid-template-columns: 1fr; }
    .full-field { grid-column: auto; }
    .credentials-grid { grid-template-columns: 1fr; }
    .credentials-grid > article:first-child { grid-column: auto; }
    .admin-heading, .receipt-hero, .danger-zone { align-items: stretch; flex-direction: column; }
    .admin-heading { display: flex; }
    .admin-heading > .button { width: 100%; }
    .receipt-status { align-self: flex-start; }
    .danger-actions { justify-content: flex-start; }
    .table-panel { overflow-x: auto; }
    table { min-width: 720px; }
    .endpoint-row { grid-template-columns: 1fr; gap: 3px; }
    .app-manage-heading { display: flex; }
    .manage-app-logo { width: 60px; height: 60px; }
    .profile-panel { align-items: flex-start; }
}

@media (max-width: 520px) {
    .topnav .user-chip span { display: none; }
    .topnav .button { padding-inline: 10px; }
    .gateway-trust { display: grid; gap: 10px; }
    .oauth-app-identity { align-items: flex-start; }
    .oauth-app-copy h1 { font-size: 20px; }
    .oauth-account { align-items: flex-start; flex-wrap: wrap; }
    .oauth-account a { width: 100%; padding-left: 50px; }
    .form-actions { display: grid; grid-template-columns: 1fr; }
    .form-actions .button { width: 100%; }
    .copy-field { flex-direction: column; }
    .copy-button { border-left: 0; border-top: 1px solid rgba(255,255,255,.10); }
    .app-manage-heading { align-items: flex-start; }
}

/* =========================================================
   SDN.RE IDMS v15 — CFX / FORUM VISUAL SYSTEM
   ========================================================= */
:root {
    --sdn-header-height: 68px;
    --sdn-header-max-width: 1400px;
    --sdn-header-side-padding: 20px;
    --cfx-panel: #191c25;
    --cfx-panel-2: #141821;
    --cfx-line: rgba(255, 255, 255, .12);
    --cfx-line-soft: rgba(255, 255, 255, .07);
    --cfx-text: #f4f5f7;
    --cfx-muted: #a8acb7;
    --cfx-faint: #6f7480;
}

html { background: #11151d; }
body {
    background: transparent;
    color: var(--cfx-text);
}

/* Keep the animated forum pattern inside the page stacking context.
   The previous negative z-index could place it behind the body canvas,
   which made OAuth screens look like a flat dark background. */
.background-stage { z-index: 0; pointer-events: none; }
.background-shade { z-index: 1; pointer-events: none; }
.topbar, .page-shell, .footer { position: relative; z-index: 2; }

.background-stage {
    inset: -620px;
    background-color: #191d27;
    background-image: var(--idms-background), var(--idms-fallback);
    background-size: var(--idms-pattern-size), var(--idms-pattern-size);
    background-position: 0 0, 0 0;
    background-repeat: repeat, repeat;
    filter: saturate(.34) brightness(.68) contrast(1.04);
    transform: none;
    animation: sdnPatternTravel var(--idms-pattern-duration) linear infinite;
    will-change: background-position;
}

.background-shade {
    background:
        linear-gradient(180deg, rgba(19, 23, 33, .57), rgba(16, 20, 29, .72) 46%, rgba(12, 16, 24, .84));
}

.auth-screen .background-shade,
.oauth-screen .background-shade {
    background: rgba(18, 22, 31, .54);
}

@keyframes sdnPatternTravel {
    from { background-position: 0 0, 0 0; }
    to { background-position: var(--idms-pattern-shift-x) var(--idms-pattern-shift-y), var(--idms-pattern-shift-x) var(--idms-pattern-shift-y); }
}

@media (prefers-reduced-motion: reduce) {
    .background-stage,
    .topbar { animation: none !important; }
}

/* Header based on the Sdn.re forum header proportions. */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--sdn-header-height);
    min-height: var(--sdn-header-height);
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .55);
    background-color: #2a166b;
    background-image:
        linear-gradient(rgba(17, 19, 28, .42), rgba(17, 19, 28, .42)),
        var(--idms-background),
        var(--idms-fallback);
    background-repeat: repeat, repeat, repeat;
    background-size: auto, 560px auto, 560px auto;
    background-position: center, 0 0, 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .38), inset 0 -1px 0 rgba(255, 255, 255, .04);
    backdrop-filter: none;
    animation: sdnHeaderTravel var(--idms-pattern-duration) linear infinite;
}

.topbar::after { display: none; }

@keyframes sdnHeaderTravel {
    from { background-position: center, 0 0, 0 0; }
    to { background-position: center, var(--idms-pattern-shift-x) var(--idms-pattern-shift-y), var(--idms-pattern-shift-x) var(--idms-pattern-shift-y); }
}

.topbar-inner {
    width: 100%;
    max-width: var(--sdn-header-max-width);
    height: var(--sdn-header-height);
    min-height: var(--sdn-header-height);
    margin: 0 auto;
    padding: 0 var(--sdn-header-side-padding);
    gap: 18px;
}

.brand {
    height: 100%;
    min-width: 136px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
}

/* Give the inline SVG an explicit viewport. The logo source contains a
   viewBox but no width/height attributes; explicit dimensions prevent
   browsers from collapsing it inside the flex header. */
.brand-logo {
    display: block;
    width: 136px;
    height: 31px;
    max-width: 136px;
    max-height: 31px;
    overflow: visible;
    object-fit: contain;
    object-position: left center;
    flex: 0 0 auto;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .7)) drop-shadow(0 0 1px rgba(255, 255, 255, .14));
}

.topnav { height: 100%; gap: 5px; }
.topnav-link,
.topnav > a:not(.button):not(.user-chip) {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: rgba(255, 255, 255, .88);
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}
.topnav-link:hover,
.topnav > a:not(.button):not(.user-chip):hover { background: rgba(255, 255, 255, .10); color: #fff; }

.header-user { position: relative; height: 100%; display: flex; align-items: center; }
.header-avatar-button {
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.header-avatar-button:hover,
.header-avatar-button[aria-expanded="true"] { background: rgba(255, 255, 255, .10); border-color: rgba(255, 255, 255, .08); }
.header-avatar {
    width: 39px;
    height: 39px;
    min-width: 39px;
    min-height: 39px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.header-presence-dot {
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 10px;
    height: 10px;
    border: 2px solid #211c48;
    border-radius: 50%;
    background: #43b581;
}
.header-user-menu {
    position: absolute;
    top: calc(100% - 5px);
    right: 0;
    width: 330px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    background: #171a23;
    box-shadow: 0 20px 55px rgba(0, 0, 0, .55);
}
.header-user-menu[hidden] { display: none; }
.header-user-card { display: flex; align-items: center; gap: 12px; padding: 8px; }
.header-menu-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255,255,255,.16); }
.header-user-copy { min-width: 0; }
.header-user-copy strong,
.header-user-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-user-copy strong { font-size: 15px; }
.header-user-copy span { color: #969aa6; font-size: 12px; }
.header-badges { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 8px 10px; border-bottom: 1px solid var(--cfx-line-soft); }
.header-badges .profile-badge { font-size: 9px; padding: 3px 6px; }
.header-menu-links { display: grid; gap: 2px; padding-top: 7px; }
.header-menu-links a { display: block; padding: 9px 10px; border-radius: 6px; color: #f2f3f5; text-decoration: none; }
.header-menu-links a:hover { background: rgba(255,255,255,.065); }
.header-menu-links span,
.header-menu-links small { display: block; }
.header-menu-links span { font-size: 12px; font-weight: 600; }
.header-menu-links small { margin-top: 2px; color: #787d89; font-size: 10px; }
.header-menu-links .header-logout span { color: #ff7898; }

.page-shell {
    width: min(1400px, calc(100% - 40px));
    min-height: calc(100vh - 128px);
    padding: 38px 0 58px;
}
.footer { width: min(1400px, calc(100% - 40px)); }

.panel {
    border-color: var(--cfx-line);
    border-radius: 8px;
    background: rgba(23, 27, 37, .94);
    box-shadow: 0 12px 36px rgba(0, 0, 0, .24);
    backdrop-filter: blur(6px);
}

.button,
.oauth-primary-action,
.oauth-secondary-action,
.oauth-cancel-action,
.oauth-close-link {
    border-radius: 3px;
    box-shadow: none;
}

.button:not(.button-secondary):not(.button-danger),
.cfx-submit {
    border-color: #ff0059;
    background: #ff0059;
}
.button:not(.button-secondary):not(.button-danger):hover,
.cfx-submit:hover { background: #e90050; }
.button-secondary { background: #222630; border-color: rgba(255,255,255,.16); color: #f2f3f5; }
.button-secondary:hover { background: #2a2f3a; }

/* OAuth and sign-in screens deliberately stay compact like the Cfx.re prompt. */
.auth-screen .page-shell {
    padding: 30px 18px;
    min-height: 100vh;
}
.oauth-card,
.auth-card,
.restricted-card,
.status-card {
    width: min(420px, 100%);
    padding: 27px 30px 24px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 0;
    background: rgba(25, 28, 37, .96);
    box-shadow: 0 18px 55px rgba(0, 0, 0, .27);
    backdrop-filter: none;
}
.oauth-consent-card { width: min(440px, 100%); }
.oauth-brand,
.auth-brand { margin-bottom: 15px; }
.oauth-brand-logo,
.auth-logo { width: 108px; max-height: 34px; }
.oauth-kicker { display: none; }
.oauth-card h1,
.auth-card h1 { margin-bottom: 22px; font-family: "Montserrat", sans-serif; font-size: 24px; font-weight: 400; line-height: 1.15; text-align: center; }
.oauth-consent-card .oauth-app-identity {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}
.oauth-consent-card .oauth-client-logo-shell,
.oauth-consent-card .oauth-app-origin { display: none; }
.oauth-consent-card .oauth-app-copy h1 { margin: 0 0 22px; font-size: 24px; font-weight: 400; text-align: center; }
.oauth-lead,
.oauth-consent-lead { margin: 0 0 8px; color: #f0f1f3; font-size: 13px; line-height: 1.45; text-align: left; }
.oauth-permissions { margin: 0 0 16px; }
.oauth-section-label { margin: 0 0 5px; color: #f0f1f3; font-size: 12px; letter-spacing: 0; text-transform: none; }
.oauth-permissions ul { display: block; margin: 0 0 10px; padding-left: 16px; list-style: disc; }
.oauth-permission { display: list-item; padding: 0; border: 0; border-radius: 0; background: transparent; }
.oauth-permission + .oauth-permission { margin-top: 2px; }
.oauth-permission-icon { display: none; }
.oauth-permission strong { font-size: 12px; font-weight: 400; }
.oauth-permission small { display: none; }
.oauth-account {
    display: block;
    margin: 13px 0 20px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #f0f1f3;
    font-size: 12px;
}
.oauth-account-avatar { display: none; }
.oauth-account div { display: inline; }
.oauth-account div small { display: inline; margin-right: 3px; color: #f0f1f3; font-size: 12px; }
.oauth-account div strong { display: inline; font-size: 12px; font-weight: 600; }
.oauth-account a { display: block; width: fit-content; margin-top: -1px; color: #fff; font-size: 11px; text-decoration: underline; }
.oauth-decision-form { display: grid; gap: 9px; }
.oauth-primary-action {
    width: 100%;
    min-height: 35px;
    margin: 0;
    border: 2px solid #ff0059;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.oauth-primary-action:hover { background: rgba(255, 0, 89, .13); }
.oauth-cancel-action {
    min-height: 28px;
    padding: 5px;
    border: 0;
    background: transparent;
    color: #727680;
    font-size: 10px;
    font-weight: 400;
}
.oauth-cancel-action:hover { color: #adb0b8; background: transparent; }
.oauth-security-note { display: none; }
.oauth-state-icon { width: 38px; height: 38px; margin-bottom: 15px; border-radius: 4px; }
.oauth-error-card h1 { font-size: 24px; }
.oauth-error-card .oauth-lead { text-align: center; color: #b8bbc4; }
.oauth-request-details { border-radius: 3px; background: rgba(255,255,255,.02); }
.oauth-admin-actions { border-top-color: rgba(255,255,255,.08); }
.oauth-admin-actions > span { font-size: 8px; }
.oauth-error-card .oauth-primary-action,
.oauth-error-card .oauth-secondary-action { min-height: 37px; }
.oauth-close-link { border: 0; background: transparent; color: #777b85; }

/* Profile: forum-like identity page. */
.profile-page { max-width: 1120px; margin: 0 auto; }
.forum-profile-card { overflow: hidden; }
.profile-cover {
    min-height: 150px;
    padding: 18px 22px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    background-color: #2a166b;
    background-image: linear-gradient(rgba(17,19,28,.44), rgba(17,19,28,.62)), var(--idms-background), var(--idms-fallback);
    background-size: auto, 560px auto, 560px auto;
    background-repeat: repeat;
}
.profile-cover-label { color: rgba(255,255,255,.62); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.profile-main { display: flex; gap: 22px; padding: 0 28px 28px; }
.profile-avatar-wrap { position: relative; flex: 0 0 auto; width: 116px; margin-top: -52px; }
.profile-avatar {
    width: 116px;
    height: 116px;
    border: 5px solid #191c25;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.profile-online-dot { position: absolute; right: 7px; bottom: 8px; width: 19px; height: 19px; border: 4px solid #191c25; border-radius: 50%; background: #43b581; }
.profile-copy { min-width: 0; flex: 1; padding-top: 18px; }
.profile-name-row { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.profile-name-row h1 { margin: 0; font-size: 28px; }
.profile-handle { color: #888d99; font-size: 13px; }
.profile-actions { display: flex; align-items: center; gap: 10px; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.profile-badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 3px;
    background: rgba(255,255,255,.045);
    color: #d8dae0;
    font-size: 10px;
    font-weight: 600;
}
.profile-badge-staff { border-color: rgba(255,0,89,.46); background: rgba(255,0,89,.10); color: #ff83aa; }
.profile-badge-moderator { border-color: rgba(82,160,255,.34); color: #a8cdfd; }
.profile-badge-group { border-color: rgba(125,93,255,.35); color: #c6b7ff; }
.profile-badge-title { color: #e1e1e4; }
.profile-badge-trust { color: #9fa4af; }
.profile-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 24px; border-top: 1px solid var(--cfx-line-soft); }
.profile-meta-grid article { padding: 15px 16px 0 0; }
.profile-meta-grid span,
.profile-meta-grid strong { display: block; }
.profile-meta-grid span { color: #777c88; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.profile-meta-grid strong { margin-top: 4px; font-size: 13px; }
.profile-content-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; margin-top: 18px; }
.profile-info-panel,
.profile-apps-panel { padding: 24px; }

/* Admin shell. */
.keymaster-layout {
    display: grid;
    grid-template-columns: 285px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}
.admin-sidebar {
    position: sticky;
    top: calc(var(--sdn-header-height) + 22px);
    padding: 14px;
    border: 1px solid var(--cfx-line);
    border-radius: 8px;
    background: rgba(20, 24, 33, .96);
    box-shadow: 0 12px 36px rgba(0,0,0,.22);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 8px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--cfx-line-soft); }
.sidebar-brand-logo { width: 88px; height: auto; }
.sidebar-brand > div { padding-left: 10px; border-left: 1px solid rgba(255,255,255,.12); }
.sidebar-brand strong,
.sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 12px; }
.sidebar-brand span { color: #767b87; font-size: 9px; }
.sidebar-section-label { padding: 8px 9px 6px; color: #6d727d; font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.sidebar-account-label { margin-top: 8px; border-top: 1px solid var(--cfx-line-soft); padding-top: 15px; }
.sidebar-nav { display: grid; gap: 3px; }
.sidebar-link {
    position: relative;
    display: grid;
    grid-template-columns: 33px minmax(0,1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #d7d9de;
    text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,.045); }
.sidebar-link.active { border-color: rgba(255,0,89,.32); background: rgba(255,0,89,.08); }
.sidebar-link.active::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; background: #ff0059; }
.sidebar-link-copy { min-width: 0; }
.sidebar-link-copy strong,
.sidebar-link-copy small { display: block; }
.sidebar-link-copy strong { font-size: 12px; }
.sidebar-link-copy small { margin-top: 1px; color: #707581; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 5px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.035); }
.sidebar-icon::after { color: #a7abb5; font-size: 11px; font-weight: 700; }
.sidebar-icon-grid::after { content: "APP"; font-size: 8px; }
.sidebar-icon-users::after { content: "USR"; font-size: 8px; }
.sidebar-icon-shield::after { content: "SEC"; font-size: 8px; }
.sidebar-icon-pulse::after { content: "LOG"; font-size: 8px; }
.sidebar-icon-system::after { content: "SYS"; font-size: 8px; }
.sidebar-icon-profile::after { content: "ME"; font-size: 8px; }
.admin-nav-count { min-width: 24px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 10px; background: #292e39; color: #a6aab3; font-size: 9px; }
.sidebar-help { margin-top: 14px; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; background: rgba(255,255,255,.025); }
.sidebar-help strong,
.sidebar-help span { display: block; }
.sidebar-help strong { font-size: 10px; }
.sidebar-help span { margin-top: 4px; color: #717683; font-size: 9px; line-height: 1.5; }
.admin-content { min-width: 0; }
.admin-heading { margin-bottom: 22px; }
.admin-heading h1 { margin-bottom: 7px; font-size: 34px; }
.admin-heading p { margin-bottom: 0; max-width: 720px; }
.admin-welcome { display: grid; grid-template-columns: minmax(0, .85fr) minmax(380px, 1.15fr); gap: 28px; padding: 24px; margin-bottom: 18px; }
.admin-welcome h2 { font-size: 22px; }
.admin-welcome p { margin: 0; }
.setup-steps { display: grid; gap: 7px; }
.setup-steps article { display: grid; grid-template-columns: 31px 1fr; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--cfx-line-soft); border-radius: 5px; background: rgba(255,255,255,.025); }
.setup-steps b { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(255,0,89,.35); color: #ff6f9f; font-size: 10px; }
.setup-steps strong,
.setup-steps small { display: block; }
.setup-steps strong { font-size: 11px; }
.setup-steps small { color: #747984; font-size: 9px; }
.stats-grid { gap: 12px; }
.stats-grid article { min-height: 126px; border-radius: 7px; background: rgba(23,27,37,.94); }
.stat-kicker { display: block; margin-bottom: 10px; color: #6d727e !important; font-size: 9px !important; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.table-panel { overflow: hidden; }
.table-panel .panel-toolbar { padding: 20px 22px 16px; border-bottom: 1px solid var(--cfx-line-soft); }
.table-panel .panel-toolbar h2 { margin-bottom: 3px; }
.table-panel .panel-toolbar p { margin: 0; font-size: 11px; }
.table-scroll { overflow-x: auto; }
table { min-width: 760px; }
thead th { background: rgba(255,255,255,.025); color: #818692; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
tbody td { border-top-color: var(--cfx-line-soft); }
.audit-panel { margin-top: 18px; }

/* Forms: less SaaS, more administration console. */
.form-page { max-width: 1040px; }
.form-heading { margin-bottom: 20px; }
.form-heading h1 { font-size: 34px; }
.application-form { padding: 24px; }
.application-form fieldset { border-color: var(--cfx-line-soft); }
.client-type-grid { gap: 10px; }
.client-type-card { min-height: 94px; border-radius: 6px; background: rgba(255,255,255,.025); }
.client-type-card:has(input:checked) { border-color: #ff0059; background: rgba(255,0,89,.055); box-shadow: inset 0 0 0 1px rgba(255,0,89,.12); }
.client-type-icon { border-radius: 5px; }
input,
textarea,
select { border-radius: 4px; background: #101721; border-color: rgba(255,255,255,.13); }
input:focus,
textarea:focus,
select:focus { border-color: rgba(255,0,89,.75); box-shadow: 0 0 0 2px rgba(255,0,89,.10); }
.checkbox-row,
.toggle-box { border-radius: 5px; background: rgba(255,255,255,.02); }
.advanced-fields { border-radius: 5px; }

.credentials-grid article,
.credential-card { border-radius: 6px; }
.copy-field { border-radius: 4px; }
.copy-button { border-radius: 3px; }
.uri-chip { border-radius: 3px; }

@media (max-width: 980px) {
    .keymaster-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .sidebar-nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .sidebar-help { display: none; }
    .admin-welcome { grid-template-columns: 1fr; }
    .profile-content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    :root { --sdn-header-height: 56px; --sdn-header-side-padding: 9px; }
    .topbar-inner { padding: 0 var(--sdn-header-side-padding); }
    .brand { min-width: 112px; }
    .brand-logo { width: 112px; height: 25px; max-width: 112px; max-height: 25px; }
    .topnav-link { display: none; }
    .header-avatar-button { width: 38px; height: 38px; min-width: 38px; }
    .header-avatar { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
    .header-user-menu { position: fixed; top: 58px; right: 8px; left: 8px; width: auto; }
    .page-shell { width: min(100% - 18px, 1400px); padding-top: 22px; }
    .sidebar-nav { grid-template-columns: 1fr; }
    .profile-cover { min-height: 112px; }
    .profile-main { display: block; padding: 0 18px 20px; }
    .profile-avatar-wrap { width: 92px; margin-top: -43px; }
    .profile-avatar { width: 92px; height: 92px; }
    .profile-copy { padding-top: 10px; }
    .profile-name-row { display: block; }
    .profile-actions { margin-top: 12px; flex-wrap: wrap; }
    .profile-meta-grid { grid-template-columns: repeat(2, 1fr); }
    .oauth-card, .auth-card { padding: 24px 22px 22px; }
}
.table-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.table-badges .profile-badge { min-height: 18px; padding: 2px 5px; font-size: 8px; }
.register-layout { display: grid; grid-template-columns: minmax(0, 1fr) 315px; gap: 18px; align-items: start; }
.register-help { position: sticky; top: calc(var(--sdn-header-height) + 22px); padding: 20px; }
.register-help h2 { font-size: 18px; line-height: 1.25; }
.register-help-list { display: grid; gap: 0; margin-top: 16px; border-top: 1px solid var(--cfx-line-soft); }
.register-help-list article { padding: 13px 0; border-bottom: 1px solid var(--cfx-line-soft); }
.register-help-list strong { font-size: 11px; }
.register-help-list p { margin: 4px 0 0; color: #777c88; font-size: 10px; line-height: 1.55; }
.register-help-note { margin-top: 15px; padding: 12px; border-left: 2px solid #ff0059; background: rgba(255,0,89,.055); }
.register-help-note strong, .register-help-note span { display: block; }
.register-help-note strong { font-size: 10px; }
.register-help-note span { margin-top: 4px; color: #8e929d; font-size: 9px; line-height: 1.5; }
@media (max-width: 1020px) { .register-layout { grid-template-columns: 1fr; } .register-help { position: static; } }
.admin-info-strip { margin-bottom: 16px; padding: 14px 16px; border-left: 2px solid rgba(255,0,89,.72); }
.admin-info-strip strong, .admin-info-strip span { display: block; }
.admin-info-strip strong { font-size: 11px; }
.admin-info-strip span { margin-top: 4px; color: #858a95; font-size: 10px; line-height: 1.55; }
.admin-info-strip code { color: #c6cad2; }
.app-summary-bar { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0; margin-bottom: 14px; overflow: hidden; }
.app-summary-bar article { padding: 13px 16px; border-right: 1px solid var(--cfx-line-soft); }
.app-summary-bar article:last-child { border-right: 0; }
.app-summary-bar span, .app-summary-bar strong { display: block; }
.app-summary-bar span { color: #727783; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.app-summary-bar strong { margin-top: 4px; font-size: 11px; }
@media (max-width: 760px) { .app-summary-bar { grid-template-columns: repeat(2,1fr); } .app-summary-bar article:nth-child(2) { border-right: 0; } .app-summary-bar article:nth-child(-n+2) { border-bottom: 1px solid var(--cfx-line-soft); } }
