/* ============================================================================
   assets/css/dswd-shell.css — the frame around every staff and citizen page

   Sidebar (expanded, minimised, drawer), the GOVPH strip, the header with its
   search and account menu, the footer, the back-to-top button, page changes
   and the text-size / contrast settings.

   The shell uses its own class names (ag-*) so none of the older layers —
   dswd-theme, dswd-surfaces, dswd-responsive, dswd-sidebar-responsive, and
   the <style> blocks individual pages carried for their own headers — can
   reach it. That is what let a page's ".topbar-right{flex-wrap:wrap}" push
   the account menu out of the header when the window was narrowed.
   ============================================================================ */

:root{
  --ag-navy:#001a44; --ag-navy2:#002a6b; --ag-ink:#0b2545; --ag-blue:#0038a8; --ag-gold:#fcd116; --ag-red:#ce1126;
  --ag-bg:#eef3f9; --ag-line:#e3e9f2; --ag-muted:#64748b;
  --ag-sbw-open:280px; --ag-sbw-min:78px; --ag-sbw:var(--ag-sbw-open);
  --ag-zoom:1; --ag-navzoom:1;
}
html.ag-collapsed{ --ag-sbw:var(--ag-sbw-min); }
html.ag-shell body{ background:var(--ag-bg); margin:0; }

/* ══════════════════════════════════════════════════════════════════════════
   Text size and contrast
   ══════════════════════════════════════════════════════════════════════════
   A, A+ and A++ used to zoom the whole <body>. Media queries do not see a
   CSS zoom, so at A++ the header thought it had 1440px when it had 1070 and
   the account menu was pushed off the edge, and the sidebar grew by a third.
   Now the page area is zoomed, the menu text grows a little, and the header
   and tiles lay themselves out by the room they actually have (container
   queries), so a larger size stays usable. */
html[data-textsize="lg"]{ --ag-zoom:1.1;  --ag-navzoom:1.05; }
html[data-textsize="xl"]{ --ag-zoom:1.22; --ag-navzoom:1.1; }
html.ag-shell[data-textsize] body{ zoom:1 !important; }
html.ag-shell[data-textsize]{ font-size:16px !important; }

/* ══════════════════════════════════════════════════════════════════════════
   Sidebar
   ══════════════════════════════════════════════════════════════════════════ */
