/* IGnite Intranet — Material Design 3 theme
   Layout: top app bar, standard navigation drawer on the left, one content column.
   Colours: house screen palette (Word Style Guide, outputs-in-code §3) mapped onto M3 colour roles.
   Dark is the default; [data-ig-theme="light"] on <html> switches to light. */

:root {
  color-scheme: dark;
  /* Brand (house "Brand", dark set) */
  --md-primary: #E0664F;
  --md-on-primary: #3A0D04;
  --md-primary-container: #6E2010;
  --md-on-primary-container: #FFDAD2;
  --md-secondary-container: #3B2B27;
  --md-on-secondary-container: #F5DDD7;
  /* Surfaces (house Paper #161616 and Wash #1F1E1C, with M3 container steps) */
  --md-surface: #161616;
  --md-surface-container-lowest: #121212;
  --md-surface-container-low: #1B1A19;
  --md-surface-container: #1F1E1C;
  --md-surface-container-high: #292725;
  --md-surface-container-highest: #33312E;
  --md-hero: #6B3420;
  --md-hero-muted: #D9D4CE;
  --md-hero-field: #4D2618;
  --md-link: #E0664F;
  --md-search: #292725;
  --md-search-hover: #33312E;
  --tone-green: #6FB08E;
  --tone-amber: #D9A24A;
  --tone-red: #F2867A;
  --md-on-surface: #ECEAE6;
  --md-on-surface-variant: #A3A09B;
  --md-outline: #6E6A65;
  --md-outline-variant: #34322F;
  --md-scrim: rgba(0, 0, 0, .55);
  --md-shadow: rgba(0, 0, 0, .5);
  --panel-shadow: rgba(0, 0, 0, .22);
  --md-inverse-surface: #ECEAE6;
  --snack-bg: #3A3734;
  --md-inverse-on-surface: #2B2927;
  --md-inverse-primary: #BF5113;
  /* Area hues, used for icon containers only */
  --hue-blue: #8AB4F8; --hue-indigo: #A9B3FF; --hue-teal: #6FD3C3; --hue-violet: #C7A7FF;
  --hue-amber: #F0B56C; --hue-pink: #F49CC3; --hue-sky: #7DC3F2; --hue-green: #82CB9C;
  --hue-red: #F28B82;
  --hue-mix: 18%;
  /* Solid colour cards: the same bright colours and dark text in both themes (light mode doesn't redefine these) */
  --card-blue: #8AB4F8; --card-indigo: #A9B3FF; --card-teal: #6FD3C3; --card-violet: #C7A7FF; --card-amber: #F0B56C;
  --card-pink: #F49CC3; --card-sky: #7DC3F2; --card-green: #82CB9C; --card-red: #F28B82; --card-brand: #E0664F;
  --card-neutral: #A3A09B; --on-solid: #1A1A1A;
  --open-btn: #262626;   /* a resource's Open button */
  --logo-light-display: none;
  --logo-dark-display: block;
  /* Scrollbars */
  --sb-track: var(--md-surface);
  --sb-thumb: #4A4642;
  --sb-thumb-hover: #66615C;
  --sb-thumb-active: var(--md-primary);

  /* Type: PT Sans is the house face; M3 type scale */
  --font: "PT Sans", Helvetica, Arial, sans-serif;
  /* ---- The shared scale: every size in this file comes from these (tests/style_lint.py checks) ----
     Text, with the line height each size is set on */
  --fs-label: 12px;        /* 16px: labels, captions, meta lines, chips */
  --fs-body-s: 14px;       /* 20px: most text, buttons */
  --fs-body: 16px;         /* 24px: lead text, inputs, list titles */
  --fs-title-s: 18px;      /* 24px: card and panel titles */
  --fs-title: 22px;        /* 28px: section headings */
  --fs-headline-s: 24px;   /* 32px: dialog titles */
  --fs-headline: 28px;     /* 36px: sign-in heading */
  --fs-display: 32px;      /* 40px: page titles */
  /* Icons (Material Symbols): inline with text, in buttons, row actions, standard, large boxes */
  --icon-xs: 16px; --icon-s: 18px; --icon-m: 20px; --icon-l: 24px; --icon-xl: 28px;
  /* Buttons: compact (chips, side panel), standard, large (full-width main actions) */
  --btn-h-s: 36px; --btn-h: 40px; --btn-h-l: 48px;
  /* Google's sign-in mark sits on white in both themes (Google's branding rules) */
  --google-white: #FFFFFF;
  /* Shape (M3 corner scale) */
  --r-xs: 4px; --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-xl: 28px; --r-full: 999px;
  /* Motion (M3 emphasized / standard easing) */
  --ease-emph: cubic-bezier(.2, 0, 0, 1);
  --ease-std: cubic-bezier(.2, 0, 0, 1);
  --ease-press: cubic-bezier(.22, 1, .36, 1);   /* card press (neo-brutalist): quick, soft landing */
  --dur-s: 150ms; --dur-m: 300ms; --dur-l: 500ms;
  --bar-h: 64px;
  --drawer-w: 288px;
}

:root[data-ig-theme="light"] {
  color-scheme: light;
  --md-primary: #EE6B2F;
  --md-on-primary: #2A0D04;
  --open-btn: #F3F3F3;
  --md-primary-container: #FFDBC9;
  --md-on-primary-container: #3A1300;
  --md-link: #BF5113;
  --md-search: #E3DCD7;
  --md-search-hover: #DAD2CC;
  --tone-green: #1E7A45;
  --tone-amber: #8F5300;
  --tone-red: #B3261E;
  --md-secondary-container: #F7DED8;
  --md-on-secondary-container: #2C1510;
  --md-surface: #FFFFFF;
  --md-surface-container-lowest: #FFFFFF;
  --md-surface-container-low: #FAF7F5;
  --md-surface-container: #F4F0ED;
  --md-surface-container-high: #EEE9E6;
  --md-surface-container-highest: #E7E1DE;
  --md-hero: #FDEDE3;
  --md-hero-muted: #595959;
  --md-hero-field: #EFE4DD;
  --md-on-surface: #1A1A1A;
  --md-on-surface-variant: #595959;
  --md-outline: #8A8580;
  --md-outline-variant: #D9D9D9;
  --md-scrim: rgba(0, 0, 0, .32);
  --md-shadow: rgba(60, 30, 20, .18);
  --panel-shadow: rgba(60, 30, 20, .08);
  --md-inverse-surface: #33302D;
  --snack-bg: #E4DFDB;
  --md-inverse-on-surface: #F5EFEC;
  --md-inverse-primary: #FFB59A;
  --hue-blue: #1B5FAA; --hue-indigo: #4152B5; --hue-teal: #0F766E; --hue-violet: #6D3BD1;
  --hue-amber: #8F5300; --hue-pink: #AE1859; --hue-sky: #0D67A3; --hue-green: #1E7A45;
  --hue-red: #C5221F;
  --hue-mix: 12%;
  --logo-light-display: block;
  --logo-dark-display: none;
  --sb-thumb: #D3CDC9;
  --sb-thumb-hover: #A8A29E;
}

/* Neo-brutalist style (Settings > Style; html[data-ig-style="brutal"]): the same layout with outlines, solid offset
   shadows and Space Grotesk. A softer take: 2px outlines, small shadows, the usual rounded corners. */
:root[data-ig-style="brutal"] {
  --font: "Space Grotesk", "PT Sans", Helvetica, Arial, sans-serif;
  --nb-ink: #000000;          /* outlines and shadows: black in both themes */
  --nb-w: 2px;
  --nb-shadow: 3px 3px 0 var(--nb-ink);
  --nb-shadow-up: 5px 5px 0 var(--nb-ink);
  --nb-shadow-s: 2px 2px 0 var(--nb-ink);
  --nb-shadow-pop: 6px 6px 0 var(--nb-ink);
  /* dark: a lifted ground so the black outlines and shadows read */
  --md-surface: #26231F;
  --md-surface-container-lowest: #1F1C19;
  --md-surface-container-low: #2C2925;
  --md-surface-container: #34302B;
  --md-surface-container-high: #3E3933;
  --md-surface-container-highest: #48423B;
  --md-outline-variant: #57514A;
  --md-search: #3E3933;
  --md-search-hover: #48423B;
  --sb-track: #26231F;
}
:root[data-ig-style="brutal"][data-ig-theme="light"] {
  --nb-ink: #000000;
  /* light: neutral greys and white only (no warm tints): a pale grey ground, white cards and panels */
  --md-surface: #F2F2F2;
  --md-surface-container-lowest: #FFFFFF;
  --md-surface-container-low: #FAFAFA;
  --md-surface-container: #FFFFFF;
  --md-surface-container-high: #EBEBEB;
  --md-surface-container-highest: #E0E0E0;
  --md-outline-variant: #CCCCCC;
  --md-search: #FFFFFF;
  --md-search-hover: #F7F7F7;
  --snack-bg: #FFFFFF;
  --sb-track: #F2F2F2;
  --sb-thumb: #C4C4C4;
  --sb-thumb-hover: #9E9E9E;
}

/* Page size (Settings > Size): the whole page is drawn at --ig-scale (80% unless chosen otherwise) on screens
   768px and wider; phones stay at full size. --z is the zoom in effect: sizes taken from the window (vh, vw)
   are divided by it, so full-height and full-width areas still fill the window. ignite.js measures through it too. */
html { --z: 1; zoom: var(--z); }
@media (min-width: 768px) { html { --z: var(--ig-scale, 0.8); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body); line-height: 24px; letter-spacing: .01em;
  background: var(--md-surface);
  color: var(--md-on-surface);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
/* While the page is held for fonts nothing animates, so it appears already settled */
html.ig-loading *, html.ig-loading *::before, html.ig-loading *::after { transition: none !important; animation: none !important; }

/* Moving between pages: the browser cross-fades the content, and the top bar and side panel (named here) stay
   put. While a page's data loads, its content area shows skeletons (html.ig-shell, assets/shell.js). */
@view-transition { navigation: auto; }
.app-bar { view-transition-name: ig-bar; }
.drawer { view-transition-name: ig-drawer; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
html.ig-shell main.page > :not(.skel-page) { display: none !important; }
.skel-page { display: flex; flex-direction: column; gap: 24px; padding-top: 8px; }
.skel { display: block; position: relative; overflow: hidden; border-radius: var(--r-s); background: var(--md-surface-container-high); }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--md-on-surface) 7%, transparent), transparent);
  animation: skel-shimmer 1.2s var(--ease-std) infinite;
}
@keyframes skel-shimmer { to { transform: translateX(100%); } }
.skel-line { height: 16px; }
.skel-title { height: 28px; }
.skel-display { height: 44px; }
.skel-w20 { width: 20%; } .skel-w30 { width: 30%; } .skel-w40 { width: 40%; } .skel-w50 { width: 50%; } .skel-w60 { width: 60%; } .skel-w70 { width: 70%; }
.skel-stack { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.skel-hero { max-width: 640px; }
.skel-head { display: flex; align-items: center; gap: 16px; }
.skel-icon { width: 64px; height: 64px; flex: none; border-radius: var(--r-l); }
.skel-row { display: flex; gap: 8px; }
.skel-chip { width: 140px; height: var(--btn-h-s); border-radius: var(--r-s); }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.skel-card { height: 196px; border-radius: var(--r-l); }
.skel-bar { height: 72px; border-radius: var(--r-l); }
html[data-ig-density="compact"] .skel-card { height: 64px; border-radius: var(--r-m); }
body { transition: opacity 120ms ease-out; }

/* Material Symbols */
.ms {
  font-family: "Material Symbols Rounded";
  font-weight: normal; font-style: normal; font-size: var(--icon-l); line-height: 1;
  letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr;
  display: inline-block; flex: none; width: 1em; height: 1em; overflow: hidden;
  -webkit-font-feature-settings: "liga"; font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
}
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* State layer: hover / focus / press overlays in the content colour */
.sl { position: relative; isolation: isolate; overflow: hidden; }
.sl::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0; pointer-events: none; z-index: -1;
  transition: opacity var(--dur-s) var(--ease-std);
}
.sl:hover::after { opacity: .08; }
.sl:focus-visible::after { opacity: .10; }
.sl:active::after { opacity: .12; }
:focus-visible { outline: 3px solid var(--md-primary); outline-offset: 2px; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 200;
  background: var(--md-primary); color: var(--md-on-primary);
  padding: 10px 16px; border-radius: var(--r-full); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Top app bar ---------- */
.app-bar {
  position: relative; z-index: 50; flex: none;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 8px;
  padding-inline: 8px 16px;
  background: var(--md-surface-container);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; padding: 6px 10px; border-radius: var(--r-m); min-width: 0; }
.brand img { height: 36px; width: auto; }
.brand .logo-light { display: var(--logo-light-display); }
.brand .logo-dark { display: var(--logo-dark-display); }
.brand-divider { width: 1px; height: 28px; background: var(--md-outline-variant); flex: none; }
.brand-label { font-size: var(--fs-body); line-height: 24px; color: var(--md-on-surface-variant); white-space: nowrap; }
.app-bar .spacer { flex: 1; }
.bar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Buttons (M3: 40px tall, full radius) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding-inline: 24px; border-radius: var(--r-full);
  font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em;
  text-decoration: none; border: 0; cursor: pointer; white-space: nowrap;
}
.btn .ms { font-size: var(--icon-s); }
.btn.has-icon { padding-inline: 16px 24px; }
.btn-filled { background: var(--md-primary); color: var(--md-on-primary); }
.btn-filled:hover { box-shadow: 0 1px 2px var(--md-shadow), 0 1px 3px 1px var(--md-shadow); }
.btn-tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.btn-outlined { background: transparent; color: var(--md-link); box-shadow: inset 0 0 0 1px var(--md-outline); }
.btn-text { background: transparent; color: var(--md-link); padding-inline: 12px; }
.btn-text.has-icon { padding-inline: 12px 16px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-full); border: 0; padding: 0;
  display: inline-grid; place-items: center; flex: none; cursor: pointer;
  background: transparent; color: var(--md-on-surface-variant);
}

/* ---------- Search bar (M3 search) ---------- */
.search { position: relative; width: 100%; max-width: 560px; }
.search-field {
  display: flex; align-items: center; gap: 4px;
  height: 48px; padding-inline: 12px 6px;
  border-radius: var(--r-full);
  background: var(--md-search);
  color: var(--md-on-surface-variant);
  transition: background-color var(--dur-s) var(--ease-std);   /* the shape changes at once when results open */
}
.search-field:hover { background: var(--md-search-hover); }
.search-field .ms { margin-inline: 4px 8px; }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font: 400 var(--fs-body)/24px var(--font); color: var(--md-on-surface);
}
.search input::placeholder { color: var(--md-on-surface-variant); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font: 700 var(--fs-label)/16px var(--font); color: var(--md-on-surface-variant);
  border: 1px solid var(--md-outline-variant); border-radius: var(--r-xs);
  padding: 2px 7px; margin-right: 8px;
}
.search .clear { display: none; }
.search.has-value .clear { display: inline-grid; }
.search.has-value kbd { display: none; }
/* Open: the field and its results read as one panel, so the field casts the same shadow as the results
   (the results sit above it, hiding the part of the field's shadow that falls under them). */
