:root {
    --bg: #eef3f7;
    --panel: #ffffff;
    --panel-soft: #f7fafc;
    --ink: #102033;
    --muted: #5f6f82;
    --line: rgba(79, 99, 122, .22);
    --line-strong: rgba(79, 99, 122, .42);
    --teal: #0f766e;
    --blue: #2563eb;
    --sky: #0ea5e9;
    --green: #15803d;
    --red: #b91c1c;
    --amber: #b45309;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(15, 118, 110, .10), rgba(15, 118, 110, 0) 340px),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
}

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
}

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background: #102033;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    text-decoration: none;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.brand-mark {
    width: 184px;
    height: 184px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .10);
    font-weight: 900;
}

.brand-mark img {
    width: 150px;
    height: 150px;
    object-fit: contain;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .72);
}

.nav-stack {
    display: grid;
    gap: 8px;
}

.nav-stack a,
.rail-user a {
    text-decoration: none;
    border-radius: 8px;
}

.nav-stack a {
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .11);
    background: rgba(255, 255, 255, .06);
    font-weight: 800;
}

.nav-stack a:hover,
.nav-stack a:focus {
    background: rgba(255, 255, 255, .12);
}

.rail-user {
    margin-top: auto;
    display: grid;
    gap: 10px;
    color: rgba(255, 255, 255, .82);
}

.rail-user a {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .08);
}

.workspace {
    min-width: 0;
    padding: clamp(18px, 3vw, 38px);
}

main {
    max-width: 1360px;
    margin: 0 auto;
}

.hero,
.panel,
.login-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 18px 42px rgba(16, 32, 51, .08);
}

.hero {
    min-height: 230px;
    padding: clamp(22px, 4vw, 42px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
    gap: 22px;
    align-items: end;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, .12), rgba(29, 78, 216, .08)),
        #ffffff;
}

.hero.compact {
    min-height: 150px;
    margin-bottom: 18px;
}

.eyebrow,
.kicker {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
    font-weight: 900;
    color: var(--teal);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(32px, 4.4vw, 58px);
    line-height: 1;
}

h2 {
    margin-bottom: 0;
    font-size: 21px;
}

h3 {
    margin-bottom: 6px;
}

.muted,
.task-card p,
.simple-list span,
.workflow-grid p,
.med-item span {
    color: var(--muted);
}

.small-note {
    margin: 6px 0 0;
    font-size: 13px;
}

.hero-actions,
.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-actions {
    justify-content: flex-end;
}

.btn,
button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, .24);
    background: #eef6ff;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.btn.primary,
button.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.btn.danger,
button.danger {
    border-color: rgba(185, 28, 28, .28);
    background: #fef2f2;
    color: var(--red);
}

.btn.success,
button.success {
    border-color: rgba(21, 128, 61, .28);
    background: #ecfdf5;
    color: var(--green);
}

.btn.warning,
button.warning {
    border-color: rgba(180, 83, 9, .28);
    background: #fffbeb;
    color: var(--amber);
}

.btn:disabled,
button:disabled,
.disabled-link {
    opacity: .55;
    pointer-events: none;
    cursor: default;
}

.compact-action {
    min-height: 32px;
    margin-top: 10px;
    padding: 0 9px;
    font-size: 12px;
}

.compact-buttons {
    align-items: center;
}

.icon-btn {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
}

