/* Account access and administration use the same visual language as the CRM. */
.crm-auth-locked .app-shell { visibility: hidden; }
.app-shell[hidden] { display: none; }
.crm-auth-locked { overflow: hidden; }
.crm-auth-screen { position: fixed; inset: 0; z-index: 1000; overflow-y: auto; background: radial-gradient(ellipse 80% 55% at 50% -8%, var(--green-soft) 0%, rgba(238,242,220,0) 70%), var(--paper); display: flex; flex-direction: column; align-items: center; padding: 64px 20px 32px; }
.auth-brand-block { display: grid; grid-template-columns: 42px auto; grid-template-rows: auto auto; gap: 2px 14px; margin-bottom: 32px; align-items: center; }
.auth-brand-mark { position: relative; grid-row: 1 / 3; justify-self: center; width: 40px; height: 48px; background: var(--flesh); border: 3px solid var(--green); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; font-size: 0; color: transparent; }
.auth-brand-mark::after { content: ""; position: absolute; left: 50%; bottom: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--pit); transform: translateX(-50%); }
.auth-brand-block strong { font-size: 20px; letter-spacing: -.01em; }
.auth-brand-block span { font-size: 11px; color: var(--muted); letter-spacing: .12em; }
.auth-card { width: min(100%, 440px); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 40px 36px 36px; box-shadow: 0 30px 80px rgba(42, 51, 32, .07); }
.auth-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; }
.auth-card .eyebrow { margin-bottom: 8px; }
.auth-intro { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0 0 26px; overflow-wrap: anywhere; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.auth-field input, .auth-field select { width: 100%; min-width: 0; padding: 12px 14px; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 10px; transition: border-color .15s ease, box-shadow .15s ease; background: #fff; outline: none; font-size: 14px; font-weight: 500; }
.auth-field input:focus, .auth-field select:focus { border-color: var(--green); box-shadow: var(--focus); }
.auth-field input[readonly], .auth-field select:disabled { background: var(--subtle); color: var(--muted); }
.auth-hint { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: -8px; display: block; }
.auth-checkbox { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); cursor: pointer; width: fit-content; }
.auth-checkbox input { width: 15px; height: 15px; margin: 0; accent-color: var(--green); }
.auth-submit { min-height: 46px; margin-top: 6px; font-size: 15px; }
.auth-error { color: var(--red); background: var(--red-soft); border-radius: 9px; padding: 10px 12px; font-size: 12px; line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
.auth-error[hidden] { display: none; }
.auth-help { text-align: center; color: var(--muted); font-size: 11px; margin: 20px 0 0; }
.auth-local-note { color: var(--muted); font-size: 11px; margin-top: 20px; }
.auth-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
.auth-dialog .dialog-head { margin-bottom: 3px; align-items: center; }
.auth-dialog .dialog-head h2 { font-size: 21px; }
.auth-dialog .auth-intro { margin-bottom: 0; }
.auth-dialog .auth-info { margin: 0; color: var(--muted); background: var(--subtle); border: 1px solid var(--line); border-radius: 9px; font-size: 12px; line-height: 1.7; padding: 12px; }
.auth-dialog .dialog-actions { margin-top: 6px; }
.auth-notice { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 2000; background: var(--skin); color: #fff; border-radius: 12px; padding: 13px 18px; max-width: calc(100% - 32px); box-shadow: var(--shadow); font-size: 13px; }
.auth-notice.is-error { background: var(--red); }
.auth-card .eyebrow { color: var(--green); }
.auth-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.account-role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
.account-role-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; align-items: flex-start; gap: 12px; }
.account-role-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--green-ink); background: var(--green-soft); border-radius: 50%; font-size: 17px; font-weight: 700; flex: 0 0 auto; }
.account-role-card strong { font-size: 14px; font-weight: 600; line-height: 1.7; }
.account-role-card p { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 5px 0 0; }
.account-search { max-width: 100%; }
.account-table th { padding-top: 14px; padding-bottom: 14px; }
.account-table td { padding-top: 17px; padding-bottom: 17px; }
.account-table td > strong, .account-table td small { display: block; }
.account-table td small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.account-role-tag { background: var(--hover); border-radius: 999px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.account-self { display: inline-flex; vertical-align: middle; color: var(--green-ink); background: var(--green-soft); font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px; margin-left: 3px; }
.account-table .action-row { flex-wrap: nowrap; }
.account-table button { white-space: nowrap; }
.account-audit-panel { margin-top: 24px; }
.account-audit-table td:first-child { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.account-audit-table td:last-child { overflow-wrap: anywhere; min-width: 170px; }
.account-user-menu { display: flex; align-items: center; gap: 8px; }
.account-user-label { display: flex; flex-direction: column; gap: 3px; text-align: right; font-size: 13px; font-weight: 600; }
.account-user-label small { font-size: 10px; color: var(--muted); font-weight: 500; }
.account-delegation-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 40px; background: var(--green-soft); border-bottom: 1px solid var(--green-line); color: var(--green-ink); font-size: 13px; line-height: 1.65; }
.account-delegation-banner[hidden] { display: none; }
.account-delegation-banner > span { overflow-wrap: anywhere; }
.account-delegation-banner .button { flex: 0 0 auto; }
.account-switch-list { display: grid; gap: 9px; max-height: 340px; overflow-y: auto; }
.account-switch-option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s ease, background-color .15s ease; background: #fff; cursor: pointer; }
.account-switch-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.account-switch-option:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.account-switch-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); flex: 0 0 auto; }
.account-switch-option strong { display: block; color: var(--ink); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.account-switch-option small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .account-role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .crm-auth-screen { padding-top: 28px; }
  .auth-card { padding: 24px; }
  .auth-brand-block { margin-bottom: 22px; }
  .account-role-grid { grid-template-columns: 1fr; gap: 9px; }
  .account-role-card { padding: 13px; }
  .accounts-section .welcome-row, .accounts-section .panel-head { align-items: stretch; flex-direction: column; }
  .accounts-section .panel-head .search { width: 100%; }
  .account-user-label { max-width: 110px; overflow-wrap: anywhere; }
  .account-delegation-banner { padding: 12px 18px; align-items: flex-start; flex-direction: column; gap: 9px; }
}
