:root {
    --ink: #16201d;
    --ink-soft: #53605c;
    --muted: #7b8782;
    --paper: #ffffff;
    --canvas: #f4f6f2;
    --canvas-warm: #faf8f3;
    --line: #dfe5df;
    --line-strong: #cbd4cd;
    --green: #16794d;
    --green-dark: #105b3b;
    --green-soft: #e5f4ea;
    --orange: #c66b20;
    --orange-soft: #fff0df;
    --blue: #256f9d;
    --blue-soft: #e7f2f8;
    --rose: #aa3f52;
    --rose-soft: #fae9ed;
    --yellow: #9b7412;
    --yellow-soft: #fff7d8;
    --shadow: 0 12px 34px rgba(26, 45, 37, 0.08);
    --shadow-small: 0 4px 14px rgba(26, 45, 37, 0.07);
    --radius: 8px;
    --sidebar-width: 248px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

input,
textarea,
select {
    color: var(--ink);
}

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

h1,
h2,
h3 {
    line-height: 1.25;
}

.muted {
    color: var(--muted);
}

.compact {
    margin: 8px 0 0;
    font-size: 13px;
}

.mono {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
    line-height: 1.2;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
    box-shadow: 0 6px 16px rgba(22, 121, 77, 0.2);
}

.button-primary:hover {
    border-color: var(--green-dark);
    background: var(--green-dark);
}

.button-ghost {
    border-color: var(--line-strong);
    background: var(--paper);
}

.button-ghost:hover {
    border-color: var(--green);
    color: var(--green);
}

.button-danger-ghost {
    border-color: #e7b9c1;
    background: #fff;
    color: var(--rose);
}

.button-danger-ghost:hover {
    border-color: var(--rose);
    background: var(--rose-soft);
}

.button-small {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 13px;
}

.button-large {
    min-height: 50px;
    padding: 13px 24px;
    font-size: 16px;
}

.button-block {
    width: 100%;
}

.text-link {
    border: 0;
    padding: 0;
    background: none;
    color: var(--green);
    font-weight: 700;
}

.text-link:hover {
    text-decoration: underline;
}

.danger-link {
    color: var(--rose);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    font-size: 19px;
    font-weight: 900;
}

.brand > span:last-child {
    display: flex;
    flex-direction: column;
}

.brand strong {
    font-size: 15px;
    line-height: 1.3;
}

.brand small {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-small);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.builder-heading h2 {
    margin: 0;
    font-size: 19px;
}

.count-badge,
.code-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--canvas);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
}

.count-badge {
    min-height: 28px;
    padding: 4px 10px;
}

.code-chip {
    min-height: 30px;
    padding: 4px 10px;
    color: var(--green-dark);
    font-family: Consolas, monospace;
    font-size: 15px;
    letter-spacing: 0.08em;
}

.status-pill {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status-open {
    background: var(--green-soft);
    color: var(--green-dark);
}

.status-closed {
    background: var(--rose-soft);
    color: var(--rose);
}

.status-warning {
    background: var(--orange-soft);
    color: var(--orange);
}

.status-info {
    background: var(--blue-soft);
    color: var(--blue);
}

.status-neutral {
    background: #edf0ed;
    color: var(--ink-soft);
}

.field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
}

.field > span,
.field legend,
.field > label,
.field > .field-label {
    color: #35413d;
    font-size: 13px;
    font-weight: 800;
}

.field small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.field input,
.field textarea,
.field select,
.search-form input,
.search-form select,
.inline-form input,
.record-form input,
.record-form select {
    width: 100%;
    min-width: 0;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    outline: none;
    background: #fff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field textarea {
    min-height: 90px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.search-form input:focus,
.search-form select:focus,
.inline-form input:focus,
.record-form input:focus,
.record-form select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 121, 77, 0.12);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--canvas-warm);
}

.check-row input,
.check-inline input,
.choice-item input {
    width: 17px;
    height: 17px;
    margin: 3px 0 0;
    accent-color: var(--green);
}

.check-row span,
.check-inline span {
    display: flex;
    flex-direction: column;
}

.check-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-soft);
    font-weight: 700;
}

.check-inline span {
    display: inline;
}

.required-mark {
    color: var(--rose);
}

.alert {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid;
    border-radius: 7px;
    font-weight: 700;
}

.alert button {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
}

.alert-success {
    border-color: #b7ddc5;
    background: var(--green-soft);
    color: var(--green-dark);
}

