/* LAM 介面色票。預設是白底條目。其餘外觀只覆寫色票，圓角由使用者滑塊決定，版面不變。藥敏仍用綠／琥珀／紅。 */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #202122;
  --text: var(--ink);
  --muted: #54595d;
  --panel: #ffffff;
  --line: #a2a9b1;
  --line-strong: #72777d;
  --border: #c8ccd1;
  --accent: #3366cc;
  --accent-hover: #2a4b8d;
  --danger: #d73333;
  --pill: #f8f9fa;
  --head: #eaecf0;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-muted: #f8f9fa;
  --input-bg: #ffffff;
  --on-accent: #ffffff;
  --ok: #14866d;
  --ok-bg: #eaf6f3;
  --ok-line: #b7ddd2;
  --error-bg: #fee7e6;
  --error-line: #f3c4c0;
  --warn: #6d4c00;
  --warn-bg: #fef6e7;
  --warn-line: #e0c98a;
  --highlight: #3366cc;
  --focus-ring: color-mix(in srgb, var(--accent) 25%, transparent);
  --focus-ring-strong: color-mix(in srgb, var(--accent) 35%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 8%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-soft-3: color-mix(in srgb, var(--accent) 20%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 12%, transparent);
  --sir-s: #14866d;
  --sir-i: #9a6700;
  --sir-r: #c0392b;
  --overlay: color-mix(in srgb, var(--ink) 40%, transparent);
  --shadow: color-mix(in srgb, var(--ink) 12%, transparent);
  --shadow-lg: color-mix(in srgb, var(--ink) 18%, transparent);
  --row-hover: color-mix(in srgb, var(--accent) 4%, transparent);
  --ghost-hover: color-mix(in srgb, var(--ink) 4%, transparent);
  --mark-return-bg: #fee7e6;
  --mark-flag: #6d4c00;
  --mark-flag-bg: #fef6e7;
  --pill-progress-ok: #eaf6f3;
  --pill-need-redo: #fee7e6;
  --pill-ready-archive: #eaf3ff;
  --pill-note: #f8f9fa;
  --row-warn-bg: #fef6e7;
  --reopen-bg: #eaf3ff;
  --reopen-line: #a2c4e0;
  --notice-bg: #fef6e7;
  --notice-line: #e0c98a;
  --status-returned-line: #e0a39a;
  --status-closed-line: #e0c98a;
  --photo-letterbox: #eaecf0;
  /* 報告紙面（AST 報告、臨床報告預覽）：固定紙色，不隨主題翻轉 */
  --report-bg: #ffffff;
  --report-ink: #111111;
  --report-line: #cccccc;
  --report-line-strong: #bbbbbb;
  --report-head-bg: #f4f4f4;
  --report-fig-bg: #f0f0f0;
  --report-note: #444444;
  --report-label: #555555;
  --combo-muted: #72777d;
  --combo-disabled-ink: #a2a9b1;
  --combo-placeholder-ink: #72777d;
  --seat-a: #3366cc;
  --seat-a-bg: #eaf3ff;
  --seat-a-ink: #202122;
  --seat-b: #6d4c00;
  --wl-current-bg: #fef6e7;
  --wl-current-line: #9a6700;
  --wl-done-bg: #eaf6f3;
  --wl-done-line: #14866d;
  --wl-done-ink: #0d4f40;
  --wl-idle-bg: #f8f9fa;
  --wl-peer-bg: #f8f9fa;
  --wl-fail-bg: #fee7e6;
  --wl-fail-line: #d73333;
  --wl-fail-ink: #7a1f1a;
  --wl-card-bg: #ffffff;
  --wl-card-focus-bg: #eaf3ff;
  --wl-chip-line: #a2a9b1;
  --wl-chip-ink: #202122;
  --wl-pos-line: #14866d;
  --wl-pos-ink: #0d4f40;
  --wl-pos-fill: #14866d;
  --wl-pos-fill-line: #0d4f40;
  --wl-neg-line: #d73333;
  --wl-neg-ink: #7a1f1a;
  --wl-neg-fill: #d73333;
  --wl-neg-fill-line: #9b2c24;
  --wl-clear-line: #72777d;
  --wl-clear-ink: #202122;
  --wl-clear-fill: #54595d;
  --wl-clear-fill-line: #202122;
  --wl-pending-ring: #9a6700;
  --role-admin: #eaf6f3;
  --role-teacher: #eaf3ff;
  --role-staff: #f8f9fa;
  --iso-dim: #f8f9fa;
  --iso-ok-bg: #eaf6f3;
  /* 圓角由 --ui-radius 單一來源帶動；預設 0，與舊「預設」色票相同，不跟色票一起變。 */
  --ui-radius: 0px;
  --radius: var(--ui-radius);
  --radius-sm: max(0px, calc(var(--ui-radius) - 2px));
  --radius-pill: max(2px, calc(var(--ui-radius) * 1.5 + 2px));
  --font: "IBM Plex Sans", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans Mono", ui-monospace, monospace;
  --fs: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;
  --fs-display: 1.7rem;
  --lh: 1.5;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  /* 互動節奏：相似浮層／展開共用，刻意短、不過度 */
  --motion-micro: 100ms;   /* 鈕／晶片 hover 色變 */
  --motion-fast: 140ms;    /* 浮層關閉退場、微回饋、按下位移 */
  --motion-fill: 220ms;    /* 主鈕色塊掃過、文字鈕底線長出 */
  --motion-in: 180ms;      /* 浮層／面板進場 */
  --motion-busy: 120ms;    /* 忙碌條／toast／狀態訊息出現 */
  --status-draft: #f8f9fa;
  --status-testing: #eaf3ff;
  --status-pending: #fef6e7;
  --status-archived: #eaecf0;
  --status-returned: #fee7e6;
  --status-closed-banner: #fef6e7;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --touch-min: 2.75rem;
}