.metric-grid {
    margin: 18px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.metric {
    min-height: 128px;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.metric span {
    display: block;
    margin-bottom: 14px;
    color: var(--muted);
    font-weight: 850;
}

.metric strong {
    display: block;
    font-size: 52px;
    line-height: .9;
}

.metric.hot {
    background: #102033;
    color: #fff;
}

.metric.hot span {
    color: rgba(255, 255, 255, .75);
}

.panel {
    margin-bottom: 18px;
    padding: clamp(16px, 2.4vw, 26px);
}

.panel.subdued {
    background: var(--panel-soft);
}

.slim-panel {
    padding: 16px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.card-grid,
.workflow-grid,
.round-grid {
    display: grid;
    gap: 14px;
}

.card-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
    align-items: stretch;
}

.workflow-grid,
.round-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.task-card,
.workflow-grid article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 18px;
}

.task-card {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    max-width: 360px;
}

.task-card.compact-card {
    min-height: 142px;
}

.task-card .btn {
    margin-top: auto;
    align-self: flex-start;
}

.task-card .button-row .btn,
.task-card .button-row button {
    margin-top: 0;
    align-self: center;
}

.admin-success {
    position: sticky;
    top: 12px;
    z-index: 10;
    border-color: rgba(15, 118, 110, .35);
    background: #dffcf3;
    color: #0f5132;
    font-size: 20px;
    box-shadow: var(--shadow);
}

.danger-zone {
    margin-top: 18px;
}

.matrix-scroll {
    overflow-x: auto;
}

.permission-matrix {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.matrix-student-col {
    width: 220px;
}

.matrix-select-col {
    width: 138px;
}

.matrix-med-col {
    width: 132px;
}

.permission-matrix th,
.permission-matrix td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    vertical-align: middle;
}

.permission-matrix th:first-child {
    position: sticky;
    left: 0;
    background: #fff;
    text-align: left;
    z-index: 1;
}

.permission-matrix thead th:not(:first-child) {
    white-space: normal;
    overflow-wrap: anywhere;
}

.permission-matrix .row-select-all {
    width: 122px;
    justify-content: flex-start;
}

.matrix-check {
    appearance: none;
    width: 24px;
    height: 24px;
    margin: 0;
    display: inline-grid;
    place-content: center;
    border: 1px solid rgba(21, 128, 61, .38);
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
}

.matrix-check::before {
    content: "";
    width: 13px;
    height: 13px;
    transform: scale(0);
    transition: transform .12s ease;
    clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 16%, 84% 0, 36% 68%);
    background: #fff;
}

.matrix-check:checked {
    border-color: #15803d;
    background: #16a34a;
}

.matrix-check:checked::before {
    transform: scale(1);
}

.permission-matrix td:has(.locked-permission) {
    background: #f1f5f9;
    color: #64748b;
}

.locked-permission {
    opacity: .55;
    cursor: default;
}

.lock-note {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}

