:root {
    color-scheme: light;

    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-soft: #f1f5ff;
    --blue-line: #c7d7fb;

    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #f7f9fc;

    --ink: #17202b;
    --ink-2: #51617a;
    --ink-3: #8b97a8;

    --line: #e5eaf2;
    --line-strong: #cfd8e5;

    --red: #cf3d3d;
    --red-soft: #fdf3f3;
    --red-line: #f2c4c4;
    --green: #1d7a4c;
    --green-soft: #effaf4;
    --amber: #9a6708;
    --amber-soft: #fdf7e9;

    --overlay: rgba(20, 28, 40, 0.42);
    --focus: rgba(37, 99, 235, 0.16);
    --radius: 14px;
    --radius-sm: 10px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
}

[data-theme="dark"] {
    color-scheme: dark;

    --blue: #7aafff;
    --blue-hover: #94c0ff;
    --blue-soft: #16253b;
    --blue-line: #2c4869;

    --bg: #0a111a;
    --surface: #131e2c;
    --surface-2: #182535;

    --ink: #e9eff7;
    --ink-2: #aab8ca;
    --ink-3: #7d8da3;

    --line: #26384e;
    --line-strong: #3a5069;

    --red: #f19595;
    --red-soft: #2f1d21;
    --red-line: #5c3039;
    --green: #6fd6a0;
    --green-soft: #142a22;
    --amber: #e9bb6a;
    --amber-soft: #2c2416;

    --overlay: rgba(3, 7, 12, 0.72);
    --focus: rgba(122, 175, 255, 0.24);
}

html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
    transition: background-color 0.32s ease, color 0.32s ease, border-color 0.32s ease,
        box-shadow 0.32s ease, fill 0.32s ease, stroke 0.32s ease !important;
}

@media (prefers-reduced-motion: reduce) {
    html.theme-switching,
    html.theme-switching *,
    html.theme-switching *::before,
    html.theme-switching *::after {
        transition: none !important;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.site-footer {
    flex-shrink: 0;
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    color: var(--ink-3);
    font-size: 11.5px;
    letter-spacing: 0.3px;
    text-align: center;
}

@supports (overflow-x: clip) {
    body {
        overflow-x: clip;
    }
}

button,
select,
input {
    touch-action: manipulation;
}


a {
    color: inherit;
}

h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.2px;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
}

h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.muted {
    color: var(--ink-2);
    font-size: 13.5px;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 动效 */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes queue-in {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes live-pulse {
    0% {
        transform: scale(1);
        opacity: 0.55;
    }
    70%,
    100% {
        transform: scale(2.6);
        opacity: 0;
    }
}

@keyframes screen-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes modal-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(4px);
    }
}

@keyframes current-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 基础布局 */
.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 var(--space-5) var(--space-8);
}

.card {
    min-width: 0;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: background-color 0.18s ease, border-color 0.18s ease;
    animation: fade-in 0.18s ease both;
}

.content {
    padding: var(--space-6);
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: screen-in 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

/* 顶栏 */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    padding: var(--space-4) 0;
    flex-wrap: wrap;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

/* 顶栏全屏背景与分割线，避免滚动内容从两侧/上方透出 */
.topbar::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: -1px;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background-color: var(--bg);
    border-bottom: 1px solid var(--line);
    z-index: -1;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    flex-wrap: nowrap;
}

.topbar-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    padding: 0 9px;
    flex-shrink: 0;
    border-radius: 6px;
    background-color: var(--blue-soft);
    color: var(--blue);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 24px;
    transform: translateY(1px);
}

.topbar-title h1 {
    font-size: 19px;
    line-height: 24px;
    letter-spacing: 0.1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
        transform 0.08s ease;
}

.btn .icon {
    width: 16px;
    height: 16px;
}

.btn:active:not(:disabled) {
    transform: scale(0.985);
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--blue-hover);
    border-color: var(--blue-hover);
}

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

.btn-outline:hover:not(:disabled) {
    border-color: var(--blue);
    color: var(--blue);
}

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

.btn-ghost:hover:not(:disabled) {
    border-color: var(--blue);
    background-color: var(--surface);
    color: var(--blue);
}

.btn-danger {
    border-color: var(--line);
    color: var(--red);
}

.btn-danger:hover:not(:disabled) {
    border-color: var(--red-line);
    background-color: var(--red-soft);
}

.btn-sm {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
}

.btn-block {
    width: 100%;
}

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

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--ink-2);
    line-height: 0;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
        transform 0.08s ease;
}

.icon-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.icon-btn:active {
    transform: scale(0.94);
}