.alert-error {
    border-color: #e8bcc4;
    background: var(--rose-soft);
    color: var(--rose);
}

.alert-warning {
    border-color: #ead49b;
    background: var(--yellow-soft);
    color: #725716;
}

.alert-info {
    border-color: #bbd4e3;
    background: var(--blue-soft);
    color: var(--blue);
}

.inline-message {
    margin: 18px 0;
    padding: 13px 15px;
    border-radius: 7px;
    font-weight: 700;
}

.inline-error {
    border: 1px solid #e8bcc4;
    background: var(--rose-soft);
    color: var(--rose);
}

.inline-warning {
    border: 1px solid #ead49b;
    background: var(--yellow-soft);
    color: #725716;
}

/* Admin shell */
.admin-shell {
    padding-left: var(--sidebar-width);
}

.sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    padding: 22px 17px 18px;
    background: #17251f;
    color: #eef6f0;
}

.sidebar .brand {
    padding: 0 6px 22px;
}

.sidebar .brand .brand-mark {
    background: #ddb34e;
    color: #253024;
}

.sidebar .brand small {
    color: #91a199;
}

.main-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.main-nav a {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 7px;
    color: #b8c5be;
    font-weight: 700;
    transition: background 0.18s ease, color 0.18s ease;
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.main-nav a.active {
    box-shadow: inset 3px 0 0 #ddb34e;
}

.nav-index {
    color: #73847b;
    font-family: Consolas, monospace;
    font-size: 11px;
}

.main-nav a.active .nav-index {
    color: #ddb34e;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.public-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    color: #d8e3dc;
    font-size: 13px;
    font-weight: 700;
}

.admin-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-identity > span:last-child {
    display: flex;
    flex-direction: column;
}

.admin-identity small {
    color: #91a199;
    font-size: 11px;
}

.avatar {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}

.avatar-soft {
    background: var(--green-soft);
    color: var(--green-dark);
}

.app-frame {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    z-index: 25;
    top: 0;
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(244, 246, 242, 0.94);
    backdrop-filter: blur(12px);
}

.topbar-title p {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 11px;
}

.topbar-title h1 {
    margin: 0;
    font-size: 22px;
}

.menu-toggle {
    display: none;
}

.icon-button {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
}

.logout-form {
    margin: 0;
}

.page-content {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.sidebar-backdrop {
    display: none;
}

/* Dashboard */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    min-height: 146px;
    overflow: hidden;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-small);
}

.stat-card::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--green);
    content: "";
}

.stat-card.accent-blue::before {
    background: var(--blue);
}

.stat-card.accent-orange::before {
    background: var(--orange);
}

.stat-card.accent-rose::before {
    background: var(--rose);
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    margin: 10px 0 12px;
    font-size: 34px;
    line-height: 1;
}

