:root {
    --page: #f2faf9;
    --surface: #ffffff;
    --surface-soft: #f6fbfa;
    --surface-strong: #eef7f5;
    --ink: #172a32;
    --muted: #5e727b;
    --subtle: #879aa0;
    --line: #d9ebe9;
    --line-strong: #bddbd7;
    --brand-mint: #68e9a1;
    --brand-teal: #35b9b2;
    --brand-blue: #1768aa;
    --accent: #249f9c;
    --accent-strong: #1768aa;
    --accent-soft: #e5f8f4;
    --info: #1768aa;
    --info-soft: #e6f1fb;
    --success: #159b72;
    --success-soft: #e4f7ef;
    --warning: #b77916;
    --warning-soft: #fff4df;
    --danger: #cf3f36;
    --danger-soft: #fdebea;
    --heart-full: #e0453f;
    --heart-half: #e6aa24;
    --heart-empty: #c8d1d3;
    --amber: #b77916;
    --shadow-sm: 0 1px 2px rgba(14, 58, 72, 0.06);
    --shadow-md: 0 12px 28px rgba(14, 58, 72, 0.13);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(104, 233, 161, 0.12), transparent 26%),
        linear-gradient(180deg, #f8fcfb 0%, var(--page) 42%, #eef7f4 100%);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
    text-rendering: geometricPrecision;
}

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

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

button {
    cursor: pointer;
}

.mono {
    font-variant-numeric: tabular-nums;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.app-frame {
    display: flex;
    min-height: 100vh;
    background: var(--page);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    width: 232px;
    height: 100vh;
    flex-shrink: 0;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 251, 250, 0.98) 100%);
    color: var(--ink);
    border-right: 1px solid var(--line);
    box-shadow: 16px 0 40px rgba(17, 61, 73, 0.04);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(12px);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: linear-gradient(160deg, var(--brand-mint) 0%, var(--brand-teal) 48%, var(--brand-blue) 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.brand-logo {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
    box-shadow: none;
}

.brand-copy {
    min-width: 0;
}

.brand-title {
    display: block;
    overflow: hidden;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-subtitle {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.nav-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 10px;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    transition: background 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.nav-link i {
    width: 18px;
    color: #7a929a;
    text-align: center;
}

.nav-link:hover,
.nav-link.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    transform: translateX(2px);
    box-shadow: inset 0 0 0 1px rgba(36, 159, 156, 0.08);
}

.nav-link.is-active i {
    color: var(--accent);
}

.sidebar-footer {
    padding: 12px 14px 16px;
    border-top: 1px solid var(--line);
}

.sync-note {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

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

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

.topbar-content,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

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

.page-title-wrap {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.page-title {
    min-width: 0;
    color: var(--ink);
    font-size: 18px;
    font-weight: 750;
    line-height: 1.3;
}

.page-summary {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(36, 159, 156, 0.12);
    border-radius: 999px;
    background: rgba(229, 248, 244, 0.9);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.divider,
.topbar-meta .divider {
    width: 1px;
    height: 16px;
    background: var(--line);
}

.page-content {
    width: 100%;
    max-width: 1480px;
    padding: 24px 28px 36px;
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.section-title {
    margin: 0;
    color: var(--ink);
    font-size: 17px;
    font-weight: 750;
}

.section-caption {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.page-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 18px;
    padding: 22px;
    border: 1px solid rgba(36, 159, 156, 0.12);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(240, 251, 246, 0.96) 100%);
    box-shadow: 0 18px 42px rgba(15, 61, 72, 0.08);
}

.teacher-hero {
    border-color: rgba(21, 127, 110, 0.14);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(232, 249, 242, 0.98) 100%);
}

.dashboard-hero {
    border-color: rgba(23, 104, 170, 0.12);
}

.page-hero-copy {
    display: grid;
    gap: 10px;
    align-content: start;
}

.page-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(23, 104, 170, 0.08);
    color: var(--info);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-hero-title {
    margin: 0;
    color: var(--ink);
    font-size: clamp(24px, 2.6vw, 34px);
    line-height: 1.16;
    letter-spacing: -0.02em;
}

.page-hero-text {
    max-width: 62ch;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.status-strip {
    display: grid;
    gap: 10px;
    align-content: start;
}

.stat-chip {
    display: grid;
    gap: 4px;
    padding: 14px 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
}

.stat-chip.warning {
    border-color: rgba(183, 121, 22, 0.2);
    background: rgba(255, 244, 223, 0.92);
}

.stat-chip-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-chip strong {
    color: var(--ink);
    font-size: 15px;
    line-height: 1.35;
}

.count-pill,
.small-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

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

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

.metric-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-width: 0;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-align: left;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    background: linear-gradient(90deg, rgba(104, 233, 161, 0.9), rgba(36, 159, 156, 0.9), rgba(23, 104, 170, 0.9));
    opacity: 0;
    transition: opacity 150ms ease;
}

.metric-card > div:first-child {
    min-width: 0;
    flex: 1;
    text-align: left;
}

.metric-card[onclick] {
    cursor: pointer;
}

.metric-card-button {
    width: 100%;
    cursor: pointer;
}

.metric-card-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: 0 8px 20px rgba(22, 36, 30, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #fbfefd 100%);
}

.metric-card[onclick]:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: 0 8px 20px rgba(22, 36, 30, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #fbfefd 100%);
}

.metric-card:hover::after,
.metric-card.is-selected::after {
    opacity: 1;
}

.metric-card.ring-2,
.metric-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(21, 127, 110, 0.16), var(--shadow-sm);
}

.metric-label {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
    text-align: left;
}

.metric-value {
    margin-top: 8px;
    color: var(--ink);
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.teacher-metric-text {
    font-size: 18px;
    line-height: 1.35;
    word-break: break-all;
}

.metric-help {
    margin-top: 8px;
    color: var(--subtle);
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
}

.metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
}

.metric-icon.info {
    background: var(--info-soft);
    color: var(--info);
}

.metric-icon.success {
    background: var(--success-soft);
    color: var(--success);
}

.metric-icon.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.metric-icon.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-accent {
    color: var(--accent) !important;
}

.text-info {
    color: var(--info) !important;
}

.data-panel,
.chart-panel,
.profile-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(246, 251, 250, 0.92) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.single-row-toolbar {
    flex-wrap: nowrap;
}

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

.toolbar-group-grow {
    flex: 1;
    min-width: 220px;
}

.single-row-toolbar .toolbar-group {
    flex-wrap: nowrap;
}

.single-row-toolbar .toolbar-group-grow {
    min-width: 280px;
}

.single-row-toolbar .search-field {
    min-width: 0;
}

.single-row-toolbar .control.w-auto {
    width: auto;
}

.single-row-toolbar .btn {
    flex-shrink: 0;
}

.toolbar-group-end {
    justify-content: flex-end;
}

.panel-subbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 251, 250, 0.72);
}

.panel-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 750;
}

