:root {
  --canvas:#f9f9fb; --paper:#fff; --chrome:#f3f3f6; --tint:#f6f6f9; --hover:#ededf2;
  --ink:#25252d; --body:#656570; --muted:#747480; --line:#e5e5eb; --control-border:#d9d9e1;
  --blue:#5262cd; --blue-hover:#4251ba; --blue-soft:#efeffb; --focus:#aab1ed;
  --nav-hover:#e1e6fb;
  --green:#287653; --green-soft:#edf7f1; --amber:#92621e; --amber-soft:#fcf5e8;
  --red:#b5424b; --red-soft:#fbf0f1;
  --font-ui:"PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  --text-body:14px; --text-small:12px; --text-label:13px; --text-section:16px; --text-title:22px; --text-dialog:18px;
  --weight-normal:400; --weight-medium:500; --weight-strong:600;
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-5:20px; --space-6:24px; --space-8:32px;
  --radius-sm:4px; --radius-control:6px; --radius-card:10px;
  --control-height:36px; --header-height:56px; --menu-height:224px; --list-height:448px;

  color-scheme:light; color:var(--ink); font:var(--weight-normal) var(--text-body)/24px var(--font-ui);
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; background:var(--canvas); -webkit-font-smoothing:antialiased; }
h1,h2,h3,p { margin:0; }
h1 { font-size:var(--text-title); line-height:32px; font-weight:var(--weight-strong); }
h2 { font-size:var(--text-dialog); line-height:28px; font-weight:var(--weight-strong); }
h3 { font-size:var(--text-label); line-height:20px; font-weight:var(--weight-medium); }
button,input,select { font:inherit; color:inherit; }
button,a { -webkit-tap-highlight-color:transparent; touch-action:manipulation; }
button { cursor:pointer; }
button:disabled { cursor:not-allowed; opacity:.55; }
button:focus-visible,a:focus-visible { outline:2px solid var(--blue); outline-offset:3px; }
a { color:var(--blue); text-decoration:none; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.topbar { min-height:var(--header-height); border-bottom:1px solid var(--line); background:var(--chrome); }
.topbar-inner { max-width:1440px; min-height:var(--header-height); margin:auto; padding:0 32px; display:flex; align-items:center; gap:32px; }
.brand { display:flex; align-items:center; gap:8px; white-space:nowrap; font-size:var(--text-body); font-weight:var(--weight-strong); }
.brand-mark { width:28px; height:24px; object-fit:contain; }
.account-nav { display:flex; align-items:center; gap:4px; }
.account-nav .button-text { min-height:32px; border-radius:6px; padding:4px 12px; }
.account-nav [aria-current="page"] { background:var(--paper); color:var(--ink); box-shadow:0 1px 2px rgb(24 24 35 / 12%); }
.account { margin-left:auto; display:flex; align-items:center; gap:8px; }
.current-user { max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:var(--text-small); color:var(--body); }
.workspace { max-width:1128px; margin:auto; padding:48px 24px 64px; }
#query-view { max-width:656px; margin:32px auto 0; }
#loading-view,#login-view,#access-view { max-width:460px; margin:16px auto 0; }
.eyebrow { color:var(--muted); font-size:var(--text-small); margin-bottom:12px; }
.page-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:24px; }
.heading-actions { display:flex; gap:8px; flex-shrink:0; }
.subtitle { color:var(--body); font-size:var(--text-label); margin-top:4px; }
.search-card { padding:24px; border:1px solid var(--line); border-radius:var(--radius-card); background:var(--paper); }
.admin-card { padding:0; border:0; background:transparent; }
.card-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:24px; }
.card-heading > div,.card-heading h1,.card-heading h2 { min-width:0; overflow-wrap:anywhere; }
.card-heading > button { flex-shrink:0; }
.helper { margin-top:4px; color:var(--muted); font-size:var(--text-small); line-height:20px; overflow-wrap:anywhere; }
.body-copy { color:var(--body); margin:8px 0 24px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px 16px; }
.field { position:relative; min-width:0; }
.field-name { grid-column:1/-1; }
label { display:block; font-size:var(--text-label); font-weight:var(--weight-medium); line-height:20px; margin:0 0 8px; }
input,select { width:100%; height:var(--control-height); border:1px solid var(--control-border); border-radius:var(--radius-control); padding:0 12px; font-size:var(--text-label); background:var(--paper); }
select { appearance:none; -webkit-appearance:none; background-image:linear-gradient(45deg,transparent calc(50% - .75px),var(--body) calc(50% - .75px),var(--body) calc(50% + .75px),transparent calc(50% + .75px)),linear-gradient(135deg,transparent calc(50% - .75px),var(--body) calc(50% - .75px),var(--body) calc(50% + .75px),transparent calc(50% + .75px)); background-repeat:no-repeat; background-position:right 20px center,right 12px center; background-size:8px 8px; padding-right:32px; }
input::placeholder { color:var(--muted); }
input:focus,select:focus { outline:2px solid var(--focus); outline-offset:1px; border-color:var(--blue); }
input[aria-invalid="true"] { border-color:var(--red); }
input:disabled,select:disabled { background-color:var(--tint); color:var(--muted); cursor:not-allowed; }
#customer-name { height:40px; font-size:var(--text-body); }
.menu-select { position:relative; }
.menu-trigger { padding-right:32px; text-align:left; }
.menu-chevron { position:absolute; top:6px; right:12px; color:var(--muted); pointer-events:none; }
.menu-options { position:absolute; z-index:30; top:calc(100% + 4px); left:0; width:100%; max-height:var(--menu-height); overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:4px; border:1px solid var(--line); border-radius:6px; background:var(--paper); box-shadow:0 8px 28px rgb(24 24 35 / 12%); }
.menu-option { display:block; min-height:32px; border-radius:4px; padding:4px 8px; font-size:var(--text-label); line-height:24px; cursor:pointer; overflow-wrap:anywhere; }
.menu-option:hover,.menu-option[data-focused="true"] { background:var(--tint); }
.menu-option[aria-selected="true"] { color:var(--blue); background:var(--blue-soft); }
.menu-empty { padding:12px; color:var(--muted); font-size:var(--text-label); }
.actions { display:flex; align-items:center; gap:12px; margin-top:24px; }
.button-primary,.button-secondary,.button-text { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:var(--control-height); padding:4px 12px; border:1px solid var(--control-border); border-radius:6px; font-size:var(--text-label); line-height:24px; font-weight:var(--weight-medium); background:var(--paper); text-decoration:none; }
.button-primary { color:#fff; background:var(--blue); border-color:var(--blue); }
.button-primary:hover:enabled,a.button-primary:hover { background:var(--blue-hover); }
.button-secondary:hover:enabled { background:var(--tint); }
.button-text { color:var(--body); background:transparent; border-color:transparent; font-weight:var(--weight-normal); }
.button-text:hover:enabled { background:var(--hover); }
.account-nav > :is(#query-nav,#admin-nav) { color:var(--blue); background:var(--blue-soft); border-color:var(--blue); }
.account-nav > :is(#query-nav,#admin-nav):hover:enabled { color:var(--blue-hover); background:var(--nav-hover); border-color:var(--blue-hover); }
.account-nav > :is(#query-nav,#admin-nav)[aria-current="page"] { color:var(--paper); background:var(--blue); border-color:var(--blue); }
.account-nav > :is(#query-nav,#admin-nav)[aria-current="page"]:hover:enabled { color:var(--paper); background:var(--blue-hover); border-color:var(--blue-hover); }
.account-nav > :is(#query-nav,#admin-nav):focus-visible { outline-color:var(--blue-hover); }
.button-primary.is-disabled { opacity:.55; cursor:not-allowed; }
.full-button { width:100%; }
.error,.field-error { margin-top:8px; color:var(--red); font-size:var(--text-small); line-height:20px; overflow-wrap:anywhere; }
.error:empty,.field-error:empty,.helper:empty { display:none; }
.notice { margin-bottom:16px; padding:12px 16px; border:1px solid #eadbbb; border-radius:6px; color:var(--amber); background:var(--amber-soft); font-size:var(--text-label); overflow-wrap:anywhere; }
.divider { display:flex; align-items:center; gap:12px; margin:24px 0 20px; color:var(--muted); font-size:var(--text-small); }
.divider::before,.divider::after { content:""; height:1px; background:var(--line); flex:1; }
.code-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
#sms-form { margin-top:16px; }
#sms-form > .field + .field { margin-top:16px; }
#sms-submit,.login-note { margin-top:20px; }
.result,.result-placeholder { margin-top:16px; border:1px solid var(--line); border-radius:6px; padding:20px; background:var(--paper); min-height:80px; }
.result-top,.result-placeholder { display:flex; align-items:center; gap:12px; }
.result h2 { font-size:var(--text-section); line-height:24px; }
.status-glyph { display:grid; place-items:center; width:32px; height:32px; border-radius:50%; background:var(--tint); color:var(--muted); flex:0 0 auto; }
.result-placeholder { border-style:dashed; background:transparent; color:var(--muted); font-size:var(--text-label); }
.result:not([hidden]) + .result-placeholder { display:none; }
.result.protected h2 { color:var(--red); }.result.protected .status-glyph { color:var(--red); background:var(--red-soft); }
.result.possible h2 { color:var(--amber); }.result.possible .status-glyph { color:var(--amber); background:var(--amber-soft); }
.result.clear h2 { color:var(--green); }.result.clear .status-glyph { color:var(--green); background:var(--green-soft); }
.section-tabs { display:flex; border-bottom:1px solid var(--line); gap:24px; margin-bottom:16px; }
.section-tab { border:0; border-bottom:2px solid transparent; background:none; color:var(--body); padding:12px 0; font-size:var(--text-label); min-height:44px; }
.section-tab[aria-pressed="true"] { color:var(--ink); border-bottom-color:var(--ink); font-weight:var(--weight-medium); }
.sub-tabs { display:flex; gap:4px; margin-bottom:12px; }
.sub-tabs [aria-pressed="true"] { background:var(--hover); color:var(--ink); }
#grant-scope { margin:12px 0; }
.list-title { font-size:var(--text-label); font-weight:var(--weight-medium); line-height:20px; }
.list-search { display:flex; align-items:center; gap:12px; margin:12px 0 16px; }
.list-search input { min-width:0; flex:1; max-width:320px; }
.list-search select { width:112px; flex:0 0 auto; }
.grant-table { border:1px solid var(--line); border-radius:6px; overflow:hidden; background:var(--paper); }
.table-head,.grant-row { display:grid; grid-template-columns:minmax(0,2.3fr) minmax(0,1fr) minmax(0,1.2fr) 84px 64px; align-items:center; gap:16px; padding:12px 16px; }
.table-head { color:var(--body); background:var(--tint); font-size:var(--text-small); border-bottom:1px solid var(--line); }
.grants-scroll { max-height:clamp(120px,calc(100dvh - 560px),var(--list-height)); overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.grant-row { min-height:64px; border-bottom:1px solid var(--line); font-size:var(--text-label); }
.grant-row:last-child { border-bottom:0; }
.grant-identity { min-width:0; display:flex; align-items:center; gap:12px; }
.type-icon { width:28px; height:28px; display:grid; place-items:center; border-radius:6px; background:var(--tint); color:var(--muted); flex:0 0 auto; font-size:12px; }
.identity-copy { min-width:0; }
.identity-copy h2 { font-size:var(--text-label); line-height:22px; font-weight:var(--weight-medium); overflow-wrap:anywhere; }
.identity-copy .helper { margin:0; }
.role-cell,.expiry-cell { overflow-wrap:anywhere; }
.expiry-cell { color:var(--body); font-size:var(--text-small); }
.grant-status { color:var(--green); font-size:var(--text-small); white-space:nowrap; }
.grant-status::before { content:""; display:inline-block; width:6px; height:6px; margin-right:4px; background:currentColor; border-radius:50%; vertical-align:middle; }
.grant-status.inactive { color:var(--muted); }
.grant-row .button-text { font-size:var(--text-small); padding:4px 8px; }
.list-state { padding:32px 16px; margin:0; color:var(--muted); font-size:var(--text-label); text-align:center; }
.pagination { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; color:var(--muted); }
.pagination .helper { margin:0; text-align:center; }
.pagination .button-secondary { min-height:28px; padding:0 8px; font-size:var(--text-small); }
/* Modal chrome never shares the scroll container with the selection content. */
dialog { width:min(432px,calc(100vw - 48px)); max-width:calc(100vw - 48px); max-height:calc(100dvh - 48px); padding:24px; overflow-y:auto; border:1px solid var(--line); border-radius:10px; color:var(--ink); background:var(--paper); box-shadow:0 24px 80px rgb(24 24 35 / 12%); }
dialog::backdrop { background:rgb(34 34 45 / 24%); }
fieldset { margin:0; padding:0; border:0; min-width:0; }
#grant-form .field,#department-form .field { margin-top:16px; }
#selected-department { overflow-wrap:anywhere; }
.organization-dialog { width:936px; height:min(696px,calc(100dvh - 64px)); max-height:calc(100dvh - 64px); padding:0; overflow:hidden; }
#organization-form { display:flex; flex-direction:column; height:100%; max-height:100%; min-height:0; }
.organization-dialog .card-heading { flex-shrink:0; margin:0; padding:20px 24px 16px; border-bottom:1px solid var(--line); }
.organization-dialog .card-heading h2 { font-size:var(--text-dialog); }
.organization-dialog .card-heading .helper { margin-top:4px; }
.picker-panel-tabs { display:none; }
.picker-body { flex:1; min-height:0; overflow:hidden; }
#picker-fields { height:100%; }
.picker-workspace { display:grid; grid-template-columns:1.1fr 1fr; height:100%; min-height:0; overflow:hidden; }
.picker-pane,.picker-selection { display:flex; flex-direction:column; min-height:0; min-width:0; }
.picker-pane { border-right:1px solid var(--line); }
.picker-search { display:flex; align-items:center; gap:8px; padding:16px 16px 12px; flex-shrink:0; }
.picker-search select { width:88px; flex:0 0 88px; padding-left:8px; }
.picker-search input { min-width:0; flex:1; }
.picker-search button { padding-inline:4px; font-size:var(--text-small); }
.picker-source-tabs { display:flex; gap:8px; padding:0 12px; flex-shrink:0; }
.picker-source-tabs .button-text { min-height:28px; font-size:var(--text-small); padding:0 4px; }
.picker-source-tabs [aria-pressed="true"] { color:var(--blue); }
#organization-path { margin:4px 16px 8px; flex-shrink:0; }
.organization-list { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:0 8px 12px; }
.picker-tree-row { display:flex; align-items:center; gap:8px; min-width:0; min-height:44px; padding:4px 8px; padding-left:min(calc(8px + var(--tree-depth,0)*20px),80px); border-radius:6px; font-size:var(--text-label); }
.picker-tree-row:hover { background:var(--tint); }
.picker-tree-row:has(input:checked) { background:var(--blue-soft); }
.picker-tree-row:has(input[data-included="true"]) { background:var(--tint); }
.picker-choice { display:flex; flex:1; align-items:center; gap:8px; margin:0; min-width:0; padding:4px 0; font-size:var(--text-label); line-height:20px; font-weight:var(--weight-normal); cursor:pointer; }
.picker-choice span { min-width:0; overflow-wrap:anywhere; }
.picker-choice input { width:16px; height:16px; flex:0 0 16px; padding:0; margin:0; accent-color:var(--blue); }
.picker-choice input:disabled { cursor:not-allowed; }
.picker-kind { color:var(--muted); font-size:var(--text-small); margin-right:6px; }
.inherit-tag { color:var(--muted); font-size:var(--text-small); white-space:nowrap; }
.picker-expand { order:-1; display:grid; place-items:center; width:24px; height:28px; flex:0 0 24px; border:0; border-radius:4px; background:transparent; color:var(--muted); padding:0; font-size:18px; }
.picker-expand:hover:enabled { background:var(--hover); }
.picker-expand[aria-expanded="true"] .icon { transform:rotate(90deg); }
.picker-pane-heading { display:flex; align-items:center; justify-content:space-between; padding:16px; min-height:60px; gap:8px; flex-shrink:0; }
.picker-pane-heading .button-text { color:var(--blue); font-size:var(--text-small); min-height:28px; padding:0; }
.picker-selected-row { display:flex; align-items:center; gap:12px; padding:8px; border-radius:6px; font-size:var(--text-label); }
.picker-selected-row:hover { background:var(--tint); }
.picker-selected-row > div { flex:1; min-width:0; overflow-wrap:anywhere; }
.picker-selected-row .button-text { flex-shrink:0; font-size:var(--text-small); min-height:32px; padding:0 4px; }
.picker-selected-path { color:var(--muted); font-size:var(--text-small); line-height:20px; }
.picker-pagination { display:flex; align-items:center; justify-content:space-between; gap:4px; padding:4px 12px; border-top:1px solid var(--line); flex-shrink:0; }
.picker-pagination .button-text { min-height:28px; font-size:var(--text-small); padding:0 4px; }
.picker-pagination .helper { margin:0; }
.picker-branch-pagination { display:flex; align-items:center; gap:4px; padding-left:min(calc(var(--tree-depth,0)*20px),80px); }
.picker-branch-pagination .button-text { font-size:var(--text-small); min-height:28px; padding:0 4px; }
.picker-settings { padding:12px 24px; background:var(--tint); border-top:1px solid var(--line); flex-shrink:0; max-height:40%; overflow-y:auto; }
.settings-fields { display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.compact-field { display:flex; align-items:center; gap:8px; font-size:var(--text-small); }
.compact-field label { margin:0; font-size:var(--text-small); color:var(--body); font-weight:var(--weight-normal); }
.compact-field select { width:128px; height:32px; font-size:var(--text-small); }
.compact-field input { width:152px; height:32px; font-size:var(--text-small); }
.picker-footer { display:flex; flex-shrink:0; align-items:center; justify-content:space-between; gap:8px; background:var(--paper); border-top:1px solid var(--line); margin:0; padding:16px 24px; }
.picker-footer .actions { margin:0; gap:8px; }
.picker-footer > .helper { margin:0; }
.picker-confirmation { flex:1; min-height:0; overflow-y:auto; padding:20px 24px; }
.confirmation-list { max-height:240px; overflow-y:auto; margin:16px 0; border:1px solid var(--line); border-radius:6px; }
.confirmation-row { padding:8px 12px; border-bottom:1px solid var(--line); font-size:var(--text-label); overflow-wrap:anywhere; }
.confirmation-row:last-child { border:0; }
@media(max-height:760px) and (min-width:641px) {
  .workspace { padding-top:32px; } #query-view { margin-top:8px; }
  .organization-dialog { height:calc(100dvh - 40px); max-height:calc(100dvh - 40px); }
}
@media(max-width:760px) {
  .table-head,.grant-row { grid-template-columns:minmax(0,1.8fr) 96px 80px 64px; gap:8px; }
  .table-head > :nth-child(3),.expiry-cell { display:none; }
  .topbar-inner { gap:16px; padding:0 20px; }
  .current-user { max-width:110px; }
}
@media(max-width:640px) {
  :root { --control-height:48px; --menu-height:240px; --header-height:104px; }
  h1 { font-size:20px; line-height:28px; }
  .topbar-inner { display:grid; grid-template-columns:1fr auto; gap:0 8px; padding:8px 16px 0; }
  .brand { min-height:40px; }.account { grid-row:1; grid-column:2; }.current-user { max-width:90px; }
  .account-nav { grid-column:1/-1; grid-row:2; height:48px; gap:16px; }
  .account-nav .button-text { padding:0 4px; height:48px; border-radius:0; }
  .account-nav [aria-current="page"] { box-shadow:none; background:transparent; border-bottom:2px solid var(--ink); }
  .workspace { padding:32px 16px 40px; } #query-view { margin-top:0; }
  .search-card { padding:20px; }.admin-card { padding:0; }
  .eyebrow { margin-bottom:8px; }.page-heading { margin-bottom:20px; }
  .admin-card .page-heading { flex-direction:column; align-items:stretch; }.heading-actions > button { flex:1; }
  input,select,#customer-name { font-size:16px; } #customer-name { height:48px; }
  .form-grid { gap:16px 12px; }
  .menu-chevron { top:12px; }.menu-option { min-height:48px; }
  .actions { margin-top:20px; } #query-submit { flex:1; }
  .result,.result-placeholder { padding:16px; }
  .list-search { flex-wrap:wrap; gap:8px; }.list-search input { max-width:none; flex-basis:calc(100% - 120px); }
  .list-search select { width:112px; }.list-search > button { min-height:36px; }
  .section-tabs { gap:20px; }.section-tab { min-height:48px; }
  .table-head { display:none; }
  .grant-row { grid-template-columns:minmax(0,1fr) 64px; gap:0 8px; padding:12px; min-height:88px; }
  .grant-identity { grid-row:1/3; gap:8px; }.role-cell { grid-column:1; margin-left:36px; font-size:var(--text-small); color:var(--body); }
  .grant-status { grid-column:2; grid-row:1; justify-self:center; }.grant-row .button-text { grid-column:2; grid-row:2/4; width:100%; min-height:44px; }
  .grants-scroll { max-height:440px; }.pagination .button-secondary { min-height:44px; padding:0 12px; }
  .pagination { gap:4px; }.pagination .helper { font-size:11px; }
  dialog { max-width:calc(100vw - 24px); width:min(432px,calc(100vw - 24px)); padding:20px; }
  .organization-dialog { width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; margin:0; border:0; border-radius:0; padding:0; }
  .organization-dialog .card-heading { padding:12px 16px; }
  .organization-dialog .card-heading .button-text { padding:4px 8px; }
  .picker-panel-tabs { display:flex; gap:24px; padding:0 16px; border-bottom:1px solid var(--line); flex-shrink:0; }
  .picker-panel-tabs [aria-pressed="true"] { border-bottom-color:var(--ink); border-radius:0; color:var(--ink); }
  .picker-workspace { display:flex; }.picker-pane,.picker-selection { width:100%; border:0; }
  .picker-workspace[data-panel="candidates"] #picker-selected-pane,.picker-workspace[data-panel="selected"] #picker-candidates { display:none; }
  .picker-search { padding:12px 16px; gap:8px; }.picker-search select { width:88px; flex-basis:88px; font-size:13px; }.picker-search button { min-width:32px; }
  .picker-tree-row { min-height:52px; padding-left:min(calc(8px + var(--tree-depth,0)*16px),64px); }
  .picker-expand { width:32px; height:48px; flex-basis:32px; }.picker-choice input { width:20px; height:20px; flex-basis:20px; }
  .picker-selected-row .button-text,.picker-pagination .button-text { min-height:44px; }
  .picker-pane-heading { min-height:56px; padding:12px 16px; }
  .picker-settings { padding:12px 16px; }.settings-fields { gap:12px; }.compact-field { flex-wrap:wrap; }
  .compact-field > label { display:none; }.compact-field select { height:40px; width:120px; font-size:14px; }.compact-field input { height:40px; width:144px; font-size:16px; }
  .picker-footer { padding:12px 16px max(12px,env(safe-area-inset-bottom)); }.picker-footer > .helper { display:none; }.picker-footer .actions { width:100%; }.picker-footer .actions > button { flex:1; }
  .picker-confirmation { padding:16px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; } }

.picker-choice[data-kind="person"] { padding-left:32px; }
@media(max-width:640px) { .picker-choice[data-kind="person"] { padding-left:40px; } }

@media(max-width:640px) {
  .topbar[data-navigation="false"],.topbar[data-navigation="false"] .topbar-inner { min-height:56px; }
  .topbar[data-navigation="false"] .topbar-inner { display:flex; padding:8px 16px; }
}

.icon-defs { position:absolute; }
.icon { display:inline-block; width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
#grant-new::before { content:"+"; font-size:18px; line-height:16px; font-weight:400; }

.picker-confirmation { order:2; }
.picker-settings { order:3; }
.picker-footer { order:4; }

#grant-form .actions,#department-form .actions { justify-content:flex-end; }
@media(max-width:640px) { #picker-expiry-mode { width:140px; } }

.notice[data-tone="success"] { color:var(--green); background:var(--green-soft); border-color:#d5e8dc; }

/* V2.8: one internal rule list and an explicit primary authorization switch. */
.section-tabs { display:inline-flex; gap:4px; padding:4px; border:0; border-radius:8px; background:var(--tint); margin-bottom:20px; }
.section-tab { min-height:44px; padding:8px 16px; border:0; border-radius:6px; background:transparent; color:var(--body); white-space:nowrap; }
.section-tab:hover { background:var(--hover); }
.section-tab[aria-pressed="true"] { color:#fff; background:var(--blue); font-weight:var(--weight-medium); }
.section-tab[aria-pressed="true"]:hover { background:var(--blue-hover); }
#grants-kind-field { flex:0 0 auto; }
.table-head,.grant-row { grid-template-columns:minmax(0,2.3fr) minmax(0,1fr) minmax(0,1.2fr) 84px 152px; }
.grant-actions { display:flex; align-items:center; justify-content:flex-end; gap:4px; }
.grant-actions .button-text { padding-inline:6px; white-space:nowrap; }
.grant-actions .members-action { color:var(--blue); }
.members-dialog { width:680px; height:min(620px,calc(100dvh - 64px)); max-height:calc(100dvh - 64px); padding:0; overflow:hidden; }
.members-frame { height:100%; min-height:0; display:flex; flex-direction:column; }
.members-dialog .card-heading { margin:0; padding:20px 24px 12px; border-bottom:1px solid var(--line); flex-shrink:0; }
#members-note { margin:12px 24px 0; flex-shrink:0; }
.members-dialog .list-search { padding:0 24px; flex-shrink:0; }
.members-dialog .list-search input { max-width:none; }
.members-scroll { flex:1; min-height:0; padding:0 24px 12px; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.member-row { padding:12px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.member-name { font-size:var(--text-body); line-height:24px; }
.members-footer { display:flex; align-items:center; gap:12px; padding:12px 24px; border-top:1px solid var(--line); flex-shrink:0; }
.members-footer .pagination { flex:1; min-width:0; padding:0; }
.members-footer .button-secondary,.members-dialog .card-heading .button-text { min-height:44px; }
.members-footer > button { flex-shrink:0; }
@media(max-width:760px) {
  .table-head,.grant-row { grid-template-columns:minmax(0,1.8fr) 96px 80px 152px; }
}
@media(max-width:640px) {
  .section-tabs { display:flex; width:100%; gap:4px; }
  .section-tab { flex:1; min-width:0; padding:8px 4px; font-size:var(--text-label); }
  .grant-row { grid-template-columns:minmax(0,1fr) 96px; }
  .grant-actions { grid-column:2; grid-row:2/4; flex-direction:column; align-items:stretch; gap:0; }
  .grant-actions .button-text { width:100%; min-height:44px; padding-inline:4px; }
  #grants-kind-field { flex-basis:calc(50% - 4px); }
  #grants-kind,#grants-status { width:100%; }
  .list-search input { flex-basis:100%; }
  #grants-status { flex-basis:calc(50% - 4px); }
  #grants-kind-field[hidden] + label + #grants-status { flex-basis:112px; }
  .members-dialog { width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; margin:0; border:0; border-radius:0; }
  .members-dialog .card-heading { padding:12px 16px; }
  #members-note { margin:12px 16px 0; }
  .members-dialog .list-search { padding:0 16px; }
  .members-dialog .list-search input { flex-basis:100%; }
  .members-scroll { padding-inline:16px; }
  .members-footer { gap:8px; padding:12px 16px max(12px,env(safe-area-inset-bottom)); flex-wrap:wrap; }
  .members-footer .pagination { flex-basis:100%; }
  .members-footer > button { margin-left:auto; }
}

/* Profile data is presentation only; department and external icons stay distinct. */
.person-identity { display:flex; align-items:flex-start; gap:8px; min-width:0; width:100%; }
.person-avatar { position:relative; display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; flex:0 0 28px; overflow:hidden; border-radius:50%; background:var(--tint); color:var(--muted); }
.person-avatar .icon { width:18px; height:18px; }
.person-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.profile-copy { min-width:0; flex:1; }
.profile-name { display:block; overflow-wrap:anywhere; }
.profile-paths { display:block; color:var(--muted); font-size:var(--text-small); line-height:20px; font-weight:var(--weight-normal); overflow-wrap:anywhere; }
.profile-paths > span { display:block; }
.current-identity { min-width:0; }
.current-user,.current-profile-note { display:block; }
.current-profile-note { max-width:180px; font-size:var(--text-small); line-height:16px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#current-avatar .person-avatar { width:28px; height:28px; flex-basis:28px; }
.account { min-width:0; }
.account > button { flex-shrink:0; }
.picker-choice > .person-identity { flex:1; }
.picker-choice .person-avatar { flex-basis:28px; width:28px; height:28px; }
.member-row .profile-name { font-size:var(--text-body); line-height:24px; }
@media(max-width:640px) { .current-profile-note { max-width:90px; } #current-avatar .person-avatar { width:24px; height:24px; flex-basis:24px; } }

.picker-choice .profile-name,.picker-selected-row .profile-name { display:inline; }
