:root {
  color-scheme: light;
  --font-ui: "Noto Sans SC", "HarmonyOS Sans SC", "MiSans",
    "Segoe UI Variable", "PingFang SC", "Microsoft YaHei UI",
    "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Fira Code",
    "SF Mono", Consolas, monospace;
  --font-number: "Bahnschrift", "Segoe UI Variable", "Noto Sans SC",
    "HarmonyOS Sans SC", var(--font-ui);
  --text-caption: 0.75rem;
  --text-table: 0.8125rem;
  --text-ui: 0.875rem;
  --text-body: 1rem;
  --text-title: 1.375rem;
  --text-number: 1.5rem;
  --text-kpi: 2.25rem;
  --leading-tight: 1.2;
  --leading-ui: 1.45;
  --leading-body: 1.65;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: var(--radius);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-panel: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sticky: 0 1px 8px rgba(16, 24, 40, 0.08);
  --shadow: var(--shadow-panel);
  --ring: rgba(0, 33, 71, 0.22);
  --surface-hover: #f7fbfa;
  --bg: #f3f7f6;
  --panel: #fffefd;
  --panel-raised: #ffffff;
  --surface: var(--panel-raised);
  --section-head: #fbfdfc;
  --topbar-bg: rgba(243, 247, 246, 0.96);
  --input-bg: #ffffff;
  --btn-bg: #ffffff;
  --btn-hover: #fbfdfc;
  --ink: #17212b;
  --text: var(--ink);
  --ink-strong: #102a2a;
  --muted: #667780;
  --line: #d4e2e3;
  --line-soft: #e6eef0;
  --hover-border: #c6dcdd;
  --brand: #002147;
  --brand-dark: #00172f;
  --brand-soft: #eaf0f7;
  --brand-border: #c8d6e5;
  --brand-pale: #d8e4f1;
  --accent: #1d4f91;
  --success: #087443;
  --success-bg: #e8f7ee;
  --info: #175cd3;
  --info-bg: #eaf2ff;
  --warning: #b54708;
  --warning-bg: #fff4e5;
  --danger: #b42318;
  --danger-bg: #fff1f3;
  --warn-bg: #fff4d6;
  --warn-fg: #9a3412;
  --manual-bg: #ffe4e8;
  --manual-fg: #c01048;
  --group: #dceafe;
  --sidebar-bg: #f0ece6;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e8e2da;
  --sidebar-active: #eaf0f7;
  --sidebar-ink: #2a2420;
  --sidebar-text: #3e403f;
  --sidebar-muted: #8a7e72;
  --sidebar-border: #ddd8d0;
  --sidebar-line: #ddd8d0;
  --sidebar-active-text: #002147;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #eaf0f7;
  --table-head-ink: #002147;
  --abnormal-hover: #ffedbf;
  --receivable-hover: #ffe6eb;
  --risk-unpaid-bg: #ffe4ea;
  --risk-low-bg: #ffedcc;
  --neutral-chip-bg: #f2f4f7;
  --neutral-chip-fg: #475467;
  --neutral-chip-border: #d0d5dd;
  --primary-ink: #ffffff;
  --danger-border: #ffd6dd;
  --danger-hover: #ffe8ed;
  --danger-hover-border: #ffbdca;
  --modal-backdrop: rgba(17, 27, 37, 0.36);
  --selection-bg: #d8e4f1;
  --selection-border: #afc5dc;
  --selection-ink: #0b2f2c;
  --brand-hover-bg: rgba(15, 118, 110, 0.08);
  --group-fg: #1e3a8a;
  --group-hover: #cfe0ff;
  --exam-hover: #ffead1;
  --warn-pill-bg: #fff8db;
  --warn-pill-fg: #854d0e;
  --shot-bg: #f7f9fc;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #102033;
  --shot-muted: #64748b;
  --shot-line: #c8d6e5;
  --shot-brand: #002147;
  --shot-brand-dark: #00172f;
  --shot-brand-soft: #eaf0f7;
  --shot-brand-pale: #f5f8fc;
  --shot-tag-bg: #eaf0f7;
  --shot-tag-text: #002147;
  --shot-time-bg: #eaf0f7;
  --shot-footer-bg: #eef3f9;
}

:root[data-palette="liming-blue"] {
  --brand: #002147;
  --brand-dark: #00172f;
  --brand-soft: #eaf0f7;
  --brand-border: #c8d6e5;
  --brand-pale: #d8e4f1;
  --accent: #1d4f91;
  --sidebar-bg: #f0ece6;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e8e2da;
  --sidebar-active: #eaf0f7;
  --sidebar-text: #3e403f;
  --sidebar-active-text: #002147;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #eaf0f7;
  --table-head-ink: #002147;
  --selection-bg: #d8e4f1;
  --selection-border: #afc5dc;
  --shot-bg: #f7f9fc;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #102033;
  --shot-muted: #64748b;
  --shot-line: #c8d6e5;
  --shot-brand: #002147;
  --shot-brand-dark: #00172f;
  --shot-brand-soft: #eaf0f7;
  --shot-brand-pale: #f5f8fc;
  --shot-tag-bg: #eaf0f7;
  --shot-tag-text: #002147;
  --shot-time-bg: #eaf0f7;
  --shot-footer-bg: #eef3f9;
}

:root[data-palette="black-white"] {
  --ring: rgba(17, 17, 17, 0.2);
  --surface-hover: #f5f5f5;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --surface: #ffffff;
  --section-head: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --input-bg: #ffffff;
  --btn-bg: #ffffff;
  --btn-hover: #f5f5f5;
  --ink: #0a0a0a;
  --text: #0a0a0a;
  --ink-strong: #000000;
  --muted: #666666;
  --line: #e8e8e8;
  --line-soft: #f1f1f1;
  --hover-border: #c6c6c6;
  --brand: #0a0a0a;
  --brand-dark: #000000;
  --brand-soft: #f5f5f5;
  --brand-border: #dddddd;
  --brand-pale: #f7f7f7;
  --accent: #0a0a0a;
  --success: #3f3f3f;
  --success-bg: #f6f6f6;
  --info: #3f3f3f;
  --info-bg: #f6f6f6;
  --warning: #525252;
  --warning-bg: #f6f6f6;
  --danger: #b42318;
  --danger-bg: #fff1f3;
  --warn-bg: #f6f6f6;
  --warn-fg: #3f3f3f;
  --manual-bg: #f1f1f1;
  --manual-fg: #1a1a1a;
  --group: #f1f1f1;
  --sidebar-bg: #ffffff;
  --sidebar: #ffffff;
  --sidebar-hover: #f5f5f5;
  --sidebar-active: #f1f1f1;
  --sidebar-ink: #0a0a0a;
  --sidebar-text: #3f3f3f;
  --sidebar-muted: #707070;
  --sidebar-border: #efefef;
  --sidebar-line: #efefef;
  --sidebar-active-text: #000000;
  --sidebar-active-ink: #000000;
  --table-head: #fafafa;
  --table-head-ink: #0a0a0a;
  --abnormal-hover: #f5f5f5;
  --receivable-hover: #fff1f3;
  --risk-unpaid-bg: #fff1f3;
  --risk-low-bg: #f5f5f5;
  --neutral-chip-bg: #f5f5f5;
  --neutral-chip-fg: #454545;
  --neutral-chip-border: #dedede;
  --primary-ink: #ffffff;
  --danger-border: #fecdca;
  --danger-hover: #ffe4e8;
  --danger-hover-border: #fda29b;
  --selection-bg: #f1f1f1;
  --selection-border: #c6c6c6;
  --selection-ink: #0a0a0a;
  --brand-hover-bg: rgba(17, 17, 17, 0.08);
  --group-fg: #1a1a1a;
  --group-hover: #ededed;
  --exam-hover: #f2f2f2;
  --warn-pill-bg: #f2f2f2;
  --warn-pill-fg: #3f3f3f;
  --shot-bg: #ffffff;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #0a0a0a;
  --shot-muted: #666666;
  --shot-line: #e5e5e5;
  --shot-brand: #0a0a0a;
  --shot-brand-dark: #000000;
  --shot-brand-soft: #f5f5f5;
  --shot-brand-pale: #fafafa;
  --shot-tag-bg: #f5f5f5;
  --shot-tag-text: #0a0a0a;
  --shot-time-bg: #f1f1f1;
  --shot-footer-bg: #f5f5f5;
}

:root[data-palette="jade-original"] {
  --brand: #2d9e8f;
  --brand-dark: #1e7a6e;
  --brand-soft: #edf8f6;
  --brand-border: #c8e7e2;
  --brand-pale: #d4f0eb;
  --accent: #175cd3;
  --sidebar-bg: #f0ece6;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e8e2da;
  --sidebar-active: #e0f0ed;
  --sidebar-text: #4a4038;
  --sidebar-active-text: #1e7a6e;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #edf7f6;
  --table-head-ink: #24524f;
  --selection-bg: #d4f0eb;
  --selection-border: #8ed0c6;
  --shot-bg: #f3f7f6;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #102a2a;
  --shot-muted: #667780;
  --shot-line: #c8e7e2;
  --shot-brand: #2d9e8f;
  --shot-brand-dark: #1e7a6e;
  --shot-brand-soft: #edf8f6;
  --shot-brand-pale: #f6fbfa;
  --shot-tag-bg: #edf8f6;
  --shot-tag-text: #1e7a6e;
  --shot-time-bg: #edf8f6;
  --shot-footer-bg: #eaf7f5;
}

:root[data-palette="warm-sun"] {
  --brand: #8f5b18;
  --brand-dark: #55340f;
  --brand-soft: #fff5e6;
  --brand-border: #ead6b2;
  --brand-pale: #f6e7cc;
  --accent: #6a471b;
  --sidebar-bg: #f3eadc;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #eadcc8;
  --sidebar-active: #f4e2c4;
  --sidebar-text: #4e3b27;
  --sidebar-active-text: #6a471b;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #fff3df;
  --table-head-ink: #6a471b;
  --selection-bg: #ead6b2;
  --selection-border: #d3b27f;
  --shot-bg: #fbf7ef;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #3f2c16;
  --shot-muted: #806b52;
  --shot-line: #ead6b2;
  --shot-brand: #8f5b18;
  --shot-brand-dark: #55340f;
  --shot-brand-soft: #fff5e6;
  --shot-brand-pale: #fffaf1;
  --shot-tag-bg: #fff5e6;
  --shot-tag-text: #6a471b;
  --shot-time-bg: #fff0d4;
  --shot-footer-bg: #f6e7cc;
}

:root[data-palette="lavender"] {
  --brand: #7b61b3;
  --brand-dark: #4c3b77;
  --brand-soft: #f2eefb;
  --brand-border: #d9d0ef;
  --brand-pale: #e7e0f5;
  --accent: #44355f;
  --sidebar-bg: #f0ece6;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e8e2da;
  --sidebar-active: #eee9f8;
  --sidebar-text: #443c4d;
  --sidebar-active-text: #4c3b77;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #f2eefb;
  --table-head-ink: #4c3b77;
  --selection-bg: #e7e0f5;
  --selection-border: #c7bae7;
  --shot-bg: #f7f4fc;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #33274f;
  --shot-muted: #756a8b;
  --shot-line: #d9d0ef;
  --shot-brand: #7b61b3;
  --shot-brand-dark: #4c3b77;
  --shot-brand-soft: #f2eefb;
  --shot-brand-pale: #faf8ff;
  --shot-tag-bg: #f2eefb;
  --shot-tag-text: #4c3b77;
  --shot-time-bg: #ede7fa;
  --shot-footer-bg: #eee9f8;
}

:root[data-palette="ink"] {
  --brand: #3d3d3d;
  --brand-dark: #121212;
  --brand-soft: #f1f1f1;
  --brand-border: #d9d9d9;
  --brand-pale: #e8e8e8;
  --accent: #7a7a7a;
  --sidebar-bg: #eeeeea;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e2e2de;
  --sidebar-active: #dedede;
  --sidebar-text: #3d3d3d;
  --sidebar-active-text: #121212;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #f1f1f1;
  --table-head-ink: #3d3d3d;
  --selection-bg: #d9d9d9;
  --selection-border: #b8b8b8;
  --shot-bg: #f6f6f6;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #121212;
  --shot-muted: #6b7280;
  --shot-line: #d9d9d9;
  --shot-brand: #3d3d3d;
  --shot-brand-dark: #121212;
  --shot-brand-soft: #f1f1f1;
  --shot-brand-pale: #fafafa;
  --shot-tag-bg: #f1f1f1;
  --shot-tag-text: #121212;
  --shot-time-bg: #ededed;
  --shot-footer-bg: #eeeeee;
}

:root[data-palette="forest"] {
  --brand: #3f764d;
  --brand-dark: #234c2e;
  --brand-soft: #edf8ee;
  --brand-border: #bfe2c4;
  --brand-pale: #d8efd9;
  --accent: #1d3422;
  --sidebar-bg: #eef0e8;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e2e6da;
  --sidebar-active: #e2f1e4;
  --sidebar-text: #334133;
  --sidebar-active-text: #234c2e;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #edf8ee;
  --table-head-ink: #234c2e;
  --selection-bg: #d8efd9;
  --selection-border: #a7d4ae;
  --shot-bg: #f4faf4;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #183621;
  --shot-muted: #627468;
  --shot-line: #bfe2c4;
  --shot-brand: #3f764d;
  --shot-brand-dark: #234c2e;
  --shot-brand-soft: #edf8ee;
  --shot-brand-pale: #f8fcf8;
  --shot-tag-bg: #edf8ee;
  --shot-tag-text: #234c2e;
  --shot-time-bg: #e4f3e6;
  --shot-footer-bg: #e5f3e7;
}

:root[data-palette="glacier"] {
  --brand: #2f6db3;
  --brand-dark: #27496d;
  --brand-soft: #eef5fc;
  --brand-border: #c7d8ea;
  --brand-pale: #dce9f6;
  --accent: #22364f;
  --sidebar-bg: #edf0f3;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e1e7ed;
  --sidebar-active: #e7f0fa;
  --sidebar-text: #38434d;
  --sidebar-active-text: #27496d;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #eef5fc;
  --table-head-ink: #27496d;
  --selection-bg: #dce9f6;
  --selection-border: #adc8e4;
  --shot-bg: #f4f8fc;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #18304b;
  --shot-muted: #66788b;
  --shot-line: #c7d8ea;
  --shot-brand: #2f6db3;
  --shot-brand-dark: #27496d;
  --shot-brand-soft: #eef5fc;
  --shot-brand-pale: #f8fbfe;
  --shot-tag-bg: #eef5fc;
  --shot-tag-text: #27496d;
  --shot-time-bg: #e3eef9;
  --shot-footer-bg: #e8f1fa;
}

:root[data-palette="coffee"] {
  --brand: #8a5a44;
  --brand-dark: #4b3127;
  --brand-soft: #f7efeb;
  --brand-border: #e3d1c6;
  --brand-pale: #edddd4;
  --accent: #42271d;
  --sidebar-bg: #f0ece6;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e7ddd4;
  --sidebar-active: #f0e2da;
  --sidebar-text: #4b4038;
  --sidebar-active-text: #4b3127;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #f7efeb;
  --table-head-ink: #4b3127;
  --selection-bg: #edddd4;
  --selection-border: #d4b8a9;
  --shot-bg: #faf6f3;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #34231c;
  --shot-muted: #7d6a60;
  --shot-line: #e3d1c6;
  --shot-brand: #8a5a44;
  --shot-brand-dark: #4b3127;
  --shot-brand-soft: #f7efeb;
  --shot-brand-pale: #fcf8f6;
  --shot-tag-bg: #f7efeb;
  --shot-tag-text: #4b3127;
  --shot-time-bg: #f1e4dc;
  --shot-footer-bg: #f2e6de;
}

:root[data-palette="spice-earth"] {
  --brand: #8f562e;
  --brand-dark: #623726;
  --brand-soft: #f8efe7;
  --brand-border: #c9ab87;
  --brand-pale: #ecd8c4;
  --accent: #a45d3f;
  --sidebar-bg: #f1e9df;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e6dacb;
  --sidebar-active: #f0dfcc;
  --sidebar-text: #4f3c31;
  --sidebar-active-text: #623726;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #f8efe7;
  --table-head-ink: #623726;
  --selection-bg: #ecd8c4;
  --selection-border: #c9ab87;
  --shot-bg: #faf4ee;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #3c261b;
  --shot-muted: #7d6656;
  --shot-line: #c9ab87;
  --shot-brand: #8f562e;
  --shot-brand-dark: #623726;
  --shot-brand-soft: #f8efe7;
  --shot-brand-pale: #fcf8f4;
  --shot-tag-bg: #f8efe7;
  --shot-tag-text: #623726;
  --shot-time-bg: #f0dfcc;
  --shot-footer-bg: #ecd8c4;
}

:root[data-palette="monet-garden"] {
  --brand: #435f89;
  --brand-dark: #334866;
  --brand-soft: #eef2f7;
  --brand-border: #adbbd2;
  --brand-pale: #dbe3ee;
  --accent: #8b607b;
  --sidebar-bg: #eef0e7;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e2e5d8;
  --sidebar-active: #e9edd5;
  --sidebar-text: #3f4852;
  --sidebar-active-text: #435f89;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #eef2f7;
  --table-head-ink: #435f89;
  --selection-bg: #dbe3ee;
  --selection-border: #adbbd2;
  --shot-bg: #f5f7f4;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #2d405f;
  --shot-muted: #6f7780;
  --shot-line: #adbbd2;
  --shot-brand: #435f89;
  --shot-brand-dark: #334866;
  --shot-brand-soft: #eef2f7;
  --shot-brand-pale: #fafbf7;
  --shot-tag-bg: #eef2f7;
  --shot-tag-text: #435f89;
  --shot-time-bg: #e8ecd8;
  --shot-footer-bg: #e7ebdf;
}

:root[data-palette="waterlily-pink"] {
  --brand: #8d586f;
  --brand-dark: #6b4053;
  --brand-soft: #f7eeee;
  --brand-border: #dbc8c3;
  --brand-pale: #eadbd8;
  --accent: #4f756a;
  --sidebar-bg: #f0ece6;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e7dfd8;
  --sidebar-active: #f0e3e2;
  --sidebar-text: #4a4143;
  --sidebar-active-text: #6b4053;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #f7eeee;
  --table-head-ink: #6b4053;
  --selection-bg: #eadbd8;
  --selection-border: #d2b7b0;
  --shot-bg: #faf6f6;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #503142;
  --shot-muted: #746a6d;
  --shot-line: #dbc8c3;
  --shot-brand: #8d586f;
  --shot-brand-dark: #6b4053;
  --shot-brand-soft: #f7eeee;
  --shot-brand-pale: #fcf8f8;
  --shot-tag-bg: #f7eeee;
  --shot-tag-text: #6b4053;
  --shot-time-bg: #e9eeee;
  --shot-footer-bg: #eadbd8;
}

:root[data-palette="bauhaus"] {
  --brand: #144f9e;
  --brand-dark: #202020;
  --brand-soft: #fff8d6;
  --brand-border: #f3d74b;
  --brand-pale: #f8e98d;
  --accent: #c92b2b;
  --sidebar-bg: #f2eee2;
  --sidebar: var(--sidebar-bg);
  --sidebar-hover: #e6dfcf;
  --sidebar-active: #fff3b8;
  --sidebar-text: #202020;
  --sidebar-active-text: #144f9e;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-head: #fff8d6;
  --table-head-ink: #202020;
  --selection-bg: #f8e98d;
  --selection-border: #e1c332;
  --shot-bg: #fbf8ed;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #202020;
  --shot-muted: #5f6368;
  --shot-line: #e7d372;
  --shot-brand: #144f9e;
  --shot-brand-dark: #202020;
  --shot-brand-soft: #fff8d6;
  --shot-brand-pale: #fffdf0;
  --shot-tag-bg: #fff8d6;
  --shot-tag-text: #144f9e;
  --shot-time-bg: #fff1a8;
  --shot-footer-bg: #f8e98d;
}

/* 课程截图配色：默认固定黎明蓝，仅当 data-shot-follow-palette="true" 时跟随当前配色方案 */
:root:not([data-shot-follow-palette="true"]) {
  --shot-bg: #f7f9fc;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #102033;
  --shot-muted: #64748b;
  --shot-line: #c8d6e5;
  --shot-brand: #002147;
  --shot-brand-dark: #00172f;
  --shot-brand-soft: #eaf0f7;
  --shot-brand-pale: #f5f8fc;
  --shot-tag-bg: #eaf0f7;
  --shot-tag-text: #002147;
  --shot-time-bg: #eaf0f7;
  --shot-footer-bg: #eef3f9;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --shadow-panel: none;
  --shadow-sticky: none;
  --ring: rgba(47, 111, 211, 0.26);
  --surface-hover: #0d141d;
  --bg: #030508;
  --panel: #080d12;
  --panel-raised: #0b121b;
  --section-head: #0c1420;
  --topbar-bg: rgba(3, 5, 8, 0.96);
  --input-bg: #070c12;
  --btn-bg: #0c1420;
  --btn-hover: #121a26;
  --ink: #cbd5e1;
  --ink-strong: #e2e8f0;
  --muted: #748094;
  --line: #15202b;
  --line-soft: #101923;
  --line-strong: #253142;
  --hover-border: #283546;
  --brand: #2f6fd3;
  --brand-dark: #2458ad;
  --brand-soft: rgba(47, 111, 211, 0.10);
  --brand-border: rgba(47, 111, 211, 0.24);
  --brand-pale: rgba(47, 111, 211, 0.12);
  --accent: #3b82d8;
  --success: #2fb184;
  --success-bg: rgba(47, 177, 132, 0.10);
  --info: #5f93c7;
  --info-bg: rgba(95, 147, 199, 0.10);
  --warning: #c9902e;
  --warning-bg: rgba(201, 144, 46, 0.11);
  --danger: #d06478;
  --danger-bg: rgba(208, 100, 120, 0.11);
  --warn-bg: rgba(201, 144, 46, 0.13);
  --warn-fg: #d6a64b;
  --manual-bg: #311522;
  --manual-fg: #db7c96;
  --group: #0d1826;
  --sidebar: var(--sidebar-bg);
  --sidebar-bg: #05080d;
  --sidebar-hover: #0b1118;
  --sidebar-active: #0d1b2e;
  --sidebar-ink: #dce7f5;
  --sidebar-text: #9aa6b2;
  --sidebar-muted: #748094;
  --sidebar-border: #030508;
  --sidebar-line: rgba(116, 128, 148, 0.16);
  --sidebar-active-text: #dce7f5;
  --sidebar-active-ink: var(--sidebar-active-text);
  --table-bg: #080d12;
  --table-head: #0c1827;
  --table-head-ink: #b7c3d0;
  --table-row-hover: #0d141d;
  --abnormal-hover: rgba(201, 144, 46, 0.16);
  --receivable-hover: rgba(208, 100, 120, 0.14);
  --risk-unpaid-bg: rgba(208, 100, 120, 0.14);
  --risk-low-bg: rgba(201, 144, 46, 0.15);
  --neutral-chip-bg: #0c1420;
  --neutral-chip-fg: #a8b4c3;
  --neutral-chip-border: #202b3a;
  --primary-ink: #eef4fb;
  --danger-border: rgba(208, 100, 120, 0.26);
  --danger-hover: rgba(208, 100, 120, 0.15);
  --danger-hover-border: rgba(208, 100, 120, 0.34);
  --modal-backdrop: rgba(2, 6, 12, 0.72);
  --selection-bg: rgba(47, 111, 211, 0.18);
  --selection-border: rgba(47, 111, 211, 0.32);
  --selection-ink: #eef4fb;
  --brand-hover-bg: rgba(47, 111, 211, 0.10);
  --group-fg: #a8b4c3;
  --group-hover: #111d2c;
  --exam-hover: rgba(201, 144, 46, 0.14);
  --warn-pill-bg: rgba(201, 144, 46, 0.13);
  --warn-pill-fg: #d6a64b;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --shadow-panel: none;
    --shadow-sticky: none;
    --ring: rgba(47, 111, 211, 0.26);
    --surface-hover: #0d141d;
    --bg: #030508;
    --panel: #080d12;
    --panel-raised: #0b121b;
    --section-head: #0c1420;
    --topbar-bg: rgba(3, 5, 8, 0.96);
    --input-bg: #070c12;
    --btn-bg: #0c1420;
    --btn-hover: #121a26;
    --ink: #cbd5e1;
    --ink-strong: #e2e8f0;
    --muted: #748094;
    --line: #15202b;
    --line-soft: #101923;
    --line-strong: #253142;
    --hover-border: #283546;
    --brand: #2f6fd3;
    --brand-dark: #2458ad;
    --brand-soft: rgba(47, 111, 211, 0.10);
    --brand-border: rgba(47, 111, 211, 0.24);
    --brand-pale: rgba(47, 111, 211, 0.12);
    --brand-hover-bg: rgba(47, 111, 211, 0.10);
    --accent: #3b82d8;
    --success: #2fb184;
    --success-bg: rgba(47, 177, 132, 0.10);
    --info: #5f93c7;
    --info-bg: rgba(95, 147, 199, 0.10);
    --warning: #c9902e;
    --warning-bg: rgba(201, 144, 46, 0.11);
    --danger: #d06478;
    --danger-bg: rgba(208, 100, 120, 0.11);
    --warn-bg: rgba(201, 144, 46, 0.13);
    --warn-fg: #d6a64b;
    --manual-bg: #311522;
    --manual-fg: #db7c96;
    --group: #0d1826;
    --group-fg: #a8b4c3;
    --group-hover: #111d2c;
    --exam-hover: rgba(201, 144, 46, 0.14);
    --sidebar-bg: #05080d;
    --sidebar: var(--sidebar-bg);
    --sidebar-hover: #0b1118;
    --sidebar-active: #0d1b2e;
    --sidebar-ink: #dce7f5;
    --sidebar-text: #9aa6b2;
    --sidebar-muted: #748094;
    --sidebar-border: #030508;
    --sidebar-line: rgba(116, 128, 148, 0.16);
    --table-bg: #080d12;
    --table-head: #0c1827;
    --table-head-ink: #b7c3d0;
    --table-row-hover: #0d141d;
    --abnormal-hover: rgba(201, 144, 46, 0.16);
    --receivable-hover: rgba(208, 100, 120, 0.14);
    --risk-unpaid-bg: rgba(208, 100, 120, 0.14);
    --risk-low-bg: rgba(201, 144, 46, 0.15);
    --neutral-chip-bg: #0c1420;
    --neutral-chip-fg: #a8b4c3;
    --neutral-chip-border: #202b3a;
    --primary-ink: #eef4fb;
    --danger-border: rgba(208, 100, 120, 0.26);
    --danger-hover: rgba(208, 100, 120, 0.15);
    --danger-hover-border: rgba(208, 100, 120, 0.34);
    --modal-backdrop: rgba(2, 6, 12, 0.72);
    --sidebar-active-text: #dce7f5;
    --selection-bg: rgba(47, 111, 211, 0.18);
    --selection-border: rgba(47, 111, 211, 0.32);
    --selection-ink: #eef4fb;
    --warn-pill-bg: rgba(201, 144, 46, 0.13);
    --warn-pill-fg: #d6a64b;
  }
}

:root[data-theme="dark"][data-palette="liming-blue"] {
  --brand: #2f6fd3;
  --brand-dark: #2458ad;
  --brand-soft: rgba(47, 111, 211, 0.10);
  --brand-border: rgba(47, 111, 211, 0.24);
  --brand-pale: rgba(47, 111, 211, 0.12);
  --accent: #3b82d8;
  --sidebar-active: #0d1b2e;
  --sidebar-active-text: #dce7f5;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: rgba(47, 111, 211, 0.18);
  --selection-border: rgba(47, 111, 211, 0.32);
}

:root[data-theme="dark"][data-palette="black-white"] {
  --ring: rgba(255, 255, 255, 0.22);
  --surface-hover: #141414;
  --bg: #000000;
  --panel: #050505;
  --panel-raised: #0a0a0a;
  --section-head: #0a0a0a;
  --topbar-bg: rgba(0, 0, 0, 0.96);
  --input-bg: #050505;
  --btn-bg: #0a0a0a;
  --btn-hover: #141414;
  --ink: #f0f0f0;
  --ink-strong: #ffffff;
  --muted: #a3a3a3;
  --line: #242424;
  --line-soft: #151515;
  --line-strong: #3a3a3a;
  --hover-border: #555555;
  --brand: #ffffff;
  --brand-dark: #ffffff;
  --brand-soft: #161616;
  --brand-border: #404040;
  --brand-pale: #1d1d1d;
  --accent: #ffffff;
  --success: #e5e5e5;
  --success-bg: #151515;
  --info: #d4d4d4;
  --info-bg: #151515;
  --warning: #d4d4d4;
  --warning-bg: #151515;
  --danger: #f97066;
  --danger-bg: #2a1012;
  --warn-bg: #151515;
  --warn-fg: #d4d4d4;
  --manual-bg: #242424;
  --manual-fg: #ffffff;
  --group: #151515;
  --sidebar-bg: #000000;
  --sidebar: #000000;
  --sidebar-hover: #121212;
  --sidebar-active: #f4f4f5;
  --sidebar-ink: #f4f4f5;
  --sidebar-text: #d4d4d8;
  --sidebar-muted: #a1a1aa;
  --sidebar-border: #000000;
  --sidebar-line: #242424;
  --sidebar-active-text: #000000;
  --sidebar-active-ink: #000000;
  --table-head: #0a0a0a;
  --table-head-ink: #f0f0f0;
  --table-row-hover: #141414;
  --abnormal-hover: #1d1d1d;
  --receivable-hover: #2a1012;
  --risk-unpaid-bg: #2a1012;
  --risk-low-bg: #1d1d1d;
  --neutral-chip-bg: #151515;
  --neutral-chip-fg: #d4d4d4;
  --neutral-chip-border: #404040;
  --primary-ink: #000000;
  --danger-border: #7a271a;
  --danger-hover: #3c1417;
  --danger-hover-border: #b42318;
  --selection-bg: #242424;
  --selection-border: #555555;
  --selection-ink: #ffffff;
  --brand-hover-bg: rgba(255, 255, 255, 0.08);
  --group-fg: #f0f0f0;
  --group-hover: #242424;
  --exam-hover: #1d1d1d;
  --warn-pill-bg: #1d1d1d;
  --warn-pill-fg: #d4d4d4;
  --shot-bg: #000000;
  --shot-panel: #050505;
  --shot-card: #0a0a0a;
  --shot-title: #ffffff;
  --shot-muted: #a3a3a3;
  --shot-line: #242424;
  --shot-brand: #ffffff;
  --shot-brand-dark: #f4f4f5;
  --shot-brand-soft: #161616;
  --shot-brand-pale: #0a0a0a;
  --shot-tag-bg: #161616;
  --shot-tag-text: #ffffff;
  --shot-time-bg: #161616;
  --shot-footer-bg: #0a0a0a;
}

:root[data-theme="dark"][data-palette="jade-original"] {
  --brand: #3a9c91;
  --brand-dark: #2f8077;
  --brand-soft: #102b29;
  --brand-border: #265952;
  --brand-pale: #12302d;
  --accent: #5f93c7;
  --sidebar-active: #102a28;
  --sidebar-active-text: #cfe5df;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #214f49;
  --selection-border: #347269;
}