.search-field {
    position: relative;
    min-width: 220px;
    flex: 1;
}

.search-field i {
    position: absolute;
    top: 50%;
    left: 12px;
    color: var(--subtle);
    font-size: 13px;
    transform: translateY(-50%);
}

.control {
    width: 100%;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.35;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.search-field .control {
    padding-left: 36px;
}

.control::placeholder {
    color: #98a39d;
}

.control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21, 127, 110, 0.14);
}

.control[readonly] {
    background: var(--surface-soft);
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.btn.is-disabled {
    pointer-events: none;
    opacity: 0.52;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(21, 127, 110, 0.18);
}

.btn-compact {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 12px;
}

.scope-pill {
    min-height: 32px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: rgba(109, 233, 160, 0.28);
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-strong);
}

.btn-secondary {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--surface-soft);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #1e653c;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #9f342b;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--muted);
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.icon-button:hover {
    border-color: var(--line);
    background: var(--surface-soft);
    color: var(--ink);
}

.table-wrap {
    overflow-x: auto;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, #ffffff 100%);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    white-space: nowrap;
}

.data-table th {
    padding: 11px 14px;
    background: var(--surface-soft);
    color: var(--muted);
    text-align: left;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.data-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    text-align: left !important;
    font-size: 14px;
    line-height: 1.35;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 150ms ease;
}

.data-table tbody tr:hover {
    background: #f9fbfa;
}

.data-table .is-alert-row {
    background: var(--danger-soft);
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.person-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar,
.avatar-sm,
.avatar-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 800;
}

.avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 26px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 23px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
}

.badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.badge.neutral {
    border-color: var(--line);
    background: var(--surface-soft);
    color: var(--muted);
}

.badge.success {
    background: var(--success-soft);
    color: var(--success);
}

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

.badge.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

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

.badge.accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.tag {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.dept-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.teacher-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.teacher-section-head {
    margin-bottom: 14px;
}

.teacher-department-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.teacher-department-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff 0%, #f9fcfb 100%);
    box-shadow: var(--shadow-sm);
}

.teacher-department-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.teacher-department-top h3 {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    font-weight: 750;
}

.teacher-student-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hearts {
    display: flex;
    align-items: center;
    gap: 3px;
}

.heart-full {
    color: var(--heart-full) !important;
}

.heart-half {
    color: var(--heart-half) !important;
}

.heart-empty {
    color: var(--heart-empty) !important;
}

.empty-state {
    padding: 48px 16px;
    color: var(--subtle);
    text-align: center;
    font-size: 14px;
}

.empty-state i {
    display: block;
    margin-bottom: 10px;
    color: #b6c0ba;
    font-size: 28px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(20, 29, 25, 0.46);
}

.modal-card {
    width: min(100%, 560px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.modal-card.sm {
    width: min(100%, 420px);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}

.modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    background: var(--surface-soft);
}

.modal-title {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    font-weight: 750;
}

.modal-body {
    display: grid;
    gap: 14px;
    padding: 18px;
}

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

.field label,
.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

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

.field .flow-type-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.flow-type-option:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    background: var(--surface-soft);
}

.flow-type-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.flow-type-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    font-size: 12px;
}

.flow-type-deduction .flow-type-icon {
    background: var(--danger-soft);
    color: var(--danger);
}

.flow-type-recovery .flow-type-icon {
    background: var(--success-soft);
    color: var(--success);
}

.flow-type-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.flow-type-title {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.1;
}

.flow-type-desc {
    color: var(--subtle);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
}

.flow-type-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(109, 233, 160, 0.12);
}

.flow-type-deduction:has(input:checked) {
    border-color: rgba(207, 63, 54, 0.48);
    background: var(--danger-soft);
    box-shadow: 0 0 0 3px rgba(207, 63, 54, 0.1);
}

.flow-type-recovery:has(input:checked) {
    border-color: rgba(21, 155, 114, 0.5);
    background: var(--success-soft);
    box-shadow: 0 0 0 3px rgba(21, 155, 114, 0.12);
}

.flow-type-option:has(input:focus-visible) {
    box-shadow: 0 0 0 3px rgba(109, 233, 160, 0.2);
}

.student-picker {
    position: relative;
}

.student-suggestions {
    position: absolute;
    z-index: 70;
    right: 0;
    left: 0;
    top: calc(100% + 6px);
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow-md);
}

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

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

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

.student-suggestion-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.student-suggestion-name {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.1;
}

.student-suggestion-id {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.1;
}

.student-suggestion-dept {
    max-width: 120px;
    overflow: hidden;
    color: var(--subtle);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.student-selected-hint {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.student-selected-hint strong {
    color: var(--accent-strong);
    font-weight: 800;
}

.field-note {
    margin-top: 7px;
    color: var(--subtle);
    font-size: 12px;
    font-weight: 650;
}

.leader-list {
    display: grid;
    gap: 8px;
    min-width: 260px;
}

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

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 0;
}

.panel-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.leader-chip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    width: min(100%, 420px);
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.leader-chip.is-disabled {
    background: var(--surface-soft);
    opacity: 0.72;
}

.leader-chip-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.leader-chip-name {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.leader-chip-name > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leader-chip-meta {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leader-chip-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.leader-chip-actions .icon-button {
    width: 30px;
    height: 30px;
}

.selected-person-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.selected-person-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(53, 162, 131, 0.22);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 750;
}

.selected-person-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(53, 162, 131, 0.14);
    color: inherit;
    cursor: pointer;
}

.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: var(--danger);
}

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

.detail-item {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.detail-label {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-value {
    margin-top: 5px;
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.chart-panel {
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 252, 251, 0.98) 100%);
}

.chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 750;
}

