/* Matched to the design's .side-tools spec (mockup + mobile/BLUEPRINT.md
   "the tools register — present and unchanged from the rail": gap:6px,
   padding-block:10px, hairline rules above/below, marks 32x32 with a
   20x20 svg — not the placeholder 12px/24px this shipped with. Padding
   is block-only; the drawer's own 20px padding already supplies the
   inline gutter, so adding padding-inline here would double it. */
/* Belt-and-suspenders desktop guard: this element only ever gets inserted into
   .portal-footer-resp-nav (the mobile drawer), which relies on a slide-out
   transform to stay off-screen above the mobile breakpoint rather than
   display:none — measured only ~21px past the viewport edge at 1440px, close
   enough that any positioning drift (viewport width, drawer transform change)
   could make it visible. Same unconditional-hide-then-reveal pattern already
   used for .ag-door-frame/.ag-door-caption. */
.ag-drawer-tools-register {
	display: none;
}
@media (max-width: 1025px) {
	.ag-drawer-tools-register {
		display: flex;
		align-items: center;
		gap: 6px;
		padding-block: 10px;
		margin-block-end: 12px;
		border-top: 1px solid var(--ph-line-faint, oklch(0.19 0.006 258));
		border-bottom: 1px solid var(--ph-line-faint, oklch(0.19 0.006 258));
		flex: 0 0 auto;
	}
}

.ag-drawer-tools-register .ag-drawer-tool-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.ag-drawer-tools-register .ag-drawer-tool-btn svg {
	width: 20px;
	height: 20px;
}

.ag-drawer-tools-register .ag-drawer-tool-notification .notification-unread-count {
	top: -2px;
	inset-inline-end: -2px;
}

/* SureDash's own #portal-mobile-notification sizes itself with plain `vh` (85vh). On a real
   mobile browser `vh` is measured against the full layout viewport, including the strip the
   address bar can occupy — taller than what's actually visible before the bar collapses on
   scroll — so the popup can render partly below the visible area ("swallowed"). `dvh` tracks
   the actually-visible viewport; declared after `vh` so unsupporting browsers keep the vh value
   and everything else falls through unchanged. Defensive: applies regardless of whether this is
   the actual cause of a specific report.
   !important because this selector's specificity exactly matches SureDash's own rule in
   responsive.min.css (id + class, no more) — without it, whichever stylesheet's <link> happens
   to print later in <head> wins, which isn't something enqueue order here should be trusted to
   guarantee. */
#portal-mobile-notification.portal-mobile-notification-popup {
	max-height: 85vh !important;
	max-height: 85dvh !important;
	min-height: 85vh !important;
	min-height: 85dvh !important;
}