.ag-sidebar{
  position:fixed; top:0; left:0; bottom:0; width:var(--ag-sbw); z-index:1045;
  display:flex; flex-direction:column;
  background:linear-gradient(180deg, var(--ag-navy) 0%, #00245c 55%, var(--ag-navy2) 100%);
  color:#fff; font-family:inherit;
  transition:width .22s cubic-bezier(.4,0,.2,1);
  box-shadow:1px 0 0 rgba(255,255,255,.04), 6px 0 24px rgba(0,16,48,.10);
}
.ag-sidebar a{ text-decoration:none; }
.ag-sidebar :focus-visible{ outline:3px solid var(--ag-gold); outline-offset:2px; }

.ag-brand{ position:relative; display:flex; align-items:center; gap:8px; padding:16px 12px 14px 16px;
  border-bottom:1px solid rgba(255,255,255,.08); flex:0 0 auto; }
.ag-brand-link{ display:flex; align-items:center; gap:11px; min-width:0; flex:1; color:#fff; }
.ag-seal{ width:46px; height:46px; border-radius:50%; flex:0 0 auto; object-fit:cover; background:#fff;
  box-shadow:0 0 0 2px rgba(252,209,22,.55), 0 6px 16px rgba(0,0,0,.25); }
.ag-brand-meta{ display:flex; flex-direction:column; min-width:0; }
.ag-bt{ font-weight:800; font-size:21px; line-height:1; letter-spacing:.2px; color:#fff; }
.ag-bt .go{ color:var(--ag-gold); }
.ag-bs{ font-size:10px; letter-spacing:.08em; text-transform:uppercase; color:rgba(255,255,255,.62);
  margin-top:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ag-collapse{ width:32px; height:32px; flex:0 0 auto; border:0; border-radius:10px; cursor:pointer;
  background:rgba(255,255,255,.10); color:#fff; display:inline-flex; align-items:center; justify-content:center;
  transition:background .15s, transform .15s; }
.ag-collapse:hover{ background:rgba(255,255,255,.2); }

.ag-nav{ flex:1 1 auto; overflow-y:auto; overflow-x:hidden; padding:6px 10px 16px; zoom:var(--ag-navzoom);
  scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.22) transparent; overscroll-behavior:contain; }
.ag-nav::-webkit-scrollbar{ width:6px; }
.ag-nav::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.2); border-radius:6px; }

.ag-sec{ padding:16px 12px 6px; font-size:10.5px; font-weight:800; letter-spacing:.12em; text-transform:uppercase;
  color:rgba(255,255,255,.45); white-space:nowrap; }

.ag-link, .ag-ghead{
  position:relative; display:flex; align-items:center; gap:12px; width:100%; min-height:44px; margin:1px 0;
  padding:9px 12px; border:0; border-radius:12px; background:none; cursor:pointer; text-align:left;
  color:rgba(255,255,255,.86); font:inherit; font-size:14px; font-weight:700; line-height:1.25;
  transition:background .15s, color .15s;
}
.ag-ico{ width:22px; flex:0 0 auto; text-align:center; font-size:15px; color:inherit; }
.ag-group[data-code] > .ag-ghead .ag-ico{ color:color-mix(in srgb, var(--pc, #fff) 55%, #fff); }
.ag-lbl{ flex:1 1 auto; min-width:0; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.22; }
.ag-link:hover, .ag-ghead:hover{ background:rgba(255,255,255,.08); color:#fff; }
.ag-link.active{ background:rgba(252,209,22,.15); color:#fff; }
.ag-link.active::before, .ag-group.has-active > .ag-ghead::before{
  content:''; position:absolute; left:0; top:10px; bottom:10px; width:3px; border-radius:3px; background:var(--ag-gold); }
.ag-group.has-active > .ag-ghead{ color:#fff; }
.ag-group.has-active > .ag-ghead .ag-ico{ color:var(--ag-gold) !important; }
.ag-caret{ font-size:11px; opacity:.7; flex:0 0 auto; transition:transform .22s ease; }
.ag-group.open > .ag-ghead .ag-caret{ transform:rotate(90deg); }

.ag-badge{ flex:0 0 auto; min-width:22px; height:20px; padding:0 7px; border-radius:10px; background:var(--ag-red);
  color:#fff; font-size:10.5px; font-weight:800; display:inline-flex; align-items:center; justify-content:center; line-height:1; }

/* Open and close by animating the row height — a grid track from 0fr to 1fr
   — so a group of any length slides rather than snapping. */
.ag-sub, .ag-sub3{ display:grid; grid-template-rows:0fr; transition:grid-template-rows .24s ease; }
.ag-group.open > .ag-sub, .ag-sub2.open > .ag-sub3{ grid-template-rows:1fr; }
.ag-sub-in{ min-height:0; overflow:hidden; }
.ag-group:not(.open) > .ag-sub > .ag-sub-in, .ag-sub2:not(.open) > .ag-sub3 > .ag-sub-in{ visibility:hidden; transition:visibility 0s .24s; }

.ag-sub > .ag-sub-in{ padding:2px 0 6px; }
.ag-sublink{ display:flex; align-items:center; gap:10px; min-height:38px; padding:7px 10px 7px 44px; margin:1px 0;
  border-radius:10px; color:rgba(255,255,255,.72); font-size:13px; font-weight:600; line-height:1.3;
  transition:background .15s, color .15s; flex:1 1 auto; min-width:0; }
.ag-sublink i{ width:16px; text-align:center; font-size:12px; opacity:.85; flex:0 0 auto; }
.ag-sublink span:not(.ag-badge){ flex:1 1 auto; min-width:0; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.ag-sublink:hover{ background:rgba(255,255,255,.07); color:#fff; }
.ag-sublink.active{ background:rgba(0,56,168,.42); color:#fff; }
.ag-sublink.active i{ color:var(--ag-gold); opacity:1; }

.ag-sub2-row{ display:flex; align-items:center; gap:2px; }
.ag-sub2-tog{ flex:0 0 auto; width:32px; height:32px; border:0; border-radius:9px; background:none; color:rgba(255,255,255,.7);
  cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.ag-sub2-tog:hover{ background:rgba(255,255,255,.08); color:#fff; }
.ag-sub2-tog i{ font-size:11px; transition:transform .22s ease; }
.ag-sub2.open > .ag-sub2-row .ag-sub2-tog i{ transform:rotate(180deg); }
.ag-sub3 > .ag-sub-in{ margin:0 0 4px 52px; border-left:1px dashed rgba(255,255,255,.18); }
.ag-sub3link{ display:flex; align-items:center; gap:9px; min-height:32px; padding:5px 10px 5px 14px; margin:1px 0;
  border-radius:0 9px 9px 0; color:rgba(255,255,255,.68); font-size:12.5px; font-weight:600; }
.ag-sub3link:hover{ background:rgba(255,255,255,.07); color:#fff; }
.ag-sub3link.active{ background:rgba(252,209,22,.14); color:#fff; }
.ag-dot{ width:8px; height:8px; border-radius:50%; background:var(--c, #8fb4ff); flex:0 0 auto; box-shadow:0 0 0 3px color-mix(in srgb, var(--c, #8fb4ff) 25%, transparent); }

.ag-progs{ display:flex; flex-wrap:wrap; gap:6px; padding:4px 12px 8px; }
.ag-chip{ font-size:10.5px; font-weight:800; letter-spacing:.04em; padding:4px 10px; border-radius:20px;
  color:color-mix(in srgb, var(--c) 45%, #fff); background:color-mix(in srgb, var(--c) 22%, transparent); }
.ag-chip:hover{ color:#fff; background:color-mix(in srgb, var(--c) 45%, transparent); }

.ag-user{ flex:0 0 auto; padding:12px 14px 14px; border-top:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.14)); }
.ag-user-row{ display:flex; align-items:center; gap:11px; color:#fff; border-radius:12px; padding:4px; }
.ag-user-row:hover{ background:rgba(255,255,255,.06); }
.ag-av{ width:40px; height:40px; border-radius:50%; flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg, var(--ag-blue), var(--ag-red)); color:#fff; font-weight:800; font-size:14px; overflow:hidden; }
.ag-av img, .ag-uav img{ width:100%; height:100%; object-fit:cover; display:block; }
.ag-umeta{ display:flex; flex-direction:column; min-width:0; }
.ag-uname{ font-size:13px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ag-urole{ font-size:11px; color:rgba(255,255,255,.55); margin-top:2px; }
.ag-uorg{ font-size:10.5px; color:rgba(255,255,255,.45); margin:9px 4px 10px; display:flex; align-items:center; gap:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ag-signout{ display:flex; align-items:center; justify-content:center; gap:9px; width:100%; min-height:40px; border-radius:11px;
  background:rgba(206,17,38,.16); color:#ffd7dc; font-size:13px; font-weight:800; transition:background .15s; }
.ag-signout:hover{ background:rgba(206,17,38,.34); color:#fff; }
.ag-signout .ag-lbl{ flex:0 0 auto; }

/* ── Minimised ─────────────────────────────────────────────────────────── */
@media (min-width:993px){
  html.ag-collapsed .ag-brand{ justify-content:center; padding:16px 8px 14px; }
  html.ag-collapsed .ag-brand-link{ flex:0 0 auto; }
  html.ag-collapsed .ag-brand-meta{ display:none; }
  html.ag-collapsed .ag-collapse{ position:absolute; right:-14px; top:26px; width:28px; height:28px; border-radius:50%;
    background:var(--ag-gold); color:var(--ag-ink); box-shadow:0 4px 12px rgba(0,0,0,.25); z-index:2; }
  html.ag-collapsed .ag-collapse:hover{ transform:scale(1.08); background:#ffdd3c; }
  html.ag-collapsed .ag-nav{ padding:6px 10px 14px; }
  html.ag-collapsed .ag-sec{ padding:10px 0 4px; font-size:0; }
  html.ag-collapsed .ag-sec span{ display:block; height:1px; margin:6px 12px; background:rgba(255,255,255,.12); }
  html.ag-collapsed .ag-link, html.ag-collapsed .ag-ghead{ justify-content:center; padding:10px 0; gap:0; }
  html.ag-collapsed .ag-ico{ font-size:17px; width:auto; }
  html.ag-collapsed .ag-lbl, html.ag-collapsed .ag-caret,
  html.ag-collapsed .ag-sub, html.ag-collapsed .ag-progs, html.ag-collapsed .ag-progs-label,
  html.ag-collapsed .ag-umeta, html.ag-collapsed .ag-uorg{ display:none !important; }
  html.ag-collapsed .ag-link .ag-badge, html.ag-collapsed .ag-ghead .ag-badge{
    position:absolute; top:4px; right:6px; min-width:16px; height:16px; padding:0 4px; font-size:9px; }
  html.ag-collapsed .ag-group.flyout-open > .ag-ghead{ background:rgba(255,255,255,.14); color:#fff; }
  html.ag-collapsed .ag-user{ padding:10px 8px 12px; display:flex; flex-direction:column; align-items:center; gap:10px; }
  html.ag-collapsed .ag-user-row{ padding:0; }
  html.ag-collapsed .ag-signout{ width:42px; height:42px; min-height:42px; border-radius:12px; }
}

/* ── Fly-out panel (minimised menu) and tooltips ───────────────────────── */
.ag-flyout{ position:fixed; z-index:1060; min-width:240px; max-width:300px; max-height:min(80vh, 560px); overflow:auto;
  background:#fff; color:var(--ag-ink); border-radius:14px; padding:8px; box-shadow:0 18px 48px rgba(11,37,69,.30);
  opacity:0; transform:translateX(-6px); transition:opacity .14s, transform .14s; }
.ag-flyout.show{ opacity:1; transform:none; }
.ag-flyout h6{ margin:6px 10px 8px; font-size:11px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:#8496ae;
  display:flex; align-items:center; gap:8px; }
.ag-flyout a{ display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:9px; color:#1f2d45;
  font-size:13px; font-weight:600; text-decoration:none; }
.ag-flyout a i{ width:16px; text-align:center; color:#51607a; font-size:12px; }
.ag-flyout a:hover, .ag-flyout a:focus-visible{ background:#eef3fb; color:var(--ag-ink); outline:none; }
.ag-flyout a.active{ background:var(--ag-ink); color:#fff; }
.ag-flyout a.active i{ color:var(--ag-gold); }
.ag-flyout a.lvl3{ padding-left:34px; font-size:12.5px; }
.ag-flyout .ag-dot{ box-shadow:none; }
.ag-flyout .ag-badge{ margin-left:auto; }
.ag-tipbox{ position:fixed; z-index:1061; pointer-events:none; background:var(--ag-ink); color:#fff; font-size:12.5px; font-weight:700;
  padding:7px 11px; border-radius:8px; box-shadow:0 8px 20px rgba(0,0,0,.25); white-space:nowrap; opacity:0; transition:opacity .12s; }
.ag-tipbox.show{ opacity:1; }

/* ══════════════════════════════════════════════════════════════════════════
   Page area
   ══════════════════════════════════════════════════════════════════════════ */
.ag-main{ margin-left:calc(var(--ag-sbw) / var(--ag-zoom)); min-height:calc(100vh / var(--ag-zoom)); display:flex; flex-direction:column;
  zoom:var(--ag-zoom); transition:margin-left .22s cubic-bezier(.4,0,.2,1); min-width:0; }
/* Pages that still draw their own header around the shared sidebar. */
html.ag-shell .main-wrap{ margin-left:calc(var(--ag-sbw) / var(--ag-zoom)) !important; zoom:var(--ag-zoom); transition:margin-left .22s; }
html.ag-shell .page-foot:not(.ag-foot){ margin-left:var(--ag-sbw) !important; }

/* ── GOVPH strip ───────────────────────────────────────────────────────── */
.ag-gov{ display:flex; align-items:center; gap:10px; min-height:34px; padding:6px 24px;
  background:linear-gradient(90deg, #001233, #002a6b); color:#fff; font-size:12px; font-weight:700; letter-spacing:.02em; }
.ag-gov-badge{ display:inline-flex; align-items:center; gap:6px; font-weight:800; white-space:nowrap; }
.ag-gov-badge i{ color:var(--ag-gold); }
.ag-gov-sep{ width:1px; height:13px; background:rgba(255,255,255,.28); flex:0 0 auto; }
.ag-gov-org{ min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ag-gov-org .ag-short{ display:none; }
.ag-gov-time{ margin-left:auto; display:inline-flex; align-items:center; gap:7px; white-space:nowrap; opacity:.95; font-variant-numeric:tabular-nums; min-width:0; }
.ag-gov-time [data-ag-clock]{ min-width:0; overflow:hidden; text-overflow:ellipsis; }
.ag-flag{ height:4px; background:linear-gradient(90deg, var(--ag-blue) 0 33.3%, var(--ag-red) 33.3% 66.6%, var(--ag-gold) 66.6% 100%); }

/* ── Header ────────────────────────────────────────────────────────────── */
.ag-top{
  position:sticky; top:0; z-index:1030; container-type:inline-size; container-name:agtop;
  /* The search column has no fixed minimum: when the search folds into an
     icon (narrow header) its track empties and the title gets the room.
     (.ag-top is its own size container, so a container query cannot
     change this template — it has to work at every width as written.) */
  display:grid; grid-template-columns:auto minmax(0, max-content) minmax(auto, 1fr) auto; align-items:center; gap:12px 18px;
  padding:12px 24px; background:rgba(255,255,255,.96); backdrop-filter:saturate(1.4) blur(8px);
  border-bottom:1px solid var(--ag-line); box-shadow:0 4px 18px rgba(11,37,69,.05);
}
.ag-burger{ display:none; width:42px; height:42px; border-radius:12px; border:1px solid #dde5ef; background:#fff;
  color:var(--ag-ink); font-size:16px; cursor:pointer; align-items:center; justify-content:center; }
.ag-burger:hover{ background:#eef3fb; }
.ag-titlebox{ min-width:0; grid-column:2; }
.ag-title{ display:flex; align-items:center; gap:11px; margin:0; font-size:21px; font-weight:800; color:var(--ag-ink); line-height:1.15; min-width:0; }
.ag-tico{ width:40px; height:40px; flex:0 0 auto; border-radius:12px; display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg, var(--ag-blue), #0b56d6); color:#fff; font-size:16px; box-shadow:0 8px 18px rgba(0,56,168,.22); }
.ag-ttext{ min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ag-crumb{ display:flex; align-items:center; gap:6px; margin:4px 0 0 51px; font-size:12px; color:var(--ag-muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:0; }
.ag-crumb a{ color:var(--ag-blue); text-decoration:none; font-weight:600; }
.ag-crumb a:hover{ text-decoration:underline; }
.ag-crumb .sep{ opacity:.45; }

.ag-search{ position:relative; grid-column:3; min-width:200px; width:100%; max-width:480px; justify-self:center; }
.ag-search > i{ position:absolute; left:14px; top:50%; transform:translateY(-50%); color:#8496ae; font-size:13px; pointer-events:none; }
.ag-search input{ width:100%; height:42px; border-radius:12px; border:1px solid #dde5ef; background:#f7f9fc;
  padding:0 14px 0 38px; font-size:13.5px; color:var(--ag-ink); outline:none; transition:border-color .15s, box-shadow .15s, background .15s; }
.ag-search input::placeholder{ color:#8f9db3; }
.ag-search input:focus{ background:#fff; border-color:#8fb4ff; box-shadow:0 0 0 4px rgba(0,56,168,.10); }
.ag-search input:focus-visible{ outline:none !important; }
.ag-search input::-webkit-search-cancel-button{ cursor:pointer; }
.ag-search-x{ display:none; }

.ag-actions{ grid-column:4; display:flex; align-items:center; gap:8px; justify-self:end; }
.ag-ibtn{ position:relative; width:42px; height:42px; flex:0 0 auto; border-radius:12px; border:1px solid #dde5ef; background:#fff;
  color:var(--ag-ink); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; text-decoration:none;
  transition:background .15s, transform .15s; }
.ag-ibtn:hover{ background:#eef3fb; color:var(--ag-ink); transform:translateY(-1px); }
.ag-ibtn .tb-dot{ position:absolute; top:9px; right:10px; width:8px; height:8px; border-radius:50%; background:var(--ag-red); box-shadow:0 0 0 2px #fff; }
.ag-search-open{ display:none; }

.ag-user-dd{ position:relative; flex:0 0 auto; }
.ag-uchip{ display:flex; align-items:center; gap:9px; height:46px; padding:4px 12px 4px 5px; border-radius:30px; border:1px solid #dde5ef;
  background:#fff; cursor:pointer; color:var(--ag-ink); max-width:250px; transition:box-shadow .15s; }
.ag-uchip:hover, .ag-uchip[aria-expanded="true"]{ box-shadow:0 6px 18px rgba(11,37,69,.10); }
.ag-uav{ width:36px; height:36px; border-radius:50%; flex:0 0 auto; overflow:hidden; display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg, var(--ag-blue), var(--ag-red)); color:#fff; font-weight:800; font-size:13px; }
.ag-uav.lg{ width:44px; height:44px; font-size:15px; }
.ag-utext{ display:flex; flex-direction:column; align-items:flex-start; min-width:0; text-align:left; }
.ag-un{ font-size:13px; font-weight:800; line-height:1.15; max-width:150px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ag-ur{ font-size:11px; color:var(--ag-muted); line-height:1.2; }
.ag-uchev{ font-size:10px; color:#8496ae; flex:0 0 auto; transition:transform .18s; }
.ag-uchip[aria-expanded="true"] .ag-uchev{ transform:rotate(180deg); }
.ag-umenu{ position:absolute; right:0; top:calc(100% + 8px); z-index:1050; width:262px; background:#fff; border-radius:16px;
  box-shadow:0 18px 50px rgba(11,37,69,.24); padding:8px; transform-origin:top right; animation:agMenuIn .14s ease both; }
.ag-umenu[hidden]{ display:none; }
@keyframes agMenuIn{ from{ opacity:0; transform:translateY(-6px) scale(.98); } }
.ag-umenu-hd{ display:flex; gap:11px; align-items:center; padding:8px 8px 12px; margin-bottom:6px; border-bottom:1px solid #eef1f7; }
.ag-umenu-hd b{ display:block; font-size:13.5px; color:var(--ag-ink); }
.ag-umenu-hd small{ display:block; font-size:11.5px; color:var(--ag-muted); overflow-wrap:anywhere; }
.ag-umenu a, .ag-umenu button{ display:flex; align-items:center; gap:11px; width:100%; padding:10px 10px; border:0; background:none;
  border-radius:10px; color:#1f2d45; font:inherit; font-size:13.5px; font-weight:600; text-decoration:none; cursor:pointer; text-align:left; }
.ag-umenu a i, .ag-umenu button i{ width:18px; text-align:center; color:var(--ag-blue); }
.ag-umenu a:hover, .ag-umenu button:hover, .ag-umenu a:focus-visible, .ag-umenu button:focus-visible{ background:#eef3fb; outline:none; }
.ag-umenu a.danger{ color:#b42318; margin-top:4px; border-top:1px solid #eef1f7; border-radius:0 0 10px 10px; }
.ag-umenu a.danger i{ color:#b42318; }

/* Narrower headers: the search gives way first, then the name on the chip,
   then the search becomes a button. Measured on the header itself, so the
   same steps happen at A++ on a wide screen as on a small laptop. */
@container agtop (max-width:1180px){
  .ag-un{ max-width:120px; }
}
@container agtop (max-width:960px){
  .ag-utext{ display:none; }
  .ag-uchip{ padding:4px 8px 4px 5px; }
}
@container agtop (max-width:900px){
  .ag-search{ display:none; max-width:none; min-width:0; }
  .ag-search-open{ display:inline-flex; }
  .ag-top.searching .ag-search{ display:block; position:absolute; inset:0; z-index:3; background:#fff; padding:12px 16px; grid-column:auto; }
  .ag-top.searching .ag-search > i{ left:30px; }
  .ag-top.searching .ag-search input{ padding-right:52px; }
  .ag-top.searching .ag-search-x{ display:inline-flex; position:absolute; right:22px; top:50%; transform:translateY(-50%);
    width:36px; height:36px; border:0; border-radius:10px; background:#eef3fb; color:var(--ag-ink); align-items:center; justify-content:center; cursor:pointer; }
}
@container agtop (max-width:560px){
  .ag-title{ font-size:17px; gap:9px; }
  .ag-tico{ width:34px; height:34px; font-size:14px; border-radius:10px; }
  .ag-crumb{ margin-left:43px; font-size:11.5px; }
  .ag-actions{ gap:6px; }
  .ag-ibtn{ width:38px; height:38px; }
  .ag-uchip{ height:42px; padding:3px 6px 3px 3px; }
  .ag-uav{ width:34px; height:34px; }
  .ag-uchev{ display:none; }
}
@container agtop (max-width:460px){
  .ag-actions a[href="help.php"], .ag-actions a[href="../help.php"], .ag-actions .ag-help-btn{ display:none; }
  .ag-crumb{ display:none; }
  /* The title gets the room the icon was using, and two lines. */
  .ag-tico{ display:none; }
  .ag-title{ font-size:16px; }
  .ag-ttext{ white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.15; }
}

/* ── Content and footer ────────────────────────────────────────────────── */
.ag-content{ flex:1 0 auto; width:100%; max-width:1560px; margin:0 auto; padding:24px 26px 44px; box-sizing:border-box; min-width:0; }
.ag-foot{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:6px 18px;
  padding:16px 26px; margin:0 !important; background:#fff; border-top:1px solid var(--ag-line); color:var(--ag-muted); font-size:12px; }
.ag-foot i{ color:var(--ag-blue); }

/* ── Back to top ───────────────────────────────────────────────────────── */
.ag-totop{ position:fixed; right:28px; bottom:88px; z-index:1065; width:46px; height:46px; border-radius:50%; border:0; cursor:pointer;
  background:var(--ag-ink); color:#fff; font-size:16px; display:inline-flex; align-items:center; justify-content:center;
  box-shadow:0 10px 26px rgba(11,37,69,.32); opacity:0; transform:translateY(12px) scale(.9); pointer-events:none;
  transition:opacity .2s, transform .2s, background .15s; }
.ag-totop[hidden]{ display:inline-flex; }
.ag-totop.show{ opacity:1; transform:none; pointer-events:auto; }
.ag-totop:hover{ background:var(--ag-blue); transform:translateY(-3px); }
.ag-totop:active{ transform:scale(.94); }
.ag-totop:focus-visible{ outline:3px solid var(--ag-gold); outline-offset:3px; }
html.ag-shell .dswd-totop{ display:none !important; }
@media (max-width:575px){
  .ag-totop{ right:18px; bottom:80px; width:42px; height:42px; font-size:15px; }
}

/* ── Progress while the next page loads ────────────────────────────────── */
.ag-progress{ position:fixed; top:0; left:var(--ag-sbw); right:0; height:3px; z-index:1100; pointer-events:none; opacity:0;
  background:linear-gradient(90deg, var(--ag-gold), #ffdd3c, var(--ag-blue)); background-size:200% 100%;
  transform-origin:left; transform:scaleX(0); }
html.ag-navigating .ag-progress{ opacity:1; animation:agLoad 6s cubic-bezier(.08,.6,.2,1) forwards, agSlide 1.2s linear infinite; }
html.ag-navigating .ag-content{ opacity:.55; transition:opacity .25s .12s; }
@keyframes agLoad{ from{ transform:scaleX(.05); } to{ transform:scaleX(.92); } }
@keyframes agSlide{ to{ background-position:-200% 0; } }

/* ══════════════════════════════════════════════════════════════════════════
   Page changes — the sidebar and header stay put, only the panels change
   ══════════════════════════════════════════════════════════════════════════
   Pages opt in to cross-document view transitions. The sidebar, the GOVPH
   strip and the header are named, and their snapshots are swapped without
   any animation, so they never flash or redraw; everything else — the panel
   area — fades across. The page area itself is deliberately not named: a
   named element becomes its own stacking layer, and modals inside it would
   then open underneath the header. */
@view-transition{ navigation:auto; }
.ag-sidebar{ view-transition-name:ag-sidebar; }
.ag-gov{ view-transition-name:ag-gov; }
.ag-flag{ view-transition-name:ag-flag; }
.ag-top{ view-transition-name:ag-top; }
::view-transition-group(ag-sidebar), ::view-transition-group(ag-gov), ::view-transition-group(ag-flag), ::view-transition-group(ag-top){ animation:none; }
::view-transition-old(ag-sidebar), ::view-transition-old(ag-gov), ::view-transition-old(ag-flag), ::view-transition-old(ag-top){ display:none; }
::view-transition-new(ag-sidebar), ::view-transition-new(ag-gov), ::view-transition-new(ag-flag), ::view-transition-new(ag-top){ animation:none; }
::view-transition-old(root){ animation:agFadeOut .12s ease both; }
::view-transition-new(root){ animation:agFadeIn .2s ease both; }
@keyframes agFadeOut{ to{ opacity:0; } }
@keyframes agFadeIn{ from{ opacity:0; } }
@media (prefers-reduced-motion:reduce){
  ::view-transition-old(root), ::view-transition-new(root){ animation:none; }
  .ag-sidebar, .ag-main, .ag-sub, .ag-sub3{ transition:none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   First-visit tour
   ══════════════════════════════════════════════════════════════════════════ */
.ag-tour{ position:fixed; inset:0; z-index:2000; }
.ag-tour-ring{ position:fixed; border-radius:14px; box-shadow:0 0 0 4px var(--ag-gold), 0 0 0 9999px rgba(3,14,34,.62);
  transition:all .25s cubic-bezier(.4,0,.2,1); pointer-events:none; }
.ag-tour-card{ position:fixed; background:#fff; color:var(--ag-ink); border-radius:16px; padding:18px 18px 14px;
  box-shadow:0 22px 60px rgba(0,0,0,.35); transition:left .25s, top .25s; }
.ag-tour-step{ font-size:11px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:#8496ae; }
.ag-tour-card h3{ font-size:17px; font-weight:800; margin:6px 0 6px; color:var(--ag-ink); }
.ag-tour-card p{ font-size:13.5px; line-height:1.6; color:#3b4658; margin:0 0 14px; }
.ag-tour-acts{ display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; }
.ag-tour-acts button{ height:38px; padding:0 14px; border-radius:10px; border:1px solid #dde5ef; background:#fff; color:#51607a;
  font-weight:700; font-size:13px; cursor:pointer; }
.ag-tour-acts .skip{ margin-right:auto; border:0; padding:0 4px; }
.ag-tour-acts .next{ background:var(--ag-blue); border-color:var(--ag-blue); color:#fff; }
.ag-tour-acts .next:hover{ background:#002f8f; }
html.dswd-hc .ag-tour-card{ background:#000 !important; color:#fff !important; border:2px solid #fcd116; }

/* ══════════════════════════════════════════════════════════════════════════
   Drawer (tablets and phones)
   ══════════════════════════════════════════════════════════════════════════ */
.ag-scrim{ position:fixed; inset:0; z-index:1044; background:rgba(6,20,40,.48); backdrop-filter:blur(2px);
  opacity:0; visibility:hidden; transition:opacity .22s, visibility .22s; }
.ag-scrim.show{ opacity:1; visibility:visible; }
@media (max-width:992px){
  html.ag-shell{ --ag-sbw:0px; }
  .ag-sidebar{ width:min(86vw, 320px); transform:translateX(-104%); transition:transform .26s cubic-bezier(.4,0,.2,1); z-index:1046;
    box-shadow:none; }
  .ag-sidebar.open{ transform:none; box-shadow:6px 0 40px rgba(6,20,40,.32); }
  .ag-collapse{ display:none; }
  .ag-burger{ display:inline-flex; grid-column:1; }
  .ag-progress{ left:0; }
  html.ag-drawer-open, html.ag-drawer-open body{ overflow:hidden; }
  .ag-link, .ag-ghead{ min-height:46px; }
  .ag-sublink{ min-height:42px; }
  .ag-top{ padding:10px 14px; gap:10px 12px; }
  .ag-gov{ padding:6px 14px; }
  .ag-content{ padding:18px 16px 36px; }
  .ag-foot{ padding:14px 16px; }
}
@media (min-width:993px){ .ag-scrim{ display:none !important; } }
@media (max-width:640px){
  .ag-gov{ font-size:11px; gap:8px; }
  .ag-gov-org .ag-long{ display:none; }
  .ag-gov-org .ag-short{ display:inline; }
}
@media (max-width:420px){
  .ag-gov{ padding:6px 12px; }
  .ag-gov-org{ display:none; }
  .ag-gov-sep{ display:none; }
  .ag-content{ padding:14px 12px 30px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   High contrast for the shell
   ══════════════════════════════════════════════════════════════════════════ */
html.dswd-hc .ag-sidebar, html.dswd-hc .ag-gov, html.dswd-hc .ag-top, html.dswd-hc .ag-foot,
html.dswd-hc .ag-umenu, html.dswd-hc .ag-flyout, html.dswd-hc .ag-main, html.dswd-hc .ag-content{
  background:#000 !important; background-image:none !important; color:#fff !important; border-color:#fcd116 !important; box-shadow:none !important; }
html.dswd-hc .ag-sidebar{ border-right:2px solid #fcd116 !important; }
html.dswd-hc .ag-top{ border-bottom:2px solid #fcd116 !important; backdrop-filter:none; }
html.dswd-hc .ag-flag{ display:none; }
html.dswd-hc .ag-link, html.dswd-hc .ag-ghead, html.dswd-hc .ag-sublink, html.dswd-hc .ag-sub3link,
html.dswd-hc .ag-flyout a, html.dswd-hc .ag-umenu a, html.dswd-hc .ag-umenu button, html.dswd-hc .ag-crumb a{ color:#fcd116 !important; }
html.dswd-hc .ag-link.active, html.dswd-hc .ag-sublink.active, html.dswd-hc .ag-sub3link.active, html.dswd-hc .ag-flyout a.active{
  background:#fcd116 !important; color:#000 !important; }
html.dswd-hc .ag-link.active *, html.dswd-hc .ag-sublink.active *, html.dswd-hc .ag-sub3link.active *,
html.dswd-hc .ag-flyout a.active *{ color:#000 !important; background:transparent !important; }
html.dswd-hc .ag-ibtn, html.dswd-hc .ag-uchip, html.dswd-hc .ag-burger, html.dswd-hc .ag-collapse, html.dswd-hc .ag-totop,
html.dswd-hc .ag-search input, html.dswd-hc .ag-signout{ background:#000 !important; color:#fcd116 !important; border:2px solid #fcd116 !important; }
html.dswd-hc .ag-uav, html.dswd-hc .ag-av, html.dswd-hc .ag-tico{ background:#fcd116 !important; color:#000 !important; }
html.dswd-hc .ag-badge{ background:#fcd116 !important; color:#000 !important; }
html.dswd-hc .ag-progress{ background:#fcd116 !important; }

/* ══════════════════════════════════════════════════════════════════════════
   Print: the page, not the frame
   ══════════════════════════════════════════════════════════════════════════ */
@media print{
  .ag-sidebar, .ag-gov, .ag-flag, .ag-top, .ag-totop, .ag-progress, .ag-scrim, .ag-flyout, .ag-foot, .ds-a11y-fab, .ds-a11y-panel{ display:none !important; }
  .ag-main, html.ag-shell .main-wrap{ margin:0 !important; zoom:1 !important; }
  .ag-content{ padding:0 !important; max-width:none !important; }
  html.ag-shell body{ background:#fff !important; }
}

/* Floating buttons step aside while a dialog is open, so they never sit on
   top of a modal's own buttons. */
body.modal-open .ag-totop, body.modal-open #agToTop,
body.modal-open .ds-a11y-fab, body.modal-open #dswdA11yFab{ display:none !important; }

/* Idle sign-out notice (dswd-shell.js) */
.ag-idle{ position:fixed; left:50%; bottom:22px; transform:translateX(-50%); z-index:2000;
  display:flex; align-items:center; gap:12px; max-width:min(560px, calc(100vw - 32px));
  background:#0b2545; color:#fff; border-radius:12px; padding:12px 14px 12px 16px;
  box-shadow:0 12px 32px rgba(11,37,69,.35); font-size:14px; line-height:1.35; }
.ag-idle > i{ font-size:20px; color:#fcd116; }
.ag-idle strong{ display:block; font-size:14.5px; }
.ag-idle .ag-idle-stay{ margin-left:auto; flex:0 0 auto; background:#fcd116; color:#0b2545; border:0;
  border-radius:8px; padding:9px 14px; font-weight:700; cursor:pointer; min-height:0; }
.ag-idle .ag-idle-stay:focus-visible{ outline:3px solid #fff; outline-offset:2px; }
@media print{ .ag-idle{ display:none !important; } }

/* ══════════════════════════════════════════════════════════════════════════
   Dialogs: the buttons never fall off the screen
   Many dialogs wrap their header, body and footer in one <form> inside
   .modal-content. Bootstrap's scrollable layout expects those three as direct
   children, so with the <form> in between the body never scrolled and on a
   laptop screen the Save / Cancel buttons were cut off below the window.
   The form takes over the flex column, the body scrolls, the footer stays.
   ══════════════════════════════════════════════════════════════════════════ */
.modal-content > form{ display:flex; flex-direction:column; min-height:0; flex:1 1 auto; }
.modal-dialog-scrollable .modal-content > form{ overflow:hidden; max-height:100%; }
.modal-dialog-scrollable .modal-content > form > .modal-body{ overflow-y:auto; flex:1 1 auto; min-height:0; overscroll-behavior:contain; }
.modal .modal-content{ max-height:calc(100vh - 2rem); }
.modal .modal-content > .modal-body,
.modal .modal-content > form > .modal-body{ overflow-y:auto; overscroll-behavior:contain; }
.modal .modal-footer{ flex-shrink:0; }
@media (max-width:575.98px){ .modal .modal-content{ max-height:calc(100vh - 1rem); } }
