/* Profile fields have their own grid: shared flex minimums otherwise make
   short name fields wide and helper text push adjacent inputs out of line. */
#tab-profile .profile-card{max-width:1120px}
#tab-profile .profile-intro{font-size:14px;color:var(--muted);line-height:1.7;margin:0 0 22px;max-width:78ch}
#tab-profile .profile-grid{display:grid;gap:18px 16px;align-items:start;margin-bottom:22px}
#tab-profile .profile-name-grid{grid-template-columns:minmax(90px,.7fr) minmax(0,2fr) minmax(0,1.6fr) minmax(0,2fr) minmax(80px,.7fr);align-items:start}
#tab-profile .profile-work-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
#tab-profile .profile-grid .form-group{min-width:0;max-width:none;margin:0}
#tab-profile .profile-grid input,#tab-profile .profile-grid select{box-sizing:border-box;width:100%;min-width:0;min-height:44px;font:inherit;font-size:14px}
#tab-profile .profile-grid small{font-size:12px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}
#tab-profile .profile-actions{display:flex;justify-content:flex-start;margin-top:4px}
#tab-profile .profile-actions .btn{min-height:44px}
#tab-profile #profile-clearance-badges{align-items:flex-start}
#tab-profile #profile-clearance-badges .badge{white-space:normal;overflow-wrap:anywhere;line-height:1.5}
#tab-profile .session-actions{display:flex;flex-wrap:wrap;gap:10px}
#tab-profile .session-actions .btn{min-height:44px}
#tab-profile .session-row>*{min-width:0;overflow-wrap:anywhere}
@media(max-width:1100px){
  #tab-profile .profile-name-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:600px){
  #tab-profile .profile-name-grid,#tab-profile .profile-work-grid{grid-template-columns:minmax(0,1fr)}
  #tab-profile .profile-grid input,#tab-profile .profile-grid select{font-size:16px}
  #tab-profile .profile-actions .btn{width:100%}
}
/* User ID (migration 045): can be used instead of the email to sign in. */
#tab-profile .profile-user-id{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;margin:-8px 0 20px;padding:10px 14px;border-radius:10px;background:var(--bg);border:1px solid var(--border);font-size:13px;color:var(--slate)}
#tab-profile .profile-user-id[hidden]{display:none}
#tab-profile .profile-user-id b{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:15px;letter-spacing:.06em}
#tab-profile .profile-user-id span{font-size:12px;color:var(--muted)}
/* Settings → Two-factor sign-in */
.totp-required-note{margin:0 0 14px;padding:10px 14px;border-radius:10px;background:rgba(245,158,11,.16);color:var(--slate);font-size:13.5px;font-weight:650;line-height:1.55}
.totp-required-note[hidden]{display:none}
.totp-steps{margin:0 0 16px;padding-left:20px;font-size:14px;line-height:1.7;color:var(--slate)}
.totp-qr{flex:0 0 auto;width:180px;padding:8px;background:#fff;border-radius:10px;border:1px solid var(--border);font-size:12px;color:#334155}
.totp-qr[hidden]{display:none}
.totp-qr svg{display:block;width:100%;height:auto}
.totp-help{font-size:12.5px;color:var(--muted);margin:10px 0 0}
#my-totp-card [hidden]{display:none!important}
#settings-telegram[hidden]{display:none!important}
/* Profile → Secondary offices */
.prof-secondary{margin:22px 0 6px;padding-top:18px;border-top:1px solid var(--border)}
.prof-secondary[hidden],.prof-secondary-form[hidden]{display:none}
.prof-secondary h3{font-size:15px;margin:0 0 6px}
.prof-secondary-lead{font-size:13px;color:var(--muted);line-height:1.6;margin:0 0 12px}
.prof-secondary-list{list-style:none;padding:0;margin:0 0 14px;display:grid;gap:8px}
.prof-secondary-list li{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:14px;padding:10px 12px;border:1px solid var(--border);border-radius:10px}
.prof-secondary-list .prof-secondary-empty{color:var(--muted);border-style:dashed}
.prof-secondary-form{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end}
.prof-secondary-form label{display:grid;gap:5px;font-size:12px;font-weight:700;color:var(--muted);flex:1 1 220px;min-width:0}
.prof-secondary-form select,.prof-secondary-form input{min-height:40px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:var(--card);color:var(--slate);font:inherit;width:100%}
.prof-secondary-note{font-size:12.5px;color:var(--muted);margin:8px 0 0}
.prof-secondary-note:empty{display:none}
/* Users → office requests and Edit profile */
.usr-office-request{margin-top:8px;font-size:12.5px;display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.usr-office-request-actions{display:inline-flex;gap:6px}
.eup-dialog{border:1px solid var(--border);border-radius:14px;padding:22px;max-width:640px;width:calc(100% - 32px);background:var(--card);color:var(--slate)}
.eup-dialog::backdrop{background:rgba(15,23,42,.45)}
.eup-dialog h3{margin:0 0 4px;font-size:18px}
.eup-who{font-size:12.5px;color:var(--muted);margin:0 0 14px;overflow-wrap:anywhere}
.eup-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.eup-grid label{display:grid;gap:5px;font-size:12px;font-weight:700;color:var(--muted)}
.eup-grid input{min-height:40px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--slate);font:inherit;width:100%}
.eup-note{font-size:12px;color:var(--muted);margin:12px 0 0}
.eup-error{color:var(--red,#dc2626);font-size:13px;margin:8px 0 0}
.eup-error:empty{display:none}
.eup-actions{display:flex;gap:8px;margin-top:14px}
@media(max-width:600px){.eup-grid{grid-template-columns:1fr}}
dialog.eup-dialog{position:fixed;inset:0;margin:auto;height:fit-content;max-height:92dvh;overflow:auto}
/* Edit Profile → EDMS record */
.eup-edms{margin-top:14px;padding:12px 14px;border:1px solid var(--border);border-radius:10px}
.eup-edms h4{margin:0 0 4px;font-size:14px}
.eup-edms-now{font-size:13px;margin:0 0 8px;overflow-wrap:anywhere}
.eup-edms-buttons{display:flex;gap:8px;flex-wrap:wrap}
.eup-edms-panel{margin-top:10px}
.eup-edms-panel[hidden],.eup-edms-buttons [hidden]{display:none}
.eup-edms-panel input{width:100%;min-height:40px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--slate);font:inherit}
.eup-edms-list{list-style:none;margin:8px 0 0;padding:0;max-height:300px;overflow:auto;display:grid;gap:6px}
.eup-edms-list li{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;font-size:13px}
.eup-edms-list li.is-current{border-color:var(--blue)}
.eup-edms-who{min-width:0;display:grid;gap:2px;overflow-wrap:anywhere}
.eup-edms-who small{color:var(--muted);font-size:11.5px}
.eup-edms-tags{display:flex;gap:4px;flex-wrap:wrap}
.eup-edms-why{font-size:11.5px;color:var(--muted);text-align:right;max-width:40%}
.eup-edms-none{color:var(--muted);border-style:dashed!important}
/* Settings → Approved devices (System Administrator) */
.adv-lead{font-size:14px;color:var(--muted);line-height:1.6;margin:0 0 10px}
.adv-status{font-size:13.5px;font-weight:700;margin:0 0 10px}
.adv-status.is-on{color:var(--green,#16a34a)}
.adv-status.is-off{color:#b45309}
.adv-list{list-style:none;padding:0;margin:0 0 14px;display:grid;gap:8px}
.adv-list li{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;font-size:14px}
.adv-list li>span{display:grid;gap:2px;min-width:0}
.adv-list small{color:var(--muted);font-size:12px}
.adv-none{color:var(--muted);border-style:dashed!important}
.adv-actions{display:flex;gap:8px;flex-wrap:wrap}
.adv-actions [hidden],.adv-code[hidden]{display:none!important}
.adv-code{margin-top:12px;padding:12px 14px;border-radius:10px;background:var(--blue-lt);display:grid;gap:4px}
.adv-code b{font-family:monospace;font-size:24px;letter-spacing:3px;color:var(--blue)}
.adv-code span{font-size:13px;color:var(--slate)}
.adv-help{font-size:12px;color:var(--muted);margin:12px 0 0;overflow-wrap:anywhere}
.adv-list li>span .badge{justify-self:start}
/* Space between the password box and the buttons below it */
#my-admin-devices-card .form-group{margin:4px 0 0}
#my-admin-devices-card .adv-actions{margin-top:14px}
#my-totp-card #s-totp-secret+.btn{display:inline-flex;width:auto!important;align-self:flex-start;justify-self:start;margin-top:8px}
#my-totp-card .form-row+.form-row{margin-top:6px}

/* My Profile: "I have no middle name" under the middle name box (migration 090). */
.prof-no-middle{display:flex;align-items:center;gap:6px;margin-top:6px;font-size:12.5px;font-weight:600;color:var(--muted);text-transform:none;letter-spacing:0;cursor:pointer}
#tab-profile .prof-no-middle input[type=checkbox]{width:16px;height:16px;min-height:0;padding:0;margin:0;flex:none}
