:root {
  color-scheme: light;
  --ink: #17213a;
  --muted: #53617b;
  --brand: #174ea6;
  --brand-dark: #0e3474;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --border: #c9d4e7;
  --focus-outer: #14213d;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 1rem/1.55 system-ui, sans-serif; }
a { color: var(--brand-dark); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible,
input[type="reset"]:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: -2px; box-shadow: inset 0 0 0 4px #fff; }
.skip-link { position: absolute; left: 1rem; top: -5rem; background: var(--surface); padding: .75rem 1rem; z-index: 10; }
.skip-link:focus { top: 1rem; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1rem max(1rem, calc((100% - 72rem) / 2)); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { color: var(--ink); font-size: 1.25rem; font-weight: 750; text-decoration: none; }
nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
nav form { margin: 0; }
main { width: min(72rem, calc(100% - 2rem)); margin: 2rem auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; padding: clamp(1.25rem, 4vw, 2.5rem); box-shadow: 0 .5rem 1.5rem rgb(20 42 82 / 8%); }
.eyebrow { color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.facts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.facts div { padding: 1rem; border: 1px solid var(--border); border-radius: .75rem; }
dt { color: var(--muted); font-size: .9rem; }
dd { margin: .25rem 0 0; font-weight: 700; }
label { display: block; font-weight: 650; margin-top: 1rem; }
input, select, textarea { width: 100%; max-width: 32rem; padding: .75rem; border: 1px solid var(--border); border-radius: .5rem; font: inherit; }
input[type="checkbox"], input[type="radio"] { width: auto; min-width: 1.25rem; min-height: 1.25rem; }
button { margin-top: 1rem; padding: .7rem 1rem; color: #fff; background: var(--brand); border: 0; border-radius: .5rem; font: inherit; font-weight: 700; cursor: pointer; }
.errorlist { color: #9b1c1c; }
.message { margin-bottom: 1rem; padding: 1rem; background: #e9f2ff; border-left: .3rem solid var(--brand); }
.message-error { background: #fff0f0; border-left-color: #9b1c1c; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
caption { padding: .75rem; font-weight: 700; text-align: left; }
th, td { padding: .75rem; border: 1px solid var(--border); text-align: left; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
@media (max-width: 40rem) { .site-header { align-items: flex-start; flex-direction: column; } }

/* Modern application layer. Existing selectors remain valid; the new shell,
   login and resource classes can be adopted screen by screen. */
:root {
  --ink-soft: #33415f;
  --brand-soft: #e9f1ff;
  --accent: #7357d9;
  --success: #14735b;
  --warning-ink: #7b4f00;
  --danger: #9b1c1c;
  --surface-soft: #f9fbff;
  --border-soft: #e2e8f3;
  --sidebar-width: 17.5rem;
  --content-width: 78rem;
  --radius-sm: .625rem;
  --radius-md: .875rem;
  --radius-lg: 1.25rem;
  --shadow-sm: 0 .25rem .75rem rgb(20 42 82 / 7%);
  --shadow-md: 0 1rem 2.5rem rgb(20 42 82 / 10%);
  --ease: 180ms ease;
}

html {
  min-width: 20rem;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 2%, rgb(219 230 255 / 70%), transparent 22rem),
    linear-gradient(180deg, #f8faff 0, var(--canvas) 30rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

::selection {
  color: #fff;
  background: var(--brand-dark);
}

img,
svg,
video {
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin-block: 0 .7em;
  line-height: 1.18;
  letter-spacing: -.025em;
}

h1 { font-size: clamp(1.75rem, 3.2vw, 2.65rem); }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.8rem); }
h3 { font-size: clamp(1.08rem, 1.8vw, 1.3rem); }
p { margin-block: 0 1rem; }

a {
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

a:hover { color: var(--brand); }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: .75rem;
  left: 1rem;
  padding: .75rem 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-weight: 750;
  transform: translateY(-6rem);
  transition: transform var(--ease);
}

.skip-link:focus {
  top: .75rem;
  transform: translateY(0);
}

/* Shell and navigation */
.app-shell {
  min-height: 100vh;
  padding-inline-start: var(--sidebar-width);
}

.site-header,
.sidebar {
  position: fixed;
  z-index: 100;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  min-height: 100vh;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 1.15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.2rem 1rem;
  background: linear-gradient(145deg, rgb(255 255 255 / 98%), rgb(239 244 255 / 98%));
  border-right: 1px solid var(--border-soft);
  border-bottom: 0;
  box-shadow: .5rem 0 2rem rgb(24 55 105 / 8%);
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

.site-header::-webkit-scrollbar,
.sidebar::-webkit-scrollbar { width: .55rem; }

.site-header::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border: .12rem solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.brand {
  display: inline-flex;
  min-height: 3.25rem;
  align-items: center;
  gap: .72rem;
  padding: .65rem .72rem;
  border-radius: var(--radius-md);
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand::before {
  content: "О";
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-radius: .7rem;
  box-shadow: 0 .4rem 1rem rgb(23 78 166 / 24%);
  font-size: 1rem;
}

.brand:hover {
  color: var(--brand-dark);
  background: rgb(255 255 255 / 72%);
}

.site-header nav,
.sidebar nav {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: .22rem;
}

.site-header nav a,
.sidebar-link {
  display: flex;
  min-height: 2.62rem;
  align-items: center;
  gap: .68rem;
  padding: .6rem .75rem;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: .72rem;
  font-size: .925rem;
  font-weight: 650;
  line-height: 1.25;
  text-decoration: none;
  transition: color var(--ease), background-color var(--ease),
    border-color var(--ease), transform var(--ease);
}

.site-header nav a:hover,
.sidebar-link:hover,
.sidebar-link[aria-current="page"] {
  color: var(--brand-dark);
  background: rgb(255 255 255 / 90%);
  border-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
  transform: translateX(.12rem);
}

.sidebar-link[aria-current="page"] {
  background: var(--brand-soft);
  border-color: #b8ccee;
}

.sidebar-group {
  display: grid;
  gap: .25rem;
  padding-block: .35rem;
}

.sidebar-group + .sidebar-group { border-top: 1px solid var(--border-soft); }

.sidebar-group > :is(h2, h3, p, span):first-child {
  margin: .35rem .75rem .22rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.site-header nav form,
.sidebar nav form {
  margin: .6rem 0 0;
  padding-top: .65rem;
  border-top: 1px solid var(--border-soft);
}

.site-header nav form button:not(.icon-button),
.sidebar nav form button:not(.icon-button) {
  width: 100%;
  justify-content: center;
  margin: 0;
}

.topbar {
  position: sticky;
  z-index: 80;
  top: 0;
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem clamp(1rem, 3vw, 2rem);
  background: rgb(248 250 255 / 88%);
  border-bottom: 1px solid rgb(201 212 231 / 70%);
  box-shadow: 0 .4rem 1.25rem rgb(20 42 82 / 4%);
  backdrop-filter: blur(1rem);
}

main {
  width: auto;
  max-width: var(--content-width);
  min-height: 100vh;
  margin: 0 0 0 var(--sidebar-width);
  padding: clamp(1.25rem, 3vw, 2.75rem);
}

/* Reusable layout and dashboard */
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stack > * { margin-block: 0; }

.cluster,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem 1.25rem;
  flex-wrap: wrap;
}

.section-heading { margin-bottom: .25rem; }
.section-heading > * { margin-block: 0; }

.card {
  background: linear-gradient(145deg, #fff, #f8fbff);
  border-color: var(--border-soft);
  border-radius: var(--radius-lg);
  padding: clamp(1.15rem, 3vw, 2rem);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
}

.card:hover {
  border-color: #cbd7eb;
  box-shadow: var(--shadow-md);
}

.dashboard-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background: linear-gradient(128deg, #fff 8%, #edf3ff 58%, #f1ebff 100%);
  border: 1px solid #dbe4f5;
  border-radius: clamp(1.1rem, 2vw, 1.6rem);
  box-shadow: var(--shadow-md);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 18rem;
  height: 18rem;
  top: -8rem;
  right: -5rem;
  background: radial-gradient(circle, rgb(115 87 217 / 22%), transparent 68%);
  border-radius: 50%;
}

.dashboard-hero > :last-child { margin-bottom: 0; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
}

.quick-card {
  display: flex;
  min-height: 10.5rem;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem;
  color: var(--ink);
  background: linear-gradient(145deg, #fff, #edf4ff);
  border: 1px solid #d9e3f4;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}

.quick-card:nth-child(3n + 2) { background: linear-gradient(145deg, #fff, #f2efff); }
.quick-card:nth-child(3n + 3) { background: linear-gradient(145deg, #fff, #eaf8f4); }

.quick-card:hover {
  color: var(--brand-dark);
  border-color: #b8ccec;
  box-shadow: var(--shadow-md);
  transform: translateY(-.18rem);
}

.eyebrow {
  margin-bottom: .55rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .09em;
}

.facts { gap: .8rem; }

.facts div {
  background: rgb(255 255 255 / 76%);
  border-color: var(--border-soft);
  border-radius: var(--radius-md);
}

dt { font-size: .85rem; font-weight: 650; }
dd { color: var(--ink); font-weight: 750; }

/* Login/start screen compatible with an IRPO-style split welcome screen. */
.login-shell {
  display: grid;
  width: min(72rem, calc(100% - 2rem));
  min-height: min(44rem, calc(100vh - 4rem));
  grid-template-columns: minmax(0, 1.15fr) minmax(22rem, .85fr);
  margin: 2rem auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-md);
}

.login-visual {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 34rem;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem);
  color: #fff;
  background:
    radial-gradient(circle at 76% 24%, rgb(173 157 255 / 72%), transparent 18rem),
    linear-gradient(145deg, #174ea6 0%, #243f91 48%, #6946bd 100%);
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 50%;
}

.login-visual::before {
  width: 24rem;
  height: 24rem;
  right: -10rem;
  bottom: -8rem;
}

.login-visual::after {
  width: 10rem;
  height: 10rem;
  top: 3rem;
  left: -4rem;
}

.login-visual h1,
.login-visual h2,
.login-visual a { color: #fff; }

.login-visual p { color: #eef3ff; }

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 4rem);
  background: linear-gradient(180deg, #fff, #fbfcff);
}

.login-panel > * { width: 100%; max-width: 28rem; margin-inline: auto; }
.login-panel input, .login-panel select { max-width: none; }
.login-panel button:not(.icon-button), .login-panel input[type="submit"]:not(.icon-button) { width: 100%; }

/* Video, PDF and interactive constructor cards. */
.resource-grid,
.constructor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
}

.resource-card,
.video-card,
.pdf-card,
.constructor-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.resource-card:hover,
.video-card:hover,
.pdf-card:hover,
.constructor-card:hover {
  border-color: #b9c9e6;
  box-shadow: var(--shadow-md);
  transform: translateY(-.15rem);
}

.resource-card__preview,
.video-card__preview,
.pdf-card__preview,
.constructor-card__preview {
  position: relative;
  display: grid;
  min-height: 10rem;
  place-items: center;
  overflow: hidden;
  color: var(--brand-dark);
  background: linear-gradient(135deg, #edf4ff, #f4f0ff);
  border-bottom: 1px solid var(--border-soft);
}

.video-card__preview { aspect-ratio: 16 / 9; min-height: auto; background: #1b2741; color: #fff; }
.pdf-card__preview { background: linear-gradient(135deg, #fff1f1, #fff); color: #8b2424; }
.constructor-card__preview { background: linear-gradient(135deg, #e9f8f3, #eff8ff); color: #12634f; }

.resource-card__body,
.video-card__body,
.pdf-card__body,
.constructor-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .65rem;
  padding: 1.1rem;
}

.resource-card__body > *,
.video-card__body > *,
.pdf-card__body > *,
.constructor-card__body > * { margin-block: 0; }

.resource-card__meta,
.video-card__meta,
.pdf-card__meta,
.constructor-card__meta {
  color: var(--muted);
  font-size: .85rem;
}

.resource-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: .25rem .55rem;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #c8d8f2;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
}

/* Forms and actions */
form p { margin-block: 0 1rem; }
.field { display: grid; gap: .4rem; }

label {
  margin-top: 0;
  margin-bottom: .4rem;
  color: var(--ink-soft);
  font-weight: 700;
}

input,
select,
textarea {
  max-width: 38rem;
  min-height: 2.85rem;
  padding: .72rem .85rem;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgb(20 42 82 / 4%);
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

textarea { min-height: 8rem; resize: vertical; }

input:hover,
select:hover,
textarea:hover { border-color: #98acd0; }

input:focus,
select:focus,
textarea:focus { background: #fff; border-color: var(--brand); }

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid transparent;
  outline-offset: -2px;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand), inset 0 0 0 3px var(--brand-soft);
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  min-width: 1.25rem;
  height: 1.25rem;
  min-height: 1.25rem;
  margin: 0 .4rem 0 0;
  padding: 0;
  accent-color: var(--brand);
  vertical-align: -.18em;
}

input[type="file"] { min-height: auto; padding: .55rem; }

input::file-selector-button {
  margin-right: .75rem;
  padding: .52rem .72rem;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 0;
  border-radius: .45rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled { cursor: not-allowed; opacity: .62; }

.helptext {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  font-size: .88rem;
}

.errorlist {
  margin: .45rem 0;
  padding: .7rem .85rem .7rem 2rem;
  color: var(--danger);
  background: #fff4f4;
  border: 1px solid #efcaca;
  border-radius: var(--radius-sm);
  font-weight: 650;
}

button,
.button,
input[type="submit"] {
  display: inline-flex;
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 2.35rem;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin-top: .25rem;
  padding: .48rem .72rem;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: 0 .45rem 1rem rgb(23 78 166 / 20%);
  font: inherit;
  font-size: .86rem;
  font-weight: 620;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow var(--ease), background-color var(--ease), border-color var(--ease);
}

button:hover,
.button:hover,
input[type="submit"]:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

button > span,
.button > span { min-width: 0; }

.button.secondary,
button.secondary {
  color: var(--brand-dark);
  background: var(--surface);
  border-color: #b8c9e6;
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover,
button.secondary:hover { color: var(--brand-dark); background: var(--brand-soft); }

/* Messages and tables */
.message,
.notice,
.warning {
  margin-bottom: 1rem;
  padding: .9rem 1rem;
  color: var(--ink);
  background: #e9f2ff;
  border: 1px solid #cbdcf5;
  border-left: .3rem solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.message-success { background: #eaf8f3; border-color: #b9dfd2; border-left-color: var(--success); }
.message-warning, .warning { background: #fff7e8; border-color: #ead5a9; border-left-color: var(--warning-ink); }
.message-error, .message-danger { color: #761818; background: #fff0f0; border-color: #efc3c3; border-left-color: var(--danger); }

code,
kbd,
pre { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }

code {
  padding: .12rem .32rem;
  color: #472e89;
  background: #f0ecff;
  border-radius: .35rem;
  overflow-wrap: anywhere;
}

.table-scroll {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

table {
  border-spacing: 0;
  border-collapse: separate;
  font-size: .88rem;
}

caption {
  padding: .62rem .72rem;
  background: var(--surface-soft);
}

th,
td {
  padding: .5rem .65rem;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  line-height: 1.35;
  vertical-align: top;
}

th {
  color: var(--ink-soft);
  background: #f1f5fc;
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: .015em;
}

tbody tr:nth-child(even) td { background: #fbfcff; }
tbody tr:hover td { background: #f0f5ff; }
tbody tr:last-child td { border-bottom: 0; }

.sidebar-backdrop { display: none; }

@media (max-width: 56rem) {
  .app-shell { padding-inline-start: 0; }

  .sidebar {
    width: min(19rem, calc(100vw - 3rem));
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform var(--ease), visibility var(--ease);
  }

  .sidebar[data-open="true"],
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 90;
    inset: 0;
    background: rgb(12 24 48 / 45%);
  }

  .app-shell.sidebar-open .sidebar-backdrop { display: block; }

  .site-header {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: auto;
    max-height: none;
    gap: .7rem;
    overflow: visible;
    padding: .75rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
    box-shadow: 0 .35rem 1rem rgb(20 42 82 / 6%);
  }

  .site-header nav {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: .35rem;
  }

  .site-header nav form { margin: 0; padding: 0; border: 0; }

  main {
    max-width: 100%;
    min-height: auto;
    margin: 0;
    padding: 1.25rem 1rem 2rem;
  }

  .login-shell {
    grid-template-columns: 1fr;
    margin-block: 1rem;
  }

  .login-visual { min-height: 18rem; }
}

@media (max-width: 40rem) {
  .site-header nav { grid-template-columns: 1fr; }

  .cluster,
  .section-heading,
  .topbar { align-items: stretch; flex-direction: column; }

  .cluster > .button,
  .section-heading > .button { width: auto; }

  .card,
  .dashboard-hero,
  .login-shell { border-radius: 1rem; padding: 1rem; }

  .login-shell { width: calc(100% - 1rem); padding: 0; }
  .login-visual, .login-panel { padding: 1.25rem; }

  .quick-grid,
  .facts,
  .resource-grid,
  .constructor-grid { grid-template-columns: 1fr; }

  th, td { padding: .46rem .55rem; }
}

/* Integrated workspace, role navigation and learning library. */
.app-workspace { min-width: 0; }
.app-main { max-width: var(--content-width); margin: 0 auto; }
.public-main { width: 100%; max-width: none; margin: 0; padding: 0; }

.site-header {
  position: relative;
  inset: auto;
  width: 100%;
  min-height: auto;
  flex-direction: row;
  padding: .85rem max(1rem, calc((100% - 72rem) / 2));
  background: rgb(255 255 255 / 92%);
  border-right: 0;
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 .35rem 1rem rgb(20 42 82 / 5%);
}

.app-sidebar__brand { display: grid; gap: .35rem; }
.brand__text { display: grid; line-height: 1.15; }
.brand__text small { margin-top: .3rem; color: var(--muted); font-size: .68rem; font-weight: 600; }
.workspace-badge,
.role-badge,
.status-badge,
.tag {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: .25rem .55rem;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #c8d8f2;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 750;
}
.workspace-badge { margin: 0 .72rem; }
.sidebar-nav { gap: 0; }
.sidebar-nav__group { margin: 0; }
.sidebar-nav__label { margin: .35rem .75rem .22rem; }
.sidebar-nav__list { display: grid; gap: .22rem; }
.sidebar-nav__icon {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 1.9rem;
  place-items: center;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: .55rem;
  font-size: .65rem;
  font-weight: 850;
}
.sidebar-link.is-disabled { opacity: .55; }
.app-sidebar__account {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-top: auto;
  padding: .8rem .7rem;
  background: rgb(255 255 255 / 72%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}
.user-avatar {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 2.35rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-radius: .72rem;
  font-weight: 850;
}
.user-summary { display: grid; min-width: 0; line-height: 1.25; }
.user-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-summary small { color: var(--muted); }
.app-topbar__context { display: grid; }
.app-topbar__context .eyebrow { margin: 0; }
.app-topbar__actions,
.topbar-user,
.button-row,
.page-actions,
.filter-actions,
.tag-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}
.topbar-user { align-items: flex-end; flex-direction: column; gap: .1rem; line-height: 1.2; }
.app-topbar__actions form { margin: 0; }
.app-topbar__actions button { margin: 0; }
.button-quiet,
.button-secondary,
.button.secondary,
button.secondary {
  color: var(--brand-dark);
  background: #fff;
  border-color: #b8c9e6;
  box-shadow: var(--shadow-sm);
}
.button-quiet:hover,
.button-secondary:hover,
.button.secondary:hover,
button.secondary:hover { color: var(--brand-dark); background: var(--brand-soft); }

.mobile-navigation { display: none; }
.dashboard-page .app-main {
  max-width: 94rem;
  padding-top: calc(var(--app-topbar-height) + .8rem);
  padding-bottom: calc(var(--app-statusbar-height) + .8rem);
}

.dashboard-home { display: grid; gap: .7rem; }

@media (max-width: 48rem) {
  .dashboard-page .app-main {
    padding-top: calc(var(--app-topbar-height) + .65rem);
    padding-bottom: calc(var(--app-statusbar-height) + .65rem);
  }
}

.login-page {
  background:
    linear-gradient(rgb(23 78 166 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 78 166 / 5%) 1px, transparent 1px),
    #f5f8fd;
  background-size: 2rem 2rem;
}
.login-page .site-header { display: none; }
.login-page .public-main { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.login-page .login-shell { width: min(68rem, 100%); min-height: min(42rem, calc(100vh - 2rem)); margin: 0; }
.login-brand { display: inline-flex; align-items: center; gap: .75rem; margin-bottom: 4rem; text-decoration: none; }
.login-brand span {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  background: rgb(255 255 255 / 17%);
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: .85rem;
  font-size: 1.25rem;
  font-weight: 850;
}
.login-brand strong { font-size: 1.35rem; }
.login-intro { max-width: 37rem; font-size: 1.08rem; }
.login-feature-list { display: grid; gap: .75rem; margin: 2rem 0 0; padding: 0; list-style: none; }
.login-feature-list li { display: flex; align-items: center; gap: .75rem; }
.login-feature-list span { color: #fff; font-size: .72rem; font-weight: 850; opacity: .72; }
.login-panel__header { margin-bottom: .6rem; }
.login-help { display: flex; justify-content: space-between; gap: .7rem; margin-top: 1rem; font-size: .9rem; }
.login-note { margin-top: 1.6rem; color: var(--muted); font-size: .86rem; }

.page-heading,
.resource-detail,
.viewer-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.page-heading > div:first-child { max-width: 54rem; }
.page-lead { color: var(--ink-soft); font-size: 1.05rem; }
.breadcrumbs { justify-content: flex-start; margin-bottom: 1rem; color: var(--muted); font-size: .88rem; }
.library-filter-panel { margin-bottom: 2rem; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem 1rem; }
.filter-grid > div { min-width: 0; }
.filter-grid label { font-size: .83rem; }
.filter-grid input,
.filter-grid select { width: 100%; max-width: none; }
.filter-search { grid-column: span 2; }
.filter-actions { align-self: end; }
.library-distribution { margin-bottom: 2rem; }
.facet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.facet-card { padding: 1rem; background: rgb(255 255 255 / 75%); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
.facet-list,
.clean-list { margin: 0; padding: 0; list-style: none; }
.facet-list { display: grid; gap: .25rem; }
.facet-list a { display: flex; justify-content: space-between; gap: .7rem; padding: .48rem .55rem; border-radius: .55rem; text-decoration: none; }
.facet-list a:hover { background: var(--brand-soft); }
.facet-list b { color: var(--muted); font-size: .82rem; }
.resource-card { display: grid; grid-template-columns: 5rem minmax(0, 1fr); }
.resource-card__cover,
.resource-detail__cover,
.file-type-icon,
.media-card__preview {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #174ea6, #7357d9);
  font-weight: 850;
}
.resource-card__cover { min-height: 100%; }
.resource-card__body { padding: 1.15rem; }
.resource-card__meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.resource-card__authors { color: var(--muted); }
.tag-row { margin-block: .35rem; }
.tag { color: var(--ink-soft); background: #f5f7fb; border-color: var(--border-soft); }
.card-link { margin-top: auto; font-weight: 750; text-decoration: none; }
.empty-state { grid-column: 1 / -1; padding: 2rem; text-align: center; background: #fff; border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.resource-detail { justify-content: flex-start; padding: 1.5rem; background: linear-gradient(135deg, #fff, #edf3ff); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); }
.resource-detail__cover { width: 7rem; height: 9rem; flex: 0 0 7rem; border-radius: .8rem; font-size: 1.2rem; }
.content-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(17rem, .65fr); gap: 1rem; align-items: start; }
.file-action-list { display: grid; gap: .8rem; }
.file-action-card { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: .9rem; padding: .9rem; border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
.file-type-icon { width: 3.5rem; height: 4.4rem; border-radius: .6rem; background: linear-gradient(145deg, #a62727, #d94747); font-size: .72rem; }
.resource-facts dl { display: grid; gap: .25rem; }
.resource-facts dd { margin-bottom: .75rem; }
.workflow-card { margin-top: 1rem; }

.viewer-shell { overflow: hidden; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.viewer-toolbar { align-items: center; margin: 0; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-soft); }
.viewer-toolbar h1 { margin: 0; font-size: 1.2rem; }
.pdf-viewer { display: block; width: 100%; height: min(72vh, 58rem); border: 0; background: #e9edf4; }
.viewer-fallback { margin: 0; padding: .8rem 1rem; color: var(--muted); font-size: .86rem; }
.learning-viewer { overflow: hidden; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.reading-surface,
.file-preview,
.transcript-panel { padding: clamp(1rem, 3vw, 2rem); }
.video-viewer { display: grid; min-height: 20rem; place-items: center; background: #11192b; }
.video-viewer video { width: 100%; max-height: 72vh; background: #000; }
.transcript-panel { border-top: 1px solid var(--border-soft); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.media-card { display: grid; overflow: hidden; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.media-card__preview { min-height: 9rem; }
.media-card--video .media-card__preview { background: linear-gradient(145deg, #18243d, #4b3b88); }
.media-card--pdf .media-card__preview { background: linear-gradient(145deg, #9d2727, #d84e4e); }
.media-card__body { display: flex; flex-direction: column; padding: 1rem; }
.segmented-control { display: inline-flex; padding: .25rem; background: #fff; border: 1px solid var(--border-soft); border-radius: .7rem; }
.segmented-control a { padding: .45rem .7rem; border-radius: .5rem; font-weight: 700; text-decoration: none; }
.segmented-control a[aria-current="page"] { color: #fff; background: var(--brand); }

@media (max-width: 70rem) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-columns { grid-template-columns: 1fr; }
}

@media (max-width: 56rem) {
  .app-shell { padding-inline-start: 0; }
  .app-workspace { width: 100%; }
  .app-main { margin: 0 auto; }
  .app-topbar { position: relative; }
  .mobile-navigation { display: block; margin: 1rem; padding: .7rem 1rem; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
  .mobile-navigation summary { color: var(--brand-dark); font-weight: 800; cursor: pointer; }
  .mobile-navigation nav { display: grid; align-items: stretch; padding-top: .8rem; }
  .mobile-navigation section { width: 100%; }
  .mobile-navigation ul { display: grid; gap: .25rem; margin: 0 0 .8rem; padding: 0; list-style: none; }
  .mobile-navigation a,
  .mobile-navigation span { display: block; padding: .5rem; border-radius: .45rem; }
  .dashboard-hero { grid-template-columns: 1fr; }
}

@media (max-width: 40rem) {
  .topbar-user { display: none; }
  .page-heading,
  .resource-detail,
  .viewer-toolbar { align-items: stretch; flex-direction: column; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .resource-card { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .resource-detail__cover { width: 4rem; height: 5rem; flex-basis: 4rem; }
  .login-help { flex-direction: column; }
  .login-brand { margin-bottom: 2rem; }
}

@media (prefers-contrast: more) {
  :root { --border: #7585a2; --border-soft: #98a5ba; }

  .card,
  .quick-card,
  .resource-card,
  .video-card,
  .pdf-card,
  .constructor-card,
  .table-scroll,
  input,
  select,
  textarea { border-width: 2px; }

  .eyebrow, dt, .helptext { color: #34415a; }
}

@media (forced-colors: active) {
  .site-header,
  .sidebar,
  .card,
  .quick-card,
  .dashboard-hero,
  .login-shell,
  .login-visual,
  .login-panel,
  .resource-card,
  .video-card,
  .pdf-card,
  .constructor-card,
  .table-scroll,
  .message,
  .notice,
  .warning,
  button,
  .button {
    color: CanvasText;
    background: Canvas;
    border: 1px solid CanvasText;
    box-shadow: none;
    forced-color-adjust: auto;
  }

  .brand::before {
    color: ButtonText;
    background: ButtonFace;
    border: 1px solid ButtonText;
  }

  .site-header nav a:hover,
  .sidebar-link:hover,
  .sidebar-link[aria-current="page"] { color: HighlightText; background: Highlight; }

  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible { outline-color: Highlight; }
}

@media print {
  body { background: #fff; }

  .site-header,
  .sidebar,
  .topbar,
  .skip-link,
  button,
  .button { display: none !important; }

  main,
  .app-shell { width: 100%; max-width: none; margin: 0; padding: 0; }

  .card,
  .quick-card,
  .dashboard-hero,
  .table-scroll { break-inside: avoid; box-shadow: none; }
}

/* Refined authenticated workspace shell. */
:root {
  --sidebar-collapsed-width: 4.65rem;
  --app-topbar-height: 4.6rem;
  --app-statusbar-height: 2rem;
}

.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

.icon,
.ui-icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  fill: currentcolor;
}

.app-shell {
  --sidebar-current-width: var(--sidebar-width);
  min-height: 100dvh;
  padding-inline-start: var(--sidebar-current-width);
  transition: padding-inline-start 180ms ease;
}

.app-workspace { min-height: 100dvh; }

.app-sidebar {
  display: grid;
  width: var(--sidebar-current-width);
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .7rem;
  overflow: hidden;
  padding: .85rem .72rem;
  background: rgb(250 252 255 / 98%);
  box-shadow: .3rem 0 1.4rem rgb(24 55 105 / 5%);
  transition: width 180ms ease, transform 180ms ease;
}

.app-sidebar__brand {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: .35rem;
  padding-bottom: .35rem;
}

.app-sidebar__brand .brand {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: .45rem;
  font-weight: 600;
}

.app-sidebar__brand .brand__text,
.app-sidebar__brand .brand__text strong,
.app-sidebar__brand .brand__text small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar__brand .sidebar-collapse-button {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.app-sidebar__brand .workspace-badge {
  grid-column: 1 / -1;
  grid-row: 2;
  max-width: calc(100% - .9rem);
  margin: 0 .45rem;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  --icon-button-size: 2.35rem;
  display: inline-flex;
  width: var(--icon-button-size);
  min-width: var(--icon-button-size);
  max-width: var(--icon-button-size);
  height: var(--icon-button-size);
  min-height: var(--icon-button-size);
  max-height: var(--icon-button-size);
  flex: 0 0 var(--icon-button-size);
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: .65rem;
  box-shadow: none;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
}

.icon-button > svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  margin: 0;
}

.icon-button:hover {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: var(--border-soft);
  box-shadow: none;
  transform: none;
}

.icon-button:focus-visible,
.sidebar-nav__label:focus-visible,
.sidebar-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 4px #fff;
}

.sidebar-nav {
  display: flex;
  flex-flow: column nowrap;
  align-items: stretch;
  align-content: stretch;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: .2rem .08rem .8rem;
  scrollbar-width: thin;
}

.sidebar-nav__group {
  display: block;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  padding: .18rem 0;
  border: 0;
}

.sidebar-nav__group + .sidebar-nav__group { border-top: 0; }

.sidebar-nav__label,
.sidebar-group > .sidebar-nav__label:first-child {
  display: flex;
  min-height: 2rem;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: .15rem .45rem;
  padding: .36rem .42rem;
  color: var(--muted);
  border-radius: .5rem;
  font-size: .71rem;
  font-weight: 500;
  letter-spacing: .025em;
  list-style: none;
  text-transform: none;
  cursor: pointer;
}

.sidebar-nav__label::-webkit-details-marker { display: none; }
.sidebar-nav__label::marker { content: ""; }
.sidebar-nav__label:hover { color: var(--ink-soft); background: rgb(227 235 248 / 55%); }
.sidebar-nav__label-main { display: inline-flex; min-width: 0; align-items: center; gap: .48rem; }
.sidebar-nav__group-icon { width: .92rem; height: .92rem; flex: 0 0 .92rem; color: #7888a0; }
.sidebar-nav__chevron { width: .78rem; height: .78rem; transition: transform 160ms ease; }
.sidebar-nav__group:not([open]) .sidebar-nav__chevron { transform: rotate(-90deg); }
.sidebar-nav__standalone { width: 100%; padding: .1rem 0 .22rem; }
.sidebar-nav__list {
  grid-template-columns: minmax(0, 1fr);
  gap: .08rem;
  padding-bottom: .3rem;
}

.sidebar-link {
  min-height: 2.45rem;
  gap: .65rem;
  padding: .5rem .6rem;
  border-radius: .65rem;
  font-size: .875rem;
  font-weight: 450;
  letter-spacing: 0;
}

.sidebar-link:hover,
.sidebar-link[aria-current="page"] {
  background: rgb(231 239 252 / 75%);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.sidebar-link[aria-current="page"] { color: var(--brand-dark); font-weight: 560; }

.sidebar-nav__icon {
  width: 1.08rem;
  height: 1.08rem;
  flex-basis: 1.08rem;
  padding: 0;
  color: #61718c;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: inherit;
  font-weight: inherit;
}

.sidebar-link:hover .sidebar-nav__icon,
.sidebar-link[aria-current="page"] .sidebar-nav__icon { color: var(--brand); }

.app-sidebar__account {
  margin-top: 0;
  padding: .55rem;
  background: transparent;
  border-color: transparent;
  border-top-color: var(--border-soft);
  border-radius: 0;
}

.app-sidebar__account .user-avatar {
  width: 2rem;
  height: 2rem;
  flex-basis: 2rem;
  border-radius: .62rem;
  font-size: .78rem;
  font-weight: 600;
}

.user-summary strong,
.topbar-user strong,
.app-topbar__context strong { font-weight: 550; }

.app-topbar {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  left: var(--sidebar-current-width);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  height: var(--app-topbar-height);
  min-height: var(--app-topbar-height);
  align-items: center;
  gap: 1rem;
  overflow: hidden;
  padding: .62rem clamp(1rem, 3vw, 2rem);
  transition: left 180ms ease;
}

.app-topbar__context { display: flex; min-width: 0; align-items: center; gap: .7rem; }
.app-topbar__titles { display: grid; min-width: 0; line-height: 1.2; }
.app-topbar__titles .eyebrow,
.app-topbar__titles strong,
.topbar-user strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-topbar__actions {
  min-width: 0;
  flex-wrap: nowrap;
  justify-self: end;
}
.topbar-back-button {
  display: inline-flex;
  min-width: max-content;
  min-height: 2.25rem;
  flex: 0 0 auto;
  align-items: center;
  gap: .35rem;
  padding: .38rem .58rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: .58rem;
  font-size: .82rem;
  font-weight: 550;
  line-height: 1;
  text-decoration: none;
}
.topbar-back-button:hover { color: var(--brand-dark); background: var(--brand-soft); }
.sidebar-menu-button { display: none; }

.app-main {
  width: auto;
  max-width: var(--content-width);
  min-height: 100dvh;
  margin: 0 auto;
  padding-top: calc(var(--app-topbar-height) + clamp(1.25rem, 3vw, 2.75rem));
  padding-bottom: calc(var(--app-statusbar-height) + clamp(1.25rem, 3vw, 2.75rem));
}

.app-statusbar {
  position: fixed;
  z-index: 79;
  right: 0;
  bottom: 0;
  left: var(--sidebar-current-width);
  display: flex;
  height: var(--app-statusbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  color: var(--muted);
  background: rgb(250 252 255 / 94%);
  border-top: 1px solid var(--border-soft);
  font-size: .72rem;
  transition: left 180ms ease;
  backdrop-filter: blur(.8rem);
}

.app-statusbar__item { display: inline-flex; align-items: center; gap: .4rem; }
.app-statusbar .ui-icon { width: .84rem; height: .84rem; color: var(--success); }

.app-shell.is-sidebar-collapsed { --sidebar-current-width: var(--sidebar-collapsed-width); }
.is-sidebar-collapsed .brand__text,
.is-sidebar-collapsed .workspace-badge,
.is-sidebar-collapsed .sidebar-nav__group-text,
.is-sidebar-collapsed .sidebar-nav__chevron,
.is-sidebar-collapsed .sidebar-nav__text,
.is-sidebar-collapsed .user-summary { display: none; }
.is-sidebar-collapsed .app-sidebar__brand {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  justify-items: center;
}
.is-sidebar-collapsed .app-sidebar__brand .brand {
  grid-column: 1;
  grid-row: 1;
  justify-content: center;
}
.is-sidebar-collapsed .app-sidebar__brand .brand::before { margin: 0; }
.is-sidebar-collapsed .sidebar-collapse-button {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
}
.is-sidebar-collapsed .sidebar-nav__group { border-top: 1px solid var(--border-soft); }
.is-sidebar-collapsed .sidebar-nav__group:first-child { border-top: 0; }
.is-sidebar-collapsed .sidebar-nav__label {
  min-height: 2.15rem;
  justify-content: center;
  margin: .14rem .4rem;
  padding: .38rem;
}
.is-sidebar-collapsed .sidebar-nav__group-icon { width: 1rem; height: 1rem; color: var(--muted); }
.is-sidebar-collapsed .sidebar-nav__group > .sidebar-nav__list { display: grid !important; }
.is-sidebar-collapsed .sidebar-link { justify-content: center; padding-inline: .5rem; }
.is-sidebar-collapsed .app-sidebar__account { justify-content: center; }

@media (max-width: 56rem) {
  .app-shell { --sidebar-current-width: 0rem; padding-inline-start: 0; }
  .app-sidebar {
    width: min(18rem, calc(100vw - 3rem));
    visibility: hidden;
    transform: translateX(-105%);
  }
  .app-shell.is-sidebar-open .app-sidebar {
    visibility: visible;
    transform: translateX(0);
  }
  .sidebar-collapse-button { display: none; }
  .sidebar-menu-button { display: inline-flex; }
  .app-topbar { left: 0; position: fixed; }
  .app-statusbar { left: 0; }
  .app-shell.is-sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    z-index: 90;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: rgb(12 24 48 / 42%);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .app-sidebar { z-index: 100; }
  .mobile-navigation { display: none; }
}

@media (max-width: 70rem) {
  .app-topbar .topbar-user { display: none; }
}

@media (max-width: 40rem) {
  .app-topbar__context .eyebrow { display: none; }
  .topbar-back-button {
    width: 2.25rem;
    min-width: 2.25rem;
    padding: 0;
    justify-content: center;
  }
  .topbar-back-button span { display: none; }
  .app-statusbar__role { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .app-sidebar,
  .app-topbar,
  .app-statusbar,
  .sidebar-nav__chevron { transition: none; }
}

@media print {
  .app-statusbar,
  .sidebar-backdrop { display: none !important; }
}

/* Settings workspace and account registry. */
.settings-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: .75rem;
}

.settings-tabs {
  position: sticky;
  z-index: 12;
  top: calc(var(--app-topbar-height) + .5rem);
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  min-width: 0;
  gap: .28rem;
  padding: .4rem;
  background: rgb(250 252 255 / 96%);
  border: 1px solid var(--border-soft);
  border-radius: .85rem;
  box-shadow: 0 .35rem 1.2rem rgb(24 55 105 / 5%);
  backdrop-filter: blur(.8rem);
}

.settings-tabs__intro {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0 .2rem .25rem;
  padding: .35rem .45rem .55rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.settings-tab,
.settings-subtab {
  display: inline-flex;
  min-height: 2.25rem;
  flex: 0 0 auto;
  align-items: center;
  gap: .5rem;
  padding: .44rem .58rem;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: .58rem;
  font-size: .84rem;
  font-weight: 450;
  line-height: 1.2;
  text-decoration: none;
}

.settings-tab {
  width: 100%;
  min-width: 0;
  min-height: 2.55rem;
  justify-content: center;
  margin: 0;
  padding: .48rem;
}
.settings-tab .ui-icon { width: 1.08rem; height: 1.08rem; color: #687891; }
.settings-tab:hover,
.settings-subtab:hover { color: var(--brand-dark); background: var(--brand-soft); }

.settings-tab.is-active,
.settings-subtab.is-active {
  color: var(--brand-dark);
  background: #fff;
  border-color: #d7e1f1;
  box-shadow: 0 .22rem .7rem rgb(24 55 105 / 7%);
}
.settings-tab.is-active .ui-icon { color: var(--brand); }

.settings-panel {
  min-width: 0;
  padding: 1rem;
}
.settings-panel > .panel__header {
  min-height: 3.4rem;
  margin-bottom: .85rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--border-soft);
}
.settings-panel__heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .7rem;
}
.settings-panel__heading h2 { margin: 0; font-size: 1.12rem; font-weight: 600; }
.settings-panel__heading p { margin: .15rem 0 0; font-size: .83rem; }
.settings-panel__icon,
.settings-card__icon {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 2.15rem;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: .62rem;
}

.settings-subtabs {
  display: flex;
  max-width: 100%;
  gap: .25rem;
  margin: 0 0 .8rem;
  padding: .3rem;
  overflow-x: auto;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: .72rem;
}
.settings-subtab { white-space: nowrap; }
.settings-subtab.is-active { box-shadow: none; }

.settings-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: .65rem;
}
.settings-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  min-height: 4.25rem;
  padding: .7rem;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: .72rem;
}
.settings-card__icon { width: 1.9rem; height: 1.9rem; flex-basis: 1.9rem; }
.settings-card__content { min-width: 0; }
.settings-card h3 { margin: 0; font-size: .9rem; font-weight: 580; }
.settings-card p {
  margin: .15rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .79rem;
  text-overflow: ellipsis;
}

.settings-user-cell { display: inline-flex; align-items: center; gap: .5rem; }
.settings-user-avatar {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 1.75rem;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: .5rem;
  font-size: .72rem;
  font-weight: 650;
}
.settings-panel th,
.settings-panel td { padding: .45rem .55rem; vertical-align: middle; }

@media (max-width: 42rem) {
  .settings-tabs { gap: .16rem; padding: .28rem; }
  .settings-tab { min-height: 2.3rem; padding: .35rem; }
  .settings-panel { padding: .75rem; }
  .settings-panel > .panel__header { align-items: flex-start; }
  .settings-panel__heading { align-items: flex-start; }
  .settings-card { grid-template-columns: auto minmax(0, 1fr); }
  .settings-card > .status-chip { grid-column: 2; justify-self: start; }
}

.registry-heading,
.form-actions,
.table-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.registry-heading { justify-content: space-between; margin: .75rem 0; }
.registry-heading h3 { margin: 0; font-weight: 550; }
.registry-heading p { margin: .2rem 0 0; }
.form-actions { min-width: 0; flex-wrap: wrap; }
.table-actions { min-width: max-content; }
.table-actions .icon-button { --icon-button-size: 2rem; }
.icon-button--danger { color: var(--danger); }
.icon-button--danger:hover { color: #8f1c28; background: #fff0f1; }

.content-tabs { position: sticky; top: var(--topbar-height); z-index: 6; display: flex; gap: .35rem; padding: .45rem; margin: 0 0 1rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 1rem; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.content-tabs a { white-space: nowrap; padding: .55rem .8rem; border-radius: .7rem; color: var(--muted); text-decoration: none; }
.content-tabs a:hover { color: var(--brand); background: var(--brand-soft); }
.journal-legend { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .82rem; }
.journal-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.journal-scroll { border: 1px solid var(--line); border-radius: .85rem; }
.journal-table { min-width: 900px; border-collapse: separate; border-spacing: 0; }
.journal-table th, .journal-table td { min-width: 7.4rem; padding: .48rem; text-align: center; vertical-align: middle; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.journal-table thead th { vertical-align: top; background: var(--surface-subtle); }
.journal-table__student { position: sticky; left: 0; z-index: 2; min-width: 10rem !important; max-width: 13rem; text-align: left !important; background: var(--surface) !important; }
.journal-table thead .journal-table__student { z-index: 3; background: var(--surface-subtle) !important; }
.journal-date, .journal-topic { display: block; }
.journal-date { color: var(--brand); font-size: 1rem; }
.journal-topic { margin-top: .4rem; font-size: .72rem; font-weight: 500; line-height: 1.25; }
.journal-mark { display: block; font-size: 1.05rem; color: var(--ink); }
.journal-mark--empty { color: var(--muted); font-weight: 400; }
.status-dot { display: inline-block; width: .5rem; height: .5rem; margin: .28rem; border-radius: 50%; background: #a8b0bc; }
.status-dot--present { background: #1c9a6b; }
.status-dot--absent { background: #d15b63; }
.status-dot--unknown { background: #a8b0bc; }
.icon-button.icon-button--small { --icon-button-size: 1.7rem; }
.risk-pill { display: inline-flex; padding: .3rem .55rem; border-radius: 999px; font-size: .76rem; background: #e9f7f1; color: #14734f; }
.risk-pill--1, .risk-pill--2 { background: #fff5d8; color: #825f00; }
.risk-pill--3, .risk-pill--4, .risk-pill--5 { background: #ffebed; color: #9e2935; }
@media print { .app-sidebar, .app-topbar, .app-footer, .button { display: none !important; } .app-main { margin: 0 !important; padding: 0 !important; } }
.status-chip--muted { color: var(--muted); background: var(--surface-soft); }
.form-panel { max-width: 47rem; }
.form-panel form > div { margin-bottom: .85rem; }
.form-panel .form-actions { margin-top: 1.15rem; margin-bottom: 0; }
.form-actions button:not(.icon-button),
.form-actions .button:not(.icon-button) { display: inline-flex; flex: 0 1 auto; min-width: 0; max-width: 100%; align-items: center; gap: .45rem; margin: 0; }
.button.compact { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.3rem; padding: .45rem .7rem; font-size: .84rem; }
.form-note { margin: 1rem 0 0; color: var(--muted); font-size: .82rem; }

@media (max-width: 42rem) {
  .registry-heading { align-items: flex-start; flex-direction: column; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions button:not(.icon-button),
  .form-actions .button:not(.icon-button) { width: 100%; justify-content: center; }
}

/* Accessible modal dialogs. */
body.has-modal-open { overflow: hidden; }

.app-modal {
  --modal-max-height: min(52rem, calc(100dvh - 2rem));
  width: min(42rem, calc(100vw - 2rem));
  min-width: 0;
  max-width: none;
  max-height: var(--modal-max-height);
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.app-modal:not([open]) { display: none; }

.app-modal::backdrop {
  background: rgb(13 26 49 / 38%);
  backdrop-filter: blur(.18rem);
}

.app-modal__surface {
  display: flex;
  min-width: 0;
  min-height: 0;
  max-height: var(--modal-max-height);
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgb(213 222 237 / 90%);
  border-radius: 1rem;
}

.app-modal__header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.2rem .95rem;
  border-bottom: 1px solid var(--border-soft);
}

.app-modal__heading {
  min-width: 0;
  max-height: min(12rem, 30dvh);
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.app-modal__title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 560;
  line-height: 1.3;
}

.app-modal__description,
.app-modal__message {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.app-modal__close { align-self: flex-start; }

.app-modal__form {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.app-modal__body {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  padding: 1.15rem 1.2rem;
  overflow: auto;
  overflow-wrap: anywhere;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.app-modal__body > :first-child { margin-top: 0; }
.app-modal__body > :last-child { margin-bottom: 0; }
.app-modal__body form { min-width: 0; max-width: 100%; margin: 0; }
.app-modal__body input:not([type="checkbox"]):not([type="radio"]),
.app-modal__body select,
.app-modal__body textarea { min-width: 0; max-width: 100%; }
.app-modal__body .form-actions { flex-flow: row wrap; align-items: center; }
.app-modal__body .form-actions > *:not(.icon-button) { width: auto; max-width: 100%; }

.app-modal__footer {
  position: static;
  display: flex;
  min-width: 0;
  max-height: 35dvh;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  overflow: auto;
  padding: .85rem 1.2rem 1rem;
  background: var(--surface-soft);
  border-top: 1px solid var(--border-soft);
}

.app-modal__footer .button:not(.icon-button),
.app-modal__footer button:not(.icon-button) {
  display: inline-flex;
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 2.5rem;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.button-danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.button-danger:hover {
  color: #fff;
  background: #7f1721;
  border-color: #7f1721;
}

.app-modal__form[aria-busy="true"] { cursor: progress; }

@media (max-width: 34rem) {
  .app-modal {
    --modal-max-height: calc(100dvh - 1rem);
    width: calc(100vw - 1rem);
  }
  .app-modal__header,
  .app-modal__body { padding-inline: 1rem; }
  .app-modal__footer {
    padding-inline: 1rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .app-modal[open] .app-modal__surface {
    animation: app-modal-enter 160ms ease-out;
  }
  @keyframes app-modal-enter {
    from { opacity: 0; transform: translateY(.35rem) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

@media print {
  .app-modal,
  .app-modal::backdrop { display: none !important; }
}

/* Shared registry search and pagination. */
.registry-toolbar {
  display: grid;
  gap: .42rem;
  margin: 0 0 1rem;
  padding: .85rem;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: .8rem;
}

.registry-toolbar > label { color: var(--ink-soft); font-size: .8rem; font-weight: 520; }
.registry-toolbar__search,
.registry-toolbar__controls { display: flex; align-items: center; gap: .5rem; }
.registry-toolbar__search input,
.registry-toolbar__controls input { min-width: 12rem; max-width: none; flex: 1 1 22rem; }
.registry-toolbar__search button:not(.icon-button),
.registry-toolbar__search .button:not(.icon-button),
.registry-toolbar__controls button:not(.icon-button),
.registry-toolbar__controls .button:not(.icon-button),
.registry-toolbar > button:not(.icon-button),
.filter-actions button:not(.icon-button) {
  display: inline-flex;
  width: auto;
  min-width: 6rem;
  min-height: 2.25rem;
  align-items: center;
  justify-self: start;
  margin: 0;
  padding: .44rem .68rem;
  font-size: .84rem;
}

.registry-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--border-soft);
  font-size: .82rem;
}

.registry-pagination__summary { margin: 0; color: var(--muted); }
.registry-pagination__sizes,
.registry-pagination__pages { display: flex; align-items: center; gap: .32rem; }
.registry-pagination a:not(.icon-button) {
  display: inline-flex;
  min-width: 1.9rem;
  min-height: 1.9rem;
  align-items: center;
  justify-content: center;
  padding: .25rem .42rem;
  border-radius: .48rem;
  text-decoration: none;
}
.registry-pagination a.is-current { color: #fff; background: var(--brand); }
.registry-pagination .icon-button { --icon-button-size: 1.9rem; }

@media (max-width: 48rem) {
  .registry-pagination { align-items: flex-start; flex-direction: column; }
  .registry-toolbar__search,
  .registry-toolbar__controls { align-items: stretch; flex-wrap: wrap; }
  .registry-toolbar__search input,
  .registry-toolbar__controls input { width: 100%; flex-basis: 100%; }
  .registry-toolbar__search button:not(.icon-button),
  .registry-toolbar__search .button:not(.icon-button),
  .registry-toolbar__controls button:not(.icon-button),
  .registry-toolbar__controls .button:not(.icon-button) { width: auto; }
}

/* Course and assessment constructors. */
.course-builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: .85rem;
}

.builder-card {
  display: grid;
  gap: .75rem;
  padding: 1rem;
  background: linear-gradient(145deg, #fff, var(--surface-soft));
  border: 1px solid var(--border-soft);
  border-radius: .9rem;
  box-shadow: 0 .3rem 1rem rgb(24 55 105 / 5%);
}

.builder-card__head,
.builder-card__meta,
.builder-card__links {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
}

.builder-card h3 { margin: .2rem 0 0; font-size: 1rem; font-weight: 560; }
.builder-card__icon { width: 1.5rem; height: 1.5rem; color: var(--brand); }
.builder-card__meta { align-items: center; color: var(--muted); font-size: .8rem; }
.builder-card__links { justify-content: flex-start; flex-wrap: wrap; font-size: .84rem; }
.builder-card__subjects { display: grid; gap: .3rem; color: var(--ink-soft); font-size: .78rem; }
.video-viewer video { width: 100%; max-height: 70dvh; background: #0c1422; border-radius: .8rem; }
.pdf-viewer { width: 100%; min-height: 72dvh; border: 1px solid var(--border-soft); border-radius: .8rem; }
.transcript-panel { margin-top: 1rem; padding: 1rem; background: var(--surface-soft); border-radius: .8rem; }
