/*
 * VSMS theme, built on IBM's Carbon Design System:
 *   - colour: Carbon "g10" theme for light mode, "g100" for dark mode
 *   - type: IBM Plex Sans / Plex Mono, Carbon productive type scale
 *   - motion: Carbon duration and easing tokens (productive for UI, expressive for page entrances)
 *   - shape: square corners, hairline dividers, no drop shadows on tiles (Carbon "layers")
 *
 * Token names stay VSMS-specific (--surface, --text-2 ...) and are mapped onto Django admin's
 * variables, so every page (dashboard, lists, forms) follows the same palette.
 *
 * Dark mode follows the OS setting unless the user picks light/dark with the theme toggle
 * (html[data-theme]), exactly like Django admin itself.
 */

/* IBM Plex, served from our own static files (Latin-1 subset, ~20 KB per weight). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 300; font-display: swap; src: local("IBM Plex Sans Light"), local("IBMPlexSans-Light"), url("vendor/plex/IBMPlexSans-Light-Latin1.1df9776613ee.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: local("IBM Plex Sans"), local("IBMPlexSans"), url("vendor/plex/IBMPlexSans-Regular-Latin1.678efa63c3fb.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: local("IBM Plex Sans SemiBold"), local("IBMPlexSans-SemiBold"), url("vendor/plex/IBMPlexSans-SemiBold-Latin1.106da8161b57.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: local("IBM Plex Mono"), local("IBMPlexMono"), url("vendor/plex/IBMPlexMono-Regular-Latin1.23b4f5fce19d.woff2") format("woff2"); }

/* ---------------------------------------------------------------------------
   Tokens that do not change with the theme
   ------------------------------------------------------------------------- */
:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, "Courier New", monospace;

  /* Carbon motion: durations */
  --duration-fast-01: 70ms;      /* micro-interactions: hover, toggles */
  --duration-fast-02: 110ms;     /* small expansions, fades */
  --duration-moderate-01: 150ms; /* menus, notifications */
  --duration-moderate-02: 240ms; /* panels, sidebar */
  --duration-slow-01: 400ms;     /* large entrances */
  --duration-slow-02: 700ms;     /* page-level, data visualisation */
  /* Carbon motion: easing (productive = everyday UI, expressive = moments worth noticing) */
  --ease-standard-productive: cubic-bezier(0.2, 0, 0.38, 0.9);
  --ease-entrance-productive: cubic-bezier(0, 0, 0.38, 0.9);
  --ease-exit-productive: cubic-bezier(0.2, 0, 1, 0.9);
  --ease-standard-expressive: cubic-bezier(0.4, 0.14, 0.3, 1);
  --ease-entrance-expressive: cubic-bezier(0, 0, 0.3, 1);
  --ease-exit-expressive: cubic-bezier(0.4, 0.14, 1, 1);

  /* Carbon spacing scale */
  --sp-01: 2px; --sp-02: 4px; --sp-03: 8px; --sp-04: 12px; --sp-05: 16px;
  --sp-06: 24px; --sp-07: 32px; --sp-08: 40px; --sp-09: 48px;

  /* Buttons keep the same colours in both themes (Carbon) */
  --button-primary: #0f62fe;
  --button-primary-hover: #0050e6;
  --button-primary-active: #002d9c;
  --button-danger: #da1e28;
  --button-danger-hover: #b81921;
  --button-danger-active: #750e13;
}

/* ---------------------------------------------------------------------------
   Light: Carbon g10
   ------------------------------------------------------------------------- */
:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f4;            /* background */
  --surface: #ffffff;       /* layer-01 */
  --surface-2: #f4f4f4;     /* layer-02 */
  --surface-3: #e8e8e8;     /* layer-hover-01 */
  --layer-accent: #e0e0e0;  /* layer-accent-01: table headers */
  --layer-selected: #e0e0e0;
  --border: #e0e0e0;        /* border-subtle-01 */
  --border-strong: #8d8d8d; /* border-strong-01 */
  --text: #161616;          /* text-primary */
  --text-2: #525252;        /* text-secondary */
  --text-3: #6f6f6f;        /* text-helper */
  --text-disabled: #a8a8a8;
  --brand: #0f62fe;         /* interactive */
  --brand-hover: #0043ce;   /* link-primary-hover */
  --brand-soft: #edf5ff;    /* blue-10 */
  --brand-ink: #0f62fe;     /* link-primary */
  --on-brand: #ffffff;
  --focus: #0f62fe;
  --focus-inset: #ffffff;
  --field: #ffffff;         /* field-01 on the page background */
  --field-2: #f4f4f4;       /* field-02 inside white tiles */
  --field-hover: #e8e8e8;
  --button-secondary: #393939;
  --button-secondary-hover: #474747;
  --button-secondary-active: #6f6f6f;
  --button-tertiary: #0f62fe;
  --success: #198038;       /* text-safe status colours */
  --success-icon: #24a148;  /* support-success */
  --success-soft: #defbe6;
  --warning: #8e6a00;
  --warning-icon: #f1c21b;  /* support-warning */
  --warning-soft: #fcf4d6;
  --danger: #da1e28;        /* support-error */
  --danger-soft: #fff1f1;
  --info: #0043ce;          /* support-info */
  --info-soft: #edf5ff;
  --shadow: none;
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.3);
  --overlay: rgba(22, 22, 22, 0.5);
  /* Data colours (Carbon ramps, checked with the dataviz palette validator against white) */
  --data-1: #6929c4;        /* purple-70 */
  --data-2: #009d9a;        /* teal-50 */
  --data-track: #e0e0e0;
  --data-grid: #e0e0e0;
  --data-axis: #8d8d8d;
  --chart-theme: white;     /* Carbon Charts theme that matches a white tile */
  --tooltip-bg: #393939;    /* background-inverse */
  --tooltip-fg: #f4f4f4;    /* text-inverse */
}

/* ---------------------------------------------------------------------------
   Dark: Carbon g100 (written twice: OS preference, and the explicit toggle)
   ------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161616; --surface: #262626; --surface-2: #393939; --surface-3: #333333;
    --layer-accent: #393939; --layer-selected: #393939;
    --border: #393939; --border-strong: #6f6f6f;
    --text: #f4f4f4; --text-2: #c6c6c6; --text-3: #a8a8a8; --text-disabled: #6f6f6f;
    --brand: #4589ff; --brand-hover: #a6c8ff; --brand-soft: #001d6c; --brand-ink: #78a9ff; --on-brand: #ffffff;
    --focus: #ffffff; --focus-inset: #161616;
    --field: #262626; --field-2: #393939; --field-hover: #333333;
    --button-secondary: #6f6f6f; --button-secondary-hover: #5e5e5e; --button-secondary-active: #393939;
    --button-tertiary: #ffffff;
    --success: #42be65; --success-icon: #42be65; --success-soft: #071908;
    --warning: #f1c21b; --warning-icon: #f1c21b; --warning-soft: #1c1500;
    --danger: #ff8389; --danger-soft: #2d0709;
    --info: #78a9ff; --info-soft: #001141;
    --shadow: none; --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.8); --overlay: rgba(0, 0, 0, 0.65);
    --data-1: #8a3ffc;      /* purple-60 */
    --data-2: #009d9a;      /* teal-50 */
    --data-track: #393939; --data-grid: #393939; --data-axis: #6f6f6f;
    --chart-theme: g90;
    --tooltip-bg: #f4f4f4; --tooltip-fg: #161616;
  }
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161616; --surface: #262626; --surface-2: #393939; --surface-3: #333333;
  --layer-accent: #393939; --layer-selected: #393939;
  --border: #393939; --border-strong: #6f6f6f;
  --text: #f4f4f4; --text-2: #c6c6c6; --text-3: #a8a8a8; --text-disabled: #6f6f6f;
  --brand: #4589ff; --brand-hover: #a6c8ff; --brand-soft: #001d6c; --brand-ink: #78a9ff; --on-brand: #ffffff;
  --focus: #ffffff; --focus-inset: #161616;
  --field: #262626; --field-2: #393939; --field-hover: #333333;
  --button-secondary: #6f6f6f; --button-secondary-hover: #5e5e5e; --button-secondary-active: #393939;
  --button-tertiary: #ffffff;
  --success: #42be65; --success-icon: #42be65; --success-soft: #071908;
  --warning: #f1c21b; --warning-icon: #f1c21b; --warning-soft: #1c1500;
  --danger: #ff8389; --danger-soft: #2d0709;
  --info: #78a9ff; --info-soft: #001141;
  --shadow: none; --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.8); --overlay: rgba(0, 0, 0, 0.65);
  --data-1: #8a3ffc;
  --data-2: #009d9a;
  --data-track: #393939; --data-grid: #393939; --data-axis: #6f6f6f;
  --chart-theme: g90;
  --tooltip-bg: #f4f4f4; --tooltip-fg: #161616;
}