.matrix-toolbar {
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.matrix-toolbar-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.matrix-toolbar-right {
    margin-left: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.matrix-save {
    margin-left: 0;
}

.workflow-grid span {
    width: 36px;
    height: 36px;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--teal);
    color: #fff;
    font-weight: 900;
}

.pill {
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: var(--muted);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
}

.pill-label,
.toggle-label {
    display: inline-block;
    line-height: 1;
    transform: translateY(1.5px);
}

.pill.danger {
    border-color: rgba(185, 28, 28, .28);
    background: #fef2f2;
    color: var(--red);
}

.pill.success {
    border-color: rgba(21, 128, 61, .28);
    background: #ecfdf5;
    color: var(--green);
}

.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.search-form .field {
    max-width: 420px;
}

.search-form .field input,
.search-form .field select {
    min-height: 42px;
}

.search-form .btn,
.search-form button {
    width: 132px;
}

.student-search {
    display: grid;
    grid-template-columns: minmax(220px, 420px) max-content;
    gap: 12px;
    align-items: end;
}

.student-search .field input {
    min-height: 42px;
}

.student-search .btn {
    width: 132px;
}

.toolbar-action {
    min-height: 38px;
    width: auto;
    padding-inline: 14px;
    background: #eef6ff;
    color: #17426d;
}

.student-card-grid {
    justify-content: center;
}

.student-card {
    position: relative;
    min-height: 126px;
    padding-bottom: 52px;
    border-color: rgba(15, 118, 110, .18);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
    align-items: center;
    text-align: center;
}

.student-card .button-row {
    justify-content: center;
}

.student-card .btn,
.student-card .button-row .btn {
    align-self: center;
}

.student-open-btn {
    min-height: 36px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 850;
}

.student-card .student-open-btn {
    min-width: 112px;
}

.student-indicator-row {
    display: flex;
    min-height: 22px;
    margin: 4px 0 8px;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.student-indicator {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.student-indicator.medical {
    border: 1px solid rgba(37, 99, 235, .35);
    background: #dbeafe;
    color: #1d4ed8;
}

.student-indicator.allergy {
    border: 1px solid rgba(185, 28, 28, .35);
    background: #fee2e2;
    color: #b91c1c;
}

.table-indicators {
    min-height: 20px;
    margin: 4px 0 0;
    justify-content: flex-start;
}

.student-card-remove {
    position: absolute;
    right: 12px;
    bottom: 12px;
}

.student-card:hover {
    border-color: rgba(15, 118, 110, .34);
    transform: translateY(-1px);
}

.result-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.round-student-controls {
    margin: 14px 0;
    justify-content: space-between;
}

.round-student-grid {
    margin-top: 12px;
}

.segmented {
    display: inline-flex;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    gap: 2px;
}

.segmented a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
}

.segmented.compact a {
    min-width: 42px;
    justify-content: center;
    padding: 0 8px;
}

.segmented a.active {
    background: var(--blue);
    color: #fff;
}

.add-list-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.import-table tr.excluded-row,
.import-table tr:has(input[type="checkbox"]:not(:checked)) {
    background: #f1f5f9;
    color: #64748b;
}

.import-table tr.duplicate-row {
    background: #fff7ed;
}

.import-table td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.results-note {
    margin-top: 14px;
    text-align: center;
}

.log-list {
    display: grid;
    gap: 10px;
}

.log-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.log-main {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.log-head {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.log-row p {
    margin: 0;
    overflow-wrap: anywhere;
}

.log-row small {
    color: var(--muted);
}

.log-row details {
    max-width: 100%;
}

.log-row pre {
    max-height: 220px;
    overflow: auto;
    padding: 12px;
    border-radius: 8px;
    background: #0f172a;
    color: #e5e7eb;
    white-space: pre-wrap;
}

.collapse-panel {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.collapse-panel summary {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    list-style: none;
}

.collapse-panel summary::-webkit-details-marker {
    display: none;
}

.collapse-panel summary::before {
    content: ">";
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eefcf8;
    color: var(--teal);
    font-weight: 900;
    transition: transform .16s ease;
}

.collapse-panel[open] summary::before {
    transform: rotate(90deg);
}

.collapse-panel summary span {
    display: grid;
    gap: 2px;
}

.collapse-panel summary strong {
    font-size: 17px;
}

.collapse-panel summary small {
    color: var(--muted);
}

.collapse-body {
    padding: 0 16px 16px 56px;
}

.med-item a {
    text-decoration: none;
}

.empty {
    padding: 18px;
    border-radius: 8px;
    border: 1px dashed var(--line-strong);
    background: #f8fafc;
    color: var(--muted);
    font-weight: 750;
}

.simple-list {
    display: grid;
    gap: 8px;
}

.simple-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.record-list {
    display: grid;
    gap: 10px;
}

.selection-list,
.mapping-grid,
.import-preview {
    display: grid;
    gap: 10px;
}

.selection-row,
.mapping-row {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.selection-row {
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    cursor: pointer;
}

.selection-row.disabled-row {
    opacity: .72;
    cursor: default;
}

.selection-row input {
    width: 22px;
    height: 22px;
    accent-color: var(--teal);
}

.selection-row strong,
.selection-row small,
.mapping-row strong,
.mapping-row span {
    display: block;
}

.selection-row small,
.mapping-row span {
    color: var(--muted);
}

.mapping-row {
    grid-template-columns: minmax(180px, .7fr) minmax(220px, 1fr);
    align-items: center;
}

.mapping-row select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.import-workflow {
    margin-top: 14px;
}

.record-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(220px, .8fr) minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.archived-card,
.archived-row {
    background: #f1f5f9 !important;
    color: #64748b;
}

.archive-marker {
    position: absolute;
    right: 10px;
    bottom: 10px;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid rgba(185, 28, 28, .24);
    background: #fee2e2;
    color: #991b1b;
    font-size: 11px;
    font-weight: 850;
}

.archive-marker.inline {
    position: static;
}

.toggle-pill {
    height: 34px;
    gap: 8px;
    padding: 0 12px 0 7px;
    border-radius: 999px;
    border: 1px solid rgba(79, 99, 122, .26);
    background: #f1f5f9;
    color: #475569;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1;
}

.toggle-pill > span:first-child {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow: inset 0 0 0 4px #fff;
    transform: none;
}

.toggle-pill.on {
    border-color: rgba(21, 128, 61, .28);
    background: #ecfdf5;
    color: #166534;
}

.toggle-pill.on > span:first-child {
    background: var(--green);
}

.inline-control-form {
    align-self: end;
}

.teacher-record-row {
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 96px 72px 132px 72px;
    align-items: end;
}

.teacher-delete-button {
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
    align-self: end;
}

.confirm-dialog {
    max-width: min(420px, calc(100vw - 32px));
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}

.confirm-dialog::backdrop {
    background: rgba(15, 23, 42, .36);
}

.teacher-status {
    align-self: end;
    min-width: 0;
}

.teacher-status .pill {
    width: 86px;
}

.teacher-status .small-note {
    text-align: center;
}

.record-row strong,
.record-row span {
    display: block;
}

.record-row span,
.record-row p {
    color: var(--muted);
}

.record-row p {
    margin: 0;
}

.report-generate-panel {
    padding: 14px;
}

.report-generate-form {
    display: grid;
    grid-template-columns: minmax(260px, 520px) auto;
    align-items: end;
    gap: 14px;
}

.report-list {
    display: grid;
    gap: 10px;
}

.report-row.missing-report {
    background: #f1f5f9;
    color: #64748b;
}

.report-row.missing-report strong,
.report-row.missing-report span,
.report-row.missing-report p {
    color: #64748b;
}

.report-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.report-actions form {
    margin: 0;
}

.round-panel {
    min-height: 320px;
}

.med-list {
    display: grid;
    gap: 10px;
}

.med-item {
    display: grid;
    place-items: center;
    min-height: 104px;
    padding: 12px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    text-align: center;
}

.round-med-content {
    width: 100%;
    min-width: 0;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 5px;
}

.med-item strong,
.med-item span {
    display: block;
}

.med-item strong a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.med-item > div > span {
    font-size: 11px;
    line-height: 1.25;
}

.round-administer-btn {
    min-width: 0;
    width: auto;
    min-height: 32px;
    padding: 0 14px;
    font-size: 12px;
    white-space: nowrap;
}

.round-status-pill {
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 999px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.round-status-pill.success {
    border: 1px solid #166534;
    background: #16a34a;
    color: #fff;
}

.round-status-pill.missed {
    border: 1px solid #b91c1c;
    background: #ffe4e6;
    color: #b91c1c;
}

.round-status-pill.late {
    border: 1px solid #b45309;
    background: #fed7aa;
    color: #92400e;
}

.med-item.due {
    border-color: rgba(185, 28, 28, .28);
    background: #fff7f7;
}

.med-item.done {
    border-color: rgba(21, 128, 61, .28);
    background: #f0fdf4;
}

.medication-plan-table th,
.medication-plan-table td {
    text-align: left;
    vertical-align: middle;
}

.medication-plan-table td:last-child {
    width: 1%;
    white-space: nowrap;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 18px;
}

.login-shell {
    width: min(440px, 100%);
}

.login-card {
    padding: 28px;
}

.login-logo {
    width: 64px;
    height: 64px;
    padding: 8px;
    border-radius: 8px;
    background: #102033;
    object-fit: contain;
}

.form-stack {
    display: grid;
    gap: 14px;
}

.date-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.date-jump .field {
    width: min(320px, 100%);
}

.round-stepper {
    margin: 0 0 18px;
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
}

.round-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    cursor: default;
}

.round-step span {
    grid-row: span 2;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e2e8f0;
    font-weight: 900;
}

.round-step strong,
.round-step small {
    display: block;
}

.round-step small {
    color: var(--muted);
}

.round-step.complete {
    border-color: rgba(21, 128, 61, .24);
    background: #f0fdf4;
}

.round-step.complete span {
    background: #bbf7d0;
    color: #166534;
}

.round-step.current {
    border-color: rgba(37, 99, 235, .34);
    background: #eff6ff;
    color: #1e3a8a;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .10);
}

.round-step.current span {
    background: var(--blue);
    color: #fff;
}

.teacher-row-form {
    display: contents;
}

.teacher-row-form .button-row .btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

.muted-row {
    opacity: .76;
}

.field {
    display: grid;
    gap: 6px;
}

.field label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 50px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 15px;
    font-family: inherit;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .18);
}

.alert {
    margin: 14px 0;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(185, 28, 28, .28);
    background: #fef2f2;
    color: var(--red);
    font-weight: 800;
    transition: opacity .28s ease, transform .28s ease, margin .28s ease, padding .28s ease;
}

.alert.success {
    border-color: rgba(21, 128, 61, .28);
    background: #f0fdf4;
    color: var(--green);
}

.alert.dismissed {
    opacity: 0;
    transform: translateY(-6px);
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.toggle-pill.mixed {
    border-color: rgba(180, 83, 9, .28);
    background: #fffbeb;
    color: var(--amber);
}

.toggle-pill.mixed > span:first-child {
    background: var(--amber);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.detail-grid div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.detail-grid .wide,
.confirm-form .wide {
    grid-column: 1 / -1;
}

.detail-grid span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.detail-grid strong {
    display: block;
    font-size: 17px;
}

.confirm-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-row {
    grid-column: 1 / -1;
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    font-weight: 850;
}

.check-row input {
    width: 22px;
    height: 22px;
    accent-color: var(--teal);
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.schedule-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) repeat(4, minmax(92px, 1fr));
    gap: 8px;
    align-items: stretch;
}

.schedule-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.schedule-date,
.schedule-cell {
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.schedule-cell {
    gap: 8px;
    cursor: pointer;
    font-weight: 800;
}

.schedule-cell input {
    width: 20px;
    height: 20px;
    accent-color: var(--blue);
}

.schedule-cell span {
    color: var(--muted);
    font-size: 13px;
}

.readonly-field input {
    background: #f8fafc;
    color: var(--muted);
}

.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.confirm-form .button-row {
    grid-column: 1 / -1;
}

.pill > .pill-label,
.toggle-pill > .toggle-label,
.round-status-pill > .pill-label {
    position: relative;
    top: 3px;
    display: inline-block;
    color: inherit !important;
    line-height: 1;
}

.round-status-pill.success > .pill-label {
    color: #fff !important;
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .rail {
        position: sticky;
        z-index: 10;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .brand {
        border-bottom: 0;
        padding-bottom: 0;
        flex: 1 1 auto;
        flex-direction: row;
        align-items: center;
    }

    .brand-mark {
        width: 72px;
        height: 72px;
    }

    .brand-mark img {
        width: 58px;
        height: 58px;
    }

    .nav-stack {
        order: 3;
        flex: 1 0 100%;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
    }

    .rail-user {
        margin-top: 0;
    }

    .hero,
    .workflow-grid,
    .round-grid {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 620px) {
    .workspace {
        padding: 10px;
    }

    .hero,
    .panel,
    .login-card {
        padding: 14px;
    }

    h1 {
        font-size: 36px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .hero-actions,
    .button-row,
    .date-jump,
    .report-generate-form,
    .teacher-row-form,
    .student-search {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .round-stepper {
        grid-template-columns: 1fr 1fr;
    }

    .panel-head,
    .result-controls {
        display: grid;
        grid-template-columns: 1fr;
        justify-content: stretch;
    }

    .collapse-body {
        padding: 0 12px 12px;
    }

    .simple-list div,
    .med-item,
    .record-row,
    .mapping-row,
    .log-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .detail-grid,
    .confirm-form,
    .check-grid,
    .schedule-grid {
        grid-template-columns: 1fr;
    }

    .schedule-head {
        display: none;
    }
}

@media print {
    .rail,
    .hero-actions,
    .btn {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .app-shell {
        display: block;
    }

    .workspace {
        padding: 0;
    }

    .hero,
    .panel,
    .metric {
        box-shadow: none;
        break-inside: avoid;
    }
}
