/* ==========================================================================
   Theme system — one shared layout, four visual templates
   ========================================================================== */

@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/press-start-2p-latin.woff2") format("woff2");
}

:root {
  --font-ui: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-mono: "Cascadia Mono", "Consolas", "Courier New", monospace;
  --font-pixel: "Press Start 2P", "Consolas", monospace;
  --heading-weight: 700;
  --title-tracking: 0.01em;
  --badge-radius: 6px;
  --brand-radius: 12px;
  --page-kicker-color: var(--accent);
  --selection: rgba(185, 123, 59, 0.22);

  --sidebar-w: 260px;
  --topbar-h: 60px;

  --body-art:
    radial-gradient(1200px 620px at 102% -10%, rgba(190, 151, 85, 0.14), transparent 64%),
    radial-gradient(900px 520px at -8% 18%, rgba(33, 75, 61, 0.07), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 34%);
  --body-art-size: auto;
}

/* --------------------------------------------------------------------------
   1. 暖纸书院
   -------------------------------------------------------------------------- */
:root,
html[data-theme="academy"] {
  color-scheme: light;

  --canvas: #f3efe5;
  --canvas-deep: #ece6da;
  --surface: #fdfbf5;
  --surface-2: #f7f1e6;
  --surface-raised: #fffdf8;
  --surface-sunken: #eee7d9;
  --text: #202a24;
  --text-soft: #405048;
  --text-muted: #6d786f;
  --text-faint: #919a91;
  --border: #e2dacb;
  --border-soft: #ece6da;
  --border-strong: #cec3af;
  --primary: #214b3d;
  --primary-hover: #173b2f;
  --on-primary: #fdfbf5;
  --primary-soft: #e7efe7;
  --primary-600: #2a5a47;
  --primary-700: #1b4032;
  --accent: #b97b3b;
  --accent-hover: #a4662e;
  --accent-soft: #f5e7d4;
  --on-accent: #281608;
  --success: #3f8a5f;
  --success-soft: #e4f1e7;
  --success-text: #2e6f49;
  --warning: #b87a2f;
  --warning-soft: #f7ecd8;
  --warning-text: #8a5818;
  --danger: #b75244;
  --danger-soft: #f7e5e0;
  --danger-text: #8f3c32;
  --info: #3d7893;
  --info-soft: #e5f0f4;
  --info-text: #2e6278;
  --math: #3c6d90;
  --english: #4f7c5b;
  --politics: #a36b35;
  --major: #765b91;

  --table-head: #f4eee3;
  --table-hover: #faf5ec;
  --control-bg: #fffdf8;
  --control-border: #ded5c5;
  --overlay: rgba(17, 25, 21, 0.45);
  --focus-ring: rgba(33, 75, 61, 0.45);

  --sidebar-bg:
    radial-gradient(460px 300px at 100% 0%, rgba(212, 177, 109, 0.10), transparent 70%),
    linear-gradient(168deg, #19342a 0%, #12261f 58%, #0e1f19 100%);
  --sidebar-text: #f1ecdc;
  --sidebar-muted: #9db0a2;
  --sidebar-active: #2a4a3b;
  --sidebar-active-text: #fffdf4;
  --sidebar-hover: rgba(255, 255, 255, 0.055);
  --sidebar-border: #0b1914;
  --sidebar-card: rgba(255, 255, 255, 0.055);
  --sidebar-accent: #d3b171;

  --topbar-bg: rgba(250, 247, 240, 0.88);
  --topbar-text: #394940;

  --brand-bg: linear-gradient(135deg, #ddc28a, #b78e4d);
  --brand-fg: #193128;
  --avatar-bg: #e5d8bd;
  --avatar-fg: #254236;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(48, 39, 24, 0.04);
  --shadow: 0 18px 40px -28px rgba(47, 38, 23, 0.34);
  --shadow-lg: 0 28px 70px -36px rgba(31, 26, 16, 0.42);

  --login-brand-bg: linear-gradient(155deg, #1b372c 0%, #12261f 50%, #2c3c2c 100%);
  --login-brand-text: #f7f1df;
  --login-brand-muted: #b5c1b2;
  --login-accent: #dfbb75;
  --login-panel: #f3efe5;

  --font-ui: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --heading-weight: 700;
  --title-tracking: 0.015em;

  --ink: var(--text);
  --ink-soft: var(--text-soft);
  --muted: var(--text-muted);
  --muted-light: var(--text-faint);
  --line: var(--border);
  --line-soft: var(--border-soft);
  --bg: var(--canvas);
  --card: var(--surface);
}

/* --------------------------------------------------------------------------
   2. 清岚教务
   -------------------------------------------------------------------------- */
html[data-theme="breeze"] {
  color-scheme: light;

  --canvas: #f3f7fc;
  --canvas-deep: #edf2f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-raised: #ffffff;
  --surface-sunken: #eef3fa;
  --text: #142033;
  --text-soft: #334155;
  --text-muted: #607089;
  --text-faint: #93a2b6;
  --border: #e2e8f0;
  --border-soft: #eef2f7;
  --border-strong: #cbd5e1;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --on-primary: #ffffff;
  --primary-soft: #e8efff;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --accent: #0f8f87;
  --accent-hover: #0b746e;
  --accent-soft: #e6f7f5;
  --on-accent: #ffffff;
  --success: #059669;
  --success-soft: #dff7ec;
  --success-text: #047857;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --warning-text: #b45309;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-text: #b91c1c;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --info-text: #0369a1;
  --math: #2563eb;
  --english: #059669;
  --politics: #d97706;
  --major: #7c3aed;

  --table-head: #f8fafc;
  --table-hover: #f7faff;
  --control-bg: #ffffff;
  --control-border: #dbe3ee;
  --overlay: rgba(15, 23, 42, 0.4);
  --focus-ring: rgba(29, 78, 216, 0.38);

  --sidebar-bg: linear-gradient(180deg, #fbfcfe 0%, #f4f7fc 100%);
  --sidebar-text: #203047;
  --sidebar-muted: #78879c;
  --sidebar-active: #e8efff;
  --sidebar-active-text: #1d4ed8;
  --sidebar-hover: #eff4fb;
  --sidebar-border: #e5ebf3;
  --sidebar-card: #f2f6fb;
  --sidebar-accent: #1d4ed8;

  --topbar-bg: rgba(255, 255, 255, 0.86);
  --topbar-text: #3a4a61;

  --brand-bg: linear-gradient(135deg, #3b82f6, #14b8a6);
  --brand-fg: #ffffff;
  --avatar-bg: #e8efff;
  --avatar-fg: #1d4ed8;

  --radius-sm: 9px;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 18px 40px -30px rgba(30, 58, 138, 0.28);
  --shadow-lg: 0 30px 70px -40px rgba(15, 23, 42, 0.36);

  --login-brand-bg: linear-gradient(155deg, #10245d 0%, #1d4ed8 55%, #0f8f87 120%);
  --login-brand-text: #ffffff;
  --login-brand-muted: #c8d8ff;
  --login-accent: #8ce9df;
  --login-panel: #f3f7fc;

  --body-art:
    radial-gradient(1000px 560px at 8% -8%, rgba(29, 78, 216, 0.09), transparent 62%),
    radial-gradient(920px 540px at 96% 0%, rgba(15, 143, 135, 0.07), transparent 58%),
    linear-gradient(180deg, #f7faff 0%, #f3f7fc 64%, #f7fafc 100%);
  --body-art-size: auto;

  --font-display: "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
  --heading-weight: 800;
  --title-tracking: -0.025em;

  --ink: var(--text);
  --ink-soft: var(--text-soft);
  --muted: var(--text-muted);
  --muted-light: var(--text-faint);
  --line: var(--border);
  --line-soft: var(--border-soft);
  --bg: var(--canvas);
  --card: var(--surface);
}

/* --------------------------------------------------------------------------
   3. 夜色控制台
   -------------------------------------------------------------------------- */
html[data-theme="midnight"] {
  color-scheme: dark;

  --canvas: #07101e;
  --canvas-deep: #050b15;
  --surface: #0d1828;
  --surface-2: #111f32;
  --surface-raised: #142437;
  --surface-sunken: #091321;
  --text: #e8eff8;
  --text-soft: #c3d2e4;
  --text-muted: #8fa2ba;
  --text-faint: #63768e;
  --border: #1d3048;
  --border-soft: #16263a;
  --border-strong: #2b445f;
  --primary: #58c7ef;
  --primary-hover: #7bd9f7;
  --on-primary: #06131b;
  --primary-soft: rgba(88, 199, 239, 0.12);
  --primary-600: #6dd5f7;
  --primary-700: #a0e9fc;
  --accent: #efc05d;
  --accent-hover: #f6d27e;
  --accent-soft: rgba(239, 192, 93, 0.12);
  --on-accent: #1b1304;
  --success: #63d69a;
  --success-soft: rgba(99, 214, 154, 0.13);
  --success-text: #8be7b5;
  --warning: #efc05d;
  --warning-soft: rgba(239, 192, 93, 0.14);
  --warning-text: #f5d788;
  --danger: #ff8c87;
  --danger-soft: rgba(255, 140, 135, 0.13);
  --danger-text: #ffafa9;
  --info: #70c9f2;
  --info-soft: rgba(112, 201, 242, 0.13);
  --info-text: #9bdcf8;
  --math: #7bb8ff;
  --english: #6fdaa0;
  --politics: #efc05d;
  --major: #bda1ff;

  --table-head: #0b1727;
  --table-hover: #122238;
  --control-bg: #0a1523;
  --control-border: #253a53;
  --overlay: rgba(2, 7, 14, 0.68);
  --focus-ring: rgba(109, 213, 247, 0.5);

  --sidebar-bg:
    radial-gradient(420px 300px at 100% 0%, rgba(88, 199, 239, 0.09), transparent 70%),
    linear-gradient(180deg, #060c15 0%, #091525 100%);
  --sidebar-text: #dbe8f5;
  --sidebar-muted: #73859d;
  --sidebar-active: rgba(88, 199, 239, 0.12);
  --sidebar-active-text: #8fe4ff;
  --sidebar-hover: rgba(255, 255, 255, 0.045);
  --sidebar-border: #02060c;
  --sidebar-card: rgba(255, 255, 255, 0.045);
  --sidebar-accent: #6dd5f7;

  --topbar-bg: rgba(7, 16, 30, 0.84);
  --topbar-text: #c2d3e5;

  --brand-bg: linear-gradient(135deg, #72dcff, #2f93bc);
  --brand-fg: #05121a;
  --avatar-bg: rgba(88, 199, 239, 0.16);
  --avatar-fg: #8fe4ff;

  --radius-sm: 8px;
  --radius: 13px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 20px 50px -32px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 34px 90px -42px rgba(0, 0, 0, 0.9);

  --login-brand-bg:
    radial-gradient(820px 500px at 20% 0%, rgba(88, 199, 239, 0.16), transparent 60%),
    linear-gradient(150deg, #081420 0%, #0b1b2d 55%, #142235 100%);
  --login-brand-text: #edf6ff;
  --login-brand-muted: #94a8bf;
  --login-accent: #7bdcff;
  --login-panel: #07101e;

  --body-art:
    radial-gradient(950px 600px at 90% -5%, rgba(88, 199, 239, 0.08), transparent 60%),
    radial-gradient(780px 520px at 0% 34%, rgba(239, 192, 93, 0.045), transparent 62%),
    linear-gradient(180deg, #07101e 0%, #091528 62%, #07101d 100%);
  --body-art-size: auto;

  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --heading-weight: 650;
  --title-tracking: 0.01em;

  --ink: var(--text);
  --ink-soft: var(--text-soft);
  --muted: var(--text-muted);
  --muted-light: var(--text-faint);
  --line: var(--border);
  --line-soft: var(--border-soft);
  --bg: var(--canvas);
  --card: var(--surface);
}

/* --------------------------------------------------------------------------
   4. 方块世界
   -------------------------------------------------------------------------- */
html[data-theme="blocks"] {
  color-scheme: dark;

  --canvas: #101822;
  --canvas-deep: #0a1018;
  --surface: #1b2632;
  --surface-2: #222f3d;
  --surface-raised: #273543;
  --surface-sunken: #131d27;
  --text: #f5eedb;
  --text-soft: #d7d0bf;
  --text-muted: #b1aa98;
  --text-faint: #827b6d;
  --border: #060b10;
  --border-soft: #33404a;
  --border-strong: #5b4630;
  --primary: #73b957;
  --primary-hover: #87ce68;
  --on-primary: #0e1c09;
  --primary-soft: #233822;
  --primary-600: #8edb70;
  --primary-700: #b2f29a;
  --accent: #e8b851;
  --accent-hover: #f4ca69;
  --accent-soft: #3c3118;
  --on-accent: #1d1404;
  --success: #8bd66d;
  --success-soft: #243821;
  --success-text: #b5f29b;
  --warning: #e8b851;
  --warning-soft: #3b3017;
  --warning-text: #f4d58c;
  --danger: #ff8174;
  --danger-soft: #3e201d;
  --danger-text: #ffb1a8;
  --info: #75cfe3;
  --info-soft: #1c343d;
  --info-text: #a6e7f4;
  --math: #79cfe2;
  --english: #90d76f;
  --politics: #e8b851;
  --major: #c0a1ff;

  --table-head: #141e28;
  --table-hover: #202d3a;
  --control-bg: #131d27;
  --control-border: #060b10;
  --overlay: rgba(3, 6, 9, 0.7);
  --focus-ring: rgba(142, 219, 112, 0.58);

  --sidebar-bg:
    radial-gradient(360px 240px at 100% 0%, rgba(232, 184, 81, 0.07), transparent 72%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.016) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #1c2619 0%, #131b11 55%, #0d130b 100%);
  --sidebar-text: #f4eedb;
  --sidebar-muted: #a89f8b;
  --sidebar-active: #2c3f22;
  --sidebar-active-text: #d7ffc5;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-border: #040705;
  --sidebar-card: rgba(255, 255, 255, 0.05);
  --sidebar-accent: #8edb70;

  --topbar-bg: rgba(16, 24, 34, 0.92);
  --topbar-text: #e4ddcc;

  --brand-bg: linear-gradient(180deg, #8fd46e 0 58%, #7a4f2e 58% 100%);
  --brand-fg: #102006;
  --avatar-bg: #2d4023;
  --avatar-fg: #d7ffc5;

  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 4px;
  --shadow-sm: 0 2px 0 rgba(0, 0, 0, 0.22);
  --shadow: 0 10px 28px -18px rgba(0, 0, 0, 0.72);
  --shadow-lg: 0 22px 50px -24px rgba(0, 0, 0, 0.86);

  --login-brand-bg:
    radial-gradient(800px 460px at 78% 12%, rgba(232, 184, 81, 0.10), transparent 58%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 10px),
    linear-gradient(160deg, #1c291c 0%, #121b13 58%, #0c130d 100%);
  --login-brand-text: #f7f0dc;
  --login-brand-muted: #b3b09f;
  --login-accent: #9ee080;
  --login-panel: #101822;

  --body-art:
    radial-gradient(2px 2px at 12% 14%, rgba(255, 240, 192, 0.9), transparent 65%),
    radial-gradient(2px 2px at 72% 8%, rgba(255, 237, 178, 0.65), transparent 65%),
    radial-gradient(1px 1px at 35% 34%, rgba(255, 245, 211, 0.5), transparent 65%),
    radial-gradient(2px 2px at 88% 28%, rgba(255, 226, 154, 0.55), transparent 65%),
    linear-gradient(rgba(255, 255, 255, 0.023) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.023) 1px, transparent 1px),
    linear-gradient(180deg, #0a1019 0%, #0d1722 56%, #1b2b20 100%);
  --body-art-size: 340px 340px, 460px 460px, 390px 390px, 520px 520px, 32px 32px, 32px 32px, auto;

  --font-ui: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-display: "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
  --heading-weight: 900;
  --title-tracking: 0.02em;
  --badge-radius: 2px;
  --brand-radius: 2px;

  --ink: var(--text);
  --ink-soft: var(--text-soft);
  --muted: var(--text-muted);
  --muted-light: var(--text-faint);
  --line: var(--border);
  --line-soft: var(--border-soft);
  --bg: var(--canvas);
  --card: var(--surface);
}

/* Semantic status aliases are defined on the themed html element so they follow
   each theme's palette rather than resolving to the academy defaults at :root. */
html[data-theme] {
  --status-open: var(--warning);
  --status-open-soft: var(--warning-soft);
  --status-in-progress: var(--info);
  --status-in-progress-soft: var(--info-soft);
  --status-resolved: var(--success);
  --status-resolved-soft: var(--success-soft);
  --status-closed: var(--text-muted);
  --status-closed-soft: var(--surface-2);
  --source-wechat: var(--info);
  --source-phone: var(--major);
  --source-other: var(--text-muted);
  --target-session: var(--info);
  --target-plan-item: var(--primary);
  --target-general: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Theme previews
   -------------------------------------------------------------------------- */
.theme-preview--academy { background: #f3efe5; }
.theme-preview--academy i:nth-child(1) { background: #214b3d; }
.theme-preview--academy i:nth-child(2) { background: #b97b3b; }
.theme-preview--academy i:nth-child(3) { background: #fdfbf5; }

.theme-preview--breeze { background: #f3f7fc; }
.theme-preview--breeze i:nth-child(1) { background: #1d4ed8; }
.theme-preview--breeze i:nth-child(2) { background: #0f8f87; }
.theme-preview--breeze i:nth-child(3) { background: #ffffff; }

.theme-preview--midnight { background: #07101e; }
.theme-preview--midnight i:nth-child(1) { background: #58c7ef; }
.theme-preview--midnight i:nth-child(2) { background: #efc05d; }
.theme-preview--midnight i:nth-child(3) { background: #142437; }

.theme-preview--blocks { background: #101822; }
.theme-preview--blocks i:nth-child(1) { background: #73b957; }
.theme-preview--blocks i:nth-child(2) { background: #7a4f2e; }
.theme-preview--blocks i:nth-child(3) { background: #e8b851; }

.theme-current-swatch--academy { background: linear-gradient(135deg, #214b3d 0 50%, #c6a365 50%); }
.theme-current-swatch--breeze { background: linear-gradient(135deg, #1d4ed8 0 50%, #0f8f87 50%); }
.theme-current-swatch--midnight { background: linear-gradient(135deg, #58c7ef 0 50%, #142437 50%); }
.theme-current-swatch--blocks { background: linear-gradient(135deg, #73b957 0 50%, #7a4f2e 50%); }

/* --------------------------------------------------------------------------
   Theme-specific character
   -------------------------------------------------------------------------- */
html[data-theme="academy"] .topbar-kicker,
html[data-theme="academy"] .brand-sub {
  letter-spacing: 0.16em;
}

html[data-theme="breeze"] .sidebar {
  box-shadow: 10px 0 34px -28px rgba(15, 23, 42, 0.22);
}
html[data-theme="breeze"] .brand-mark {
  box-shadow: 0 8px 18px -10px rgba(29, 78, 216, 0.65);
}
html[data-theme="breeze"] .nav-link.active::before {
  opacity: 0;
}
html[data-theme="breeze"] .nav-link.active {
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.08);
}

html[data-theme="midnight"] .brand-mark {
  box-shadow: 0 0 24px -8px rgba(88, 199, 239, 0.55);
}
html[data-theme="midnight"] .topbar {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}
html[data-theme="midnight"] .stat-icon {
  box-shadow: 0 0 18px -8px currentColor;
}

html[data-theme="blocks"] .topbar-kicker,
html[data-theme="blocks"] .brand-sub,
html[data-theme="blocks"] .stat-value,
html[data-theme="blocks"] .theme-menu-head small {
  font-family: var(--font-pixel);
  letter-spacing: 0;
}

html[data-theme="blocks"] body {
  background-color: #0a1019;
  background-image: var(--body-art);
  background-size: var(--body-art-size);
  background-attachment: fixed;
}

html[data-theme="blocks"] .sidebar {
  border-right: 3px solid #040705;
  border-top: 6px solid #4f8136;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.06), 8px 0 0 rgba(0, 0, 0, 0.18);
}
html[data-theme="blocks"] .brand {
  border-bottom: 2px solid rgba(255, 255, 255, 0.06);
}
html[data-theme="blocks"] .brand-mark {
  border: 2px solid #060b08;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.23),
    inset 0 -4px 0 rgba(0, 0, 0, 0.24),
    3px 3px 0 rgba(0, 0, 0, 0.32);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.2);
}
html[data-theme="blocks"] .nav-group-title {
  color: #8e9a7d;
  font-family: var(--font-pixel);
  font-size: 7px;
  letter-spacing: 0.08em;
}
html[data-theme="blocks"] .nav-link {
  border: 2px solid transparent;
}
html[data-theme="blocks"] .nav-link:hover {
  border-color: rgba(255, 255, 255, 0.05);
}
html[data-theme="blocks"] .nav-link.active {
  border-color: #0a1208;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.08),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3),
    2px 2px 0 rgba(0, 0, 0, 0.22);
}
html[data-theme="blocks"] .nav-link.active::before {
  width: 5px;
  border-radius: 0;
}
html[data-theme="blocks"] .user-card {
  border: 2px solid #070c07;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="blocks"] .topbar {
  border-bottom: 3px solid #050a0d;
  box-shadow:
    inset 0 -2px 0 rgba(255, 255, 255, 0.025),
    0 6px 0 rgba(0, 0, 0, 0.12);
}
html[data-theme="blocks"] .page-title {
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}
html[data-theme="blocks"] .page-head {
  border-bottom: 2px dashed rgba(232, 184, 81, 0.24);
}
html[data-theme="blocks"] .card,
html[data-theme="blocks"] .theme-menu,
html[data-theme="blocks"] .login-card,
html[data-theme="blocks"] .stat-card {
  border-width: 2px;
  border-color: #070c11;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.06),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3),
    3px 3px 0 rgba(0, 0, 0, 0.18);
}
html[data-theme="blocks"] .card-head {
  border-bottom: 2px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent);
}
html[data-theme="blocks"] .btn {
  border-width: 2px;
  border-color: #05090d;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -3px 0 rgba(0, 0, 0, 0.25),
    2px 2px 0 rgba(0, 0, 0, 0.32);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.18);
}
html[data-theme="blocks"] .btn-secondary {
  background: linear-gradient(180deg, #2b3947, #1d2834);
}
html[data-theme="blocks"] .btn-ghost {
  background: rgba(255, 255, 255, 0.025);
}
html[data-theme="blocks"] .btn:active {
  transform: translate(2px, 2px);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.28);
}
html[data-theme="blocks"] .badge {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
html[data-theme="blocks"] .stat-card {
  background: linear-gradient(180deg, #202c39, #19232f);
}
html[data-theme="blocks"] .stat-icon {
  border: 2px solid #070c11;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08);
}
html[data-theme="blocks"] .input,
html[data-theme="blocks"] .select,
html[data-theme="blocks"] .textarea {
  border-width: 2px;
  border-color: #070c11;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.28);
}
html[data-theme="blocks"] .table th {
  background: #111a23;
  border-bottom: 2px solid #070c11;
}
html[data-theme="blocks"] .table td {
  border-bottom: 1px solid #2b3741;
}
html[data-theme="blocks"] .theme-trigger,
html[data-theme="blocks"] .menu-btn,
html[data-theme="blocks"] .topbar-chip {
  border: 2px solid #060b0f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 2px 2px 0 rgba(0, 0, 0, 0.25);
}
html[data-theme="blocks"] .theme-menu {
  border-radius: 3px;
}
html[data-theme="blocks"] .theme-preview {
  border-radius: 0;
  border: 2px solid #080c10;
}
html[data-theme="blocks"] .page-head .btn svg,
html[data-theme="blocks"] .nav-link svg {
  shape-rendering: crispEdges;
}

/* --------------------------------------------------------------------------
   Print: always return to a clean light document in every theme
   -------------------------------------------------------------------------- */
@media print {
  html,
  html[data-theme] {
    color-scheme: light !important;
    --canvas: #ffffff;
    --canvas-deep: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --surface-raised: #ffffff;
    --surface-sunken: #ffffff;
    --text: #111827;
    --text-soft: #333333;
    --text-muted: #666666;
    --text-faint: #777777;
    --border: #dddddd;
    --border-soft: #e7e7e7;
    --border-strong: #cccccc;
    --primary: #111111;
    --primary-hover: #111111;
    --primary-soft: #f3f3f3;
    --primary-600: #111111;
    --primary-700: #111111;
    --accent: #444444;
    --accent-soft: #f3f3f3;
    --success: #333333;
    --warning: #555555;
    --danger: #333333;
    --info: #333333;
    --success-soft: #f5f5f5;
    --warning-soft: #f5f5f5;
    --danger-soft: #f5f5f5;
    --info-soft: #f5f5f5;
    --table-head: #f5f5f5;
    --table-hover: #ffffff;
    --control-bg: #ffffff;
    --control-border: #cccccc;
    --overlay: transparent;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: none;
    --font-pixel: var(--font-ui);
  }

  body,
  html {
    background: #ffffff !important;
    color: #111827 !important;
  }

  .sidebar,
  .sidebar-scrim,
  .topbar,
  .theme-switcher,
  .page-actions,
  .toolbar,
  .pagination,
  .messages,
  .plan-summary,
  .plan-tools,
  .plan-board-toolbar,
  .plan-task-grip,
  .plan-task-actions,
  .plan-day-menu,
  .plan-course-menu,
  .plan-task-more,
  .plan-toast-region,
  .fb-view-switch,
  .fb-filter-card,
  .fb-card-actions,
  .fb-drawer-root,
  .sp-card-actions,
  .sp-task-actions,
  .sp-toolbar-card,
  .toast-stack,
  .menu-btn {
    display: none !important;
  }

  .main {
    margin-left: 0 !important;
  }

  .content {
    max-width: none !important;
    padding: 0 !important;
  }

  .card,
  .stat-card,
  .stats-grid,
  .fb-kpis .stat-card,
  .fb-column,
  .fb-card,
  .fb-panel,
  .fb-drawer,
  .quick-link,
  .plan-day,
  .plan-task,
  .plan-course,
  .sp-card,
  .sp-day-cell {
    color: #111827 !important;
    background: #ffffff !important;
    border-color: #dddddd !important;
    box-shadow: none !important;
  }

  .table th,
  .calendar-head {
    color: #333333 !important;
    background: #f5f5f5 !important;
  }

  .table td,
  .card-head,
  .fb-column-head,
  .fb-card-footer,
  .plan-day-head {
    border-color: #e5e5e5 !important;
  }

  .badge,
  .tag,
  .session-chip,
  .day-note,
  .fb-age,
  .fb-filter-chip {
    color: #333333 !important;
    background: #f3f3f3 !important;
    border-color: #dddddd !important;
  }

  a {
    color: #111827 !important;
    text-decoration: none !important;
  }

  .plan-board-scroll {
    max-height: none !important;
    overflow: visible !important;
    --plan-col: 0px;
  }

  .plan-board {
    min-width: 0 !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }

  .fb-board {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .fb-column-body {
    max-height: none !important;
    overflow: visible !important;
  }

  .table thead {
    display: table-header-group;
  }

  .card,
  .fb-card,
  .plan-day,
  .sp-card {
    break-inside: avoid;
  }

  .stats-grid {
    border: 1px solid #dddddd !important;
  }
}

@media print {
  .actions,
  .table .actions,
  .table .btn,
  .form-actions .btn,
  .empty .btn,
  .dash-card-link,
  .btn {
    display: none !important;
  }

  .table th,
  .table td {
    color: #111827 !important;
    background: #ffffff !important;
  }

  .table th {
    background: #f5f5f5 !important;
  }
}