/* 莫蘭迪：奶油底、霧綠主色、銅金高光。只換色，版面跟預設相同。 */
html[data-palette="morandi"] {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #1c2a24;
  --text: var(--ink);
  --muted: #5c6b63;
  --panel: #fffdf8;
  --line: #d5cbb8;
  --line-strong: #b8ad96;
  --border: #c5cdd6;
  --accent: #1f6f5b;
  --accent-hover: #165445;
  --danger: #8b2e2e;
  --pill: #e7f1ed;
  --head: #f7f3ea;
  --surface: #ffffff;
  --surface-2: #f4efe6;
  --surface-muted: #faf8f3;
  --input-bg: #ffffff;
  --on-accent: #ffffff;
  --ok: #1f6b4a;
  --ok-bg: #e7f5ee;
  --ok-line: #c5e0d2;
  --error-bg: #f8e8e8;
  --error-line: #e8c8c8;
  --warn: #5c4a12;
  --warn-bg: #fff8e6;
  --warn-line: #d4b56a;
  --highlight: #c4a57a;
  --sir-s: #0b6b3a;
  --sir-i: #9a6b00;
  --sir-r: #a32020;
  --mark-return-bg: #f8e0e0;
  --mark-flag: #5c4a12;
  --mark-flag-bg: #fff3cc;
  --pill-progress-ok: #dcefe4;
  --pill-need-redo: #f8e0e0;
  --pill-ready-archive: #d9eaf8;
  --pill-note: #eceff3;
  --row-warn-bg: #fff6e8;
  --reopen-bg: #e4eef5;
  --reopen-line: #9bb8cc;
  --notice-bg: #f5e6c8;
  --notice-line: #e2d0a8;
  --status-returned-line: #e0a39a;
  --status-closed-line: #e0c98a;
  --photo-letterbox: #e2ebe6;
  --combo-muted: #8a968f;
  --combo-disabled-ink: #b0b8b5;
  --combo-placeholder-ink: #8a9390;
  --seat-a: #1f6f8f;
  --seat-a-bg: #eef6fa;
  --seat-a-ink: #163a4a;
  --seat-b: #8a5a1f;
  --wl-current-bg: #fff6d8;
  --wl-current-line: #b8860b;
  --wl-done-bg: #d9efe4;
  --wl-done-line: #1f6f5b;
  --wl-done-ink: #0b4f38;
  --wl-idle-bg: #ecece8;
  --wl-peer-bg: #f3f3f1;
  --wl-fail-bg: #fde2e0;
  --wl-fail-line: #aa3333;
  --wl-fail-ink: #7a1f1a;
  --wl-card-bg: #f6f3ec;
  --wl-card-focus-bg: #eef6f2;
  --wl-chip-line: #9a9a92;
  --wl-chip-ink: #333333;
  --wl-pos-line: #3a8f6b;
  --wl-pos-ink: #0b4f38;
  --wl-pos-fill: #1f6f5b;
  --wl-pos-fill-line: #145244;
  --wl-neg-line: #c45c52;
  --wl-neg-ink: #7a1f1a;
  --wl-neg-fill: #b33a32;
  --wl-neg-fill-line: #8a241e;
  --wl-clear-line: #8a8a82;
  --wl-clear-ink: #555555;
  --wl-clear-fill: #5a5a54;
  --wl-clear-fill-line: #3f3f3a;
  --wl-pending-ring: #c9a227;
  --role-admin: #e8f1ee;
  --role-teacher: #eef0f7;
  --role-staff: #f3f1ea;
  --iso-dim: #eceff3;
  --iso-ok-bg: #e8f1ee;
  --status-draft: #eceff3;
  --status-testing: #d9eaf8;
  --status-pending: #f5e6c8;
  --status-archived: #e2ebe6;
  --status-returned: #f8d9d6;
  --status-closed-banner: #f5e6c8;
}

