:root {
  --crimson: #841617;
  --crimson-dark: #5f0e10;
  --crimson-soft: #f5e9e9;
  --black: #171717;
  --charcoal: #323232;
  --muted: #6f6f6f;
  --canvas: #f0f0f0;
  --surface: #ffffff;
  --line: #dddddd;
  --sky: #bcdceb;
  --leaf: #8ca57d;
  --stone: #beb4a5;
  --amber: #a55a18;
  --shadow: 0 2px 12px rgba(0, 0, 0, .045);
  --sidebar-width: 240px;
}

.feature-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 24px; }
.feature-heading p { margin: 12px 0 0; max-width: 760px; }
.feature-filters { display: flex; align-items: end; gap: 16px; padding: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.feature-filters label { display: grid; gap: 6px; flex: 1; min-width: 160px; font-weight: 650; }
.feature-filters input, .feature-filters select { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.feature-section { padding: 24px; margin-bottom: 24px; }
.feature-section .panel-header { padding: 0 0 18px; }
.feature-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.feature-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.feature-row:last-child, .problem-row:last-child { border-bottom: 0; }
.feature-row > div:first-child { min-width: 0; }
.feature-row a { overflow-wrap: anywhere; font-weight: 700; }
.feature-row p { margin: 5px 0; }
.material-group { padding-top: 20px; }
.material-labels { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.status.blocked { background: #fff1dd; color: #78420d; }
.source-notes { margin-top: 24px; }
.source-notes pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: .9rem; }
summary { cursor: pointer; font-weight: 650; padding: 10px 0; }
.problem-row { padding: 20px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.problem-row .secondary { display: inline-block; margin-top: 12px; }
.problem-detail { overflow-wrap: anywhere; white-space: pre-wrap; background: var(--canvas); padding: 14px; border-radius: 6px; }
.submission-setting { padding: 20px; display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; }
.submission-setting h2 { font-size: 1.25rem; margin-bottom: 10px; }
.submission-setting p { margin: 0; }
@media (max-width: 760px) {
  .feature-heading, .submission-setting, .feature-row { flex-direction: column; align-items: stretch; }
  .material-labels { justify-content: flex-start; }
  .feature-section { padding: 18px; }
  .feature-row button { width: 100%; }
  .mobile-nav { overflow-x: auto; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--charcoal); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
form { margin: 0; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; color: var(--black); }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.04; letter-spacing: -.035em; }
h2 { margin-bottom: 0; line-height: 1.15; letter-spacing: -.02em; }
h3 { margin-bottom: 4px; color: var(--black); line-height: 1.25; }
.muted { color: var(--muted); }
.full { width: 100%; }

.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: 10px 14px; border-radius: 7px; background: var(--black); color: white; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; background: linear-gradient(180deg, #8d201d 0%, #761314 100%); color: white; }
.workspace-brand { display: block; padding: 26px 24px 25px; border-bottom: 1px solid rgba(255,255,255,.18); text-decoration: none; }
.workspace-brand span { display: block; margin-bottom: 6px; color: rgba(255,255,255,.67); font-size: .66rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.workspace-brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; line-height: 1.15; }
.sidebar-nav { flex: 1; display: grid; align-content: start; gap: 5px; padding: 22px 12px; }
.sidebar-nav a { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: rgba(255,255,255,.86); font-weight: 650; text-decoration: none; }
.sidebar-nav a[aria-current="page"], .sidebar-nav a:hover, .sidebar-nav a:focus-visible { background: white; color: var(--crimson); outline: 0; }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 6px; font-size: .67rem; font-weight: 850; }
.sidebar-account { padding: 16px; border-top: 1px solid rgba(255,255,255,.18); }
.account-row { display: flex; align-items: center; gap: 11px; padding: 0 6px 13px; }
.account-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: white; color: var(--crimson); font-weight: 850; }
.account-row strong, .account-row small { display: block; }
.account-row small { color: rgba(255,255,255,.62); }
.sidebar-signout { width: 100%; min-height: 42px; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: rgba(255,255,255,.82); text-align: left; cursor: pointer; font-weight: 700; }
.sidebar-signout:hover { background: rgba(255,255,255,.1); color: white; }

.app-frame { min-height: 100vh; margin-left: var(--sidebar-width); }
.desktop-header { position: sticky; top: 0; z-index: 30; height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 3vw, 38px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.desktop-header span, .desktop-header strong { display: block; }
.desktop-header span { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.desktop-header strong { color: var(--charcoal); font-size: .86rem; }
.mobile-header, .mobile-nav { display: none; }
.header-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid #cfcfcf; border-radius: 8px; background: white; color: var(--charcoal); font-weight: 750; text-decoration: none; }
.header-button:hover { border-color: #a9a9a9; background: #fafafa; }

.page { width: min(1500px, 100%); margin: 0 auto; padding: 24px clamp(20px, 3vw, 38px) 58px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.eyebrow { margin-bottom: 5px; color: var(--crimson); font-size: .68rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.updated { margin-bottom: 5px; color: var(--muted); font-size: .82rem; }

.panel { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading > span { color: var(--muted); font-size: .75rem; }
.panel-heading .eyebrow { margin: 0; }

.overview { scroll-margin-top: 84px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(350px, 1fr); gap: 12px; }
.next-deadline { min-height: 143px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: var(--shadow); }
.next-deadline h2 { margin: 8px 0 5px; font-size: 1.35rem; }
.next-deadline p { margin: 0; color: var(--muted); font-size: .84rem; }
.next-actions { min-width: 150px; display: grid; gap: 7px; }
.next-actions form, .next-actions form button { width: 100%; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.deadline-badge, .platform, .status { display: inline-flex; align-items: center; width: fit-content; padding: 4px 9px; border-radius: 999px; font-size: .67rem; font-weight: 800; }
.deadline-badge { background: var(--crimson-soft); color: var(--crimson); }
.platform { background: #e8e5e1; color: #49433e; }
.platform-mcgraw-hill { background: rgba(188,220,235,.58); color: #23516c; }
.platform-gradescope { background: #eee9f7; color: #5f4a86; }
.status { background: #e7e7e7; color: #555; }
.status.not-submitted, .status.needs-input, .status.needs-review, .status.failed { background: var(--crimson-soft); color: var(--crimson); }
.status.submitted, .status.saved, .status.complete { background: rgba(140,165,125,.26); color: #3c6330; }
.status.graded { background: rgba(140,165,125,.26); color: #3c6330; }
.status.running { background: rgba(188,220,235,.58); color: #23516c; }

.quick-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-totals article { min-width: 0; min-height: 143px; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: var(--shadow); }
.quick-totals strong, .quick-totals span { display: block; }
.quick-totals strong { color: var(--black); font-size: 1.7rem; line-height: 1; }
.quick-totals article div span { margin-top: 6px; color: var(--muted); font-size: .72rem; line-height: 1.25; }
.stat-icon { width: 32px; height: 32px; display: grid !important; place-items: center; border-radius: 8px; font-size: .7rem; font-weight: 900; }
.stat-icon.sky { background: rgba(188,220,235,.65); color: #23516c; }
.stat-icon.stone { background: rgba(190,180,165,.35); color: #665d52; }
.stat-icon.leaf { background: rgba(140,165,125,.27); color: #3c6330; }

.deadline-strip { margin-top: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: var(--shadow); }
.deadline-strip h2 { font-family: inherit; color: var(--muted); font-size: .7rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.deadline-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 9px; }
.deadline-days a { position: relative; min-height: 70px; display: grid; place-items: center; align-content: center; padding: 8px; border: 1px solid #e4e4e4; border-radius: 8px; color: var(--charcoal); text-decoration: none; }
.deadline-days a:first-child, .deadline-days a:hover { border-color: var(--crimson); background: var(--crimson); color: white; }
.deadline-days span, .deadline-days small { font-size: .62rem; font-weight: 750; text-transform: uppercase; }
.deadline-days strong { font-size: 1rem; }
.deadline-days i { position: absolute; right: 7px; bottom: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--stone); }
.deadline-days i.submitted, .deadline-days i.graded { background: var(--leaf); }
.deadline-days i.not-submitted { background: var(--crimson); }
.deadline-days a:first-child i, .deadline-days a:hover i { background: white; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(315px, .72fr); gap: 14px; margin-top: 14px; }
.assignments-panel, .focus-panel, .quick-panel, .all-drafts, .grade-summary { scroll-margin-top: 84px; }
.panel-header { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-header h2 { font-size: 1.25rem; }
.panel-header .eyebrow { margin-bottom: 2px; }
.legend { display: flex; gap: 3px; padding: 4px; border-radius: 7px; background: var(--canvas); color: var(--muted); font-size: .68rem; font-weight: 750; }
.legend span { padding: 5px 8px; }
.legend span:first-child { border-radius: 5px; background: white; color: var(--crimson); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.assignment-list { max-height: 650px; overflow-y: auto; }
.assignment-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.assignment-row:last-child { border-bottom: 0; }
.assignment-row:hover { background: #fbfbfb; }
.date-block { width: 48px; height: 48px; display: grid; place-items: center; align-content: center; border: 1px solid #e2e2e2; border-radius: 8px; background: #fafafa; text-align: center; }
.date-block strong { color: var(--black); font-size: 1rem; line-height: 1; }
.date-block span { margin-top: 3px; color: var(--crimson); font-size: .56rem; font-weight: 850; text-transform: uppercase; }
.assignment-main { min-width: 0; }
.assignment-main h3 { margin-top: 5px; overflow: hidden; font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.assignment-main p { margin: 0; overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { min-width: 130px; display: grid; grid-template-columns: 1fr; gap: 5px; }
.row-actions form, .row-actions button { width: 100%; }
.row-actions .small-link { text-align: center; }
.small-link, .text-link, .back { color: var(--crimson); font-size: .72rem; font-weight: 750; text-decoration: none; }
.small-link:hover, .text-link:hover, .back:hover { text-decoration: underline; }

.primary, .secondary { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; text-decoration: none; font-weight: 750; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.primary { background: var(--crimson); color: white; }
.primary:hover { background: var(--crimson-dark); transform: translateY(-1px); }
.secondary { border-color: #d0d0d0; background: white; color: var(--charcoal); }
.secondary:hover { border-color: #a9a9a9; background: #fafafa; }

.focus-column { display: grid; align-content: start; gap: 14px; }
.focus-panel { position: sticky; top: 79px; padding: 17px; }
.focus-panel h2 { margin: 9px 0 2px; font-size: 1.25rem; }
.focus-panel > p { color: var(--muted); font-size: .78rem; }
.focus-course { margin-bottom: 12px; color: var(--charcoal) !important; font-weight: 700; }
.focus-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0; }
.focus-details div { padding: 8px; border-radius: 7px; background: var(--canvas); }
.focus-details dt { color: var(--muted); font-size: .6rem; font-weight: 750; text-transform: uppercase; }
.focus-details dd { margin: 3px 0 0; color: var(--black); font-size: .7rem; font-weight: 750; }
.focus-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.quick-panel { padding: 15px; }
.quick-panel h2 { font-size: 1.1rem; }
.quick-list { display: grid; gap: 6px; margin-top: 12px; }
.quick-list a, .quick-list > div { display: grid; padding: 9px 0; border-top: 1px solid #ececec; text-decoration: none; }
.quick-list a:first-child, .quick-list > div:first-child { border-top: 0; padding-top: 0; }
.quick-list strong { color: var(--black); font-size: .77rem; }
.quick-list span, .quick-list small { color: var(--muted); font-size: .66rem; }
.grade-list > div { grid-template-columns: auto 1fr; gap: 2px 9px; }
.grade-list strong { grid-row: 1 / 3; color: var(--crimson); font-size: 1rem; }

.lower-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .75fr); gap: 14px; margin-top: 14px; }
.draft-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 14px; }
.draft-card { min-width: 0; display: block; padding: 14px; border: 1px solid #e4e4e4; border-radius: 8px; background: #fbfbfb; text-decoration: none; }
.draft-card:hover { border-color: #c3c3c3; background: white; }
.draft-card h3 { margin: 9px 0 3px; font-size: .84rem; }
.draft-card p, .draft-card small { margin: 0; color: var(--muted); font-size: .68rem; }
.grade-more { padding: 0 14px 12px; }
.grade-more > summary { cursor: pointer; color: var(--crimson); font-size: .8rem; font-weight: 700; padding: 6px 0; }
.grade-more .quick-list { max-height: 420px; overflow-y: auto; padding: 0; }
.course-grade-list { padding: 8px 14px 14px; }
.grade-summary { align-self: start; }
.course-grade-list div { display: grid; gap: 3px; padding: 10px 0; border-bottom: 1px solid #ececec; }
.course-grade-list div:last-child { border-bottom: 0; }
.course-grade-list span { color: var(--black); font-size: .75rem; font-weight: 700; }
.course-grade-list strong { color: var(--crimson); font-size: .8rem; }
.course-grade-list small { color: var(--muted); }

.notice { margin-bottom: 14px; padding: 12px 14px; border: 1px solid transparent; border-radius: 8px; }
.notice.error { border-color: #e6b9b9; background: var(--crimson-soft); color: #6f1113; }
.notice.success { border-color: #c8d7c0; background: #edf4e9; color: #36552e; }
.notice.neutral { border-color: #c9dce6; background: #edf5f8; color: #31566b; }
.empty { padding: 36px; color: var(--muted); text-align: center; }
.empty-inline { grid-column: 1 / -1; margin: 12px; color: var(--muted); text-align: center; }

/* Assignment workspace */
.assignment-page .page { max-width: 1460px; }
.back { display: inline-block; margin: 3px 0 15px; }
.back:before { content: "<"; margin-right: 7px; }
.assignment-title { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 16px; padding-bottom: 18px; border-bottom: 1px solid #d4d4d4; }
.assignment-title h1 { max-width: 900px; }
.assignment-title-meta { min-width: 235px; text-align: right; }
.assignment-title-meta p { margin: 7px 0 0; color: var(--muted); font-size: .78rem; }
.assignment-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 15px; align-items: start; }
.assignment-work, .assignment-side { display: grid; gap: 15px; }
.assignment-side { position: sticky; top: 80px; }
.assignment-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 25px; padding: 18px; }
.assignment-summary p:last-child { margin-bottom: 0; }
.assignment-facts, .version-panel { padding: 17px; }
.assignment-facts dl { margin: 10px 0 16px; }
.assignment-facts dl div { padding: 9px 0; border-bottom: 1px solid #ececec; }
.assignment-facts dt { color: var(--muted); font-size: .62rem; font-weight: 750; text-transform: uppercase; }
.assignment-facts dd { margin: 2px 0 0; color: var(--black); font-size: .75rem; font-weight: 700; }
.assignment-facts .primary { width: 100%; }
.version-panel h2 { font-size: 1.05rem; }
.version-list { display: grid; gap: 7px; margin: 13px 0; }
.version-pill { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid #dedede; border-radius: 7px; text-decoration: none; }
.version-pill strong { font-size: .76rem; }
.version-pill small { color: var(--muted); font-size: .62rem; text-transform: uppercase; }
.version-pill:hover, .version-pill.active { border-color: var(--crimson); background: var(--crimson-soft); color: var(--crimson); }

.smartbook-box { padding: 18px; border-left: 4px solid var(--crimson); }
.smartbook-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.smartbook-heading h2 { font-size: 1.3rem; }
.progress-number { color: var(--crimson); font-family: Georgia, "Times New Roman", serif; font-size: 2.2rem; font-weight: 700; }
.progress-track { height: 9px; margin: 15px 0 9px; overflow: hidden; border-radius: 999px; background: #e3e3e3; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--crimson); }
.goal-form { display: flex; align-items: end; gap: 11px; margin-top: 17px; }
.goal-form label { display: grid; min-width: 190px; gap: 5px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #c8c8c8; border-radius: 7px; background: white; color: var(--charcoal); }
input { min-height: 46px; padding: 9px 12px; }
select { min-height: 44px; padding: 8px 34px 8px 11px; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(132,22,23,.14); border-color: var(--crimson); }
.smartbook-actions { display: flex; gap: 8px; margin-top: 14px; }
.small-text { margin: 10px 0 0; font-size: .75rem; }
.smartbook-report { padding: 18px; }
.smartbook-report pre { margin: 0; white-space: pre-wrap; color: var(--charcoal); font: inherit; }
.draft-progress { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pdf-section { padding: 16px; }
.pdf-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.pdf-heading h2 { font-size: 1.25rem; }
.pdf-viewer { width: 100%; height: min(70vh, 820px); min-height: 520px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.manual-submit-box { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 13px; padding: 15px; border: 1px solid #c8d7c0; border-radius: 8px; background: #edf4e9; }
.manual-submit-box p { margin: 3px 0 0; color: #486240; font-size: .72rem; }
.manual-submit-box form { flex: 0 0 auto; }
.manual-submit-box input[type="hidden"] { display: none; }
.editor { padding: 16px; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.editor-heading label { color: var(--black); font-weight: 800; }
.editor-heading span { color: var(--muted); font-size: .7rem; }
.editor textarea { min-height: 58vh; padding: 17px; resize: vertical; line-height: 1.65; background: #fcfcfc; }
.submit-box { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px 20px; margin-top: 13px; padding: 15px; border-radius: 8px; background: var(--crimson-soft); }
.submit-box p { grid-column: 1 / -1; margin: 0; color: #6f3b3b; font-size: .7rem; }
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: 19px; min-height: 19px; accent-color: var(--crimson); }
.danger { background: var(--crimson); }

/* Sign in */
.signed-out { min-height: 100vh; background: var(--crimson); }
.signed-out .page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(980px, 100%); min-height: 570px; display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border-radius: 13px; background: white; box-shadow: 0 25px 80px rgba(58,0,2,.3); }
.login-brand { display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(38px, 7vw, 72px); background: linear-gradient(155deg, #9b2824, #6f1012); color: white; }
.login-brand .eyebrow { color: rgba(255,255,255,.7); }
.login-brand h1 { color: white; font-size: clamp(2.5rem, 6vw, 4.3rem); }
.login-brand > p:not(.eyebrow) { max-width: 390px; margin-top: 24px; color: rgba(255,255,255,.78); font-size: 1rem; }
.login-rule { width: 54px; height: 4px; margin: 28px 0; background: white; }
.login-brand small { color: rgba(255,255,255,.6); }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 6vw, 66px); }
.login-card h2 { font-size: 2rem; }
.login-card > .muted { margin: 8px 0 27px; }
.login-form { display: grid; gap: 17px; }
.login-form label { display: grid; gap: 6px; color: var(--charcoal); font-size: .8rem; font-weight: 750; }

@media (max-width: 1180px) {
  .overview-grid { grid-template-columns: 1fr; }
  .quick-totals article { min-height: 105px; }
  .workspace-grid { grid-template-columns: minmax(0, 1.45fr) minmax(285px, .75fr); }
  .focus-details { grid-template-columns: 1fr; }
  .focus-actions { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .sidebar, .desktop-header { display: none; }
  .app-frame { margin-left: 0; }
  .mobile-header { position: sticky; top: 0; z-index: 30; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 4vw; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
  .mobile-header > a:first-child { color: var(--crimson); font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; font-weight: 700; text-decoration: none; }
  .mobile-nav { position: fixed; inset: auto 0 0 0; z-index: 50; height: 68px; display: grid; grid-template-columns: repeat(7, minmax(54px, 1fr)); overflow-x: auto; border-top: 1px solid var(--line); background: rgba(255,255,255,.98); }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .62rem; font-weight: 750; text-decoration: none; }
  .mobile-nav a[aria-current="page"] { color: var(--crimson); }
  .mobile-nav span { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 6px; font-size: .62rem; }
  .page { padding: 22px 4vw 95px; }
  .workspace-grid, .lower-grid, .assignment-layout { grid-template-columns: 1fr; }
  .focus-panel, .assignment-side { position: static; }
  .focus-details { grid-template-columns: repeat(3, 1fr); }
  .focus-actions { grid-template-columns: 1fr 1fr; }
  .assignment-side { grid-row: 1; }
}

@media (max-width: 680px) {
  body { font-size: 14px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .overview-grid, .next-deadline, .assignment-summary { grid-template-columns: 1fr; }
  .next-actions { min-width: 0; grid-template-columns: 1fr 1fr; }
  .quick-totals { gap: 7px; }
  .quick-totals article { min-height: 108px; padding: 12px; }
  .quick-totals article div span { font-size: .64rem; }
  .deadline-strip { overflow: hidden; }
  .deadline-days { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .deadline-days a { min-width: 72px; }
  .workspace-grid { margin-top: 10px; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .assignment-list { max-height: none; overflow: visible; }
  .assignment-row { grid-template-columns: 45px minmax(0,1fr); padding: 13px; }
  .row-actions { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .row-actions .small-link { grid-column: 1 / -1; }
  .assignment-main h3, .assignment-main p { white-space: normal; }
  .lower-grid { display: block; }
  .lower-grid > * + * { margin-top: 10px; }
  .draft-grid { grid-template-columns: 1fr; }
  .assignment-title { align-items: flex-start; flex-direction: column; }
  .assignment-title-meta { min-width: 0; text-align: left; }
  .assignment-summary .secondary { width: 100%; }
  .goal-form, .smartbook-heading, .draft-progress, .pdf-heading, .manual-submit-box { align-items: stretch; flex-direction: column; }
  .goal-form label { min-width: 0; }
  .focus-details { grid-template-columns: 1fr; }
  .submit-box { grid-template-columns: 1fr; }
  .submit-box p { grid-column: auto; }
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-brand { min-height: 250px; padding: 34px; }
  .login-card { padding: 34px; }
}

@media (max-width: 420px) {
  .mobile-header .header-button { padding: 7px 10px; font-size: .72rem; }
  .next-actions, .focus-actions, .row-actions { grid-template-columns: 1fr; }
  .quick-totals strong { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Syllabus key dates on the dashboard */
.key-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.key-badge.key-exam { background: var(--crimson); color: white; }
.key-badge.key-deadline { background: #fff1dd; color: #78420d; }
.key-badge.key-event { background: rgba(188,220,235,.58); color: #23516c; }
.key-badge.key-break { background: #e7e7e7; color: #555; }
.key-row.key-exam { box-shadow: inset 3px 0 0 var(--crimson); }
.key-row .key-note { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.deadline-days a.key-exam { border-color: var(--crimson); }
.deadline-days i.key-exam { background: var(--crimson); }
.deadline-days i.key-deadline { background: var(--amber); }
.deadline-days i.key-event { background: #3d8bb5; }
.deadline-days i.key-break { background: #b9b9b9; }
.exams-panel .quick-list > div { gap: 1px; }
.exams-panel strong { color: var(--crimson); font-size: .8rem; }
.exams-panel span { color: var(--black); font-weight: 650; font-size: .85rem; }
.exams-panel small { color: var(--muted); }
.exams-panel .to-confirm strong { color: var(--amber); }

/* Console */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.status.finished { background: rgba(140,165,125,.26); color: #3c6330; }
.status.queued, .status.stopping { background: rgba(188,220,235,.58); color: #23516c; }
.status.handed-over { background: #fff1dd; color: #78420d; }

.cx-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.cx-stats { display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, auto); gap: 10px; align-items: stretch; margin-bottom: 18px; }
.cx-headline { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-weight: 700; }
.cx-headline.ok { color: #3c6330; }
.cx-headline.warn { color: var(--crimson); }
.cx-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
.cx-stat { min-width: 112px; display: grid; align-content: center; padding: 8px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--charcoal); text-decoration: none; }
.cx-stat strong { font-size: 1.35rem; line-height: 1.1; color: var(--black); }
.cx-stat span { color: var(--muted); font-size: .75rem; }
.cx-stat.warn strong { color: var(--crimson); }
.cx-stat:hover { border-color: #c5c5c5; }

.cx-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.cx-main, .cx-side { display: grid; gap: 18px; min-width: 0; }
.cx-panel { padding: 18px 20px; min-width: 0; }
.cx-panel h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.15rem; }
.cx-count { min-width: 24px; padding: 1px 8px; border-radius: 999px; background: #e7e7e7; color: #555; font: 750 .75rem/1.6 Inter, system-ui, sans-serif; text-align: center; }
.cx-count.warn { background: var(--crimson-soft); color: var(--crimson); }
.cx-empty { margin: 0; }

.cx-ask-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.cx-ask-top h2 { margin: 0; }
.cx-toggle { position: relative; display: inline-flex; padding: 3px; border-radius: 9px; background: var(--canvas); }
.cx-toggle input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.cx-toggle label { padding: 6px 14px; border-radius: 7px; color: var(--muted); font-weight: 700; font-size: .88rem; cursor: pointer; }
.cx-toggle input:checked + label { background: white; color: var(--black); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.cx-toggle input:focus-visible + label { outline: 2px solid var(--crimson); outline-offset: 1px; }
.cx-ask textarea { width: 100%; min-height: 110px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: white; resize: vertical; line-height: 1.5; }
.cx-ask textarea:focus { outline: 2px solid color-mix(in srgb, var(--crimson) 35%, transparent); border-color: var(--crimson); }
.cx-ask-bottom { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 10px; }
.cx-ask-bottom p { margin: 0; font-size: .78rem; }

.cx-answer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.cx-answer-head .muted { font-size: .8rem; margin-left: 6px; }
.cx-agent { font-weight: 800; color: var(--black); }
.cx-answer-actions { display: flex; align-items: center; gap: 8px; }
.cx-small { min-height: 30px; padding: 4px 10px; font-size: .82rem; }
.cx-question { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--crimson); background: var(--canvas); border-radius: 0 8px 8px 0; color: var(--charcoal); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.5em; overflow: auto; }
.cx-markdown { color: var(--black); line-height: 1.6; overflow-wrap: anywhere; }
.cx-markdown > :first-child { margin-top: 0; }
.cx-markdown p, .cx-markdown ul, .cx-markdown ol { margin: 0 0 12px; }
.cx-markdown ul, .cx-markdown ol { padding-left: 22px; }
.cx-markdown h4 { margin: 18px 0 6px; font-size: 1rem; }
.cx-markdown code { padding: 1px 5px; border-radius: 4px; background: var(--canvas); font-size: .86em; }
.cx-markdown pre { margin: 0 0 12px; padding: 12px 14px; border-radius: 8px; background: #1d1f21; color: #e6e6e6; overflow-x: auto; }
.cx-markdown pre code { padding: 0; background: none; }
.cx-live { white-space: pre-wrap; color: var(--muted); }
.cx-more { margin-top: 12px; }
.cx-more > summary, .cx-item > summary, .cx-entry > summary { cursor: pointer; }
.cx-more > summary { color: var(--muted); font-size: .85rem; font-weight: 650; }
.cx-terminal { margin: 8px 0 0; padding: 12px 14px; max-height: 340px; overflow: auto; border-radius: 8px; background: #1d1f21; color: #d8d8d8; font: .76rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.cx-jobs { margin: 0; padding: 0; list-style: none; }
.cx-jobs a { display: grid; grid-template-columns: auto 64px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 8px; margin: 0 -8px; border-radius: 7px; color: inherit; text-decoration: none; }
.cx-jobs a:hover { background: var(--canvas); }
.cx-jobs a[aria-current] { background: var(--crimson-soft); }
.cx-job-agent { font-weight: 750; font-size: .85rem; }
.cx-job-prompt { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cx-job-age { color: var(--muted); font-size: .75rem; white-space: nowrap; }

.cx-state { width: 9px; height: 9px; flex: none; border-radius: 50%; background: #b9b9b9; }
.cx-state.finished { background: #6f9a5c; }
.cx-state.failed { background: var(--crimson); }
.cx-state.late, .cx-state.handed-over { background: #d08a2c; }
.cx-state.running, .cx-state.queued, .cx-state.stopping { background: #3d8bb5; animation: cx-pulse 1.4s ease-in-out infinite; }
.cx-state.neutral { background: #9aa6b0; }
@keyframes cx-pulse { 50% { opacity: .35; } }

.cx-item { border-top: 1px solid var(--line); }
.cx-item:first-of-type { border-top: 0; }
.cx-item > summary, .cx-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; list-style: none; }
.cx-item > summary::-webkit-details-marker { display: none; }
.cx-item > summary > span:nth-child(2), .cx-row > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: .9rem; }
.cx-item > summary::after { content: '+'; color: var(--muted); font-weight: 700; }
.cx-item[open] > summary::after { content: '\2212'; }
.cx-meta { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.cx-item-body { padding: 0 0 12px 19px; font-size: .88rem; }
.cx-item-body p { margin: 0 0 8px; }
.cx-notice > summary > span:nth-child(2) { font-weight: 500; color: var(--muted); }
.cx-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px !important; }
.cx-links a { color: var(--crimson); font-weight: 700; font-size: .84rem; text-decoration: none; }
.cx-links a:hover { text-decoration: underline; }
.cx-row { margin: 0; }

.cx-changelog { margin-top: 18px; }
.cx-file { font: 500 .75rem ui-monospace, Menlo, monospace; }
.cx-entry { border-top: 1px solid var(--line); }
.cx-entry > summary { display: grid; grid-template-columns: 165px 210px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 10px 0; }
.cx-when { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-who { font-weight: 700; font-size: .85rem; }
.cx-asked { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cx-entry[open] .cx-asked { white-space: normal; }
.cx-entry dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 16px; margin: 0 0 14px; padding: 12px 14px; border-radius: 8px; background: var(--canvas); font-size: .88rem; }
.cx-entry dt { color: var(--muted); font-weight: 700; }
.cx-entry dd { margin: 0; overflow-wrap: anywhere; }
.cx-entry dd p { margin: 0; }

@media (max-width: 1180px) {
  .cx-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cx-headline { grid-column: 1 / -1; }
  .cx-stat { min-width: 0; }
}
@media (max-width: 980px) {
  /* One column: problems first, then the agent, then the rest. */
  .cx-layout { display: flex; flex-direction: column; }
  .cx-main, .cx-side { display: contents; }
  .cx-layout .cx-panel { align-self: stretch; }
  #cx-attention { order: 1; }
  .cx-ask { order: 2; }
  .cx-answer { order: 3; }
  .cx-history { order: 4; }
  #cx-checks { order: 5; }
  #cx-running { order: 6; }
  #cx-errors { order: 7; }
}
@media (max-width: 680px) {
  .cx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cx-panel { padding: 16px; }
  .cx-ask-top { flex-wrap: wrap; }
  .cx-ask-bottom { flex-direction: column; align-items: stretch; }
  .cx-jobs a { grid-template-columns: auto 58px minmax(0, 1fr); }
  .cx-job-age { display: none; }
  .cx-entry > summary { grid-template-columns: 1fr; gap: 2px; }
  .cx-entry dl { grid-template-columns: 1fr; }
  .cx-entry dt { margin-top: 6px; }
}