:root[data-theme="dark"][data-palette="warm-sun"] {
  --brand: #b9864b;
  --brand-dark: #9a6d3b;
  --brand-soft: #2b2014;
  --brand-border: #5b3f20;
  --brand-pale: #302314;
  --accent: #c9902e;
  --sidebar-active: #261f14;
  --sidebar-active-text: #e0c59b;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #523b1e;
  --selection-border: #76582d;
}

:root[data-theme="dark"][data-palette="lavender"] {
  --brand: #8f7cc5;
  --brand-dark: #7765a8;
  --brand-soft: #241f35;
  --brand-border: #493c70;
  --brand-pale: #28223d;
  --accent: #9d8ed0;
  --sidebar-active: #242033;
  --sidebar-active-text: #d7ceef;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #44376b;
  --selection-border: #62528d;
}

:root[data-theme="dark"][data-palette="ink"] {
  --brand: #969696;
  --brand-dark: #b8b8b8;
  --brand-soft: #2a2a2a;
  --brand-border: #4a4a4a;
  --brand-pale: #303030;
  --accent: #ababab;
  --sidebar-active: #2e2e2e;
  --sidebar-active-text: #d8d8d8;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #3a3a3a;
  --selection-border: #5a5a5a;
}

:root[data-theme="dark"][data-palette="forest"] {
  --brand: #6fa978;
  --brand-dark: #5b8f64;
  --brand-soft: #183222;
  --brand-border: #325d3b;
  --brand-pale: #1d3927;
  --accent: #7fb587;
  --sidebar-active: #1d3422;
  --sidebar-active-text: #cfe2d0;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #315d3d;
  --selection-border: #4c7e56;
}

:root[data-theme="dark"][data-palette="glacier"] {
  --brand: #6f95bf;
  --brand-dark: #587b9f;
  --brand-soft: #17283d;
  --brand-border: #2e5074;
  --brand-pale: #1b2e45;
  --accent: #7fa8cf;
  --sidebar-active: #22364f;
  --sidebar-active-text: #d0deed;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #2d4f75;
  --selection-border: #4b719b;
}

:root[data-theme="dark"][data-palette="coffee"] {
  --brand: #a77e69;
  --brand-dark: #8b6654;
  --brand-soft: #37251f;
  --brand-border: #604234;
  --brand-pale: #3f2b23;
  --accent: #b98d79;
  --sidebar-active: #35251f;
  --sidebar-active-text: #e4cfc4;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #5a3e33;
  --selection-border: #7d5a4a;
}

:root[data-theme="dark"][data-palette="spice-earth"] {
  --brand: #ad7552;
  --brand-dark: #936044;
  --brand-soft: #39251c;
  --brand-border: #603d2b;
  --brand-pale: #422c21;
  --accent: #bd8060;
  --sidebar-active: #3a291f;
  --sidebar-active-text: #e5c7b4;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #5d3c2b;
  --selection-border: #81583f;
}

:root[data-theme="dark"][data-palette="monet-garden"] {
  --brand: #7f94b7;
  --brand-dark: #687c9d;
  --brand-soft: #1d2d42;
  --brand-border: #3e5372;
  --brand-pale: #23344b;
  --accent: #aa7f98;
  --sidebar-active: #273445;
  --sidebar-active-text: #d6dfed;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #3b5172;
  --selection-border: #5d7193;
}

:root[data-theme="dark"][data-palette="waterlily-pink"] {
  --brand: #ab7a8d;
  --brand-dark: #916476;
  --brand-soft: #342530;
  --brand-border: #5f3a4b;
  --brand-pale: #3d2a36;
  --accent: #7fb2a5;
  --sidebar-active: #352a32;
  --sidebar-active-text: #e5ccd6;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #5a3949;
  --selection-border: #7c5566;
}

:root[data-theme="dark"][data-palette="bauhaus"] {
  --brand: #bda638;
  --brand-dark: #9b862d;
  --brand-soft: #3a3315;
  --brand-border: #6f611f;
  --brand-pale: #453c18;
  --accent: #d06478;
  --sidebar-active: #343019;
  --sidebar-active-text: #e5d99a;
  --sidebar-active-ink: var(--sidebar-active-text);
  --selection-bg: #5c501d;
  --selection-border: #7d6d28;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"][data-palette="liming-blue"] {
    --brand: #2f6fd3;
    --brand-dark: #2458ad;
    --brand-soft: rgba(47, 111, 211, 0.10);
    --brand-border: rgba(47, 111, 211, 0.24);
    --brand-pale: rgba(47, 111, 211, 0.12);
    --accent: #3b82d8;
    --sidebar-active: #0d1b2e;
    --sidebar-active-text: #dce7f5;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: rgba(47, 111, 211, 0.18);
    --selection-border: rgba(47, 111, 211, 0.32);
  }
  
  :root[data-theme="system"][data-palette="black-white"] {
    --ring: rgba(255, 255, 255, 0.22);
    --surface-hover: #18181b;
    --bg: #050505;
    --panel: #0a0a0a;
    --panel-raised: #111111;
    --section-head: #111111;
    --topbar-bg: rgba(5, 5, 5, 0.96);
    --input-bg: #0a0a0a;
    --btn-bg: #111111;
    --btn-hover: #18181b;
    --ink: #e5e7eb;
    --ink-strong: #ffffff;
    --muted: #a1a1aa;
    --line: #27272a;
    --line-soft: #18181b;
    --line-strong: #3f3f46;
    --hover-border: #52525b;
    --brand: #f4f4f5;
    --brand-dark: #ffffff;
    --brand-soft: #18181b;
    --brand-border: #3f3f46;
    --brand-pale: #27272a;
    --accent: #ffffff;
    --success: #e5e7eb;
    --success-bg: #18181b;
    --info: #d4d4d8;
    --info-bg: #18181b;
    --warning: #d4d4d8;
    --warning-bg: #18181b;
    --danger: #ffffff;
    --danger-bg: #18181b;
    --warn-bg: #18181b;
    --warn-fg: #d4d4d8;
    --manual-bg: #27272a;
    --manual-fg: #ffffff;
    --group: #18181b;
    --group-fg: #e5e7eb;
    --group-hover: #27272a;
    --exam-hover: #27272a;
    --sidebar-bg: #050505;
    --sidebar: #050505;
    --sidebar-hover: #111111;
    --sidebar-active: #f4f4f5;
    --sidebar-ink: #f4f4f5;
    --sidebar-text: #d4d4d8;
    --sidebar-muted: #a1a1aa;
    --sidebar-border: #050505;
    --sidebar-line: #27272a;
    --table-bg: #0a0a0a;
    --table-head: #111111;
    --table-head-ink: #e5e7eb;
    --table-row-hover: #18181b;
    --abnormal-hover: #27272a;
    --receivable-hover: #27272a;
    --risk-unpaid-bg: #27272a;
    --risk-low-bg: #202020;
    --neutral-chip-bg: #18181b;
    --neutral-chip-fg: #d4d4d8;
    --neutral-chip-border: #3f3f46;
    --primary-ink: #050505;
    --danger-border: #3f3f46;
    --danger-hover: #27272a;
    --danger-hover-border: #52525b;
    --sidebar-active-text: #050505;
    --sidebar-active-ink: #050505;
    --selection-bg: #27272a;
    --selection-border: #52525b;
    --selection-ink: #ffffff;
    --warn-pill-bg: #27272a;
    --warn-pill-fg: #d4d4d8;
    --shot-bg: #050505;
    --shot-panel: #0a0a0a;
    --shot-card: #111111;
    --shot-title: #ffffff;
    --shot-muted: #a1a1aa;
    --shot-line: #27272a;
    --shot-brand: #ffffff;
    --shot-brand-dark: #f4f4f5;
    --shot-brand-soft: #18181b;
    --shot-brand-pale: #111111;
    --shot-tag-bg: #18181b;
    --shot-tag-text: #ffffff;
    --shot-time-bg: #18181b;
    --shot-footer-bg: #111111;
  }
  
  :root[data-theme="system"][data-palette="jade-original"] {
    --brand: #3a9c91;
    --brand-dark: #2f8077;
    --brand-soft: #102b29;
    --brand-border: #265952;
    --brand-pale: #12302d;
    --accent: #5f93c7;
    --sidebar-active: #102a28;
    --sidebar-active-text: #cfe5df;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #214f49;
    --selection-border: #347269;
  }
  
  :root[data-theme="system"][data-palette="warm-sun"] {
    --brand: #b9864b;
    --brand-dark: #9a6d3b;
    --brand-soft: #2b2014;
    --brand-border: #5b3f20;
    --brand-pale: #302314;
    --accent: #c9902e;
    --sidebar-active: #261f14;
    --sidebar-active-text: #e0c59b;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #523b1e;
    --selection-border: #76582d;
  }
  
  :root[data-theme="system"][data-palette="lavender"] {
    --brand: #8f7cc5;
    --brand-dark: #7765a8;
    --brand-soft: #241f35;
    --brand-border: #493c70;
    --brand-pale: #28223d;
    --accent: #9d8ed0;
    --sidebar-active: #242033;
    --sidebar-active-text: #d7ceef;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #44376b;
    --selection-border: #62528d;
  }
  
  :root[data-theme="system"][data-palette="ink"] {
    --brand: #969696;
    --brand-dark: #b8b8b8;
    --brand-soft: #2a2a2a;
    --brand-border: #4a4a4a;
    --brand-pale: #303030;
    --accent: #ababab;
    --sidebar-active: #2e2e2e;
    --sidebar-active-text: #d8d8d8;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #3a3a3a;
    --selection-border: #5a5a5a;
  }
  
  :root[data-theme="system"][data-palette="forest"] {
    --brand: #6fa978;
    --brand-dark: #5b8f64;
    --brand-soft: #183222;
    --brand-border: #325d3b;
    --brand-pale: #1d3927;
    --accent: #7fb587;
    --sidebar-active: #1d3422;
    --sidebar-active-text: #cfe2d0;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #315d3d;
    --selection-border: #4c7e56;
  }
  
  :root[data-theme="system"][data-palette="glacier"] {
    --brand: #6f95bf;
    --brand-dark: #587b9f;
    --brand-soft: #17283d;
    --brand-border: #2e5074;
    --brand-pale: #1b2e45;
    --accent: #7fa8cf;
    --sidebar-active: #22364f;
    --sidebar-active-text: #d0deed;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #2d4f75;
    --selection-border: #4b719b;
  }
  
  :root[data-theme="system"][data-palette="coffee"] {
    --brand: #a77e69;
    --brand-dark: #8b6654;
    --brand-soft: #37251f;
    --brand-border: #604234;
    --brand-pale: #3f2b23;
    --accent: #b98d79;
    --sidebar-active: #35251f;
    --sidebar-active-text: #e4cfc4;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #5a3e33;
    --selection-border: #7d5a4a;
  }
  
  :root[data-theme="system"][data-palette="spice-earth"] {
    --brand: #ad7552;
    --brand-dark: #936044;
    --brand-soft: #39251c;
    --brand-border: #603d2b;
    --brand-pale: #422c21;
    --accent: #bd8060;
    --sidebar-active: #3a291f;
    --sidebar-active-text: #e5c7b4;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #5d3c2b;
    --selection-border: #81583f;
  }
  
  :root[data-theme="system"][data-palette="monet-garden"] {
    --brand: #7f94b7;
    --brand-dark: #687c9d;
    --brand-soft: #1d2d42;
    --brand-border: #3e5372;
    --brand-pale: #23344b;
    --accent: #aa7f98;
    --sidebar-active: #273445;
    --sidebar-active-text: #d6dfed;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #3b5172;
    --selection-border: #5d7193;
  }
  
  :root[data-theme="system"][data-palette="waterlily-pink"] {
    --brand: #ab7a8d;
    --brand-dark: #916476;
    --brand-soft: #342530;
    --brand-border: #5f3a4b;
    --brand-pale: #3d2a36;
    --accent: #7fb2a5;
    --sidebar-active: #352a32;
    --sidebar-active-text: #e5ccd6;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #5a3949;
    --selection-border: #7c5566;
  }
  
  :root[data-theme="system"][data-palette="bauhaus"] {
    --brand: #bda638;
    --brand-dark: #9b862d;
    --brand-soft: #3a3315;
    --brand-border: #6f611f;
    --brand-pale: #453c18;
    --accent: #d06478;
    --sidebar-active: #343019;
    --sidebar-active-text: #e5d99a;
    --sidebar-active-ink: var(--sidebar-active-text);
    --selection-bg: #5c501d;
    --selection-border: #7d6d28;
  }
}

/* system 主题在系统深色模式下与显式深色黑白方案保持同一套纯黑白 token。 */
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"][data-palette="black-white"] {
    --ring: rgba(255, 255, 255, 0.22);
    --surface-hover: #141414;
    --bg: #000000;
    --panel: #050505;
    --panel-raised: #0a0a0a;
    --section-head: #0a0a0a;
    --topbar-bg: rgba(0, 0, 0, 0.96);
    --input-bg: #050505;
    --btn-bg: #0a0a0a;
    --btn-hover: #141414;
    --ink: #f0f0f0;
    --ink-strong: #ffffff;
    --muted: #a3a3a3;
    --line: #242424;
    --line-soft: #151515;
    --line-strong: #3a3a3a;
    --hover-border: #555555;
    --brand: #ffffff;
    --brand-dark: #ffffff;
    --brand-soft: #161616;
    --brand-border: #404040;
    --brand-pale: #1d1d1d;
    --accent: #ffffff;
    --success: #e5e5e5;
    --success-bg: #151515;
    --info: #d4d4d4;
    --info-bg: #151515;
    --warning: #d4d4d4;
    --warning-bg: #151515;
    --danger: #f97066;
    --danger-bg: #2a1012;
    --warn-bg: #151515;
    --warn-fg: #d4d4d4;
    --manual-bg: #242424;
    --manual-fg: #ffffff;
    --group: #151515;
    --group-fg: #f0f0f0;
    --group-hover: #242424;
    --exam-hover: #1d1d1d;
    --sidebar-bg: #000000;
    --sidebar: #000000;
    --sidebar-hover: #121212;
    --sidebar-active: #f4f4f5;
    --sidebar-ink: #f4f4f5;
    --sidebar-text: #d4d4d8;
    --sidebar-muted: #a1a1aa;
    --sidebar-border: #000000;
    --sidebar-line: #242424;
    --sidebar-active-text: #000000;
    --sidebar-active-ink: #000000;
    --table-bg: #050505;
    --table-head: #0a0a0a;
    --table-head-ink: #f0f0f0;
    --table-row-hover: #141414;
    --abnormal-hover: #1d1d1d;
    --receivable-hover: #2a1012;
    --risk-unpaid-bg: #2a1012;
    --risk-low-bg: #1d1d1d;
    --neutral-chip-bg: #151515;
    --neutral-chip-fg: #d4d4d4;
    --neutral-chip-border: #404040;
    --primary-ink: #000000;
    --danger-border: #7a271a;
    --danger-hover: #3c1417;
    --danger-hover-border: #b42318;
    --selection-bg: #242424;
    --selection-border: #555555;
    --selection-ink: #ffffff;
    --warn-pill-bg: #1d1d1d;
    --warn-pill-fg: #d4d4d4;
    --shot-bg: #000000;
    --shot-panel: #050505;
    --shot-card: #0a0a0a;
    --shot-title: #ffffff;
    --shot-muted: #a3a3a3;
    --shot-line: #242424;
    --shot-brand: #ffffff;
    --shot-brand-dark: #f4f4f5;
    --shot-brand-soft: #161616;
    --shot-brand-pale: #0a0a0a;
    --shot-tag-bg: #161616;
    --shot-tag-text: #ffffff;
    --shot-time-bg: #161616;
    --shot-footer-bg: #0a0a0a;
  }
}

/* Persisted base-data palette values take precedence over the legacy semantic
   defaults above, including inside compact course-table cells. */
.status-badge,
.status-badge.done,
.status-badge.pending,
.status-badge.leave,
.status-badge.trial,
.status-badge.exam,
.status-badge.unpaid {
  background: var(--badge-bg, var(--neutral-chip-bg));
  color: var(--badge-fg, var(--neutral-chip-fg));
}

/* The course-table student column intentionally grows to the widest visible
   complete badge line. Horizontal overflow belongs to its table wrapper only. */
.course-table.lesson-table :is(th, td).col-students,
.course-table.lesson-table col.col-students {
  width: var(--lesson-student-column-width, 300px) !important;
  min-width: var(--lesson-student-column-width, 300px) !important;
  max-width: none !important;
}
.course-table.lesson-table .lesson-student-badges,
.course-table.lesson-table .schedule-student-badges {
  display: inline-flex;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.course-table.lesson-table .lesson-schedule-student-field {
  display: block;
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.course-table.lesson-table .lesson-schedule-student-field:hover,
.course-table.lesson-table .lesson-schedule-student-field:focus-visible { background: transparent; }
.schedule-student-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 2px 0 6px;
  border-bottom: 1px solid var(--line);
}

/* 未开启“跟随当前配色”时，课程截图始终维持固定黎明蓝方案。 */
:root[data-palette]:not([data-shot-follow-palette="true"]) {
  --shot-bg: #f7f9fc;
  --shot-panel: #ffffff;
  --shot-card: #ffffff;
  --shot-title: #102033;
  --shot-muted: #64748b;
  --shot-line: #c8d6e5;
  --shot-brand: #002147;
  --shot-brand-dark: #00172f;
  --shot-brand-soft: #eaf0f7;
  --shot-brand-pale: #f5f8fc;
  --shot-tag-bg: #eaf0f7;
  --shot-tag-text: #002147;
  --shot-time-bg: #eaf0f7;
  --shot-footer-bg: #eef3f9;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 400;
  line-height: var(--leading-ui);
  letter-spacing: 0;
  font-kerning: normal;
  font-synthesis-weight: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: var(--font-ui);
  font-size: inherit;
  line-height: 1.35;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-ink);
  text-shadow: none;
}

button:focus-visible,
.btn:focus-visible,
.nav-btn:focus-visible,
.nav-sub-btn:focus-visible,
.tab:focus-visible,
.control:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  box-shadow: none;
}

@keyframes surface-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes value-settle {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#app {
  height: 100vh;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  overflow: hidden;
  transition: grid-template-columns 180ms var(--ease-out);
}

#app.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

#app.login-mode {
  grid-template-columns: minmax(0, 1fr);
}

#app.login-mode .sidebar,
#app.login-mode .topbar {
  display: none;
}

#app.login-mode .main {
  background:
    linear-gradient(180deg, rgba(234, 240, 247, 0.72), rgba(255, 255, 255, 0.86)),
    var(--bg);
}

:root[data-palette="black-white"] #app.login-mode .main {
  background: var(--bg);
}

#app.login-mode .content {
  padding: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 0 var(--space-3) var(--space-4);
  border-right: 1px solid var(--sidebar-border);
  height: 100vh;
  min-height: 0;
  overflow: visible;
}

.brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 56px;
  padding: 8px var(--space-2);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--sidebar-line);
}

.nav-expand-toggle {
  width: 34px;
  height: 34px;
  margin-left: auto;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  background: transparent;
  cursor: pointer;
}

.nav-expand-toggle:hover,
.nav-expand-toggle:focus-visible {
  border-color: var(--sidebar-border);
  color: var(--sidebar-active-text);
  background: var(--sidebar-hover);
}

.nav-expand-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-loading-skeleton {
  display: grid;
  gap: var(--space-4);
}

.view-loading-bar,
.view-loading-grid span,
.view-loading-table {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-soft) 20%, var(--brand-soft) 45%, var(--surface-soft) 70%);
  background-size: 220% 100%;
  animation: view-loading-shimmer 1.2s ease-in-out infinite;
}

.view-loading-bar {
  width: min(280px, 48%);
  height: 30px;
}

.view-loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.view-loading-grid span {
  min-height: 92px;
}

.view-loading-table {
  min-height: 260px;
}

@keyframes view-loading-shimmer {
  to { background-position: -220% 0; }
}

#nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-line) transparent;
}

.nav-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-tool-label {
  color: var(--sidebar-muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.sidebar-user {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  color: var(--sidebar-text);
  border-top: 1px solid var(--sidebar-line);
}

.sidebar-user span {
  color: var(--sidebar-muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 56px);
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: clamp(28px, 4vw, 36px);
  border: 1px solid color-mix(in srgb, var(--brand-border) 72%, #ffffff);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.12);
}

.login-title {
  color: var(--ink-strong);
  font-size: var(--text-title);
  font-weight: 900;
  text-align: center;
}

.login-subtitle,
.login-tip {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
  text-align: center;
  line-height: 1.6;
}

.login-error {
  padding: 10px 12px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  color: var(--danger);
  background: var(--danger-bg);
  font-weight: 800;
}

.login-field {
  display: grid;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.login-field .control {
  min-height: 44px;
  border-color: var(--brand-border);
  background: var(--input-bg);
}

.login-password-wrap {
  position: relative;
  display: block;
}

.login-password-wrap .login-password {
  width: 100%;
  padding-right: 44px;
}

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.login-password-toggle:hover,
.login-password-toggle:focus-visible {
  color: var(--brand);
  background: var(--brand-soft);
}

.login-password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.user-create-modal-panel {
  width: min(680px, calc(100vw - 32px));
  max-height: 92vh;
  overflow: auto;
}

.user-create-form {
  display: grid;
  gap: var(--space-4);
}

.user-create-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.user-create-form-field {
  display: grid;
  min-width: 0;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-table);
  font-weight: 800;
}

.user-create-form-field.wide {
  grid-column: 1 / -1;
}

.user-create-form-field :is(.control, .multi-select) {
  width: 100%;
}

.user-create-modal .modal-actions {
  gap: var(--space-3);
}

.user-table th,
.user-table td {
  min-width: 140px;
}

.user-actions-cell {
  min-width: 220px;
}

.user-reset-password-inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.palette-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--selection-border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--sidebar-hover) 72%, var(--panel-raised));
}

.palette-swatch {
  min-height: 14px;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--selection-border) 70%, transparent);
}

.appearance-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) minmax(180px, 0.8fr);
  gap: var(--space-4);
  align-items: end;
  padding: var(--space-5);
}

.appearance-field,
.appearance-preview {
  display: grid;
  gap: var(--space-2);
}

.appearance-field span,
.appearance-preview > span {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.appearance-preview .palette-preview {
  width: min(220px, 100%);
  border-color: var(--line);
  background: var(--panel-raised);
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 750;
  font-size: var(--text-body);
  line-height: 1;
}

.brand-name {
  font-weight: 700;
  font-size: var(--text-ui);
  line-height: 1.15;
}

.brand-subtitle {
  color: var(--sidebar-muted);
  font-size: var(--text-caption);
  line-height: 1.15;
  margin-top: 1px;
}

#app.sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

#app.sidebar-collapsed .brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

#app.sidebar-collapsed .brand-mark {
  width: 34px;
  height: 34px;
}

#app.sidebar-collapsed .brand-name,
#app.sidebar-collapsed .brand-subtitle {
  display: none;
}

.nav-btn {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--sidebar-text);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  min-height: 40px;
  padding: 10px var(--space-3);
  text-align: left;
  margin: 0;
  font-size: var(--text-ui);
  line-height: 1.35;
  overflow: hidden;
}

.nav-icon {
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  width: 22px;
  line-height: 1;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.nav-btn:hover {
  background: var(--sidebar-hover);
}

.nav-btn.active {
  border: 1px solid var(--brand-border);
  background: var(--sidebar-active);
  color: var(--sidebar-active-ink);
  font-weight: 700;
  box-shadow: none;
}

.nav-btn:active {
  background: var(--sidebar-active);
  transform: translateY(1px);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  position: relative;
}

.nav-group.open {
  margin-bottom: var(--space-2);
}

.nav-subtabs {
  display: grid;
  gap: 4px;
  padding: 4px 0 4px 8px;
  border-left: 2px solid var(--brand-border);
  margin-left: 10px;
}

.nav-sub-btn {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.nav-sub-btn {
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
}

.nav-sub-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-ink);
}

.nav-sub-btn.active {
  background: var(--brand-pale);
  color: var(--sidebar-active-ink);
}

#app.sidebar-collapsed .nav-btn {
  justify-content: center;
  min-height: 44px;
  padding: 10px 0;
}

#app.sidebar-collapsed .nav-label,
#app.sidebar-collapsed .nav-subtabs {
  display: none;
}

#app.sidebar-collapsed .nav-group.open {
  margin-bottom: 0;
}

#app.sidebar-collapsed .nav-btn:hover::after,
#app.sidebar-collapsed .nav-btn:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  z-index: 40;
  max-width: 180px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink-strong);
  box-shadow: var(--shadow-panel), 0 10px 24px rgba(15, 23, 42, 0.18);
  font-size: var(--text-caption);
  font-weight: 800;
  white-space: nowrap;
  transform: translateY(-50%);
  pointer-events: none;
}

.main {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  z-index: 5;
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sticky);
  min-height: 56px;
  padding: 9px clamp(18px, 2.4vw, 28px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

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

.sidebar-toggle {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 850;
  cursor: pointer;
}

.sidebar-toggle:hover {
  border-color: var(--brand-border);
  background: var(--brand-soft);
  color: var(--ink-strong);
}

.title-block {
  min-width: 0;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 750;
  line-height: var(--leading-tight);
  color: var(--ink-strong);
}

.page-title-note {
  display: inline-block;
  margin-left: var(--space-3);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 650;
  line-height: 1.35;
  vertical-align: middle;
}

.page-meta {
  color: var(--muted);
  margin-top: 2px;
  font-size: var(--text-caption);
  line-height: 1.25;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  row-gap: var(--space-2);
}

.toolbar:empty {
  display: none;
}

.topbar .toolbar > .btn,
.topbar .toolbar > .history-toggle {
  min-height: 34px;
  height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
  display: inline-flex;
  align-items: center;
}

.month-toolbar {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
}

.month-toolbar-label {
  padding-left: 6px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
  white-space: nowrap;
}

.month-toolbar .control {
  width: auto;
  min-width: 142px;
  height: 30px;
  min-height: 30px;
  padding-top: 3px;
  padding-bottom: 3px;
}

.month-toolbar-actions {
  display: inline-flex;
  gap: var(--space-1);
}

.month-toolbar .btn {
  min-height: 30px;
  height: 30px;
  padding: 4px 8px;
}

.month-toolbar .icon-btn {
  width: 30px;
  min-width: 30px;
  padding: 0;
}

.month-toolbar .control,
.month-toolbar .btn {
  flex: 0 0 auto;
}

.user-menu {
  position: relative;
  flex: 0 0 auto;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  height: 34px;
  padding: 4px 9px 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-ui);
  font-weight: 750;
  cursor: pointer;
}

.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger {
  border-color: var(--brand-border);
  background: var(--brand-soft);
  color: var(--ink-strong);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--primary-ink);
  font-size: var(--text-caption);
  font-weight: 850;
  line-height: 1;
}

.user-menu-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-arrow {
  color: var(--muted);
  font-size: 0.75rem;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-panel), 0 16px 32px rgba(15, 23, 42, 0.18);
}

.user-menu-header {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
}

.user-menu-header strong {
  color: var(--ink-strong);
  font-size: var(--text-ui);
  font-weight: 850;
}

.user-menu-header span {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.user-menu-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--line-soft);
}

.user-menu-item {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-ui);
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.user-menu-item:hover {
  background: var(--surface-hover);
  color: var(--ink-strong);
}

.user-menu-item.danger {
  color: var(--danger);
}

.user-menu-item.danger:hover {
  background: var(--danger-bg);
}

.toolbar label {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.35;
  font-weight: 700;
}

.history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--ink);
  white-space: nowrap;
}

.history-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.history-toggle span {
  font-size: var(--text-caption);
  font-weight: 700;
}

.compact-toggle {
  min-height: 34px;
  padding: 7px 10px;
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: clamp(20px, 2.6vw, 32px);
}

.band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-panel);
}

.band + .band,
.summary-grid + .band {
  margin-top: var(--space-5);
}

.section-head {
  min-height: 54px;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line-soft);
  background: var(--section-head);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.section-title {
  font-weight: 700;
  font-size: var(--text-body);
  line-height: 1.35;
}

.section-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.4;
}

.table-wrap {
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-color: var(--brand-border) transparent;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--text-table);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  padding: 0;
  min-width: 96px;
  height: 40px;
  line-height: 1.5;
  vertical-align: middle;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease-out);
}

th:last-child,
td:last-child {
  border-right: 0;
}

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

tbody tr:hover td {
  background-color: var(--surface-hover);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-head);
  color: var(--table-head-ink);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
  padding: 10px 12px;
}

td.readonly,
td.text-cell {
  padding: 9px 12px;
  line-height: 1.5;
}

.teacher-salary-select-cell {
  padding: 9px 12px;
  text-align: center;
}

.teacher-detail-table .select-col {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  padding: 6px 4px;
  text-align: center;
}

.fee-detail-table .select-col {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  padding: 6px 4px;
  text-align: center;
}

.teacher-detail-bulkbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: 0 0 var(--space-4);
}

.teacher-salary-batch-result {
  display: grid;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.teacher-salary-batch-details summary {
  width: fit-content;
  color: var(--brand);
  font-weight: 800;
  cursor: pointer;
}

.teacher-salary-batch-details .table-wrap {
  max-width: 100%;
  margin-top: var(--space-3);
  overflow-x: auto;
}

.teacher-salary-lesson-select:not(:disabled),
.teacher-salary-select-all:not(:disabled) {
  cursor: pointer;
}

.teacher-salary-lesson-select:disabled,
.teacher-salary-select-all:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

tr.abnormal td {
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-weight: 700;
}

tr.abnormal:hover td {
  background: var(--abnormal-hover);
}

/* [约束5] PATCH 返回 warnings 的行底色与图标 */
.course-table tr.has-warnings {
  --warn-stripe: color-mix(in srgb, var(--warning) 12%, transparent);
  background: var(--warn-stripe);
}
.lesson-warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  flex-shrink: 0;
}

tr.receivable td {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

tr.receivable:hover td {
  background: var(--receivable-hover);
}

tr.exam-row td {
  background: var(--warning-bg);
  color: var(--warning);
  font-weight: 700;
}

tr.exam-row:hover td {
  background: var(--exam-hover);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: var(--text-caption);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.status-badge.done,
.status-select.done {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}

.status-badge.pending,
.status-select.pending {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info);
}

.status-badge.leave,
.status-select.leave {
  background: var(--neutral-chip-bg);
  color: var(--neutral-chip-fg);
  border-color: var(--neutral-chip-border);
}

.status-badge.trial,
.status-select.trial {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: var(--brand-border);
}

.status-badge.exam,
.status-select.exam {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning);
}