/* 以下四張色卡只覆寫殼層色，不改藥敏三色、不改版面、不改圓角。 */
/* 霜藍：淡藍灰底、深藍主色。只換色。 */
html[data-palette="frost"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --ink: #1b2838;
  --text: var(--ink);
  --muted: #4d5d6e;
  --panel: #ffffff;
  --line: #c5d0dc;
  --line-strong: #8aa0b5;
  --border: #d5dee8;
  --accent: #1d4e89;
  --accent-hover: #163a66;
  --pill: #e7eef6;
  --head: #e8eef5;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --surface-muted: #f7f9fc;
  --input-bg: #ffffff;
  --on-accent: #ffffff;
  --highlight: #1d4e89;
}

html[data-palette="paper"] {
  color-scheme: light;
  --bg: #f6f1e8;
  --ink: #3a2a1e;
  --text: var(--ink);
  --muted: #5c4638;
  --panel: #fffaf3;
  --line: #e0d2c0;
  --line-strong: #b89a80;
  --border: #eadfce;
  --accent: #7a3b22;
  --accent-hover: #5e2c18;
  --pill: #f3e6d6;
  --head: #efe4d4;
  --surface: #fffaf3;
  --surface-2: #f6f1e8;
  --surface-muted: #fbf6ee;
  --input-bg: #fffaf3;
  --on-accent: #ffffff;
  --highlight: #7a3b22;
}

html[data-palette="slate"] {
  color-scheme: light;
  --bg: #f1f3f5;
  --ink: #1f2933;
  --text: var(--ink);
  --muted: #4a5968;
  --panel: #ffffff;
  --line: #cbd2d9;
  --line-strong: #7b8794;
  --border: #d9e2ec;
  --accent: #334e68;
  --accent-hover: #243b53;
  --pill: #e4e7eb;
  --head: #e4e7eb;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --surface-muted: #f5f7fa;
  --input-bg: #ffffff;
  --on-accent: #ffffff;
  --highlight: #334e68;
}

html[data-palette="indigo"] {
  color-scheme: light;
  --bg: #f4f5fb;
  --ink: #1e1b4b;
  --text: var(--ink);
  --muted: #4e4a72;
  --panel: #ffffff;
  --line: #d4d4ea;
  --line-strong: #8b88b0;
  --border: #e0e0f0;
  --accent: #3f3d8c;
  --accent-hover: #312e81;
  --pill: #ececf8;
  --head: #ececf6;
  --surface: #ffffff;
  --surface-2: #f4f5fb;
  --surface-muted: #f8f8fc;
  --input-bg: #ffffff;
  --on-accent: #ffffff;
  --highlight: #3f3d8c;
}