.search.open .search-field { border-radius: 24px 24px 0 0; background: var(--md-search); box-shadow: 0 8px 12px 2px var(--md-shadow); }
.search-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 60;
  margin: 0; padding: 0 0 8px; list-style: none;
  background: var(--md-search);
  border-radius: 0 0 24px 24px;
  box-shadow: 0 8px 12px 2px var(--md-shadow);
  max-height: min(calc(70vh / var(--z)), 480px); overflow-y: auto;
  border-top: 1px solid var(--md-outline-variant);
}
.search-results li a {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; min-height: 56px; text-decoration: none; color: var(--md-on-surface);
}
.search-results li a[aria-selected="true"]::after { opacity: .10; }
.search-results .r-text { display: flex; flex-direction: column; min-width: 0; }
.search-results .r-title { font-size: var(--fs-body); line-height: 24px; }
.search-results .r-sub { font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results mark { background: none; color: var(--md-link); font-weight: 700; }
.search-results .ms { color: var(--md-on-surface-variant); }
.search-empty { padding: 16px 20px 8px; color: var(--md-on-surface-variant); font-size: var(--fs-body-s); line-height: 20px; }

.app-bar .search { max-width: 480px; }
.app-bar .search-field { height: 44px; }
.app-bar .search-slot { flex: 1; display: flex; justify-content: center; min-width: 0; padding-inline: 16px; }

/* ---------- What's new: bell + panel (M3 menu surface) ---------- */
.notify { position: relative; }
.bell { color: var(--md-on-surface-variant); overflow: visible; }
.bell[aria-expanded="true"] { color: var(--md-on-secondary-container); background: var(--md-secondary-container); }
.bell[aria-expanded="true"] .ms { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.badge {
  position: absolute; top: 4px; left: 22px;
  min-width: 16px; height: 16px; padding-inline: 4px; border-radius: var(--r-full);
  background: var(--md-primary); color: var(--md-on-primary);
  font: 700 var(--fs-label)/16px var(--font); text-align: center; letter-spacing: 0;
  box-shadow: 0 0 0 2px var(--md-surface-container);
  pointer-events: none;
}
.notify-panel {
  position: fixed; right: 16px; top: calc(var(--bar-h) + 4px); z-index: 70;
  width: min(400px, calc(calc(100vw / var(--z)) - 32px));
  max-height: min(calc(70vh / var(--z)), 560px); overflow-y: auto;
  background: var(--md-surface-container-high);
  border-radius: var(--r-l);
  box-shadow: 0 6px 16px var(--panel-shadow), 0 1px 2px var(--panel-shadow);
  border: 1px solid var(--md-outline-variant);
  padding: 8px 0;
  transform-origin: top right;
  animation: panel-in var(--dur-m) var(--ease-emph);
}
@keyframes panel-in { from { opacity: 0; transform: scale(.92) translateY(-6px); } to { opacity: 1; transform: none; } }
.notify-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 20px 8px; }
.notify-head h2 { margin: 0; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
.notify-count { font-size: var(--fs-label); line-height: 16px; letter-spacing: .03em; color: var(--md-on-surface-variant); }
.notify-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; align-items: flex-start; gap: 16px; padding: 12px 20px 12px 16px; position: relative; }
.notif + .notif { border-top: 1px solid var(--md-outline-variant); }
.notif .lead {
  width: 40px; height: 40px; border-radius: var(--r-full); flex: none;
  display: grid; place-items: center;
  background: var(--md-primary-container); color: var(--md-on-primary-container);
}
.notif .lead .ms { font-size: var(--icon-m); }
.n-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.n-text { font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface); }
.n-text a { color: var(--md-link); font-weight: 700; text-decoration: none; border-radius: var(--r-xs); }
.n-text a:hover { text-decoration: underline; text-underline-offset: 3px; }
.notif time { font-size: var(--fs-label); line-height: 16px; letter-spacing: .03em; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; background: transparent; }
.notif.is-unread .unread-dot { background: var(--md-primary); }
.notif.is-unread .n-text { font-weight: 700; }
.notif.is-unread .n-text a { font-weight: 700; }
.notif-empty { display: flex; gap: 12px; align-items: flex-start; padding: 4px 20px 16px; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.notif-empty .ms { font-size: var(--icon-m); width: 20px; height: 20px; flex: none; }
.notify-panel::-webkit-scrollbar { width: 10px; }
.notify-panel::-webkit-scrollbar-track { background: transparent; }
.notify-panel::-webkit-scrollbar-thumb { border-width: 3px; background-color: var(--sb-thumb-hover); }
@media (max-width: 640px) { .notify-panel { right: 8px; width: calc(calc(100vw / var(--z)) - 16px); } }

/* ---------- Favourites ---------- */
/* Star toggle (M3 icon toggle button): outline at rest, brand colour on hover, filled when saved */
.fav-host { position: relative; }
.star-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--r-full);
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--md-on-surface-variant);
  transition: color var(--dur-s) var(--ease-std);
}
.star-glyph { display: block; width: 22px; height: 22px; fill: transparent; overflow: visible; }
.star-btn .star-glyph { transition: fill var(--dur-s) var(--ease-std), transform var(--dur-s) var(--ease-emph); }
.star-btn:hover, .star-btn:focus-visible { color: var(--md-primary); }
.star-btn:active .star-glyph { transform: scale(.82); }
.star-btn[aria-pressed="true"] { color: var(--md-primary); }
.star-btn[aria-pressed="true"] .star-glyph { fill: currentColor; }
.star-btn::before {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  border: 2px solid var(--md-primary); opacity: 0; pointer-events: none;
}
.star-btn.pop .star-glyph { animation: star-pop 450ms var(--ease-emph); }
.star-btn.pop::before { animation: star-ring 500ms ease-out; }
@keyframes star-pop { 0% { transform: scale(.55); } 55% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes star-ring { 0% { opacity: .75; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.3); } }
.cat-tile > .cat-card { height: 100%; }
.fav-host > .star-btn { top: 12px; right: 12px; }
.resource h2 { padding-right: 36px; }

/* Top-bar star: same treatment as the bell (neutral, filled only while its panel is open) */
.fav-toggle[aria-expanded="true"] { color: var(--md-on-secondary-container); background: var(--md-secondary-container); }
.fav-toggle .star-glyph { width: 24px; height: 24px; stroke-width: 1.8; }
.fav-toggle[aria-expanded="true"] .star-glyph { fill: currentColor; }

/* Favourites panel rows */
.fav-list { list-style: none; margin: 0; padding: 0 8px 4px; }
.fav-row { display: flex; align-items: center; gap: 4px; }
.fav-row .star-btn { position: relative; top: auto; right: auto; flex: none; }
.fav-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px;
  padding: 8px 8px 8px 10px; border-radius: var(--r-m);
  text-decoration: none; color: var(--md-on-surface);
}
.fav-link .icon-box { width: 40px; height: 40px; }
.fav-link .icon-box .ms { font-size: var(--icon-l); }
.fav-text { display: flex; flex-direction: column; min-width: 0; }
.fav-title { font-size: var(--fs-body-s); line-height: 20px; font-weight: 700; }
.fav-sub { font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-empty { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 4px 20px 16px; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.fav-empty .star-glyph { width: 20px; height: 20px; flex: none; }

/* Snackbar (M3) */
.snackbar {
  position: fixed; z-index: 120; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; max-width: min(560px, calc(calc(100vw / var(--z)) - 32px));
  padding: 4px 16px; border-radius: var(--r-xs);
  background: var(--snack-bg); color: var(--md-on-surface); border: 1px solid var(--md-outline-variant);
  box-shadow: 0 3px 8px var(--panel-shadow);
  font-size: var(--fs-body-s); line-height: 20px;
}
.snackbar .btn-text { color: var(--md-link); flex: none; margin-right: -8px; }
.snackbar-text { flex: 1; min-width: 0; text-align: center; }
.snackbar.in { animation: snack-in var(--dur-m) var(--ease-emph); }
@keyframes snack-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Shell: drawer + content ---------- */
/* The page scrolls below the app bar: body is a fixed-height column and .shell is the scroller,
   so the scrollbar starts under the top bar. */
body.app { height: calc(100vh / var(--z)); height: calc(100dvh / var(--z)); display: flex; flex-direction: column; overflow: hidden; }
.shell { display: flex; align-items: flex-start; }
body.app .shell { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-padding-top: 24px; }
.drawer {
  position: sticky; top: 0;
  width: var(--drawer-w); flex: none;
  height: calc(calc(100vh / var(--z)) - var(--bar-h)); height: calc(calc(100dvh / var(--z)) - var(--bar-h));
  overflow-y: auto; padding: 4px 12px 24px;
  background: var(--md-surface);
  border-right: 1px solid var(--md-outline-variant);
}
.drawer nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-head { display: none; }
.drawer h2 {
  margin: 16px 16px 8px; font-size: var(--fs-body-s); line-height: 20px; font-weight: 700;
  color: var(--md-on-surface-variant); letter-spacing: .01em;
}
.drawer hr { border: 0; height: 1px; background: var(--md-outline-variant); margin: 8px 16px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 52px; padding-inline: 16px 24px; border-radius: var(--r-full);
  text-decoration: none; color: var(--md-on-surface-variant);
  font-size: var(--fs-body); line-height: 20px; letter-spacing: .01em;
}
.nav-item .ms { color: var(--md-on-surface-variant); }
.nav-item[aria-current="page"] {
  background: var(--md-secondary-container); color: var(--md-on-secondary-container); font-weight: 700;
}
.nav-item[aria-current="page"] .ms { color: var(--md-on-secondary-container); font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.scrim { display: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Side-menu apps: tinted icon tile, name over a one-line description, external-link cue on hover */
.app-item { height: auto; min-height: 60px; padding: 8px 12px 8px 10px; gap: 14px; border-radius: var(--r-l); color: var(--md-on-surface); }
.app-icon {
  --hue: var(--md-primary);
  width: 40px; height: 40px; border-radius: var(--r-m); flex: none;
  display: grid; place-items: center; color: var(--hue);
  background: color-mix(in srgb, var(--hue) var(--hue-mix), transparent);
}
.app-icon .app-glyph, .app-icon .app-logo { display: block; width: 22px; height: 22px; }
/* the link dialog's own-image buttons (custom icon), and the image address box */
.qa-own { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.qa-own-row { display: flex; flex-wrap: wrap; gap: 8px; }
.qa-own-link { display: flex; align-items: flex-end; gap: 8px; }
.qa-own-link .field { flex: 1; min-width: 0; }
.qa-own-link .btn { height: var(--btn-h-l); }
.qa-own.is-busy { opacity: .6; pointer-events: none; }
/* a link's website icon (from the database) on a plain tile, instead of the chosen icon and colour */
.app-icon.is-site { background: var(--md-surface-container-high); }
.app-icon .app-site { display: block; width: 22px; height: 22px; object-fit: contain; }
.app-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.app-name { font-size: var(--fs-body); line-height: 20px; font-weight: 700; }
.app-desc { font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-item .ext { font-size: var(--icon-s); color: var(--md-on-surface-variant); opacity: 0; transition: opacity var(--dur-s) var(--ease-std); }
.app-item:hover .ext, .app-item:focus-visible .ext { opacity: 1; }
@media (hover: none) { .app-item .ext { opacity: .7; } }

.content { flex: 1; min-width: 0; padding: 8px 32px 0; }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px; padding-bottom: 48px; }

/* ---------- Home hero ---------- */
.hero {
  position: relative;
  border-radius: var(--r-xl);
  background: var(--md-hero);
  padding: 48px 48px 40px;
  display: flex; flex-direction: column; gap: 24px;
}
.hero-text { position: relative; z-index: 1; max-width: 640px; display: flex; flex-direction: column; gap: 12px; }
.hero h1 {
  margin: 0; font-weight: 400;
  font-size: clamp(32px, 4.2vw, 45px); line-height: 1.16; letter-spacing: -.01em;
  text-wrap: balance;
}
.hero p { margin: 0; color: var(--md-hero-muted); font-size: var(--fs-body); line-height: 24px; max-width: 56ch; }
.hero .search { position: relative; z-index: 2; max-width: 620px; }
.hero .search-field { height: 56px; background: var(--md-hero-field); padding-inline: 16px 8px; }
.hero .search-field:hover { background: var(--md-hero-field); }
.hero .search.open .search-field { border-radius: 28px 28px 0 0; }
.hero .search-results { background: var(--md-hero-field); border-radius: 0 0 28px 28px; }
.hero-clip { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.hero-shape {
  position: absolute; z-index: 0; right: -40px; top: 50%;
  width: 300px; height: 300px; transform: translateY(-50%);
  color: var(--md-primary); opacity: .9; pointer-events: none;
}
.hero-shape svg { width: 100%; height: 100%; display: block; }
.hero-shape .ms {
  position: absolute; left: 34%; top: 50%; transform: translate(-50%, -50%);
  font-size: 104px; color: var(--md-on-primary);
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 48;
}

/* Assist chips (quick access) */
.chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; max-width: 760px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--btn-h-s); padding-inline: 10px 16px; border-radius: var(--r-s);
  border: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container-low);
  font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em; text-decoration: none; color: var(--md-on-surface);
}
.chip .ms { font-size: var(--icon-s); color: var(--md-primary); }

/* Section headings */
.section { display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding-inline: 4px; min-height: 40px; }
.section-head-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }
.section-actions { display: flex; gap: 8px; margin-left: auto; }
.section-head h2 { margin: 0; font-size: var(--fs-title); line-height: 28px; font-weight: 400; }
.section-head p { margin: 0; color: var(--md-on-surface-variant); font-size: var(--fs-body-s); line-height: 20px; }

/* Category tiles (filled cards) */
.page { container-type: inline-size; }
/* Columns come from the room the grid actually has (so the page size setting and the side panel are taken into
   account): as many 220px-or-wider columns as fit, at most four. One column on phones. */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(220px, calc((100% - 36px) / 4)), 1fr)); gap: 12px; }