.status-badge.unpaid,
.status-select.unpaid {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.status-select {
  min-width: 78px;
  font-weight: 800;
}

tr.group-break td {
  background: var(--group);
  color: var(--group-fg);
}

tr.group-break:hover td {
  background: var(--group-hover);
}

.course-table.week-detail-table tbody tr.lesson-row-depth-0:not(.abnormal) > td {
  background-color: var(--panel);
}

.course-table.week-detail-table tbody tr.lesson-row-depth-1:not(.abnormal) > td {
  background-color: rgba(59, 130, 246, 0.10);
}

.course-table.week-detail-table tbody tr.lesson-row-depth-0:not(.abnormal):hover > td {
  background-color: var(--surface-hover);
}

.course-table.week-detail-table tbody tr.lesson-row-depth-1:not(.abnormal):hover > td {
  background-color: rgba(59, 130, 246, 0.16);
}

td.grade-cell {
  font-weight: 700;
}

.summary-expand-cell {
  width: 44px;
}

.summary-expand-btn,
.summary-name-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.summary-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--brand-dark);
  font-weight: 900;
}

.summary-expand-btn:hover,
.summary-name-btn:hover {
  background: var(--brand-hover-bg);
  color: var(--brand-dark);
}

.summary-name-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 800;
}

.summary-detail-row td {
  padding: 14px 16px;
  background: var(--panel-raised) !important;
  border-bottom: 1px solid var(--line);
}

.balance-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
}

.balance-mini-card {
  flex: 1 1 calc(50% - var(--space-3));
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--section-head);
}

.balance-mini-title {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
  line-height: 1.35;
}

.balance-mini-lines {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.balance-mini-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.balance-mini-line strong {
  color: var(--ink);
  font-family: var(--font-number);
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.balance-query-panel {
  margin-bottom: var(--space-5);
}

.balance-query-body {
  padding: var(--space-4);
}

.audit-panel {
  margin-bottom: var(--space-5);
}

.audit-risk-overview {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-panel);
}

.audit-risk-overview.has-critical {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.audit-risk-kicker {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.audit-risk-title {
  margin-top: var(--space-1);
  color: var(--ink-strong);
  font-size: 1.25rem;
  font-weight: 850;
  line-height: 1.25;
}

.audit-risk-note {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--text-ui);
  line-height: 1.45;
}

.audit-risk-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  gap: var(--space-3);
  min-width: min(460px, 48%);
}

.audit-risk-card {
  display: grid;
  align-content: center;
  gap: var(--space-1);
  min-height: 72px;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--section-head);
}

.audit-risk-card span {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 900;
}

.audit-risk-card strong {
  color: var(--ink);
  font-family: var(--font-number);
  font-size: 1.5rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.audit-risk-card.CRITICAL {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.audit-risk-card.HIGH,
.audit-risk-card.WARN {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.audit-risk-card.MEDIUM {
  border-color: var(--info);
  background: var(--info-bg);
}

.audit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-4);
  border-bottom: 1px solid var(--line-soft);
}

.audit-toolbar .control {
  max-width: 420px;
}

.audit-source-import {
  border-top: 1px solid var(--line-soft);
}

.audit-toolbar-note {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.segmented-option,
.segmented-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.segmented-option.active,
.segmented-btn.active {
  color: var(--ink-strong);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.audit-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0 var(--space-5) var(--space-3);
  color: var(--muted);
  font-size: var(--text-caption);
}

.audit-source-meta span {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--section-head);
  padding: 4px 8px;
}

.audit-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}

.audit-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.audit-empty {
  padding: var(--space-5);
}

.audit-inline-notice {
  margin-bottom: var(--space-4);
  padding: 10px 14px;
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  color: var(--brand-dark);
  font-weight: 700;
}

.audit-inline-notice.danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.backup-modal-panel {
  width: min(560px, calc(100vw - 32px));
}

.modal-panel.backup-records-panel {
  display: flex;
  flex-direction: column;
  width: min(1280px, 80vw);
  min-width: min(1120px, 100%);
  max-width: 100%;
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.backup-records-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(64vh, 640px);
  overflow: auto;
}

.backup-records-panel .modal-actions {
  flex: 0 0 auto;
}

.backup-settings-grid {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-4) 0;
}

.backup-enable-toggle {
  justify-content: flex-start;
}

.backup-last-run {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 750;
}

.backup-record-table td:nth-child(6) {
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--badge-bg, var(--neutral-chip-bg));
  color: var(--badge-fg, var(--neutral-chip-fg));
}

.backup-record-table {
  min-width: 1120px;
}

.audit-group {
  border-top: 1px solid var(--line-soft);
}

.audit-group summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: 12px var(--space-4);
  color: var(--ink);
}

.audit-table th,
.audit-table td {
  min-width: 100px;
}

.audit-table td:nth-child(7) {
  min-width: 220px;
}

.audit-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.severity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 900;
  line-height: 1;
}

.severity-pill.CRITICAL {
  background: var(--danger-bg);
  color: var(--danger);
}

.severity-pill.HIGH {
  background: var(--warning-bg);
  color: var(--warning);
}

.severity-pill.MEDIUM {
  background: var(--info-bg);
  color: var(--info);
}

.severity-pill.LOW {
  background: var(--neutral-chip-bg);
  color: var(--neutral-chip-fg);
}

.severity-pill.WARN {
  background: var(--warn-pill-bg);
  color: var(--warn-pill-fg);
}

.audit-history {
  margin-bottom: var(--space-5);
}

td.negative,
.negative {
  background: var(--manual-bg) !important;
  color: var(--manual-fg) !important;
  font-weight: 800;
}

.cell-input,
.cell-select {
  width: 100%;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: 0;
  padding: 8px 10px;
  background: transparent;
  color: inherit;
  min-width: 96px;
  font-size: var(--text-table);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.cell-select,
select.control,
.nav-more-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.25 5.25 7 9l3.75-3.75' fill='none' stroke='%23667780' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

.cell-select::-ms-expand,
select.control::-ms-expand,
.nav-more-select::-ms-expand {
  display: none;
}

.cell-select {
  background-color: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 0 0 1px rgba(212, 226, 227, 0.58);
  font-weight: 650;
}

.cell-select.status-select {
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.25 5.25 7 9l3.75-3.75' fill='none' stroke='%23667780' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

.cell-input:hover,
.cell-select:hover {
  border-color: var(--hover-border);
  background-color: var(--surface-hover);
}

.cell-input:focus,
.cell-select:focus,
.control:focus {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--ring);
  background-color: var(--input-bg);
}

.cell-input::placeholder {
  color: var(--muted);
}

.cell-input.number {
  text-align: right;
  font-family: var(--font-number);
}

.cell-input.custom-date-input,
.control.custom-date-input {
  cursor: text;
  background-image: none;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  caret-color: auto;
}

.cell-input.custom-date-input {
  padding-right: 10px;
}

.control.custom-date-input {
  padding-right: 12px;
}

input[type="date"][data-date-kind="single"]::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
  appearance: none;
}

.cell-input.custom-date-input::placeholder,
.control.custom-date-input::placeholder {
  color: var(--muted);
  font-family: var(--font-ui);
}

.manual-price {
  background: var(--manual-bg);
  color: var(--manual-fg);
  font-weight: 800;
}

.price-cell-wrap {
  position: relative;
  min-width: 96px;
}

.cell-input.custom-date-input:disabled,
.control.custom-date-input:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.cell-input.custom-date-input[aria-invalid="true"],
.control.custom-date-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}

.currency-input-cell,
.uniform-table td.currency-input-cell {
  text-align: right !important;
}

.currency-input-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  min-width: 88px;
}

.currency-input-wrap .currency-input {
  position: relative;
  z-index: 1;
  width: 100%;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  caret-color: var(--text);
}

.currency-input-wrap .currency-input:disabled {
  opacity: 1;
}

.currency-input-wrap .currency-display {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  color: var(--text);
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  pointer-events: none;
  transition: opacity 0.12s var(--ease-out);
}

.currency-input-wrap.negative .currency-display {
  color: var(--danger);
  font-weight: 800;
}

.currency-input-wrap:focus-within .currency-display {
  opacity: 0;
}

.currency-input-wrap:focus-within .currency-input {
  color: var(--text) !important;
  -webkit-text-fill-color: currentColor;
}

.currency-input-wrap.negative:focus-within .currency-input {
  color: var(--danger) !important;
}

.price-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.price-inline .price-amount {
  min-width: max-content;
  text-align: right;
}

.price-cell-wrap .cell-input {
  padding-right: 26px;
}

.editable-price-inline {
  align-items: center;
  gap: 8px;
}

.editable-price-inline .currency-input-wrap {
  flex: 1 1 auto;
}

.price-cell-wrap .currency-input-wrap .cell-input {
  padding-right: 8px;
}

.price-source-badge {
  position: absolute;
  top: 4px;
  right: 5px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.price-inline .price-source-badge {
  position: static;
  top: auto;
  right: auto;
  z-index: auto;
  flex: 0 0 auto;
}

.price-source-badge.manual {
  background: var(--manual-bg);
  color: var(--manual-fg);
}

.price-source-badge.custom {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.price-source-badge.exam {
  background: var(--warning-bg);
  color: var(--warning);
}

.price-source-badge.trial {
  background: var(--neutral-chip-bg);
  color: var(--neutral-chip-fg);
}

.price-source-badge.waiver {
  background: var(--danger-bg);
  color: var(--danger);
}

.visible-price-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--text-caption);
  font-weight: 800;
  white-space: nowrap;
}

.visible-price-status.is-set {
  background: var(--success-bg);
  color: var(--success);
}

.visible-price-status.is-unset {
  background: var(--neutral-chip-bg);
  color: var(--neutral-chip-fg);
}

.btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: var(--text-ui);
  line-height: 1.35;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.04);
}

.btn:hover {
  border-color: var(--brand-border);
  background: var(--btn-hover);
}

.btn:active {
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.12);
  transform: translateY(1px);
}

.btn.primary {
  background: var(--brand);
  color: var(--primary-ink);
  border-color: var(--brand);
  box-shadow: 0 2px 5px rgba(15, 118, 110, 0.2);
}

.btn.primary:hover {
  background: var(--brand-dark);
}

:root[data-palette="black-white"] .btn.primary {
  box-shadow: 0 2px 5px rgba(17, 17, 17, 0.16);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand-dark);
  box-shadow: none;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.btn.danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.btn.danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover-border);
}

.btn:disabled,
.btn:disabled:hover,
.btn.primary:disabled,
.btn.primary:disabled:hover,
.btn.danger:disabled,
.btn.danger:disabled:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--line-soft) 78%, var(--panel));
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
  filter: grayscale(0.2);
  opacity: 0.68;
  transform: none;
}

.icon-btn {
  min-width: 36px;
  padding-inline: 10px;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: var(--space-2);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: var(--text-caption);
  font-weight: 800;
  vertical-align: middle;
}

.filter-bar.compact {
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.filter-bar.compact label {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.table-filter-summary {
  justify-content: flex-end;
  margin-top: var(--space-3);
}

.hidden {
  display: none !important;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.lesson-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: var(--shadow-panel);
}

.lesson-table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.lesson-table-actions .btn {
  min-height: 34px;
  padding: 7px 11px;
}

.lesson-table-actions .schedule-mode-toggle {
  min-width: 88px;
}

.lesson-selection-summary {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
  white-space: nowrap;
}

.course-table.lesson-table .lesson-select-head,
.course-table.lesson-table .lesson-select-cell {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  text-align: center;
  vertical-align: middle;
}

.course-table.lesson-table .lesson-select-cell {
  padding: 0;
}

.course-table.lesson-table .lesson-select-head input[type="checkbox"],
.course-table.lesson-table .lesson-select-cell input[type="checkbox"] {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  accent-color: var(--brand);
  cursor: pointer;
}

.course-table.lesson-table :is(.col-teacher, .col-students, .col-note) {
  text-align: left;
}

.course-table.lesson-table :is(.col-serial, .col-date, .col-status, .col-weekday, .col-time, .col-room, .col-grade, .col-subject) {
  text-align: center;
}

.course-table.lesson-table .col-index {
  text-align: right;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.course-table.lesson-table :is(.col-date, .col-status, .col-time, .col-room, .col-grade, .col-subject) :is(.cell-input, .cell-select) {
  text-align: inherit;
}

.course-table.lesson-table :is(.col-teacher, .col-students, .col-note) :is(.cell-input, .cell-select) {
  text-align: left;
}

@media (max-width: 820px) {
  .lesson-table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-selection-summary {
    white-space: normal;
  }
}

.lesson-quick-buttons {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  min-height: 38px;
}

.lesson-quick-buttons .btn {
  min-height: 34px;
  padding: 6px 9px;
}

.course-table.lesson-table .schedule-add-row > td {
  height: 46px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--brand-soft) 30%, transparent);
  text-align: center;
  vertical-align: middle;
}

.course-table.lesson-table .schedule-add-row:hover > td {
  background: color-mix(in srgb, var(--brand-soft) 56%, transparent);
}

.course-table.lesson-table .schedule-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-width: 100%;
  margin: 0 auto;
  padding: 5px 14px;
  border: 1px dashed var(--brand-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-raised) 88%, var(--brand-soft));
  color: var(--brand-dark);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 800;
  line-height: 1.35;
  cursor: pointer;
  white-space: normal;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 140ms var(--ease-out);
}

.course-table.lesson-table .schedule-add-btn:hover,
.course-table.lesson-table .schedule-add-btn:focus-visible {
  border-style: solid;
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-1px);
}

.copy-panel {
  width: min(760px, 100%);
}

.modal-panel.week-copy-panel {
  display: flex;
  flex-direction: column;
  width: min(1360px, 84vw);
  min-width: min(1120px, 100%);
  max-width: 100%;
  max-height: min(920px, calc(100vh - 24px));
  overflow: hidden;
}

.week-copy-panel .copy-preview-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(64vh, 660px);
  overflow: auto;
}

.week-copy-panel .copy-preview-table {
  min-width: 1180px;
}

.week-copy-panel .modal-actions {
  flex: 0 0 auto;
}

.week-copy-conflict-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-3) 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--section-head);
  color: var(--muted);
}

.week-copy-conflict-summary strong {
  color: var(--ink);
  white-space: nowrap;
}

.week-copy-conflict-summary.is-clear {
  border-color: var(--line);
  background: var(--section-head);
  color: var(--muted);
}

.week-copy-conflict-summary.is-clear strong {
  color: var(--ink);
}

.week-copy-conflict-summary.has-conflict {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.week-copy-conflict-summary.has-conflict strong {
  color: var(--danger);
}

.copy-preview-table tr.has-conflict td {
  background: var(--danger-bg);
}

.lesson-create-modal .lesson-create-panel {
  width: min(820px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.copy-form {
  display: grid;
  gap: var(--space-4);
}

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

.teacher-salary-rule-modal .lesson-create-form,
.student-pricing-modal .lesson-create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.teacher-salary-rule-modal .lesson-create-form .wide,
.student-pricing-modal .lesson-create-form .wide {
  grid-column: 1 / -1;
}

.teacher-salary-rule-modal .filter-combo,
.student-pricing-modal .filter-combo {
  width: 100%;
}

.teacher-salary-rule-modal .filter-combo-menu,
.student-pricing-modal .filter-combo-menu {
  z-index: 90;
  background: var(--panel-raised);
  color: var(--text);
  border-color: var(--line);
  box-shadow: var(--shadow-sticky);
}

.teacher-salary-rule-modal :is(input, select, option),
.student-pricing-modal :is(input, select, option) {
  color-scheme: light;
}

.teacher-salary-rule-modal :is(.control, select.control),
.student-pricing-modal :is(.control, select.control) {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--line);
}

.teacher-salary-rule-modal select.control option,
.student-pricing-modal select.control option {
  background: var(--panel);
  color: var(--ink);
}

.lesson-create-modal .lesson-create-students-field {
  grid-column: 1 / -1;
}

.lesson-create-student-search-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
}

.lesson-create-student-search {
  min-width: 0;
}

.lesson-create-student-search-stats {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
  white-space: nowrap;
}

.lesson-create-student-search-stats b {
  color: var(--ink);
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
}

.lesson-create-modal .lesson-create-manual-field {
  margin-top: var(--space-2);
}

.lesson-create-modal .lesson-create-student-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--space-2);
  max-height: 180px;
  overflow: auto;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--section-head);
}

.lesson-create-modal .lesson-create-student-option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--ink);
  font-size: var(--text-table);
  font-weight: 700;
}

.lesson-create-modal .lesson-create-student-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-create-modal .lesson-create-student-option.is-search-filtered,
.lesson-create-modal .lesson-create-student-option[hidden] {
  display: none !important;
}

.lesson-create-modal .lesson-create-student-search-empty {
  grid-column: 1 / -1;
  padding: var(--space-2);
}

.lesson-create-modal .lesson-create-new-students {
  min-height: 76px;
  resize: vertical;
}

.lesson-create-conflict-hint {
  display: grid;
  gap: 3px;
  margin: 0 var(--space-4) var(--space-3);
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--section-head);
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.45;
}

.lesson-create-conflict-hint.has-conflict {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
  background: var(--danger-bg);
  color: var(--danger);
}

.lesson-create-conflict-hint strong {
  color: inherit;
  font-weight: 800;
}

.custom-select.candidate-conflict .custom-select-button {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--line));
  color: var(--danger);
}

.course-table.lesson-table .lesson-schedule-students {
  padding: 4px 6px;
  vertical-align: top;
}

.lesson-schedule-students .multi-select,
.lesson-schedule-students .multi-select-toggle {
  width: 100%;
  min-width: 0;
}

.lesson-schedule-students .multi-select-selection-summary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.lesson-schedule-students .multi-select-selection-summary b {
  color: var(--text);
  font-family: var(--font-number);
}

.lesson-schedule-students .multi-select-toggle {
  min-height: 34px;
  padding-right: 28px;
}

.schedule-student-menu {
  width: min(400px, calc(100vw - 24px));
  display: grid;
  grid-template-rows: auto minmax(0, 210px) auto auto;
  gap: 8px !important;
  overflow: hidden !important;
}

.schedule-student-menu.floating-multi-select-menu {
  /* The outer picker never scrolls; only the candidate list owns vertical scrolling. */
  max-height: none;
}

.lesson-student-picker-header { display: grid; gap: 6px; }

.lesson-student-picker-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }

.lesson-student-picker-search .multi-select-search { margin: 0; }

.schedule-student-stats {
  color: var(--muted);
  font-size: var(--text-caption);
}

.schedule-student-stats b { color: var(--text); font-family: var(--font-number); }

.schedule-student-options {
  display: grid;
  gap: 2px;
  min-height: 0;
  height: 210px;
  max-height: 210px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.lesson-student-picker-list .multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.lesson-student-picker-list .multi-select-option > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-student-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.student-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border: 0;
  border-radius: 6px;
  background: var(--badge-bg, var(--neutral-chip-bg));
  color: var(--badge-fg, var(--neutral-chip-fg));
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.student-badge-removable { cursor: pointer; }
.student-badge-removable:hover,
.student-badge-removable:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; filter: brightness(.96); }
.student-badge-remove { font-size: 15px; line-height: .8; font-weight: 500; }

.lesson-student-picker-list .student-badge { pointer-events: none; }

.schedule-student-new-names {
  width: 100%;
  min-height: 56px;
  resize: vertical;
}

.schedule-student-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

@media (max-width: 720px) {
  .lesson-create-modal .lesson-create-form,
  .teacher-salary-rule-modal .lesson-create-form,
  .student-pricing-modal .lesson-create-form,
  .recharge-form-grid {
    grid-template-columns: 1fr;
  }

  .lesson-create-student-search-wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .lesson-create-student-search-stats {
    justify-content: flex-start;
    white-space: normal;
  }
}

.quick-row,
.week-copy-form {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.copy-preview-wrap {
  max-height: 320px;
}

.modal-panel.batch-copy-panel {
  display: flex;
  flex-direction: column;
  width: min(1500px, calc(100vw - 80px));
  max-width: calc(100vw - 32px);
  height: min(900px, 90vh);
  max-height: 90vh;
  overflow: hidden;
}

.batch-copy-drag-handle {
  cursor: move;
  user-select: none;
}

.batch-copy-drag-handle .btn,
.batch-copy-drag-handle button {
  cursor: pointer;
}

.batch-copy-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: var(--space-1);
}

.batch-copy-edit-wrap,
.batch-copy-preview {
  max-height: 340px;
  overflow: auto;
}

.batch-copy-preview table {
  min-width: 1120px;
}

.batch-copy-edit-table {
  min-width: 1040px;
  table-layout: fixed;
}

.batch-copy-edit-table th,
.batch-copy-edit-table td {
  box-sizing: border-box;
  min-width: 0;
  padding: 6px 7px;
}

.batch-copy-edit-table .control,
.batch-copy-edit-table .custom-select-control,
.batch-copy-edit-table .custom-select-button {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.batch-copy-edit-table .control {
  min-height: 30px;
  padding: 4px 7px;
  font-size: var(--text-table);
  font-weight: 400;
}

.batch-copy-edit-table .custom-select-button {
  min-height: 30px;
  padding: 4px 26px 4px 7px;
  font-size: var(--text-table);
  font-weight: 400;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.batch-copy-edit-table th:nth-child(1),
.batch-copy-edit-table td:nth-child(1) {
  width: 118px;
}

.batch-copy-edit-table th:nth-child(2),
.batch-copy-edit-table td:nth-child(2) {
  width: 112px;
}

.batch-copy-edit-table th:nth-child(3),
.batch-copy-edit-table td:nth-child(3) {
  width: 86px;
  text-align: center;
}

.batch-copy-edit-table th:nth-child(4),
.batch-copy-edit-table td:nth-child(4) {
  width: 68px;
  text-align: center;
}

.batch-copy-edit-table th:nth-child(5),
.batch-copy-edit-table td:nth-child(5) {
  width: 116px;
}

.batch-copy-edit-table th:nth-child(6),
.batch-copy-edit-table td:nth-child(6),
.batch-copy-edit-table th:nth-child(7),
.batch-copy-edit-table td:nth-child(7) {
  width: 84px;
}

.batch-copy-edit-table th:nth-child(8),
.batch-copy-edit-table td:nth-child(8) {
  width: 92px;
}

.batch-copy-edit-table th:nth-child(9),
.batch-copy-edit-table td:nth-child(9) {
  width: 250px;
}

.batch-copy-edit-table th:nth-child(10),
.batch-copy-edit-table td:nth-child(10) {
  width: 220px;
}

.batch-copy-panel .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: var(--space-4) calc(var(--space-5) * -1) calc(var(--space-5) * -1);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
  background: var(--panel);
}

@media (max-width: 760px) {
  .modal-panel.batch-copy-panel {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: var(--modal-backdrop);
}

.modal-panel {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 20px 56px rgba(17, 27, 37, 0.2);
  padding: var(--space-5);
}

.pricing-audit-modal .modal-panel {
  width: min(860px, 100%);
}

.recharge-modal .recharge-modal-panel {
  width: min(740px, calc(100vw - 32px));
  max-height: 92vh;
  overflow: auto;
}

.recharge-modal .modal-head {
  margin-bottom: var(--space-5);
}

.recharge-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.recharge-form-grid label {
  display: grid;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-table);
  font-weight: 800;
  min-width: 0;
}

.recharge-form-grid .wide {
  grid-column: 1 / -1;
}

.recharge-form-grid :is(.control, .filter-combo) {
  width: 100%;
}

.recharge-form-grid :is(.control, .filter-combo .control) {
  min-height: 42px;
}

.recharge-channel-fieldset {
  min-width: 0;
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.recharge-channel-fieldset legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.recharge-channel-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.recharge-channel-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.recharge-channel-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recharge-channel-other[hidden] {
  display: none;
}

.recharge-modal .modal-actions {
  gap: var(--space-3);
}

.recharge-analysis-panel {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-raised);
}

.recharge-page > .recharge-analysis-panel {
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.recharge-page .recharge-analysis-panel .section-head {
  min-height: 0;
  padding: 0 0 var(--space-2);
  border-bottom: 0;
  background: transparent;
}

.recharge-page .recharge-analysis-card {
  gap: 3px;
  padding: var(--space-2) var(--space-3);
}

.recharge-page .recharge-analysis-card strong {
  font-size: 1.06rem;
}

.recharge-page .recharge-analysis-breakdowns {
  gap: var(--space-2);
}

.recharge-page .recharge-analysis-chip {
  padding: 4px 7px;
}

.recharge-analysis-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(116px, 1fr));
  gap: var(--space-3);
}

.recharge-analysis-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.recharge-analysis-card span {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 750;
}

.recharge-analysis-card strong {
  color: var(--ink-strong);
  font-family: var(--font-number);
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1.2;
}

.recharge-analysis-card.is-negative strong,
.negative-text {
  color: var(--manual-fg);
  font-weight: 900;
}

.recharge-analysis-card.is-negative {
  background: color-mix(in srgb, var(--manual-bg) 62%, var(--input-bg));
  border-color: color-mix(in srgb, var(--manual-fg) 24%, var(--line));
}

.recharge-analysis-breakdowns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.recharge-analysis-split {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.recharge-analysis-split-title {
  color: var(--ink-strong);
  font-size: var(--text-caption);
  font-weight: 850;
}

.recharge-analysis-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.recharge-analysis-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--text-caption);
}

.recharge-analysis-chip b,
.recharge-analysis-chip span,
.recharge-analysis-chip em {
  min-width: 0;
}

.recharge-analysis-chip em {
  color: var(--muted);
  font-style: normal;
}

@media (max-width: 980px) {
  .recharge-analysis-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recharge-analysis-breakdowns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .recharge-analysis-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.data-center-section {
  margin-bottom: 18px;
}

.data-import-grid,
.data-confirm-grid {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.data-backup-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.data-backup-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.data-backup-subcard {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-hover);
}

.data-backup-primary-grid,
.data-backup-retention-grid {
  display: grid;
  gap: 12px;
  align-items: end;
}

.data-backup-primary-grid {
  grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(150px, 1fr));
}

.data-backup-retention-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.data-backup-checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.data-backup-checkbox-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

.data-backup-checkbox-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-file-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 40px;
}

.data-import-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.data-import-file-trigger {
  flex: 0 0 auto;
  min-height: 40px;
}