/* Everforest Soft 淺色：奶油綠底、森綠主色、琥珀高光。
   底／面板對齊 soft light；字色／主色略加深以達臨床介面對比。 */
html[data-palette="everforest"] {
  color-scheme: light;
  --bg: #f2efdf;
  --ink: #2d353b;
  --text: var(--ink);
  --muted: #5c6a72;
  --panel: #fff9e8;
  --line: #e1ddc7;
  --line-strong: #a6b0a0;
  --border: #e9e5cf;
  --accent: #3a6b4a;
  --accent-hover: #2d5540;
  --danger: #f85552;
  --pill: #edf0cd;
  --head: #f0ecd7;
  --surface: #fff9e8;
  --surface-2: #f7f4e0;
  --surface-muted: #f2efdf;
  --input-bg: #fff9e8;
  --on-accent: #ffffff;
  --ok: #35a77c;
  --ok-bg: #f1f3d4;
  --ok-line: #bec5b2;
  --error-bg: #fce5dc;
  --error-line: #f85552;
  --warn: #dfa000;
  --warn-bg: #fbebcb;
  --warn-line: #dfa000;
  --highlight: #f57d26;
  --sir-s: #35a77c;
  --sir-i: #dfa000;
  --sir-r: #f85552;
  --mark-return-bg: #fce5dc;
  --mark-flag: #dfa000;
  --mark-flag-bg: #fbebcb;
  --pill-progress-ok: #f1f3d4;
  --pill-need-redo: #fce5dc;
  --pill-ready-archive: #eaf2dd;
  --pill-note: #f0ecd7;
  --row-warn-bg: #fbebcb;
  --reopen-bg: #eaf2dd;
  --reopen-line: #3a94c5;
  --notice-bg: #fbebcb;
  --notice-line: #dfa000;
  --status-returned-line: #f85552;
  --status-closed-line: #dfa000;
  --photo-letterbox: #e1ddc7;
  --combo-muted: #939f91;
  --combo-disabled-ink: #a6b0a0;
  --combo-placeholder-ink: #829181;
  --seat-a: #3a94c5;
  --seat-a-bg: #eaf2dd;
  --seat-a-ink: #5c6a72;
  --seat-b: #f57d26;
  --wl-current-bg: #fbebcb;
  --wl-current-line: #dfa000;
  --wl-done-bg: #f1f3d4;
  --wl-done-line: #35a77c;
  --wl-done-ink: #3a6b4a;
  --wl-idle-bg: #f0ecd7;
  --wl-peer-bg: #f7f4e0;
  --wl-fail-bg: #fce5dc;
  --wl-fail-line: #f85552;
  --wl-fail-ink: #a33a38;
  --wl-card-bg: #fff9e8;
  --wl-card-focus-bg: #edf0cd;
  --wl-chip-line: #a6b0a0;
  --wl-chip-ink: #5c6a72;
  --wl-pos-line: #35a77c;
  --wl-pos-ink: #3a6b4a;
  --wl-pos-fill: #3a6b4a;
  --wl-pos-fill-line: #2d5540;
  --wl-neg-line: #f85552;
  --wl-neg-ink: #a33a38;
  --wl-neg-fill: #f85552;
  --wl-neg-fill-line: #c44442;
  --wl-clear-line: #829181;
  --wl-clear-ink: #5c6a72;
  --wl-clear-fill: #939f91;
  --wl-clear-fill-line: #5c6a72;
  --wl-pending-ring: #dfa000;
  --role-admin: #f1f3d4;
  --role-teacher: #eaf2dd;
  --role-staff: #f0ecd7;
  --iso-dim: #f0ecd7;
  --iso-ok-bg: #f1f3d4;
  --status-draft: #f0ecd7;
  --status-testing: #eaf2dd;
  --status-pending: #fbebcb;
  --status-archived: #e1ddc7;
  --status-returned: #fce5dc;
  --status-closed-banner: #fbebcb;
}

