.access-console {
    --ink: #17233c;
    --accent: #147d64;
    --accent-dark: #0c5d4a;
    margin: 24px 0 10px;
    color: var(--ink);
}

/* Author styles can override the browser's native [hidden] rule.
   Keep the empty and populated states mutually exclusive. */
.access-console [hidden] {
    display: none !important;
}

.access-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 30px 32px;
    border-radius: 24px 24px 0 0;
    color: #fff;
    background: linear-gradient(120deg, #12213b 0%, #17364b 58%, #126c59 100%);
}

.access-hero::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    right: -60px;
    top: -130px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    box-shadow: 0 0 0 34px rgba(255,255,255,.035), 0 0 0 72px rgba(255,255,255,.025);
}

.access-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .78;
}

.access-eyebrow svg { width: 15px; height: 15px; }
.access-hero h2 { max-width: 690px; margin: 9px 0 8px; font-size: clamp(1.45rem, 2.4vw, 2.1rem); line-height: 1.08; }
.access-hero p { max-width: 720px; margin: 0; color: rgba(255,255,255,.72); line-height: 1.55; }

.access-refresh {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 11px 16px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 12px;
    color: #fff;
    background: rgba(255,255,255,.09);
    font: inherit;
    font-size: .82rem;
    font-weight: 750;
    cursor: pointer;
}

.access-refresh svg { width: 16px; }
.access-refresh:hover { background: rgba(255,255,255,.16); }

.access-layout {
    display: grid;
    grid-template-columns: minmax(250px, .72fr) minmax(480px, 1.7fr);
    min-height: 520px;
    border: 1px solid #dfe7ec;
    border-top: 0;
    border-radius: 0 0 24px 24px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(23,35,60,.08);
}