/* > **CLAUDE-AUTHORED** — written by Claude (`drawer-gap`), 2026-09-19. */
/* ============================================================
   THE THIRD FLEX ITEM IS OURS, SO THE THIRD ITEM'S DAMAGE IS OURS.

   ⛔ THE DEFECT, measured on this fixture at 390x844 on 2026-09-19:
   the mobile drawer renders 48.3% empty on portal routes no screen claims —
   210px above the menu list, 198px below it, avatar jammed in the bottom
   corner. The owner reported it as "mobile - sidebar has empty space."

   THE MECHANISM, not a guess — read from the platform's own sheet and then
   confirmed against computed layout. suredash single-rtl.min.css:
     .portal-footer-resp-nav:has( .portal-user-profiles-wrap ){
       display:flex; flex-direction:column; justify-content:space-between }
   That is written for TWO items: the list, and the profile at the foot. Its
   companion `.portal-user-profiles-wrap{margin-top:auto}` is the intended
   packer, but it lands on an element NESTED inside the profile block rather
   than on the flex item itself, so it never bites and `space-between` is what
   actually distributes.
   ⛔ `drawer-tools-register.js:135` inserts `.ag-drawer-tools-register` at
   `drawer.firstChild`. THAT MAKES THREE ITEMS. With three, `space-between`
   opens a gap on BOTH sides of the list: free space 396px, halved, 198px each.
   The arithmetic was checked against the measurement and closes exactly.

   THE FIX IS ONE DECLARATION, and it is one because auto margins are resolved
   BEFORE `justify-content` gets any free space to distribute. Give the list an
   auto end-margin and the container has nothing left to spread: register and
   list pack to the top, the profile stays pinned at the foot where the platform
   puts it. 210px -> 12px above the list (12px being this sheet's own
   `margin-block-end` on the register, ~40 lines up).

   ⛔ WHY IT LIVES HERE AND NOT IN A SCREEN'S SHEET. `portal-home.css` carried
   this declaration un-scoped for exactly this reason, until `portal-home.php`
   was narrowed to `suredash_is_home()` at 2026-09-19 09:12:25Z and `body.ag-face`
   became home-only. The injector never had a gate, so off-home routes kept our
   third item and lost our repair. A portal-wide shared sheet is REJECTED by the
   owner (`screens/portal-home/shipping/chrome-scope/REJECTED.md`) and per-screen
   copies are forbidden by the ruling that created M9. The remaining and correct
   reading is the one `antigravity-tools-register-icons/style.css` landed an hour
   earlier: THE PLUGIN THAT EMITS THE ELEMENT OWNS THE ELEMENT'S STYLING. This is
   not a screen's design travelling; it is this plugin paying for its own item.

   ⛔ THIS IS THE WHOLE PORT. The other 27 un-scoped `.portal-footer-resp-nav`
   blocks in `portal-home.css` are home's DESIGN — the 20px inset, the 296px
   width, the 48px group rhythm, the suppressed row separators and subitem icons,
   the 26px type, the gold active bar, the `--agf-*` tokens that do not exist off
   `body.ag-face`, and M9d2's absolute placement of the avatar into the tools row.
   None of them is load-bearing for a three-item `space-between` column, and
   `fix-pass/PENDING.md` § 12 is the standing order against shipping them:
   "when un-scoping, split first — layout travels, styling doesn't."
   ⚠️ So the avatar stays at the foot of the drawer off-home. That placement is
   `rehost-b/REHOST_B.md` § 8.5 item B2 — a screen's design, OPEN for
   re-decision, NOT this plugin's to make.

   THE PREDICATE IS THE DEFECT'S OWN SHAPE, which is `PENDING.md` § 9 condition
   (b) taken literally ("narrow the predicate — for example, to the drawer
   carrying a third item"):
     :has(> .ag-drawer-tools-register)  the third item is present, i.e. ours
     :not(:has(.portal-aside-endpoint-navigation))  and this is the portal
       drawer, not the lesson outline — the same gate every M9 rule uses.
       ✅ Measured: a lesson route is byte-identical before and after.

   SPECIFICITY — a floor, never a ceiling:
     portal-home.css   body.ag-face … > .portal-aside-list-wrapper     (0,4,1) !important
     course-space.css  body.cs-screen.cs-design … same tail            (0,5,1) !important
     here              (no type selector, four classes)                (0,4,0) UNFORCED
   Strictly below both, and unforced against two `!important`s, so it cannot win
   anywhere a screen has spoken — and where a screen HAS spoken it declares this
   same property on this same element with this same value, so the tie is silent.
   ✅ Proved by negative control, not by reading: with the value swapped to a
   marker no screen declares, `/portal/`, `/portal/zugiut-hemshech/` and
   `/portal/energia-elohit/` discarded it outright (260px / 361.5px / 360px
   unchanged) while `/portal/bookmarks/` took it. It loses by design.

   ⚠️ The media query is this sheet's own breakpoint (the register is
   `display:none` above it, ~50 lines up), not a new one. Verified at 1025 the
   rule fires and at 1026 it does not.
   ============================================================ */
@media (max-width: 1025px) {
  .portal-footer-resp-nav:not(:has(.portal-aside-endpoint-navigation)):has(> .ag-drawer-tools-register) > .portal-aside-list-wrapper {
    margin-block-end: auto;
  }
}
