:root {
  --soft: var(--ink-soft);
  --faint: var(--ink-faint);
  --shadow: var(--shadow-sm);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1200;
  transform: translateY(-160%);
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: .8125rem;
}
.skip-link:focus { transform: translateY(0); }

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); background: var(--paper); }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 45;
  width: var(--sidebar-width);
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: color-mix(in oklch, var(--surface) 88%, var(--paper));
  display: flex;
  flex-direction: column;
}
.brand {
  min-height: var(--topbar-height);
  padding: 16px 19px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--brand);
}
.brand-mark::before { content: ""; width: 10px; height: 10px; background: currentColor; transform: rotate(45deg); }
.brand strong,
.brand small { display: block; }
.brand strong { font: 600 1.0625rem/1.05 "Source Serif 4", serif; }
.brand small { margin-top: 4px; color: var(--ink-faint); font: 400 .53125rem "IBM Plex Mono", monospace; letter-spacing: .15em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 17px 12px; }
.nav-group + .nav-group { margin-top: 21px; }
.nav-label { margin: 0 9px 8px; color: var(--ink-faint); font: 400 .5625rem "IBM Plex Mono", monospace; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-nav .nav-item {
  width: 100%;
  min-height: 38px;
  margin: 2px 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: .8125rem;
  text-align: left;
  cursor: pointer;
}
.sidebar-nav .nav-item:hover { background: var(--surface-muted); color: var(--ink); }
.sidebar-nav .nav-item.active { border-color: color-mix(in oklch, var(--brand) 16%, var(--line)); background: var(--brand-soft); color: var(--brand-deep); }
.nav-glyph { width: 19px; flex: 0 0 19px; color: currentColor; font: 400 .6875rem "IBM Plex Mono", monospace; text-align: center; }
.sidebar-foot { padding: 14px 19px 18px; border-top: 1px solid var(--line); }
.sidebar-foot strong { display: block; color: var(--ink-soft); font: 500 .59375rem "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-foot span { display: block; margin-top: 5px; color: var(--ink-faint); font-size: .6875rem; line-height: 1.5; }

.main { min-width: 0; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-height); border-bottom: 1px solid var(--line); background: color-mix(in oklch, var(--paper) 92%, transparent); backdrop-filter: blur(12px); }
.topbar-inner { height: 100%; padding: 11px 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar-context { min-width: 0; }
.eyebrow,
.kicker { color: var(--brand); font: 400 .59375rem "IBM Plex Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.topbar-title { margin: 3px 0 0; overflow: hidden; color: var(--ink); font: 600 1.1875rem/1.1 "Source Serif 4", serif; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.languages { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); flex-wrap: nowrap; }
.alberuni-app .languages button { min-width: 34px; height: 28px; min-height: 28px; padding: 0 8px; border: 0; border-radius: 3px; background: transparent; font: 400 .65625rem "IBM Plex Mono", monospace; }
.alberuni-app .languages button.active { background: var(--brand); color: #fff; }
.identity { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.identity strong,
.identity small { display: block; }
.user-avatar { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: .625rem; font-weight: 600; }
.identity strong { max-width: 190px; overflow: hidden; font-size: .75rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.identity small { max-width: 190px; margin-top: 1px; overflow: hidden; color: var(--ink-faint); font-size: .65625rem; text-overflow: ellipsis; white-space: nowrap; }

.notice { margin: 12px 28px 0; }
.teacher-workspace { width: min(1440px, 100%); margin: 0 auto; padding: var(--space-6) 28px 80px; }
.page-head { padding-bottom: 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head h2 { margin: 7px 0 0; font: 600 clamp(1.75rem, 3vw, 2.375rem)/1.08 "Source Serif 4", serif; letter-spacing: -.015em; }
.page-head p { max-width: 70ch; margin: 10px 0 0; color: var(--ink-soft); font-size: .84375rem; line-height: 1.6; }

.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.metric { min-width: 0; padding: 15px 16px; }
.metric strong { display: block; font: 600 1.6875rem/1 "Source Serif 4", serif; }
.metric span { display: block; min-height: 30px; margin-top: 7px; color: var(--ink-faint); font-size: .71875rem; line-height: 1.4; }
.metric.attention { border-top: 2px solid var(--warning); }
.grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 18px; align-items: start; }
.panel { padding: 20px 22px; }
.panel h3 { margin: 0; font: 600 1.25rem "Source Serif 4", serif; }
.panel > p { color: var(--ink-soft); font-size: .8125rem; line-height: 1.55; }
.panel-head { margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.stack { display: grid; gap: 9px; }
.row { padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.row-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.row strong { font-size: .875rem; }
.row p { margin: 5px 0 0; color: var(--ink-soft); font-size: .8125rem; line-height: 1.5; }
.meta { color: var(--ink-faint); font: 400 .65625rem "IBM Plex Mono", monospace; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tabs { margin: 0 0 16px; }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.list { display: grid; gap: 8px; align-content: start; }
.select-row { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.select-row:hover { border-color: color-mix(in oklch, var(--brand) 40%, var(--line)); }
.select-row.active { border-color: var(--brand); box-shadow: var(--focus); }
.select-row p { margin: 5px 0 8px; color: var(--ink-soft); font-size: .75rem; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; }
.check { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); display: flex; align-items: flex-start; gap: 8px; color: var(--ink-soft); font-size: .75rem; line-height: 1.45; }
.check input { margin-top: 2px; accent-color: var(--brand); }
.content-block { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-muted); color: var(--ink-soft); font: 400 .8125rem/1.65 "IBM Plex Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.audit { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 145px 160px minmax(0, 1fr); gap: 12px; color: var(--ink-soft); font-size: .75rem; line-height: 1.45; }
.audit:last-child { border-bottom: 0; }
.capabilities { display: flex; gap: 8px; flex-wrap: wrap; }
.capability { padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-muted); color: var(--ink-soft); font-size: .6875rem; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split,
  .grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .shell { display: block; padding-bottom: 68px; }
  .sidebar { position: fixed; inset: auto 0 0; width: 100%; height: auto; padding-bottom: env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--line); display: block; background: color-mix(in oklch, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
  .brand,
  .nav-label,
  .sidebar-foot { display: none; }
  .sidebar-nav { width: 100%; padding: 6px 8px; overflow-x: auto; overflow-y: hidden; display: flex; scrollbar-width: none; }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-group,
  .nav-group + .nav-group { width: max-content; margin: 0 0 0 3px; display: flex; gap: 3px; }
  .nav-group:first-child { margin-left: 0; }
  .sidebar-nav .nav-item { width: auto; min-width: 92px; min-height: 49px; margin: 0; padding: 6px 8px; flex-direction: column; justify-content: center; gap: 2px; font-size: .65625rem; text-align: center; }
  .nav-glyph { width: auto; flex-basis: auto; font-size: .625rem; }
  .topbar-inner { padding-inline: 18px; }
  .identity small { display: none; }
  .identity strong { max-width: 120px; }
}

@media (max-width: 720px) {
  .topbar-actions { gap: 7px; }
  .topbar-context { max-width: 35vw; }
  .identity { display: none; }
  .teacher-workspace { padding: 24px 16px 76px; }
  .notice { margin-inline: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .wide { grid-column: auto; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 13px; }
  .page-head > .button { width: 100%; justify-content: center; }
  .audit { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .row-line { align-items: stretch; flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar .button { flex: 1 1 auto; text-align: center; }
}

@media (max-width: 430px) {
  .topbar-inner { padding-inline: 14px; }
  .topbar-title { font-size: 1.0625rem; }
  .eyebrow { font-size: .5rem; }
  .nav-group,
  .nav-group + .nav-group { gap: 1px; margin-left: 1px; }
  .nav-group:first-child { margin-left: 0; }
  .sidebar-nav .nav-item { min-width: 68px; padding-inline: 4px; font-size: .5625rem; }
  .metrics { gap: 8px; }
  .metric { padding: 13px; }
  .metric strong { font-size: 1.5rem; }
}
