/* استوديو المدرس — شكل واحد لصفحات إنشاء وتعديل الكورس والدرس والقسم والامتحان.
 *
 * Every colour comes from the platform template's --tc-* tokens, so the same
 * markup is right on a light template and a dark one; nothing here is a fixed
 * brand colour except the three semantic ones (success, warning, danger).
 * The base layout forces form controls to --tc-surface with !important on dark
 * templates, which is why the control rules below carry !important too.
 * No gradients, no glow, no emoji: the owner calls that the "AI look".
 */

.sd {
  --sd-bg: var(--tc-bg, #f6f7f9);
  --sd-surface: var(--tc-surface, #fff);
  --sd-text: var(--tc-text, #111827);
  --sd-muted: var(--tc-text-secondary, #6b7280);
  --sd-line: var(--tc-border, #e5e7eb);
  --sd-primary: var(--tc-primary, #2563eb);
  --sd-ink: var(--tc-primary-ink, #fff);
  --sd-field: color-mix(in srgb, var(--sd-surface) 92%, var(--sd-text) 8%);
  --sd-soft: color-mix(in srgb, var(--sd-primary) 9%, var(--sd-surface));
  --sd-radius: var(--tc-radius-card, 14px);
  --sd-radius-in: var(--tc-radius-input, 10px);
  --sd-radius-btn: var(--tc-radius-button, 10px);
  /* The fixed semantic colours, pulled toward the text colour: darker on a
     light template, lighter on a dark one, so they stay readable on both. */
  --sd-ok: color-mix(in srgb, #1f7a4d 72%, var(--sd-text));
  --sd-warn: color-mix(in srgb, #b7791f 72%, var(--sd-text));
  --sd-danger: color-mix(in srgb, #b42318 72%, var(--sd-text));
  color: var(--sd-text);
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1rem 6.5rem;
}

/* A class that sets display must not beat the hidden attribute. */
.sd [hidden] { display: none !important; }

/* ---------- Header ---------- */
.sd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--sd-surface);
  border: 1px solid var(--sd-line);
  border-inline-start: 4px solid var(--sd-primary);
  border-radius: var(--sd-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.sd-crumbs { font-size: .8125rem; color: var(--sd-muted); margin-bottom: .25rem; display: flex; gap: .375rem; flex-wrap: wrap; }
.sd-crumbs a { color: var(--sd-muted); text-decoration: none; }
.sd-crumbs a:hover { color: var(--sd-primary); text-decoration: underline; }
.sd-title { font-size: 1.375rem; font-weight: var(--tc-heading-weight, 700); margin: 0; line-height: 1.35; color: var(--sd-text); }
.sd-sub { margin: .25rem 0 0; color: var(--sd-muted); font-size: .875rem; }
.sd-head__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.sd-meta { display: flex; gap: .375rem; flex-wrap: wrap; margin-top: .5rem; }

/* ---------- Layout ---------- */
.sd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
.sd-main { display: grid; gap: 1rem; min-width: 0; }
.sd-aside { display: grid; gap: 1rem; position: sticky; top: 5.5rem; min-width: 0; }
.sd--narrow .sd-grid { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin: 0 auto; }
@media (max-width: 960px) {
  .sd-grid { grid-template-columns: minmax(0, 1fr); }
  .sd-aside { position: static; }
}

/* ---------- Cards ---------- */
.sd-card {
  background: var(--sd-surface);
  border: 1px solid var(--sd-line);
  border-radius: var(--sd-radius);
  padding: 1.125rem 1.25rem 1.25rem;
  min-width: 0;
}
.sd-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.sd-card__title { display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 700; margin: 0; color: var(--sd-text); }
.sd-card__title .ei { width: 18px; height: 18px; color: var(--sd-primary); flex: none; }
.sd-card__hint { margin: .2rem 0 0; font-size: .8125rem; color: var(--sd-muted); line-height: 1.6; }
.sd-card--soft { background: var(--sd-soft); border-color: color-mix(in srgb, var(--sd-primary) 25%, var(--sd-line)); }
.sd-card--danger { border-color: color-mix(in srgb, var(--sd-danger) 45%, var(--sd-line)); }
.sd-card--danger .sd-card__title .ei { color: var(--sd-danger); }
.sd-card--flush { padding: 0; }
.sd-card--flush > :first-child { border-start-start-radius: inherit; border-start-end-radius: inherit; }
.sd-card--flush > :last-child { border-end-start-radius: inherit; border-end-end-radius: inherit; }
.sd-menu[open] { z-index: 35; }

/* ---------- Fields ---------- */
.sd-field { display: grid; gap: .375rem; margin-bottom: 1rem; min-width: 0; }
.sd-field:last-child { margin-bottom: 0; }
.sd-label { font-weight: 600; font-size: .875rem; color: var(--sd-text); }
.sd-label .req { color: var(--sd-danger); margin-inline-start: .125rem; }
.sd-label .opt { color: var(--sd-muted); font-weight: 400; font-size: .8125rem; }
.sd-help { font-size: .8125rem; color: var(--sd-muted); line-height: 1.6; margin: 0; }
.sd-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .875rem; }
.sd-row > .sd-field { margin-bottom: 0; }

.sd input[type="text"], .sd input[type="number"], .sd input[type="url"], .sd input[type="email"],
.sd input[type="datetime-local"], .sd input[type="date"], .sd input[type="time"], .sd input[type="search"],
.sd select, .sd textarea {
  width: 100%;
  min-height: 44px;
  padding: .625rem .875rem;
  border: 1px solid var(--sd-line) !important;
  border-radius: var(--sd-radius-in);
  background: var(--sd-field) !important;
  color: var(--sd-text) !important;
  font: inherit;
  font-size: .9375rem;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: none;
}
.sd textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.sd input::placeholder, .sd textarea::placeholder { color: var(--sd-muted) !important; opacity: .8; }
.sd input:focus, .sd select:focus, .sd textarea:focus {
  outline: none;
  border-color: var(--sd-primary) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sd-primary) 22%, transparent);
}
.sd input[dir="ltr"] { text-align: left; }
.sd input[type="file"] { font: inherit; font-size: .875rem; color: var(--sd-muted); max-width: 100%; }

/* Switch: a real checkbox, drawn. */
.sd-switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .875rem 1rem; border: 1px solid var(--sd-line); border-radius: var(--sd-radius-in); background: var(--sd-field); cursor: pointer; }
.sd-switch__text { display: grid; gap: .125rem; }
.sd-switch__text strong { font-size: .9375rem; }
.sd-switch__text span { font-size: .8125rem; color: var(--sd-muted); }
.sd-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sd-switch__track { flex: none; width: 44px; height: 24px; border-radius: 999px; background: color-mix(in srgb, var(--sd-text) 22%, var(--sd-surface)); position: relative; transition: background .15s; }
.sd-switch__track::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.sd-switch input:checked + .sd-switch__track { background: var(--sd-primary); }
.sd-switch input:checked + .sd-switch__track::after { inset-inline-start: 23px; }
.sd-switch input:focus-visible + .sd-switch__track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sd-primary) 30%, transparent); }

/* Chips: checkboxes / radios shown as toggle pills (grades, source picker). */
.sd-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.sd-chip { position: relative; }
.sd-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.sd-chip span { display: inline-flex; align-items: center; gap: .375rem; min-height: 38px; padding: .375rem .875rem; border: 1px solid var(--sd-line); border-radius: 999px; background: var(--sd-field); font-size: .875rem; color: var(--sd-text); cursor: pointer; transition: border-color .15s, background .15s; }
.sd-chip input:checked + span { border-color: var(--sd-primary); background: var(--sd-soft); color: var(--sd-text); font-weight: 600; }
.sd-chip input:checked + span::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--sd-primary); }
.sd-chip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sd-primary) 30%, transparent); }