/* Django admin variables → tokens (both modes, since they reference the tokens). */
:root, html[data-theme] {
  --primary: var(--brand);
  --secondary: var(--brand);
  --accent: var(--brand);
  --primary-fg: var(--on-brand);
  --body-fg: var(--text);
  --body-bg: var(--surface);
  --body-quiet-color: var(--text-3);
  --body-medium-color: var(--text-2);
  --body-loud-color: var(--text);
  --header-color: var(--text);
  --header-branding-color: var(--text);
  --header-bg: var(--surface);
  --header-link-color: var(--text-2);
  --breadcrumbs-fg: var(--text-3);
  --breadcrumbs-link-fg: var(--brand-ink);
  --breadcrumbs-bg: transparent;
  --link-fg: var(--brand-ink);
  --link-hover-color: var(--brand-hover);
  --link-selected-fg: var(--brand);
  --hairline-color: var(--border);
  --border-color: var(--border-strong);
  --error-fg: var(--danger);
  --message-success-bg: var(--success-soft);
  --message-warning-bg: var(--warning-soft);
  --message-error-bg: var(--danger-soft);
  --darkened-bg: var(--surface-2);
  --selected-bg: var(--layer-selected);
  --selected-row: var(--brand-soft);
  --button-fg: #ffffff;
  --button-bg: var(--button-primary);
  --button-hover-bg: var(--button-primary-hover);
  --default-button-bg: var(--button-primary);
  --default-button-hover-bg: var(--button-primary-hover);
  --close-button-bg: var(--button-secondary);
  --close-button-hover-bg: var(--button-secondary-hover);
  --delete-button-bg: var(--button-danger);
  --delete-button-hover-bg: var(--button-danger-hover);
  --object-tools-fg: #ffffff;
  --object-tools-bg: var(--button-secondary);
  --object-tools-hover-bg: var(--button-secondary-hover);
  --font-family-primary: var(--font-sans);
  --font-family-monospace: var(--font-mono);
}

/* ---------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */
html, body { background: var(--bg); }
body { color: var(--text); font-family: var(--font-sans); letter-spacing: 0.16px; }
code, kbd, pre, samp, .mono { font-family: var(--font-mono); letter-spacing: 0.32px; }
.vi { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.vi-sm { width: 16px; height: 16px; vertical-align: -3px; }
.vi-lg { width: 24px; height: 24px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
#content h1 { font-size: 1.75rem; line-height: 2.25rem; font-weight: 400; letter-spacing: 0; color: var(--text); }
#content { padding: var(--sp-06) var(--sp-07); }
a:link, a:visited { color: var(--link-fg); }
a:link:hover, a:visited:hover { color: var(--link-hover-color); }
.module h2, .module caption, .inline-group h2 {
  background: var(--layer-accent); color: var(--text); border-bottom: 1px solid var(--border);
  font-weight: 600; letter-spacing: 0.16px; text-transform: none; font-size: 0.875rem; padding: 12px 16px;
}

/* ---------------------------------------------------------------------------
   Top bar (Carbon UI shell header: 48px, hairline bottom)
   ------------------------------------------------------------------------- */
#header {
  display: flex; align-items: stretch; gap: 0; flex-wrap: nowrap;
  min-height: 48px; padding: 0; background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--border);
}
#branding { order: 0; flex: none; display: flex; align-items: center; padding-right: var(--sp-05); border-right: 1px solid var(--border); }
#header .vsms-nav { order: 1; }
#user-tools { order: 2; }
#site-name { margin: 0; font-size: 0.875rem; font-weight: 600; }
#site-name a:link, #site-name a:visited { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; letter-spacing: 0.1px; }
.brand-mark {
  width: 48px; height: 48px; display: grid; place-items: center; flex: none;
  background: var(--button-primary); color: #ffffff;
}
.brand-mark .vi { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 0.75rem; font-weight: 400; color: var(--text-3); letter-spacing: 0.32px; }