.data-import-file-name {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-import-file-name.has-file {
  color: var(--ink);
}

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

.baidu-status-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.baidu-status-grid span,
.data-preflight-record {
  color: var(--muted);
}

.baidu-plaintext-warning {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.baidu-plaintext-ack {
  align-items: flex-start;
}

.baidu-settings-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.baidu-settings-schedule {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.baidu-test-step-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.baidu-test-step-list > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.data-export-log-option {
  margin-left: auto;
}

.remote-pair-status {
  display: grid;
  gap: 3px;
  min-width: 150px;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--text-caption);
}

.remote-legacy-encrypted {
  display: inline-flex;
  margin-top: 4px;
  color: var(--warning);
  font-size: var(--text-caption);
  font-weight: 700;
}

.data-preflight-panel {
  margin-bottom: 18px;
}

.data-preflight-list,
.data-preflight-issue,
.baidu-guide-steps {
  display: grid;
  gap: 10px;
}

.data-preflight-issue {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.data-preflight-issue > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.data-preflight-detail-panel {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.data-preflight-detail-list,
.data-preflight-detail-records,
.data-preflight-detail-record {
  display: grid;
  gap: 12px;
}

.data-preflight-detail-issue,
.data-preflight-detail-record {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
}

.data-preflight-detail-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.data-preflight-detail-heading > div {
  display: grid;
  gap: 3px;
}

.data-preflight-detail-heading span,
.data-preflight-detail-record dt {
  color: var(--muted);
  font-size: var(--text-caption);
}

.data-preflight-detail-record dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
}

.data-preflight-detail-record dl > div {
  min-width: 0;
}

.data-preflight-detail-record dt,
.data-preflight-detail-record dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.data-preflight-detail-record .btn {
  justify-self: start;
}

.data-preflight-detail-state {
  min-height: 100px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.user-row.preflight-target td {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.user-row.preflight-target td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.preflight-message {
  white-space: pre-line;
}

.baidu-guide-panel {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.baidu-guide-steps section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-hover);
}

.baidu-guide-steps h3 {
  margin: 0 0 8px;
}

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

.copy-row :is(code, pre) {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.baidu-env-template {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface);
  white-space: pre-wrap;
}

.data-import-preview {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.data-count-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-count-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 12px;
}

.data-center-backup-table .backup-note-field {
  min-width: 150px;
}

.data-center-backup-table .backup-select-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-inline: 8px;
  text-align: center;
  vertical-align: middle;
}

.data-center-backup-table .backup-select-col input {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
}

.backup-batch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.backup-selected-count {
  color: var(--ink-strong);
  font-size: var(--text-ui);
}

.backup-selection-hint {
  color: var(--muted);
  font-size: var(--text-caption);
}

.backup-filename-cell,
.backup-failure-cell {
  max-width: 320px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.backup-failure-reason,
.backup-failure-actions,
.backup-delete-summary,
.backup-delete-result {
  display: grid;
  gap: 7px;
}

.backup-failure-reason > strong { color: var(--danger); }
.backup-failure-actions { grid-template-columns: repeat(2, max-content); }
.backup-failure-empty { color: var(--muted); }

.backup-delete-panel { width: min(560px, calc(100vw - 32px)); }
.backup-batch-delete-panel {
  width: min(1120px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  overflow: auto;
}

.backup-batch-confirm-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: var(--space-2);
}

.backup-batch-confirm-summary > div {
  display: grid;
  gap: 4px;
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.backup-batch-confirm-summary span {
  color: var(--muted);
  font-size: var(--text-caption);
}

.backup-batch-confirm-summary p {
  grid-column: 1 / -1;
  margin: var(--space-2) 0 0;
  color: var(--muted);
}

.backup-batch-result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.backup-batch-result-wrap {
  max-height: 420px;
  overflow: auto;
}

.backup-batch-result-table {
  width: max-content;
  min-width: 100%;
}

.backup-delete-summary > div,
.backup-delete-result > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: var(--space-2);
  min-width: 0;
}

.backup-delete-summary span,
.backup-delete-result dt { color: var(--muted); }

.backup-delete-summary strong,
.backup-delete-result dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .backup-failure-actions { grid-template-columns: minmax(0, 1fr); }
  .backup-delete-summary > div,
  .backup-delete-result > div { grid-template-columns: minmax(0, 1fr); }
  .backup-batch-confirm-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backup-batch-result-summary { align-items: flex-start; flex-direction: column; }
}

.data-center-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (max-width: 760px) {
  .data-import-grid,
  .data-confirm-grid,
  .data-backup-settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-backup-card-grid,
  .baidu-status-grid,
  .baidu-settings-group,
  .baidu-settings-schedule,
  .baidu-test-step-list,
  .data-backup-primary-grid,
  .data-backup-retention-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-file-picker {
    align-items: stretch;
    flex-direction: column;
  }

  .data-import-file-trigger,
  .data-import-file-name {
    width: 100%;
  }

  .data-preflight-detail-record dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .copy-row {
    align-items: stretch;
    flex-direction: column;
  }

  .data-import-grid .btn,
  .data-confirm-grid .btn {
    width: 100%;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .data-backup-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

/* Compact schedule-mode entity selectors keep color on the badge, not the cell. */
.course-table.lesson-table :is(.col-status, .col-grade, .col-subject) .custom-select-cell {
  display: inline-flex;
  width: auto;
  min-width: 0;
  max-width: 100%;
}

.course-table.lesson-table :is(.col-status, .col-grade, .col-subject) .custom-select-button {
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 24px;
  height: 24px;
  padding: 0 18px 0 0;
  border: 0 !important;
  border-radius: 999px;
  background: transparent !important;
  box-shadow: none !important;
  text-align: left;
}

.course-table.lesson-table :is(.col-status, .col-grade, .col-subject) .custom-select-value {
  display: inline-flex;
  flex: 0 1 auto;
  overflow: visible;
  text-align: left;
}

.course-table.lesson-table :is(.col-status, .col-grade, .col-subject) .custom-select-arrow {
  right: 0;
}

.course-table.lesson-table .col-room .custom-select.candidate-conflict .custom-select-button {
  box-shadow: inset 0 0 0 1px var(--danger) !important;
}

.course-table.lesson-table .col-room .custom-select.candidate-conflict .custom-select-value {
  color: var(--danger) !important;
}

.custom-select-option .entity-badge {
  pointer-events: none;
}

.custom-select-candidate-state {
  margin-left: 6px;
  color: var(--muted);
  font-size: var(--text-caption);
}

.custom-select-option.option-conflict .custom-select-candidate-state {
  color: var(--danger);
}

.lesson-date-shortcuts {
  width: auto;
  min-width: 0;
}

@media (max-width: 1320px) {
  .lesson-filter-top .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-filter-top .filter-summary {
    grid-column: 2;
  }

  .lesson-filter-top .filter-search {
    grid-column: 1;
  }

  .lesson-date-filter-group {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .lesson-filter-top .filter-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .lesson-date-filter-group,
  .lesson-filter-top .filter-search,
  .lesson-filter-top .filter-summary {
    grid-column: auto;
  }

  .lesson-date-filter-group {
    grid-template-columns: minmax(0, 1fr);
  }

  .lesson-filter-top .filter-summary {
    justify-self: end;
  }
}

.opening-balance-modal .opening-balance-modal-panel {
  width: min(640px, calc(100vw - 32px));
  max-height: 92vh;
  overflow: auto;
}

.opening-balance-modal .modal-head {
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.opening-balance-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.opening-balance-form-grid label {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-table);
  font-weight: 800;
}

.opening-balance-form-grid .wide {
  grid-column: 1 / -1;
}

.opening-balance-form-grid :is(.control, .filter-combo) {
  width: 100%;
}

.opening-balance-form-grid :is(.control, .filter-combo .control) {
  min-height: 42px;
}

.opening-balance-modal .modal-actions {
  justify-content: flex-end;
  gap: var(--space-3);
}

@media (max-width: 720px) {
  .opening-balance-form-grid {
    grid-template-columns: 1fr;
  }
}

.statement-panel {
  width: min(1180px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.statement-preview {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.statement-preview img {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.student-query-controls {
  position: relative;
  z-index: 20;
  overflow: visible;
  margin-bottom: var(--space-5);
}

.student-query-controls .filter-bar {
  margin-bottom: 0;
}

.student-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.base-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 720px) {
  .base-data-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.base-data-card {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
}

.base-data-card-head {
  margin-bottom: var(--space-3);
  padding: 0;
  border: 0;
  background: transparent;
}

.base-data-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.base-data-list-title {
  margin: var(--space-3) 0 var(--space-2);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.login-submit {
  min-height: 44px;
  justify-content: center;
}

.base-data-custom-list,
.base-data-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.base-data-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-ui);
  font-weight: 700;
}

.base-data-delete {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.base-data-delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.student-history-block {
  min-width: 0;
}

.small-title {
  margin-bottom: var(--space-3);
  font-size: var(--text-body);
}

.muted-tip {
  color: var(--muted);
  font-size: var(--text-caption);
  white-space: nowrap;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.modal-title {
  font-size: var(--text-body);
  font-weight: 800;
}

.modal-subtitle {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-table);
}

.delete-counts {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--section-head);
}

.delete-counts div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  font-variant-numeric: tabular-nums;
}

.confirm-label {
  display: grid;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-table);
  font-weight: 700;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-4);
}

.profile-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.profile-search {
  min-width: 240px;
}

.profile-table th,
.profile-table td {
  min-width: 108px;
}

.profile-table th.wide,
.profile-table td:has(.wide) {
  min-width: 220px;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.profile-form label {
  display: grid;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-table);
  font-weight: 800;
}

.profile-form-wide {
  grid-column: 1 / -1;
}

.current-grade-cell {
  font-weight: 850;
  color: var(--brand);
}

.profile-form .hidden {
  display: none;
}

.student-profile-main-row {
  cursor: pointer;
}

.student-profile-main-row :is(input, select, button) {
  cursor: auto;
}

.student-stage-conflict-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
}

.student-stage-conflict-banner > div,
.student-stage-conflict-banner > div > div,
.student-name-with-conflict,
.student-stage-conflict-record-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.student-stage-conflict-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-weight: 900;
}

.student-stage-conflict-chip,
.student-stage-conflict-marker {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 3px 7px;
  border: 1px solid var(--danger-border);
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 850;
  white-space: nowrap;
}

.student-stage-conflict-marker { cursor: pointer !important; }
.student-name-with-conflict { flex-wrap: wrap; }

.student-stage-conflict-panel {
  width: min(900px, calc(100vw - 32px));
  max-height: min(88vh, 820px);
  overflow: auto;
}

.student-stage-conflict-list,
.student-stage-conflict-record {
  display: grid;
  gap: var(--space-3);
}

.student-stage-conflict-record {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
}

.student-stage-conflict-record p,
.student-stage-conflict-record dl,
.student-stage-conflict-record dd { margin: 0; overflow-wrap: anywhere; }
.student-stage-conflict-record-head { justify-content: space-between; }

.student-stage-conflict-record dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px var(--space-3);
}

.student-stage-conflict-record dt { color: var(--muted); font-size: var(--text-caption); }
.student-stage-conflict-record .btn { justify-self: start; }

body.student-grade-stage-modal-open {
  overflow: hidden;
}

.student-grade-stage-modal {
  z-index: 540;
}

.student-grade-stage-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(860px, calc(100vw - 32px));
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: hidden;
}

.student-grade-stage-modal-head {
  margin: 0;
  padding: var(--space-5);
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}

.student-grade-stage-modal-body {
  min-height: 0;
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
}

.student-grade-stage-current {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--muted);
  font-size: var(--text-table);
  font-weight: 750;
}

.student-stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.student-stage-card {
  display: grid;
  grid-template-columns: minmax(62px, auto) minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
}

.student-stage-name {
  align-self: center;
  color: var(--ink-strong);
  font-weight: 900;
  text-align: center;
}

.student-stage-card label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.student-stage-card .control {
  width: 100%;
  min-width: 0;
}

.student-stage-card-conflict {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.student-grade-stage-field-conflict {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 14%, transparent);
}

.student-stage-field-error {
  grid-column: 1 / -1;
  color: var(--danger);
  font-size: var(--text-caption);
  font-weight: 750;
}

.student-grade-stage-modal-actions {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}

@media (max-width: 720px) {
  .student-stage-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .student-stage-card {
    grid-template-columns: minmax(58px, auto) minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .student-grade-stage-modal {
    padding: 12px;
  }

  .student-grade-stage-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .student-grade-stage-modal-head,
  .student-grade-stage-modal-body,
  .student-grade-stage-modal-actions {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  .student-stage-card {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .student-stage-name {
    text-align: left;
  }

  .student-stage-conflict-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .student-stage-conflict-banner > div > div,
  .student-stage-conflict-record-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .student-stage-conflict-record dl {
    grid-template-columns: minmax(0, 1fr);
  }
}

.operations-summary .metric-value {
  font-family: var(--font-number);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.staff-payroll-table th,
.staff-payroll-table td,
.expense-table th,
.expense-table td {
  min-width: 108px;
}

.warning-cell {
  color: var(--warning);
  background: var(--warning-bg);
  font-weight: 800;
}

.row-inactive td {
  background: var(--surface-hover);
  color: var(--muted);
}

.row-inactive .cell-input {
  color: var(--muted);
  background: var(--surface-hover);
  border-color: var(--line-soft);
}

.attendance-summary-grid {
  margin-bottom: var(--space-4);
}

.attendance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: var(--space-4);
  align-items: start;
}

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

.attendance-head {
  align-items: flex-start;
}

.attendance-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--line-soft);
}

.attendance-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.attendance-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.attendance-legend-item span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--muted);
}

.attendance-gap {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--text-table);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.attendance-quickbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface-hover) 54%, transparent);
}

.attendance-quick-title {
  margin-right: var(--space-1);
  color: var(--ink-strong);
  font-size: var(--text-table);
  font-weight: 900;
}

.attendance-quickbar .control {
  width: auto;
  min-width: 128px;
  height: 38px;
}

.attendance-quickbar .btn {
  height: 38px;
  white-space: nowrap;
}

.attendance-wrap {
  max-height: calc(100vh - 330px);
}

.staff-attendance-table {
  min-width: 1280px;
}

.staff-attendance-table th,
.staff-attendance-table td {
  min-width: 42px;
  padding: 0;
  text-align: center;
}

.staff-attendance-table th.sticky-name,
.staff-attendance-table td.sticky-name {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 132px;
  background: var(--panel-raised);
}

.staff-attendance-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}

.staff-attendance-table th span,
.staff-attendance-table th small {
  display: block;
  line-height: 1.2;
}

.staff-attendance-table th small,
.staff-attendance-table td.sticky-name span {
  color: var(--muted);
  font-size: 0.72rem;
}

.attendance-cell {
  position: relative;
  height: 38px;
}

.attendance-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.attendance-label {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  font-weight: 800;
  color: var(--muted);
}

.status-涓婄彮 + .attendance-label {
  color: var(--success);
  background: var(--success-bg);
}

.attendance-legend-item.status-涓婄彮 span {
  color: var(--success);
  background: var(--success-bg);
}

.status-浼戞伅 + .attendance-label,
.status-璋冧紤 + .attendance-label {
  color: var(--neutral-chip-fg);
  background: var(--neutral-chip-bg);
}

.attendance-legend-item.status-浼戞伅 span,
.attendance-legend-item.status-璋冧紤 span {
  color: var(--neutral-chip-fg);
  background: var(--neutral-chip-bg);
}

.status-璇峰亣 + .attendance-label,
.status-鐥呭亣 + .attendance-label,
.status-浜嬪亣 + .attendance-label,
.status-鏃峰伐 + .attendance-label {
  color: var(--danger);
  background: var(--danger-bg);
}

.attendance-legend-item.status-璇峰亣 span,
.attendance-legend-item.status-鐥呭亣 span,
.attendance-legend-item.status-浜嬪亣 span,
.attendance-legend-item.status-鏃峰伐 span {
  color: var(--danger);
  background: var(--danger-bg);
}

.status-鍗婂ぉ + .attendance-label,
.status-鍔犵彮 + .attendance-label {
  color: var(--warning);
  background: var(--warning-bg);
}

.attendance-legend-item.status-鍗婂ぉ span,
.attendance-legend-item.status-鍔犵彮 span {
  color: var(--warning);
  background: var(--warning-bg);
}

.attendance-note-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.attendance-side {
  position: sticky;
  top: var(--space-4);
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
}

.attendance-side-list {
  display: grid;
  gap: var(--space-2);
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 2px;
}

.attendance-side-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.attendance-side-row div:first-child {
  display: grid;
  min-width: 0;
}

.attendance-side-row strong,
.attendance-side-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-side-row span,
.attendance-side-numbers span {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.attendance-side-numbers {
  display: grid;
  justify-items: end;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.attendance-side-numbers b {
  color: var(--text);
  font-family: var(--font-number);
  font-size: 1rem;
}

@media (max-width: 1180px) {
  .attendance-layout {
    grid-template-columns: 1fr;
  }

  .attendance-side {
    position: static;
  }

  .attendance-side-list {
    max-height: 280px;
  }
}

.inactive-tag {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-2);
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.expense-head {
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.expense-total {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-table);
  font-variant-numeric: tabular-nums;
}

.expense-filter-bar {
  flex-wrap: wrap;
  margin: var(--space-4);
}

.expense-filter-bar label {
  display: inline-grid;
  gap: var(--space-1);
}

.expense-bar-wrap {
  display: grid;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-4);
}

.expense-bar {
  display: flex;
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.expense-bar.empty-bar {
  background: var(--line-soft);
}

.expense-bar-segment {
  min-width: 2px;
}

.expense-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.control {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--ink);
  padding: 8px 12px;
  min-height: 38px;
  font-size: var(--text-ui);
  line-height: 1.35;
}

select.control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  font-weight: 700;
}

.control:hover {
  border-color: var(--brand-border);
  background-color: var(--surface-hover);
}

.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip-path: inset(50%) !important;
}

.custom-select {
  position: relative;
  display: inline-block;
  min-width: 96px;
  max-width: 100%;
  color: var(--ink);
  vertical-align: middle;
}

.custom-select-control {
  min-width: 136px;
}

.custom-select-cell {
  width: 100%;
}

.custom-select-button {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-raised), var(--input-bg));
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-ui);
  font-weight: 750;
  line-height: 1.35;
  padding: 8px 34px 8px 12px;
  text-align: left;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.custom-select-button:hover {
  border-color: var(--brand-border);
  background: var(--surface-hover);
}

.custom-select-button:focus-visible,
.custom-select.open .custom-select-button {
  outline: 0;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--ring);
}

.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  position: absolute;
  right: 11px;
  top: 50%;
  color: var(--muted);
  font-size: 0;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-53%);
  transition: transform 140ms var(--ease-out), color 140ms var(--ease-out);
}

.custom-select-arrow::before {
  content: "⌄";
  font-size: 16px;
}

.custom-select.open .custom-select-arrow {
  color: var(--brand-dark);
  transform: translateY(-52%);
}

.custom-select.open .custom-select-arrow::before {
  content: "⌕";
  font-size: 15px;
}

.custom-select-menu {
  position: fixed;
  z-index: 600;
  top: 0;
  left: 0;
  display: none;
  min-width: 100%;
  width: max-content;
  max-width: min(320px, calc(100vw - 48px));
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: 0 18px 42px rgba(17, 27, 37, 0.16), 0 2px 8px rgba(17, 27, 37, 0.08);
  overscroll-behavior: contain;
}

.custom-select.open .custom-select-menu,
.custom-select-menu.open {
  display: grid;
  gap: 2px;
  animation: surface-enter 120ms var(--ease-out);
}

.custom-select-search {
  position: sticky;
  top: -6px;
  z-index: 1;
  display: flex;
  gap: 4px;
  padding: 2px 0 6px;
  background: var(--panel-raised);
}

.custom-select-search-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-ui);
  padding: 5px 8px;
}

.custom-select-search-input:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.custom-select-search-clear {
  width: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.custom-select-search-clear:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.custom-select-result-count {
  position: sticky;
  top: 34px;
  z-index: 1;
  padding: 3px 8px 5px;
  background: var(--panel-raised);
  color: var(--muted);
  font-size: var(--text-caption);
  pointer-events: none;
}

.custom-select-empty {
  padding: 8px 10px;
  color: var(--muted);
  font-size: var(--text-ui);
}

.custom-select-option {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-ui);
  font-weight: 720;
  line-height: 1.35;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  outline: 0;
  background: var(--surface-hover);
  color: var(--ink-strong);
}

.custom-select-option.selected {
  background: var(--surface-hover);
  color: var(--ink-strong);
}

/* 冲突语义来自候选数据属性，不能被通用 hover / selected 文本色覆盖。 */
.custom-select-menu .custom-select-option.option-conflict,
.custom-select-menu .custom-select-option.option-conflict:hover,
.custom-select-menu .custom-select-option.option-conflict:active,
.custom-select-menu .custom-select-option.option-conflict:focus,
.custom-select-menu .custom-select-option.option-conflict:focus-visible,
.custom-select-menu .custom-select-option.option-conflict.selected,
.custom-select-menu .custom-select-option.option-conflict.is-active,
.custom-select-menu .custom-select-option.option-conflict[aria-selected="true"] {
  color: var(--danger);
}

.custom-select-option:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.55;
}

.custom-select-cell .custom-select-button {
  min-height: 40px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 0 0 1px rgba(212, 226, 227, 0.58);
  font-size: var(--text-table);
  font-weight: 650;
  justify-content: center;
  padding: 8px 30px 8px 10px;
  text-align: center;
}

.custom-select-cell .custom-select-value {
  flex: 1;
  text-align: center;
}

.custom-select-status .custom-select-button {
  justify-content: center;
  border-radius: 6px;
  font-weight: 400;
  box-shadow: none;
}

.custom-select-status.done .custom-select-button {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}

.custom-select-status.pending .custom-select-button {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info);
}

.custom-select-status.leave .custom-select-button {
  background: var(--neutral-chip-bg);
  color: var(--neutral-chip-fg);
  border-color: var(--neutral-chip-border);
}

.custom-select-status.trial .custom-select-button {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: var(--brand-border);
}

.custom-select-status.exam .custom-select-button {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning);
}

.custom-select-status.unpaid .custom-select-button {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* Profile and account statuses read as compact labels until the shared
   searchable page-level selector is opened. */
.custom-select-inline-status {
  width: auto;
  min-width: 0;
  max-width: 100%;
}

.custom-select-inline-status .custom-select-button,
.custom-select-inline-status .custom-select-button:hover {
  width: auto;
  min-width: 0;
  min-height: 26px;
  margin: 0 auto;
  padding: 1px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.custom-select-inline-status .custom-select-value {
  flex: 0 1 auto;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.custom-select-inline-status .custom-select-arrow {
  display: none;
}

.custom-select-inline-status .status-badge {
  min-height: 22px;
  padding: 2px 8px;
}

.custom-select-inline-status .custom-select-button:disabled {
  cursor: default;
  opacity: 1;
}

.filter-field .custom-select-control {
  min-width: 136px;
}

.expense-filter-bar .custom-select-control,
.filter-bar.compact .custom-select-control {
  min-width: 136px;
}

:root[data-theme="dark"] .cell-select {
  background-color: rgba(238, 244, 251, 0.045);
  box-shadow: inset 0 0 0 1px rgba(37, 49, 66, 0.82);
}

:root[data-theme="dark"] .custom-select-cell .custom-select-button {
  background: rgba(238, 244, 251, 0.045);
  box-shadow: inset 0 0 0 1px rgba(37, 49, 66, 0.82);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .cell-select {
    background-color: rgba(238, 244, 251, 0.045);
    box-shadow: inset 0 0 0 1px rgba(37, 49, 66, 0.82);
  }

  :root[data-theme="system"] .custom-select-cell .custom-select-button {
    background: rgba(238, 244, 251, 0.045);
    box-shadow: inset 0 0 0 1px rgba(37, 49, 66, 0.82);
  }
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.schedule-conflict-panel {
  margin-bottom: var(--space-5);
  border-left: 4px solid var(--line);
}

.schedule-conflict-panel.has-conflict {
  border-left-color: var(--danger);
}

.conflict-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.conflict-counts span {
  min-width: 68px;
  padding: 5px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  color: var(--muted);
  font-size: var(--text-caption);
  text-align: center;
}

.conflict-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-4);
}

.conflict-options .history-toggle {
  margin: 0;
}

.conflict-list {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
}

.conflict-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
}

.conflict-main {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.conflict-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.conflict-heading strong,
.conflict-lesson-line strong {
  color: var(--ink-strong);
  font-family: var(--font-number);
  font-weight: 650;
}

.conflict-message,
.conflict-more {
  min-width: 0;
  color: var(--muted);
  white-space: normal;
}

.conflict-focus {
  align-self: start;
  white-space: nowrap;
}

.conflict-lessons {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--space-2);
}

.conflict-lesson-line {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(181, 71, 8, 0.18);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
}

.conflict-lesson-line span {
  min-width: 0;
  color: var(--muted);
  white-space: normal;
}

.conflict-more {
  padding: 0 var(--space-1);
  font-size: var(--text-caption);
}

.lesson-conflict-btn.conflict-ok,
.lesson-conflict-btn.conflict-ok:disabled,
.lesson-conflict-btn.conflict-ok:disabled:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel-raised) 88%, var(--surface-hover));
  color: var(--muted);
  opacity: 0.94;
  cursor: not-allowed;
}

.lesson-conflict-btn.conflict-found {
  border-color: var(--danger-border);
  background: var(--danger);
  color: var(--primary-ink);
}

.lesson-conflict-btn.conflict-found:hover {
  background: color-mix(in srgb, var(--danger) 88%, #000);
  border-color: color-mix(in srgb, var(--danger) 78%, #000);
}

.lesson-conflict-panel {
  width: min(980px, calc(100vw - 32px));
  max-height: min(84vh, 820px);
  overflow: auto;
}

body.lesson-conflict-modal-open { overflow: hidden; }

.lesson-conflict-modal { z-index: 500; }

.lesson-conflict-edit-modal { z-index: 520; }

.lesson-conflict-modal .modal-panel,
.lesson-conflict-edit-modal .modal-panel { pointer-events: auto; }

.lesson-conflict-edit-panel {
  width: min(860px, calc(100vw - 32px));
  max-height: min(88vh, 860px);
  overflow: auto;
}

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

.conflict-edit-student-field { grid-column: 1 / -1; }

.conflict-edit-student-field .multi-select { width: 100%; }

.conflict-edit-date-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.conflict-edit-date-control :is(input[type="date"], .custom-date-input) {
  width: 100%;
  min-width: 0;
}

.conflict-edit-weekday {
  min-width: 36px;
  color: var(--muted);
  font-size: var(--text-caption);
  text-align: center;
}

.conflict-edit-student-field .schedule-student-popover,
.conflict-edit-student-field .lesson-schedule-student-field {
  width: 100%;
}

.conflict-lesson-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-2);
}

@media (max-width: 720px) {
  .conflict-edit-form { grid-template-columns: 1fr; }
}

.lesson-conflict-panel .conflict-options {
  padding: 0 0 var(--space-3);
}

.lesson-conflict-counts {
  justify-content: flex-start;
  margin-bottom: var(--space-3);
}

.lesson-conflict-list {
  padding: 0;
}

.conflict-lesson-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px 10px;
  padding: 9px 10px;
  border: 1px solid rgba(181, 71, 8, 0.18);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  color: var(--text);
  font-size: var(--text-caption);
  line-height: 1.35;
}

.conflict-lesson-detail span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.conflict-lesson-detail b {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.focus-lesson-panel {
  margin-bottom: var(--space-5);
  border-left: 4px solid var(--warning);
  background: var(--warning-bg);
}

.focus-lesson-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.focus-lesson-body strong {
  display: block;
  color: var(--ink-strong);
  font-size: var(--text-body);
  line-height: 1.35;
}

.focus-lesson-body span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.45;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-border);
  border-radius: var(--radius);
  min-height: 92px;
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric:hover,
.finance-kpi:hover,
.band:hover {
  border-color: var(--hover-border);
}

.summary-grid .metric:nth-child(1) {
  border-top-color: var(--info);
}

.summary-grid .metric:nth-child(2) {
  border-top-color: var(--success);
}

.summary-grid .metric:nth-child(3) {
  border-top-color: var(--brand);
}

.summary-grid .metric:nth-child(4) {
  border-top-color: var(--warning);
}

.metric-label {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.35;
}

.metric-value {
  margin-top: 10px;
  font-size: var(--text-number);
  line-height: 1.15;
  font-weight: 600;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--ink);
}

.metric-value.small {
  font-size: var(--text-body);
  line-height: var(--leading-ui);
  white-space: normal;
}

.summary-grid .metric:nth-child(1) .metric-value {
  color: var(--info);
}

.summary-grid .metric:nth-child(2) .metric-value {
  color: var(--success);
}

.summary-grid .metric:nth-child(3) .metric-value {
  color: var(--brand-dark);
}

.summary-grid .metric:nth-child(4) .metric-value {
  color: var(--warning);
}

.finance-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.finance-command-panel {
  margin-bottom: var(--space-5);
}

.finance-notice-list {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.finance-notice {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  background: var(--warning-bg);
  color: var(--warning);
}

.finance-notice strong {
  color: var(--ink-strong);
}

.finance-command-main {
  border: 1px solid rgba(169, 186, 199, 0.28);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: 0 18px 42px rgba(15, 35, 55, 0.08);
}

.finance-command-main {
  min-height: 168px;
  padding: var(--space-6);
  display: grid;
  align-content: center;
  border-left: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(23, 92, 211, 0.05)),
    var(--panel-raised);
}

.finance-command-main.negative {
  background:
    linear-gradient(135deg, rgba(180, 35, 24, 0.11), rgba(245, 158, 11, 0.05)),
    var(--panel-raised);
}

:root[data-theme="dark"] .finance-command-main {
  border-color: rgba(116, 128, 148, 0.18);
  background:
    linear-gradient(135deg, rgba(47, 177, 132, 0.08), rgba(47, 111, 211, 0.04)),
    var(--panel-raised);
  box-shadow: none;
}

:root[data-theme="dark"] .finance-command-main.negative {
  background:
    linear-gradient(135deg, rgba(208, 100, 120, 0.08), rgba(201, 144, 46, 0.04)),
    var(--panel-raised);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .finance-command-main {
    border-color: rgba(116, 128, 148, 0.18);
    background:
      linear-gradient(135deg, rgba(47, 177, 132, 0.08), rgba(47, 111, 211, 0.04)),
      var(--panel-raised);
    box-shadow: none;
  }

  :root[data-theme="system"] .finance-command-main.negative {
    background:
      linear-gradient(135deg, rgba(208, 100, 120, 0.08), rgba(201, 144, 46, 0.04)),
      var(--panel-raised);
  }
}

.finance-command-main span {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.finance-command-main strong {
  margin-top: var(--space-2);
  color: var(--ink-strong);
  font-family: var(--font-number);
  font-size: clamp(2rem, 4vw, 3.75rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.finance-command-main.positive strong {
  color: var(--success);
}

.finance-command-main.negative strong {
  color: var(--danger);
}

.finance-command-main small {
  margin-top: var(--space-3);
}

.finance-kpi::after {
  content: "";
  position: absolute;
  left: var(--space-5);
  right: var(--space-5);
  bottom: var(--space-4);
  height: 3px;
  border-radius: 999px;
  background: var(--line-soft);
}

.finance-kpi::before {
  content: "";
  position: absolute;
  left: var(--space-5);
  bottom: var(--space-4);
  z-index: 1;
  width: 68%;
  height: 3px;
  border-radius: 999px;
  background: var(--brand);
}

.finance-kpi {
  background: var(--panel);
  border: 1px solid rgba(169, 186, 199, 0.28);
  border-radius: var(--radius);
  min-height: 126px;
  min-width: 0;
  padding: var(--space-5);
  padding-bottom: var(--space-6);
  box-shadow: 0 16px 34px rgba(15, 35, 55, 0.07);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.finance-kpi:nth-child(1) {
  --brand: var(--success);
}

.finance-kpi:nth-child(2) {
  --brand: var(--warning);
}

.finance-kpi:nth-child(3) {
  --brand: var(--info);
}

.finance-kpi:nth-child(4) {
  --brand: var(--brand-dark);
}

.finance-kpi:nth-child(5) {
  --brand: var(--danger);
}

.finance-kpi:nth-child(6) {
  background: var(--panel);
  --brand: var(--muted);
}

.finance-kpi-value {
  margin-top: 8px;
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 650;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

.finance-kpi:nth-child(1) .finance-kpi-value {
  color: var(--success);
}

.finance-kpi:nth-child(2) .finance-kpi-value {
  color: var(--warning);
}

.finance-kpi:nth-child(3) .finance-kpi-value {
  color: var(--info);
}

.finance-kpi:nth-child(4) .finance-kpi-value {
  color: var(--brand-dark);
}

.finance-kpi:nth-child(5) .finance-kpi-value {
  color: var(--danger);
}

.finance-kpi:nth-child(6) .finance-kpi-value {
  color: var(--ink);
}

.kpi-subtitle {
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-caption);
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-kpi .metric-label,
.finance-kpi .mom {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-kpi .metric-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0;
}

.mom {
  margin-top: 8px;
  font-size: var(--text-caption);
  font-weight: 800;
  line-height: 1.35;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.mom.up {
  color: var(--success);
}

.mom.down {
  color: var(--danger);
}

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

.finance-range-panel {
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-color: rgba(169, 186, 199, 0.28);
  background: var(--panel-raised);
  box-shadow: 0 12px 28px rgba(15, 35, 55, 0.06);
}

.finance-range-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-3);
}

.finance-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.finance-preset.active {
  color: var(--brand-dark);
  border-color: var(--brand-border);
  background: var(--brand-soft);
}

.finance-visual-grid,
.finance-grade-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(360px, 0.78fr);
  gap: var(--space-5);
  margin-bottom: var(--space-5);
  align-items: start;
}

.finance-composition-panel,
.finance-stack-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-content: start;
  padding: var(--space-4);
}

.composition-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel-raised);
  border: 1px solid rgba(169, 186, 199, 0.22);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.composition-title {
  color: var(--ink-strong);
  font-size: 0.9375rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: var(--space-3);
}

.composition-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
  min-height: 150px;
}

.composition-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  color: var(--muted);
  font-size: var(--text-ui);
}

.finance-composition-panel .composition-card {
  min-height: 218px;
}

.finance-subject-donut-panel {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
}

.finance-subject-donut-panel .composition-card {
  flex: 0 1 auto;
}

.finance-subject-donut-panel .composition-body {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: var(--space-3);
}

.finance-subject-donut-panel .donut-svg {
  width: 150px;
  height: 150px;
}

.finance-subject-donut-panel .donut-legend {
  width: 100%;
}

.finance-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-5);
  align-items: start;
}

.finance-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.finance-panel .table-wrap {
  flex: 0 1 auto;
  min-height: 0;
}

.finance-table {
  height: auto;
}

.finance-chart-panel {
  display: flex;
  flex-direction: column;
}

.finance-chart-panel div[id] {
  flex: 1;
}

.finance-trend-chart {
  width: 100%;
  min-height: 340px;
  padding: 0 var(--space-3);
}