/* Segmented tabs (video source, image source). */
.sd-seg { display: flex; gap: .25rem; padding: .25rem; border: 1px solid var(--sd-line); border-radius: calc(var(--sd-radius-in) + 4px); background: var(--sd-field); flex-wrap: wrap; }
.sd-seg > * { flex: 1 1 auto; }
.sd-seg button, .sd-seg label { display: flex; align-items: center; justify-content: center; gap: .375rem; min-height: 40px; padding: .375rem .75rem; border: 0; border-radius: var(--sd-radius-in); background: transparent; color: var(--sd-muted); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }
.sd-seg [aria-selected="true"], .sd-seg .is-on, .sd-seg input:checked + span { background: var(--sd-surface); color: var(--sd-text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.sd-seg label { position: relative; }
.sd-seg label input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.sd-seg label span { display: flex; align-items: center; gap: .375rem; padding: .375rem .75rem; border-radius: var(--sd-radius-in); width: 100%; justify-content: center; }

/* Drop zone for files. */
.sd-drop { display: grid; place-items: center; gap: .375rem; text-align: center; padding: 1.5rem 1rem; border: 1.5px dashed var(--sd-line); border-radius: var(--sd-radius-in); background: var(--sd-field); color: var(--sd-muted); cursor: pointer; transition: border-color .15s, background .15s; }
.sd-drop:hover, .sd-drop.is-over { border-color: var(--sd-primary); background: var(--sd-soft); }
.sd-drop strong { color: var(--sd-text); font-size: .9375rem; }
.sd-drop .ei { width: 28px; height: 28px; color: var(--sd-primary); }

/* Progress. */
.sd-progress { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--sd-text) 12%, var(--sd-surface)); overflow: hidden; }
.sd-progress > i { display: block; height: 100%; width: 0; background: var(--sd-primary); transition: width .3s; }
/* design-system.css paints every student-page bar purple→honey ([class*="progress"] > [style*="width"]); the studio is flat. */
.sd .sd-progress > i { background-image: none !important; }