.icon-btn .icon {
    width: 17px;
    height: 17px;
}

/* 键盘焦点 */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.field:focus-visible,
.setting-input:focus-visible {
    outline: none;
}

.icon-btn {
    position: relative;
}

.icon-sun,
.icon-moon {
    position: absolute;
    inset: 0;
    margin: auto;
    transition: opacity 0.26s ease, transform 0.34s cubic-bezier(0.22, 0.7, 0.3, 1);
}

.icon-sun {
    opacity: 0;
    transform: rotate(-80deg) scale(0.55);
}

.icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .icon-moon {
    opacity: 0;
    transform: rotate(80deg) scale(0.55);
}

/* 深色模式：表单内凹层次与卡片阴影 */
[data-theme="dark"] .field,
[data-theme="dark"] .setting-input {
    background-color: var(--bg);
}

[data-theme="dark"] .card {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 28px rgba(0, 0, 0, 0.26);
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .brand-mark {
    color: #0b1524;
}

/* 登录页 */
.login-shell {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 34px 30px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background-color: var(--blue);
    color: #ffffff;
}

.brand-mark .icon {
    width: 20px;
    height: 20px;
}

.brand-sub {
    margin-bottom: 24px;
    color: var(--ink-3);
    font-size: 13px;
}

.theme-float {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10;
}

/* 表单 */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.form-stack-spaced {
    margin-top: var(--space-5);
    animation: fade-up 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.field,
.setting-input {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--ink);
    background-color: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.field::placeholder,
.setting-input::placeholder {
    color: var(--ink-3);
}

.field:focus,
.setting-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--focus);
}

.field:disabled,
.setting-input:disabled {
    background-color: var(--surface-2);
    color: var(--ink-3);
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

select.field,
select.setting-input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2351617a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 15px;
    cursor: pointer;
}

[data-theme="dark"] select.field,
[data-theme="dark"] select.setting-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a4b2c6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

select.field:disabled,
select.setting-input:disabled {
    cursor: not-allowed;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
}

.field-short {
    max-width: 200px;
}

.error-message {
    min-height: 18px;
    margin-top: 8px;
    color: var(--red);
    font-size: 13px;
    text-align: center;
}

/* 信息行 */
.summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.summary-text {
    color: var(--ink-2);
    font-size: 13.5px;
}

.summary-count {
    color: var(--blue);
    font-weight: 600;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: 48px var(--space-4);
    color: var(--ink-3);
    font-size: 13.5px;
    text-align: center;
}

.empty-state .icon {
    width: 28px;
    height: 28px;
    color: var(--ink-3);
}

/* 教师卡片 */
.teacher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-3);
}

.teacher-grid + .sticky-actions {
    margin-top: var(--space-5);
}

/* 网格入场动效 */
.teacher-grid > *,
.schedule-grid > *,
.action-grid > * {
    animation: fade-up 0.26s ease both;
}

.teacher-grid > :nth-child(2),
.schedule-grid > :nth-child(2),
.action-grid > :nth-child(2) {
    animation-delay: 0.025s;
}

.teacher-grid > :nth-child(3),
.schedule-grid > :nth-child(3),
.action-grid > :nth-child(3) {
    animation-delay: 0.05s;
}

.teacher-grid > :nth-child(4),
.schedule-grid > :nth-child(4),
.action-grid > :nth-child(4) {
    animation-delay: 0.075s;
}

.teacher-grid > :nth-child(5),
.schedule-grid > :nth-child(5),
.action-grid > :nth-child(5) {
    animation-delay: 0.1s;
}

.teacher-grid > :nth-child(6),
.schedule-grid > :nth-child(6),
.action-grid > :nth-child(6) {
    animation-delay: 0.125s;
}

.teacher-card {
    padding: 18px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}

.teacher-card:hover {
    border-color: var(--blue);
}

.teacher-card.selected {
    border-color: var(--blue);
    background-color: var(--blue-soft);
}

.teacher-card.must-locked {
    border-color: var(--red-line);
    background-color: var(--red-soft);
}

.teacher-card.disabled {
    background-color: var(--surface-2);
    border-color: var(--line);
    cursor: not-allowed;
}

.teacher-card.disabled:hover {
    border-color: var(--line);
}

.teacher-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.teacher-name {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--ink);
}

.tag {
    display: inline-flex;
    align-items: center;
    height: 21px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
}

.tag-locked {
    background-color: var(--red-soft);
    color: var(--red);
    border: 1px solid var(--red-line);
}