.grade-trend-chart {
  min-height: 360px;
}
.donut-svg {
  width: 132px;
  height: 132px;
  display: block;
  overflow: visible;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.donut-segment {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

.donut-total-label {
  fill: var(--muted);
  font-size: 0.6875rem;
  font-weight: 750;
}

.donut-total-value {
  fill: var(--ink-strong);
  font-size: 0.875rem;
  font-weight: 750;
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.donut-legend li {
  display: grid;
  grid-template-columns: 10px minmax(72px, 1fr) auto 48px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.donut-key {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.donut-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.donut-value,
.donut-pct {
  color: var(--ink-strong);
  font-family: var(--font-number);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

.donut-pct {
  color: var(--muted);
  text-align: right;
}

.finance-chart-panel {
  margin-top: 0;
  padding-bottom: var(--space-4);
}

.trend-svg {
  max-width: 1040px;
  margin: 0 auto;
  padding: 4px var(--space-4) var(--space-3);
}

.trend-svg text {
  font-size: 11px;
}

.trend-svg .trend-tick {
  font-size: 11px;
  fill: var(--muted);
  opacity: 0.82;
}

.trend-svg .trend-month {
  font-size: 12px;
  fill: var(--muted);
  font-weight: 700;
}

.trend-svg .trend-label {
  font-size: 11px;
  fill: var(--ink-strong);
  font-weight: 800;
}

.trend-svg .trend-axis {
  stroke: var(--line);
  stroke-width: 1;
  opacity: 0.82;
}

.trend-svg .trend-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
  stroke-dasharray: 3 7;
  opacity: 0.9;
}

.trend-profit-area {
  fill: url(#trendArea);
}

.trend-profit-line,
.trend-rate-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-profit-line {
  stroke: var(--brand);
  stroke-width: 2.8;
  filter: drop-shadow(0 4px 8px rgba(15, 118, 110, 0.12));
}

.trend-rate-line {
  stroke: var(--accent);
  stroke-width: 2.3;
  opacity: 0.92;
}

.trend-profit-point {
  fill: var(--brand);
  stroke: var(--panel-raised);
  stroke-width: 2.4;
}

.trend-rate-point {
  fill: var(--panel-raised);
  stroke: var(--accent);
  stroke-width: 2.2;
}

.trend-legend-profit {
  fill: rgba(15, 118, 110, 0.12);
  stroke: var(--brand);
  stroke-width: 2;
}

.trend-legend-rate {
  fill: rgba(23, 92, 211, 0.08);
  stroke: var(--accent);
  stroke-width: 2;
}

.trend-svg .trend-legend text {
  font-size: 12px;
  fill: var(--muted);
  font-weight: 750;
}

.trend-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--muted);
}

.finance-two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: var(--space-5);
}

.finance-visual-grid > .band,
.finance-grade-grid > .band,
.finance-two > .band,
.finance-panels > .band {
  border-color: rgba(169, 186, 199, 0.28);
  background: var(--panel-raised);
  box-shadow: 0 18px 42px rgba(15, 35, 55, 0.07);
}

.finance-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-5);
  align-items: start;
}

.finance-panels-two {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.finance-panel table th,
.finance-panel table td {
  min-width: 78px;
}

.current-month-row td {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}

.current-month-row:hover td {
  background: var(--brand-soft);
}

.student-history-panel {
  margin-bottom: var(--space-5);
}

tr.risk-low td {
  background: var(--warning-bg);
  color: var(--warning);
}

tr.risk-low:hover td {
  background: var(--risk-low-bg);
}

tr.risk-unpaid td {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

tr.risk-debt td {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

tr.risk-unpaid:hover td {
  background: var(--risk-unpaid-bg);
}

tr.risk-debt:hover td {
  background: var(--risk-unpaid-bg);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.tab {
  position: relative;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  border-radius: var(--radius);
  min-height: 38px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: var(--text-ui);
  line-height: 1.35;
  overflow: hidden;
}

.tab::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: translateX(-10px) scaleX(0.4);
  transform-origin: left center;
}

.tab:hover {
  border-color: var(--brand-border);
  background: var(--surface-hover);
}

.tab.active {
  background: var(--brand);
  color: var(--primary-ink);
  border-color: var(--brand);
}

.tab.active::after {
  opacity: 0.72;
  transform: translateX(0) scaleX(1);
}

.tab.active:hover {
  background: var(--brand-dark);
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-size: var(--text-ui);
  line-height: var(--leading-body);
}

.loading {
  padding: 40px;
  color: var(--muted);
  font-size: var(--text-ui);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s var(--ease-out);
}

.right {
  text-align: right;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.cell-input.number,
.course-table :is(th, td):nth-child(12),
.teacher-detail-table :is(th, td):nth-child(12),
.teacher-detail-table :is(th, td):nth-child(13),
.fee-detail-table :is(th, td):nth-child(12),
.fee-detail-table :is(th, td):nth-child(13),
.student-summary-table :is(th, td):nth-child(n + 3),
.recharge-table :is(th, td):nth-child(4),
.recharge-table :is(th, td):nth-child(5),
.pricing-table :is(th, td):nth-child(3),
.student-pricing-create-table :is(th, td):nth-child(3),
.student-pricing-table :is(th, td):nth-child(5),
.teacher-salary-table :is(th, td):nth-child(n + 3):nth-child(-n + 8),
.finance-table :is(th, td):nth-child(n + 2),
.risk-table :is(th, td):nth-child(3) {
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.course-table :is(th, td):nth-child(2),
.course-table :is(th, td):nth-child(3),
.course-table :is(th, td):nth-child(4),
.course-table :is(th, td):nth-child(5),
.course-table :is(th, td):nth-child(6),
.course-table :is(th, td):nth-child(7),
.course-table :is(th, td):nth-child(8),
.course-table :is(th, td):nth-child(11),
.course-table :is(th, td):nth-child(13),
.course-table :is(th, td):nth-child(14),
.course-table :is(th, td):nth-child(15),
.fee-detail-table :is(th, td):nth-child(4),
.fee-detail-table :is(th, td):nth-child(5),
.fee-detail-table :is(th, td):nth-child(6),
.fee-detail-table :is(th, td):nth-child(7),
.fee-detail-table :is(th, td):nth-child(8),
.fee-detail-table :is(th, td):nth-child(9),
.fee-detail-table :is(th, td):nth-child(10),
.student-summary-table :is(th, td):nth-child(2),
.recharge-table :is(th, td):nth-child(2),
.recharge-table :is(th, td):nth-child(6),
.pricing-table :is(th, td):nth-child(1),
.pricing-table :is(th, td):nth-child(2),
.student-pricing-create-table :is(th, td):nth-child(2),
.student-pricing-create-table :is(th, td):nth-child(5),
.student-pricing-table :is(th, td):nth-child(2),
.student-pricing-table :is(th, td):nth-child(3),
.student-pricing-table :is(th, td):nth-child(6),
.teacher-salary-table :is(th, td):nth-child(2),
.top-students-table :is(th, td):nth-child(2),
.risk-table :is(th, td):nth-child(1) {
  text-align: center;
}

.course-table :is(th, td):nth-child(12),
.teacher-detail-table :is(th, td):nth-child(12),
.teacher-detail-table :is(th, td):nth-child(13),
.fee-detail-table :is(th, td):nth-child(12),
.fee-detail-table :is(th, td):nth-child(13),
.student-summary-table :is(th, td):nth-child(n + 3),
.recharge-table :is(th, td):nth-child(4),
.recharge-table :is(th, td):nth-child(5),
.pricing-table :is(th, td):nth-child(3),
.student-pricing-create-table :is(th, td):nth-child(3),
.student-pricing-table :is(th, td):nth-child(5),
.teacher-salary-table :is(th, td):nth-child(n + 3):nth-child(-n + 8),
.profit-table :is(th, td):nth-child(n + 2),
.balance-table :is(th, td):nth-child(2),
.top-students-table :is(th, td):nth-child(3),
.teacher-rank-table :is(th, td):nth-child(n + 2),
.risk-table :is(th, td):nth-child(3) {
  text-align: right;
}

.course-table :is(th, td):nth-child(1),
.course-table :is(th, td):nth-child(9),
.course-table :is(th, td):nth-child(10),
.fee-detail-table :is(th, td):nth-child(2),
.fee-detail-table :is(th, td):nth-child(3),
.fee-detail-table :is(th, td):nth-child(11),
.student-summary-table :is(th, td):nth-child(1),
.recharge-table :is(th, td):nth-child(1),
.recharge-table :is(th, td):nth-child(7),
.pricing-table :is(th, td):nth-child(4),
.pricing-table :is(th, td):nth-child(5),
.student-pricing-create-table :is(th, td):nth-child(1),
.student-pricing-create-table :is(th, td):nth-child(4),
.student-pricing-table :is(th, td):nth-child(1),
.student-pricing-table :is(th, td):nth-child(4),
.student-pricing-table :is(th, td):nth-child(7),
.student-pricing-table :is(th, td):nth-child(8),
.teacher-salary-table :is(th, td):nth-child(1),
.teacher-salary-table :is(th, td):nth-child(9),
.finance-table :is(th, td):nth-child(1),
.risk-table :is(th, td):nth-child(2),
.risk-table :is(th, td):nth-child(4) {
  text-align: left;
}

.table-wrap td.empty,
td.empty {
  height: 84px;
  padding: 28px;
  color: var(--muted);
  font-size: var(--text-ui);
  line-height: var(--leading-body);
  text-align: center;
  vertical-align: middle;
  white-space: normal;
}

.course-table td:nth-child(2) .cell-input,
.course-table td:nth-child(3) .cell-select,
.course-table td:nth-child(5) .cell-input,
.course-table td:nth-child(6) .cell-select,
.course-table td:nth-child(7) .cell-select,
.course-table td:nth-child(8) .cell-select,
.course-table td:nth-child(11) .cell-select,
.fee-detail-table td:nth-child(12) .cell-input,
.recharge-table td:nth-child(4) .cell-input,
.recharge-table td:nth-child(5) .cell-input,
.pricing-table td:nth-child(3) .cell-input,
.student-pricing-create-table td:nth-child(3) .cell-input,
.student-pricing-table td:nth-child(5) .cell-input,
.teacher-salary-table td:nth-child(n + 3):nth-child(-n + 7) .cell-input {
  text-align: inherit;
}

.recharge-table .cell-input.number,
.pricing-table .cell-input.number,
.student-pricing-table .cell-input.number,
.teacher-salary-table .cell-input.number,
.staff-table .cell-input.number,
.expense-table .cell-input.number {
  text-align: right;
}

.smooth-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable both-edges;
  contain: layout paint;
}

.uniform-table {
  table-layout: auto;
  width: max-content;
  min-width: 0;
}

.nowrap-table th,
.nowrap-table td {
  white-space: nowrap;
}

.uniform-table th {
  text-align: center !important;
}

.uniform-table td {
  text-align: center;
}

.uniform-table td.col-left,
.uniform-table td.wide,
.uniform-table td.text-left {
  text-align: left !important;
}

.uniform-table td.col-right,
.uniform-table td.right,
.uniform-table td:has(> .cell-input.number) {
  text-align: right !important;
}

.uniform-table .select-col,
.uniform-table .lesson-select-head,
.uniform-table .lesson-select-cell {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center !important;
}

.uniform-table .wide {
  min-width: 180px;
  max-width: 360px;
}

.course-table.lesson-table :is(td, th):nth-child(10),
.course-table.lesson-table :is(td, th):nth-child(11),
.course-table.week-detail-table :is(td, th):nth-child(9),
.course-table.week-detail-table :is(td, th):nth-child(10),
.fee-detail-table:not(.student-query-detail-table) :is(td, th):nth-child(11),
.student-query-detail-table :is(td, th):nth-child(10),
.recharge-table:not(.opening-balance-table) :is(td, th):nth-child(7),
.opening-balance-table :is(td, th):nth-child(7),
.student-pricing-table :is(td, th):nth-child(4),
.student-pricing-table :is(td, th):nth-child(7),
.teacher-salary-rule-table :is(td, th):nth-child(4),
.teacher-salary-rule-table :is(td, th):nth-child(7),
.profile-table :is(td, th).profile-notes-col,
.pricing-table :is(td, th):nth-child(5) {
  text-align: left !important;
}

.teacher-salary-rule-table :is(td, th):nth-child(5) {
  text-align: right !important;
}

.student-summary-table :is(td, th),
.student-summary-table .right,
.course-table.lesson-table :is(td, th):nth-child(12),
.course-table.lesson-table :is(td, th):nth-child(13),
.course-table.week-detail-table :is(td, th):last-child,
.fee-detail-table:not(.student-query-detail-table) :is(td, th):nth-child(12),
.fee-detail-table:not(.student-query-detail-table) :is(td, th):nth-child(13),
.student-query-detail-table :is(td, th):nth-child(11),
.recharge-table .cell-input.number,
.opening-balance-table .cell-input.number {
  text-align: center !important;
}

.course-table.lesson-table.uniform-table :is(td, th):not(:nth-child(10)):not(:nth-child(11)),
.course-table.week-detail-table.uniform-table :is(td, th):not(:nth-child(9)):not(:nth-child(10)),
.fee-detail-table.uniform-table:not(.student-query-detail-table) :is(td, th):not(:nth-child(11)),
.student-query-detail-table.uniform-table :is(td, th):not(:nth-child(10)),
.recharge-table.uniform-table:not(.opening-balance-table) :is(td, th):not(:nth-child(7)),
.opening-balance-table.uniform-table :is(td, th):not(:nth-child(7)),
.student-pricing-table.uniform-table :is(td, th):not(:nth-child(4)):not(:nth-child(7)),
.pricing-table.uniform-table :is(td, th):not(:nth-child(5)),
.teacher-salary-table.uniform-table :is(td, th):nth-child(1),
.profile-table.uniform-table :is(td, th):not(.profile-notes-col),
.operation-log-table.uniform-table th,
.audit-table.uniform-table th,
.user-table.uniform-table th {
  text-align: center !important;
}

.teacher-salary-rule-table.uniform-table :is(td, th):nth-child(1),
.teacher-salary-rule-table.uniform-table :is(td, th):nth-child(2),
.teacher-salary-rule-table.uniform-table :is(td, th):nth-child(3),
.teacher-salary-rule-table.uniform-table :is(td, th):nth-child(6) {
  text-align: center !important;
}

/* Table UI alignment pass: headers stay centered; body cells follow field semantics. */
table th,
.uniform-table th {
  text-align: center !important;
}

.uniform-table td {
  text-align: center;
}

.uniform-table td.right,
.uniform-table td.col-right,
.uniform-table td:has(> .cell-input.number) {
  text-align: right !important;
}

.course-table.lesson-table td:nth-child(10),
.course-table.lesson-table td:nth-child(11),
.course-table.week-detail-table td:nth-child(9),
.course-table.week-detail-table td:nth-child(10),
.fee-detail-table:not(.student-query-detail-table) td:nth-child(11),
.student-query-detail-table td:nth-child(10),
.recharge-table:not(.opening-balance-table) td:nth-child(7),
.opening-balance-table td:nth-child(7),
.student-pricing-table td:nth-child(4),
.student-pricing-table td:nth-child(7),
.teacher-salary-rule-table td:nth-child(4),
.teacher-salary-rule-table td:nth-child(7),
.teacher-detail-table td.teacher-detail-students,
.teacher-detail-table td.teacher-detail-notes,
.teacher-profile-table td.profile-notes-col,
.pricing-table td:nth-child(5) {
  text-align: left !important;
}

.course-table.lesson-table td:nth-child(12),
.course-table.lesson-table td:nth-child(13),
.course-table.week-detail-table td:last-child,
.student-summary-table td:nth-child(1),
.student-summary-table td:nth-child(2),
.student-summary-table td:nth-child(3),
.student-history-table td:nth-child(1),
.student-history-table td:nth-child(2),
.student-profile-table td,
.teacher-profile-table td:not(.profile-notes-col),
.teacher-salary-rule-table td:nth-child(1),
.teacher-salary-rule-table td:nth-child(2),
.teacher-salary-rule-table td:nth-child(3),
.teacher-salary-rule-table td:nth-child(6) {
  text-align: center !important;
}

.student-summary-table td:nth-child(n + 4),
.fee-detail-table:not(.student-query-detail-table) td:nth-child(12),
.fee-detail-table:not(.student-query-detail-table) td:nth-child(13),
.student-query-detail-table td:nth-child(11),
.student-history-table td:nth-child(n + 3),
.recharge-table:not(.opening-balance-table) td:nth-child(4),
.recharge-table:not(.opening-balance-table) td:nth-child(5),
.opening-balance-table td:nth-child(5),
.opening-balance-table td:nth-child(6),
.student-pricing-table td:nth-child(5),
.teacher-salary-rule-table td:nth-child(5),
.teacher-detail-table td:nth-child(12),
.teacher-detail-table td:nth-child(13),
.pricing-table td:nth-child(3) {
  text-align: right !important;
}

.course-table.lesson-table :is(th, td):nth-child(3),
.course-table.week-detail-table :is(th, td):nth-child(2),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(4),
.student-query-detail-table :is(th, td):nth-child(3),
.recharge-table:not(.opening-balance-table) :is(th, td):nth-child(6) {
  width: 116px;
  min-width: 116px;
  max-width: 116px;
}

.course-table.lesson-table :is(th, td):nth-child(6),
.course-table.week-detail-table :is(th, td):nth-child(5),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(7),
.student-query-detail-table :is(th, td):nth-child(6) {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
}

.course-table.lesson-table :is(th, td):nth-child(10) {
  min-width: 260px;
  max-width: 520px;
}

.course-table.week-detail-table :is(th, td):nth-child(9),
.student-pricing-table :is(th, td):nth-child(4),
.teacher-salary-rule-table :is(th, td):nth-child(4) {
  min-width: 240px;
  max-width: 460px;
}

.course-table.lesson-table :is(th, td):nth-child(11),
.course-table.week-detail-table :is(th, td):nth-child(10),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(11),
.student-query-detail-table :is(th, td):nth-child(10),
.recharge-table:not(.opening-balance-table) :is(th, td):nth-child(7),
.opening-balance-table :is(th, td):nth-child(7),
.student-pricing-table :is(th, td):nth-child(7),
.teacher-salary-rule-table :is(th, td):nth-child(7),
.teacher-profile-table :is(th, td).profile-notes-col,
.student-profile-table :is(th, td).profile-notes-col {
  min-width: 150px;
  max-width: 280px;
}

.teacher-detail-table :is(th, td).teacher-detail-students-head,
.teacher-detail-table :is(th, td).teacher-detail-students {
  min-width: 220px;
  max-width: 420px;
}

.teacher-detail-table :is(th, td).teacher-detail-notes-head,
.teacher-detail-table :is(th, td).teacher-detail-notes {
  min-width: 220px;
  max-width: 360px;
  white-space: normal;
}

.course-table.lesson-table :is(th, td):nth-child(12),
.course-table.lesson-table :is(th, td):nth-child(13),
.course-table.week-detail-table :is(th, td):last-child {
  width: 76px;
  min-width: 76px;
  max-width: 84px;
}

.recharge-table:not(.opening-balance-table) :is(th, td):nth-child(4),
.recharge-table:not(.opening-balance-table) :is(th, td):nth-child(5),
.opening-balance-table :is(th, td):nth-child(5),
.opening-balance-table :is(th, td):nth-child(6),
.student-pricing-table :is(th, td):nth-child(5),
.teacher-salary-rule-table :is(th, td):nth-child(5),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(12),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(13),
.student-query-detail-table :is(th, td):nth-child(11) {
  min-width: 112px;
  max-width: 132px;
}

.course-table.lesson-table :is(th, td):nth-child(4),
.course-table.week-detail-table :is(th, td):nth-child(3),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(5),
.student-query-detail-table :is(th, td):nth-child(4) {
  min-width: 84px;
  max-width: 104px;
}

.course-table.lesson-table.uniform-table thead th,
.course-table.week-detail-table.uniform-table thead th,
.fee-detail-table.uniform-table thead th,
.student-summary-table.uniform-table thead th,
.recharge-table.uniform-table thead th,
.student-history-table.uniform-table thead th,
.student-pricing-table.uniform-table thead th,
.profile-table.uniform-table thead th,
.teacher-salary-rule-table.uniform-table thead th,
.teacher-detail-table.uniform-table thead th,
.pricing-table.uniform-table thead th,
.teacher-salary-table.uniform-table thead th,
.operation-log-table.uniform-table thead th,
.audit-table.uniform-table thead th,
.user-table.uniform-table thead th {
  text-align: center !important;
}

.fee-detail-table.uniform-table thead th.note-head {
  text-align: center !important;
}

.fee-detail-table.uniform-table:not(.student-query-detail-table) td:nth-child(12),
.fee-detail-table.uniform-table:not(.student-query-detail-table) td:nth-child(13),
.student-query-detail-table.uniform-table td:nth-child(11),
.recharge-table.uniform-table:not(.opening-balance-table) td:nth-child(4),
.recharge-table.uniform-table:not(.opening-balance-table) td:nth-child(5),
.opening-balance-table.uniform-table td:nth-child(5),
.opening-balance-table.uniform-table td:nth-child(6),
.student-pricing-table.uniform-table td:nth-child(5),
.teacher-salary-rule-table.uniform-table td:nth-child(5),
.teacher-detail-table.uniform-table td:nth-child(12),
.teacher-detail-table.uniform-table td:nth-child(13),
.pricing-table.uniform-table td:nth-child(3) {
  text-align: right !important;
}

.profile-table.student-profile-table.uniform-table td.profile-notes-col {
  text-align: center !important;
}

.profile-table.teacher-profile-table.uniform-table td.profile-notes-col {
  text-align: left !important;
}

.student-profile-table .cell-input,
.student-profile-table .cell-select,
.teacher-profile-table td:not(.profile-notes-col) .cell-input,
.teacher-profile-table td:not(.profile-notes-col) .cell-select,
.course-table.lesson-table td:not(:nth-child(10)):not(:nth-child(11)) .cell-input,
.course-table.lesson-table td:not(:nth-child(10)):not(:nth-child(11)) .cell-select,
.recharge-table:not(.opening-balance-table) td:nth-child(6) .cell-input {
  text-align: inherit;
}

.student-profile-table th,
.student-profile-table td,
.teacher-profile-table th,
.teacher-profile-table td {
  height: 36px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.student-profile-table .cell-input,
.student-profile-table .cell-select,
.teacher-profile-table .cell-input,
.teacher-profile-table .cell-select {
  height: 32px;
  min-height: 32px;
  padding: 5px 8px;
  font-size: var(--text-table);
  font-weight: 400;
  line-height: 1.35;
}

.profile-table.student-profile-table.uniform-table th,
.profile-table.student-profile-table.uniform-table td,
.profile-table.teacher-profile-table.uniform-table th,
.profile-table.teacher-profile-table.uniform-table td {
  height: 36px;
  padding: 4px 8px;
  font-size: var(--text-table);
  line-height: 1.35;
  vertical-align: middle;
}

.profile-table.student-profile-table.uniform-table .profile-row > td,
.profile-table.teacher-profile-table.uniform-table .profile-row > td {
  height: 36px;
}

.profile-table.student-profile-table.uniform-table .cell-input,
.profile-table.student-profile-table.uniform-table .cell-select,
.profile-table.teacher-profile-table.uniform-table .cell-input,
.profile-table.teacher-profile-table.uniform-table .cell-select {
  height: 32px;
  min-height: 32px;
}

.profile-table.student-profile-table.uniform-table .btn,
.profile-table.teacher-profile-table.uniform-table .btn {
  min-height: 32px;
  height: 32px;
  padding: 5px 10px;
  font-size: var(--text-table);
  line-height: 1.2;
}

.profile-table.student-profile-table.uniform-table .select-col,
.profile-table.teacher-profile-table.uniform-table .select-col {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
}

.profile-table.student-profile-table.uniform-table input[type="checkbox"],
.profile-table.teacher-profile-table.uniform-table input[type="checkbox"] {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
}

.profile-table.student-profile-table.uniform-table {
  table-layout: fixed;
  width: max-content;
  min-width: 852px;
}

.student-profile-table col.student-profile-col-select { width: 38px; }
.student-profile-table col.student-profile-col-name { width: 88px; }
.student-profile-table col.student-profile-col-grade { width: 74px; }
.student-profile-table col.student-profile-col-guardian { width: 82px; }
.student-profile-table col.student-profile-col-phone { width: 104px; }
.student-profile-table col.student-profile-col-status { width: 78px; }
.student-profile-table col.student-profile-col-date { width: 104px; }
.student-profile-table col.student-profile-col-notes { width: 180px; }

.profile-table.student-profile-table.uniform-table th,
.profile-table.student-profile-table.uniform-table td {
  min-width: 0 !important;
  height: 32px;
  padding: 3px 6px;
  font-size: 0.78rem;
  line-height: 1.25;
}

.profile-table.student-profile-table.uniform-table .profile-row > td {
  height: 32px;
}

.profile-table.student-profile-table.uniform-table .select-col {
  width: 38px;
  min-width: 38px !important;
  max-width: 38px;
  padding-left: 3px;
  padding-right: 3px;
}

.profile-table.student-profile-table.uniform-table .cell-input,
.profile-table.student-profile-table.uniform-table .cell-select {
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.2;
}

.profile-table.student-profile-table.uniform-table .cell-select {
  padding-right: 24px;
  background-position: right 7px center;
}

.student-profile-table .student-name-cell {
  color: var(--ink-strong);
  font-weight: 700;
  text-align: center !important;
}

.student-profile-table .student-name-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-profile-table .current-grade-cell {
  padding: 3px 6px !important;
}

.student-profile-table .profile-notes-col .cell-input {
  text-align: left;
}

.teacher-profile-table td.profile-notes-col .cell-input,
.recharge-table:not(.opening-balance-table) td:nth-child(7) .cell-input,
.opening-balance-table td:nth-child(7) .cell-input,
.student-pricing-table td:nth-child(7) .cell-input,
.teacher-salary-rule-table td:nth-child(7) .cell-input {
  text-align: left;
}

.uniform-table .cell-input.number {
  text-align: right !important;
}

.teacher-travel-table td.currency-input-cell,
.teacher-travel-table td.right {
  text-align: right !important;
}

.teacher-travel-table .currency-input-wrap {
  min-width: 96px;
}

.class-group-table :is(th, td):nth-child(1),
.class-group-table :is(th, td):nth-child(2),
.class-group-table :is(th, td):nth-child(3) {
  text-align: center;
}

.class-group-table :is(th, td):nth-child(4),
.class-group-table :is(th, td):nth-child(5) {
  text-align: left;
}

.class-group-table .cell-input {
  min-width: 180px;
}

.lesson-table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  scrollbar-gutter: auto;
  contain: layout paint;
}

.course-table.lesson-table {
  width: max-content;
  min-width: 0;
  table-layout: auto;
}

.course-table.lesson-table :is(th, td) {
  box-sizing: border-box;
  min-width: 0;
  transition: none;
}

.course-table.lesson-table :is(.col-select, .lesson-select-head, .lesson-select-cell) {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
  text-align: center !important;
}

.course-table.lesson-table .lesson-select-cell {
  position: relative;
}

.course-table.lesson-table .lesson-warning-icon {
  position: absolute;
  top: 2px;
  right: 1px;
  width: 15px;
  height: 15px;
  margin-left: 0;
  font-size: 9px;
}

.course-table.lesson-table .col-teacher {
  width: 112px;
  min-width: 96px;
  max-width: 132px;
}

.course-table.lesson-table .col-serial {
  width: 62px;
  min-width: 58px;
  max-width: 68px;
  text-align: center !important;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
}

.course-table.lesson-table .col-date {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
}

.course-table.lesson-table .col-status {
  width: 86px;
  min-width: 78px;
  max-width: 96px;
}

.course-table.lesson-table .col-weekday {
  width: 62px;
  min-width: 58px;
  max-width: 72px;
}

.course-table.lesson-table .col-time {
  width: 112px;
  min-width: 108px;
  max-width: 118px;
}

.course-table.lesson-table .col-room,
.course-table.lesson-table .col-grade {
  width: 76px;
  min-width: 70px;
  max-width: 86px;
}

.course-table.lesson-table .col-subject {
  width: 86px;
  min-width: 76px;
  max-width: 96px;
}

.course-table.lesson-table .col-students {
  width: 300px;
  min-width: 220px;
  max-width: 360px;
  text-align: left !important;
}

.course-table.lesson-table .col-note {
  width: 170px;
  min-width: 120px;
  max-width: 220px;
  text-align: left !important;
}

.course-table.lesson-table .col-index {
  width: 76px;
  min-width: 72px;
  max-width: 82px;
  text-align: right !important;
}

/* 课程总表在“复选框 + 序号”结构下使用列类名覆盖历史 nth-child 规则。 */
.course-table.lesson-table :is(th, td).col-serial {
  width: 62px !important;
  min-width: 58px !important;
  max-width: 68px !important;
  text-align: center !important;
}

.course-table.lesson-table :is(th, td).col-teacher {
  width: 112px !important;
  min-width: 96px !important;
  max-width: 132px !important;
  text-align: left !important;
}

.course-table.lesson-table :is(th, td).col-date {
  width: 108px !important;
  min-width: 108px !important;
  max-width: 108px !important;
  text-align: center !important;
}

.course-table.lesson-table :is(th, td).col-status {
  width: 86px !important;
  min-width: 78px !important;
  max-width: 96px !important;
  text-align: center !important;
}

.course-table.lesson-table :is(th, td).col-weekday {
  width: 62px !important;
  min-width: 58px !important;
  max-width: 72px !important;
  text-align: center !important;
}

.course-table.lesson-table :is(th, td).col-time {
  width: 112px !important;
  min-width: 108px !important;
  max-width: 118px !important;
  text-align: center !important;
}

.course-table.lesson-table :is(th, td).col-room,
.course-table.lesson-table :is(th, td).col-grade {
  width: 76px !important;
  min-width: 70px !important;
  max-width: 86px !important;
  text-align: center !important;
}

.course-table.lesson-table :is(th, td).col-subject {
  width: 86px !important;
  min-width: 76px !important;
  max-width: 96px !important;
  text-align: center !important;
}

.course-table.lesson-table :is(th, td).col-students {
  width: 300px !important;
  min-width: 220px !important;
  max-width: 360px !important;
  text-align: left !important;
}

.course-table.lesson-table :is(th, td).col-note {
  width: 170px !important;
  min-width: 120px !important;
  max-width: 220px !important;
  text-align: left !important;
}

.course-table.lesson-table :is(th, td).col-index {
  width: 76px !important;
  min-width: 72px !important;
  max-width: 82px !important;
  text-align: right !important;
}

.course-table.lesson-table .lesson-cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-table.lesson-table .col-students .lesson-cell-text,
.course-table.lesson-table .col-note .lesson-cell-text {
  max-width: 100%;
}

.course-table.lesson-table .cell-input,
.course-table.lesson-table .cell-select,
.course-table.lesson-table .custom-select-cell,
.course-table.lesson-table .custom-select-cell .custom-select-button {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.course-table.lesson-table .cell-input,
.course-table.lesson-table .cell-select {
  height: 34px;
  padding: 6px 8px;
}

.course-table.lesson-table td.readonly,
.course-table.lesson-table td.text-cell {
  padding: 6px 8px;
}

.course-table.lesson-table .custom-select-cell .custom-select-button {
  min-height: 34px;
  padding: 6px 28px 6px 8px;
  box-shadow: none;
}

.course-table.lesson-table .col-time .custom-select-cell .custom-select-button,
.course-table.lesson-table .col-time .cell-input,
.course-table.lesson-table .col-time .lesson-cell-text {
  background: transparent;
  font-size: var(--text-table);
  font-weight: 400;
}

.course-table.lesson-table .col-date .lesson-cell-text,
.course-table.lesson-table .col-date .cell-input,
.course-table.lesson-table .col-date .custom-date-input {
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-table);
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
}

.course-table.lesson-table .col-status .custom-select-status .custom-select-button,
.course-table.lesson-table .col-status .status-select,
.course-table.lesson-table .col-status .status-badge {
  min-height: 24px;
  min-width: 58px;
  padding: 3px 8px;
  border-color: transparent !important;
  background: transparent !important;
  color: inherit !important;
  box-shadow: none;
  font-size: var(--text-table);
  font-weight: 400;
  line-height: 1.35;
}

.course-table.lesson-table tbody td,
.course-table.lesson-table tbody tr.exam-row td,
.course-table.lesson-table tbody .lesson-cell-text,
.course-table.lesson-table tbody .cell-input,
.course-table.lesson-table tbody .cell-select,
.course-table.lesson-table tbody .status-select,
.course-table.lesson-table tbody .status-badge,
.course-table.lesson-table tbody .custom-select-cell .custom-select-button {
  font-size: var(--text-table);
  font-weight: 400;
  line-height: 1.5;
}

.compact-table-scroll {
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  scrollbar-gutter: auto;
  contain: layout paint;
}

.compact-table-scroll > .uniform-table,
.course-table.week-detail-table,
.fee-detail-table.uniform-table:not(.student-query-detail-table) {
  width: max-content;
  min-width: 0;
  table-layout: auto;
}

.course-table.week-detail-table :is(th, td),
.fee-detail-table.uniform-table:not(.student-query-detail-table) :is(th, td) {
  box-sizing: border-box;
  min-width: 0;
}

.course-table.week-detail-table :is(th, td):nth-child(1),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(3) {
  width: 112px;
  min-width: 96px;
  max-width: 132px;
}

.course-table.week-detail-table :is(th, td):nth-child(2),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(4) {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
}

.course-table.week-detail-table :is(th, td):nth-child(3),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(5) {
  width: 86px;
  min-width: 78px;
  max-width: 96px;
}

.course-table.week-detail-table :is(th, td):nth-child(4),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(6) {
  width: 62px;
  min-width: 58px;
  max-width: 72px;
}

.course-table.week-detail-table :is(th, td):nth-child(5),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(7) {
  width: 112px;
  min-width: 108px;
  max-width: 118px;
}

.course-table.week-detail-table :is(th, td):nth-child(6),
.course-table.week-detail-table :is(th, td):nth-child(7),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(8),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(9) {
  width: 76px;
  min-width: 70px;
  max-width: 86px;
}

.course-table.week-detail-table :is(th, td):nth-child(8),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(10) {
  width: 86px;
  min-width: 76px;
  max-width: 96px;
}

.course-table.week-detail-table :is(th, td):nth-child(9) {
  width: 300px;
  min-width: 220px;
  max-width: 360px;
  text-align: left !important;
}

.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(2) {
  width: 128px;
  min-width: 112px;
  max-width: 160px;
}

.course-table.week-detail-table :is(th, td):nth-child(10),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(11) {
  width: 168px;
  min-width: 120px;
  max-width: 220px;
}

.course-table.week-detail-table td:nth-child(9),
.course-table.week-detail-table td:nth-child(10),
.fee-detail-table:not(.student-query-detail-table) td:nth-child(11) {
  overflow: hidden;
  text-align: left !important;
  text-overflow: ellipsis;
}

.course-table.week-detail-table :is(th, td):last-child {
  width: 76px;
  min-width: 72px;
  max-width: 84px;
  text-align: center !important;
}

.course-table.week-detail-table td:nth-child(11):not(:last-child),
.fee-detail-table:not(.student-query-detail-table) td:nth-child(12),
.fee-detail-table:not(.student-query-detail-table) td:nth-child(13) {
  text-align: right !important;
}

.course-table.week-detail-table :is(th, td):nth-child(11):not(:last-child),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(12),
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(13) {
  width: 118px;
  min-width: 112px;
  max-width: 132px;
}

.fee-detail-table:not(.student-query-detail-table) :is(.select-col, th.select-col, td.select-col) {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
  text-align: center !important;
}

.wide {
  min-width: 180px;
}

.narrow {
  min-width: 58px;
}

@media (prefers-reduced-motion: no-preference) {
  .tabs,
  .summary-grid,
  .appearance-settings-grid,
  .query-head,
  .finance-kpi-grid,
  .finance-grade-grid,
  .finance-two,
  .finance-panels,
  .content > .band {
    animation: surface-enter 220ms var(--ease-out) both;
  }

  .summary-grid .metric,
  .query-head .metric,
  .finance-kpi {
    animation: surface-enter 240ms var(--ease-out) both;
  }

  .summary-grid .metric:nth-child(2),
  .query-head .metric:nth-child(2),
  .finance-kpi:nth-child(2) {
    animation-delay: 35ms;
  }

  .summary-grid .metric:nth-child(3),
  .query-head .metric:nth-child(3),
  .finance-kpi:nth-child(3) {
    animation-delay: 70ms;
  }

  .summary-grid .metric:nth-child(4),
  .query-head .metric:nth-child(4),
  .finance-kpi:nth-child(4) {
    animation-delay: 105ms;
  }

.metric-value,
.finance-kpi-value {
  animation: value-settle 180ms var(--ease-out) both;
}

  .btn,
  .nav-btn,
  .tab,
  .control,
  .custom-select-button,
  .cell-input,
  .cell-select,
  .band,
  .metric,
  .finance-kpi {
    transition:
      background-color 140ms ease,
      border-color 140ms ease,
      box-shadow 140ms ease,
      color 140ms ease,
      opacity 140ms ease,
      transform 120ms ease;
  }

  .tab::after {
    transition:
      opacity 180ms var(--ease-out),
      transform 180ms var(--ease-out);
  }
}

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

.filter-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--topbar-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(8px);
}


.filter-controls {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  min-width: 0;
}

.lesson-filter-bar {
  display: grid;
  align-items: stretch;
  gap: var(--space-3);
}

.lesson-filter-top {
  display: block;
  width: 100%;
  min-width: 0;
}

.lesson-filter-top .filter-summary {
  grid-column: 4;
  align-self: end;
  min-width: max-content;
  margin-left: 0;
  justify-content: flex-end;
}

.lesson-filter-top .filter-controls {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(200px, 1.2fr);
  align-items: end;
  column-gap: 12px;
  row-gap: 11px;
  min-width: 0;
}

.lesson-filter-top .filter-field,
.lesson-filter-top .filter-combo,
.lesson-filter-top .text-filter,
.lesson-filter-top .multi-select,
.lesson-filter-top .date-range-picker {
  min-width: 0;
  width: 100%;
}

.lesson-filter-top .filter-combo .control,
.lesson-filter-top .text-filter .control,
.lesson-filter-top .multi-select-toggle,
.lesson-filter-top .date-range-trigger {
  min-width: 0;
}

.lesson-filter-top .filter-search {
  grid-column: span 3;
}

.lesson-date-filter-group {
  grid-column: span 2;
  display: grid;
  grid-template-columns: max-content minmax(282px, 1fr);
  align-items: flex-end;
  gap: 12px;
  min-width: 0;
}

.lesson-date-filter-group .filter-date-range {
  min-width: 282px;
}

.date-shortcuts {
  display: inline-flex;
  align-items: flex-end;
  gap: var(--space-2);
  min-height: 38px;
}

.lesson-date-shortcuts {
  width: max-content;
  max-width: 100%;
  flex-wrap: wrap;
}

.lesson-date-shortcut {
  min-width: 56px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--brand-dark);
}

.lesson-date-shortcut:hover,
.lesson-date-shortcut:focus-visible {
  border-color: transparent;
  background: color-mix(in srgb, var(--brand-soft) 58%, transparent);
}

.lesson-date-shortcut.active {
  border-color: transparent;
  background: var(--brand);
  color: var(--primary-ink);
  box-shadow: 0 2px 5px rgba(15, 118, 110, 0.14);
}

.fee-detail-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line-soft);
}

.fee-detail-bulk-actions .muted-tip {
  min-width: 0;
}

.fee-detail-bulk-actions .apply-selected-student-pricing-rules {
  flex: 0 0 auto;
  margin-left: 0;
}

.transaction-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 0 var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--line-soft);
}