/* 深色：深炭底、霧灰字、霧綠主色、銅金高光。只換色，版面跟預設相同。 */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191a1f;
  --ink: #e2e5ea;
  --text: var(--ink);
  --muted: #aeb2be;
  --panel: #23242b;
  --line: #42434e;
  --line-strong: #5a5c6a;
  --border: #4a4c58;
  --accent: #8fbfa8;
  --accent-hover: #a8d0bc;
  --danger: #c17b76;
  --pill: #2a2d38;
  --head: #2c2d36;
  --surface: #1e1f25;
  --surface-2: #2c2d34;
  --surface-muted: #262730;
  --input-bg: #1e1f25;
  --on-accent: #14161a;
  --ok: #7a9a88;
  --ok-bg: #24332c;
  --ok-line: #3d5a4c;
  --error-bg: #3a2c2c;
  --error-line: #6a4542;
  --warn: #d4c4a0;
  --warn-bg: #3a3428;
  --warn-line: #6a5a3a;
  --highlight: #c4a57a;
  --sir-s: #8fb5a3;
  --sir-i: #c4a57a;
  --sir-r: #c17b76;
  --mark-return-bg: #3d2c2c;
  --mark-flag: #d4c4a0;
  --mark-flag-bg: #3a3428;
  --pill-progress-ok: #2a3532;
  --pill-need-redo: #3d2c2c;
  --pill-ready-archive: #2a3848;
  --pill-note: #2e3138;
  --row-warn-bg: #3a3428;
  --reopen-bg: #2a3848;
  --reopen-line: #5a7388;
  --notice-bg: #3a3428;
  --notice-line: #6a5a3a;
  --status-returned-line: #6a4542;
  --status-closed-line: #6a5a3a;
  --photo-letterbox: #2a3532;
  --combo-muted: #a4a8b4;
  --combo-disabled-ink: #7a7e8a;
  --combo-placeholder-ink: #9498a4;
  --seat-a: #7a9eb0;
  --seat-a-bg: #243038;
  --seat-a-ink: #b4c8d4;
  --seat-b: #b08a62;
  --wl-current-bg: #3a3428;
  --wl-current-line: #c4a57a;
  --wl-done-bg: #24332c;
  --wl-done-line: #7a9a88;
  --wl-done-ink: #b4c8bc;
  --wl-idle-bg: #2a2b33;
  --wl-peer-bg: #2c2d36;
  --wl-fail-bg: #3a2c2c;
  --wl-fail-line: #c17b76;
  --wl-fail-ink: #e0b4b0;
  --wl-card-bg: #23242b;
  --wl-card-focus-bg: #2a3532;
  --wl-chip-line: #5a5c6a;
  --wl-chip-ink: #e2e5ea;
  --wl-pos-line: #7a9a88;
  --wl-pos-ink: #b4c8bc;
  --wl-pos-fill: #7a9a88;
  --wl-pos-fill-line: #5a7a6a;
  --wl-neg-line: #c17b76;
  --wl-neg-ink: #e0b4b0;
  --wl-neg-fill: #c17b76;
  --wl-neg-fill-line: #8a5550;
  --wl-clear-line: #6a6e7a;
  --wl-clear-ink: #b4b8c2;
  --wl-clear-fill: #5a5c6a;
  --wl-clear-fill-line: #42434e;
  --wl-pending-ring: #c4a57a;
  --role-admin: #24332c;
  --role-teacher: #2a2d38;
  --role-staff: #2c2d36;
  --iso-dim: #2e3138;
  --iso-ok-bg: #24332c;
  --status-draft: #2e3138;
  --status-testing: #2a3848;
  --status-pending: #3a3428;
  --status-archived: #2a3532;
  --status-returned: #3d2c2c;
  --status-closed-banner: #3a3428;
}