.stat-card a {
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.quick-actions > a {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 82px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-small);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.quick-actions > a:hover {
    border-color: var(--green);
    transform: translateY(-2px);
}

.quick-icon,
.form-letter {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 900;
}

.quick-actions > a > span:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.quick-actions small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-arrow {
    color: var(--muted);
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

.data-list {
    padding: 4px 0;
}

.data-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
}

.data-row:last-child {
    border-bottom: 0;
}

.data-row:hover {
    background: #fafcfa;
}

.data-main {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.data-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-main small,
.data-value small {
    color: var(--muted);
    font-size: 11px;
}

.data-value {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    text-align: right;
}

.status-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #aeb8b3;
}

.dot-live {
    background: #24a467;
    box-shadow: 0 0 0 4px rgba(36, 164, 103, 0.12);
}

.empty-state {
    padding: 42px 28px;
    text-align: center;
}

.empty-state h2,
.empty-state h3 {
    margin-bottom: 8px;
}

.empty-state p {
    max-width: 560px;
    margin: 0 auto 20px;
    color: var(--muted);
}

.empty-number,
.state-symbol {
    display: block;
    margin-bottom: 12px;
    color: #b8c2bc;
    font-family: Consolas, monospace;
    font-size: 30px;
    font-weight: 900;
}

.compact-empty {
    padding: 30px 22px;
}

.page-empty {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.large-empty {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
}

/* Tables and page controls */
.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.page-lead {
    max-width: 760px;
}

.page-lead p {
    margin: 0;
    color: var(--ink-soft);
}

.search-form {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.search-form input {
    width: min(320px, 100%);
}

.search-form select {
    width: auto;
    min-width: 140px;
}

.action-group,
.row-actions,
.detail-actions,
.card-actions,
.success-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

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

.row-actions form {
    margin: 0;
}

.align-right {
    text-align: right;
}

.table-panel {
    overflow: hidden;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

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

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8faf7;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

tbody tr:hover {
    background: #fcfdfb;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.table-empty {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.person-cell,
.table-title-cell {
    display: flex;
    min-width: 155px;
    align-items: center;
    gap: 10px;
}

.person-cell > span:last-child,
.table-title-cell > span:last-child,
.stacked-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.person-cell small,
.table-title-cell small,
.stacked-text small {
    color: var(--muted);
    font-size: 11px;
}

.table-title-cell {
    min-width: 260px;
}

.answer-cell {
    min-width: 150px;
    max-width: 380px;
    white-space: normal;
}

.wide-table table {
    min-width: 900px;
}

.metric-inline strong {
    font-size: 17px;
}

.heading-progress {
    display: flex;
    width: 260px;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-track {
    height: 7px;
    flex: 1;
    overflow: hidden;
    border-radius: 99px;
    background: #e8eee9;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
}

/* Students */
.import-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid #b7d7c3;
    border-radius: var(--radius);
    background: #f4fbf6;
}

.import-panel h3 {
    margin-bottom: 4px;
}

.import-panel p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-form input[type="file"] {
    max-width: 330px;
    padding: 8px;
}

.student-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
    gap: 20px;
}

.sticky-panel {
    position: sticky;
    top: 98px;
}

.form-panel .stack-form {
    padding: 20px 22px 22px;
}

/* Attendance */
.session-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}

.session-card {
    display: flex;
    min-height: 310px;
    flex-direction: column;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-small);
}

.session-card-top,
.session-footer,
.detail-kicker,
.form-status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.session-mode {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.session-card h2 {
    margin: 18px 0 8px;
    font-size: 20px;
}

.session-card > p {
    min-height: 48px;
    color: var(--ink-soft);
    font-size: 13px;
}

.session-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
    margin: 10px 0 20px;
}

.session-meta div {
    min-width: 0;
    padding: 9px 10px;
    border-radius: 6px;
    background: var(--canvas-warm);
}

.session-meta dt {
    color: var(--muted);
    font-size: 10px;
}

.session-meta dd {
    overflow: hidden;
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-card .progress-row {
    margin-top: auto;
}

.session-footer {
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    align-items: start;
    gap: 20px;
}

.editor-main {
    min-width: 0;
}

.editor-main > .stack-form {
    padding: 22px;
}

.editor-side {
    position: sticky;
    top: 98px;
    overflow: hidden;
}

.editor-side > .field,
.range-fields,
.editor-note {
    margin: 20px 22px;
}

.range-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.editor-note {
    padding: 15px;
    border-left: 3px solid var(--blue);
    background: var(--blue-soft);
}

.editor-note.accent-note {
    border-left-color: var(--orange);
    background: var(--orange-soft);
}

.editor-note strong {
    display: block;
    margin-bottom: 4px;
}

.editor-note p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 12px;
}

.editor-side-actions {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 18px 22px 22px;
    border-top: 1px solid var(--line);
}

.segmented-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 7px;
}

.segmented-options label {
    cursor: pointer;
}

.segmented-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-options span {
    display: flex;
    min-height: 88px;
    flex-direction: column;
    justify-content: center;
    padding: 14px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
}

.segmented-options input:checked + span {
    border-color: var(--green);
    background: var(--green-soft);
    box-shadow: 0 0 0 2px rgba(22, 121, 77, 0.08);
}

.segmented-options small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.detail-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--green);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-small);
}

.detail-hero h1 {
    margin: 13px 0 7px;
    font-size: 29px;
}

.detail-hero p {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--ink-soft);
}

.detail-kicker {
    justify-content: flex-start;
    color: var(--muted);
    font-size: 12px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 15px;
    color: var(--muted);
    font-size: 12px;
}

.checkin-banner {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) auto;
    align-items: end;
    gap: 18px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid #b7d7c3;
    border-radius: var(--radius);
    background: #f4fbf6;
}

.checkin-code-block,
.checkin-link-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkin-code-block > span,
.checkin-link-block > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.checkin-code-block strong {
    color: var(--green-dark);
    font-family: Consolas, monospace;
    font-size: 28px;
    letter-spacing: 0.13em;
}