.transaction-action-row .btn {
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .transaction-action-row,
  .fee-detail-bulk-actions {
    align-items: flex-start;
  }

  .fee-detail-bulk-actions .muted-tip {
    white-space: normal;
  }
}

.lesson-quick-row {
  flex: none;
  padding-top: var(--space-2);
  border-top: 1px dashed var(--line-soft);
}

.lesson-quick-field {
  width: 100%;
}

.filter-field {
  display: grid;
  gap: var(--space-1);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
  line-height: 1.35;
}

.filter-field .control {
  min-width: 136px;
}

.unified-filter-bar {
  align-items: flex-end;
}

.unified-filter-field {
  flex: 1 1 156px;
  min-width: 136px;
  max-width: 240px;
}

.unified-filter-field .multi-select,
.unified-filter-field .multi-select-toggle,
.unified-filter-field .unified-filter-control {
  width: 100%;
  min-width: 0;
}

.unified-filter-field .multi-select-toggle {
  min-height: 36px;
}

.filter-combo {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  min-width: 136px;
}

.filter-combo .control {
  width: 100%;
  min-width: 136px;
  padding-right: 46px;
}

.filter-combo-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  z-index: 2;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transform: translateY(-50%);
}

.filter-combo-clear:hover {
  background: var(--brand-soft);
  color: var(--text);
}

.filter-combo.has-value:hover:not(.open) .filter-combo-clear,
.filter-combo.has-value:focus-within:not(.open) .filter-combo-clear {
  display: grid;
  place-items: center;
}

.filter-combo-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 36px;
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0;
  line-height: 1;
}

.filter-combo-toggle::before {
  content: "⌄";
  font-size: 18px;
  line-height: 1;
}

.filter-combo.open .filter-combo-toggle::before {
  content: "⌕";
  font-size: 18px;
}

.filter-combo.has-value:hover:not(.open) .filter-combo-toggle,
.filter-combo.has-value:focus-within:not(.open) .filter-combo-toggle {
  opacity: 0;
  pointer-events: none;
}

.filter-combo-toggle:hover,
.filter-combo.open .filter-combo-toggle {
  background: var(--surface-hover);
  color: var(--text);
}

.filter-combo-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 60;
  display: none;
  width: max(100%, 168px);
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sticky);
}

.filter-combo.open .filter-combo-menu {
  display: grid;
  gap: 2px;
}

.filter-combo-option {
  width: 100%;
  min-height: 30px;
  padding: 6px 9px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  white-space: nowrap;
}

.filter-combo-option:hover,
.filter-combo-option:focus-visible {
  outline: none;
  background: var(--surface-hover);
}

.filter-combo-option.muted {
  color: var(--muted);
}

.filter-combo-empty {
  padding: 7px 9px;
  color: var(--muted);
  font-size: var(--text-ui);
}

.text-filter {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  min-width: 136px;
}

.text-filter .control {
  width: 100%;
  min-width: 136px;
  padding-right: 44px;
}

.text-filter-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  z-index: 2;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  transform: translateY(-50%);
}

.text-filter-clear:hover {
  background: var(--brand-soft);
  color: var(--text);
}

.text-filter.has-value:hover .text-filter-clear,
.text-filter.has-value:focus-within .text-filter-clear {
  display: grid;
}

.multi-select {
  position: relative;
  display: inline-flex;
  min-width: 168px;
}

.multi-select-toggle {
  position: relative;
  width: 100%;
  min-width: 168px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-right: 44px;
  text-align: left;
}

.multi-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 课程总表学生列由当前可见课程的 Canvas 实测文本宽度驱动。 */
.course-table.lesson-table :is(th, td).col-students,
.course-table.lesson-table col.col-students {
  width: var(--lesson-student-column-width, 300px) !important;
  min-width: var(--lesson-student-column-width, 300px) !important;
  max-width: none !important;
}

/* Student names are individual labels: they may wrap inside a bounded table column
   instead of widening the entire page or being compressed into an ellipsis. */
.course-table.lesson-table :is(th, td).col-students,
.course-table.lesson-table col.col-students {
  width: var(--lesson-student-column-width, 300px) !important;
  min-width: min(220px, var(--lesson-student-column-width, 300px)) !important;
  max-width: 420px !important;
}

.course-table.lesson-table .col-students .lesson-cell-text { white-space: normal; overflow: visible; text-overflow: clip; }
.course-table.lesson-table .lesson-schedule-students { vertical-align: middle; }
.lesson-schedule-students .schedule-student-badges { margin-bottom: 5px; }
.lesson-schedule-students .lesson-schedule-student-field { min-height: 28px; padding: 3px 24px 3px 7px; font-size: var(--text-caption); }

.course-table.lesson-table .col-status .status-badge,
.course-table.lesson-table .col-status .custom-select-status .custom-select-button {
  background: var(--badge-bg, var(--neutral-chip-bg)) !important;
  color: var(--badge-fg, var(--neutral-chip-fg)) !important;
  border: 0 !important;
  border-radius: 6px;
  font-weight: 700;
}
.custom-select-status .custom-select-value .status-badge { min-width: 0; }
.custom-select-option .status-option-badge { pointer-events: none; }

/* Only the fee-detail table is condensed; recharge, opening balance and profile
   tables intentionally keep their established spacing. */
.fee-detail-table.uniform-table th { padding-top: 6px; padding-bottom: 6px; line-height: 1.25; }
.fee-detail-table.uniform-table td { padding-top: 5px; padding-bottom: 5px; line-height: 1.3; vertical-align: middle; }
.fee-detail-table.uniform-table .status-badge { min-height: 21px; padding: 2px 7px; }
.fee-detail-table.uniform-table input[type="checkbox"] { inline-size: 16px; block-size: 16px; }

/* Special lesson states remain visible through their badges; the fee-detail
   row itself stays neutral instead of becoming a full-width yellow band. */
.fee-detail-table:not(.student-query-detail-table) tr:is(.abnormal, .exam-row) > td {
  background: var(--panel);
  color: var(--ink);
  font-weight: inherit;
}

.fee-detail-table:not(.student-query-detail-table) tr:is(.abnormal, .exam-row):hover > td {
  background: var(--surface-hover);
}

.color-config-card { grid-column: span 1; }
.color-config-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 7px;
}
.color-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(260px, 100%);
}
.color-config-row label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: var(--text-caption);
  white-space: nowrap;
}
.color-config-row input[type="color"] { inline-size: 30px; block-size: 26px; padding: 1px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.base-data-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.base-data-grid > .color-config-card {
  grid-column: 1 / -1;
}

.color-config-row {
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--section-head);
}

.color-config-label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  overflow: visible;
}

.color-config-row input[type="color"] {
  flex: 0 0 30px;
}

.course-table.lesson-table .col-students .lesson-cell-text,
.lesson-schedule-students .multi-select-label {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.multi-select-caret {
  position: absolute;
  right: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 100%;
  color: var(--muted);
  font-size: 0;
}

.multi-select-caret::before {
  content: "⌄";
  font-size: 18px;
  line-height: 1;
}

.multi-select.open .multi-select-caret::before {
  content: "⌕";
  font-size: 18px;
}

.multi-select-clear-icon {
  position: absolute;
  right: 7px;
  top: 50%;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  transform: translateY(-50%);
}

.multi-select.has-value:hover:not(.open) .multi-select-caret,
.multi-select.has-value:focus-within:not(.open) .multi-select-caret {
  display: none;
}

.multi-select.has-value:hover:not(.open) .multi-select-clear-icon,
.multi-select.has-value:focus-within:not(.open) .multi-select-clear-icon {
  display: grid;
}

.multi-select-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 70;
  display: none;
  width: max(100%, 188px);
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sticky);
}

.multi-select.open .multi-select-menu {
  display: grid;
  gap: 2px;
}

.multi-select-menu.floating-multi-select-menu {
  position: fixed;
  z-index: 610;
  display: grid;
  gap: 2px;
  right: auto;
  bottom: auto;
}

.multi-select-search {
  width: 100%;
  min-height: 32px;
  margin-bottom: 4px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.multi-select-clear,
.multi-select-option {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.multi-select-clear {
  padding: 6px 9px;
  color: var(--muted);
}

.multi-select-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2);
  padding: 6px 9px;
}

.multi-select-option:hover,
.multi-select-option:focus-visible,
.multi-select-clear:hover,
.multi-select-clear:focus-visible {
  outline: none;
  background: var(--surface-hover);
}

.multi-select-option.selected {
  background: var(--surface-hover);
  color: var(--ink-strong);
}

.multi-select-check {
  width: 18px;
  color: var(--brand);
  font-weight: 900;
  text-align: center;
}

.multi-select-empty {
  padding: 7px 9px;
  color: var(--muted);
  font-size: var(--text-ui);
}

.week-grid-panel {
  --matrix-lesson-card-width: 196px;
  --matrix-lesson-cell-width: calc(var(--matrix-lesson-card-width) + 16px);
  overflow: visible;
}

.week-grid-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.matrix-view-tabs {
  margin-bottom: var(--space-4);
}

.matrix-date-region,
.matrix-tabs-region,
.matrix-filter-region,
.matrix-view-region {
  min-width: 0;
}

.matrix-dimension-panel {
  --matrix-lesson-card-width: 196px;
  --matrix-lesson-cell-width: calc(var(--matrix-lesson-card-width) + 16px);
  overflow: visible;
}

.matrix-dimension-scroll {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.matrix-dimension-table {
  width: max-content;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.matrix-dimension-table th,
.matrix-dimension-table td {
  vertical-align: top;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.matrix-dimension-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 48px;
  padding: 10px 12px;
  background: var(--section-head);
  color: var(--ink-strong);
  font-size: var(--text-ui);
  text-align: center;
}

.matrix-dimension-entity-head,
.matrix-dimension-entity {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 148px;
  min-width: 148px !important;
  max-width: 180px;
  background: color-mix(in srgb, var(--section-head) 76%, var(--panel-raised));
  color: var(--ink-strong);
  text-align: left !important;
}

.matrix-dimension-entity {
  padding: 12px 10px;
  border-left: 4px solid var(--brand);
  font-weight: 850;
}

.matrix-dimension-table tbody tr + tr th,
.matrix-dimension-table tbody tr + tr td {
  border-top: 10px solid color-mix(in srgb, var(--line) 42%, var(--bg));
}

.matrix-dimension-table td {
  width: var(--matrix-lesson-cell-width);
  min-width: var(--matrix-lesson-cell-width);
  min-height: 116px;
  height: auto;
  padding: 8px;
  background: var(--panel);
}

.matrix-dimension-table .matrix-dimension-date-head {
  width: var(--matrix-lesson-cell-width);
  min-width: var(--matrix-lesson-cell-width);
}

.matrix-lesson-card {
  display: grid;
  gap: 4px;
  width: var(--matrix-lesson-card-width);
  min-width: var(--matrix-lesson-card-width);
  max-width: var(--matrix-lesson-card-width);
  margin-bottom: 6px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  overflow: visible;
}

.matrix-lesson-card:last-child {
  margin-bottom: 0;
}

.matrix-dimension-card.abnormal {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.matrix-dimension-time {
  color: var(--ink-strong);
  font-size: var(--text-ui);
  font-weight: 760;
}

.matrix-lesson-card-badges.entity-badge-list {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}

.matrix-dimension-meta {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: normal;
}

.matrix-dimension-meta span,
.matrix-dimension-note {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  writing-mode: horizontal-tb;
}

.matrix-dimension-note {
  color: var(--text);
  font-size: var(--text-caption);
  line-height: 1.45;
}

.week-grid-sparse {
  display: grid;
  gap: 10px;
}

.week-grid-sparse-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.week-grid-sparse-time {
  padding: 14px 12px;
  border-right: 1px solid var(--line-soft);
  background: var(--section-head);
  color: var(--ink-strong);
  font-family: var(--font-number);
  font-size: var(--text-ui);
  font-weight: 850;
}

.week-grid-sparse-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 8px;
  min-width: 0;
  padding: 8px;
}

.week-grid-sparse-cell {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.week-grid-sparse-cell.outside-month {
  background: color-mix(in srgb, var(--panel) 70%, var(--bg));
}

.week-grid-sparse-date {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--ink-strong);
  font-size: var(--text-ui);
  font-weight: 850;
}

.week-grid-sparse-date span {
  color: var(--muted);
  font-family: var(--font-number);
  font-size: var(--text-caption);
  font-weight: 800;
}

.week-grid-sparse-empty {
  padding: 16px;
  color: var(--muted);
  font-weight: 700;
}

.week-grid-table {
  width: max-content;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.week-grid-table th,
.week-grid-table td {
  vertical-align: top;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.week-grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 48px;
  padding: 10px 8px;
  background: var(--section-head);
  color: var(--ink-strong);
  font-size: var(--text-ui);
  text-align: center;
}

.week-grid-table thead th span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.week-grid-time-head,
.week-grid-time {
  width: 148px;
  min-width: 148px;
  max-width: 180px;
}

.week-grid-time-head {
  left: 0;
  z-index: 3;
  background: color-mix(in srgb, var(--section-head) 76%, var(--panel-raised));
  text-align: left !important;
}

.week-grid-time {
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 12px 10px;
  border-left: 4px solid var(--brand);
  background: color-mix(in srgb, var(--section-head) 76%, var(--panel-raised));
  color: var(--ink-strong);
  font-family: var(--font-number);
  font-size: var(--text-ui);
  text-align: left;
}

.week-grid-table tbody tr + tr th,
.week-grid-table tbody tr + tr td {
  border-top: 10px solid color-mix(in srgb, var(--line) 42%, var(--bg));
}

.week-grid-table td {
  min-height: 116px;
  height: auto;
  padding: 8px;
  background: var(--panel);
}

.week-grid-table .outside-month {
  background: color-mix(in srgb, var(--panel) 70%, var(--bg));
}

.week-grid-card {
  /* 学生名单较长时由内容自然撑高，不能裁切课程卡片。 */
  overflow: visible;
}

.week-grid-card.abnormal {
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning-bg) 34%, var(--panel-raised));
}

.week-grid-card.has-conflict {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger-bg) 42%, var(--panel-raised));
}

.week-grid-course {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--ink-strong);
  font-size: var(--text-ui);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.week-grid-conflicts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.week-grid-conflicts span {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: var(--text-caption);
  font-weight: 850;
}

.week-grid-meta,
.week-grid-students,
.week-grid-notes {
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 650;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  writing-mode: horizontal-tb;
}

.week-grid-meta {
  display: grid;
  gap: 1px;
}

.week-grid-meta span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.week-grid-students {
  color: var(--text);
}

.week-grid-empty {
  display: block;
  padding-top: 30px;
  color: var(--muted);
  text-align: center;
}

.filter-search .control {
  min-width: 220px;
}

.date-range-inputs {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  background: color-mix(in srgb, var(--input-bg) 86%, var(--panel-raised));
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: border-color 140ms var(--ease-out), background-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}

.date-range-inputs .control {
  min-width: 132px;
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  padding: 5px 8px;
}

.date-range-inputs:hover {
  border-color: var(--brand-border);
  background: var(--surface-hover);
}

.date-range-inputs:focus-within {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--ring);
}

.date-range-inputs .control:hover,
.date-range-inputs .control:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.date-range-inputs input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.62;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.date-range-inputs input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: var(--brand-soft);
  opacity: 0.92;
}

.date-range-inputs .custom-date-input {
  cursor: pointer;
  text-align: center;
  caret-color: transparent;
}

.date-range-inputs .custom-date-input::placeholder {
  color: var(--muted);
  font-family: var(--font-ui);
}