@media (max-width: 572px) {
  .cat-grid { grid-template-columns: minmax(0, 1fr); }
}
.cat-card {
  display: flex; flex-direction: column; gap: 16px;
  padding: 20px 20px 16px; min-height: 196px;
  border-radius: var(--r-l);
  background: var(--md-surface-container);
  text-decoration: none; color: var(--md-on-surface);
  transition: background-color var(--dur-s) var(--ease-std);
}
.cat-text { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cat-card h3 { margin: 0; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
.cat-card p { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.cat-foot { display: flex; align-items: center; justify-content: flex-end; font-size: var(--fs-label); line-height: 16px; letter-spacing: .03em; color: var(--md-on-surface-variant); }
.cat-foot .ms { font-size: var(--icon-m); transition: transform var(--dur-m) var(--ease-emph); }
a.cat-card:hover .cat-foot .ms { transform: translateX(4px); }

.icon-box {
  --hue: var(--md-primary);
  width: 48px; height: 48px; border-radius: var(--r-m); flex: none;
  display: grid; place-items: center;
  color: var(--hue);
  background: color-mix(in srgb, var(--hue) var(--hue-mix), transparent);
}
.icon-box.lg { width: 64px; height: 64px; border-radius: var(--r-l); }
.icon-box.lg .ms { font-size: var(--icon-xl); font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 40; }
.hue-blue { --hue: var(--hue-blue); --card-hue: var(--card-blue); } .hue-indigo { --hue: var(--hue-indigo); --card-hue: var(--card-indigo); } .hue-teal { --hue: var(--hue-teal); --card-hue: var(--card-teal); }
.hue-violet { --hue: var(--hue-violet); --card-hue: var(--card-violet); } .hue-amber { --hue: var(--hue-amber); --card-hue: var(--card-amber); } .hue-pink { --hue: var(--hue-pink); --card-hue: var(--card-pink); }
.hue-sky { --hue: var(--hue-sky); --card-hue: var(--card-sky); } .hue-green { --hue: var(--hue-green); --card-hue: var(--card-green); } .hue-brand { --hue: var(--md-primary); --card-hue: var(--card-brand); }
/* Link types only (resources): red for PDF, Gmail and video; neutral for websites and pending links */
.hue-red { --hue: var(--hue-red); --card-hue: var(--card-red); } .hue-neutral { --hue: var(--md-on-surface-variant); --card-hue: var(--card-neutral); }
/* Cards are solid colour: their icon's colour (lightened in light mode), with text, icons and star in the colour
   that reads on it (--on-solid). The card carries the same hue- class as its icon. Category and sub-category
   tiles, resource cards (not the compact list's rows) and recently viewed. The same colours in both themes. Edit mode keeps its own look. */
.cat-card[class*="hue-"], html:not([data-ig-density="compact"]) .resource[class*="hue-"], .recent-card[class*="hue-"] {
  background: var(--card-hue); color: var(--on-solid);
}
.cat-card[class*="hue-"] :is(h3, p, .cat-foot), .cat-tile:has(> .cat-card[class*="hue-"]) > .star-btn,
html:not([data-ig-density="compact"]) .resource[class*="hue-"] :is(h3, p, dt, dd, dd a, .res-type-label, .pending, .star-btn),
.recent-card[class*="hue-"] :is(.recent-title, .recent-meta, .recent-ext) { color: var(--on-solid); }
.cat-card[class*="hue-"] .icon-box, html:not([data-ig-density="compact"]) .resource[class*="hue-"] .icon-box, .recent-card[class*="hue-"] .icon-box {
  background: color-mix(in srgb, var(--on-solid) 16%, transparent); color: var(--on-solid);
}

/* ---------- Inner pages ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0 -16px; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.crumbs a { color: var(--md-link); text-decoration: none; font-weight: 700; padding: 2px 4px; border-radius: var(--r-xs); }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.crumbs .ms { font-size: var(--icon-s); }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 20px; }
.page-head h1 { margin: 0; font-size: var(--fs-display); line-height: 40px; font-weight: 400; text-wrap: balance; }
.page-head p { margin: 4px 0 0; color: var(--md-on-surface-variant); font-size: var(--fs-body); line-height: 24px; }

.resources { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
@media (min-width: 900px) { .resources.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .resources.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Resource cards: the same tinted card as the category and sub-category tiles (the transparent border is
   there so edit mode's dashed outline doesn't move anything) */
.resource {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 16px 12px 20px; border-radius: var(--r-l);
  border: 1px solid transparent;
  background: var(--md-surface-container);
  scroll-margin-top: calc(var(--bar-h) + 24px);
}
.resource h2 { margin: 0; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
.resource p { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.resource-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; min-height: 40px; }
.resource:target { box-shadow: 0 0 0 2px var(--md-primary); animation: target-pulse 1.2s var(--ease-emph) 1; }
@keyframes target-pulse { 0% { background: var(--md-primary-container); } }   /* back to the card's own tint */
.pending {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding-inline: 8px 12px; border-radius: var(--r-s);
  background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
  font: 700 var(--fs-label)/16px var(--font); letter-spacing: .03em;
}
.pending .ms { font-size: var(--icon-xs); }

.empty {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 24px; border-radius: var(--r-l);
  background: var(--md-surface-container);
  max-width: 720px;
}
.empty .icon-box { --hue: var(--md-on-surface-variant); }
.empty h2 { margin: 0 0 4px; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
.empty p { margin: 0; color: var(--md-on-surface-variant); font-size: var(--fs-body-s); line-height: 20px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -16px; }

/* ---------- Theme switch: everything changes together ----------
   Element colour transitions are paused while the theme flips; the page cross-fades as a single image. */
html.ig-theme-switching *, html.ig-theme-switching *::before, html.ig-theme-switching *::after { transition: none !important; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; animation-timing-function: cubic-bezier(.2, 0, 0, 1); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .drawer {
    position: fixed; z-index: 90; left: 0; top: 0; bottom: 0; height: 100%;
    width: min(320px, calc(86vw / var(--z)));
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    background: var(--md-surface-container-low);
    border-radius: 0 var(--r-l) var(--r-l) 0; border-right: 0;
    transform: translateX(-105%);
    transition: transform var(--dur-m) var(--ease-emph), visibility 0s linear var(--dur-m);
    visibility: hidden;
  }
  .drawer-head { display: block; position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 8px; z-index: 1; }
  body.drawer-open .drawer { transform: none; visibility: visible; transition: transform var(--dur-m) var(--ease-emph); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 80; background: var(--md-scrim); opacity: 0; pointer-events: none; transition: opacity var(--dur-m) var(--ease-std); }
  body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .content { padding: 8px 24px 0; }
}
@media (max-width: 860px) {
  .brand-divider, .brand-label { display: none; }
  .app-bar .search-slot { padding-inline: 8px; }
  .search kbd { display: none; }
}
@media (max-width: 640px) {
  :root { --bar-h: 64px; }
  .brand img { height: 28px; }
  .brand { padding: 6px 4px; }
  .app-bar { flex-wrap: wrap; height: auto; min-height: var(--bar-h); padding-block: 8px; row-gap: 4px; }
  /* the bar has 8px on the left and 16px on the right; this evens the search out to 16px both sides,
     in line with the page content below */
  .app-bar .search-slot { order: 5; flex-basis: 100%; padding: 0 0 4px 8px; }
  .app-bar .search { max-width: none; }
  .content { padding: 4px 16px 0; }
  .page { gap: 32px; }
  .hero { padding: 28px 20px 24px; border-radius: var(--r-l); }
  .hero-shape { width: 200px; height: 200px; right: -100px; top: auto; bottom: -100px; transform: none; opacity: .45; }
  .cat-card { min-height: 0; }
  .hero-shape .ms { display: none; }
  .page-head { gap: 16px; align-items: flex-start; }
  .page-head h1 { font-size: var(--fs-headline); line-height: 36px; }
  .empty { flex-direction: column; gap: 16px; padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* App-bar search hidden while the home hero search is on screen */
.app-bar .search-slot { transition: opacity var(--dur-m) var(--ease-std), visibility 0s; }
.app-bar .search-slot.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dur-s) var(--ease-std), visibility 0s linear var(--dur-s); }
@media (max-width: 640px) { .app-bar .search-slot.is-hidden { display: none; } }
@media (min-width: 641px) and (max-width: 1000px) {
  .hero-shape { width: 260px; height: 260px; right: -110px; opacity: .55; }
  .hero-shape .ms { display: none; }
}

/* ---------- Scrollbars ----------
   Chromium, Edge and Safari: pill thumb inset from the edge, warm neutral, brand colour while dragging.
   Firefox only understands colour and width, so it gets those through @supports below
   (setting scrollbar-color in Chromium would switch off the shaped thumb). */
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: var(--sb-track); }
::-webkit-scrollbar-thumb {
  background-color: var(--sb-thumb);
  border: 4px solid transparent; background-clip: padding-box;
  border-radius: var(--r-full); min-height: 48px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--sb-thumb-hover); border-width: 3px; }
::-webkit-scrollbar-thumb:active { background-color: var(--sb-thumb-active); border-width: 3px; }
::-webkit-scrollbar-corner { background: var(--sb-track); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
/* Slimmer bars inside the menu drawer and search results, on their own surface colours */
.drawer::-webkit-scrollbar, .search-results::-webkit-scrollbar { width: 10px; }
.drawer::-webkit-scrollbar-track, .search-results::-webkit-scrollbar-track { background: transparent; }
.drawer::-webkit-scrollbar-thumb, .search-results::-webkit-scrollbar-thumb { border-width: 3px; }
.drawer::-webkit-scrollbar-thumb { background-color: transparent; }
.drawer:hover::-webkit-scrollbar-thumb, .drawer:focus-within::-webkit-scrollbar-thumb { background-color: var(--sb-thumb); }
.drawer::-webkit-scrollbar-thumb:hover { background-color: var(--sb-thumb-hover); }
.search-results::-webkit-scrollbar-thumb { background-color: var(--sb-thumb-hover); }
/* Dialogs and pop-up panels: a slim scrollbar that sits inside the rounded box (no track colour, kept clear
   of the rounded corners) rather than a full-height strip along its edge. */
.dlg::-webkit-scrollbar { width: 12px; }
.dlg::-webkit-scrollbar-track { background: transparent; margin-block: var(--r-xl); }
.dlg::-webkit-scrollbar-thumb { border-width: 4px; background-color: var(--sb-thumb); }
.dlg::-webkit-scrollbar-thumb:hover { border-width: 3px; background-color: var(--sb-thumb-hover); }
@supports (-moz-appearance: none) {
  html { scrollbar-color: var(--sb-thumb) var(--sb-track); }
  .drawer, .search-results, .dlg { scrollbar-width: thin; scrollbar-color: var(--sb-thumb) transparent; }
}

/* Home without the hero: a plain heading block on the page surface */
.home-head { display: flex; flex-direction: column; gap: 12px; padding: 24px 4px 0; }
.home-head h1 { margin: 0; font-weight: 400; font-size: clamp(28px, 3.2vw, 36px); line-height: 1.22; letter-spacing: -.005em; text-wrap: balance; }
.home-head p { margin: 0; max-width: 60ch; color: var(--md-on-surface-variant); font-size: var(--fs-body); line-height: 24px; }
.home-head .chips { margin-top: 8px; max-width: none; }
/* ---------- Home layout ----------
   Greeting with an orange accent and the Sydney artwork beside it (dropped where there isn't room), then
   What's new and Recently viewed side by side, then the categories as short rows. */
.home-head { position: relative; padding-bottom: 4px; }
.home-head .greet { flex-direction: column; align-items: flex-start; justify-content: center; gap: 12px; }
.home-head .greet::after { content: ""; width: 48px; height: 4px; border-radius: var(--r-full); background: var(--md-primary); }
.home-art { display: none; }
@media (min-width: 1000px) {
  /* the neo-brutalist style has its own artwork; only the one for the current style shows (and loads) */
  html[data-ig-style="brutal"] .home-head .home-art:not(.home-art-nb), html:not([data-ig-style="brutal"]) .home-head .home-art-nb { display: none !important; }
  .home-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 54%); column-gap: 24px; row-gap: 12px; align-content: start; }
  .home-head > :not(.home-art) { grid-column: 1; }
  .home-art { display: block; grid-column: 2; grid-row: 1 / span 2; align-self: end; width: 100%; height: auto; margin-top: -8px; pointer-events: none; user-select: none; }
}

.home-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1000px) { .home-panels { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.home-panels.is-single { grid-template-columns: minmax(0, 1fr); }
.panel-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px 12px; border-radius: var(--r-l); background: var(--md-surface-container); min-width: 0; }
.panel-card[hidden] { display: none; }
.panel-head { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.panel-head h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
.panel-icon { display: grid; place-items: center; color: var(--md-primary); }
.panel-icon .ms { font-size: var(--icon-l); }
.panel-head .btn { margin-right: -8px; }
.btn.has-icon-end { display: inline-flex; align-items: center; gap: 6px; }
.btn.has-icon-end .ms { font-size: var(--icon-s); }
.news-list, .recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.news-row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 0; }
.news-row + .news-row, .recent-list li + li { border-top: 1px solid var(--md-outline-variant); }
.news-tag { flex: none; width: 44px; padding: 2px 0; border-radius: var(--r-xs); text-align: center; font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--md-primary); color: var(--md-on-primary); }
.news-tag.is-blank { background: transparent; }
.news-text { flex: 1; min-width: 0; font-size: var(--fs-body-s); line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-text a { color: var(--md-on-surface); font-weight: 700; text-decoration: none; }
.news-text a:hover { text-decoration: underline; }
.news-ctx, .news-by { color: var(--md-on-surface-variant); }
.news-row time { flex: none; font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.news-empty { padding: 8px 0 12px; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.recent-row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 8px; margin-inline: -8px; border-radius: var(--r-s); text-decoration: none; color: var(--md-on-surface); }
.recent-row:hover { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }
.recent-ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-s); color: var(--hue); background: color-mix(in srgb, var(--hue) var(--hue-mix), transparent); }
.recent-ic .ms, .recent-ic .type-glyph { font-size: var(--icon-m); width: 20px; height: 20px; }
.recent-go { flex: none; font-size: var(--icon-m); color: var(--md-on-surface-variant); }
@media (max-width: 640px) { .news-by { display: none; } }

/* Home categories: short rows (icon, name, arrow), four across on wide screens, in the same solid colours */
.cat-grid.is-rows { gap: 12px; }
.cat-grid.is-rows .cat-card { min-height: 72px; flex-direction: row; align-items: center; gap: 14px; padding: 12px 16px 12px 14px; }
.cat-grid.is-rows .cat-card .icon-box { width: 44px; height: 44px; }
.cat-grid.is-rows .cat-text { flex: 1; gap: 0; }
.cat-grid.is-rows .cat-card h3 { font-size: var(--fs-body); line-height: 20px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cat-grid.is-rows .cat-card p { display: none; }
.cat-grid.is-rows .cat-foot { flex: none; }
/* no favourite stars on the home rows (they stay on category pages) */
.cat-grid.is-rows .cat-tile:not(.is-editing) > .star-btn { display: none; }
.cat-grid.is-rows .cat-tile.is-editing > .cat-card { padding-top: 44px; padding-right: 14px; }
.cat-grid.is-rows .cat-tile .res-edit-btns { top: 4px; right: 4px; }
.cat-grid.is-rows .cat-add { min-height: 72px; }

/* Account button: the avatar with a small arrow */
.account-toggle { width: auto; padding: 0 4px 0 4px; gap: 2px; grid-auto-flow: column; }
.account-toggle .acct-chev { font-size: var(--icon-m); color: var(--md-on-surface-variant); transition: transform var(--dur-m) var(--ease-emph); }
.account-toggle[aria-expanded="true"] .acct-chev { transform: rotate(180deg); }

/* Side panel: the Quick access shortcuts under the title, then the link groups */
.app-icon.is-plain { background: transparent; color: var(--md-primary); }
.drawer .app-item[aria-current="page"] { background: color-mix(in srgb, var(--md-primary) 14%, transparent); }
.drawer .app-item[aria-current="page"] .app-name { color: var(--md-primary); }
.drawer .qa-quick .app-item { min-height: 48px; padding-block: 4px; }
@media (min-width: 1101px) {
  html[data-ig-drawer="collapsed"] .qa-group[data-qa-group="quick"]:not([hidden]) + .qa-group::before {
    content: ""; display: block; height: 1px; margin: 6px 16px; background: var(--md-outline-variant);
  }
  /* the line between the logo and "Intranet" sits right above the open side panel's edge, and stays put
     (the line, "Intranet" and the search don't move) when the panel folds */
  .brand { display: grid; grid-template-columns: calc(var(--drawer-w) - 12px - 10px - 1px) 1px auto; align-items: center; column-gap: 0; }
  .brand-label { margin-left: 14px; }
}

/* Greeting row */
.greet { display: flex; align-items: center; min-height: 48px; }
.greet h1 { margin: 0; font-weight: 400; font-size: clamp(28px, 3.2vw, 36px); line-height: 1.22; letter-spacing: -.005em; text-wrap: balance; }

/* ---------- Account ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--md-primary-container); color: var(--md-on-primary-container);
  font: 700 var(--fs-body-s)/1 var(--font); letter-spacing: 0;
}
.avatar.lg { width: 48px; height: 48px; font-size: var(--fs-title-s); }
.account-toggle[aria-expanded="true"] .avatar { box-shadow: 0 0 0 2px var(--md-surface), 0 0 0 4px var(--md-primary); }
.account-panel { width: min(340px, calc(calc(100vw / var(--z)) - 32px)); padding: 8px 0 12px; max-height: calc(calc(100vh / var(--z)) - var(--bar-h) - 16px); max-height: calc(calc(100dvh / var(--z)) - var(--bar-h) - 16px); }
.acct-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px 16px; border-bottom: 1px solid var(--md-outline-variant); }
.acct-id { min-width: 0; }
.acct-id h2 { margin: 0; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
.acct-id p { margin: 0; font-size: var(--fs-label); line-height: 16px; letter-spacing: .02em; color: var(--md-on-surface-variant); }
.acct-section { padding: 12px 8px 4px; }
.acct-section + .acct-section { border-top: 1px solid var(--md-outline-variant); }
.acct-section h3 { margin: 0 12px 8px; font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .03em; color: var(--md-on-surface-variant); }
.acct-row {
  width: 100%; display: flex; align-items: center; gap: 14px;
  min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--r-m);
  background: transparent; color: var(--md-on-surface); text-align: left; text-decoration: none;
  font: 400 var(--fs-body-s)/20px var(--font); cursor: pointer;
}
.acct-row > .ms, .acct-row > .star-glyph { color: var(--md-on-surface-variant); font-size: var(--icon-l); width: 22px; height: 22px; flex: none; }
.acct-label { flex: 1; min-width: 0; }
.acct-meta { font-size: var(--fs-label); line-height: 16px; letter-spacing: .02em; color: var(--md-on-surface-variant); }
.acct-ext { font-size: var(--icon-xs) !important; color: var(--md-on-surface-variant); }
.acct-foot { padding: 12px 20px 4px; border-top: 1px solid var(--md-outline-variant); margin-top: 4px; }
.acct-foot .btn { width: 100%; }

/* M3 segmented button (theme) */
/* Segmented control: the account menu's Theme and View (the admin panel uses chips, .chip-btn) */
.segmented { display: flex; margin: 0; border: 1px solid var(--md-outline); border-radius: var(--r-full); overflow: hidden; }
.acct-section .segmented { margin: 0 4px 8px; }
.seg:disabled { cursor: default; }
.seg:disabled:not([aria-checked="true"]) { opacity: .45; }
.seg {
  flex: 1; height: var(--btn-h); padding-inline: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: transparent; color: var(--md-on-surface); cursor: pointer;
  font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em;
}
.seg + .seg { border-left: 1px solid var(--md-outline); }
.seg .ms { font-size: var(--icon-s); }
.seg .seg-check { display: none; }
.seg[aria-checked="true"] { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.seg[aria-checked="true"] .seg-check { display: inline-block; }
.seg[aria-checked="true"] .seg-icon { display: none; }

/* ---------- Sign-in page (signin.html, assets/signin.js) ---------- */
body.login-page { margin: 0; background: var(--md-surface); color: var(--md-on-surface); font-family: var(--font); }
.login { min-height: calc(100vh / var(--z)); min-height: calc(100dvh / var(--z)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 48px 16px; position: relative; box-sizing: border-box; }
.login-state { display: flex; flex-direction: column; gap: 24px; }
.login-state[hidden] { display: none; }
.login-state h1:focus { outline: none; }   /* focused only so screen readers read the new state */
.login-text .ms.big { font-size: var(--icon-xl); margin-bottom: 8px; color: var(--md-primary); }
.login-state.is-denied .login-text .ms.big { color: var(--tone-red); }
.login-btn.google { gap: 12px; }
.g-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--google-white); display: grid; place-items: center; flex: none; }
.g-badge svg { width: 18px; height: 18px; }
.login-busy { display: flex; align-items: center; gap: 14px; color: var(--md-on-surface-variant); font-size: var(--fs-body); line-height: 24px; }
.login-spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--md-outline-variant); border-top-color: var(--md-primary); animation: login-spin .9s linear infinite; flex: none; }
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .login-spinner { animation-duration: 3s; } }
.login-theme { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }
.login-card {
  width: min(420px, 100%);
  display: flex; flex-direction: column; align-items: stretch; gap: 24px;
  padding: 40px 32px 32px; border-radius: var(--r-xl);
  background: var(--md-surface-container);
}
.login-card img { height: 40px; width: auto; align-self: flex-start; }
.login-card .logo-dark { display: var(--logo-dark-display); }
.login-card .logo-light { display: var(--logo-light-display); }
.login-text h1 { margin: 0 0 6px; font-size: var(--fs-headline); line-height: 36px; font-weight: 400; }
.login-text p { margin: 0; color: var(--md-on-surface-variant); font-size: var(--fs-body); line-height: 24px; }
.login-btn { height: var(--btn-h-l); width: 100%; font-size: var(--fs-body-s); }
.login-note { display: flex; gap: 10px; margin: 0; padding: 12px 14px; border-radius: var(--r-m); background: var(--md-surface-container-high); color: var(--md-on-surface-variant); font-size: var(--fs-body-s); line-height: 20px; }
.login-note .ms { font-size: var(--icon-s); color: var(--md-on-surface-variant); }
.login-foot { margin: 0; font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); text-align: center; max-width: 420px; }
@media (max-width: 640px) { .login-card { padding: 32px 20px 24px; border-radius: var(--r-l); } }