/* Everforest Soft 深色：覆寫在 data-theme=dark 之後，森綠主色、暖灰字。對齊 soft dark。 */
html[data-palette="everforest-dark"] {
  color-scheme: dark;
  --bg: #232a2e;
  --ink: #d3c6aa;
  --text: var(--ink);
  --muted: #9da9a0;
  --panel: #333c43;
  --line: #4d5a5e;
  --line-strong: #7a8478;
  --border: #566165;
  --accent: #a7c080;
  --accent-hover: #b8d092;
  --danger: #e67e80;
  --pill: #3a464c;
  --head: #3a464c;
  --surface: #2d353b;
  --surface-2: #3a464c;
  --surface-muted: #343f44;
  --input-bg: #2d353b;
  --on-accent: #232a2e;
  --ok: #83c092;
  --ok-bg: #404d44;
  --ok-line: #5a6e5c;
  --error-bg: #4e3e43;
  --error-line: #e67e80;
  --warn: #dbbc7f;
  --warn-bg: #4a4940;
  --warn-line: #dbbc7f;
  --highlight: #e69875;
  --sir-s: #83c092;
  --sir-i: #dbbc7f;
  --sir-r: #e67e80;
  --mark-return-bg: #4e3e43;
  --mark-flag: #dbbc7f;
  --mark-flag-bg: #4a4940;
  --pill-progress-ok: #404d44;
  --pill-need-redo: #4e3e43;
  --pill-ready-archive: #394f5a;
  --pill-note: #415055;
  --row-warn-bg: #4a4940;
  --reopen-bg: #394f5a;
  --reopen-line: #7fbbb3;
  --notice-bg: #4a4940;
  --notice-line: #dbbc7f;
  --status-returned-line: #e67e80;
  --status-closed-line: #dbbc7f;
  --photo-letterbox: #404d44;
  --combo-muted: #9da9a0;
  --combo-disabled-ink: #7a8478;
  --combo-placeholder-ink: #859289;
  --seat-a: #7fbbb3;
  --seat-a-bg: #394f5a;
  --seat-a-ink: #d3c6aa;
  --seat-b: #e69875;
  --wl-current-bg: #4a4940;
  --wl-current-line: #dbbc7f;
  --wl-done-bg: #404d44;
  --wl-done-line: #83c092;
  --wl-done-ink: #d3c6aa;
  --wl-idle-bg: #3a464c;
  --wl-peer-bg: #415055;
  --wl-fail-bg: #4e3e43;
  --wl-fail-line: #e67e80;
  --wl-fail-ink: #f0b0b0;
  --wl-card-bg: #333c43;
  --wl-card-focus-bg: #404d44;
  --wl-chip-line: #7a8478;
  --wl-chip-ink: #d3c6aa;
  --wl-pos-line: #83c092;
  --wl-pos-ink: #d3c6aa;
  --wl-pos-fill: #a7c080;
  --wl-pos-fill-line: #83c092;
  --wl-neg-line: #e67e80;
  --wl-neg-ink: #f0b0b0;
  --wl-neg-fill: #e67e80;
  --wl-neg-fill-line: #c06062;
  --wl-clear-line: #859289;
  --wl-clear-ink: #d3c6aa;
  --wl-clear-fill: #7a8478;
  --wl-clear-fill-line: #4d5a5e;
  --wl-pending-ring: #dbbc7f;
  --role-admin: #404d44;
  --role-teacher: #394f5a;
  --role-staff: #3a464c;
  --iso-dim: #415055;
  --iso-ok-bg: #404d44;
  --status-draft: #415055;
  --status-testing: #394f5a;
  --status-pending: #4a4940;
  --status-archived: #404d44;
  --status-returned: #4e3e43;
  --status-closed-banner: #4a4940;
}

