/* ---------- the console's dialogs: the shared .a-modal shell (DS-40, DS-42) ----------
   `.a-scrim` > `.a-modal.a-admin-dlg` > `.a-drawer-h` (h2 + close), `.a-drawer-b`, `.a-drawer-f`. Opened through
   altModalOpen()/altModalClose(). The bands' padding is alt-shared-dialogs.css's; this sets the size and the flex that
   alt-tasks.css (not loaded here) gives the drawer bands. A footer stacks below 520px so a danger action and Cancel fit. */
.a-modal.a-admin-dlg{width:min(480px, 94vw); height:auto; max-height:min(680px, 88vh);}
.a-modal.a-admin-dlg.wide{width:min(640px, 94vw);}
.a-admin-dlg > .a-drawer-h{display:flex; align-items:center; gap:var(--a-sp-8); flex:0 0 auto;}
.a-admin-dlg > .a-drawer-h h2{flex:1 1 auto; min-width:0; overflow-wrap:anywhere;}
.a-admin-dlg > .a-drawer-b{flex:1 1 auto; min-height:0; overflow-y:auto; display:flex; flex-direction:column; gap:var(--a-sp-12);}
.a-admin-dlg > .a-drawer-b.is-flow{display:block;}  /* the account and password bodies lay themselves out */
.a-admin-dlg > .a-drawer-f{flex:0 0 auto;}
@media (max-width:520px){
  .a-admin-dlg > .a-drawer-f{flex-direction:column-reverse; align-items:stretch;}
  .a-admin-dlg > .a-drawer-f .a-btn{justify-content:center;}
}

/* ---------- the page frame: body, panes, the pane grid ----------
   Moved out of admin.html's inline <style> (DS-A, wave 2); roles for rows, badges, headings, notices and fields are in CSS/alt/alt-admin.css. */