/* ---------- IT Support: choose a priority ---------- */
.support-intro { margin: -16px 0 0; max-width: 68ch; color: var(--md-on-surface-variant); font-size: var(--fs-body); line-height: 24px; }
.prio-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .prio-grid { grid-template-columns: minmax(0, 1fr); max-width: 560px; } }
.prio {
  --tone: var(--tone-green);
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: var(--r-l);
  background: var(--md-surface-container);
}
.tone-green { --tone: var(--tone-green); } .tone-amber { --tone: var(--tone-amber); } .tone-red { --tone: var(--tone-red); }
.prio-head { display: flex; align-items: center; gap: 14px; }
.prio-icon {
  width: 48px; height: 48px; border-radius: var(--r-m); flex: none; display: grid; place-items: center;
  color: var(--tone); background: color-mix(in srgb, var(--tone) var(--hue-mix), transparent);
}
.prio-head h2 { margin: 0; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
.prio-summary { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--tone); font-weight: 700; }
.prio-when { margin: 0; flex: 1; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.prio-btn { width: 100%; height: var(--btn-h-l); }
.prio-subject { margin: 0; min-height: 32px; font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); overflow-wrap: anywhere; user-select: all; }
.prio-subject span { font-weight: 700; margin-right: 4px; user-select: none; }
.support-fallback { display: flex; gap: 10px; align-items: flex-start; margin: -8px 0 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.support-fallback .ms { font-size: var(--icon-m); }
.selectable { user-select: all; color: var(--md-on-surface); }

/* ---------- Quick access: edit mode ---------- */
.drawer-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 4px 6px 16px; min-height: 40px; }
.drawer-title-row h2 { margin: 0; }
.qa-edit { color: var(--md-on-surface-variant); }
.qa-edit .ms { font-size: var(--icon-m); }
.qa-done { height: var(--btn-h-s); padding-inline: 18px; }
.app-list { display: flex; flex-direction: column; gap: 2px; }
.app-item.is-editing { gap: 8px; padding: 6px 4px 6px 0; cursor: default; background: var(--md-surface-container-low); }
.app-list.is-editing { gap: 6px; }
.app-item.is-editing .app-desc { max-width: 100%; }
.qa-handle {
  width: 32px; height: 44px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: var(--r-s); background: transparent; color: var(--md-on-surface-variant);
  cursor: grab; touch-action: none;
}
.qa-handle:hover { color: var(--md-on-surface); background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.qa-handle .ms { font-size: var(--icon-m); }
.qa-row-btn { width: 36px; height: 36px; color: var(--md-on-surface-variant); }
.qa-row-btn .ms { font-size: var(--icon-m); }
.app-list.is-sorting { cursor: grabbing; }
.app-list.is-sorting .qa-handle { cursor: grabbing; }
.app-item.is-dragging {
  background: var(--md-surface-container-high);
  box-shadow: 0 4px 12px var(--panel-shadow), 0 0 0 1px var(--md-primary);
  position: relative; z-index: 2;
}
.qa-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 8px 4px; }
.qa-empty { margin: 4px 16px 8px; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
/* Quick access groups: Team links (the same for everyone; anyone can fold it) and My links */
.qa-group { display: flex; flex-direction: column; gap: 2px; }
.qa-group[hidden] { display: none; }
.qa-group + .qa-group { margin-top: 12px; }
.qa-group-head { display: flex; align-items: center; gap: 4px; min-height: 40px; margin: 0 4px 0 16px; }
.qa-group-title {
  flex: 1; min-width: 0; margin: 0; font-size: var(--fs-label); line-height: 16px; font-weight: 700;
  letter-spacing: .04em; color: var(--md-on-surface-variant);
}
.qa-group-toggle {
  display: inline-flex; align-items: center; gap: 2px; margin: 0 0 0 -8px; padding: 6px 4px 6px 8px;
  border: 0; border-radius: var(--r-full); background: transparent; cursor: pointer;
  font: inherit; letter-spacing: inherit; color: inherit;
}
.qa-group-toggle:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.qa-group-toggle .chev { font-size: var(--icon-m); transition: transform var(--dur-m) var(--ease-emph); }
.qa-group-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.qa-group-wrap { display: grid; grid-template-rows: 1fr; grid-template-columns: minmax(0, 1fr); opacity: 1;
  transition: grid-template-rows var(--dur-m) var(--ease-emph), opacity var(--dur-m) var(--ease-std); }
.qa-group-wrap[data-open="false"] { grid-template-rows: 0fr; opacity: 0; }
.qa-group-body { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.qa-group-wrap[data-open="false"] > .qa-group-body { overflow: hidden; }
.app-icon .app-ms { font-size: var(--icon-l); }
@media (max-width: 1100px) { .drawer-title-row { margin: 0 52px 6px 16px; } }

/* ---------- Dialog (M3 basic dialog) ---------- */
.dlg {
  width: min(480px, calc(calc(100vw / var(--z)) - 32px)); max-height: calc(calc(100vh / var(--z)) - 48px);
  padding: 0; border: 0; border-radius: var(--r-xl);
  background: var(--md-surface-container-high); color: var(--md-on-surface);
  box-shadow: 0 8px 28px var(--panel-shadow);
  overflow: auto;
}
.dlg::backdrop { background: var(--md-scrim); }
.dlg[open] { animation: dlg-in var(--dur-m) var(--ease-emph); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.dlg-form h2 { margin: 0 0 2px; font-size: var(--fs-headline-s); line-height: 32px; font-weight: 400; }
.dlg-preview { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--r-l); background: var(--md-surface-container); min-height: 60px; }
.dlg-preview .app-desc[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .02em; color: var(--md-on-surface-variant); }
.field em { font-style: normal; font-weight: 400; }
.field input {
  height: 48px; padding: 0 14px; border: 1px solid var(--md-outline); border-radius: var(--r-xs);
  background: transparent; color: var(--md-on-surface); font: 400 var(--fs-body)/24px var(--font); letter-spacing: .01em;
}
.field input:hover { border-color: var(--md-on-surface); }
.field input:focus { outline: none; border: 2px solid var(--md-primary); padding: 0 13px; }
.field input[aria-invalid="true"] { border: 2px solid var(--tone-red); padding: 0 13px; }
.field-error { margin: -8px 0 0; font-size: var(--fs-label); line-height: 16px; color: var(--tone-red); }
.picker { margin: 0; padding: 0; border: 0; min-width: 0; }
.picker legend { padding: 0; margin-bottom: 8px; font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .02em; color: var(--md-on-surface-variant); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-choice {
  height: 44px; border: 1px solid var(--md-outline-variant); border-radius: var(--r-m);
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--md-on-surface-variant);
}
.icon-choice .app-glyph, .icon-choice .app-logo { width: 22px; height: 22px; }
.icon-choice .app-ms { font-size: var(--icon-l); }
.icon-choice[aria-checked="true"] {
  color: var(--hue); border: 2px solid var(--hue);
  background: color-mix(in srgb, var(--hue) var(--hue-mix), transparent);
}
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--hue); color: var(--md-surface);
}
.swatch .ms { font-size: var(--icon-m); opacity: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--md-surface-container-high), 0 0 0 4px var(--hue); }
.swatch[aria-checked="true"] .ms { opacity: 1; }
/* Each colour row shows its colours as they'll really appear. Categories and sub-categories (.is-card) are solid
   cards in the card colour, so the swatch is that colour; Quick access tiles (.is-tile) are a light tint with the
   icon in the full colour, so the swatch is the tint with a dot of the icon colour. */