.copy-field,
.record-form {
    display: flex;
    align-items: center;
    gap: 7px;
}

.copy-field input,
.record-form input,
.record-form select {
    min-height: 38px;
    padding: 7px 9px;
}

.record-form {
    min-width: 430px;
}

.record-form select {
    width: 100px;
}

.record-form input {
    flex: 1;
}

.compact-stats .stat-card {
    min-height: 112px;
}

.compact-stats .stat-card strong {
    margin-bottom: 0;
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-top: 1px solid #ebcbd1;
    background: #fffafb;
}

.danger-zone p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* Form builder */
.builder-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 23px 22px 16px;
    border-top: 1px solid var(--line);
}

.field-builder {
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 0 22px 22px;
}

.field-builder-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fcfdfb;
}

.builder-row-index {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 7px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-family: Consolas, monospace;
    font-size: 12px;
    font-weight: 900;
}

.builder-row-content {
    min-width: 0;
}

.builder-top-row {
    margin-bottom: 14px;
}

.builder-row-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 13px;
}

.field-option-input {
    margin-top: 13px;
}

/* Public pages */
.student-page {
    background: var(--canvas-warm);
}

.student-header,
.public-header {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px max(22px, calc((100vw - 1200px) / 2));
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.student-header-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.student-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    align-items: end;
    gap: 40px;
    width: min(1200px, calc(100% - 44px));
    margin: 0 auto;
    padding: 62px 0 48px;
}

.student-hero-copy {
    max-width: 760px;
}

.student-hero h1 {
    margin-bottom: 15px;
    font-size: clamp(34px, 5vw, 58px);
    font-weight: 900;
}

.student-hero-copy > p:last-child {
    max-width: 690px;
    margin-bottom: 0;
    color: var(--ink-soft);
    font-size: 17px;
}

.hero-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.hero-summary div {
    display: flex;
    min-height: 120px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.hero-summary div + div {
    border-left: 1px solid var(--line);
}

.hero-summary strong {
    font-size: 34px;
    line-height: 1;
}

.hero-summary span {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.student-section {
    width: min(1200px, calc(100% - 44px));
    margin: 0 auto;
    padding: 0 0 70px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 0;
    font-size: 28px;
}

.section-heading > p {
    max-width: 520px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.form-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.collection-card {
    display: flex;
    min-height: 320px;
    flex-direction: column;
    padding: 23px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-small);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.collection-card:hover {
    border-color: #a9cdb7;
    transform: translateY(-2px);
}

.collection-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sequence {
    color: var(--muted);
    font-family: Consolas, monospace;
    font-size: 12px;
}

.collection-card h3 {
    margin: 22px 0 10px;
    font-size: 24px;
}

.collection-card > p {
    min-height: 52px;
    color: var(--ink-soft);
}

.collection-card .card-actions {
    margin-top: auto;
    padding-top: 21px;
    border-top: 1px solid var(--line);
}

.public-form-shell {
    width: min(860px, calc(100% - 36px));
    margin: 0 auto;
    padding: 44px 0 70px;
}

.public-form-card,
.success-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.public-form-head {
    padding: 32px 34px 28px;
    border-bottom: 1px solid var(--line);
    background: #fbfdfb;
}

.public-form-head h1 {
    margin: 15px 0 12px;
    font-size: clamp(28px, 4vw, 42px);
}

.public-form-head > p {
    max-width: 700px;
    margin-bottom: 0;
    color: var(--ink-soft);
    font-size: 16px;
}

.public-form-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
}

.form-status-line {
    justify-content: flex-start;
    color: var(--muted);
    font-size: 12px;
}

.public-answer-form {
    padding: 30px 34px 34px;
}

.person-match-block,
.answer-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.person-match-block {
    padding: 20px;
    border: 1px solid #b7d7c3;
    border-radius: 7px;
    background: #f5fbf7;
}

.person-match-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.person-match-heading h2 {
    margin: 0 0 3px;
    font-size: 20px;
}

.person-match-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.step-number {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    background: var(--green);
    color: #fff;
    font-family: Consolas, monospace;
    font-size: 12px;
    font-weight: 900;
}

.student-picker {
    position: relative;
}

.student-suggestions {
    position: absolute;
    z-index: 50;
    top: calc(100% + 5px);
    right: 0;
    left: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 16px 32px rgba(22, 37, 31, 0.15);
}

.student-suggestion {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    text-align: left;
}

.student-suggestion:last-child {
    border-bottom: 0;
}

.student-suggestion:hover,
.student-suggestion.active {
    background: var(--green-soft);
}

.student-suggestion strong {
    display: block;
}

.student-suggestion small {
    color: var(--muted);
}

.public-question {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 13px;
    padding: 21px 0;
    border-bottom: 1px solid var(--line);
}

.public-question:last-child {
    border-bottom: 0;
}

.question-index {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--muted);
    font-family: Consolas, monospace;
    font-size: 11px;
    font-weight: 900;
}

.choice-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.choice-item {
    display: flex;
    min-height: 42px;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    font-weight: 600;
}

.choice-item:hover {
    border-color: var(--green);
}

.submit-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding-top: 25px;
    border-top: 1px solid var(--line);
}