.vsms-nav {
  flex: 1; display: flex; align-items: stretch; gap: 0; padding: 0; background: none; border: none;
  font-size: 0.875rem; min-width: 0;
}
.vsms-nav > a, .vsms-menu > summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; box-sizing: border-box;
  color: var(--text-2) !important; font-weight: 400; letter-spacing: 0.16px; text-decoration: none; white-space: nowrap;
  transition: background-color var(--duration-fast-02) var(--ease-standard-productive), color var(--duration-fast-02) var(--ease-standard-productive);
}
.vsms-nav > a:hover, .vsms-menu > summary:hover, .vsms-menu[open] > summary { background: var(--surface-3); color: var(--text) !important; }
.vsms-nav > a.is-active { color: var(--text) !important; box-shadow: inset 0 -3px 0 var(--brand); font-weight: 600; }
.vsms-menu { position: relative; display: flex; }
.vsms-menu summary::after { content: none; }
.vsms-menu summary .vi-sm { transition: transform var(--duration-fast-02) var(--ease-standard-productive); }
.vsms-menu[open] summary .vi-sm { transform: rotate(180deg); }
.vsms-menu-items {
  position: absolute; z-index: 1002; display: flex; flex-direction: column;
  top: 100%; left: 0; min-width: 224px; padding: 0; border-radius: 0;
  background: var(--surface); border: none; box-shadow: var(--shadow-pop);
}
.vsms-menu-items a {
  border-radius: 0; padding: 0 16px; min-height: 40px; display: flex; align-items: center;
  color: var(--text-2) !important; font-weight: 400; border-bottom: 1px solid var(--border);
  transition: background-color var(--duration-fast-01) var(--ease-standard-productive);
}
.vsms-menu-items a:last-child { border-bottom: none; }
.vsms-menu-items a:hover { background: var(--surface-3); color: var(--text) !important; }

/* Carbon search: 40px field, bottom border, icon on the left. */
.vsms-nav-search { margin-left: auto; position: relative; display: flex; align-items: center; padding: 0 var(--sp-05); }
.vsms-nav-search .vi { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; z-index: 1; width: 16px; height: 16px; }
#container .vsms-nav-search input[type=search] {
  width: 300px; height: 40px; padding: 0 56px 0 40px; border-radius: 0; font-size: 0.875rem; letter-spacing: 0.16px;
  background: var(--field-2); border: none; border-bottom: 1px solid var(--border-strong); color: var(--text);
  transition: background-color var(--duration-fast-02) var(--ease-standard-productive);
}
#container .vsms-nav-search input[type=search]::placeholder { color: var(--text-3); }
#container .vsms-nav-search input[type=search]:hover { background: var(--field-hover); }
#container .vsms-nav-search input[type=search]:focus { outline: 2px solid var(--focus); outline-offset: -2px; box-shadow: none; }
.vsms-kbd {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font: 400 0.75rem/1 var(--font-mono); color: var(--text-3);
  border: 1px solid var(--border-strong); border-radius: 0; padding: 3px 5px; background: transparent;
}

/* User menu (replaces Django's "Welcome, … / View site / Change password / Log out" line). */
#user-tools { margin: 0; padding: 0; font-size: 0.875rem; text-transform: none; letter-spacing: 0.16px; display: flex; border-left: 1px solid var(--border); }
.user-menu { position: relative; display: flex; }
.user-menu > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; min-height: 48px; border-radius: 0;
  transition: background-color var(--duration-fast-02) var(--ease-standard-productive);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--surface-3); }