.swatch-row.is-card .swatch { background: var(--card-hue); color: var(--on-solid); }
.swatch-row.is-card .swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--md-surface-container-high), 0 0 0 4px var(--card-hue); }
.swatch-row.is-tile .swatch { background: color-mix(in srgb, var(--hue) var(--hue-mix), transparent); color: var(--hue); }
.swatch-row.is-tile .swatch > *, .swatch-row.is-tile .swatch::before { grid-area: 1 / 1; }
.swatch-row.is-tile .swatch:not([aria-checked="true"])::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--hue); }
/* the category dialog's preview is drawn as the card itself */
.dlg-preview.is-card[class*="hue-"] { background: var(--card-hue); color: var(--on-solid); }
.dlg-preview.is-card[class*="hue-"] :is(.app-name, .app-desc) { color: var(--on-solid); }
.dlg-preview.is-card[class*="hue-"] .icon-box { background: color-mix(in srgb, var(--on-solid) 16%, transparent); color: var(--on-solid); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Quick access folders */
.qa-folder { display: flex; flex-direction: column; gap: 2px; }
.folder-row { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.folder-row .chev { margin-left: auto; font-size: var(--icon-m); color: var(--md-on-surface-variant); transition: transform var(--dur-m) var(--ease-emph); }
.folder-row[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.qa-children { display: flex; flex-direction: column; gap: 2px; margin-left: 22px; padding-left: 10px; border-left: 2px solid var(--md-outline-variant); }
.qa-children-wrap { display: grid; grid-template-rows: 1fr; opacity: 1;
  transition: grid-template-rows var(--dur-m) var(--ease-emph), opacity var(--dur-m) var(--ease-std); }
.qa-children-wrap[data-open="false"] { grid-template-rows: 0fr; opacity: 0; }
.qa-children-wrap > .qa-children { min-height: 0; overflow: hidden; }
.qa-empty.sm { margin: 6px 8px 8px; font-size: var(--fs-label); line-height: 16px; }
.qa-folder.is-editing { gap: 6px; border-radius: var(--r-l); }
.qa-folder.is-editing > .folder-row { cursor: default; }
.qa-folder.is-editing .qa-children { gap: 6px; margin-left: 16px; padding-left: 8px; }
.qa-folder.is-dragging { box-shadow: 0 4px 12px var(--panel-shadow), 0 0 0 1px var(--md-primary); background: var(--md-surface-container-high); position: relative; z-index: 2; }
.qa-folder.is-dragging > .folder-row { background: transparent; }
.dlg select {
  height: 48px; padding: 0 12px; border: 1px solid var(--md-outline); border-radius: var(--r-xs);
  background: transparent; color: var(--md-on-surface); font: 400 var(--fs-body)/24px var(--font);
}
.dlg select:focus { outline: none; border: 2px solid var(--md-primary); padding: 0 11px; }
.dlg select option { background: var(--md-surface-container-high); color: var(--md-on-surface); }
.qa-link-only { display: flex; flex-direction: column; gap: 14px; }
.qa-link-only[hidden] { display: none; }
/* Edit mode: keep names on one line and leave room for nested rows */
.app-list.is-editing .app-name, .app-list.is-editing .app-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-list.is-editing .app-item.is-editing { gap: 6px; padding-right: 2px; }
.app-list.is-editing .qa-handle { width: 28px; }
.app-list.is-editing .qa-row-btn { width: 32px; height: 32px; }
.app-list.is-editing .qa-children .app-icon { width: 34px; height: 34px; }
.qa-folder.is-editing .qa-children { margin-left: 12px; padding-left: 6px; }
.qa-foot .btn.has-icon { padding-inline: 12px 16px; height: var(--btn-h-s); }

/* Drag a link onto a folder: the folder lights up as the drop target */
.qa-folder.is-editing.drop-into { box-shadow: 0 0 0 2px var(--md-primary); background: color-mix(in srgb, var(--md-primary) 8%, transparent); }
.qa-folder.is-editing .qa-children { min-height: 8px; }

/* ---------- Area pages: sections and the page editor ---------- */
.page-head-text { min-width: 0; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; }
.area-body { display: flex; flex-direction: column; gap: 36px; }
.res-section { display: flex; flex-direction: column; gap: 14px; }
.res-section-title { margin: 0; font-size: var(--fs-title); line-height: 28px; font-weight: 400; }
.res-section-title.untitled { color: var(--md-on-surface-variant); }
.res-section-head { display: flex; align-items: center; gap: 2px; min-height: 40px; }
.res-section-head .res-section-title { margin-right: 6px; }
.res-btn { width: 36px; height: 36px; color: var(--md-on-surface-variant); }
.res-btn .ms { font-size: var(--icon-m); }
.res-btn[data-ad-del]:hover, .res-btn[data-ad-del-section]:hover { color: var(--tone-red); }
.resource h3 { margin: 0; font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; padding-right: 36px; }
.res-edit-btns { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; }
.resource.is-editing { border: 1.5px dashed var(--md-outline); background: var(--md-surface-container-low); }
.resource.is-editing h3 { padding-right: 76px; }
.res-add {
  min-height: 140px; border: 1.5px dashed var(--md-outline); border-radius: var(--r-l);
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: transparent; color: var(--md-link); font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em;
}
.res-add .ms { font-size: var(--icon-m); }
.res-empty { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.area-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -12px; }
@media (max-width: 640px) { .page-head-actions, .section-actions { margin-left: 0; width: 100%; } }

/* ---------- Settings: editing tools off ----------
   Every editing control is marked data-edit-ui; turning editing tools off hides them all. */
html[data-ig-edit="off"] [data-edit-ui] { display: none !important; }

/* ---------- Side panel: folds to an icon rail on desktop ----------
   The rail is 84px: icons stay exactly where they sit in the full panel, so only the width changes. */
:root { --rail-w: 84px; }
.rail-toggle { display: none; color: var(--md-on-surface-variant); }
.rail-toggle .ms { transition: transform var(--dur-m) var(--ease-emph); }
@media (min-width: 1101px) {
  .icon-btn.menu { display: none; }
  .app-bar { padding-inline-start: 12px; }
  .rail-toggle { display: inline-grid; }
  .drawer { overflow-x: hidden; transition: width var(--dur-m) var(--ease-emph); }
  .drawer-title-row { margin: 8px 4px 6px 10px; justify-content: flex-start; gap: 4px; }
  .drawer-title-row h2 { flex: 1; white-space: nowrap; transition: opacity var(--dur-s) var(--ease-std); }
  .drawer .app-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .drawer .app-text, .drawer .app-item .ext, .drawer .folder-row .chev { transition: opacity var(--dur-s) var(--ease-std); }

  html[data-ig-drawer="collapsed"] .drawer { width: var(--rail-w); scrollbar-width: none; }
  html[data-ig-drawer="collapsed"] .drawer::-webkit-scrollbar { width: 0; }
  html[data-ig-drawer="collapsed"] .rail-toggle .ms { transform: rotate(180deg); }
  html[data-ig-drawer="collapsed"] .drawer-title-row h2,
  html[data-ig-drawer="collapsed"] .qa-edit, html[data-ig-drawer="collapsed"] .qa-done,
  html[data-ig-drawer="collapsed"] .qa-foot { display: none !important; }
  html[data-ig-drawer="collapsed"] .drawer .app-text,
  html[data-ig-drawer="collapsed"] .drawer .app-item .ext,
  html[data-ig-drawer="collapsed"] .drawer .folder-row .chev { opacity: 0; pointer-events: none; }
  html[data-ig-drawer="collapsed"] .drawer .app-item { width: 60px; min-height: 60px; padding-right: 0; }
  html[data-ig-drawer="collapsed"] .drawer .qa-empty { display: none; }
  /* Groups: no headings in the rail, just a line between the team links and this person's own */
  html[data-ig-drawer="collapsed"] .qa-group-head { display: none; }
  html[data-ig-drawer="collapsed"] .qa-group + .qa-group { margin-top: 0; }
  html[data-ig-drawer="collapsed"] .qa-group[data-qa-group="team"]:not([hidden]):not(.is-folded) + .qa-group::before {
    content: ""; display: block; height: 1px; margin: 6px 16px; background: var(--md-outline-variant);
  }
  /* Folders: an open folder's links stack under its icon on a shared tint */
  html[data-ig-drawer="collapsed"] .qa-folder { width: 60px; border-radius: var(--r-l); transition: background-color var(--dur-m) var(--ease-std); }
  html[data-ig-drawer="collapsed"] .qa-folder:has(> .qa-children-wrap[data-open="true"]) { background: var(--md-surface-container-high); }
  html[data-ig-drawer="collapsed"] .qa-children { margin-left: 0; padding-left: 0; border-left: 0; }
  /* links in an open folder are the same size as every other item in the rail, so their highlight matches */
}
/* Tooltip (M3 plain tooltip), one for every title and icon button; beside the icon in the folded side panel */
.rail-tip {
  position: fixed; z-index: 130; transform: translateY(-50%); pointer-events: none;
  display: flex; flex-direction: column; max-width: 240px; padding: 6px 10px; border-radius: var(--r-xs);
  background: var(--md-inverse-surface); color: var(--md-inverse-on-surface);
  font-size: var(--fs-label); line-height: 16px; box-shadow: 0 2px 6px var(--panel-shadow);
  animation: tip-in var(--dur-s) var(--ease-std);
}
.rail-tip.is-below { transform: none; }   /* under (or above) a button, rather than beside a side panel icon */
.rail-tip-name { font-weight: 700; }
.rail-tip-sub { opacity: .8; font-size: var(--fs-label); line-height: 16px; }
@keyframes tip-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Account menu: switch row (M3 switch) ---------- */
.acct-label { display: flex; flex-direction: column; }
.acct-label .acct-meta { margin-top: 1px; }
.segmented + .segmented { margin-top: 8px; }
.switch {
  position: relative; flex: none; width: 52px; height: 32px; border-radius: var(--r-full);
  border: 1px solid var(--md-outline); background: var(--md-surface-container-highest);
  transition: background-color var(--dur-s) var(--ease-std), border-color var(--dur-s) var(--ease-std);
}
.switch::before {
  content: ""; position: absolute; top: 50%; left: 7px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--md-outline); transform: translateY(-50%);
  transition: left var(--dur-m) var(--ease-emph), width var(--dur-s) var(--ease-std), height var(--dur-s) var(--ease-std), background-color var(--dur-s) var(--ease-std);
}
/* The switch keeps its outline when on, like the Theme and View choices */
[aria-checked="true"] > .switch { background: var(--md-primary); }
[aria-checked="true"] > .switch::before { left: 23px; width: 24px; height: 24px; background: var(--md-on-primary); }
.acct-row[role="switch"] { padding-right: 8px; }

/* ---------- Buttons: destructive ---------- */
.btn-danger { background: var(--tone-red); color: var(--md-surface); }
.btn-danger:hover { box-shadow: 0 1px 2px var(--md-shadow), 0 1px 3px 1px var(--md-shadow); }
.btn-text-danger { color: var(--tone-red); }
.dlg-sm { width: min(400px, calc(calc(100vw / var(--z)) - 32px)); }
.dlg-text, .dlg-hint { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.dlg-preview .icon-box { width: 40px; height: 40px; }
.dlg-preview .icon-box .ms { font-size: var(--icon-l); }

/* ---------- Notifications: View all ---------- */
.notify-foot { display: flex; justify-content: center; padding: 4px 12px 0; border-top: 1px solid var(--md-outline-variant); margin-top: 4px; }
.notify-foot .btn { margin-top: 4px; }
.notif .lead-add { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* ---------- Home: category tiles in edit mode ---------- */
.cat-tile.is-editing > .cat-card { border: 1.5px dashed var(--md-outline); background: var(--md-surface-container-low); }
.cat-tile.is-editing h3 { padding-right: 0; }
.cat-add {
  min-height: 196px; border: 1.5px dashed var(--md-outline); border-radius: var(--r-l);
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: transparent; color: var(--md-link); font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em;
}
.cat-add .ms { font-size: var(--icon-m); }

/* ---------- Category pages: groups, drag handles and reordering ---------- */
.res-group { display: flex; flex-direction: column; gap: 10px; }
.res-group-label { margin: 0; font-size: var(--fs-body-s); line-height: 20px; font-weight: 700; color: var(--md-on-surface-variant); }
.res-sections { display: flex; flex-direction: column; gap: 36px; }
.resource.is-editing h3 { padding-right: calc(var(--btns, 2) * 38px + 4px); }
.drag-handle { cursor: grab; touch-action: none; }
.is-sorting, .is-sorting .drag-handle { cursor: grabbing; }
.is-sorting { user-select: none; }
.drop-hint {
  margin: 0; min-height: 96px; display: grid; place-items: center; padding: 16px;
  border: 1.5px dashed var(--md-outline-variant); border-radius: var(--r-m);
  font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant);
}
.resource.is-dragging, .cat-tile.is-dragging, .res-section.is-dragging {
  position: relative; z-index: 3;
  box-shadow: 0 8px 24px var(--panel-shadow), 0 0 0 2px var(--md-primary);
}
.resource.is-dragging { background: var(--md-surface-container-high); border-style: solid; }
.cat-tile.is-dragging { border-radius: var(--r-l); }
.cat-tile.is-dragging > .cat-card { background: var(--md-surface-container-high); }
.res-section.is-dragging { border-radius: var(--r-l); background: var(--md-surface-container-high); padding: 4px 8px; margin: -4px -8px; }
.res-section.is-editing { border-radius: var(--r-l); }
/* While a section is dragged, every section folds to its heading */
.is-sorting-sections .res-section > .resources, .is-sorting-sections .res-group { display: none; }
.is-sorting-sections .res-sections { gap: 8px; }
.is-sorting-sections .res-section { padding: 4px 8px; margin: 0 -8px; background: var(--md-surface-container-low); border-radius: var(--r-l); }
.resource.is-target { box-shadow: 0 0 0 2px var(--md-primary); animation: target-pulse 1.2s var(--ease-emph) 1; }
.res-del:hover { color: var(--tone-red); }
.btn-outlined.has-icon .ms, .btn-text.has-icon .ms { font-size: var(--icon-s); }

/* ---------- Admin panel ---------- */
.admin { display: flex; flex-direction: column; gap: 16px; margin-top: -8px; }
.admin-note { display: flex; gap: 10px; margin: 0; padding: 12px 14px; max-width: 760px; border-radius: var(--r-m); background: var(--md-surface-container); color: var(--md-on-surface-variant); font-size: var(--fs-body-s); line-height: 20px; }
.admin-note .ms { font-size: var(--icon-m); }
.admin-summary { padding-inline: 4px; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-card { border-radius: var(--r-l); background: var(--md-surface-container); }
.user-head {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 14px; min-height: 72px;
  border: 0; border-radius: var(--r-l); background: transparent; color: var(--md-on-surface); text-align: left; cursor: pointer; font: inherit;
}
.user-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { font-size: var(--fs-body); line-height: 22px; font-weight: 700; }
.user-email { font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-chip { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: var(--r-full); background: var(--md-surface-container-highest); font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .03em; color: var(--md-on-surface-variant); vertical-align: 2px; }
.role-chip { flex: none; padding: 4px 12px; border-radius: var(--r-s); font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .03em; border: 1px solid var(--md-outline-variant); color: var(--md-on-surface-variant); }
.role-admin { background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: transparent; }
.role-editor { background: var(--md-secondary-container); color: var(--md-on-secondary-container); border-color: transparent; }
.user-head .chev { color: var(--md-on-surface-variant); transition: transform var(--dur-m) var(--ease-emph); }
.user-card.is-open .user-head .chev { transform: rotate(180deg); }
/* An opened card stays one even tint: no hover band across its heading (keyboard focus still shows) */
.user-card.is-open > .user-head.sl:hover::after, .user-card.is-open > .user-head.sl:active::after { opacity: 0; }
.user-body-wrap { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows var(--dur-m) var(--ease-emph), opacity var(--dur-m) var(--ease-std); }
.user-body-wrap[data-open="true"] { grid-template-rows: 1fr; opacity: 1; }
.user-body-wrap > .user-body { min-height: 0; overflow: hidden; }
.user-body { display: flex; flex-direction: column; gap: 16px; padding: 0 20px; }
.user-body-wrap[data-open="true"] > .user-body { padding-bottom: 20px; }
.perm-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--md-outline-variant); }
.perm-presets-label { font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .02em; color: var(--md-on-surface-variant); margin-right: 4px; }
.perm-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 552px) { .perm-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 708px) { .perm-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .perm-groups { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.perm-group { margin: 0; padding: 12px 8px 8px; border: 1px solid var(--md-outline-variant); border-radius: var(--r-m); min-width: 0; }
.perm-group legend { padding: 0 6px; font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .03em; color: var(--md-on-surface-variant); }
.perm { display: flex; align-items: flex-start; gap: 12px; padding: 8px; border-radius: var(--r-s); cursor: pointer; font-size: var(--fs-body-s); line-height: 20px; }
.perm:hover { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }
.perm.is-locked { cursor: default; color: var(--md-on-surface-variant); }
.perm.is-locked:hover { background: transparent; }
.cb {
  appearance: none; -webkit-appearance: none; flex: none; margin: 1px 0 0; width: 18px; height: 18px;
  border: 2px solid var(--md-on-surface-variant); border-radius: 3px; display: grid; place-items: center; cursor: pointer;
  transition: background-color var(--dur-s) var(--ease-std), border-color var(--dur-s) var(--ease-std);
}
.cb::after { content: ""; width: 5px; height: 10px; border: solid var(--md-on-primary); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg) scale(0); transition: transform var(--dur-s) var(--ease-emph); }
.cb:checked { background: var(--md-primary); border-color: var(--md-primary); }
.cb:checked::after { transform: translateY(-1px) rotate(45deg) scale(1); }
.cb:disabled { opacity: .45; cursor: default; }
.cb:focus-visible { outline: 3px solid var(--md-primary); outline-offset: 2px; }
.perm-note { display: flex; gap: 8px; margin: 0; font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); }
.perm-note .ms { font-size: var(--icon-s); }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) {
  .user-head { gap: 10px; padding-inline: 12px 10px; }
  .user-head .avatar.lg { width: 40px; height: 40px; font-size: var(--fs-title-s); }
  .user-email { white-space: normal; }
  .role-chip { padding-inline: 8px; }
  .user-body { padding-inline: 12px; }
}

/* ---------- Compact view ----------
   Smaller tiles and tighter spacing everywhere; set in the account menu. */
html[data-ig-density="compact"] {
  --bar-h: 56px;
  --drawer-w: 240px;    /* the side panel on desktop: link names only, so it can be narrower */
}
/* ...but full width while links are being edited, so their names and buttons fit */
html[data-ig-density="compact"] .drawer:has(.qa-group.is-editing) { --drawer-w: 288px; }
html[data-ig-density="compact"] .app-bar .search-field { height: 40px; }
html[data-ig-density="compact"] .page { gap: 28px; }
html[data-ig-density="compact"] .home-head { padding-top: 12px; gap: 8px; }
html[data-ig-density="compact"] .greet { min-height: 40px; }
html[data-ig-density="compact"] .chip { height: 32px; }
html[data-ig-density="compact"] .section { gap: 12px; }
/* Category tiles: one row (icon, name, count) */
html[data-ig-density="compact"] .cat-grid { gap: 8px; grid-template-columns: repeat(auto-fill, minmax(max(200px, calc((100% - 24px) / 4)), 1fr)); }
@media (max-width: 572px) { html[data-ig-density="compact"] .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html[data-ig-density="compact"] .cat-card {
  min-height: 0; display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto;
  column-gap: 12px; row-gap: 0; align-items: center; padding: 12px 52px 12px 12px; border-radius: var(--r-m);
}
html[data-ig-density="compact"] .cat-card .icon-box { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: var(--r-m); }
html[data-ig-density="compact"] .cat-card .icon-box .ms { font-size: var(--icon-m); }
html[data-ig-density="compact"] .cat-text { gap: 0; }
html[data-ig-density="compact"] .cat-card h3 { font-size: var(--fs-body); line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ig-density="compact"] .cat-card p { display: none; }
html[data-ig-density="compact"] .cat-foot .ms { display: none; }
/* compact tiles: just the icon and the name, centred against it (the arrow is hidden here) */
html[data-ig-density="compact"] .cat-foot { display: none; }
html[data-ig-density="compact"] .cat-text { grid-row: 1 / 3; grid-column: 2; }
html[data-ig-density="compact"] .cat-tile > .star-btn { top: 50%; right: 6px; transform: translateY(-50%); width: 36px; height: 36px; }
html[data-ig-density="compact"] .cat-tile.is-editing > .cat-card { padding-right: 12px; padding-top: 44px; }
html[data-ig-density="compact"] .cat-tile.is-editing h3 { padding-right: 0; }
html[data-ig-density="compact"] .cat-tile .res-edit-btns { top: 4px; right: 4px; }
html[data-ig-density="compact"] .cat-add { min-height: 64px; border-radius: var(--r-m); }
/* Resource tiles: three across, shorter */
@media (min-width: 512px) { html[data-ig-density="compact"] .resources.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 808px) { html[data-ig-density="compact"] .resources.cols-2 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
html[data-ig-density="compact"] .resources { gap: 8px; }
html[data-ig-density="compact"] .resource { padding: 12px 10px 10px 14px; gap: 4px; border-radius: var(--r-m); }
html[data-ig-density="compact"] .resource h3 { font-size: var(--fs-body); line-height: 20px; padding-right: 30px; }
html[data-ig-density="compact"] .resource.is-editing h3 { padding-right: calc(var(--btns, 2) * 34px); }
html[data-ig-density="compact"] .resource p { font-size: var(--fs-body-s); line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html[data-ig-density="compact"] .resource-foot { margin-top: 4px; min-height: 32px; }
html[data-ig-density="compact"] .resource-foot .btn { height: 32px; padding-inline: 10px 14px; font-size: var(--fs-body-s); }
html[data-ig-density="compact"] .resource .star-btn { top: 4px; right: 4px; width: 36px; height: 36px; }
html[data-ig-density="compact"] .resource .star-glyph { width: 20px; height: 20px; }
html[data-ig-density="compact"] .res-edit-btns { top: 4px; right: 4px; }
html[data-ig-density="compact"] .res-btn { width: 32px; height: 32px; }
html[data-ig-density="compact"] .res-btn .ms { font-size: var(--icon-s); }
html[data-ig-density="compact"] .res-add, html[data-ig-density="compact"] .drop-hint { min-height: 88px; }
html[data-ig-density="compact"] .area-body, html[data-ig-density="compact"] .res-sections { gap: 24px; }
html[data-ig-density="compact"] .res-section { gap: 10px; }
html[data-ig-density="compact"] .res-section-title { font-size: var(--fs-title-s); line-height: 24px; }
html[data-ig-density="compact"] .page-head h1 { font-size: var(--fs-headline); line-height: 36px; }
html[data-ig-density="compact"] .icon-box.lg { width: 52px; height: 52px; }
html[data-ig-density="compact"] .icon-box.lg .ms { font-size: var(--icon-l); }
/* Quick access: one line per link */
html[data-ig-density="compact"] .app-item { min-height: 44px; padding-block: 4px; padding-left: 14px; gap: 12px; }
html[data-ig-density="compact"] .app-icon { width: 32px; height: 32px; border-radius: var(--r-m); }
html[data-ig-density="compact"] .app-icon .app-glyph, html[data-ig-density="compact"] .app-icon .app-logo, html[data-ig-density="compact"] .app-icon .app-site { width: 18px; height: 18px; }
html[data-ig-density="compact"] .app-icon .app-ms { font-size: var(--icon-s); }
html[data-ig-density="compact"] .app-list:not(.is-editing) .app-desc { display: none; }
html[data-ig-density="compact"] .app-name { font-size: var(--fs-body-s); }
/* Other pages */
html[data-ig-density="compact"] .prio { padding: 16px; gap: 10px; }
html[data-ig-density="compact"] .user-head { min-height: 60px; padding-block: 8px; }
html[data-ig-density="compact"] .user-head .avatar.lg { width: 40px; height: 40px; font-size: var(--fs-body); }
html[data-ig-density="compact"] .notif { padding-block: 8px; }

/* Compact view in the rail: keep the smaller icons on the same centre line as the arrow button */
@media (min-width: 1101px) {
  html[data-ig-density="compact"][data-ig-drawer="collapsed"] .drawer .app-item { min-height: 48px; padding-left: 14px; }
}

/* Dragging: the item follows the pointer; a dashed outline (its own element, under the item) marks the
   slot it will drop into. The dragged item itself is solid, with a primary outline. */
.resource.is-dragging, .cat-tile.is-dragging, .res-section.is-dragging, .app-item.is-dragging, .qa-folder.is-dragging { cursor: grabbing; }
.has-drop-slot { position: relative; }
.drop-slot {
  position: absolute; z-index: 0; pointer-events: none; box-sizing: border-box;
  border: 2px dashed var(--md-outline);
  background: color-mix(in srgb, var(--md-primary) 6%, transparent);
}
.cat-tile.is-dragging > .cat-card { border-style: solid; border-color: transparent; }
.app-list .app-item.is-dragging, .qa-folder.is-dragging { border-radius: var(--r-l); }
/* Cards in a row share that row's height (the tallest card beside them, not the tallest on the page). A
   resource card's details stay at the top and its Open button and link type sit at the bottom. */
.resource > .resource-foot, html[data-ig-density="compact"] .resource > .resource-foot { margin-top: auto; padding-top: 4px; }

/* Category page: the sub-category grid; a missing category shows its message full width */
.cat-grid.is-missing { display: flex; flex-direction: column; gap: 16px; }

/* Narrow phones: the logo scales down with the screen so the menu button, logo and the three icons
   always stay on one line (the logo is 5.9 times as wide as it is tall) */
@media (max-width: 640px) {
  .brand { min-width: 0; flex-shrink: 1; }
  .brand img { height: clamp(14px, calc((100vw / var(--z) - 214px) / 5.9), 28px); }
}
@media (max-width: 400px) {
  .app-bar { padding-inline: 6px 10px; column-gap: 6px; }
  .app-bar .search-slot { padding: 0 6px 4px 10px; }
  .bar-actions { gap: 4px; }
}

/* Side panel folding: measuring the finished layout happens with animation off (html.ig-measure); while
   card heights glide (html.ig-cards-sizing) any text still re-wrapping stays inside its card */
html.ig-measure *, html.ig-measure *::before, html.ig-measure *::after { transition: none !important; }
html.ig-cards-sizing .cat-grid > *, html.ig-cards-sizing .resources > * { overflow: clip; }


/* Hover colours: every delete (trash) button, every edit (pencil) button and the side panel's
   collapse / expand arrow turn the same red on hover or keyboard focus */
[data-res-del]:hover, [data-sec-del]:hover, [data-tile-del]:hover, [data-qa-del-link]:hover, [data-qa-del-folder]:hover,
[data-res-edit]:hover, [data-sec-rename]:hover, [data-tile-edit]:hover, [data-qa-edit]:hover, [data-qa-edit-link]:hover, [data-qa-edit-folder]:hover,
[data-rail-toggle]:hover,
[data-res-del]:focus-visible, [data-sec-del]:focus-visible, [data-tile-del]:focus-visible, [data-qa-del-link]:focus-visible, [data-qa-del-folder]:focus-visible,
[data-res-edit]:focus-visible, [data-sec-rename]:focus-visible, [data-tile-edit]:focus-visible, [data-qa-edit]:focus-visible, [data-qa-edit-link]:focus-visible, [data-qa-edit-folder]:focus-visible,
[data-rail-toggle]:focus-visible { color: var(--tone-red); }

/* The selected theme and view options in the account menu use the same orange as the filled buttons (Edit
   categories, Edit page), in both themes */
.seg[aria-checked="true"] { background: var(--md-primary); color: var(--md-on-primary); }

/* A resource's Open button: a quiet grey (very light in light mode, very dark in dark mode) */
.resource .resource-foot .btn { background: var(--open-btn); color: var(--md-on-surface); }

/* Quick access edit mode: the row buttons' icons take the button's colour (they had their own grey from
   .nav-item .ms), so the red hover shows on the pencil and trash themselves */
.qa-row-btn .ms { color: inherit; }

/* Light mode: the Editing tools switch, when on, uses the same peach as the selected Dark/Light and
   Standard/Compact options */
:root[data-ig-theme="light"] [aria-checked="true"] > .switch { background: var(--md-secondary-container); }
:root[data-ig-theme="light"] [aria-checked="true"] > .switch::before { background: var(--md-on-secondary-container); }

/* Close (X) on the mobile side panel turns red on hover, like edit and delete */
.drawer-head [data-drawer-close]:hover, .drawer-head [data-drawer-close]:focus-visible { color: var(--tone-red); }
.drawer-head [data-drawer-close] .ms { color: inherit; }
/* Tiles being edited aren't links, so no arrow */
.cat-tile.is-editing .cat-foot > .ms { display: none; }

/* ---------- Resource link types ---------- */
.res-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.res-head h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.res-type { width: 40px; height: 40px; border-radius: var(--r-m); }
.res-type .ms { font-size: var(--icon-l); }
.res-type-label { font-size: var(--fs-label); line-height: 16px; letter-spacing: .03em; color: var(--md-on-surface-variant); text-align: right; }
html[data-ig-density="compact"] .res-head { gap: 10px; }
html[data-ig-density="compact"] .res-type { width: 32px; height: 32px; border-radius: var(--r-s); }
html[data-ig-density="compact"] .res-type .ms { font-size: var(--icon-s); }
.link-type { display: flex; align-items: center; gap: 10px; margin: -6px 0 0; font-size: var(--fs-label); line-height: 16px; color: var(--md-on-surface-variant); }
.link-type .icon-box { width: 28px; height: 28px; border-radius: var(--r-s); }
.link-type .icon-box .ms { font-size: var(--icon-xs); }

/* ---------- Home: Recently viewed ---------- */
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.recent-card {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 10px 12px 10px 10px; border-radius: var(--r-m);
  background: var(--md-surface-container); color: var(--md-on-surface); text-decoration: none;
  transition: background-color var(--dur-s) var(--ease-std);
}
.recent-card:hover { background: var(--md-surface-container-high); }
.recent-card[hidden] { display: none; }
.recent-card .icon-box { width: 40px; height: 40px; border-radius: var(--r-m); }
.recent-card .icon-box .ms { font-size: var(--icon-l); }
.recent-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recent-title { font-size: var(--fs-body); line-height: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: var(--fs-label); line-height: 16px; letter-spacing: .02em; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-ext { font-size: var(--icon-s); color: var(--md-on-surface-variant); flex: none; }
html[data-ig-density="compact"] .recent-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
html[data-ig-density="compact"] .recent-card { padding: 6px 10px 6px 6px; gap: 10px; border-radius: var(--r-m); }
html[data-ig-density="compact"] .recent-card .icon-box { width: 32px; height: 32px; border-radius: var(--r-s); }
html[data-ig-density="compact"] .recent-card .icon-box .ms { font-size: var(--icon-s); }
html[data-ig-density="compact"] .recent-title { font-size: var(--fs-body-s); }

/* ---------- Admin panel: tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--md-outline-variant); margin-top: -8px; overflow-x: auto; scrollbar-width: none; }
.tabs[hidden] { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 48px; padding: 0 16px; border: 0; background: transparent; cursor: pointer;
  color: var(--md-on-surface-variant); font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em;
  border-radius: var(--r-s) var(--r-s) 0 0;
}
.tab .ms { font-size: var(--icon-m); }
.tab:hover { color: var(--md-on-surface); background: var(--md-surface-container); }
.tab[aria-selected="true"] { color: var(--md-link); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--md-link); }
.admin[hidden] { display: none; }

/* ---------- Admin panel: change history ---------- */
.hist-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.hist-tools[hidden] { display: none; }
.hist-search { position: relative; flex: 1 1 260px; max-width: 480px; }
.hist-search .ms { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: var(--icon-m); color: var(--md-on-surface-variant); pointer-events: none; }
.hist-search input, .hist-person select {
  width: 100%; height: 48px; border: 1px solid var(--md-outline); border-radius: var(--r-full);
  background: transparent; color: var(--md-on-surface); font: 400 var(--fs-body)/24px var(--font);
}
.hist-search input { padding: 0 16px 0 42px; }
.hist-person { flex: 0 1 220px; }
.hist-person select { padding: 0 14px; }
.hist-person select option { background: var(--md-surface-container); color: var(--md-on-surface); }
.hist-search input:focus, .hist-person select:focus { outline: none; border: 2px solid var(--md-primary); }
.hist-search input:focus { padding-left: 41px; }
.hist-list { display: flex; flex-direction: column; gap: 8px; outline: none; }
.hist-day { margin: 12px 4px 0; font-size: var(--fs-body-s); line-height: 20px; font-weight: 700; color: var(--md-on-surface-variant); }
.hist-list > .hist-day:first-child { margin-top: 0; }
.hist-group { display: flex; flex-direction: column; gap: 8px; }
.hist-entry { padding: 14px 16px 10px; border-radius: var(--r-l); background: var(--md-surface-container); }
.hist-entry.is-restore { box-shadow: inset 3px 0 0 var(--md-link); }
.hist-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.hist-head .avatar { margin-top: 2px; }
.hist-who { flex: 1 1 240px; min-width: 0; }
.hist-title { margin: 0; font-size: var(--fs-body); line-height: 24px; }
.hist-meta { margin: 0; font-size: var(--fs-label); line-height: 16px; letter-spacing: .02em; color: var(--md-on-surface-variant); }
.hist-all { height: 36px; margin: -2px -4px 0 auto; }
.hist-changes { list-style: none; margin: 8px 0 0 44px; padding: 0; display: flex; flex-direction: column; }
.hist-change { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 2px 0; font-size: var(--fs-body-s); line-height: 20px; }
.hist-change > .ms { font-size: var(--icon-s); color: var(--md-on-surface-variant); flex: none; }
.hist-change.op-add > .ms { color: var(--tone-green); }
.hist-change.op-delete > .ms { color: var(--tone-red); }
.hist-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hist-link { color: var(--md-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.hist-link:hover { text-decoration-thickness: 2px; }
.hist-act { height: 32px; flex: none; }
.hist-state { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: var(--fs-label); line-height: 16px; letter-spacing: .02em; color: var(--md-on-surface-variant); }
.hist-state .ms { font-size: var(--icon-xs); }
.hist-more { height: 32px; margin: 2px 0 0 36px; }
.hist-none { margin: 0; padding: 8px 4px; color: var(--md-on-surface-variant); font-size: var(--fs-body-s); }
@media (max-width: 640px) {
  .hist-changes { margin-left: 0; }
  .hist-more { margin-left: -8px; }
  .hist-all { margin-left: 32px; }
  .hist-change { flex-wrap: wrap; column-gap: 10px; }
  .hist-text { flex: 1 1 calc(100% - 40px); }
  .hist-act { margin: -4px 0 2px 20px; }
  .hist-state { margin: 0 0 4px 28px; }
}

/* Line icons (Xero, XPM) used as a resource's link type, wherever the type icon shows */
.type-glyph { display: block; width: 22px; height: 22px; flex: none; }
.search-results .type-glyph { width: 24px; height: 24px; color: var(--md-on-surface-variant); }
.link-type .type-glyph { width: 17px; height: 17px; }
html[data-ig-density="compact"] .res-type .type-glyph { width: 18px; height: 18px; }

/* ---------- Category and sub-category pages: sub-categories and resources ---------- */
.node-part { display: flex; flex-direction: column; gap: 16px; }
.node-part[hidden], [data-node-empty][hidden], .node-part [data-part-head][hidden] { display: none; }
/* With the "Sub-categories" and "Resources" headings showing, section names sit one level below them */
.node-part:has(> [data-part-head]:not([hidden])) .res-section-title { font-size: var(--fs-title-s); line-height: 24px; font-weight: 700; }
html[data-ig-density="compact"] .node-part:has(> [data-part-head]:not([hidden])) .res-section-title { font-size: var(--fs-body); line-height: 22px; }

/* A tile's summary stays to three lines however much is inside */
.cat-text p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Resource custom fields ---------- */
.res-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; margin: 2px 0 0; }
.res-fields .rf { min-width: 0; }
.res-fields .rf-wide { grid-column: 1 / -1; }
.res-fields dt { font-size: var(--fs-label); line-height: 16px; letter-spacing: .04em; text-transform: uppercase; color: var(--md-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-fields dd { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface); overflow-wrap: anywhere; }
.rf-user { display: inline-flex; align-items: center; gap: 6px; }
.avatar.xs { width: 20px; height: 20px; font-size: var(--fs-label); }
.rf-link { display: inline-flex; align-items: center; gap: 2px; color: var(--md-link); font-weight: 700; text-decoration: none; }
.rf-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.rf-link .ms { font-size: var(--icon-xs); }
.rf-more summary { cursor: pointer; color: var(--md-on-surface); }
.rf-more summary::marker { color: var(--md-link); }
.rf-more[open] summary { color: var(--md-on-surface-variant); margin-bottom: 4px; }
.rf-more p { margin: 0 0 6px; white-space: pre-wrap; }
html[data-ig-density="compact"] .res-fields { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px 12px; }
html[data-ig-density="compact"] .res-fields dd { font-size: var(--fs-label); line-height: 16px; }

/* ---------- Page and section notes ---------- */
.notes { font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.notes p { margin: 0 0 6px; overflow-wrap: anywhere; }
.notes p:last-child { margin-bottom: 0; }
.notes a { color: var(--md-link); }
/* The page's guidance: a grey box with an information icon on the left */
.page-notes { max-width: 900px; padding: 12px 16px 12px 14px; border-radius: var(--r-m); background: var(--md-surface-container);
  display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 12px; align-items: start; }
.page-notes .notes-icon { font-size: var(--icon-m); line-height: 20px; color: var(--md-on-surface-variant); font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.page-notes .notes-body > p { margin: 0 0 6px; }
.page-notes .notes-body > p:last-child { margin-bottom: 0; }
.page-notes[hidden] { display: none; }
.sec-notes { max-width: 900px; margin: -4px 0 12px; }

/* ---------- Dialog: text areas and the field editor ---------- */
.field textarea, .field-row textarea {
  min-height: 48px; padding: 12px 14px; border: 1px solid var(--md-outline); border-radius: var(--r-xs); resize: vertical;
  background: transparent; color: var(--md-on-surface); font: 400 var(--fs-body)/24px var(--font); letter-spacing: .01em;
}
.field textarea:focus, .field-row textarea:focus { outline: none; border: 2px solid var(--md-primary); padding: 11px 13px; }
.fields-editor { border: 0; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fields-editor legend { padding: 0; margin-bottom: 2px; font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .02em; color: var(--md-on-surface-variant); }
.fields-editor legend em { font-style: normal; font-weight: 400; }
.fields-editor .dlg-hint { margin: 0; }
.fields-editor > .btn { align-self: flex-start; }
.field-rows { display: flex; flex-direction: column; gap: 8px; }
.field-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 104px minmax(0, 1.4fr) 40px; gap: 6px; align-items: start; }
.field-row input, .field-row select {
  height: 48px; min-width: 0; padding: 0 12px; border: 1px solid var(--md-outline); border-radius: var(--r-xs);
  background: transparent; color: var(--md-on-surface); font: 400 var(--fs-body)/24px var(--font);
}
.field-row textarea { min-height: 48px; padding: 11px 12px; font-size: var(--fs-body); line-height: 24px; }
.field-row select option { background: var(--md-surface-container-high); color: var(--md-on-surface); }
.field-row input:focus, .field-row select:focus { outline: none; border: 2px solid var(--md-primary); padding: 0 9px; }
.field-row .fv-slot { min-width: 0; display: flex; }
.field-row .fv-slot > * { flex: 1; width: 100%; }
.field-row .field-del { width: 40px; height: 40px; margin-top: 2px; color: var(--md-on-surface-variant); }
.field-row .field-del:hover { color: var(--tone-red); }
.field-row .field-error { grid-column: 2 / -1; margin: 0; }
@media (max-width: 520px) {
  .field-row { grid-template-columns: 24px minmax(0, 1fr) 96px 40px; }
  .field-row .fv-slot { grid-column: 2 / 4; grid-row: 2; }
}

/* ---------- Design polish ---------- */
/* Section headings line up with the cards under them */
.section-head { padding-inline: 0; }
/* Breadcrumbs: an arrow stays with the name after it when the trail wraps */
.crumbs .crumb { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
/* The page's guidance runs the full width, like the cards below it; the text inside keeps a readable length */
.page-notes { max-width: none; }
.page-notes .notes-body > p { max-width: 110ch; }
.sec-notes { max-width: 110ch; }
/* Stars and edit buttons sit level with the title row */
.resource > .star-btn { top: 20px; right: 12px; }
.resource > .res-edit-btns { top: 22px; right: 12px; }
.cat-tile > .star-btn { top: 24px; right: 14px; }
html[data-ig-density="compact"] .resource > .star-btn { top: 10px; right: 6px; }
html[data-ig-density="compact"] .resource > .res-edit-btns { top: 10px; right: 6px; }
/* Resource cards: a little tighter, and "Link pending" is the same height as Open */
.resource .pending { height: 40px; padding-inline: 12px 16px; border-radius: var(--r-full); }
html[data-ig-density="compact"] .resource .pending { height: 32px; }
/* Edit mode: "Add" boxes are no bigger than they need to be */
.res-add, .drop-hint { min-height: 88px; }
/* (the Add box still grows to match tiles in the same row) */
.cat-add { min-height: 88px; }
/* Phones: the page icon sits beside the title instead of on its own line */
@media (max-width: 640px) {
  .page-head { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px 14px; }
  .page-head > .icon-box.lg { width: 48px; height: 48px; border-radius: var(--r-m); }
  .page-head > .icon-box.lg .ms { font-size: var(--icon-xl); }
  .page-head h1 { font-size: var(--fs-headline-s); line-height: 32px; }
  .page-head p { font-size: var(--fs-body-s); line-height: 20px; margin-top: 2px; }
  .page-head-actions { grid-column: 1 / -1; }
}

/* ---------- Guidance text: edit mode ---------- */
/* Edit and delete sit in the top right of the guidance box */
.notes.has-tools { position: relative; }
.page-notes.has-tools { padding-right: 96px; }
.sec-notes.has-tools { min-height: 48px; padding: 13px 88px 13px 14px; border: 1.5px dashed var(--md-outline); border-radius: var(--r-m); max-width: none; }
.sec-notes.has-tools > p { max-width: 110ch; }
.note-tools { position: absolute; top: 5px; right: 6px; display: flex; gap: 2px; }
/* "Add guidance text": a slim dashed button where the guidance would show */
.page-notes-add[hidden] { display: none; }
.note-add {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 8px 16px;
  border: 1.5px dashed var(--md-outline); border-radius: var(--r-m); background: transparent; cursor: pointer;
  color: var(--md-link); font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em;
}
.note-add .ms { font-size: var(--icon-m); }
.note-add:hover { background: color-mix(in srgb, var(--md-primary) 6%, transparent); }
.res-section .note-add { width: auto; align-self: flex-start; min-height: 36px; padding: 6px 14px 6px 10px; border-radius: var(--r-full); margin: -4px 0 2px; }
[data-note-edit]:hover, [data-note-del]:hover, [data-note-edit]:focus-visible, [data-note-del]:focus-visible { color: var(--tone-red); }
html[data-ig-density="compact"] .res-add, html[data-ig-density="compact"] .drop-hint, html[data-ig-density="compact"] .cat-add { min-height: 64px; }

/* ---------- Person fields with several people ---------- */
.rf-users { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.people-pick {
  flex: 1; min-width: 0; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 5px 6px;
  border: 1px solid var(--md-outline); border-radius: var(--r-xs); cursor: text;
}
.people-pick:focus-within { border: 2px solid var(--md-primary); padding: 4px 5px; }
.field-row .people-pick > [data-pp-in] {
  flex: 1 1 90px; min-width: 90px; height: 32px; padding: 0 4px; border: 0; background: transparent;
}
.field-row .people-pick > [data-pp-in]:focus { border: 0; padding: 0 4px; outline: none; }
.pp-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 2px 0 4px; border-radius: var(--r-full);
  background: var(--md-surface-container-high); color: var(--md-on-surface); font-size: var(--fs-label); line-height: 20px; max-width: 100%;
}
.pp-del { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--md-on-surface-variant); cursor: pointer; }
.pp-del .ms { font-size: var(--icon-xs); }
.pp-del:hover, .pp-del:focus-visible { color: var(--tone-red); background: color-mix(in srgb, var(--tone-red) 12%, transparent); }

/* ---------- Resource dialog: reordering fields ---------- */
#res-dialog { width: min(560px, calc(calc(100vw / var(--z)) - 32px)); }
.field-row { position: relative; border-radius: var(--r-s); }
.field-handle {
  width: 24px; height: 44px; padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--md-on-surface-variant); cursor: grab; touch-action: none;
}
.field-handle:hover { color: var(--md-on-surface); background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.field-handle .ms { font-size: var(--icon-m); }
.field-rows.is-sorting, .field-rows.is-sorting .field-handle { cursor: grabbing; }
.field-row.is-dragging { z-index: 2; background: var(--md-surface-container-highest, var(--md-surface-container-high)); box-shadow: 0 0 0 1px var(--md-primary), 0 6px 18px var(--panel-shadow); cursor: grabbing; }
.field-rows > .drop-slot { border-radius: var(--r-s); }

/* ---------- Date fields: typed date plus the site's own calendar ---------- */
.date-pick {
  flex: 1; min-width: 0; height: 44px; display: flex; align-items: center;
  border: 1px solid var(--md-outline); border-radius: var(--r-xs);
}
.date-pick:focus-within { border: 2px solid var(--md-primary); }
.date-pick.is-bad { border-color: var(--tone-red); }
.field-row .date-pick > [data-dp-in] { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0 4px 0 10px; background: transparent; }
.field-row .date-pick:focus-within > [data-dp-in] { padding-left: 9px; }
.field-row .date-pick > [data-dp-in]:focus { border: 0; outline: none; }
.dp-open { width: 38px; height: 38px; margin-right: 2px; flex: none; color: var(--md-on-surface-variant); }
.dp-open .ms { font-size: var(--icon-m); }
.dp-open:hover, .dp-open[aria-expanded="true"] { color: var(--md-primary); }

.date-pop {
  position: absolute; z-index: 5; width: 296px; padding: 10px 12px 6px; box-sizing: border-box;
  border-radius: var(--r-l); background: var(--md-surface-container-highest);
  box-shadow: 0 10px 30px var(--panel-shadow), 0 0 0 1px color-mix(in srgb, var(--md-outline) 40%, transparent);
  animation: panel-in var(--dur-s) var(--ease-emph); transform-origin: top right;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dp-title { font-size: var(--fs-body); line-height: 20px; font-weight: 700; color: var(--md-on-surface); }
.dp-nav { width: 36px; height: 36px; color: var(--md-on-surface-variant); }
.dp-nav .ms { font-size: var(--icon-l); }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); justify-items: center; }
.dp-week span { width: 36px; font-size: var(--fs-label); line-height: 28px; font-weight: 700; text-align: center; color: var(--md-on-surface-variant); }
.dp-day {
  width: 36px; height: 36px; margin: 1px 0; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--md-on-surface); font: 400 var(--fs-body-s)/20px var(--font);
}
.dp-day:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.dp-day:focus-visible { outline: 2px solid var(--md-primary); outline-offset: -2px; }
.dp-day.is-other { color: color-mix(in srgb, var(--md-on-surface-variant) 60%, transparent); }
.dp-day.is-today { box-shadow: inset 0 0 0 1.5px var(--md-primary); color: var(--md-primary); font-weight: 700; }
.dp-day.is-sel, .dp-day.is-sel:hover { background: var(--md-primary); color: var(--md-on-primary); box-shadow: none; font-weight: 700; }
:root[data-ig-theme="light"] .dp-day.is-sel, :root[data-ig-theme="light"] .dp-day.is-sel:hover { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.dp-foot { display: flex; justify-content: space-between; margin-top: 2px; }
.dp-foot .btn { height: 36px; }

/* ---------- Dialog text boxes and Person fields: same height as the boxes beside them ---------- */
.dlg textarea { resize: none; overflow-y: auto; }
.field-row textarea { height: 44px; max-height: 140px; }
.field-row textarea:focus { padding: 9px; }
#rd-desc { min-height: 72px; max-height: 160px; }
#gd-text { min-height: 168px; max-height: calc(50vh / var(--z)); }
/* A Person box is 44px high like the name and type boxes beside it; it only grows a line when more
   people are picked than fit on one */
.people-pick { height: auto; min-height: 44px; flex-wrap: wrap; overflow: visible; padding: 7px 6px; row-gap: 4px; }
.people-pick:focus-within { padding: 6px 5px; }
.pp-chip { flex: none; height: 28px; white-space: nowrap; }
/* The typing spot takes no room until it's used, so a few people still fit on one line */
.field-row .people-pick > [data-pp-in] { flex: 1 1 0; min-width: 0; height: 28px; padding: 0; }
.field-row .people-pick > [data-pp-in]:focus, .field-row .people-pick > [data-pp-in]:not([placeholder=""]) { padding: 0 4px; }
.field-row .people-pick > [data-pp-in]:not([placeholder=""]), .field-row .people-pick > [data-pp-in]:focus { min-width: 96px; }
.pp-chip { gap: 2px; padding: 0 2px 0 10px; font-size: var(--fs-label); background: var(--md-surface-container-highest); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-outline) 45%, transparent); }
.pp-chip .avatar.xs { width: 20px; height: 20px; }
.pp-del { width: 22px; height: 22px; }
.pp-del .ms { font-size: var(--icon-xs); }
/* Wider dialog, with more room for the value than the name */
#res-dialog { width: min(640px, calc(calc(100vw / var(--z)) - 32px)); }
.field-row { grid-template-columns: 24px minmax(0, 1fr) 104px minmax(0, 1.8fr) 40px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 24px minmax(0, 1fr) 96px 40px; } }

/* ---------- Live data ---------- */
/* A field with nothing in it yet */
.rf-empty { color: var(--md-on-surface-variant); }
/* "Saving…" on Save changes */
.btn .ms.spin { animation: ig-spin 900ms linear infinite; }
@keyframes ig-spin { to { transform: rotate(360deg); } }
.btn[aria-busy="true"] { cursor: progress; }
/* Admin: what new people start with */
.start-perms { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px 0;
  padding: 16px 20px; border-radius: var(--r-l); background: var(--md-surface-container); margin: 0 0 16px; }
.start-perms > :nth-child(n+3) { padding-top: 16px; border-top: 1px solid var(--md-outline-variant); }
.start-perms > :nth-child(even) { padding-left: 24px; align-self: stretch; align-items: center; }
@media (max-width: 640px) {
  .start-perms { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .start-perms > :nth-child(n+3) { padding-top: 0; border-top: 0; }
  .start-perms > :nth-child(even) { padding-left: 0; }
  .start-perms > :nth-child(3) { padding-top: 16px; border-top: 1px solid var(--md-outline-variant); }
}
.start-perms h2 { margin: 0 0 2px; font-size: var(--fs-body); line-height: 24px; font-weight: 700; }
.start-perms p { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.seg-row { display: flex; flex-wrap: wrap; gap: 8px; }
/* Admin: someone whose access is turned off */
.user-card.is-off .user-name, .user-card.is-off .avatar { opacity: .6; }
.role-chip.role-off { background: color-mix(in srgb, var(--tone-red) 16%, transparent); color: var(--tone-red); }
/* The page couldn't load */
.boot-error { margin-top: 24px; }

/* ---------- Shared components (design consistency pass, 30 Oct 2026) ----------
   One style for each kind of thing; later in the file, so these win over the older one-off rules. */

/* Label: every small label (side panel groups, resource field names, permission groups, Quick set, dialog
   fields, pickers, account menu sections). Sentence case, never capitals. */
.label, .qa-group-title, .res-fields dt, .perm-group legend, .perm-presets-label, .field, .picker legend,
.fields-editor legend, .acct-section h3 {
  font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .03em;
  text-transform: none; color: var(--md-on-surface-variant);
}

/* Info box: every explanatory box (page and section guidance, admin and history notes, the sign-in note).
   Full width, text kept to a readable line length, a filled information icon. */
.admin-note, .login-note {
  display: flex; gap: 12px; margin: 0; padding: 12px 16px; max-width: none; border-radius: var(--r-m);
  font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant);
}
.admin-note { background: var(--md-surface-container); }
.login-note { background: var(--md-surface-container-high); }   /* it sits on the sign-in card */
.page-notes { padding: 12px 16px; grid-template-columns: var(--icon-m) minmax(0, 1fr); column-gap: 12px; }
.admin-note > .ms, .login-note > .ms, .page-notes .notes-icon {
  font-size: var(--icon-m); line-height: 20px; color: var(--md-on-surface-variant);
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}
.admin-note > span, .login-note > span { max-width: 110ch; }

/* Empty states line up with the cards around them */
.empty { padding: 20px; }

/* Pick one in the admin panel (New people, Quick set): separate rounded chips with icons; the chosen one is
   filled and shows a tick */
.chip-set { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: var(--btn-h-s); padding-inline: 10px 14px; border-radius: var(--r-s);
  border: 1px solid var(--md-outline-variant); background: transparent; color: var(--md-on-surface);
  font: 700 var(--fs-body-s)/20px var(--font); letter-spacing: .02em; cursor: pointer;
}
.chip-btn .ms { font-size: var(--icon-s); color: var(--md-on-surface-variant); }
.chip-btn[aria-checked="true"] { background: var(--md-secondary-container); color: var(--md-on-secondary-container); border-color: transparent; }
.chip-btn[aria-checked="true"] .ms { color: inherit; }
.chip-btn:disabled { cursor: default; }
.chip-btn:disabled:not([aria-checked="true"]) { opacity: .45; }

/* Breadcrumbs on phones: just the way back to the page above ("← Job WorkFlow Management"), so a long trail
   never wraps with an arrow starting the second line */
@media (max-width: 640px) {
  .crumbs > :not(:nth-last-child(2)) { display: none; }
  .crumbs > :nth-last-child(2) { display: inline-flex; align-items: center; gap: 4px; }
  .crumbs > :nth-last-child(2) > .ms { display: none; }
  .crumbs > :nth-last-child(2)::before {
    content: "arrow_back"; font-family: "Material Symbols Rounded"; font-size: var(--icon-s); line-height: 1;
    -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; color: var(--md-link);
  }
}

/* Dropdown (assets/ignite.js, "Dropdowns"): every list on the site. A box like the other inputs; the list opens
   in a panel like the account and notification menus. The real <select> stays underneath, hidden. */
.dd { position: relative; min-width: 0; }
.dd-native { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.dd-btn {
  width: 100%; height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px;
  border: 1px solid var(--md-outline); border-radius: var(--r-xs); background: transparent; color: var(--md-on-surface);
  font: 400 var(--fs-body)/24px var(--font); letter-spacing: .01em; text-align: left; cursor: pointer;
}
.dd-btn:hover { border-color: var(--md-on-surface); }
.dd-btn:focus-visible, .dd.is-open .dd-btn { outline: none; border: 2px solid var(--md-primary); padding: 0 9px 0 13px; }
.dd-btn:disabled { cursor: default; opacity: .6; }
.dd-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-chev { font-size: var(--icon-m); color: var(--md-on-surface-variant); transition: transform var(--dur-s) var(--ease-std); }
.dd.is-open .dd-chev { transform: rotate(180deg); }
.dd-list {
  position: fixed; z-index: 200; margin: 0; padding: 6px; list-style: none; max-height: 296px; overflow-y: auto;
  border-radius: var(--r-m); border: 1px solid var(--md-outline-variant); background: var(--md-surface-container-high);
  box-shadow: 0 6px 16px var(--panel-shadow), 0 1px 2px var(--panel-shadow); outline: none;
}
.dd-list[hidden] { display: none; }
.dd-opt {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 14px 8px 10px; border-radius: var(--r-s);
  font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface); cursor: pointer; white-space: nowrap;
}
.dd-opt .ms { font-size: var(--icon-s); color: var(--md-primary); visibility: hidden; }
.dd-opt[aria-selected="true"] { font-weight: 700; }
.dd-opt[aria-selected="true"] .ms { visibility: visible; }
.dd-opt.is-active { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
/* in the change history's toolbar it's round like the search box beside it */
.hist-person .dd-btn { border-radius: var(--r-full); padding: 0 12px 0 16px; }
.hist-person .dd-btn:focus-visible, .hist-person .dd.is-open .dd-btn { padding: 0 11px 0 15px; }

/* Outside the compact list the fields' wrapper is invisible to layout */
.res-more, .res-more-in { display: contents; }
/* Compact view: a section's resources as a list (one tinted block, thin lines between rows) instead of cards.
   Only a row with more to show (.can-open: fields, or a description cut off) can open: on hover it gets the
   hover tint and its chevron shows. Clicking it slides it open to show the whole description and the fields
   (.is-open; one row at a time), and again shuts it. A row opened by its link starts open, and one opens when a
   link in its fields has keyboard focus. Edit mode keeps the cards. */
.resource > .res-chev, .res-count { display: none; }
.res-sub { display: contents; }
html[data-ig-density="compact"] .res-list { display: flex; flex-direction: column; gap: 0; padding: 4px; border-radius: var(--r-l); background: var(--md-surface-container); }
html[data-ig-density="compact"] .res-list .resource {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "icon name foot star chev" "icon desc foot star chev" ". more more more more";
  align-items: center; column-gap: 12px; row-gap: 0;
  padding: 8px 4px 8px 12px; border: 0; border-radius: var(--r-m); background: transparent;
  transition: background-color var(--dur-s) var(--ease-std);
}
html[data-ig-density="compact"] .res-list .resource + .resource::before {
  content: ""; position: absolute; top: 0; left: 12px; right: 12px; border-top: 1px solid var(--md-outline-variant);
}
html[data-ig-density="compact"] .res-list .resource.can-open { cursor: pointer; }
html[data-ig-density="compact"] .res-list .resource:is(.can-open:hover, .is-open) { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }
html[data-ig-density="compact"] .res-list .resource:is(.can-open:hover, .is-open)::before,
html[data-ig-density="compact"] .res-list .resource:is(.can-open:hover, .is-open) + .resource::before { opacity: 0; }
html[data-ig-density="compact"] .res-list .resource.is-target { animation: row-pulse 1.2s var(--ease-emph) 1; }
@keyframes row-pulse { 0% { background: var(--md-primary-container); } 100% { background: transparent; } }
html[data-ig-density="compact"] .res-list .res-head { display: contents; }
html[data-ig-density="compact"] .res-list .res-type { grid-area: icon; align-self: start; margin-top: 4px; }
html[data-ig-density="compact"] .res-list .resource h3 { grid-area: name; align-self: end; padding-right: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ig-density="compact"] .res-list .resource:not(:has(> .res-sub)) h3 { grid-row: 1 / 3; align-self: center; }
/* one line, sliding to its full height (--desc-h, measured by ignite.js) when the row opens; .is-closing keeps
   it unclamped while it slides back, so the cut-off line only comes back once it's one line high again */
/* the line under the name: the description, then how many details the row opens to ("6 details"), so a row
   that opens says so without hovering. A description too long for the line fades out at the end. */
html[data-ig-density="compact"] .res-list .res-sub { grid-area: desc; display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
html[data-ig-density="compact"] .res-list .res-count { display: block; flex: none; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
html[data-ig-density="compact"] .res-list .res-desc + .res-count::before { content: "· "; }
html[data-ig-density="compact"] .res-list .res-desc { flex: 0 1 auto; min-width: 0; display: block; -webkit-line-clamp: unset; white-space: nowrap; max-height: 20px; transition: max-height var(--dur-m) var(--ease-std); }
html[data-ig-density="compact"] .res-list .resource:not(.is-open, .is-target, .is-closing) .res-desc.is-cut {
  -webkit-mask-image: linear-gradient(to right, var(--md-on-surface) calc(100% - 56px), transparent);
  mask-image: linear-gradient(to right, var(--md-on-surface) calc(100% - 56px), transparent);
}
html[data-ig-density="compact"] .res-list .resource.is-measuring .res-desc { white-space: normal; max-height: none; transition: none; }
html[data-ig-density="compact"] .res-list .res-more {
  grid-area: more; display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows var(--dur-m) var(--ease-std), opacity var(--dur-m) var(--ease-std);
}
html[data-ig-density="compact"] .res-list .res-more-in { display: block; min-height: 0; overflow: hidden; }
html[data-ig-density="compact"] .res-list .res-fields { margin: 8px 0 4px; }
/* the link type, Open, the star and the chevron stay beside the name (a 40px band at the top) as the row opens */
html[data-ig-density="compact"] .res-list .resource > .resource-foot { grid-area: foot; align-self: start; margin: 0; padding: 0; min-height: 40px; justify-content: flex-end; gap: 12px; }
html[data-ig-density="compact"] .res-list .res-type-label { width: 88px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* in the row's grid, not pinned to the corner; it keeps its own box so its hover circle stays round */
html[data-ig-density="compact"] .res-list .resource > .star-btn { grid-area: star; align-self: start; margin-top: 2px; position: relative; inset: auto; }
/* the chevron: room kept on every row so the columns line up; seen on an openable row's hover, or while open */
html[data-ig-density="compact"] .res-list .resource > .res-chev { display: inline-grid; grid-area: chev; align-self: start; margin-top: 2px; visibility: hidden; opacity: 0; transition: opacity var(--dur-s) var(--ease-std); }
html[data-ig-density="compact"] .res-list .resource:is(.can-open, .is-target) > .res-chev { visibility: visible; }
html[data-ig-density="compact"] .res-list .resource:is(.can-open:hover, .is-open, .is-target) > .res-chev,
html[data-ig-density="compact"] .res-list .resource > .res-chev:focus-visible { opacity: 1; }
html[data-ig-density="compact"] .res-list .res-chev .ms { transition: transform var(--dur-m) var(--ease-std); }
html[data-ig-density="compact"] .res-list .resource:is(.is-open, .is-target) > .res-chev .ms { transform: rotate(180deg); }
/* open */
html[data-ig-density="compact"] .res-list .resource:is(.is-open, .is-target, :has(.res-more :focus-visible)) h3 { white-space: normal; }
html[data-ig-density="compact"] .res-list .resource:is(.is-open, .is-target, .is-closing, :has(.res-more :focus-visible)) .res-desc { white-space: normal; }
html[data-ig-density="compact"] .res-list .resource:is(.is-open, .is-target) .res-count { display: none; }
html[data-ig-density="compact"] .res-list .resource:is(.is-open, .is-target, :has(.res-more :focus-visible)) .res-desc { max-height: var(--desc-h, 480px); }
html[data-ig-density="compact"] .res-list .resource:is(.is-open, .is-target, :has(.res-more :focus-visible)) .res-more { grid-template-rows: 1fr; opacity: 1; }
/* phones: the link type and the word "Open" give way to the name (the button keeps its hidden full name) */
@media (max-width: 600px) {
  html[data-ig-density="compact"] .res-list .res-type-label { display: none; }
  html[data-ig-density="compact"] .res-list .resource-foot .btn { width: var(--btn-h); padding: 0; justify-content: center; }
  html[data-ig-density="compact"] .res-list .resource-foot .btn-word { display: none; }
}

/* ---------- Settings page ---------- */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 920px; }
.set-card { display: flex; flex-direction: column; padding: 4px 20px; border-radius: var(--r-l); background: var(--md-surface-container); }
.set-card h2 { margin: 14px 0 2px; font-size: var(--fs-label); line-height: 16px; font-weight: 700; letter-spacing: .03em; color: var(--md-on-surface-variant); }
.set-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 14px 0; }
.set-row + .set-row { border-top: 1px solid var(--md-outline-variant); }
.set-ic { flex: none; display: grid; place-items: center; width: 24px; color: var(--md-on-surface-variant); }
.set-ic .ms { font-size: var(--icon-l); }
.set-text { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.set-text h3, .set-title { margin: 0; font-size: var(--fs-body); line-height: 24px; font-weight: 700; }
.set-text p, .set-meta { margin: 0; font-size: var(--fs-body-s); line-height: 20px; color: var(--md-on-surface-variant); }
.set-control { flex: 0 1 360px; min-width: 0; }
.set-control .segmented { width: 100%; }
.set-switch { width: 100%; flex-wrap: nowrap; border: 0; border-radius: 0; background: transparent; color: var(--md-on-surface); font: inherit; text-align: left; cursor: pointer; }
.set-switch:hover .set-title { color: var(--md-link); }
@media (max-width: 640px) {
  .set-control { flex-basis: 100%; }
  .set-card { padding-inline: 16px; }
}

/* ---------- Neo-brutalist style ----------
   Tokens at the top (:root[data-ig-style="brutal"]). Surfaces get an outline and a solid shadow; things you
   click lift a little on hover and press flat when clicked. Edit mode keeps its dashed outlines. */
html[data-ig-style="brutal"] .app-bar { border-bottom: var(--nb-w) solid var(--nb-ink); }
html[data-ig-style="brutal"] .drawer { border-right: var(--nb-w) solid var(--nb-ink); }
html[data-ig-style="brutal"] .brand-divider { width: var(--nb-w); background: var(--nb-ink); }
html[data-ig-style="brutal"] :is(.page-head h1, .greet h1, .home-head h1) { font-weight: 700; letter-spacing: -.02em; }
html[data-ig-style="brutal"] :is(.section-head h2, .res-section-title) { font-weight: 700; letter-spacing: -.01em; }
html[data-ig-style="brutal"] .home-head .greet::after { height: 6px; width: 64px; border: var(--nb-w) solid var(--nb-ink); }

/* surfaces */
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing) > .cat-card, .resource:not(.is-editing), .panel-card, .set-card, .empty,
  .prio, .user-card, .recent-card, .login-card, .admin-note) {
  border: var(--nb-w) solid var(--nb-ink); box-shadow: var(--nb-shadow);
}
/* Cards press like a button (hover: a quarter of the way onto the shadow; click: all the way, the shadow gone).
   The card moves exactly as far as its shadow shrinks, so the shadow's outer edge stays put. A tile's favourite
   star sits on top of its card, so it moves with it; hovering the star counts as hovering the tile. Movement uses
   the translate property, which adds to the star's own transform (centred in compact view). Selectors match the
   surface rule above so these win over its box-shadow. */
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing) > :is(a.cat-card, .star-btn), a.recent-card, .recent-card) {
  --nb-press: 4px;
  transition: translate .18s var(--ease-press), box-shadow .18s var(--ease-press), background-color .18s ease, color var(--dur-s) var(--ease-std);
}
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing) > a.cat-card, a.recent-card, .recent-card) {
  box-shadow: var(--nb-press) var(--nb-press) 0 var(--nb-ink);
  will-change: translate;
}
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing):hover > :is(a.cat-card, .star-btn), .recent-card:hover) {
  translate: calc(var(--nb-press) / 4) calc(var(--nb-press) / 4);
}
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing):hover > a.cat-card, .recent-card:hover) {
  box-shadow: calc(var(--nb-press) * 3 / 4) calc(var(--nb-press) * 3 / 4) 0 var(--nb-ink);
}
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing):hover > a.cat-card, .recent-card:hover)[class*="hue-"] {
  background: color-mix(in srgb, var(--card-hue) 93%, var(--nb-ink));
}
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing):has(> a.cat-card:active) > :is(a.cat-card, .star-btn), .recent-card:active) {
  translate: var(--nb-press) var(--nb-press);
}
html[data-ig-style="brutal"] :is(.cat-tile:not(.is-editing) > a.cat-card:active, .recent-card:active) {
  box-shadow: 0 0 0 var(--nb-ink);
}
html[data-ig-style="brutal"] :is(.cat-card, .resource) .icon-box { border: var(--nb-w) solid var(--on-solid); }
html[data-ig-style="brutal"] .icon-box.lg { border: var(--nb-w) solid var(--nb-ink); box-shadow: var(--nb-shadow-s); }
html[data-ig-style="brutal"] .app-icon:not(.is-plain) { border: var(--nb-w) solid var(--nb-ink); }
html[data-ig-style="brutal"] :is(.avatar, .news-tag, .recent-ic) { border: var(--nb-w) solid var(--nb-ink); }