.tag-full {
    background-color: var(--surface-2);
    color: var(--ink-3);
    border: 1px solid var(--line);
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 0;
    font-size: 13px;
}

.meta-label {
    color: var(--ink-3);
}

.meta-value {
    color: var(--ink);
    font-weight: 500;
    text-align: right;
}

/* 吸底提交 */
.sticky-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: center;
    padding: var(--space-4) 0 10px;
    background-color: var(--surface);
    border-top: 1px solid var(--line);
}

.sticky-actions .btn {
    width: 100%;
    max-width: 300px;
    min-height: 44px;
}

/* 预约记录 */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-3);
}

.schedule-item {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background-color: var(--surface-2);
}

.schedule-item-must {
    border-color: var(--red-line);
}

.schedule-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.schedule-teacher {
    font-size: 15px;
    font-weight: 600;
    color: var(--blue);
}

.schedule-time {
    font-size: 13px;
    color: var(--ink-3);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.status-waiting {
    background-color: var(--amber-soft);
    color: var(--amber);
}

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

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

.status-skipped {
    background-color: var(--red-soft);
    color: var(--red);
}

.page-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

/* 教师工作台 */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.action-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    text-decoration: none;
    transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.15s ease;
}

.action-tile:hover {
    border-color: var(--blue);
    background-color: var(--blue-soft);
    transform: translateY(-1px);
}

.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    background-color: var(--blue-soft);
    color: var(--blue);
}

.action-icon .icon {
    width: 17px;
    height: 17px;
}

.action-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
}

.action-desc {
    font-size: 12.5px;
    color: var(--ink-3);
}

/* 实时队列 */
.queue-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
    gap: 0;
    align-items: start;
}

.queue-section {
    min-width: 0;
}

.queue-section + .queue-section {
    margin-left: var(--space-7);
    padding-left: var(--space-7);
    border-left: 1px solid var(--line);
}

.section-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.section-head .icon {
    width: 16px;
    height: 16px;
    color: var(--blue);
}

.section-head h3 {
    font-size: 14px;
}

.queue-section .section-head {
    min-height: 20px;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--line);
}

.queue-section .section-head h3 {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.queue-section .section-head h3::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 12px;
    margin-right: var(--space-2);
    border-radius: 2px;
    background-color: var(--blue);
    vertical-align: -1px;
}

.count-badge {
    color: var(--ink-3);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 21px;
    margin-left: auto;
    padding: 0 9px;
    border: 1px solid var(--blue-line);
    border-radius: 999px;
    background-color: transparent;
    color: var(--blue);
    font-size: 11px;
    font-weight: 500;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.live-badge.offline {
    border-color: var(--line-strong);
    background-color: var(--surface-2);
    color: var(--ink-3);
}

.live-badge.offline .live-dot::after {
    animation: none;
}

.live-dot {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.live-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: currentColor;
    animation: live-pulse 1.8s ease-out infinite;
}

.current-card {
    display: flex;
    align-items: center;
    min-height: 112px;
    margin-bottom: var(--space-5);
}

.current-main {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    width: 100%;
    min-width: 0;
    animation: current-in 0.24s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.current-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: var(--blue-soft);
    color: var(--blue);
}

.current-avatar .icon {
    width: 22px;
    height: 22px;
}

.current-info {
    min-width: 0;
    flex: 1;
}

.current-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 3px;
}

.current-label {
    color: var(--ink-3);
    font-size: 12px;
    letter-spacing: 0.3px;
}

.current-name {
    color: var(--ink);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.current-card.is-empty .current-avatar {
    background-color: var(--surface-2);
    color: var(--ink-3);
}

.current-card.is-empty .current-name {
    color: var(--ink-3);
    font-size: 18px;
    font-weight: 500;
}

.parent-info {
    min-width: 0;
    flex: 1;
}

.parent-info strong {
    font-weight: 600;
}

.parent-info p + p {
    margin-top: 3px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.action-buttons .btn {
    min-height: 44px;
}

.queue-hint {
    margin-top: var(--space-4);
    color: var(--ink-3);
    font-size: 12.5px;
    line-height: 1.6;
}

.waiting-list {
    display: flex;
    flex-direction: column;
}

.waiting-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    animation: queue-in 0.22s ease both;
}

.waiting-item:last-child {
    border-bottom: 0;
}

.queue-number {
    width: 22px;
    flex-shrink: 0;
    color: var(--ink-3);
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.waiting-item .parent-info {
    font-size: 14px;
}

.waiting-more {
    padding: 12px 0 0;
    color: var(--ink-3);
    font-size: 12.5px;
}

.waiting-list .empty-hint {
    padding: 20px 0;
    text-align: left;
}

/* 教师设置 */
.setting-section {
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
}

.setting-section h3 {
    margin-bottom: var(--space-4);
}

.setting-item + .setting-item {
    margin-top: var(--space-4);
}

.setting-hint {
    margin-top: var(--space-2);
    color: var(--ink-3);
    font-size: 12.5px;
}

.input-row {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.input-row .setting-input {
    flex: 1 1 150px;
    min-width: 0;
}

.input-row .class-select {
    flex: 0 0 150px;
}

.input-row .btn {
    flex: 0 0 auto;
}

.reserved-list {
    margin-top: var(--space-5);
}

.reserved-list h4 {
    margin-bottom: var(--space-2);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}

.reserved-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.reserved-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background-color: var(--surface-2);
}

.reserved-name {
    font-size: 13.5px;
    color: var(--ink);
}

.empty-hint {
    padding: var(--space-4);
    color: var(--ink-3);
    font-size: 13px;
    text-align: center;
}

/* 列表表格 */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--surface);
    font-size: 13.5px;
}