/* ---------- Buttons ---------- */
.sd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .5rem 1.05rem;
  border: 1px solid var(--sd-line); border-radius: var(--sd-radius-btn);
  background: var(--sd-surface); color: var(--sd-text);
  font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.sd-btn:hover { border-color: color-mix(in srgb, var(--sd-text) 35%, var(--sd-line)); background: var(--sd-field); }
.sd-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sd-primary) 30%, transparent); }
.sd-btn[disabled], .sd-btn.is-disabled { opacity: .55; cursor: not-allowed; }
.sd-btn .ei { width: 17px; height: 17px; flex: none; }
.sd-btn--primary { background: var(--sd-primary); border-color: var(--sd-primary); color: var(--sd-ink); }
.sd-btn--primary:hover { background: color-mix(in srgb, var(--sd-primary) 88%, #000); border-color: transparent; color: var(--sd-ink); }
.sd-btn--danger { color: var(--sd-danger); border-color: color-mix(in srgb, var(--sd-danger) 45%, var(--sd-line)); background: transparent; }
.sd-btn--danger:hover { background: color-mix(in srgb, var(--sd-danger) 10%, var(--sd-surface)); border-color: var(--sd-danger); }
.sd-btn--ghost { border-color: transparent; background: transparent; color: var(--sd-muted); }
.sd-btn--ghost:hover { color: var(--sd-text); background: var(--sd-field); border-color: transparent; }
.sd-btn--sm { min-height: 36px; padding: .3rem .7rem; font-size: .8125rem; }
.sd-btn--block { width: 100%; }
.sd-btn--icon { padding: 0; width: 40px; min-height: 40px; font-size: 1.35rem; line-height: 1; }

/* ---------- Badges ---------- */
.sd-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; border: 1px solid var(--sd-line); color: var(--sd-muted); background: var(--sd-field); white-space: nowrap; }
.sd-badge .ei { width: 13px; height: 13px; }
.sd-badge--primary { color: var(--sd-text); border-color: color-mix(in srgb, var(--sd-primary) 40%, var(--sd-line)); background: var(--sd-soft); }
.sd-badge--ok { color: var(--sd-ok); border-color: color-mix(in srgb, var(--sd-ok) 40%, transparent); background: color-mix(in srgb, var(--sd-ok) 10%, var(--sd-surface)); }
.sd-badge--warn { color: var(--sd-warn); border-color: color-mix(in srgb, var(--sd-warn) 40%, transparent); background: color-mix(in srgb, var(--sd-warn) 10%, var(--sd-surface)); }
.sd-badge--danger { color: var(--sd-danger); border-color: color-mix(in srgb, var(--sd-danger) 40%, transparent); background: color-mix(in srgb, var(--sd-danger) 10%, var(--sd-surface)); }

/* ---------- Notices ---------- */
.sd-note { display: flex; gap: .625rem; align-items: flex-start; padding: .75rem .875rem; border-radius: var(--sd-radius-in); border: 1px solid var(--sd-line); background: var(--sd-field); font-size: .8125rem; line-height: 1.7; color: var(--sd-muted); }
.sd-note .ei { width: 17px; height: 17px; flex: none; margin-top: .1rem; color: var(--sd-primary); }
.sd-note--warn { border-color: color-mix(in srgb, var(--sd-warn) 40%, var(--sd-line)); }
.sd-note--warn .ei { color: var(--sd-warn); }
.sd-note--danger { border-color: color-mix(in srgb, var(--sd-danger) 40%, var(--sd-line)); }
.sd-note--danger .ei { color: var(--sd-danger); }
.sd-note strong { color: var(--sd-text); }

/* ---------- Summary list (aside) ---------- */
.sd-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: .625rem; }
.sd-facts li { display: flex; justify-content: space-between; gap: .75rem; font-size: .875rem; }
.sd-facts li span { color: var(--sd-muted); }
.sd-facts li strong { color: var(--sd-text); text-align: end; overflow-wrap: anywhere; }
.sd-tips { margin: 0; padding-inline-start: 1.1rem; display: grid; gap: .4rem; font-size: .8125rem; color: var(--sd-muted); line-height: 1.7; }