.user-menu > summary .vi-sm { transition: transform var(--duration-fast-02) var(--ease-standard-productive); }
.user-menu[open] > summary .vi-sm { transform: rotate(180deg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--layer-accent); color: var(--text); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.32px;
}
.user-menu .who { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.user-menu .who strong { font-weight: 600; color: var(--text); }
.user-menu .who span { font-size: 0.75rem; color: var(--text-3); letter-spacing: 0.32px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-items {
  position: absolute; right: 0; top: 100%; z-index: 1002; min-width: 240px; padding: 0;
  background: var(--surface); border: none; border-radius: 0; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
}
.user-menu-items a, .user-menu-items button, .user-menu-items .theme-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; padding: 0 16px; min-height: 40px; border-radius: 0;
  font: inherit; color: var(--text-2) !important; background: none; border: none; text-align: left; cursor: pointer;
  text-decoration: none; text-transform: none; letter-spacing: 0.16px;
  transition: background-color var(--duration-fast-01) var(--ease-standard-productive);
}
.user-menu-items a:hover, .user-menu-items button:hover { background: var(--surface-3); color: var(--text) !important; }
.user-menu-items hr { border: 0; border-top: 1px solid var(--border); margin: 0; }
.user-menu-items form { margin: 0; }
/* Theme: the whole menu row is the button; the tag shows the current setting. */
.user-menu-items .menu-theme { margin: 0; }
.user-menu-items .menu-theme svg.vi { width: 20px; height: 20px; margin: 0; }
.menu-theme-state {
  display: none; margin-left: auto; padding: 0 8px; min-height: 24px; align-items: center; border-radius: 2px;
  background: var(--layer-accent); color: var(--text); font-size: 0.75rem; letter-spacing: 0.32px;
}
html[data-theme="auto"] .menu-theme-state.when-auto,
html[data-theme="light"] .menu-theme-state.when-light,
html[data-theme="dark"] .menu-theme-state.when-dark { display: inline-flex; }
.theme-toggle svg.vi { width: 20px; height: 20px; fill: currentColor; }

/* Breadcrumb (Carbon): sits above the page title; "/" between levels, the current page as plain text.
   Long labels are cut with "…" (hover shows the full text), and on phones long trails fold their
   middle levels into a "…" menu. Markup comes from the {% breadcrumbs %} tag. */
.vsms-breadcrumb { margin: 0 0 var(--sp-03); font-size: 0.875rem; line-height: 1.125rem; letter-spacing: 0.16px; }
.vsms-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; margin: 0; padding: 0; list-style: none; }
.vsms-breadcrumb li.vsms-crumb { display: inline-flex; align-items: center; margin: 0 var(--sp-03) 0 0; padding: 0; list-style: none; color: var(--text); }
.vsms-crumb:not(:last-child)::after { content: "/"; margin-left: var(--sp-03); color: var(--text); }
.vsms-crumb a:link, .vsms-crumb a:visited { color: var(--brand-ink); text-decoration: none; }
.vsms-crumb a:hover { color: var(--brand-hover); text-decoration: underline; }
.vsms-crumb a:focus-visible { outline: 1px solid var(--focus); outline-offset: 0; }
.vsms-crumb-text { display: inline-block; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.vsms-crumb.is-current { color: var(--text); }
.vsms-breadcrumb li.vsms-crumb-overflow { display: none; }
.vsms-crumb-menu { position: relative; }
.vsms-crumb-menu > summary {
  list-style: none; cursor: pointer; padding: 0 6px; line-height: 1.125rem; color: var(--brand-ink);
  transition: background-color var(--duration-fast-01) var(--ease-standard-productive);
}
.vsms-crumb-menu > summary::-webkit-details-marker { display: none; }
.vsms-crumb-menu > summary:hover, .vsms-crumb-menu[open] > summary { background: var(--surface-3); }
.vsms-crumb-menu-items {
  position: absolute; z-index: 1003; top: calc(100% + 8px); left: 0; min-width: 176px;
  display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-pop);
}
details[open] > .vsms-crumb-menu-items { animation: vsms-menu-in var(--duration-moderate-01) var(--ease-entrance-productive); }
.vsms-crumb-menu-items a:link, .vsms-crumb-menu-items a:visited {
  display: flex; align-items: center; min-height: 40px; padding: 0 16px; color: var(--text-2); border-bottom: 1px solid var(--border);
}
.vsms-crumb-menu-items a:last-child { border-bottom: none; }
.vsms-crumb-menu-items a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
@media (max-width: 671px) {
  .vsms-breadcrumb li.vsms-crumb.is-folded { display: none; }
  .vsms-breadcrumb li.vsms-crumb-overflow { display: inline-flex; }
  .vsms-crumb-text { max-width: 18ch; }
}
/* Fallback for any Django page still printing its own trail */
div.breadcrumbs { background: transparent; color: var(--text-3); padding: var(--sp-05) var(--sp-07) 0; border: none; font-size: 0.875rem; }
div.breadcrumbs a { color: var(--brand-ink); }

/* ---------------------------------------------------------------------------
   Side navigation (Carbon UI shell side nav)
   ------------------------------------------------------------------------- */