.segmented {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.segment {
    min-height: 28px;
    padding: 0 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.segment.is-active {
    background: var(--accent) !important;
    color: #ffffff !important;
}

.chart-container {
    position: relative;
    width: 100%;
    min-height: 240px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.student-body {
    min-height: 100vh;
    background: var(--page);
}

.student-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 64px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.student-shell {
    width: min(100%, 1060px);
    margin: 0 auto;
    padding: 24px 18px 40px;
}

.switcher-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 50;
    width: min(320px, calc(100vw - 28px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.flow-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-top: 1px solid var(--line);
}

.flow-list-row:hover {
    background: var(--surface-soft);
}

@media (max-width: 1024px) {
    .page-hero {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 900px) {
    .app-frame {
        display: block;
    }

    .admin-sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    .brand {
        min-height: 58px;
    }

    .nav-list {
        display: none;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px 12px 12px;
    }

    .nav-link {
        flex: 0 0 auto;
    }

    .sidebar-footer {
        display: none;
    }

    body.is-sidebar-open .nav-list,
    body.is-sidebar-open .sidebar-footer {
        display: flex;
    }

    body.is-sidebar-open .sidebar-footer {
        display: block;
    }

    .topbar {
        position: static;
        min-height: auto;
        padding: 16px 18px;
    }

    .topbar,
    .topbar-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-content {
        width: 100%;
    }

    .nav-toggle {
        display: inline-flex;
        flex-shrink: 0;
    }

    .topbar-meta {
        flex-wrap: wrap;
    }

    .page-content {
        padding: 18px 14px 30px;
    }
}

@media (max-width: 640px) {
    .metric-grid,
    .metric-grid.compact {
        grid-template-columns: 1fr 1fr;
    }

    .panel-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .single-row-toolbar {
        flex-wrap: wrap;
    }

    .toolbar-group,
    .toolbar-group-end,
    .panel-subbar {
        align-items: stretch;
        flex-direction: column;
    }

    .single-row-toolbar .toolbar-group {
        flex-wrap: wrap;
    }

    .search-field {
        min-width: 0;
        width: 100%;
    }

    .control,
    .btn {
        width: 100%;
    }

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

    .profile-panel .section-head,
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .avatar-lg {
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    .student-topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }

    .page-hero {
        padding: 18px;
    }

    .page-hero-title {
        font-size: 24px;
    }
}

.logout-form {
    margin: 0;
}

.login-shell {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(24, 158, 117, 0.18), transparent 24%),
        radial-gradient(circle at bottom right, rgba(25, 84, 122, 0.14), transparent 28%),
        linear-gradient(180deg, #f3faf7 0%, #edf5f3 100%);
}

.login-stage {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    display: grid;
    width: min(100%, 420px);
    gap: 18px;
    padding: 32px 28px;
    border: 1px solid rgba(29, 89, 74, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 20px 50px rgba(17, 52, 45, 0.1);
}

.login-card-head {
    display: grid;
    gap: 10px;
    justify-items: center;
    text-align: center;
}

.login-card-title {
    margin: 0;
    color: var(--ink);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.12;
}

.login-card-text {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.login-actions,
.login-form {
    display: grid;
    gap: 12px;
}

.login-control {
    min-height: 46px;
    border-radius: 14px;
    border-color: rgba(32, 92, 80, 0.18);
    background: #fbfdfc;
    box-shadow: inset 0 1px 1px rgba(17, 52, 45, 0.03);
}

.login-btn {
    justify-content: center;
    min-height: 46px;
    border-radius: 14px;
}

.login-submit {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 800;
}

.login-divider {
    position: relative;
    margin-top: 2px;
    text-align: center;
}

.login-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--line);
}

.login-divider span {
    position: relative;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.97);
    color: var(--subtle);
    font-size: 12px;
    font-weight: 700;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    border: 1px solid rgba(220, 38, 38, 0.14);
    border-radius: 14px;
    background: rgba(220, 38, 38, 0.06);
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.6;
}

.login-alert.warning {
    border-color: rgba(245, 158, 11, 0.16);
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

.login-brand-inline {
    justify-content: center;
}

@media (max-width: 640px) {
    .login-stage {
        padding: 16px;
    }

    .login-card {
        padding: 26px 20px;
    }
}