.date-range-inputs b {
  flex: 0 0 auto;
  width: 16px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

.custom-date-picker {
  position: fixed;
  z-index: 680;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: 0 18px 42px rgba(17, 27, 37, 0.14), 0 2px 8px rgba(17, 27, 37, 0.08);
  color: var(--ink);
  animation: surface-enter 140ms var(--ease-out);
}

.custom-date-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.custom-date-title {
  color: var(--ink-strong);
  font-size: var(--text-ui);
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.custom-date-nav,
.custom-date-day {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}

.custom-date-nav {
  width: 34px;
  height: 34px;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
}

.custom-date-nav:hover,
.custom-date-nav:focus-visible {
  outline: 0;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.custom-date-weekdays,
.custom-date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.custom-date-weekdays {
  margin-bottom: var(--space-1);
}

.custom-date-weekdays span {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
  line-height: 28px;
  text-align: center;
}

.custom-date-day {
  height: 34px;
  min-width: 0;
  color: var(--ink);
  font-family: var(--font-number);
  font-size: var(--text-ui);
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.custom-date-day.outside {
  color: var(--muted);
  opacity: 0.58;
}

.custom-date-day:hover,
.custom-date-day:focus-visible {
  outline: 0;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.custom-date-day.today {
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.custom-date-day.selected {
  background: var(--brand);
  color: var(--primary-ink);
  box-shadow: none;
}

.date-range-picker {
  position: relative;
  display: inline-flex;
  min-width: 246px;
  max-width: 100%;
  vertical-align: middle;
}

.date-range-trigger {
  position: relative;
  width: 100%;
  min-width: 246px;
  padding-right: 44px;
  text-align: left;
  cursor: pointer;
}

.date-range-text {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.date-range-part {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-range-start {
  text-align: left;
}

.date-range-end {
  text-align: left;
}

.date-range-separator {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.week-grid-table thead th:not(.week-grid-time-head),
.week-grid-table td {
  width: var(--matrix-lesson-cell-width);
  min-width: var(--matrix-lesson-cell-width);
}

.date-range-part.is-placeholder {
  color: var(--muted);
  opacity: 0.68;
}

.date-range-icon {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 100%;
  color: var(--muted);
  line-height: 1;
}

.date-range-icon::before {
  content: "";
  width: 19px;
  height: 19px;
  background: currentColor;
  opacity: 0.92;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cg%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M7%203v3M17%203v3M5.5%206h13A2.5%202.5%200%200%201%2021%208.5v10A2.5%202.5%200%200%201%2018.5%2021h-13A2.5%202.5%200%200%201%203%2018.5v-10A2.5%202.5%200%200%201%205.5%206Z'/%3E%3Cpath%20d='M3%2010h18'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cg%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M7%203v3M17%203v3M5.5%206h13A2.5%202.5%200%200%201%2021%208.5v10A2.5%202.5%200%200%201%2018.5%2021h-13A2.5%202.5%200%200%201%203%2018.5v-10A2.5%202.5%200%200%201%205.5%206Z'/%3E%3Cpath%20d='M3%2010h18'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 140ms var(--ease-out), opacity 140ms var(--ease-out);
}

.date-range-picker.open .date-range-icon::before {
  transform: translateY(-1px);
}

.date-range-clear {
  position: absolute;
  right: 7px;
  top: 50%;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  transform: translateY(-50%);
}

.date-range-clear:hover {
  background: var(--brand-soft);
  color: var(--text);
}

.date-range-picker.has-value:hover:not(.open) .date-range-clear,
.date-range-picker.has-value:focus-within:not(.open) .date-range-clear {
  display: grid;
}

.date-range-picker.has-value:hover:not(.open) .date-range-icon,
.date-range-picker.has-value:focus-within:not(.open) .date-range-icon {
  display: none;
}

.date-range-picker.disabled {
  opacity: 0.62;
}

.date-range-picker-panel {
  position: fixed;
  z-index: 520;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: var(--space-3);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: 0 22px 54px rgba(17, 27, 37, 0.18), 0 2px 10px rgba(17, 27, 37, 0.08);
  color: var(--ink);
  align-items: stretch;
  overflow: hidden;
  animation: surface-enter 140ms var(--ease-out);
}

.date-range-picker-panel[hidden] {
  display: none;
}

.date-range-presets {
  display: grid;
  align-content: start;
  align-self: stretch;
  gap: 4px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: var(--space-2);
  border-right: 1px solid var(--line-soft);
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
  contain: size layout;
}

.date-range-presets::-webkit-scrollbar {
  width: 6px;
}

.date-range-presets::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line);
}

.date-range-preset {
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-ui);
  text-align: left;
  padding: 6px 9px;
}

.date-range-preset:hover,
.date-range-preset:focus-visible {
  outline: 0;
  background: var(--surface-hover);
}

.date-range-calendars {
  min-width: 0;
}

.date-range-hint {
  margin-bottom: var(--space-2);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.date-range-calendar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.date-range-calendar-head {
  display: grid;
  grid-template-columns: 30px 30px minmax(0, 1fr) 30px 30px;
  align-items: center;
  gap: 2px;
  margin-bottom: var(--space-2);
}

.date-range-calendar-title {
  color: var(--ink-strong);
  font-size: var(--text-ui);
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.date-range-nav,
.date-range-day {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.date-range-nav {
  width: 30px;
  height: 30px;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.date-range-nav:hover,
.date-range-nav:focus-visible {
  outline: 0;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.date-range-weekdays,
.date-range-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.date-range-weekdays {
  margin-bottom: var(--space-1);
}

.date-range-weekdays span {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
  line-height: 26px;
  text-align: center;
}

.date-range-day {
  position: relative;
  height: 32px;
  min-width: 0;
  cursor: pointer;
  font-family: var(--font-number);
  font-size: var(--text-ui);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.date-range-day.outside {
  color: var(--muted);
  opacity: 0.55;
}

.date-range-day:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.35;
}

.date-range-day:hover:not(:disabled),
.date-range-day:focus-visible {
  outline: 0;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.date-range-day.today {
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.date-range-day.preview {
  background: color-mix(in srgb, var(--brand-soft) 74%, transparent);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.date-range-day.selected {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.date-range-day.range-start,
.date-range-day.range-end {
  background: var(--brand);
  color: var(--primary-ink);
  box-shadow: none;
}

.filter-summary {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-left: auto;
  color: var(--muted);
  font-size: var(--text-ui);
  white-space: nowrap;
}

.filter-bar > .filter-summary,
.filter-bar.compact > .filter-summary {
  margin-left: auto;
}

.filter-bar.compact > .btn:last-child {
  margin-left: auto;
}

.filter-summary b {
  color: var(--ink);
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.query-head {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) repeat(4, minmax(150px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.travel-week-head {
  display: grid;
  justify-items: center;
  gap: 2px;
  line-height: 1.25;
  text-align: center;
}

.travel-week-head small {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
  white-space: nowrap;
}

.query-head.student-statement-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* 范围切换仅更新学生查询的内容，指标卡保持原节点且不播放进入/数值动画。 */
.student-query-results .student-statement-metrics .metric,
.student-query-results .student-statement-metrics .metric-value {
  animation: none !important;
  transition: none;
}

@media (max-width: 1180px) {
  .summary-grid,
  .appearance-settings-grid,
  .finance-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-visual-grid,
  .finance-grade-grid {
    grid-template-columns: 1fr;
  }

  .finance-two,
  .finance-panels {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1181px) and (max-width: 1320px) {
  .finance-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .query-head.student-statement-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .lesson-filter-top {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-3);
  }

  .lesson-filter-top .filter-summary {
    align-self: flex-end;
    margin-left: 0;
  }

  .lesson-filter-top .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-filter-top .filter-search {
    grid-column: auto;
  }

  .date-range-picker-panel {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .date-range-presets {
    grid-template-columns: minmax(0, 1fr);
    padding-right: var(--space-2);
    padding-bottom: 0;
    border-right: 1px solid var(--line-soft);
    border-bottom: 0;
  }

  .query-head.student-statement-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-comparison-grid {
    grid-template-columns: 1fr;
  }

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

  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: var(--space-4);
  }

  #nav {
    display: flex;
    gap: 4px;
  }

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

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }

  .filter-bar {
    top: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .filter-summary {
    justify-content: flex-end;
    width: 100%;
  }

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

  .date-range-trigger,
  .date-range-picker {
    min-width: 0;
    width: 100%;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .summary-grid,
  .appearance-settings-grid,
  .query-head,
  .finance-kpi-grid,
  .finance-command-panel,
  .finance-visual-grid,
  .finance-grade-grid,
  .finance-two,
  .finance-panels {
    grid-template-columns: 1fr;
  }

  .conflict-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .conflict-lesson-line,
  .focus-lesson-body {
    grid-template-columns: 1fr;
  }

  .focus-lesson-body {
    display: grid;
  }

  .conflict-counts {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .date-range-picker-panel {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: var(--space-2);
    padding: 8px;
  }

  .date-range-calendar-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }

  .date-range-day {
    height: 28px;
  }

  .date-range-preset {
    min-height: 30px;
    padding-inline: 6px;
  }
}

@media (max-width: 560px) {
  .query-head.student-statement-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #nav {
    grid-template-columns: none;
  }

  .nav-sections {
    grid-template-columns: 1fr;
  }

  .content,
  .topbar {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .toolbar {
    width: 100%;
  }

  .month-toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .month-toolbar .control {
    flex: 1 1 150px;
  }

  .btn,
  .control {
    flex: 1 1 auto;
  }

  .filter-field,
  .filter-field .control,
  .filter-field .custom-select,
  .filter-bar.compact .custom-select-control,
  .filter-search .control,
  .date-range-inputs,
  .date-range-inputs .control {
    width: 100%;
    min-width: 0;
  }

  .unified-filter-field {
    flex-basis: 100%;
    max-width: none;
  }

  .unified-filter-bar .filter-summary {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-left: 0;
    white-space: normal;
  }

  .date-range-inputs {
    flex-wrap: wrap;
  }

  .date-range-inputs .custom-select,
  .date-range-inputs .control {
    flex: 1 1 132px;
  }

  .date-range-inputs b {
    display: none;
  }
}

:root {
  --fg1: var(--ink-strong);
  --fg2: var(--ink);
  --fg3: var(--muted);
  --surface-1: var(--bg);
  --surface-2: var(--panel);
  --surface-3: var(--panel-raised);
  --surface-4: var(--section-head);
  --interactive-primary: var(--brand);
  --interactive-primary-hover: var(--brand-dark);
  --interactive-accent: var(--accent);
  --status-success: var(--success);
  --status-success-bg: var(--success-bg);
  --status-warning: var(--warning);
  --status-warning-bg: var(--warning-bg);
  --status-danger: var(--danger);
  --status-danger-bg: var(--danger-bg);
  --status-info: var(--info);
  --status-info-bg: var(--info-bg);
  --border-default: var(--line);
  --border-soft: var(--line-soft);
  --border-hover: var(--hover-border);
  --border-brand: var(--brand-border);
}

.t-caption { font-size: var(--text-caption); line-height: 1.35; }
.t-table { font-size: var(--text-table); }
.t-ui { font-size: var(--text-ui); }
.t-body { font-size: var(--text-body); line-height: var(--leading-body); }
.t-title { font-size: var(--text-title); font-weight: 750; line-height: var(--leading-tight); }
.t-number {
  font-family: var(--font-number);
  font-size: var(--text-number);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.t-kpi {
  font-family: var(--font-number);
  font-size: var(--text-kpi);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.t-strong { color: var(--ink-strong); font-weight: 700; }
.t-muted { color: var(--muted); }
.t-mono { font-family: var(--font-mono); }
.t-tabnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

@media (max-width: 640px) {
  .finance-composition-panel,
  .finance-stack-panel {
    grid-template-columns: 1fr;
  }

  .composition-body {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .donut-legend {
    width: 100%;
  }
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 18px;
  background: var(--panel-raised);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: 0 10px 32px rgba(17, 27, 37, 0.12), 0 2px 8px rgba(17, 27, 37, 0.06);
  color: var(--ink-strong);
  font-size: var(--text-ui);
  font-weight: 700;
  line-height: 1.4;
  animation: toast-slide-in 0.3s var(--ease-out) forwards;
  pointer-events: auto;
}

.toast.toast-error {
  border-left-color: var(--danger);
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast.toast-hiding {
  animation: toast-slide-out 0.25s var(--ease-out) forwards;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
}

.mobile-menu-btn {
  display: none;
}

.notice-filter-bar {
  align-items: stretch;
}

.notice-filter-two-row {
  display: grid;
  gap: var(--space-3);
}

.notice-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.notice-primary-controls {
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}

.notice-filter-primary-row {
  align-items: center;
}

.notice-primary-controls > .filter-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 38px;
}

.notice-primary-controls > .filter-field > span:first-child {
  white-space: nowrap;
}

.notice-primary-controls .history-toggle,
.notice-primary-controls .notice-layout-toggle,
.notice-primary-controls .btn,
.notice-filter-primary-row > .filter-summary {
  min-height: 38px;
  align-self: center;
}

.notice-primary-controls .history-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.notice-primary-controls .history-toggle input {
  margin: 0;
}

.notice-filter-primary-row > .filter-summary {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.notice-tail-row {
  display: grid;
  grid-template-columns: max-content minmax(220px, 1fr);
  align-items: center;
  gap: var(--space-3);
}

.notice-tail-field {
  min-width: 0;
  flex: 1 1 100%;
}

.notice-tail-field .control {
  width: 100%;
}

.notice-list {
  display: grid;
  gap: var(--space-4);
}

.notice-layout-toggle {
  align-self: center;
}

.notice-simple-mode {
  display: grid;
  gap: var(--space-4);
}

.notice-preview-mode {
  display: grid;
  gap: var(--space-4);
}

.notice-preview-panel {
  display: grid;
  gap: var(--space-3);
}

.notice-simple-panel {
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-panel);
}

.notice-simple-panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.notice-simple-grade {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px dashed var(--line);
}

.notice-simple-grade:first-of-type {
  border-top: 0;
}

.notice-simple-grade-title {
  color: var(--ink-strong);
  font-weight: 900;
}

.notice-simple-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-3);
}

.notice-simple-tile {
  display: grid;
  gap: 5px;
  min-height: 148px;
  align-content: start;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.notice-simple-tile:hover {
  border-color: var(--brand-border);
  background: color-mix(in srgb, var(--brand-soft) 40%, var(--input-bg));
}

.notice-simple-tile.done {
  border-color: color-mix(in srgb, var(--success) 55%, var(--line));
  background: color-mix(in srgb, var(--success-bg) 72%, var(--panel));
}

.notice-simple-title {
  color: var(--ink-strong);
  font-weight: 900;
  line-height: 1.25;
}

.notice-simple-detail-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 24px;
  overflow: visible;
  line-height: 1.35;
  white-space: normal;
}

.notice-card-identity {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--shot-line);
  background: var(--shot-card);
}

.notice-simple-tile > .notice-card-identity-row,
.notice-card-identity-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 24px;
}

.notice-simple-tile > .notice-card-identity-personal,
.notice-simple-tile > .notice-card-identity-grade-subject,
.notice-simple-tile > .notice-card-identity-teacher,
.notice-card-identity :is(.notice-card-identity-personal, .notice-card-identity-grade-subject, .notice-card-identity-teacher) {
  flex-wrap: nowrap;
}

.teacher-badge {
  --badge-bg: var(--brand-soft);
  --badge-fg: var(--brand);
  font-weight: 850;
}

.notice-simple-students .student-badge {
  max-width: none;
}

.notice-simple-students .student-badge > span {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  word-break: normal;
}

.notice-simple-meta,
.notice-simple-state {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 750;
}

.notice-simple-meta {
  margin-top: auto;
}

.notice-course-tag-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  min-height: 24px;
  line-height: 1;
  vertical-align: middle;
}

@media (max-width: 760px) {
  .notice-filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .notice-tail-row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
  }
}

.notice-simple-tile.done .notice-simple-state {
  color: var(--success);
}

.notice-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-panel);
}

.notice-item.completed {
  border-color: color-mix(in srgb, var(--success) 38%, var(--line));
  background: color-mix(in srgb, var(--success-bg) 46%, var(--panel));
}

.notice-item.partial {
  border-color: color-mix(in srgb, var(--warning) 32%, var(--line));
}

.notice-left,
.notice-right {
  min-width: 0;
}

.notice-left {
  position: relative;
  isolation: isolate;
}

.notice-right {
  display: grid;
  align-content: start;
  gap: var(--space-3);
}

.notice-object-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.notice-object-name {
  color: var(--ink-strong);
  font-size: var(--text-body);
  font-weight: 850;
  line-height: 1.35;
}

.notice-object-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 750;
}

.notice-shot-preview {
  position: relative;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--shot-line);
  border-radius: var(--radius-sm);
  background: var(--shot-bg);
  padding: 12px;
}

.notice-shot-shell {
  width: max-content;
  min-width: 100%;
  overflow: hidden;
  border: 1px solid var(--shot-line);
  border-radius: var(--radius);
  background: var(--shot-panel);
  box-shadow: 0 4px 14px rgba(16, 32, 51, 0.08);
  color: var(--shot-title);
}

.notice-shot-head {
  display: grid;
  place-items: center;
  padding: 10px 14px 11px;
  border-top: 4px solid var(--shot-brand);
  border-bottom: 1px solid var(--shot-line);
  background: var(--shot-brand-pale);
}

.notice-shot-title {
  color: var(--shot-brand-dark);
  font-size: 1.25rem;
  font-weight: 950;
  line-height: 1.25;
  text-align: center;
}

.notice-shot-table {
  width: auto;
  min-width: 100%;
  table-layout: auto;
  background: var(--shot-card);
  color: var(--shot-title);
  border: 0;
  box-shadow: none;
}

.notice-shot-table th,
.notice-shot-table td {
  min-width: max-content;
  height: 36px;
  padding: 8px 10px;
  border-color: var(--shot-line);
  white-space: nowrap;
  text-align: center;
}

.notice-shot-table th {
  position: static;
  background: var(--shot-brand-soft);
  color: var(--shot-brand-dark);
}

.notice-shot-table tbody tr:nth-child(even) td {
  background: var(--shot-brand-pale);
}

.notice-shot-table td:nth-child(5) {
  color: var(--shot-brand-dark);
  font-weight: 400;
}

.notice-shot-table td:nth-child(7),
.notice-shot-table td:nth-child(8) {
  color: var(--shot-tag-text);
  font-weight: 400;
}

.notice-shot-table td:last-child,
.notice-shot-table th:last-child {
  min-width: 180px;
}

.notice-checkmark {
  position: absolute;
  inset: 42px 0 0;
  z-index: 50;
  display: grid;
  place-items: center;
  color: var(--success);
  background: rgba(232, 247, 238, 0.28);
  font-family: "Segoe UI Symbol", "Arial Unicode MS", "Microsoft YaHei UI", var(--font-ui);
  font-size: 112px;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(8, 116, 67, 0.2);
}

.notice-message {
  min-height: 104px;
  resize: vertical;
  white-space: pre-wrap;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.notice-actions .btn {
  flex: 1 1 112px;
}

.notice-state {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 800;
}

.notice-item.completed .notice-state {
  color: var(--success);
}

.card-body:has(table), .table-container, .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Dashboard */
.dashboard-page {
  display: grid;
  gap: var(--space-4);
}

.dashboard-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(88px, 1fr));
  gap: var(--space-3);
}

.dashboard-shortcut,
.dashboard-feature-option {
  border: 1px solid var(--line-soft);
  background: var(--panel-raised);
  border-radius: var(--radius);
  min-height: 86px;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--ink);
  cursor: pointer;
}

.dashboard-shortcut:hover,
.dashboard-feature-option:hover,
.dashboard-todo-item:hover {
  border-color: var(--hover-border);
  background: var(--surface-hover);
}

.dashboard-shortcut svg,
.dashboard-feature-option svg,
.dashboard-selected-chip svg,
.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-shortcut span,
.dashboard-feature-option span {
  font-size: var(--text-caption);
  text-align: center;
  vertical-align: middle;
}

.notice-shot-table .entity-badge-list,
.notice-object-meta .entity-badge-list {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  line-height: 1;
  vertical-align: middle;
}

.notice-shot-table :is(.grade-badge, .subject-badge),
.notice-course-tag-group :is(.grade-badge, .subject-badge),
.notice-object-meta :is(.grade-badge, .subject-badge) {
  min-height: 24px;
  height: 24px;
  max-height: 24px;
  padding-block: 4px;
  line-height: 1;
  vertical-align: middle;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(360px, 1.4fr);
  gap: var(--space-4);
  align-items: start;
}

.dashboard-pie-section {
  grid-column: 1 / -1;
}

.dashboard-current-section {
  min-height: 100%;
}

.dashboard-current-list {
  display: grid;
  gap: var(--space-2);
}

.dashboard-current-item {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(220px, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 58px;
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
}

.dashboard-current-main,
.dashboard-current-meta {
  min-width: 0;
}

.dashboard-current-main {
  display: grid;
  gap: 2px;
}

.dashboard-current-main strong {
  color: var(--ink-strong);
}

.dashboard-current-main span,
.dashboard-current-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-current-main span {
  color: var(--muted);
  font-family: var(--font-number);
  font-size: var(--text-caption);
}

.dashboard-current-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-caption);
}

.dashboard-current-meta span {
  max-width: 190px;
}

.dashboard-current-empty {
  min-height: 116px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--section-head);
}

.dashboard-pie-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.dashboard-pie-card {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel-raised);
}

.dashboard-pie-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.dashboard-pie-card-head strong {
  color: var(--ink-strong);
}

.dashboard-pie-card-head span {
  color: var(--muted);
  font-size: var(--text-caption);
  white-space: nowrap;
}

.dashboard-todo-list {
  display: grid;
  gap: var(--space-2);
}

.dashboard-todo-item {
  border: 1px solid var(--line-soft);
  background: var(--panel-raised);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  cursor: pointer;
}

.dashboard-todo-item strong {
  color: var(--brand);
  font-family: var(--font-number);
  font-size: 1.25rem;
}

.dashboard-date-controls {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-trend-chart {
  width: 100%;
  height: 238px;
  display: block;
  min-width: 0;
  overflow: hidden;
}

.dashboard-empty-chart {
  min-height: 190px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--section-head);
}

.dashboard-pie-wrap {
  display: grid;
  grid-template-columns: 190px minmax(150px, 210px);
  gap: var(--space-4);
  align-items: center;
  justify-content: center;
  width: min(100%, 480px);
  min-height: 210px;
  margin: 0 auto;
  padding: 0 var(--space-3) var(--space-2);
}

.dashboard-pie-svg {
  width: 190px;
  height: 190px;
  justify-self: center;
}

.dashboard-pie-segment {
  transform: rotate(-90deg);
  transform-origin: 110px 110px;
}

.dashboard-pie-total {
  fill: var(--brand);
  font-family: var(--font-number);
  font-size: 32px;
  font-weight: 800;
}

.dashboard-pie-caption {
  fill: var(--muted);
  font-size: 13px;
}

.dashboard-pie-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.dashboard-legend-item {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--section-head);
}

.dashboard-legend-item span {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dashboard-legend-copy {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
}

.dashboard-legend-copy b {
  white-space: nowrap;
}

.dashboard-legend-copy em {
  color: var(--muted);
  font-style: normal;
  font-family: var(--font-number);
  font-weight: 700;
}

.dashboard-config-panel,
.role-permission-panel {
  max-height: min(820px, 90vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-config-panel {
  max-width: 760px;
}

.dashboard-config-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  overflow: auto;
  padding-right: var(--space-1);
}

.dashboard-config-list,
.dashboard-feature-groups {
  display: grid;
  gap: var(--space-2);
}

.dashboard-config-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.dashboard-selected-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.dashboard-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--line-soft);
  background: var(--section-head);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.dashboard-selected-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.dashboard-feature-panel {
  max-width: 880px;
}

.dashboard-feature-groups {
  max-height: 48vh;
  overflow: auto;
  padding-right: var(--space-1);
}

.dashboard-feature-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: var(--space-2);
}

.dashboard-feature-option.selected {
  border-color: var(--brand-border);
  background: var(--brand-soft);
  color: var(--brand);
}

/* User roles */
.user-admin-tabs {
  display: inline-flex;
  gap: var(--space-1);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: var(--space-4);
}

.user-admin-tab {
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--muted);
  cursor: pointer;
}

.user-admin-tab.active {
  background: var(--brand);
  color: var(--primary-ink);
}

.user-admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.role-code {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  margin-left: var(--space-2);
}

.role-create-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(140px, 0.8fr) minmax(220px, 1.2fr) auto auto;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-4);
}

.role-permission-panel {
  width: min(1040px, calc(100vw - 32px));
  max-width: 1040px;
}

.role-modal-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: var(--space-1);
  padding: 3px;
  margin-bottom: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.role-modal-tab {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.role-modal-tab.active {
  background: var(--brand);
  color: var(--primary-ink);
}

.role-modal-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding-right: var(--space-1);
}

.role-modal-panel {
  display: none;
}

.role-modal-panel.active {
  display: grid;
}

.role-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.role-preset-card {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--section-head);
}

.role-preset-date-wrap {
  align-content: start;
}

.role-preset-fixed-date[hidden] {
  display: none;
}

.user-access-panel {
  width: min(1040px, calc(100vw - 32px));
  max-height: min(860px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.user-access-grid {
  display: grid;
  gap: var(--space-4);
  overflow: auto;
  padding-right: var(--space-1);
}

.user-access-section {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--section-head);
}

.section-title.compact {
  font-size: var(--text-ui);
}

.user-access-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) minmax(260px, 1fr);
  gap: var(--space-3);
}

.user-access-fields label,
.account-preset-field-wrap {
  display: grid;
  gap: var(--space-1);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 700;
}

.user-access-fields .multi-select,
.user-access-fields .multi-select-toggle,
.account-preset-field-wrap .multi-select,
.account-preset-field-wrap .multi-select-toggle {
  width: 100%;
}

.user-access-override-toggle {
  justify-content: flex-start;
}

.user-access-permission-tree {
  max-height: 300px;
  background: var(--panel);
}

.account-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.account-preset-card {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.account-preset-title {
  color: var(--ink-strong);
  font-weight: 800;
}

.account-preset-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.role-edit-fields {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.role-edit-fields label {
  display: grid;
  gap: var(--space-1);
  color: var(--muted);
  font-size: var(--text-caption);
}

.permission-tree {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--space-3);
  overflow: auto;
  max-height: 54vh;
  background: var(--section-head);
}

.permission-tree.readonly {
  opacity: 0.86;
}

.permission-tree-group {
  border-bottom: 1px solid var(--line-soft);
  padding: var(--space-2) 0;
}

.permission-tree-group:last-child {
  border-bottom: 0;
}

.permission-tree-group summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: 700;
}

.permission-tree-children {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: var(--space-2);
  padding: var(--space-2) 0 0 24px;
}

.permission-leaf {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 34px;
}

@media (max-width: 980px) {
  .dashboard-shortcut-grid,
  .dashboard-main-grid,
  .dashboard-pie-grid,
  .dashboard-pie-wrap,
  .dashboard-config-columns,
  .role-edit-fields,
  .user-access-fields,
  .role-preset-grid,
  .account-preset-grid,
  .account-preset-fields {
    grid-template-columns: 1fr;
  }

  .dashboard-feature-options,
  .permission-tree-children {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .role-create-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dashboard-feature-options,
  .permission-tree-children {
    grid-template-columns: 1fr;
  }

  .dashboard-date-controls {
    justify-content: stretch;
  }

  .dashboard-date-controls .control {
    width: 100%;
  }

  .user-admin-actions {
    justify-content: flex-start;
  }

  .dashboard-trend-chart {
    height: 220px;
  }

  .dashboard-current-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .dashboard-current-meta {
    display: grid;
    gap: 4px;
  }

  .dashboard-current-meta span {
    max-width: 100%;
  }

  .dashboard-pie-wrap {
    justify-items: center;
    width: 100%;
  }

  .dashboard-pie-legend {
    align-items: center;
  }
}

/* Operation Logs */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line-soft);
  background: var(--section-head);
  flex-wrap: wrap;
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted);
  font-size: var(--text-caption);
  white-space: nowrap;
}

.pagination-info .control {
  width: auto;
  min-width: 96px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.pagination-btn {
  min-width: 36px;
}

.operation-log-table th,
.operation-log-table td {
  min-width: 100px;
  vertical-align: top;
}

.operation-log-table :is(th, td):nth-child(1) { min-width: 110px; }
.operation-log-table :is(th, td):nth-child(2) { min-width: 120px; }
.operation-log-table :is(th, td):nth-child(3) { min-width: 140px; }

.operation-log-table :is(th, td):nth-child(4) {
  min-width: 480px;
  max-width: 620px;
  overflow: visible;
  text-align: left !important;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.operation-log-table td:nth-child(4) {
  line-height: 1.45;
}

.operation-log-table :is(th, td):nth-child(5) { min-width: 84px; }

.operation-log-table :is(th, td):nth-child(6) {
  min-width: 160px;
}

@media (max-width: 820px) {
  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
  .pagination-controls {
    justify-content: center;
  }
}

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

/* 档案页去除重复说明后，筛选与操作保持为紧凑、可换行的独立工具栏。 */
.profile-toolbar {
  justify-content: flex-start;
  min-height: 0;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line-soft);
  background: var(--section-head);
}

.teacher-salary-rule-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--line-soft);
}

.teacher-salary-rule-actions .section-subtitle {
  margin: 0;
}

.teacher-salary-rule-toolbar {
  align-items: flex-end;
  gap: 8px;
}

.teacher-salary-rule-toolbar .filter-controls {
  flex: 1 1 280px;
  flex-wrap: nowrap;
  gap: 8px;
}

.teacher-salary-rule-toolbar .unified-filter-field {
  flex: 1 1 96px;
  min-width: 88px;
  max-width: 120px;
}

.teacher-salary-rule-toolbar .filter-combo-input,
.teacher-salary-rule-toolbar .control,
.teacher-salary-rule-toolbar .btn {
  min-height: 38px;
  height: 38px;
}

.teacher-salary-rule-toolbar > :is(.history-toggle, .filter-summary, .teacher-salary-rule-toolbar-actions) {
  min-height: 38px;
  align-self: flex-end;
}

.teacher-salary-rule-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  white-space: nowrap;
}

.teacher-salary-rule-toolbar-actions .btn {
  padding-inline: 6px;
}

.teacher-salary-rule-toolbar > :is(.history-toggle, .filter-summary),
.teacher-salary-rule-toolbar-actions {
  font-size: 12px;
}

.batch-selection-summary {
  color: var(--muted);
  font-size: var(--text-ui);
  white-space: nowrap;
}

.batch-pricing-modal-panel {
  width: min(460px, calc(100vw - 32px));
}

.batch-pricing-result:not(:empty) {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--ink);
  font-size: var(--text-caption);
}

@media (max-width: 760px) {
  .teacher-salary-rule-toolbar .filter-controls {
    flex-wrap: wrap;
  }

  .teacher-salary-rule-toolbar-actions {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .teacher-salary-rule-toolbar-actions .btn {
    flex: 1 1 0;
  }

  .pricing-batch-actions .batch-selection-summary {
    flex-basis: 100%;
  }
}

/* 2026-07 table-cell pass: each wide value remains intact and only the
   page-scoped outer table wrapper owns horizontal scrolling. */
.fee-detail-table:not(.student-query-detail-table) :is(th, td):nth-child(6) {
  width: 128px;
  min-width: 128px;
  max-width: 128px;
  overflow: visible;
  text-align: center !important;
  text-overflow: clip;
  vertical-align: middle;
  white-space: nowrap;
}

.fee-detail-table col.fee-detail-col-time {
  width: 128px;
}

.recharge-page .recharge-table :is(th, td) {
  overflow: visible;
  text-overflow: clip;
}

.recharge-page .recharge-channel-cell {
  position: relative;
  max-width: none;
  padding: 5px 8px;
  overflow: visible;
  text-align: center !important;
  text-overflow: clip;
  white-space: nowrap;
}

.recharge-page .recharge-channel-cell[data-channel-editable="1"] {
  cursor: pointer;
}

.recharge-page .recharge-channel-cell[data-channel-editable="1"]:hover,
.recharge-page .recharge-channel-cell.is-open {
  background: var(--surface-hover);
}

.recharge-page .recharge-channel-cell[data-channel-editable="1"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.recharge-channel-value {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--section-head);
  color: var(--ink);
  font-weight: 700;
}

.recharge-channel-cell.is-unrecorded .recharge-channel-value {
  color: var(--muted);
  font-weight: 650;
}

.recharge-channel-saving {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 700ms linear infinite;
}

.recharge-channel-saving[hidden] {
  display: none;
}

.recharge-channel-overlay {
  width: min(320px, calc(100vw - 16px));
  max-height: min(420px, calc(100vh - 16px));
  overflow-x: hidden;
  overflow-y: auto;
}

.recharge-channel-overlay .recharge-channel-option {
  min-height: 38px;
}

.recharge-channel-other-editor {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding: 10px;
  border-top: 1px solid var(--line-soft);
}

.recharge-channel-other-editor[hidden] {
  display: none;
}

.recharge-channel-other-editor label {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 750;
}

.recharge-channel-other-input {
  width: 100%;
  min-width: 0;
}

.recharge-channel-error {
  min-height: 18px;
  color: var(--danger);
  font-size: var(--text-caption);
}

.recharge-channel-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.recharge-page .recharge-notes-cell,
.recharge-page .recharge-notes-cell .cell-input {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.student-pricing-page .table-wrap,
.recharge-page .table-wrap,
.opening-balance-page .table-wrap,
.fee-detail-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.teacher-rule-salary-cell {
  min-width: 180px;
  max-width: 260px;
  white-space: normal !important;
  vertical-align: top;
}

.teacher-rule-result {
  display: grid;
  justify-items: end;
  gap: 3px;
  line-height: 1.35;
}

.teacher-rule-result strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.teacher-rule-result small {
  max-width: 230px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  text-align: right;
}

.teacher-rule-result.matched strong {
  color: var(--success);
}

.teacher-rule-match-details {
  max-width: 240px;
  font-family: var(--font-sans);
  text-align: left;
}

.teacher-rule-match-details summary {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
}

.teacher-rule-match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.teacher-rule-match-grid span {
  display: grid;
  gap: 1px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.7rem;
}

.teacher-rule-match-grid b {
  color: var(--muted);
  font-weight: 600;
}

.teacher-salary-rule-table :is(th, td):nth-child(6),
.teacher-salary-rule-table :is(th, td):nth-child(7) {
  text-align: center !important;
}

.teacher-salary-rule-table :is(th, td):nth-child(8) {
  min-width: 150px;
  max-width: 280px;
  text-align: left !important;
}

.teacher-salary-rule-table td:nth-child(8) .cell-input {
  text-align: left;
}

@media (max-width: 480px) {
  .teacher-rule-salary-cell {
    min-width: 160px;
  }

  .teacher-rule-match-grid {
    grid-template-columns: 1fr;
  }
}

/* 首页内容量较小时不再保留过高卡片或趋势空白，仍保留可点击面积。 */
.dashboard-page {
  gap: var(--space-3);
}

.dashboard-page .section-head {
  min-height: 46px;
  padding: 10px var(--space-4);
}

.dashboard-shortcut-grid {
  gap: 10px;
}

.dashboard-shortcut {
  min-height: 68px;
  padding: 9px 10px;
  gap: 5px;
}

.dashboard-shortcut svg {
  width: 20px;
  height: 20px;
}

.dashboard-main-grid {
  gap: var(--space-3);
}

.dashboard-todo-item {
  min-height: 46px;
  padding: 9px 12px;
}

.dashboard-current-item {
  min-height: 52px;
  padding: 10px 12px;
}

.dashboard-current-empty {
  min-height: 96px;
}

.dashboard-trend-chart {
  height: 196px;
}

.dashboard-empty-chart {
  min-height: 120px;
}

.dashboard-pie-wrap {
  min-height: 188px;
}

@media (max-width: 980px) {
  .dashboard-shortcut-grid,
  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .profile-toolbar,
  .teacher-salary-rule-actions {
    align-items: flex-start;
  }

  .profile-toolbar .profile-search {
    min-width: min(240px, 100%);
  }
}

@media (max-width: 640px) {
  .dashboard-trend-chart {
    height: 188px;
  }

  .dashboard-empty-chart {
    min-height: 108px;
  }
}

/* 黑白主题保持中性黑白，同时把正文、表头、筛选和占位文字拉回可读对比度。 */
:root[data-palette="black-white"] {
  --ink: #000000;
  --text: #000000;
  --ink-strong: #000000;
  --muted: #525252;
  --sidebar-ink: #000000;
  --sidebar-text: #000000;
  --sidebar-muted: #525252;
  --table-head-ink: #000000;
  --neutral-chip-fg: #0d0d0d;
  --manual-fg: #0d0d0d;
  --group-fg: #0d0d0d;
  --warn-fg: #0d0d0d;
  --warn-pill-fg: #0d0d0d;
  --success: #0d0d0d;
  --info: #0d0d0d;
  --warning: #0d0d0d;
  --shot-title: #000000;
  --shot-muted: #525252;
  --shot-tag-text: #000000;
}

:root[data-palette="black-white"] :is(.control, .cell-input, .cell-select)::placeholder {
  color: var(--muted);
  opacity: 1;
}

:root[data-theme="dark"][data-palette="black-white"] {
  --ink: #ffffff;
  --text: #ffffff;
  --ink-strong: #ffffff;
  --muted: #b4b4b4;
  --sidebar-ink: #ffffff;
  --sidebar-text: #ffffff;
  --sidebar-muted: #b4b4b4;
  --table-head-ink: #ffffff;
  --neutral-chip-fg: #ffffff;
  --manual-fg: #ffffff;
  --group-fg: #ffffff;
  --warn-fg: #ffffff;
  --warn-pill-fg: #ffffff;
  --success: #ffffff;
  --info: #ffffff;
  --warning: #ffffff;
  --shot-title: #ffffff;
  --shot-muted: #b4b4b4;
  --shot-tag-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"][data-palette="black-white"] {
    --ink: #ffffff;
    --text: #ffffff;
    --ink-strong: #ffffff;
    --muted: #b4b4b4;
    --sidebar-ink: #ffffff;
    --sidebar-text: #ffffff;
    --sidebar-muted: #b4b4b4;
    --table-head-ink: #ffffff;
    --neutral-chip-fg: #ffffff;
    --manual-fg: #ffffff;
    --group-fg: #ffffff;
    --warn-fg: #ffffff;
    --warn-pill-fg: #ffffff;
    --success: #ffffff;
    --info: #ffffff;
    --warning: #ffffff;
    --shot-title: #ffffff;
    --shot-muted: #b4b4b4;
    --shot-tag-text: #ffffff;
  }
}
.money-input::-webkit-outer-spin-button,
.money-input::-webkit-inner-spin-button,
.currency-input::-webkit-outer-spin-button,
.currency-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.money-input,
.currency-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.grade-badge,
.subject-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--badge-fg) 18%, transparent);
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-size: var(--text-caption);
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}