.table thead {
    background-color: var(--surface-2);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--ink-3);
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

.table tbody tr {
    border-bottom: 1px solid var(--line);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table td {
    padding: 12px 16px;
    color: var(--ink);
    white-space: nowrap;
}

.table td:first-child {
    width: 60px;
    color: var(--ink-3);
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: var(--overlay);
}

.modal.active {
    display: flex;
    animation: fade-in 0.16s ease both;
}

.modal.active .modal-card {
    animation: modal-in 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.modal.closing {
    animation: fade-out 0.14s ease both;
}

.modal.closing .modal-card {
    animation: modal-out 0.14s ease both;
}

.modal-card {
    width: 100%;
    max-width: 460px;
    max-height: min(80vh, 640px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
}

.modal-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.modal-head .icon {
    width: 18px;
    height: 18px;
    color: var(--blue);
}

.modal-head h3 {
    font-size: 15px;
}

.notice-list {
    margin-bottom: var(--space-5);
    padding-left: 18px;
    color: var(--ink-2);
    font-size: 13.5px;
    line-height: 1.9;
}

.modal.active .notice-list li {
    animation: fade-up 0.2s ease both;
}

.modal.active .notice-list li:nth-child(2) {
    animation-delay: 0.03s;
}

.modal.active .notice-list li:nth-child(3) {
    animation-delay: 0.06s;
}

.modal.active .notice-list li:nth-child(4) {
    animation-delay: 0.09s;
}

.modal.active .notice-list li:nth-child(5) {
    animation-delay: 0.12s;
}

.notice-page {
    padding: 40px 24px;
    text-align: center;
}

.notice-page .icon {
    width: 32px;
    height: 32px;
    color: var(--blue);
}

.notice-time {
    margin: 2px 0 16px;
    font-size: 19px;
    font-weight: 600;
    color: var(--ink);
}

/* 轻提示 */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(26px + env(safe-area-inset-bottom));
    z-index: 1200;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--ink);
    font-size: 13.5px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* 响应式 */
@media (max-width: 900px) {
    .queue-layout {
        grid-template-columns: 1fr;
    }

    .queue-section + .queue-section {
        margin-top: var(--space-7);
        margin-left: 0;
        padding-top: 0;
        padding-left: 0;
        border-top: 0;
        border-left: 0;
    }
}

@media (max-width: 640px) {
    .page {
        padding: 0 14px var(--space-7);
    }

    .content {
        padding: var(--space-4);
    }

    .modal-card {
        padding: var(--space-5);
        max-height: calc(100dvh - 32px);
    }

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

    .topbar {
        align-items: center;
        padding: var(--space-3) 0;
        margin-bottom: var(--space-4);
    }

    .topbar-actions {
        width: auto;
        margin-left: auto;
        gap: var(--space-2);
    }

    .topbar-actions .btn {
        flex: 0 0 auto;
    }

    h1 {
        font-size: 18px;
    }

    .teacher-grid,
    .schedule-grid,
    .action-grid {
        grid-template-columns: 1fr;
    }

    .input-row .class-select {
        flex: 1 1 100%;
    }

    .input-row .btn {
        width: 100%;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .current-card {
        min-height: 96px;
    }

    .current-name {
        font-size: 21px;
    }

    .table th,
    .table td {
        padding: 10px 12px;
    }

    .sticky-actions {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 560px) {
    .topbar-actions .btn {
        width: 38px;
        min-height: 38px;
        padding: 0;
    }

    .topbar-actions .btn .btn-label {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