/* 文字大小由滑塊寫入 html 的 font-size 百分比；列印強制標準大小，蓋過行內樣式。 */
@media print {
  html[data-theme="dark"] {
    color-scheme: light;
    --bg: #ffffff;
    --ink: #202122;
    --text: var(--ink);
    --muted: #54595d;
    --panel: #ffffff;
    --line: #a2a9b1;
    --line-strong: #72777d;
    --border: #c8ccd1;
    --accent: #3366cc;
    --accent-hover: #2a4b8d;
    --danger: #d73333;
    --pill: #f8f9fa;
    --head: #eaecf0;
    --surface: #ffffff;
    --surface-2: #f8f9fa;
    --surface-muted: #f8f9fa;
    --input-bg: #ffffff;
    --on-accent: #ffffff;
    --ok: #14866d;
    --ok-bg: #eaf6f3;
    --ok-line: #b7ddd2;
    --error-bg: #fee7e6;
    --error-line: #f3c4c0;
    --warn: #6d4c00;
    --warn-bg: #fef6e7;
    --warn-line: #e0c98a;
    --highlight: #3366cc;
    --focus-ring: color-mix(in srgb, var(--accent) 25%, transparent);
    --focus-ring-strong: color-mix(in srgb, var(--accent) 35%, transparent);
    --accent-soft: color-mix(in srgb, var(--accent) 8%, transparent);
    --accent-soft-2: color-mix(in srgb, var(--accent) 14%, transparent);
    --accent-soft-3: color-mix(in srgb, var(--accent) 20%, transparent);
    --accent-glow: color-mix(in srgb, var(--accent) 12%, transparent);
    --sir-s: #14866d;
    --sir-i: #9a6700;
    --sir-r: #c0392b;
    --overlay: color-mix(in srgb, var(--ink) 40%, transparent);
    --shadow: color-mix(in srgb, var(--ink) 12%, transparent);
    --shadow-lg: color-mix(in srgb, var(--ink) 18%, transparent);
    --row-hover: color-mix(in srgb, var(--accent) 4%, transparent);
    --ghost-hover: color-mix(in srgb, var(--ink) 4%, transparent);
    --mark-return-bg: #fee7e6;
    --mark-flag: #6d4c00;
    --mark-flag-bg: #fef6e7;
    --pill-progress-ok: #eaf6f3;
    --pill-need-redo: #fee7e6;
    --pill-ready-archive: #eaf3ff;
    --pill-note: #f8f9fa;
    --row-warn-bg: #fef6e7;
    --reopen-bg: #eaf3ff;
    --reopen-line: #a2c4e0;
    --notice-bg: #fef6e7;
    --notice-line: #e0c98a;
    --status-returned-line: #e0a39a;
    --status-closed-line: #e0c98a;
    --photo-letterbox: #eaecf0;
    --combo-muted: #72777d;
    --combo-disabled-ink: #a2a9b1;
    --combo-placeholder-ink: #72777d;
    --seat-a: #3366cc;
    --seat-a-bg: #eaf3ff;
    --seat-a-ink: #202122;
    --seat-b: #6d4c00;
    --wl-current-bg: #fef6e7;
    --wl-current-line: #9a6700;
    --wl-done-bg: #eaf6f3;
    --wl-done-line: #14866d;
    --wl-done-ink: #0d4f40;
    --wl-idle-bg: #f8f9fa;
    --wl-peer-bg: #f8f9fa;
    --wl-fail-bg: #fee7e6;
    --wl-fail-line: #d73333;
    --wl-fail-ink: #7a1f1a;
    --wl-card-bg: #ffffff;
    --wl-card-focus-bg: #eaf3ff;
    --wl-chip-line: #a2a9b1;
    --wl-chip-ink: #202122;
    --wl-pos-line: #14866d;
    --wl-pos-ink: #0d4f40;
    --wl-pos-fill: #14866d;
    --wl-pos-fill-line: #0d4f40;
    --wl-neg-line: #d73333;
    --wl-neg-ink: #7a1f1a;
    --wl-neg-fill: #d73333;
    --wl-neg-fill-line: #9b2c24;
    --wl-clear-line: #72777d;
    --wl-clear-ink: #202122;
    --wl-clear-fill: #54595d;
    --wl-clear-fill-line: #202122;
    --wl-pending-ring: #9a6700;
    --role-admin: #eaf6f3;
    --role-teacher: #eaf3ff;
    --role-staff: #f8f9fa;
    --iso-dim: #f8f9fa;
    --iso-ok-bg: #eaf6f3;
    --status-draft: #f8f9fa;
    --status-testing: #eaf3ff;
    --status-pending: #fef6e7;
    --status-archived: #eaecf0;
    --status-returned: #fee7e6;
    --status-closed-banner: #fef6e7;
  }
}
@media print {
  html { font-size: 100% !important; }
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background: var(--bg);
}
html.is-busy, html.is-busy body { cursor: progress; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--ink);
}
h1 {
  font-size: 1.7rem;
  margin: 0 0 0.55rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--line);
}
h2 {
  font-size: 1.3rem;
  margin: 1rem 0 0.45rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid var(--line);
  text-transform: none;
}
h3 { font-size: 1.05rem; margin: 0.85rem 0 0.35rem; font-weight: 600; }