.color-config-card-inline {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.filter-combo-count {
  display: block;
  padding: 5px 10px 3px;
  color: var(--muted);
  font-size: var(--text-caption);
  pointer-events: none;
}

.filter-combo-option .student-badge,
.filter-combo-option .grade-badge,
.filter-combo-option .subject-badge,
.filter-combo-option .status-badge {
  pointer-events: none;
}

/* The management console intentionally uses immediate state changes rather than motion. */
*,
*::before,
*::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html {
  scroll-behavior: auto;
}

/* Keep the complete student badge row visible; only the table wrapper scrolls. */
.course-table.lesson-table col.col-students,
.course-table.lesson-table :is(th, td).col-students {
  min-width: var(--lesson-student-column-width, 300px) !important;
  max-width: none !important;
}

.course-table.lesson-table .lesson-schedule-student-field {
  padding: 0;
}

/* Conflict warnings are a narrow red cue, never a status-driven row fill. */
.course-table tr.has-warnings {
  background: transparent;
  box-shadow: inset 3px 0 0 var(--danger);
}

.course-table tr.has-warnings > td {
  background: transparent;
}

/* Shared entity badge contract: every colored entity stays compact and inline. */
.entity-badge,
.student-badge,
.grade-badge,
.subject-badge,
.status-badge {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: start;
  min-height: 24px;
  height: 24px;
  max-height: 24px;
  max-width: 100%;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  background: var(--badge-bg, var(--neutral-chip-bg)) !important;
  color: var(--badge-fg, var(--neutral-chip-fg)) !important;
  font-family: inherit;
  font-size: var(--text-caption);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  vertical-align: middle;
}

.student-badge > span:first-child {
  min-width: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}

.student-badge-removable {
  gap: 5px;
}

.student-badge-remove {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}

/* The student editor reserves five compact candidate rows and keeps its shell static. */
.schedule-student-menu {
  width: min(400px, calc(100vw - 24px));
  grid-template-rows: auto auto 210px auto auto;
  gap: 7px !important;
  overflow: hidden !important;
}

.schedule-student-selected {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 5px;
  max-height: 72px;
  overflow: hidden;
  padding: 0;
  border: 0;
}

.schedule-student-options {
  height: 210px;
  min-height: 210px;
  max-height: 210px;
  overflow-y: auto;
  overflow-x: hidden;
}

.lesson-student-picker-list .multi-select-option {
  min-height: 38px;
  height: 38px;
  padding: 5px 8px;
}

.schedule-student-new-names {
  min-height: 46px;
  height: 46px;
  resize: none;
}

.multi-select-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.multi-select-search-row .multi-select-search {
  margin: 0;
}

.multi-select-search-clear {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.multi-select-result-count {
  display: block;
  padding: 1px 4px;
  color: var(--muted);
  font-size: var(--text-caption);
}

/* The app shell owns viewport height; sidebar and main content scroll independently. */
html,
body {
  height: 100%;
  overflow: hidden;
}

#app {
  height: 100dvh;
  min-height: 0;
}

.main {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.content {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

@media (min-width: 641px) {
  .sidebar {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  #nav {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }
}

/* Date ranges have fixed intrinsic room for both ISO dates and the calendar icon. */
.date-range-picker,
.date-range-trigger {
  min-width: 282px;
}

.date-range-picker {
  flex: 0 0 282px;
  max-width: 100%;
}

.date-range-text {
  grid-template-columns: 86px 18px 86px;
  gap: 5px;
  min-width: 190px;
}

.date-range-part {
  min-width: 86px;
  overflow: visible;
  text-overflow: clip;
}

.lesson-filter-top .date-range-picker,
.lesson-filter-top .date-range-trigger {
  width: 282px;
  min-width: 282px;
}

.lesson-date-filter-group .filter-date-range {
  flex: 0 0 282px;
}

@media (max-width: 640px) {
  .date-range-picker,
  .date-range-trigger,
  .lesson-filter-top .date-range-picker,
  .lesson-filter-top .date-range-trigger {
    width: 100%;
    min-width: 282px;
  }

  .lesson-date-filter-group .filter-date-range {
    flex-basis: 282px;
  }
}

/* Search results must disappear even when option components define display. */
.multi-select-option[hidden],
.filter-combo-option[hidden],
.custom-select-option[hidden],
.multi-select-empty[hidden],
.filter-combo-empty[hidden],
.custom-select-empty[hidden] {
  display: none !important;
}

.entity-badge-list {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}

.operation-result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-caption);
  font-weight: 700;
  white-space: nowrap;
}

.operation-result-badge.success {
  background: var(--success-bg);
  color: var(--success);
}

.operation-result-badge.failure {
  background: var(--danger-bg);
  color: var(--danger);
}

.operation-log-table :is(th, td):nth-child(4) {
  min-width: 280px;
  max-width: 520px;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-align: left;
}

/* Notes are body copy; only the column heading stays centered. */
.course-table.lesson-table th.col-note {
  text-align: center !important;
}

.course-table.lesson-table td.col-note,
.course-table.lesson-table td.col-note .lesson-cell-text {
  text-align: left !important;
  white-space: normal !important;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
}

.course-table.lesson-table td.col-note .cell-input {
  text-align: left !important;
}

.course-table.lesson-table td.col-note .lesson-note-input {
  height: auto;
  min-height: 34px;
  max-height: 108px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  resize: none;
}

.course-table.lesson-table :is(td.col-status, td.col-status .custom-select-value) .status-badge {
  min-width: 0;
  min-height: 24px;
  height: 24px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--badge-fg) 18%, transparent);
  border-radius: 999px;
  background: var(--badge-bg, var(--neutral-chip-bg)) !important;
  color: var(--badge-fg, var(--neutral-chip-fg)) !important;
  box-shadow: none;
}

/* Time and classroom are plain compact selectors; semantic badges stay on the
   status, grade, subject and student fields. */
.course-table.lesson-table.is-editing :is(td.col-time, td.col-room) .custom-select-cell {
  display: inline-flex;
  width: auto;
  min-width: 0;
  max-width: 100%;
}

.course-table.lesson-table.is-editing :is(td.col-time, td.col-room) .custom-select-button {
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 24px;
  height: 24px;
  padding: 0 18px 0 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink);
  font-size: var(--text-table);
  font-weight: 400;
  text-align: left;
}

.course-table.lesson-table.is-editing :is(td.col-time, td.col-room) .custom-select-value {
  display: inline-block;
  overflow: visible;
  text-overflow: clip;
}

.course-table.lesson-table.is-editing :is(td.col-time, td.col-room) .custom-select-arrow {
  right: 0;
}

/* The first course-filter row has explicit intrinsic room for shortcuts, two
   complete ISO dates, teacher and student controls. */
.lesson-filter-top .filter-controls {
  grid-template-columns: minmax(300px, 1.6fr) 282px minmax(150px, .75fr) minmax(220px, 1fr);
}

.lesson-date-filter-group {
  grid-template-columns: minmax(300px, 1fr) 282px;
}

@media (max-width: 1320px) {
  .lesson-filter-top .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-date-filter-group {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .lesson-filter-top .filter-controls,
  .lesson-date-filter-group {
    grid-template-columns: minmax(0, 1fr);
  }

  .lesson-date-filter-group {
    grid-column: auto;
  }
}

/* 2026-07-14: keep the two population charts in the useful upper-right area.
   Grid areas only reposition existing DOM; no chart or request is duplicated. */
.dashboard-main-grid {
  grid-template-columns: minmax(220px, .65fr) minmax(360px, 1.1fr) minmax(480px, 1.35fr);
  grid-template-areas:
    "todo trend pies"
    "current current current";
  align-items: stretch;
}

.dashboard-todo-section { grid-area: todo; }
.dashboard-trend-section { grid-area: trend; }
.dashboard-current-section { grid-area: current; }
.dashboard-pie-section {
  grid-area: pies;
  grid-column: auto;
}

.dashboard-pie-section .section-head {
  min-height: 42px;
}

.dashboard-pie-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-pie-card {
  gap: 6px;
  padding: 8px;
}

.dashboard-pie-card-head {
  gap: 6px;
  font-size: var(--text-caption);
}

.dashboard-pie-wrap {
  grid-template-columns: 112px minmax(74px, 1fr);
  gap: 7px;
  justify-content: stretch;
  width: 100%;
  min-height: 132px;
  margin: 0;
  padding: 0;
}

.dashboard-pie-svg {
  width: 112px;
  height: 112px;
}

.dashboard-pie-legend {
  gap: 4px;
  align-items: stretch;
}

.dashboard-legend-item {
  width: 100%;
  padding: 4px 6px;
  gap: 5px;
}

.dashboard-legend-item span {
  width: 9px;
  height: 9px;
}

.dashboard-legend-copy {
  justify-content: space-between;
  width: 100%;
  gap: 5px;
  font-size: 11px;
}

@media (max-width: 1280px) {
  .dashboard-main-grid {
    grid-template-columns: minmax(230px, .7fr) minmax(500px, 1.3fr);
    grid-template-areas:
      "todo pies"
      "trend trend"
      "current current";
  }
}

@media (max-width: 980px) {
  .dashboard-main-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "todo"
      "pies"
      "trend"
      "current";
  }

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

@media (max-width: 640px) {
  .dashboard-pie-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-pie-wrap {
    grid-template-columns: 124px minmax(110px, 1fr);
  }

  .dashboard-pie-svg {
    width: 124px;
    height: 124px;
  }
}

/* Current-lessons cards favor stable information blocks over one crowded line. */
.dashboard-current-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 9px;
  min-height: 112px;
  padding: 11px 12px;
}

.dashboard-current-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.dashboard-current-top strong,
.dashboard-current-top span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-current-top strong {
  color: var(--ink-strong);
  font-size: var(--text-body);
}

.dashboard-current-top span {
  color: var(--muted);
  font-family: var(--font-number);
  font-size: var(--text-caption);
}

.dashboard-current-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
}

.dashboard-current-fact {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 28px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  background: var(--section-head);
}

.dashboard-current-fact em,
.dashboard-current-students > em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--text-caption);
  font-style: normal;
}

.dashboard-current-fact b {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-current-fact :is(.entity-badge, .status-badge) {
  min-width: 0;
  max-width: 100%;
}

.dashboard-current-students {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.dashboard-current-students .entity-badge-list {
  display: inline-flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.dashboard-current-more {
  color: var(--muted);
  font-size: var(--text-caption);
  white-space: nowrap;
}

.opening-balance-notes-input {
  display: block;
  width: 100%;
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  white-space: nowrap;
}

.opening-balance-page input[type="number"],
.opening-balance-modal input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

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

@media (max-width: 640px) {
  .dashboard-current-item {
    min-height: 136px;
  }

  .dashboard-current-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

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

/* Course filters share one stable toggle + floating searchable menu. */
.lesson-filter-top .multi-select,
.lesson-filter-top .multi-select-toggle {
  width: 100%;
  min-width: 0;
}

.multi-select-menu.floating-multi-select-menu {
  overflow-x: hidden;
  overflow-y: auto;
}

.multi-select-menu.floating-multi-select-menu .multi-select-search-row {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 5px;
  background: var(--panel-raised);
}

.multi-select-menu.floating-multi-select-menu .multi-select-result-count {
  position: sticky;
  top: 38px;
  z-index: 1;
  background: var(--panel-raised);
}

.multi-select-option .classroom-badge,
.classroom-badge {
  --badge-bg: var(--neutral-chip-bg);
  --badge-fg: var(--neutral-chip-fg);
  pointer-events: none;
}

/* Candidate rows use one main value and exactly one right-side state chip. */
.custom-select-option.candidate-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.custom-select-candidate-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-candidate-state {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.custom-select-option.option-conflict .custom-select-candidate-state {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Schedule state is the same badge as browsing state; the wrapper stays clear. */
.course-table.lesson-table.is-editing td.col-status .custom-select-cell,
.course-table.lesson-table.is-editing td.col-status .custom-select-button,
.course-table.lesson-table.is-editing td.col-status .custom-select-value {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  height: 24px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.course-table.lesson-table.is-editing td.col-status .custom-select-button {
  width: auto;
  padding: 0 15px 0 0;
  border-radius: 999px;
}

.course-table.lesson-table.is-editing td.col-status .custom-select-arrow {
  right: 0;
}

/* Time and classroom conflicts use text-only red semantics without extra lines. */
.course-table.lesson-table.is-editing td.col-room .custom-select.candidate-conflict .custom-select-button {
  border: 0 !important;
  box-shadow: none !important;
  color: var(--danger);
}

.course-table.lesson-table.is-editing td.col-time .custom-select.candidate-conflict .custom-select-button {
  border: 0 !important;
  box-shadow: none !important;
  color: var(--danger);
}

/* Editable entity fields stay as content until clicked; the floating menu carries
   all search and selection affordances. */
.course-table.lesson-table.is-editing .custom-select-cell .custom-select-button,
.lesson-conflict-edit-panel .custom-select-button {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.course-table.lesson-table.is-editing .custom-select-cell .custom-select-arrow,
.course-table.lesson-table.is-editing .lesson-schedule-student-field .multi-select-caret,
.lesson-conflict-edit-panel .custom-select-arrow,
.lesson-conflict-edit-panel .multi-select-caret,
.lesson-conflict-edit-panel .multi-select-clear-icon {
  display: none !important;
}

.course-table.lesson-table.is-editing .custom-select-cell .custom-select-button,
.lesson-conflict-edit-panel .custom-select-button,
.lesson-conflict-edit-panel .multi-select-toggle {
  padding-right: 8px;
}

.lesson-conflict-edit-panel .multi-select-toggle {
  min-height: 38px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.lesson-conflict-edit-panel :is(.custom-select-button, .multi-select-toggle):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Student badges occupy the cell's vertical center and remain one complete line. */
.course-table.lesson-table td.lesson-schedule-students {
  vertical-align: middle !important;
}

.course-table.lesson-table .lesson-schedule-student-field {
  display: flex;
  align-items: center;
  min-height: 34px;
}

.course-table.lesson-table .schedule-student-badges {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  min-height: 24px;
  margin: 0;
  white-space: nowrap;
}

/* Browsing and scheduling share one table geometry; editing changes controls,
   never column widths, baseline, or normal-row height. */
.course-table.lesson-table thead th {
  height: 42px;
  padding-block: 6px !important;
  vertical-align: middle !important;
}

.course-table.lesson-table tbody tr:not(.schedule-add-row) > td {
  height: 44px;
  padding-block: 5px !important;
  vertical-align: middle !important;
}

.course-table.lesson-table.is-editing tbody td > :is(.cell-input, .custom-select-cell, .multi-select) {
  vertical-align: middle;
}

.course-table.lesson-table :is(th, td):is(.col-serial, .col-teacher, .col-date, .col-status, .col-weekday, .col-time, .col-room, .col-grade, .col-subject) {
  text-align: center !important;
}

.course-table.lesson-table td:not(.col-note) .lesson-cell-text {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
}

.course-table.lesson-table td.col-students .lesson-cell-text,
.course-table.lesson-table td.col-students .entity-badge-list,
.course-table.lesson-table .lesson-schedule-student-field,
.course-table.lesson-table .schedule-student-badges {
  min-height: 34px;
  flex-wrap: nowrap;
  align-items: center;
  white-space: nowrap;
}

.course-table.lesson-table :is(.col-teacher, .col-status, .col-time, .col-room, .col-grade, .col-subject) :is(.custom-select-button, .custom-select-value) {
  justify-content: center;
  text-align: center;
}

.course-table.lesson-table .lesson-select-cell,
.course-table.lesson-table .lesson-select-head {
  vertical-align: middle !important;
}

.course-table.lesson-table :is(.lesson-select-cell, .lesson-select-head) input[type="checkbox"] {
  display: block;
  margin: 0 auto;
}

/* Dashboard row one remains shortcuts. Wide screens use current/todo/population
   as equal-height columns, while trend owns the full third row. */
.dashboard-main-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "current todo pies"
    "trend trend trend";
  align-items: stretch;
}

.dashboard-main-grid > .band {
  margin-top: 0;
}

.dashboard-current-section { grid-area: current; }
.dashboard-todo-section { grid-area: todo; }
.dashboard-trend-section {
  grid-area: trend;
  grid-column: 1 / -1;
}

.dashboard-pie-section {
  grid-area: pies;
  grid-column: auto;
}

.dashboard-main-grid > :is(.dashboard-current-section, .dashboard-todo-section, .dashboard-pie-section) {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

.dashboard-main-grid > :is(.dashboard-current-section, .dashboard-todo-section, .dashboard-pie-section) > .section-head {
  flex: 0 0 59px;
  height: 59px;
  min-height: 59px;
  align-items: center;
}

.dashboard-current-list,
.dashboard-todo-list {
  flex: 1 1 auto;
  align-content: start;
}

.dashboard-current-empty {
  flex: 1 1 auto;
  min-height: 96px;
}

.dashboard-pie-grid {
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-pie-card {
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

.dashboard-pie-wrap {
  min-height: 0;
}

.dashboard-trend-section .section-title {
  white-space: nowrap;
}

.dashboard-date-controls,
.dashboard-date-controls .date-range-picker,
.dashboard-date-controls .date-range-trigger {
  min-width: 0;
}

.dashboard-date-controls .date-range-picker,
.dashboard-date-controls .date-range-trigger {
  width: 220px;
}

.dashboard-date-controls .date-range-picker {
  flex-basis: 220px;
}

.dashboard-date-controls .date-range-text,
.dashboard-date-controls .date-range-part {
  min-width: 0;
}

.dashboard-date-controls .date-range-text {
  font-size: 12px;
}

.dashboard-main-grid .dashboard-trend-chart {
  height: 180px;
}

/* Parent and teacher simple cards wrap whole student tags without splitting names. */
.notice-simple-tile .notice-simple-students.entity-badge-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 5px;
}

.notice-simple-tile .notice-simple-students .student-badge {
  flex: 0 0 auto;
  width: auto;
  min-width: max-content;
  height: auto;
  min-height: 24px;
  max-height: none;
  align-self: flex-start;
  padding: 4px 5px;
  overflow: visible;
  text-align: center;
  white-space: nowrap;
}

.notice-simple-tile .notice-simple-students .student-badge > span:first-child {
  overflow: visible;
  overflow-wrap: normal;
  text-overflow: clip;
  white-space: nowrap;
  word-break: normal;
}

.notice-simple-tile .notice-simple-students > .muted-tip {
  flex: 1 1 100%;
}

.dashboard-empty-chart {
  min-height: 96px;
}

.course-table.lesson-table.is-editing :is(td.col-status, td.col-time, td.col-room) > .custom-select-cell {
  display: block;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.course-table.lesson-table.is-editing :is(td.col-status, td.col-time, td.col-room) :is(.custom-select-button, .custom-select-value) {
  justify-content: center;
  text-align: center;
}

/* A schedule cell is static content until clicked.  The single, temporary
   custom-select anchor is invisible; its body-mounted menu owns editing. */
.course-table.lesson-table.is-editing td[data-lesson-edit-trigger] {
  cursor: pointer;
}

.course-table.lesson-table.is-editing td[data-lesson-edit-trigger]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: -2px;
}

.course-table.lesson-table.is-editing .lesson-inline-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-align: center;
  pointer-events: none;
}

.course-table.lesson-table.is-editing td.lesson-edit-cell[aria-disabled="true"] {
  cursor: default;
}

.course-table.lesson-table.is-editing .lesson-inline-picker .lesson-cell-text {
  width: 100%;
}

.course-table.lesson-table .candidate-conflict-text {
  color: var(--danger);
}

.course-table.lesson-table td {
  position: relative;
}

.schedule-inline-picker-anchor {
  position: absolute !important;
  inset: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.user-admin-panel:not(.role-admin-panel) .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  overscroll-behavior-inline: contain;
  scrollbar-gutter: auto;
}

.user-admin-panel:not(.role-admin-panel) .user-table {
  width: 100%;
  min-width: 1040px;
  table-layout: fixed;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.user-admin-panel:not(.role-admin-panel) .user-table col.user-col-username { width: 150px; }
.user-admin-panel:not(.role-admin-panel) .user-table col.user-col-display-name { width: 150px; }
.user-admin-panel:not(.role-admin-panel) .user-table col.user-col-role { width: 128px; }
.user-admin-panel:not(.role-admin-panel) .user-table col.user-col-teachers { width: 220px; }
.user-admin-panel:not(.role-admin-panel) .user-table col.user-col-status { width: 92px; }
.user-admin-panel:not(.role-admin-panel) .user-table col.user-col-password { width: 224px; }
.user-admin-panel:not(.role-admin-panel) .user-table col.user-col-delete { width: 76px; }

.user-admin-panel:not(.role-admin-panel) .user-table tr {
  border: 0;
}

.user-admin-panel:not(.role-admin-panel) .user-table :is(th, td) {
  box-sizing: border-box;
  min-width: 0;
  height: 44px;
  padding: 5px 7px;
  border-top: 0;
  border-left: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.user-admin-panel:not(.role-admin-panel) .user-table :is(th, td):last-child {
  border-right: 0;
}

.user-admin-panel:not(.role-admin-panel) .user-table tbody tr:last-child td {
  border-bottom: 0;
}

.user-admin-panel:not(.role-admin-panel) .user-table :is(.cell-input, .cell-select, .control) {
  width: 100%;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  margin: 0;
  border-color: transparent;
  background-color: transparent;
  box-shadow: none;
}

.user-admin-panel:not(.role-admin-panel) .user-table :is(.cell-input, .cell-select, .control):focus {
  border-color: var(--accent);
  background-color: var(--input-bg);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.user-admin-panel:not(.role-admin-panel) .user-table .multi-select,
.user-admin-panel:not(.role-admin-panel) .user-table .custom-select,
.user-admin-panel:not(.role-admin-panel) .user-table .custom-select-button {
  width: 100%;
  min-width: 0;
}

.user-admin-panel:not(.role-admin-panel) .user-table .custom-select-inline-status,
.user-admin-panel:not(.role-admin-panel) .user-table .custom-select-inline-status .custom-select-button {
  width: auto;
}

.user-admin-panel:not(.role-admin-panel) .user-reset-password-inline {
  width: 100%;
}

.user-admin-panel:not(.role-admin-panel) .user-reset-password-inline .user-reset-password-value {
  flex: 1 1 auto;
}

.user-admin-panel:not(.role-admin-panel) .user-reset-password-inline .btn {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .dashboard-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "current todo"
      "pies pies"
      "trend trend";
  }

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

@media (max-width: 760px) {
  .dashboard-main-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "current"
      "todo"
      "pies"
      "trend";
  }
}

/* The tallest natural side card defines the desktop row; live lessons scroll inside it. */
.dashboard-main-grid > :is(.dashboard-current-section, .dashboard-todo-section, .dashboard-pie-section) {
  height: 100%;
  min-height: 0;
  max-height: none;
  align-self: stretch;
}

.dashboard-current-section {
  min-height: 0;
  contain: size;
  overflow: hidden;
}

.dashboard-pie-section,
.dashboard-todo-section {
  align-self: stretch;
}

.student-query-detail-table.uniform-table tbody tr > td,
.student-query-detail-table.uniform-table tbody tr:is(.abnormal, .exam-row, .receivable) > td {
  background: var(--panel);
  color: var(--ink);
  font-weight: inherit;
}

.student-query-detail-table.uniform-table tbody tr:hover > td,
.student-query-detail-table.uniform-table tbody tr:is(.abnormal, .exam-row, .receivable):hover > td {
  background: var(--surface-hover);
}

.student-pricing-table .student-pricing-value-cell,
.student-pricing-table .student-pricing-value-cell .currency-input-wrap,
.student-pricing-table .student-pricing-value-cell .student-pricing-field {
  background: var(--panel);
}

.student-pricing-table .student-pricing-field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.student-pricing-table .student-pricing-field[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.dashboard-current-viewport {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dashboard-current-list {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding-right: 3px;
}

.dashboard-current-empty {
  width: 100%;
  min-height: 0;
}

@media (max-width: 760px) {
  .dashboard-main-grid > .dashboard-current-section {
    height: auto;
    min-height: 0;
    max-height: none;
    contain: none;
    overflow: visible;
  }

  .dashboard-main-grid > :is(.dashboard-todo-section, .dashboard-pie-section) {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .dashboard-current-viewport,
  .dashboard-current-list {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .dashboard-pie-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
}

/* Student profile conflict check: always visible and isolated from other pages. */
.student-stage-conflict-check.loading {
  border-color: var(--line);
  background: var(--section-head);
}

.student-stage-conflict-check.success {
  border-color: color-mix(in srgb, var(--success) 45%, var(--line));
  background: color-mix(in srgb, var(--success-bg) 72%, var(--panel));
}

.student-stage-conflict-check.success .student-stage-conflict-icon {
  background: var(--success);
}

.student-stage-conflict-check.error,
.student-stage-conflict-check.warning {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.student-stage-conflict-check.loading .student-stage-conflict-icon {
  background: var(--muted);
}

.student-stage-conflict-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Student profile table alignment only; shared entity badges remain unchanged. */
.student-profile-table col.student-profile-col-name {
  width: 104px;
}

.profile-table.student-profile-table.uniform-table th.student-name-head,
.profile-table.student-profile-table.uniform-table td.student-name-cell {
  text-align: center !important;
  vertical-align: middle !important;
  white-space: normal;
}

.student-profile-table .student-name-with-conflict {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.student-profile-table .student-name-with-conflict .student-badge {
  flex: 0 1 auto;
  justify-self: center;
  min-width: 0;
  height: auto;
  max-height: none;
  white-space: normal;
  overflow: visible;
}

.student-profile-table .student-name-with-conflict .student-badge > span:first-child {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.profile-table.student-profile-table.uniform-table :is(th, td).profile-notes-col {
  text-align: left !important;
}

@media (max-width: 640px) {
  .student-stage-conflict-check {
    align-items: stretch;
    flex-direction: column;
  }

  .student-stage-conflict-check > .student-stage-conflict-actions,
  .student-stage-conflict-check > .student-stage-conflict-refresh {
    align-self: flex-start;
  }
}

/* Semantic column definitions keep short fields compact while bounded long
   fields absorb free space and wrap. Widths are written after each render by
   applyAdaptiveTableColumns(); only the outer table wrapper scrolls. */
:is(
  .recharge-page,
  .opening-balance-page,
  .student-pricing-page,
  .class-group-page,
  .teacher-salary-rule-page,
  .profile-panel,
  .user-admin-panel
) .table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  contain: layout paint;
  overflow-x: auto;
  overflow-y: auto;
  resize: none;
}

table.adaptive-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

table.adaptive-table :is(th, td) {
  box-sizing: border-box;
  max-width: none;
  overflow: hidden;
  text-overflow: clip;
  vertical-align: middle;
  white-space: nowrap;
}

:is(.profile-panel, .user-admin-panel) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

table.adaptive-table :is(th, td).adaptive-wrap {
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

table.adaptive-table [data-adaptive-alignment="left"] {
  text-align: left !important;
}

table.adaptive-table [data-adaptive-alignment="center"] {
  text-align: center !important;
}

table.adaptive-table [data-adaptive-alignment="right"] {
  text-align: right !important;
}

table.adaptive-table td[data-adaptive-alignment="center"] > :is(input, select, textarea) {
  text-align: center !important;
}

:is(
  .recharge-page,
  .opening-balance-page,
  .student-pricing-page,
  .class-group-page,
  .teacher-salary-rule-page
) table.uniform-table.adaptive-table.nowrap-table thead tr > th,
:is(
  .recharge-page,
  .opening-balance-page,
  .student-pricing-page,
  .class-group-page,
  .teacher-salary-rule-page
) table.uniform-table.adaptive-table.nowrap-table thead tr > th.wide {
  min-width: 0;
  max-width: none;
  text-align: center !important;
  vertical-align: middle;
  white-space: nowrap;
}

:is(
  .recharge-page,
  .opening-balance-page,
  .student-pricing-page,
  .class-group-page,
  .teacher-salary-rule-page
) table.uniform-table.adaptive-table td.adaptive-center {
  text-align: center !important;
}

:is(
  .recharge-page,
  .opening-balance-page,
  .student-pricing-page,
  .class-group-page,
  .teacher-salary-rule-page
) table.uniform-table.adaptive-table td.adaptive-right {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

:is(
  .recharge-page,
  .opening-balance-page,
  .student-pricing-page,
  .class-group-page,
  .teacher-salary-rule-page
) table.uniform-table.adaptive-table td.adaptive-left {
  text-align: left !important;
}

table.adaptive-table td.wide,
table.adaptive-table td.adaptive-left,
table.adaptive-table td.adaptive-right {
  min-width: 0;
  max-width: none;
}

table.adaptive-table .select-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-right: 4px;
  padding-left: 4px;
  text-align: center !important;
}

table.adaptive-table .select-col input[type="checkbox"],
table.adaptive-table .teacher-salary-rule-active {
  display: block;
  margin: 0 auto;
}

table.adaptive-table .adaptive-right :is(.cell-input, .currency-input) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

table.adaptive-table .adaptive-right .currency-display {
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

table.adaptive-table .adaptive-center > :is(.entity-badge, .student-badge, .recharge-channel-value) {
  margin-right: auto;
  margin-left: auto;
}

table.adaptive-table .adaptive-left > .cell-input {
  text-align: left !important;
}

table.adaptive-table .cell-input,
table.adaptive-table .currency-input-wrap,
table.adaptive-table .multi-select-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

table.adaptive-table .student-set-cell {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-align: left !important;
}

.student-set-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  vertical-align: middle;
  white-space: normal;
}

table.adaptive-table .student-set-badges .student-badge {
  flex: 0 0 auto;
  max-width: none;
  white-space: nowrap;
  overflow-wrap: normal;
}

.student-set-empty {
  color: var(--muted);
}

.recharge-page .recharge-channel-cell {
  text-align: center !important;
}

.opening-balance-table,
.opening-balance-col-notes,
.opening-balance-table :is(.opening-balance-notes-head, .opening-balance-notes-cell) {
  width: auto;
  min-width: 0;
  max-width: none;
}

.opening-balance-table :is(.opening-balance-notes-head, .opening-balance-notes-cell),
.opening-balance-notes-input {
  overflow: hidden;
  text-overflow: clip;
  white-space: normal;
}

table.adaptive-table .adaptive-textarea {
  box-sizing: border-box;
  min-height: 38px;
  height: auto;
  overflow-x: hidden;
  overflow-y: hidden;
  resize: none;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
  word-break: break-all !important;
}

.student-pricing-page table.adaptive-table .adaptive-textarea {
  field-sizing: content;
  min-height: 38px;
  max-height: 9rem;
  overflow-y: auto;
}

.student-pricing-render-progress {
  min-height: 24px;
  padding: 8px 4px 0;
  text-align: center;
}

table.adaptive-table :is(.entity-badge, .student-badge, .status-badge) {
  display: inline-flex;
  max-width: 100%;
  white-space: nowrap;
  word-break: keep-all;
}

table.adaptive-table :is(th, td).adaptive-wrap {
  white-space: normal !important;
}

.managed-file-browser-panel {
  box-sizing: border-box;
  width: min(1180px, calc(100vw - 32px));
  max-width: 1180px;
  max-height: min(820px, calc(100vh - 32px));
  overflow: auto;
}

.managed-file-browser-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.managed-file-browser-table-wrap {
  max-height: min(560px, calc(100vh - 270px));
  overflow: auto;
}

.managed-file-browser-table {
  min-width: 940px;
}

.managed-file-browser-table :is(th, td) {
  vertical-align: middle;
}

.managed-file-browser-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--panel);
}

.managed-file-name {
  font-weight: 700;
  white-space: nowrap;
}

.managed-file-relative-path {
  max-width: 320px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.managed-file-browser-state {
  display: flex;
  min-height: 160px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.managed-file-browser-state.danger {
  color: var(--danger);
}

@media (max-width: 640px) {
  .managed-file-browser-panel {
    width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 16px);
  }

  .managed-file-browser-toolbar {
    grid-template-columns: 1fr;
  }

  .managed-file-browser-toolbar .btn {
    width: 100%;
  }
}