/* ---------- Content list (sections → lessons, questions) ---------- */
.sd-list { list-style: none; margin: 0; padding: 0; }
.sd-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-top: 1px solid var(--sd-line); min-width: 0; }
.sd-item:first-child { border-top: 0; }
.sd-item__handle { color: var(--sd-muted); cursor: grab; flex: none; display: inline-flex; }
.sd-item__handle .ei { width: 18px; height: 18px; }
.sd-item__num { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: .8125rem; font-weight: 700; background: var(--sd-field); color: var(--sd-muted); }
.sd-item__body { flex: 1 1 auto; min-width: 0; }
.sd-item__title { font-weight: 600; font-size: .9375rem; color: var(--sd-text); text-decoration: none; overflow-wrap: anywhere; }
a.sd-item__title:hover { color: var(--sd-primary); }
.sd-item__meta { display: flex; flex-wrap: wrap; gap: .375rem .75rem; margin-top: .25rem; font-size: .75rem; color: var(--sd-muted); }
.sd-item__actions { display: flex; gap: .375rem; flex: none; align-items: center; }
.sd-item.is-muted .sd-item__title { color: var(--sd-muted); }
.sd-group__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .875rem 1rem; background: var(--sd-field); border-bottom: 1px solid var(--sd-line); flex-wrap: wrap; }
.sd-group__title { font-weight: 700; font-size: .9375rem; margin: 0; }
.sd-empty { padding: 1.5rem 1rem; text-align: center; color: var(--sd-muted); font-size: .875rem; }

/* Overflow menu: the rare actions of a row live behind «⋯», not as eight buttons. */
.sd-menu { position: relative; }
.sd-item:has(.sd-menu[open]), .sd-group__head:has(.sd-menu[open]) { position: relative; z-index: 35; }
.sd-menu > summary { list-style: none; }
.sd-menu > summary::-webkit-details-marker { display: none; }
.sd-menu__list { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 30; min-width: 190px; padding: .375rem; background: var(--sd-surface); border: 1px solid var(--sd-line); border-radius: var(--sd-radius-in); box-shadow: 0 10px 30px rgba(0,0,0,.18); display: grid; gap: 2px; }
.sd-menu__list a, .sd-menu__list button { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .55rem .65rem; border: 0; border-radius: 8px; background: transparent; color: var(--sd-text); font: inherit; font-size: .875rem; text-align: start; text-decoration: none; cursor: pointer; }
.sd-menu__list a:hover, .sd-menu__list button:hover { background: var(--sd-field); }
.sd-menu__list .is-danger { color: var(--sd-danger); }
.sd-menu__list .ei { width: 16px; height: 16px; flex: none; }
.sd-menu__list form { margin: 0; }
.sd-menu__sep { height: 1px; background: var(--sd-line); margin: .25rem 0; }