body{background:var(--a-bg); color:var(--a-text); height:100vh; height:100dvh; font-family:var(--a-body); line-height:var(--a-lh-ui); display:flex; flex-direction:column; overflow:hidden;}  /* DS-47: nothing here is `normal` */
input[type=search]{appearance:none; -webkit-appearance:none;}
input[type=search]::-webkit-search-decoration, input[type=search]::-webkit-search-cancel-button{-webkit-appearance:none; appearance:none;}
.ar-num{width:74px; text-align:center;}
.a-admin-stamp{margin-left:auto; white-space:nowrap; cursor:default; font-size:var(--a-fs-11); color:var(--a-faint); align-self:center; padding-bottom:6px;}
.pane{display:none;}
.pane.on{display:block;}
.pane-grid.on{display:grid; align-items:start; grid-template-columns:minmax(0, 1fr); gap:18px 26px;}
.pane-grid.on > .sec-section{min-width:0;}
@media (min-width: 900px){
  .pane-grid.on{grid-template-columns:repeat(2, minmax(0,1fr));}
}
@media (min-width: 1400px){
  .pane-grid.on{grid-template-columns:repeat(3, minmax(0,1fr));}
}
.pane-grid .sec-section{max-width:none; margin-top:0 !important;}
.pane-grid .sec-section.is-wide{grid-column:1 / -1;}
.pane-grid.on > .sec-stack{min-width:0; display:flex; flex-direction:column; gap:18px;}
@media (min-width: 1400px){
  .pane-grid .sec-section.is-double{grid-column:span 2;}
  .pane-grid .sec-stack.is-double{grid-column:span 2;}
}
.bulk-bar{display:flex; align-items:center; gap:6px; padding-bottom:8px; margin-bottom:10px; flex-wrap:wrap;}
.bulk-count{margin-right:auto; font-size:var(--a-fs-12); line-height:var(--a-lh-ui);}
.row .who-col{flex:1; min-width:0;}
@media (max-width: 880px){
  .row .badge{order:1;}
  .row .godmode-slot{order:1;}
  .row .who-col{flex:1 1 100%; order:2; min-width:0;}
  .row .a-btn, .row .btn{order:4;}
}
.inactive-head.collapsed .chev{transform:rotate(-90deg);}
.inactive-body.collapsed{display:none;}
.inactive-body .row{opacity:.72;}
.group-head:first-child{margin-top:0;}
.group-head.collapsed .chev{transform:rotate(-90deg);}
.group-body.collapsed{display:none;}
.group-head-sub:first-child{margin-top:0;}
.group-head-sub.collapsed .chev{transform:rotate(-90deg);}
.group-body-sub{margin-left:18px;}
.group-body-sub.collapsed{display:none;}
.detail{margin:-3px 0 10px 26px; padding:10px 12px; border-radius:0 var(--a-r-sm) var(--a-r-sm) 0;}
.drow{display:flex; align-items:center; gap:9px; padding:5px 0; font-size:var(--a-fs-13); flex-wrap:wrap;}
.dname{font-weight:600; flex:1; min-width:120px;}
.dmeta{font-size:var(--a-fs-12);}
.drow.drow-action{border-top:none; padding-top:8px;}
.detail .empty{padding:10px;}
.row .expand{background:none; border:none; font-size:var(--a-fs-11); padding:4px 6px;}
.row .expand.open{transform:rotate(90deg);}
.temp-pw-who{font-size:var(--a-fs-13); color:var(--a-dim); margin-bottom:10px;}
/* The one-off password is a machine string (DS-A06): a block of code, selectable in one click. */
.alt-app code.temp-pw-value{display:block; font-size:var(--a-fs-18); letter-spacing:.09em; text-align:center; padding:13px 10px; user-select:all; word-break:break-all;}
.temp-pw-note{margin-top:var(--a-sp-12);}
.temp-pw-actions{display:flex; align-items:center; gap:10px; margin-top:10px;}
.temp-pw-status{font-size:var(--a-fs-12);}
.profile-grid{display:grid; grid-template-columns:130px 1fr; gap:7px 12px; font-size:var(--a-fs-13); margin-bottom:16px;}
.profile-grid dd{margin:0; word-break:break-word;}
.profile-sec{margin-top:14px;}
.empty{font-size:var(--a-fs-13); padding:26px; text-align:center;}
.status{font-size:var(--a-fs-12); padding:8px 12px; border-radius:var(--a-r-sm); margin-bottom:10px; display:none;}
.status.err{display:block;}
.status.ok{display:block;}
.sec-section{max-width:720px;}
.sec-desc{font-size:var(--a-fs-13); line-height:var(--a-lh-ui); margin:0 0 14px;}
.sec-section .control-row{margin-block:12px;}
.sec-section .sec-desc + .control-row{margin-top:0;}
.email-admin{display:flex; align-items:center; gap:12px; margin:10px 0 4px;}
.email-admin-state{font-size:var(--a-fs-13); font-weight:600;}
.email-admin-grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:8px; margin:12px 0;}
.email-stat{padding:9px 11px; border-radius:var(--a-r-sm);}
.email-stat b{display:block; font-size:var(--a-fs-18); font-variant-numeric:tabular-nums;}
.email-stat span{font-size:var(--a-fs-11); text-transform:uppercase; letter-spacing:.4px;}
.email-admin-actions{display:flex; gap:8px; align-items:center; margin-top:6px;}
.sec-levels{display:flex; flex-direction:column; gap:8px;}
.sec-level{display:flex; gap:10px; align-items:flex-start; cursor:pointer;}
.sec-level input{margin:2px 0 0; flex:0 0 auto;}
.sec-level .lv-name{font-size:var(--a-fs-13); font-weight:600;}
.sec-level .lv-hint{font-size:var(--a-fs-12); line-height:var(--a-lh-ui); margin-top:3px;}
.sec-level .lv-floor{font-size:var(--a-fs-11); margin-top:4px;}
#storagePane .sec-desc{max-width:78ch;}
#overviewPane .sec-desc{max-width:78ch;}
.storage-sort-label{font-size:var(--a-fs-11); text-transform:uppercase; letter-spacing:.5px; font-weight:600; white-space:nowrap;}
#storagePane .ncl-inline-check{font-size:var(--a-fs-13);}
.admin-filter-row{margin-bottom:10px;}
.admin-filter-check{display:inline-flex; align-items:center; gap:7px; cursor:pointer; font-size:var(--a-fs-12); white-space:nowrap; user-select:none;}
.admin-filter-check input{margin:0; cursor:pointer;}
.admin-filter-row select{width:auto; min-width:170px;}
.alt-app input[type=search].admin-people-search{width:auto; min-width:150px; max-width:220px; flex:0 1 190px; padding-left:30px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238390a5' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:left 9px center; background-size:15px 15px;}
.admin-filter-count{font-size:var(--a-fs-11);}

/* The OKR group header carries a delete-all at its end. */
#okrCleanupPane .group-head .okrc-group-delete-all,
#okrCleanupPane .group-head-sub .okrc-group-delete-all{margin-left:auto;}

/* ================= Organization layer: Role, Organization and God Mode badges =================
   Variants on `.alt-app .badge` like `.badge.admin`/`.badge.pending`; they carry only
   colour/border as a second class, using existing `--a-*` tokens (both themes correct). */
.alt-app .badge.role{border-color:var(--a-blue-text); color:var(--a-blue-text);}
.alt-app .badge.org{border-color:var(--a-green); color:var(--a-green);}

/* The God Mode column: a badge-shaped button that shows state and routes to Profile.
   `.godmode-slot` has no width or border when empty, so readers without access see an
   unchanged People pane. State is not colour alone: the filled state adds a purple fill and
   a leading aria-hidden glyph, so it survives grayscale and screen readers. */
.alt-app .godmode-slot{display:inline-flex;}
.alt-app .badge.godmode{
  cursor:pointer; font-family:inherit; letter-spacing:.06em;
  border-color:var(--a-line-strong); color:var(--a-dim); background:transparent;
}
.alt-app .badge.godmode:hover{border-color:var(--a-purple); color:var(--a-purple);}
.alt-app .badge.godmode.on{
  border-color:var(--a-purple); color:var(--a-purple); background:var(--a-purple-soft);
}
.alt-app .badge.godmode.on::before{content:'\2726  ';}

/* The footer note — same faint, quiet register as `.sec-note`'s prose: a fact
   about the system, not something wrong with it. */
.admin-godmode-note{font-size:var(--a-fs-11); color:var(--a-faint); margin-top:4px;}

/* ---------- Storage (R2) form: label | control | button ----------
   One grid, so every input and key-status box shares a left edge and every Enter/Replace button
   another. The key state and its hidden input share the control cell. Label stacks above below 560px. */
.cfg-form{
  display:grid; grid-template-columns:max-content minmax(0, 1fr) auto; column-gap:10px; row-gap:10px;
  align-items:center; margin:12px 0 0;
}
.cfg-form-label{font-size:var(--a-fs-12); color:var(--text-dim); white-space:nowrap;}
.cfg-form-field{min-width:0; display:flex;}
.cfg-form-field > input{width:100%; box-sizing:border-box;}
/* A 32-character ID takes the button column too; left edge unchanged. Mono at 12px so it fits unclipped. */
.cfg-form-field.is-wide{grid-column:2 / -1;}
.cfg-form-act{min-width:0;}
.cfg-form-actions{grid-column:2 / -1; display:flex; flex-wrap:wrap; gap:8px;}
/* A real `.a-chip` wearing the field's height and width; the chip owns colour, this owns geometry. */
.cfg-keystate{width:auto; max-width:none; justify-self:start;}  /* a real `.a-chip` (24px, 11px/600): the chip owns its geometry */
.cfg-keystate[hidden]{display:none;}
.cfg-source{max-width:none;}
@media (max-width: 560px){
  .cfg-form{grid-template-columns:minmax(0, 1fr); row-gap:4px;}
  .cfg-form-label{margin-top:8px;}
  .cfg-form-field.is-wide{grid-column:1;}
  .cfg-form-act{display:none;}
  .cfg-form-field + .a-btn{justify-self:start; margin-top:4px;}
  .cfg-form-actions{grid-column:1; margin-top:8px;}
}

/* ================= PEOPLE: deleting accounts with no recent sign-in (#userBulkDeleteOverlay) =================
   JS/features/admin-users-inactive.js. The warning, phrase and hint are the shared `.okrc-*` destructive recipe
   (CSS/team-delete-flow.css); only the per-account list is new. Outcomes: done green, refused red, a loose end
   orange, waiting faint. */
.ubd-list{
  list-style:none; margin:12px 0 0; padding:0; max-height:240px; overflow:auto;
  border:1px solid var(--border-soft); border-radius:var(--radius-sm);
}
.ubd-item{
  display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 10px;
  padding:7px 10px; border-top:1px solid var(--border-soft); font-size:var(--a-fs-13); color:var(--text);
}
.ubd-item:first-child{border-top:0;}
.ubd-who{font-weight:600; min-width:0; overflow-wrap:anywhere;}
.ubd-meta{font-size:var(--a-fs-12); color:var(--text-dim); min-width:0; overflow-wrap:anywhere;}
.ubd-outcome{flex:1 1 100%; font-size:var(--a-fs-12); color:var(--text-faint);}
.ubd-outcome.is-done{color:var(--green-text);}
.ubd-outcome.is-refused{color:var(--red-text);}
.ubd-outcome.is-warn{color:var(--orange-text);}
#userBulkDeletePhrase{width:100%; max-width:260px;}

/* System AI is God Mode only: the tab is not drawn for anyone else (JS/core/god-mode.js stamps body[data-god-mode]).
   A courtesy, not authorization; every system_ai_* RPC refuses a non-God-Mode caller in Postgres. */
body:not([data-god-mode="1"]) #tabs .view-tab[data-pane="systemAiPane"]{display:none;}