#nav-sidebar {
  background: var(--surface); border-right: 1px solid var(--border); padding: 0 0 var(--sp-06);
  flex-basis: 256px; margin-left: -257px; left: -257px;
  transition: margin-left var(--duration-moderate-02) var(--ease-standard-productive);
}
.main.shifted > #nav-sidebar { margin-left: 0; }
.toggle-nav-sidebar {
  background: var(--surface); border-right: 1px solid var(--border); color: var(--text-2);
  transition: background-color var(--duration-fast-02) var(--ease-standard-productive);
}
.toggle-nav-sidebar:hover { background: var(--surface-3); }
.side-school {
  display: flex; align-items: center; gap: 12px; padding: var(--sp-05); margin: 0 0 var(--sp-03);
  border-bottom: 1px solid var(--border); background: transparent;
}
.side-school .brand-mark { width: 32px; height: 32px; }
.side-school .brand-mark .vi { width: 20px; height: 20px; }
.side-school strong { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text); }
.side-school span { font-size: 0.75rem; color: var(--text-3); letter-spacing: 0.32px; }
.side-section {
  margin: var(--sp-05) var(--sp-05) var(--sp-02); font-size: 0.75rem; font-weight: 400; color: var(--text-3);
  text-transform: none; letter-spacing: 0.32px;
}
.side-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 0 var(--sp-05); min-height: 32px;
  border-radius: 0; color: var(--text-2) !important; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.16px;
  text-decoration: none;
  transition: background-color var(--duration-fast-02) var(--ease-standard-productive), color var(--duration-fast-02) var(--ease-standard-productive);
}
.side-link .vi { width: 16px; height: 16px; }
.side-link:hover { background: var(--surface-3); color: var(--text) !important; }
.side-link.is-active { background: var(--layer-selected); color: var(--text) !important; box-shadow: inset 3px 0 0 var(--brand); }
.side-link .count {
  margin-left: auto; font-size: 0.75rem; font-weight: 400; padding: 0 8px; border-radius: 2px;
  background: var(--danger-soft); color: var(--danger);
}

/* Navigation placement: the sidebar is the main navigation on wide screens.
   The top-bar menus appear on smaller screens, or when the sidebar is collapsed. */
@media (min-width: 1100px) {
  body:has(#main.shifted) #header .vsms-nav > .vsms-menu,
  body:has(#main.shifted) #header .vsms-nav > a.top-only { display: none; }
}
@media (max-width: 1099px) {
  .user-menu .who { display: none; }
  #container .vsms-nav-search input[type=search] { width: 200px; }
}
@media (max-width: 767px) {
  #content { padding: var(--sp-05); }
  .vsms-nav-search { margin-left: 0; flex-basis: 100%; padding: 0 0 var(--sp-03); }
  .vsms-nav-search .vi { left: 12px; }
  #container .vsms-nav-search input[type=search] { width: 100%; }
  .vsms-kbd { display: none; }
}

/* The live-search wrapper inside the top bar fills the search form. */
.vsms-nav-search .vsms-suggest { display: block; }
.vsms-nav-search .vsms-suggest-list { left: 0; right: auto; min-width: 300px; }

/* Django's responsive.css and header rules load after this file; these win by specificity. */
#container #header { flex-direction: row; justify-content: flex-start; align-items: stretch; padding: 0; flex-shrink: 0; height: auto; }
#container #site-name { margin: 0; line-height: 1.2; }
#container #user-tools, #container #user-tools #logout-form button {
  float: none; margin: 0; font-size: 0.875rem; font-weight: 400; line-height: normal;
  letter-spacing: 0.16px; text-transform: none; text-align: left; border-bottom: 0;
}
#container #user-tools { padding: 0; }
#container #user-tools .user-menu-items #logout-form button { padding: 0 16px; }
#container #user-tools a { border-bottom: 0; display: flex; }
#container #header a:hover { text-decoration: none; }
@media (max-width: 767px) {
  #container #header { flex-wrap: wrap; padding: 0; gap: 0; }
  #container #branding { flex: 1; border-right: none; }
  #container #header .vsms-nav { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--border); padding: 0 var(--sp-05); }
  #container #header .vsms-nav > a, #container #header .vsms-menu > summary { padding: 0 12px; min-height: 40px; }
  /* Phones: a menu opens full width under the header instead of under its button. */
  #container #header { position: relative; }
  #container #header .vsms-menu { position: static; }
  #container #header .vsms-menu-items { left: 16px; right: 16px; min-width: 0; }
}

/* ---------------------------------------------------------------------------
   Motion: one-off entrances (Carbon: productive for menus, expressive for pages)
   ------------------------------------------------------------------------- */
@keyframes vsms-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes vsms-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes vsms-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vsms-slide-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* Closed menus take no space (otherwise they can widen the page on phones). */
details:not([open]) > .vsms-menu-items,
details:not([open]) > .user-menu-items,
details:not([open]) > .vsms-crumb-menu-items { display: none; }
details[open] > .vsms-menu-items,
details[open] > .user-menu-items { animation: vsms-menu-in var(--duration-moderate-01) var(--ease-entrance-productive); }
.vsms-suggest-list { animation: vsms-menu-in var(--duration-fast-02) var(--ease-entrance-productive); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}