/* buttons: the same press as the cards (4px shadow; hover a quarter of the way down, click all the way) */
html[data-ig-style="brutal"] :is(.btn-filled, .btn-tonal, .btn-outlined, .btn-danger) {
  --nb-press: 4px;
  border: var(--nb-w) solid var(--nb-ink); box-shadow: var(--nb-press) var(--nb-press) 0 var(--nb-ink);
  transition: translate .18s var(--ease-press), box-shadow .18s var(--ease-press), background-color .18s ease;
}
html[data-ig-style="brutal"] :is(.btn-filled, .btn-tonal, .btn-outlined, .btn-danger):not(:disabled):hover {
  translate: calc(var(--nb-press) / 4) calc(var(--nb-press) / 4);
  box-shadow: calc(var(--nb-press) * 3 / 4) calc(var(--nb-press) * 3 / 4) 0 var(--nb-ink);
}
html[data-ig-style="brutal"] :is(.btn-filled, .btn-tonal, .btn-outlined, .btn-danger):not(:disabled):active {
  translate: var(--nb-press) var(--nb-press);
  box-shadow: 0 0 0 var(--nb-ink);
}
html[data-ig-style="brutal"] .btn-outlined { color: var(--md-on-surface); }

/* fields and choices */
html[data-ig-style="brutal"] :is(.search-field, .field input, .dlg select, .chip, .chip-btn, .switch) { border: var(--nb-w) solid var(--nb-ink); }
html[data-ig-style="brutal"] .segmented { border: var(--nb-w) solid var(--nb-ink); box-shadow: var(--nb-shadow-s); }
html[data-ig-style="brutal"] .seg + .seg { border-left: var(--nb-w) solid var(--nb-ink); }
html[data-ig-style="brutal"] .seg[aria-checked="true"] { background: var(--md-primary); color: var(--md-on-primary); }

/* pop-ups and dialogs */
html[data-ig-style="brutal"] :is(.notify-panel, .dlg, .snackbar) { border: var(--nb-w) solid var(--nb-ink); box-shadow: var(--nb-shadow-pop); }
html[data-ig-style="brutal"] .search.open .search-results { border: var(--nb-w) solid var(--nb-ink); border-top: 0; box-shadow: var(--nb-shadow-pop); }
html[data-ig-style="brutal"] .search.open .search-field { box-shadow: var(--nb-shadow-pop); }
@media (prefers-reduced-motion: reduce) {
  html[data-ig-style="brutal"] :is(.cat-tile > a.cat-card, .cat-tile > .star-btn, .recent-card, .btn) { translate: none !important; }
}
html[data-ig-style="brutal"] .page-actions { margin-top: 0; }