.submit-zone p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.unavailable-state {
    padding: 36px;
    text-align: center;
}

.unavailable-state strong {
    display: block;
    font-size: 19px;
}

.unavailable-state p {
    margin: 8px 0 20px;
    color: var(--muted);
}

.checkin-card {
    overflow: visible;
}

.checkin-card > .stack-form {
    padding: 28px 34px;
}

.code-input-field input {
    height: 58px;
    font-family: Consolas, monospace;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-align: center;
    text-transform: uppercase;
}

.availability-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 22px 34px 0;
    padding: 13px 15px;
    border-radius: 7px;
}

.availability-banner.available {
    background: var(--green-soft);
    color: var(--green-dark);
}

.availability-banner.unavailable {
    background: var(--rose-soft);
    color: var(--rose);
}

.availability-banner span {
    font-size: 12px;
}

.public-session-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 20px 34px 0;
}

.public-session-meta div {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--canvas-warm);
}

.public-session-meta dt {
    color: var(--muted);
    font-size: 10px;
}

.public-session-meta dd {
    margin: 2px 0 0;
    font-weight: 800;
}

.form-result {
    padding: 13px 15px;
    border-radius: 7px;
    font-weight: 700;
}

.form-result.success {
    background: var(--green-soft);
    color: var(--green-dark);
}

.form-result.error {
    background: var(--rose-soft);
    color: var(--rose);
}

/* Progress and success */
.progress-page {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
    padding: 44px 0 70px;
}

.progress-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px;
    align-items: center;
    gap: 30px;
    margin-bottom: 18px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-small);
}

.progress-hero h1 {
    margin-bottom: 10px;
    font-size: 36px;
}

.progress-hero p:last-child {
    margin-bottom: 0;
    color: var(--ink-soft);
}

.progress-ring {
    display: grid;
    width: 150px;
    height: 150px;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--green) var(--progress), #e6ece7 0);
}

.progress-ring > div {
    display: flex;
    width: 116px;
    height: 116px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
}

.progress-ring strong {
    font-size: 25px;
}

.progress-ring span {
    color: var(--muted);
    font-size: 11px;
}

.progress-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.progress-summary div {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.progress-summary .highlight {
    border-color: #e6bec6;
    background: var(--rose-soft);
    color: var(--rose);
}

.progress-summary strong {
    font-size: 28px;
}

.progress-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.missing-panel {
    margin-bottom: 18px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-small);
}

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

.name-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.name-item.missing {
    border-color: #e8cbd1;
    background: #fffafb;
}

.name-item > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.name-item small {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-check {
    display: inline-grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 900;
}

.complete-state {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border: 1px solid #b7ddc5;
    border-radius: 7px;
    background: var(--green-soft);
}

.complete-state > span {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 22px;
}

.complete-state h3,
.complete-state p {
    margin: 0;
}

.submitted-details summary {
    display: flex;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 800;
}

.submitted-details[open] summary {
    margin-bottom: 18px;
}

.compact-name-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.success-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.success-card {
    width: min(620px, 100%);
    padding: 46px;
    text-align: center;
}

.success-symbol {
    display: grid;
    width: 74px;
    height: 74px;
    margin: 0 auto 20px;
    place-items: center;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 34px;
}

.success-card h1 {
    margin-bottom: 12px;
    font-size: 34px;
}

.success-card > p:not(.eyebrow) {
    color: var(--ink-soft);
}

.success-actions {
    justify-content: center;
    margin-top: 24px;
}

/* Login */
.login-page {
    background: #f2f5f1;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
}

.login-intro {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px clamp(36px, 7vw, 110px);
    background: #17251f;
    color: #f1f7f3;
}

.login-intro .brand small {
    color: #91a199;
}

.login-intro .brand .brand-mark {
    background: #ddb34e;
    color: #253024;
}

.login-copy {
    max-width: 700px;
}

.login-copy h1 {
    margin-bottom: 20px;
    font-size: clamp(40px, 5vw, 68px);
}

.login-copy > p:last-child {
    max-width: 600px;
    color: #b8c5be;
    font-size: 18px;
}

.login-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    color: #b8c5be;
    font-size: 12px;
}

