:root {
    --blue: #003865;
    --orange: #e87722;
    --green: #2f6b4f;
    --red: #9f3a38;
    --ink: #1f2933;
    --muted: #68737d;
    --line: #d8dde2;
    --bg: #f5f6f7;
    --card: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); }
.page { width: min(1180px, calc(100% - 32px)); margin: 32px auto 64px; }
.eyebrow { margin: 0 0 5px; color: var(--orange); font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
h1, h2, h3 { color: var(--blue); }
h1 { margin: 0; }
.hero { background: white; padding: clamp(24px, 5vw, 56px); border-top: 5px solid var(--orange); border-radius: 10px; }
.hero-copy { max-width: 900px; font-size: 1.04rem; line-height: 1.65; }
.hero-actions, .resource-links { display: flex; flex-wrap: wrap; gap: 10px; }
.button, .resource-links a { display: inline-block; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: white; text-decoration: none; font-weight: 700; }
.button.primary { background: var(--blue); border-color: var(--blue); color: white; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 9px; padding: 20px; }
.course-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; border-bottom: 4px solid var(--orange); padding-bottom: 16px; }
.account { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 8px; color: var(--muted); font-size: .9rem; }
.team-badge, .pill { background: #e9f2f8; color: var(--blue); padding: 4px 7px; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.tabs { display: flex; gap: 7px; overflow-x: auto; padding: 16px 0 18px; }
.tabs a { flex: 0 0 auto; padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; background: white; text-decoration: none; font-size: .86rem; font-weight: 750; }
.tabs a.active { background: var(--blue); color: white; border-color: var(--blue); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.section-heading { margin: 3px 0 16px; }
.section-heading h2 { margin: 0; }
.section-heading p:last-child { color: var(--muted); }
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.course-item { background: white; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 9px; padding: 16px; }
.course-item.upcoming { border-top-color: #8a949d; opacity: .72; }
.course-item.upcoming.instructor-access { border-top-color: var(--blue); opacity: 1; }
.course-item.instructor-access .status.upcoming { color: var(--blue); }
.course-item.due-soon { border-top-color: var(--orange); }
.course-item.overdue { border-top-color: var(--red); }
.course-item h3 { margin: 16px 0 6px; }
.course-item > p { color: var(--muted); line-height: 1.45; }
.item-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.status { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.status.open { color: var(--green); }
.status.due-soon { color: var(--orange); }
.status.overdue { color: var(--red); }
.status.upcoming { color: var(--muted); }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 16px 0; }
.dates div { background: var(--bg); border-radius: 6px; padding: 8px; }
.dates dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; font-weight: 800; }
.dates dd { margin: 2px 0 0; font-size: .84rem; font-weight: 700; }
.resource-links a { font-size: .8rem; }
.todo-panel { position: sticky; top: 16px; background: white; border: 1px solid var(--line); border-radius: 9px; padding: 16px; }
.todo-heading h2 { margin: 0 0 12px; }
.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-list li { padding: 11px 0; border-top: 1px solid var(--line); }
.todo-list li:first-child { border-top: 0; }
.todo-list a, .todo-list span, .todo-list strong { display: block; }
.todo-list a { font-weight: 800; text-decoration: none; }
.todo-list span { color: var(--muted); font-size: .76rem; margin-top: 3px; }
.todo-list strong { font-size: .8rem; margin-top: 4px; }
.grade-placeholder { max-width: 780px; }
.grade-scale { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 18px 0; }
.grade-scale div { background: var(--bg); border-radius: 7px; padding: 12px; }
.grade-scale strong, .grade-scale span { display: block; }
.grade-scale span { color: var(--muted); font-size: .83rem; margin-top: 5px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .todo-panel { position: static; } }
@media (max-width: 650px) { .info-grid, .item-grid, .grade-scale { grid-template-columns: 1fr; } .course-header { align-items: start; flex-direction: column; } .account { justify-content: start; } .dates { grid-template-columns: 1fr; } }

/* Two-row course navigation */
.primary-tabs { padding-bottom: 8px; }
.secondary-tabs { padding-top: 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.secondary-tabs a { min-width: 150px; text-align: center; }

/* Resource cards have availability, not due-date status. */
.resource-item.available { border-top-color: var(--green); }
.status.available { color: var(--green); }
.course-item.submitted { border-top-color: var(--blue); }
.course-item.graded { border-top-color: var(--green); }
.status.submitted { color: var(--blue); }
.status.graded { color: var(--green); }

/* Grade tab */
.grade-summary { margin-bottom: 14px; }
.grade-summary h3 { margin-top: 0; }
.grade-table-wrap { overflow-x: auto; }
.grade-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grade-table th, .grade-table td { text-align: left; vertical-align: top; padding: 11px 9px; border-top: 1px solid var(--line); }
.grade-table thead th { border-top: 0; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.grade-table th:nth-child(1) { min-width: 150px; }
.grade-table th:nth-child(4) { min-width: 240px; }
.grade-result { font-weight: 800; color: var(--blue); white-space: nowrap; }

/* Instructor gradebook */
.instructor-page { max-width: 1180px; }
.flash { margin: 16px 0; padding: 11px 14px; border: 1px solid #b8d8c8; background: #eef7f2; border-radius: 7px; color: var(--green); font-weight: 800; }
.workflow-note { margin: 18px 0 26px; }
.workflow-note h2 { margin-top: 0; }
.grading-section { margin: 28px 0 44px; }
.selector { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.selector select { min-width: min(420px, 70vw); }
.grading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grade-editor { display: grid; gap: 12px; }
.grade-editor h3 { margin: 0; }
.grade-editor label:not(.check-row) { display: grid; gap: 5px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.grade-editor select, .grade-editor textarea, .selector select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font: inherit; }
.grade-editor textarea { resize: vertical; min-height: 90px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.check-row input { width: 18px; height: 18px; }

@media (max-width: 760px) {
    .grading-grid { grid-template-columns: 1fr; }
    .selector { align-items: stretch; flex-direction: column; }
    .selector select { min-width: 0; }
}

/* Numeric instructor grading */
.grade-editor input[type="number"] {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    color: var(--ink);
    font: inherit;
}
.computed-grade { margin: -3px 0 2px; font-size: .86rem; }
.team-record-note { padding: 8px 10px; border-radius: 6px; background: var(--bg); font-size: .82rem; }
.team-members { margin: 0 0 14px; color: var(--muted); }
.todo-note { margin: 14px 0 0; border-top: 1px solid var(--line); padding-top: 10px; }

/* The Grade tab becomes a full-width grading workspace for instructors. */
.layout.instructor-grade-layout { grid-template-columns: 1fr; }
.compact-heading { margin-bottom: 10px; }
.workflow-note h3 { margin-top: 0; }


/* Local-only account switcher. It is rendered only when local_debug_enabled() is true. */
.debug-switcher { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px dashed var(--line); border-radius: 6px; background: var(--bg); }
.debug-switcher label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.debug-switcher select, .debug-login select { padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font: inherit; }
.debug-switcher select { max-width: 230px; font-size: .8rem; }
.debug-login { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; max-width: 760px; }
.debug-login select { min-width: min(360px, 90vw); }
@media (max-width: 760px) { .debug-switcher { width: 100%; flex-wrap: wrap; } .debug-switcher select { max-width: 100%; flex: 1 1 220px; } }

/* Rubric-driven grading */
.rubric-stack, .student-rubric-stack { display: grid; gap: 14px; }
.rubric-editor, .student-rubric-card { padding: 0; overflow: hidden; }
.rubric-editor > summary, .student-rubric-card > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: white;
}
.rubric-editor > summary::-webkit-details-marker, .student-rubric-card > summary::-webkit-details-marker { display: none; }
.rubric-editor > summary::before, .student-rubric-card > summary::before { content: '▸'; color: var(--muted); font-weight: 900; }
.rubric-editor[open] > summary::before, .student-rubric-card[open] > summary::before { content: '▾'; }
.rubric-editor > summary > span:first-of-type, .student-rubric-card > summary > span:first-of-type { flex: 1; }
.rubric-editor summary small, .student-rubric-card summary small { display: block; color: var(--muted); margin-top: 3px; font-size: .75rem; font-weight: 500; }
.summary-meta { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.rubric-editor-body, .student-rubric-body { border-top: 1px solid var(--line); padding: 18px; }
.rubric-section + .rubric-section { margin-top: 24px; }
.rubric-section h4, .formative-block > h4, .student-rubric-body h4 { margin: 0 0 10px; color: var(--blue); }
.criterion-editor, .formative-guide { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 10px 0; background: #fff; }
.criterion-editor h5, .formative-guide h5, .member-feedback-card h5 { margin: 0 0 10px; color: var(--ink); font-size: 1rem; }
.descriptor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.descriptor-grid > div { background: var(--bg); border-radius: 7px; padding: 10px; min-width: 0; }
.descriptor-grid strong { color: var(--blue); font-size: .8rem; }
.descriptor-grid p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.criterion-inputs { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.criterion-inputs label, .formative-input-row label { display: grid; gap: 5px; color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.criterion-inputs input, .criterion-inputs textarea, .formative-input-row select, .formative-input-row textarea {
    width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font: inherit;
}
.criterion-inputs textarea, .formative-input-row textarea { resize: vertical; min-height: 72px; }
.rubric-save-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.rubric-save-row p { margin: 0; }
.calculation-note { background: #eef4f8; border-left: 4px solid var(--blue); padding: 10px 12px; border-radius: 5px; font-size: .85rem; }
.rubric-placeholder { padding: 14px; border: 1px dashed var(--line); border-radius: 7px; background: var(--bg); color: var(--muted); }
.formative-block { margin-top: 26px; padding-top: 20px; border-top: 2px solid var(--line); }
.member-feedback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.member-feedback-card { border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: var(--bg); display: grid; gap: 10px; }
.formative-input-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px; }
.student-grade-section { margin-top: 26px; }
.student-rubric-body h4:not(:first-child) { margin-top: 22px; }
.student-criteria-list { display: grid; gap: 8px; }
.student-criterion { border: 1px solid var(--line); border-radius: 7px; padding: 11px; }
.student-criterion > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.student-criterion p { margin: 7px 0 0; line-height: 1.45; font-size: .88rem; }
.personal-formative { margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--line); }
.personal-formative > h4 { margin-bottom: 2px; }

@media (max-width: 800px) {
    .descriptor-grid, .criterion-inputs, .member-feedback-grid, .formative-input-row { grid-template-columns: 1fr; }
    .rubric-editor > summary, .student-rubric-card > summary { align-items: flex-start; flex-wrap: wrap; }
    .summary-meta { width: 100%; padding-left: 22px; justify-content: space-between; }
    .rubric-save-row { align-items: stretch; flex-direction: column; }
}