.account-panel { padding: 24px 18px; border-right: 1px solid #e7edf0; background: #f7faf9; border-radius: 0 0 0 24px; }
.access-label { display: block; margin-bottom: 7px; color: #637181; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.account-search { position: relative; margin-bottom: 14px; }
.account-search svg { position: absolute; left: 12px; top: 50%; width: 16px; color: #82909b; transform: translateY(-50%); }
.account-search input, .assignment-form select {
    width: 100%;
    border: 1px solid #d8e2e5;
    border-radius: 11px;
    outline: 0;
    color: var(--ink);
    background: #fff;
    font: inherit;
}
.account-search input { padding: 11px 12px 11px 38px; font-size: .84rem; }
.account-search input:focus, .assignment-form select:focus { border-color: #28a386; box-shadow: 0 0 0 3px rgba(20,125,100,.11); }
.account-list { display: grid; gap: 7px; max-height: 430px; overflow-y: auto; }
.account-item { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.account-item:hover { background: #fff; border-color: #dce7e4; }
.account-item.active { color: #fff; background: var(--accent); box-shadow: 0 8px 18px rgba(20,125,100,.22); }
.account-avatar, .selected-avatar { display: grid; place-items: center; border-radius: 11px; font-weight: 850; }
.account-avatar { width: 38px; height: 38px; color: var(--accent-dark); background: #d9eee8; font-size: .78rem; }
.account-item.active .account-avatar { color: #fff; background: rgba(255,255,255,.16); }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: .83rem; }
.account-copy small { margin-top: 2px; color: #75828e; font-size: .7rem; }
.account-item.active small { color: rgba(255,255,255,.72); }
.account-item > svg { width: 15px; opacity: .55; }

.assignment-panel { min-width: 0; padding: 28px 30px; }
.account-empty { display: grid; place-items: center; align-content: center; height: 100%; min-height: 430px; text-align: center; }
.empty-orbit { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 16px; border: 1px solid #cce5de; border-radius: 50%; color: var(--accent); background: #edf8f5; box-shadow: 0 0 0 10px #f7fbfa; }
.empty-orbit svg { width: 30px; }
.account-empty h3 { margin: 0 0 6px; }
.account-empty p { margin: 0; color: #778491; }
.selected-account { display: flex; align-items: center; gap: 14px; padding-bottom: 22px; border-bottom: 1px solid #e8edef; }
.selected-avatar { width: 50px; height: 50px; color: #fff; background: #d4832e; font-size: 1rem; }
.selected-account h3 { margin: 3px 0 1px; font-size: 1.15rem; }
.selected-account p { margin: 0; color: #73808b; font-size: .82rem; }

.assignment-form { display: grid; grid-template-columns: 1.2fr .8fr 1fr auto; align-items: end; gap: 12px; margin: 22px 0 28px; padding: 18px; border: 1px solid #dce9e5; border-radius: 16px; background: #f6faf8; }
.assignment-form select { min-height: 43px; padding: 9px 34px 9px 11px; font-size: .82rem; }
.principal-check { display: flex; align-items: center; gap: 9px; min-height: 43px; cursor: pointer; }
.principal-check input { width: 17px; height: 17px; accent-color: var(--accent); }
.principal-check strong, .principal-check small { display: block; }
.principal-check strong { font-size: .77rem; }
.principal-check small { margin-top: 2px; color: #75828e; font-size: .65rem; }
.assign-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 43px; padding: 0 16px; border: 0; border-radius: 11px; color: #fff; background: var(--accent); font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; }
.assign-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.assign-button:disabled { opacity: .55; cursor: wait; transform: none; }
.assign-button svg { width: 16px; }

.access-table-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.access-table-heading h3 { margin: 0 0 3px; font-size: 1rem; }
.access-table-heading p { margin: 0; color: #7b8791; font-size: .72rem; }
.access-count { padding: 5px 10px; border-radius: 999px; color: var(--accent-dark); background: #e4f3ef; font-size: .68rem; font-weight: 800; }
.assigned-list { display: grid; gap: 9px; }
.assigned-row { display: grid; grid-template-columns: 1fr auto auto auto auto; align-items: center; gap: 14px; padding: 13px 15px; border: 1px solid #e1e8ea; border-radius: 13px; }
.link-employment-button { border: 1px solid #b8ddcf; border-radius: 10px; padding: 9px 12px; background: #edf9f4; color: #087f5b; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.link-employment-button:hover { background: #dff3eb; }
.link-employment-button:disabled { opacity: .55; cursor: wait; }
.link-employment-button svg { width: 15px; height: 15px; }
.assigned-company strong, .assigned-company small { display: block; }
.assigned-company strong { font-size: .83rem; }
.assigned-company small { margin-top: 3px; color: #7b8792; font-size: .69rem; }
.role-pill, .principal-pill { padding: 5px 9px; border-radius: 999px; font-size: .66rem; font-weight: 800; }
.role-pill { color: #40516a; background: #edf1f5; }
.principal-pill { color: #9b5b14; background: #fff1d9; }
.revoke-button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border: 0; border-radius: 9px; color: #b83e45; background: #fff0f0; font: inherit; font-size: .69rem; font-weight: 800; cursor: pointer; }
.revoke-button:hover { color: #fff; background: #c9464e; }
.revoke-button svg { width: 14px; }
.access-loading, .assigned-empty { padding: 28px 10px; color: #81909a; font-size: .8rem; text-align: center; }
.access-message { display: none; padding: 11px 16px; font-size: .8rem; font-weight: 700; }
.access-message.visible { display: block; }
.access-message.success { color: #0e684f; background: #dff5ed; }
.access-message.error { color: #aa3039; background: #ffebec; }

.corporate-scope {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 15px 20px;
    border: 1px solid #dbe7e3;
    border-top: 0;
    background: #f5faf8;
}
.corporate-scope[hidden] { display: none !important; }
.corporate-scope.active { background: #ecf8f4; border-color: #bfe3d7; }
.corporate-scope.global { color: #fff; background: #1c2c48; border-color: #1c2c48; }
.corporate-scope-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--accent-dark);
    background: #dcefe9;
}
.corporate-scope.global .corporate-scope-icon { color: #fff; background: rgba(255,255,255,.12); }
.corporate-scope-icon svg { width: 19px; }
.corporate-scope-copy { min-width: 0; }
.corporate-scope-copy strong, .corporate-scope-copy p { display: block; }
.corporate-scope-copy strong { margin-top: 2px; font-size: .86rem; }
.corporate-scope-copy p { margin: 2px 0 0; color: #6f7d87; font-size: .72rem; }
.corporate-scope.global .corporate-scope-copy p { color: rgba(255,255,255,.68); }
.corporate-scope-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: var(--accent);
    font: inherit;
    font-size: .74rem;
    font-weight: 800;
    cursor: pointer;
}
.corporate-scope-button:hover { background: var(--accent-dark); }
.corporate-scope-button:disabled { opacity: .55; cursor: wait; }
.corporate-scope-button svg { width: 15px; }

@media (max-width: 1300px) {
    .assignment-form { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
    .principal-check { align-self: center; }
    .assign-button { justify-self: end; min-width: 150px; }
}

@media (max-width: 1050px) {
    .access-layout { grid-template-columns: 1fr; }
    .account-panel { border-right: 0; border-bottom: 1px solid #e7edf0; border-radius: 0; }
    .account-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 230px; }
}

@media (max-width: 650px) {
    .access-hero { padding: 24px 20px; flex-direction: column; }
    .access-refresh { width: 100%; justify-content: center; }
    .account-list, .assignment-form { grid-template-columns: 1fr; }
    .assignment-panel { padding: 22px 16px; }
    .assign-button { width: 100%; min-width: 0; justify-self: stretch; }
    .assigned-row { grid-template-columns: 1fr auto; }
    .assigned-row .role-pill, .assigned-row .principal-pill { justify-self: start; }
    .revoke-button { grid-column: 2; grid-row: 1 / span 2; }
    .corporate-scope { grid-template-columns: auto 1fr; padding: 14px 16px; }
    .corporate-scope-button { grid-column: 1 / -1; width: 100%; }
}