.login-metrics strong {
    color: #f5c85e;
    font-size: 20px;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 34px;
    background: #fff;
}

.login-form-wrap {
    width: min(410px, 100%);
}

.login-form-wrap h2 {
    margin-bottom: 7px;
    font-size: 31px;
}

.login-form-wrap > .muted {
    margin-bottom: 26px;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--green);
    font-weight: 700;
}

@media (max-width: 1180px) {
    .stat-grid,
    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .student-layout {
        grid-template-columns: minmax(0, 1fr) 310px;
    }
}

@media (max-width: 960px) {
    .admin-shell {
        padding-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 35;
        inset: 0;
        display: block;
        visibility: hidden;
        background: rgba(12, 20, 17, 0.44);
        opacity: 0;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    body.sidebar-open .sidebar-backdrop {
        visibility: visible;
        opacity: 1;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar {
        padding: 12px 18px;
    }

    .page-content {
        padding: 20px;
    }

    .split-grid,
    .student-layout,
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .sticky-panel,
    .editor-side {
        position: static;
    }

    .student-hero {
        grid-template-columns: 1fr;
        gap: 25px;
        padding-top: 45px;
    }

    .hero-summary {
        max-width: 430px;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-intro {
        min-height: 430px;
    }

    .checkin-banner {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .detail-hero {
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .topbar-title p {
        display: none;
    }

    .topbar-title h1 {
        font-size: 18px;
    }

    .logout-form .button {
        padding: 7px 9px;
    }

    .page-content {
        padding: 16px;
    }

    .stat-grid,
    .quick-actions,
    .session-grid,
    .form-card-grid,
    .progress-summary,
    .name-grid,
    .compact-name-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 116px;
    }

    .page-actions,
    .section-heading,
    .import-panel,
    .danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .section-heading > p {
        text-align: left;
    }

    .search-form,
    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form input,
    .search-form select,
    .inline-form input[type="file"] {
        width: 100%;
        max-width: none;
    }

    .field-row,
    .segmented-options,
    .choice-list,
    .public-session-meta {
        grid-template-columns: 1fr;
    }

    .student-header,
    .public-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 18px;
    }

    .student-header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .student-header-actions .button {
        flex: 1;
    }

    .student-hero,
    .student-section {
        width: min(100% - 32px, 1200px);
    }

    .student-hero h1 {
        font-size: 36px;
    }

    .collection-card {
        min-height: 0;
    }

    .collection-card .card-actions {
        margin-top: 20px;
    }

    .public-form-shell,
    .progress-page {
        width: min(100% - 24px, 860px);
        padding-top: 22px;
    }

    .public-form-head,
    .public-answer-form,
    .checkin-card > .stack-form {
        padding: 23px 20px;
    }

    .availability-banner,
    .public-session-meta {
        margin-right: 20px;
        margin-left: 20px;
    }

    .availability-banner {
        align-items: flex-start;
        flex-direction: column;
    }

    .progress-hero {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .progress-ring {
        width: 128px;
        height: 128px;
        justify-self: center;
    }

    .progress-ring > div {
        width: 98px;
        height: 98px;
    }

    .missing-panel {
        padding: 19px;
    }

    .field-builder-row {
        grid-template-columns: 1fr;
    }

    .builder-row-index {
        width: 30px;
        height: 30px;
    }

    .record-form {
        min-width: 360px;
    }

    .login-intro {
        min-height: 380px;
        padding: 34px 24px;
    }

    .login-copy h1 {
        font-size: 40px;
    }

    .login-panel {
        padding: 28px 20px 45px;
    }
}

@media (max-width: 440px) {
    .student-hero h1 {
        font-size: 31px;
    }

    .hero-summary {
        grid-template-columns: 1fr;
    }

    .hero-summary div {
        min-height: 90px;
    }

    .hero-summary div + div {
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .success-card {
        padding: 32px 22px;
    }
}