.lam-busy {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.35rem 0.75rem 0.4rem;
  text-align: center;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--on-accent);
  background: var(--accent);
  animation: lam-busy-in var(--motion-busy) var(--ease-out);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
.lam-busy.is-closing {
  animation: lam-busy-out var(--motion-busy) var(--ease-out) forwards;
  pointer-events: none;
}
.lam-busy[hidden] {
  display: none !important;
}
.lam-busy-label {
  position: relative;
  z-index: 1;
  line-height: 1.35;
}
.lam-busy-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
.lam-busy-fill {
  height: 100%;
  width: 30%;
  background: rgba(255, 255, 255, 0.92);
  transform-origin: left center;
}
.lam-busy.is-indeterminate .lam-busy-fill {
  width: 36%;
  animation: lam-busy-indeterminate 1.1s ease-in-out infinite;
}
.lam-busy.is-determinate .lam-busy-fill {
  width: var(--lam-busy-pct, 0%);
  transition: width var(--motion-in) var(--ease-out);
  animation: none;
}
.lam-busy.is-ok {
  background: var(--ok);
}
.lam-busy.is-error {
  background: var(--danger);
}
.lam-busy.is-ok .lam-busy-track,
.lam-busy.is-error .lam-busy-track {
  display: none;
}
@keyframes lam-busy-in {
  from { transform: translateY(-100%); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes lam-busy-out {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100%); opacity: 0.4; }
}
/* 頁內狀態回饋（toast／.ok／.error／.notice）：短位移＋淡入，對齊 --motion-busy */
@keyframes lam-status-in {
  from { opacity: 0; transform: translateY(-0.15rem); }
  to { opacity: 1; transform: translateY(0); }
}
/* 展開面板共用進場（搜尋進階、摺疊、頂欄選單） */
@keyframes lam-panel-in {
  from { opacity: 0; transform: translateY(-0.2rem); }
  to { opacity: 1; transform: translateY(0); }
}
/* 舊名保留 */
@keyframes case-find-panel-in {
  from { opacity: 0; transform: translateY(-0.2rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes lam-busy-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* 區塊級狀態訊息進場（勿套到表格內 inline .ok 標籤） */
p.ok,
p.error,
p.notice,
.notice[role="status"],
.lam-live-banner:not([hidden]),
.consistency-banner {
  animation: lam-status-in var(--motion-busy) var(--ease-out);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-hover); }

button, .btn, .tag-chip, a.brand {
  transition:
    background var(--motion-micro) var(--ease-out),
    background-color var(--motion-micro) var(--ease-out),
    background-size var(--motion-fill) var(--ease-out),
    border-color var(--motion-micro) var(--ease-out),
    color var(--motion-micro) var(--ease-out),
    opacity var(--motion-micro) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* 裸 button／晶片預設不位移；主鈕按下下沉由 tables.css 的 .btn:active 覆寫 */
button:active, .is-pressed { transform: none; }
form {
  transition: opacity var(--motion-micro) var(--ease-out);
}
form.is-submitting { opacity: 0.72; pointer-events: none; }
button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