/* ---------- Save bar ---------- */
.sd-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--sd-surface) 96%, transparent);
  border-top: 1px solid var(--sd-line);
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
}
.sd-bar__in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sd-bar__note { font-size: .8125rem; color: var(--sd-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-bar__actions { display: flex; gap: .5rem; flex: none; }
@media (max-width: 560px) {
  .sd-bar__note { display: none; }
  .sd-bar__actions { width: 100%; }
  .sd-bar__actions .sd-btn { flex: 1 1 0; }
  .sd-head { padding: .875rem 1rem; }
  .sd-title { font-size: 1.2rem; }
  .sd-card { padding: 1rem; }
  .sd-item { flex-wrap: wrap; }
  .sd-item__actions { width: 100%; justify-content: flex-end; }
}

/* The study helper's floating button sits above the save bar, not under it. */
body:has(.sd-bar) #ai-helper .ai-dock,
body:has(.sd-bar) #ai-helper .ai-panel { bottom: 5.75rem !important; }

/* ---------- Dashboard shell: side menu on desktop, bottom bar on phones ---------- */
.sd.dsh { max-width: 1320px; padding-bottom: 2rem; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.dsh-main { min-width: 0; display: grid; gap: 1rem; }
.dsh-nav { position: sticky; top: 5.5rem; background: var(--sd-surface); border: 1px solid var(--sd-line); border-radius: var(--sd-radius); padding: .625rem; display: grid; gap: 2px; }
.dsh-nav__who { display: flex; align-items: center; gap: .625rem; padding: .5rem .5rem .75rem; margin-bottom: .25rem; border-bottom: 1px solid var(--sd-line); min-width: 0; }
.dsh-nav__avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sd-soft); color: var(--sd-text); font-weight: 700; }
.dsh-nav__who strong { display: block; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-nav__who span { display: block; font-size: .75rem; color: var(--sd-muted); }
.dsh-nav__label { font-size: .7rem; font-weight: 700; letter-spacing: .02em; color: var(--sd-muted); padding: .75rem .625rem .25rem; }
.dsh-nav a { display: flex; align-items: center; gap: .625rem; min-height: 40px; padding: .45rem .625rem; border-radius: var(--sd-radius-in); color: var(--sd-text); text-decoration: none; font-size: .875rem; position: relative; }
.dsh-nav a .ei { width: 18px; height: 18px; color: var(--sd-muted); flex: none; }
.dsh-nav a:hover { background: var(--sd-field); }
.dsh-nav a.is-active { background: var(--sd-soft); font-weight: 700; }
.dsh-nav a.is-active .ei { color: var(--sd-primary); }
.dsh-nav a.is-active::before { content: ''; position: absolute; inset-inline-start: -.625rem; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--sd-primary); }
.dsh-nav__count { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 .375rem; border-radius: 999px; display: grid; place-items: center; font-size: .7rem; font-weight: 700; background: var(--sd-primary); color: var(--sd-ink); }
.dsh-bar { display: none; }

/* Page-level pieces the three dashboards share. */
.dsh-hello { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dsh-hello h1 { margin: 0; font-size: 1.5rem; font-weight: var(--tc-heading-weight, 700); color: var(--sd-text); }
.dsh-hello p { margin: .25rem 0 0; color: var(--sd-muted); font-size: .875rem; }
.dsh-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.dsh-kpi { background: var(--sd-surface); border: 1px solid var(--sd-line); border-radius: var(--sd-radius); padding: 1rem 1.125rem; text-decoration: none; color: var(--sd-text); display: grid; gap: .25rem; min-width: 0; }
a.dsh-kpi:hover { border-color: color-mix(in srgb, var(--sd-primary) 45%, var(--sd-line)); }
.dsh-kpi__label { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--sd-muted); }
.dsh-kpi__label .ei { width: 16px; height: 16px; color: var(--sd-primary); }
.dsh-kpi__value { font-size: 1.75rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dsh-kpi__value small { font-size: .875rem; font-weight: 600; color: var(--sd-muted); margin-inline-start: .25rem; }
.dsh-kpi__note { font-size: .75rem; color: var(--sd-muted); }
.dsh-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.dsh-todo { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.dsh-todo li { display: flex; align-items: center; gap: .75rem; padding: .75rem .875rem; border: 1px solid var(--sd-line); border-radius: var(--sd-radius-in); background: var(--sd-field); min-width: 0; }
.dsh-todo__n { flex: none; min-width: 36px; height: 36px; padding: 0 .5rem; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--sd-soft); color: var(--sd-text); font-variant-numeric: tabular-nums; }
.dsh-todo__body { flex: 1 1 auto; min-width: 0; display: grid; gap: .1rem; }
.dsh-todo__body b { font-size: .9rem; }
.dsh-todo__body span { font-size: .8rem; color: var(--sd-muted); }
.dsh-cover { flex: none; width: 64px; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; border: 1px solid var(--sd-line); }
.dsh-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dsh-cover svg { width: 100%; height: 100%; display: block; }

/* Inbox rows the teacher acts on in place (a receipt, a student to remind). */
.dsh-todo__row { padding-inline-start: 3.25rem; background: color-mix(in srgb, var(--sd-field) 55%, transparent); }
.dsh-todo__body a { color: var(--sd-primary); text-decoration: underline; }
.dsh-todo__acts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; }
.dsh-todo__acts form { margin: 0; }
.dsh-reject > summary { list-style: none; }
.dsh-reject > summary::-webkit-details-marker { display: none; }
.dsh-reject[open] form { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.dsh-reject input[type="text"] { min-width: 14rem; }
@media (max-width: 640px) { .dsh-todo__row { padding-inline-start: 1rem; flex-wrap: wrap; } .dsh-todo__acts { width: 100%; } }

/* The week plan: an ordered list whose numbers are drawn by .sd-item__num. */
.dsh-plan { list-style: none; padding: 0; margin: 0; }

/* Onboarding: the next step in view, the full list folded under it. */
.onboard-rest > summary { list-style: none; margin: .25rem 1rem .75rem; }
.onboard-rest > summary::-webkit-details-marker { display: none; }
.onboard-rest[open] > summary { margin-bottom: 0; }

/* A row that is one destination: the title's link covers the row, the buttons sit above it. */
.dsh-course { position: relative; }
.dsh-course:hover { background: color-mix(in srgb, var(--sd-field) 70%, transparent); }
.dsh-course__link::after { content: ''; position: absolute; inset: 0; }
.dsh-course .sd-item__actions { position: relative; z-index: 1; }

/* No side column (nothing applies to it): the main column takes the row. */
.dsh-cols--solo { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 1100px) { .dsh-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 960px) {
  .sd.dsh { grid-template-columns: minmax(0, 1fr); padding-bottom: 6rem; }
  .dsh-nav { display: none; }
  .dsh-bar { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 45; background: var(--sd-surface); border-top: 1px solid var(--sd-line); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); justify-content: space-around; }
  .dsh-bar > a, .dsh-bar > details > summary { flex: 1 1 0; display: grid; justify-items: center; gap: 2px; padding: .4rem .25rem; font-size: .7rem; color: var(--sd-muted); text-decoration: none; list-style: none; cursor: pointer; min-height: 52px; }
  .dsh-bar > details { flex: 1 1 0; display: flex; }
  .dsh-bar > details > summary::-webkit-details-marker { display: none; }
  .dsh-bar .ei { width: 22px; height: 22px; }
  .dsh-bar > a.is-active { color: var(--sd-primary); font-weight: 700; }
  .dsh-bar .sd-menu__list { bottom: calc(100% + 6px); top: auto; inset-inline-end: .25rem; }
  /* The bottom bar is the navigation here; the floating helper covered cards and buttons. */
  body:has(.dsh-bar) #ai-helper .ai-dock { display: none !important; }
  .dsh-course { flex-wrap: nowrap; }
  .dsh-course .sd-item__actions { width: auto; }
}
