﻿:root {
  --primary-color: #2E75D5;
  --primary-hover: #2662B6;
  --save-color: #28A745;
  --save-hover: #218838;
  --danger-color: #DC3545;
  --success-color: #198754;
  --light-gray: #F8F9FA;
  --medium-gray: #E9ECEF;
  --border-gray: #DEE2E6;
  --text-color: #212529;
  --text-muted: #6C757D;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 4px 6px rgba(0, 0, 0, .1);
  --shadow-lg: 0 12px 24px rgba(31, 38, 135, .18);
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', 'Inter', sans-serif;
  --font-heading: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans TC', 'Inter', sans-serif;
  --g1: #667EEA;
  --g2: #64B3F4;
  --g3: #5EBA7D;
  --g4: #FF9F43;
  /* 字體大小系統 - 方案 B: 平衡派 (10個標準尺寸) */
  --fs-xs:     0.75rem;    /* 12px  - 超小標籤、次要資訊 */
  --fs-sm:     0.875rem;   /* 14px  - 小文字、次要內容 */
  --fs-md:     0.9375rem;  /* 15px  - 中等文字、卡片內容 */
  --fs-base:   1rem;       /* 16px  - 主要內容、標準文字 */
  --fs-lg-sm:  1.125rem;   /* 18px  - 略大文字、重要內容 */
  --fs-lg:     1.25rem;    /* 20px  - 小標題、區塊標題 */
  --fs-xl:     1.5rem;     /* 24px  - 中等標題 */
  --fs-2xl:    2rem;       /* 32px  - 大標題 */
  --fs-3xl:    3rem;       /* 48px  - 超大標題 */
  --fs-hero:   6rem;       /* 96px  - 特殊顯示（計時器等） */

  /* 按鈕變數系統 */
  --btn-primary-bg: linear-gradient(135deg, rgba(46, 117, 213, 0.9), rgba(38, 98, 182, 0.95));
  --btn-primary-hover: linear-gradient(135deg, rgba(38, 98, 182, 0.95), rgba(30, 80, 160, 1));
  --btn-secondary-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --btn-secondary-hover: linear-gradient(135deg, #5568d3 0%, #6a3f91 100%);
  --btn-success-bg: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  --btn-danger-bg: linear-gradient(135deg, #ff7043 0%, #ff5722 100%);
  --btn-completed-bg: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);

  /* 按鈕尺寸 */
  --btn-padding: 0.75rem 1.5rem;
  --btn-padding-sm: 0.6rem 1.25rem;
  --btn-padding-lg: 0.75rem 2rem;

  /* 按鈕圓角 */
  --btn-radius: 8px;
  --btn-radius-lg: 10px;

  --radius-md: 16px;
  --radius-pill: 999px;
  --container-width: 1200px;
  --header-height: 72px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}
/* Ensure the HTML hidden attribute truly hides elements */
*[hidden] {
  display: none !important;
}

body {
  font-family: var(--font-main);
  color: var(--text-color);
  margin: 0;
  background: #ffffff;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  display: block;
}

/* Buttons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  font-size: var(--fs-base);
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, .16);
  cursor: pointer;
  font-family: inherit;
  background: var(--btn-primary-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  box-shadow: 0 8px 32px 0 rgba(46, 117, 213, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
  background: var(--btn-primary-hover);
  box-shadow: 0 12px 40px 0 rgba(46, 117, 213, 0.3);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn.ghost {
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--text-color);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .2);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
  transform: translateY(-2px);
}

.btn.outline {
  background: rgba(46, 117, 213, .08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--primary-color);
  border: 1px solid rgba(46, 117, 213, .3);
  box-shadow: 0 8px 32px 0 rgba(46, 117, 213, 0.1);
}

.btn.outline:hover {
  background: rgba(46, 117, 213, .15);
  border-color: rgba(46, 117, 213, .5);
  box-shadow: 0 12px 40px 0 rgba(46, 117, 213, 0.2);
  transform: translateY(-2px);
}

/* .btn.primary 已刪除：與基礎 .btn 樣式完全相同（重複定義） */

/* Inputs --------------------------------------------------- */
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: var(--fs-base);
  border-radius: 10px;
  border: 1px solid var(--border-gray);
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 117, 213, .18);
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--text-color);
  margin: 0;
}

h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.muted {
  color: var(--text-muted);
}

/* 統一所有頁面標題中的副標題大小 */
h2 .muted,
.section-head h2 .muted {
  font-size: var(--fs-sm); /* 14px - 副標題更小更低調 */
}

/* Loader & Toast ------------------------------------------- */
#loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 5px solid var(--medium-gray);
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#toast-container {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1001;
}

.toast {
  background: var(--text-color);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
}

.toast.success { background: var(--save-color); }
.toast.error { background: var(--danger-color); }

/* Layout ---------------------------------------------------- */
body.main-page {
  background: radial-gradient(circle at top left, rgba(102, 126, 234, .08), transparent 55%), var(--light-gray);
}

#app-main-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: none;
}

body.home-active #app-main-container {
  background: transparent;
  box-shadow: none;
}

body.home-active {
  overflow: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2.5rem;
  background: rgba(255, 255, 255, .98);
  border-bottom: 1px solid rgba(222, 226, 230, .7);
}

.g-header-accent::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--g1), var(--g2), var(--g3), var(--g4));
}

.top-tabs {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.nav-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-base);
}

.nav-btn small {
  display: block;
  font-size: var(--fs-xs);
  color: rgba(154, 163, 173, .9);
  line-height: 1;
  margin-top: 2px;
}

.nav-btn:hover {
  color: var(--text-color);
}

.nav-btn.active {
  color: var(--primary-color);
}

#user-info {
  display: none;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--fs-sm);
}

#user-info img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border 0.2s;
  border: 2px solid transparent;
}

#user-info img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Gold border for unit members */
#user-info img.has-unit {
  border: 3px solid #FFD700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5), inset 0 0 3px rgba(255, 215, 0, 0.3);
}

#user-info img.has-unit:hover {
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 0 5px rgba(255, 215, 0, 0.4);
}

#logout-btn {
  background: rgba(255, 255, 255, .25);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius-pill);
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#logout-btn:hover {
  background: rgba(255, 255, 255, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
  transform: translateY(-1px);
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 3rem 3rem 5rem;
}

body.home-active main {
  padding: 0;
  max-width: 100%;
  overflow: hidden;
  height: calc(100vh - var(--header-height));
}

/* Views ----------------------------------------------------- */
.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-head span.en,
.section-head span.muted {
  margin-left: 0.5rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* Hero ------------------------------------------------------ */
#home-section {
  padding: 0;
}

.weave-full {
  position: relative;
  height: calc(100vh - var(--header-height));
  min-height: 480px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: grid;
  place-items: center;
}

body.home-active .weave-full {
  border-radius: 0;
  height: 100vh;
}

.weave-bg,
.weave-glow {
  position: absolute;
  inset: 0;
}

.weave-bg {
  background:
    linear-gradient(120deg, #f6f8fb 0%, #eef2f8 100%),
    radial-gradient(120% 120% at 15% 15%, rgba(102, 126, 234, .25), transparent 60%),
    radial-gradient(110% 110% at 85% 35%, rgba(94, 186, 125, .22), transparent 60%);
  mix-blend-mode: multiply;
}

.weave-glow {
  background:
    radial-gradient(600px 340px at 20% 40%, rgba(46, 117, 213, .25), transparent 60%),
    radial-gradient(620px 320px at 80% 60%, rgba(255, 159, 67, .22), transparent 60%);
  filter: blur(6px);
}

.hero-copy {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #1f2d3d;
  padding: 0 1.5rem;
}

.hero-title {
  font-size: var(--fs-xl);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-sub {
  margin-top: 0.75rem;
  font-size: var(--fs-lg);
  color: rgba(31, 45, 61, .85);
}

.hero-action {
  margin-top: 2rem;
}

/* Palette --------------------------------------------------- */
#palette-section {
  /* Do not force display here; it breaks view toggling */
  flex-direction: column;
  gap: 0.5rem;
}

/* Only display the Palette section when the view is active */
#palette-section.view.active {
  display: flex;
}

.palette-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
}

/* 篩選按鈕群組 - 靠近一點 */
.filter-chips-group {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
}

/* 搜尋摘要在篩選器旁邊 */
#search-summary.summary-banner {
  flex: 1;
  height: auto;
  margin: 0;
  padding: 0 1rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.5;
  display: flex;
  align-items: center;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* 1) 縮小 設定價格 按鈕 */
#goto-settings.btn {
  padding: 0.5rem 0.9rem;
  font-size: var(--fs-sm);
}

/* 2) 縮小 工具列右側按鈕（清除關鍵字／重設篩選） */
.palette-toolbar .toolbar-actions .btn {
  padding: 0.45rem 0.9rem;
  font-size: var(--fs-sm);
}

.chip {
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .25);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.95rem;
  font-size: var(--fs-sm);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip.toggler {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(102, 126, 234, .75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip.toggler:hover {
  background: rgba(100, 179, 244, .85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
  transform: translateY(-1px);
}

.chip.toggler:active {
  transform: translateY(0);
}

/* Collapse indicator for factory filter toggler */
.chip.toggler::after {
  content: "\25BE"; /* small down-pointing triangle */
  display: inline-block;
  margin-left: 0.25rem;
}
.chip.toggler[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 0.15rem 0.75rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .05em;
}
.count-pill.active {
  background: #fff;
  color: var(--primary-color);
}

.chips-panel {
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .35);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 320px;
  overflow: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip.factory {
  background: rgba(240, 245, 255, .45);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: #1b3056;
  font-weight: 600;
  border: 1px solid rgba(102, 126, 234, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}

.chip.factory:hover {
  background: rgba(230, 240, 255, .6);
  border: 1px solid rgba(102, 126, 234, .4);
  color: var(--primary-color);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
  transform: translateY(-2px);
}

.chip.factory.active {
  background: rgba(102, 126, 234, .85);
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25),
              inset 0 -1px 0 rgba(0, 0, 0, .1);
  transform: translateY(-1px);
}

/* Supplier chip styling - Glass Effect with Green Tint */
.chip.supplier {
  background: rgba(240, 255, 245, .45);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: #1a5c3a;
  font-weight: 600;
  border: 1px solid rgba(94, 186, 125, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}

.chip.supplier:hover {
  background: rgba(230, 255, 240, .6);
  border: 1px solid rgba(94, 186, 125, .4);
  color: #16a34a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
  transform: translateY(-2px);
}

.chip.supplier.active {
  background: rgba(94, 186, 125, .85);
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25),
              inset 0 -1px 0 rgba(0, 0, 0, .1);
  transform: translateY(-1px);
}

.chip.clear {
  background: #fff;
  color: var(--text-muted);
  border: 1px solid rgba(33, 37, 41, .15);
}

.chip.clear:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.search-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

/* 5) 將搜尋欄位與摘要卡片視覺設計成一組 */
.search-controls {
  background: #fff;
  border: 1px solid rgba(33, 37, 41, .08);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.palette-summary {
  background: #fff;
  border: 1px solid rgba(33, 37, 41, .08);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 0.9rem 1.1rem;
}
/* 摘要卡片在群組容器內，去除自身卡片化外觀 */
.palette-summary .summary-card {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

/* 搜尋摘要已移至 .palette-toolbar 中，不再需要獨立樣式 */

.search-filters {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex: 1;
  flex-wrap: wrap;
}

.search-filters .input-field {
  flex: 1 1 220px;
  min-width: 220px;
}

.search-filters .btn {
  flex-shrink: 0;
  align-self: flex-end;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.palette-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.summary-card {
  flex: 1 1 160px;
  min-width: 160px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(33, 37, 41, .08);
  background: #fff;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.summary-label {
  font-size: var(--fs-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.summary-value {
  margin-top: 0.4rem;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.1;
}

.summary-filter {
  align-self: center;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  background: #eef2f7;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.summary-filter.active {
  background: linear-gradient(120deg, rgba(102,126,234,.2), rgba(94,186,125,.2));
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.summary-banner {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  background: #f5f8ff;
  color: #47596b;
  font-size: var(--fs-sm);
  border: 1px solid rgba(102, 126, 234, .25);
}

.summary-keywords {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: 0.75rem;
  vertical-align: middle;
}

.summary-token {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-pill);
  background: rgba(66, 133, 244, .15);
  color: #1b4c9a;
  font-weight: 600;
  font-size: var(--fs-xs);
}

.section-actions {
  text-align: center;
  margin: 2rem 0 0.75rem;
}


/* Wrapper for table - no horizontal scroll */
.results-table-wrapper {
  width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

#results-table {
  width: max-content; /* Only use width needed for content */
  border-collapse: collapse;
  margin-top: 0;
  background: #fff;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(222, 226, 230, .7);
  border-top: none;
  /* Disable text selection */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Table row layout - dynamic columns (9 or 10 columns depending on warehouse manager) */
/* Layout is set dynamically by JavaScript updateTableLayout() function */
#results-table thead tr,
#results-table tbody tr {
  display: grid;
  grid-template-columns: 70px 125px 70px 140px 140px 120px 70px 70px 180px;
  align-items: stretch;
  gap: 0.15rem;
  width: max-content;
}

/* Truncated text cursor style */
.truncated-text {
  cursor: help;
}

#results-table th,
#results-table td {
  padding: 0.5rem 0.4rem;
  font-size: var(--fs-sm);
  border-bottom: 1px solid rgba(222, 226, 230, .7);
  text-align: left;
  vertical-align: middle;
  display: flex;
  align-items: center;
  /* 移除固定列高限制，允許自動調整 */
  min-height: 29px;
  /* 內容間距 */
  gap: 0.3rem;
}

/* 所有欄位都靠左對齊 */
#results-table th,
#results-table td {
  justify-content: flex-start;
}

/* Price columns (18P, 18A) should align left like other columns */
#results-table td[data-label="18P"],
#results-table td[data-label="18A"] {
  justify-content: flex-start;
  text-align: left;
}

/* Ensure text columns can truncate properly with flexbox */
#results-table td[data-label="來源"],
#results-table td[data-label="加工廠"],
#results-table td[data-label="等級"],
#results-table td[data-label="色號"],
#results-table td[data-label="中文品名"] {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reduce padding for product name column to maximize text space */
#results-table td[data-label="中文品名"] {
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

/* 厚度欄位容器 - 標籤間距 */
#results-table td[data-label="厚度"] {
  gap: 2px;
}

/* 備註欄位容器 - 標籤間距 */
#results-table td[data-label="備註"] {
  gap: 2px;
}

/* 標籤欄位容器 - 標籤間距 */
#results-table td[data-label="標籤"] {
  gap: 2px;
}

/* 厚度標籤樣式 - 圓形底色 */
.thickness-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 50px;
  font-size: var(--fs-xs); /* 原 11px ≈ 12px */
  font-weight: 600;
  text-align: center;
  color: #fff;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .3);
}

/* 不同厚度的透明度 - 玻璃質感 */
.thickness-badge.thickness-8 {
  /* 8mm - 50% 透明度 */
  background: rgba(102, 126, 234, 0.6);
}

.thickness-badge.thickness-18 {
  /* 18mm - 40% 透明度 */
  background: rgba(102, 126, 234, 0.5);
}

.thickness-badge.thickness-25 {
  /* 25mm - 30% 透明度 */
  background: rgba(102, 126, 234, 0.4);
}

/* 表頭高度統一，搭配上方 #search-summary 作為預留空間 */
#results-table th {
  /* 讓表頭背景完全不透明，避免看到底下資料造成重疊錯覺 */
  background: linear-gradient(120deg, rgba(102,126,234,.06), rgba(100,179,244,.06)), #fff;
  font-weight: 600;
  position: sticky;
  /* Dynamic offset to avoid overlapping filters above */
  top: var(--results-sticky-top, var(--header-height));
  z-index: 8;
  /* 覆蓋底下列，避免重疊視覺干擾 */
  backdrop-filter: none;
  box-shadow: 0 1px 0 rgba(222, 226, 230, .7);
  height: var(--results-header-h, 44px);
}

#results-table tbody tr:hover {
  background: rgba(100, 179, 244, .08);
}

.empty-results {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(33, 37, 41, .12);
}

.na-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  background: rgba(238, 241, 245, .6);
  backdrop-filter: blur(8px) saturate(160%);
  -webkit-backdrop-filter: blur(8px) saturate(160%);
  color: #6c7a89;
  border: 1px solid rgba(108, 122, 137, .2);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
}

.tag.discount {
  background: rgba(232, 240, 254, .7);
  color: #1967d2;
  border: 1px solid rgba(25, 103, 210, .25);
}

.tag.remark {
  background: rgba(59, 130, 246, 0.1);
  color: #3B82F6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Stock status tags */
.tag.stock-discontinued {
  background: rgba(243, 244, 246, 0.9);
  color: #6B7280;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.tag.stock-out {
  background: rgba(254, 226, 226, 0.9);
  color: #DC2626;
  border: 1px solid rgba(220, 38, 38, 0.3);
  cursor: help;
  position: relative;
}

.tag.stock-scheduled {
  background: rgba(254, 243, 199, 0.9);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
  cursor: help;
  position: relative;
}

/* Stock management button */
.stock-manage-cell {
  width: 40px;
  padding: 0.35rem !important;
  text-align: center;
}

.stock-manage-btn {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3B82F6;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.stock-manage-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  transform: scale(1.05);
}

.stock-manage-btn:active {
  transform: scale(0.95);
}

.lock-icon {
  color: #9CA3AF;
  font-size: 1rem;
  opacity: 0.7;
}

/* Hide price when user only has multiplier permission */
.price-hidden {
  color: transparent;
  user-select: none;
  position: relative;
  font-size: 0; /* Collapse the space taken by hidden text */
}

/* Ensure multiplier hints are visible even in hidden price cells */
.price-hidden .multiplier-hint {
  color: #495057 !important;
  font-size: var(--fs-xs); /* 原 11px ≈ 12px - Restore font size for multiplier hint */
  margin-left: 0 !important; /* Remove left margin to align left */
}

.price-hidden .multiplier-hint.is-up {
  color: #ad5a00 !important;
}

.price-hidden .multiplier-hint.is-down {
  color: #0f7b5f !important;
}

.locked-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: #F3F4F6;
  border-radius: 8px;
  color: #6B7280;
  font-size: var(--fs-sm);
}

.locked-filter .lock-icon {
  font-size: 1.5rem;
}

#section-top-btn {
  align-self: center;
}

#back-to-top-btn {
  position: fixed;
  bottom: 2.2rem;
  right: 2.2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: none;
  font-size: var(--fs-lg);
  background: rgba(102, 126, 234, .85);
  backdrop-filter: blur(16px) saturate(200%);
  -webkit-backdrop-filter: blur(16px) saturate(200%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

#back-to-top-btn:hover {
  background: rgba(100, 179, 244, .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
  transform: translateY(-4px);
}

#back-to-top-btn:active {
  transform: translateY(-2px);
}

/* Settings -------------------------------------------------- */
.settings-section p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-bottom: 1.5rem;
}

.settings-section h3 {
  font-size: var(--fs-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

.settings-section h3:not(:first-of-type) {
  margin-top: 2rem;
}

.settings-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.settings-section li {
  display: grid;
  grid-template-columns: 220px 150px 1fr;
  gap: 1rem;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(222, 226, 230, .8);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.settings-section input {
  text-align: right;
}

.settings-section .history {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

#save-all-btn-container {
  text-align: right;
  margin-top: 2rem;
}

.en-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
}
/* Login ----------------------------------------------------- */
body.login-page {
  overflow: hidden;
  background: radial-gradient(circle at top left, rgba(102,126,234,.16), transparent 55%), #f5f7fb;
}

#login-page-container {
  /* Ensure full viewport height across browsers */
  min-height: 100vh;
  min-height: 100dvh;
  /* Robust centering */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2rem;
}

.login-hero {
  width: min(640px, 92vw);
  position: relative;
  margin-inline: auto; /* guard against any parent alignment quirks */
}

.login-hero .weave-bg,
.login-hero .weave-glow {
  border-radius: var(--radius-md);
}

.login-hero .hero-copy {
  padding: 3rem 2.5rem;
  background: rgba(255, 255, 255, .95);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.login-hero footer {
  margin-top: 2rem;
  font-size: var(--fs-xs);
}

/* Utility --------------------------------------------------- */
.legend {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Responsive ------------------------------------------------ */
@media (max-width: 1024px) {
  main {
    padding: 2.5rem 1.75rem 4rem;
  }

  .app-header {
    padding: 0.9rem 1.5rem;
  }

  .settings-section li {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 1024px) {
  main {
    padding: 1.5rem 1rem 3rem;
  }

  .top-tabs {
    gap: 1rem;
  }

  .nav-btn {
    font-size: var(--fs-sm);
  }

  .palette-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  /* 搜尋控制區 - 手機版優化 */
  .search-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .search-filters .input-field {
    flex: 1 1 auto;
    min-width: 100%;
  }

  .search-filters .btn {
    width: 100%;
    align-self: stretch;
  }

  /* 隱藏桌面版表頭 */
  #results-table thead,
  .results-header {
    display: none !important;
  }

  /* 行動版表格 - 卡片式布局 */
  #results-table,
  #results-table tbody {
    display: block !important;
    width: 100% !important;
  }

  #results-table tbody tr {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    grid-template-rows: auto auto auto auto;
    gap: 0;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    background: #fff;
    overflow: hidden;
    width: 100% !important;
  }

  /* 第一行：色號(3格) | 中文品名(3格) */
  #results-table td[data-label="色號"] {
    grid-row: 1;
    grid-column: 1 / span 3;
    background: #667eea;
    color: #fff;
    font-size: var(--fs-lg-sm); /* 原 1.1rem = 17.6px → 18px */
    font-weight: 700;
    padding: 0.85rem 0.5rem;
    text-align: center;
    border-top-left-radius: 12px;
    word-wrap: break-word;
    box-sizing: border-box;
  }

  #results-table td[data-label="色號"]::before {
    display: none;
  }

  #results-table td[data-label="中文品名"] {
    grid-row: 1;
    grid-column: 4 / span 3;
    background: #f1f3f5;
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    padding: 0.85rem 0.5rem;
    text-align: center;
    border-top-right-radius: 12px;
    word-wrap: break-word;
    box-sizing: border-box;
  }

  #results-table td[data-label="中文品名"]::before {
    display: none;
  }

  /* 卡片內容區 - 預設樣式（會被特定欄位覆蓋） */
  #results-table td {
    padding: 0.75rem 1rem;
    border: none;
    text-align: left;
    font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    box-sizing: border-box;
  }

  #results-table td::before {
    content: attr(data-label) ": ";
    display: inline;
    font-weight: 600;
    color: #6c757d;
    font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
    margin-right: 0.5rem;
  }

  /* 權限表格和組織表格優化 */
  .perm-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
  }

  .perm-table thead {
    display: none;
  }

  .perm-table tbody {
    display: block;
  }

  .perm-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid rgba(222,226,230,.8);
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
  }

  .perm-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border: none;
    text-align: right;
  }

  .perm-table td::before {
    content: attr(data-label) ":";
    font-weight: 600;
    text-align: left;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    min-width: 80px;
  }

  /* 特殊處理 switch 和按鈕的欄位 */
  .perm-table td:has(.switch),
  .perm-table td:has(button) {
    justify-content: space-between;
  }

  /* Section head 優化 */
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .section-head .btn {
    width: 100%;
  }

  /* 第二行：來源(3格) | 加工廠(3格) */
  #results-table td[data-label="品牌/來源"] {
    grid-row: 2;
    grid-column: 1 / span 3;
    border-bottom: 1px solid #f0f0f0;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  }

  #results-table td[data-label="品牌/來源"]::before {
    content: "來源: ";
    font-weight: 600;
    color: #6c757d;
    font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
    margin-right: 0.3rem;
  }

  #results-table td[data-label="加工廠"] {
    grid-row: 2;
    grid-column: 4 / span 3;
    border-bottom: 1px solid #f0f0f0;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  }

  #results-table td[data-label="加工廠"] .tag.discount {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: var(--fs-xs); /* 原 0.7rem = 11.2px → 12px */
    padding: 0.2rem 0.4rem;
    background: #ff6b6b;
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
  }

  /* 第三行：等級(2格) | 厚度(4格) */
  #results-table td[data-label="等級"] {
    grid-row: 3;
    grid-column: 1 / span 2;
    border-bottom: 1px solid #f0f0f0;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  }

  #results-table td[data-label="厚度"] {
    grid-row: 3;
    grid-column: 3 / span 4;
    border-bottom: 1px solid #f0f0f0;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  }

  #results-table td[data-label="厚度"] .chip {
    display: inline-block;
    margin: 0 0.25rem 0.25rem 0;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-weight: 500;
  }

  /* 第四行：18P(2格) | 18A(2格) | 備註(2格) */
  #results-table td[data-label="18P"] {
    grid-row: 4;
    grid-column: 1 / span 2;
    background: #e8f5e9;
    font-weight: 600;
    color: #2e7d32;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    border-bottom-left-radius: 12px;
  }

  #results-table td[data-label="18A"] {
    grid-row: 4;
    grid-column: 3 / span 2;
    background: #e8f5e9;
    font-weight: 600;
    color: #2e7d32;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
  }

  #results-table td[data-label="備註"] {
    grid-row: 4;
    grid-column: 5 / span 2;
    background: #fffbf0;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
    border-bottom-right-radius: 12px;
  }

  /* 移除「備註:」標籤文字 */
  #results-table td[data-label="備註"]::before {
    display: none;
  }

  #results-table td[data-label="備註"] .tag {
    display: inline-block;
    margin: 0 0.25rem 0.25rem 0;
    font-size: var(--fs-xs); /* 原 0.7rem = 11.2px → 12px */
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
  }

  .supplier-col {
    display: none;
  }

  .summary-card {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .chip.toggler {
    width: 100%;
    justify-content: space-between;
  }
}

/* =========================
   Crown Badge (overlays on avatar top)
   ========================= */

.crown-badge {
  position: absolute;
  top: -8px;
  right: -2px;
  font-size: var(--fs-lg-sm); /* 原 18px */
  z-index: 15;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: crown-shine 2s ease-in-out infinite;
}

@keyframes crown-shine {
  0%, 100% {
    transform: scale(1) rotate(-10deg);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) brightness(1);
  }
  50% {
    transform: scale(1.1) rotate(-10deg);
    filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.5)) brightness(1.2);
  }
}

/* =========================
   Unit Badge (overlays on avatar bottom)
   ========================= */

.unit-badge {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--g1), var(--g2));
  color: white;
  font-size: var(--fs-xs); /* 原 10px ≈ 12px */
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 12px;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}

/* =========================
   Modal Styles
   ========================= */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  max-width: 500px;
  width: 90%;
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-strong);
}

.modal-content .input-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.modal-content .input-field span {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-strong);
}

.modal-content .input {
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  font-size: var(--fs-base);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.modal-content .input:focus {
  outline: none;
  border-color: rgba(0, 122, 255, 0.5);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15), 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.modal-content select.input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.modal-content select.input:hover {
  border-color: rgba(0, 0, 0, 0.2);
  background-color: rgba(255, 255, 255, 0.9);
}

.modal-content input[type="date"].input {
  cursor: pointer;
}

.modal-content input[readonly].input {
  background: rgba(248, 249, 250, 0.8);
  cursor: not-allowed;
  color: #6c757d;
}

/* User Info Modal Styles */
.user-info-card {
  max-width: 400px;
  padding: 0;
  overflow: hidden;
}

.user-info-header {
  position: relative;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  font-size: var(--fs-2xl); /* 原 28px ≈ 32px */
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.5);
}

.user-info-body {
  padding: 2rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-gray);
}

.info-row:last-child {
  border-bottom: none;
}

/* Account deletion badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.badge.deleted {
  background: #FEE2E2;
  color: #DC2626;
}

.badge.recovery {
  background: #FEF3C7;
  color: #D97706;
}

/* Recent login indicator */
.recent-login-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  margin-right: 6px;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
  }
}

/* Deleted user row styling */
.deleted-row {
  opacity: 0.6;
  background: #F9FAFB;
}

.deleted-row td {
  text-decoration: line-through;
}

/* Inactive user row (no green light) - subtle gray background */
.inactive-user {
  background: rgba(243, 244, 246, 0.5);
}

.inactive-user:hover {
  background: rgba(243, 244, 246, 0.7);
}

.info-label {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.info-value {
  font-size: var(--fs-base);
  color: var(--text-color);
  font-weight: 600;
}

/* =========================
   Permissions Page Styles
   ========================= */

/* Collapsible Sections */
.collapsible-section {
  margin-bottom: 1.5rem;
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(222, 226, 230, 0.6);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.collapsible-header:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(248, 249, 250, 1));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.collapsible-header .collapse-icon {
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: #6c757d;
  transition: transform 0.3s ease;
  min-width: 16px;
}

.collapsible-header.active .collapse-icon {
  transform: rotate(0deg);
}

.collapsible-header:not(.active) .collapse-icon {
  transform: rotate(-90deg);
}

.collapsible-header span:nth-child(2) {
  flex: 1;
  font-weight: 600;
  font-size: var(--fs-lg-sm); /* 原 1.05rem = 16.8px → 18px */
  color: var(--text-strong);
}

.collapsible-header .user-count {
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
}

.collapsible-header .badge {
  background: rgba(0, 123, 255, 0.1);
  color: #007bff;
}

.collapsible-header .badge.warning {
  background: rgba(255, 193, 7, 0.15);
  color: #d39e00;
}

.collapsible-header .badge.danger {
  background: rgba(220, 53, 69, 0.1);
  color: #c82333;
}

.collapsible-content {
  margin-top: 0.75rem;
  display: block;
}

.collapsible-content .perm-table {
  border-radius: 12px;
}

/* Permissions table */
.perm-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.perm-table th,
.perm-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(222, 226, 230, 0.7);
  text-align: left;
}

.perm-table td small {
  color: var(--text-muted, #6c757d);
}

.perm-actions button {
  padding: 0.35rem 0.7rem;
}

/* Permissions toolbar */
.perm-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0.5rem 0 1rem;
}

.perm-toolbar .input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

/* Permissions subtabs */
.perm-subtabs {
  margin: 0.5rem 0 1rem;
}

.perm-subtabs .subtab {
  padding: 0.4rem 0.8rem;
  margin-right: 0.5rem;
  border: 1px solid #dee2e6;
  background: #fff;
  border-radius: 999px;
}

.perm-subtabs .subtab.active {
  background: #e7f0ff;
  border-color: #cfe0ff;
  color: #0b57d0;
  font-weight: 600;
}

/* Chips (used in group permissions) */
.chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.chips .chip {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #dee2e6;
  background: #fff;
  cursor: pointer;
}

.chips .chip.active {
  background: #e7f0ff;
  border-color: #cfe0ff;
  color: #0b57d0;
}

/* Group apply controls */
.group-apply-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.25rem 0 1rem;
}

/* Custom checkbox (selectbox) */
.selectbox {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
}

.selectbox input {
  opacity: 0;
  width: 0;
  height: 0;
}

.selectbox .box {
  position: absolute;
  inset: 0;
  background: #fff;
  border: 1.5px solid #ced4da;
  border-radius: 6px;
}

.selectbox input:checked + .box {
  background: #5c7cfa;
  border-color: #5c7cfa;
}

.selectbox input:checked + .box:after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: 2px solid #fff;
  border-left: 0;
  border-top: 0;
  transform: rotate(45deg);
}

/* Big switch toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ced4da;
  transition: 0.2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
  background: #5c7cfa;
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* =========================
   Media Queries
   ========================= */

@media (max-width: 520px) {
  .hero-title {
    font-size: var(--fs-lg);
  }

  .hero-sub {
    font-size: var(--fs-base);
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .summary-card {
    flex: 1 1 100%;
  }

  main {
    padding: 1.5rem 1rem 3.5rem;
  }

  /* 導航按鈕優化 */
  .top-tabs {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 0;
  }

  .nav-btn {
    font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
    padding: 0.6rem 0.85rem;
    min-height: 44px; /* iOS 建議最小觸控目標 */
    white-space: nowrap;
  }

  .nav-btn small {
    display: none; /* 隱藏英文副標題 */
  }

  /* Header 優化 */
  .app-header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  #user-info {
    font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  }

  #user-photo {
    width: 36px;
    height: 36px;
  }

  /* 選色頁面標題區優化 */
  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .section-head h2 {
    font-size: var(--fs-lg); /* 統一：20px */
    margin-bottom: 0.25rem;
  }

  .section-head .btn {
    width: 100%;
  }

  /* 搜尋過濾器優化 */
  .search-filters {
    gap: 0.75rem;
  }

  .search-filters .input-field {
    width: 100%;
  }

  .search-filters .input {
    width: 100%;
  }

  /* 篩選器優化 */
  .chip-container {
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .chip {
    min-height: 40px;
    padding: 0.5rem 0.85rem;
    font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  }

  .chip.toggler {
    width: 100%;
    justify-content: space-between;
  }

  /* 模態框優化 */
  .modal-content {
    width: 95%;
    max-width: 95%;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.25rem;
  }

  /* 表單輸入優化 */
  .input,
  .btn,
  input[type="text"],
  input[type="email"],
  input[type="password"] {
    min-height: 44px;
    font-size: var(--fs-base); /* 16px - 防止 iOS 自動縮放 */
  }

  /* 權限表格優化 */
  .perm-table {
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  }

  .perm-table th,
  .perm-table td {
    padding: 0.6rem;
  }

  /* Switch 開關優化 */
  .switch {
    transform: scale(1);
    width: 48px;
    height: 26px;
  }

  /* Toast 通知優化 */
  .toast {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
    padding: 1rem;
  }

  /* 組織介面優化 */
  .org-toolbar {
    flex-direction: column;
    gap: 0.75rem;
  }

  #org-search {
    width: 100%;
  }

  /* 單位設立區塊優化 */
  .units-section-header {
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }

  /* 廣告管理表格優化 */
  #advertise-section .perm-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 負責人資訊區塊優化 */
  #org-manager-info {
    padding: 1rem;
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  }

  #org-capacity-info {
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
    padding: 0.75rem 1rem;
  }

  /* 搜尋摘要優化 */
  #search-summary {
    font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
    padding: 0.75rem 1rem;
  }
}

/* 極小螢幕優化 (iPhone SE 等) */
@media (max-width: 375px) {
  .nav-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }

  main {
    padding: 1.5rem 1rem 3rem;
  }

  .section-head h2 {
    font-size: var(--fs-lg); /* 統一：20px */
  }

  .chip {
    font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
    padding: 0.35rem 0.65rem;
  }

  #results-table tr {
    padding: 0.85rem;
  }

  .modal-content {
    padding: 1.25rem;
  }
}

/* 平板橫向優化 - 提高最小寬度避免大手機橫屏觸發 */
@media (min-width: 900px) and (max-width: 1024px) and (orientation: landscape) {
  .top-tabs {
    gap: 1.5rem;
  }

  #results-table tr {
    display: table-row;
  }

  #results-table td {
    display: table-cell;
    text-align: left;
  }

  #results-table td::before {
    display: none;
  }

  #results-table thead {
    display: table-header-group;
  }
}

/* 觸控裝置優化 */
@media (hover: none) and (pointer: coarse) {
  /* 增大可觸控區域 */
  .btn,
  .chip,
  .nav-btn,
  button {
    min-height: 44px;
    padding: 0.65rem 1rem;
  }

  /* 移除 hover 效果，使用 active 效果 */
  .btn:hover,
  .chip:hover,
  .nav-btn:hover {
    transform: none;
  }

  .btn:active,
  .chip:active,
  .nav-btn:active {
    transform: scale(0.97);
  }

  /* 優化下拉選單 */
  select {
    font-size: var(--fs-base); /* 原 16px */
    min-height: 44px;
  }

  /* 優化複選框和開關 */
  input[type="checkbox"] {
    min-width: 20px;
    min-height: 20px;
  }
}
/* =========================
   Unit Settings Collapsible Sections
   ========================= */

.units-section {
  margin-bottom: 1.5rem;
}

.units-section-header {
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #495057;
  transition: all 0.2s ease;
  border: 1px solid #dee2e6;
}

.units-section-header:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.units-section-header .collapse-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.875rem;
  min-width: 1rem;
}

/* Organization capacity info */
#org-capacity-info {
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #6c757d;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
}

/* Manager badge in organization table */
.manager-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #000;
  font-weight: 600;
  font-size: 0.75rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  box-shadow: 0 1px 3px rgba(255, 215, 0, 0.3);
}

/* Load More Button Container */
.load-more-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  width: 100%;
}

/* Load More Button */
.btn.load-more {
  background: rgba(200, 200, 200, .7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-color);
  border: 1px solid rgba(255, 255, 255, .3);
  padding: var(--btn-padding-lg);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  min-width: 160px;
  box-shadow: none;
  transition: all 0.3s ease;
}

.btn.load-more:hover {
  background: rgba(180, 180, 180, .8);
  border-color: rgba(255, 255, 255, .4);
  transform: translateY(-2px);
}

/* Load All Button */
.btn.load-all {
  background: var(--btn-secondary-bg);
  color: white;
  border: none;
  padding: var(--btn-padding-lg);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  min-width: 160px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

.btn.load-all:hover {
  background: var(--btn-secondary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn.load-all:disabled {
  background: rgba(150, 150, 150, .5);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* All Loaded Message */
.all-loaded-message {
  color: #10b981;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* [INTERNAL_SYSTEM_START] Internal Data Tab Styles */
.internal-tab {
  position: relative;
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.internal-tab:hover {
  color: var(--text-color);
  background: rgba(108, 117, 125, 0.05);
}

.internal-tab.active {
  color: var(--primary-color);
  font-weight: 600;
  border-bottom-color: var(--primary-color);
  background: rgba(52, 152, 219, 0.08);
}

.tab-content {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Performance KPI Cards */
.perf-kpi-card {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.perf-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.perf-kpi-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.perf-kpi-value {
  font-size: var(--fs-2xl); /* 原 1.75rem = 28px → 32px */
  font-weight: 700;
  margin: 0.5rem 0;
}

.perf-kpi-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Performance Tables */
.perf-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.perf-table thead {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.perf-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-color);
  border-bottom: 2px solid var(--border-gray);
}

.perf-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--light-gray);
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
}

.perf-table tbody tr:hover {
  background: rgba(52, 152, 219, 0.04);
}

.perf-table tbody tr:last-child td {
  border-bottom: none;
}

/* Toggle details button */
.toggle-details-btn {
  width: 100%;
  padding: 0.875rem 1.5rem;
  margin: 1.5rem 0;
  background: rgba(248, 249, 250, .45);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: var(--text-muted);
  border: 1px solid rgba(108, 117, 125, 0.25);
  border-radius: var(--radius-md);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.toggle-details-btn:hover {
  background: rgba(233, 236, 239, .6);
  color: var(--text-color);
  border-color: rgba(108, 117, 125, 0.4);
  transform: translateY(-2px);
}

.toggle-details-btn .icon {
  transition: transform 0.3s ease;
}

.toggle-details-btn.expanded .icon {
  transform: rotate(180deg);
}

/* Medal animations for performance table */
@keyframes shimmer-gold {
  0%, 100% {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 0 12px rgba(255, 215, 0, 0.5);
    transform: scale(1);
  }
  50% {
    text-shadow: 0 0 16px rgba(255, 215, 0, 1), 0 0 24px rgba(255, 215, 0, 0.8), 0 0 32px rgba(255, 223, 0, 0.6);
    transform: scale(1.15);
  }
}

@keyframes shimmer-star {
  0%, 100% {
    text-shadow: 0 0 10px rgba(255, 223, 0, 0.9), 0 0 15px rgba(255, 165, 0, 0.6), 0 0 20px rgba(255, 140, 0, 0.4);
    transform: scale(1) rotate(0deg);
  }
  50% {
    text-shadow: 0 0 20px rgba(255, 223, 0, 1), 0 0 30px rgba(255, 165, 0, 0.9), 0 0 40px rgba(255, 140, 0, 0.7), 0 0 50px rgba(255, 100, 0, 0.5);
    transform: scale(1.2) rotate(10deg);
  }
}

.medal-gold {
  display: inline-block;
  animation: shimmer-gold 2s ease-in-out infinite;
}

.medal-star {
  display: inline-block;
  animation: shimmer-star 2.5s ease-in-out infinite;
}
/* [INTERNAL_SYSTEM_END] */

/* Footer -------------------------------------------------- */
#main-footer {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  background: transparent;
  border: none;
}

/* =========================
   Cases Section Styles
   ========================= */

/* Toolbar */
.cases-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.cases-filters {
  display: flex;
  gap: 0.5rem;
}

.filter-chip {
  padding: 0.5rem 1rem;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  font-weight: 500;
}

.filter-chip:hover {
  border-color: rgba(0, 122, 255, 0.3);
  background: rgba(255, 255, 255, 0.95);
}

.filter-chip.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

.cases-search {
  flex: 1;
  min-width: 250px;
  max-width: 400px;
}

/* Instagram-style Grid Layout */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1rem 0;
}

.case-card {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.case-card:hover {
  opacity: 0.9;
}

.case-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f0f0f0;
  border-radius: 8px;
}

.case-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.case-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.case-card:hover .case-overlay {
  opacity: 1;
}

.case-overlay-stats {
  display: flex;
  gap: 2rem;
  color: white;
  font-weight: 600;
  font-size: 1rem;
}

.case-overlay-stats span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.case-info {
  padding: 0.75rem 0;
}

.case-info-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.case-author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.case-author-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  flex-shrink: 0;
}

.case-info-text {
  flex: 1;
  min-width: 0;
}

.case-title {
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-author {
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: var(--text-muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-private-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: rgba(108, 117, 125, 0.1);
  border-radius: 12px;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  font-weight: 500;
  color: #495057;
  transition: all 0.2s ease;
}

.color-chip:hover {
  background: rgba(108, 117, 125, 0.2);
  transform: scale(1.05);
}

.case-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: var(--text-muted);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 0.75rem;
}

.case-card-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.case-card-stats {
  display: flex;
  gap: 1rem;
}

/* Upload Modal Styles */
.image-upload-area {
  border: 2px dashed rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(248, 249, 250, 0.5);
}

.image-upload-area:hover {
  border-color: rgba(0, 122, 255, 0.5);
  background: rgba(248, 249, 250, 0.8);
}

.upload-placeholder p {
  margin: 0.5rem 0 0 0;
  font-weight: 500;
  color: #495057;
}

.color-selector {
  position: relative;
}

.selected-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  min-height: 40px;
}

.color-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  margin-top: 0.5rem;
}

.color-suggestion-item {
  padding: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.color-suggestion-item:hover {
  background: rgba(0, 122, 255, 0.05);
}

.color-suggestion-item:last-child {
  border-bottom: none;
}

/* Case Detail Modal - Full Screen Override */
#case-detail-modal.modal {
  background: rgba(0, 0, 0, 0.95);
  padding: 0;
}

#case-detail-modal .modal-content {
  max-width: 100%;
  width: 100%;
  height: 100%;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  border: none;
  margin: 0;
}

/* Case Detail Modal - Full Screen */
.case-detail {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  margin: 0;
  padding: 0;
}

/* Image Gallery Container - Full Screen */
.case-detail-image-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.case-detail-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.3s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.case-detail-image.fade {
  opacity: 0.5;
}

/* Prevent right-click on images */
.case-detail-image {
  pointer-events: none;
}

/* Image Navigation Buttons - Hidden by default, show on hover */
.image-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: var(--fs-2xl); /* 原 28px ≈ 32px */
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  opacity: 0;
}

.case-detail-image-container:hover .image-nav-btn {
  opacity: 1;
}

.image-nav-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-50%) scale(1.1);
}

.image-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.image-nav-btn.prev {
  left: 20px;
}

.image-nav-btn.next {
  right: 20px;
}

.image-nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Image Counter - Hidden by default, show on hover */
.image-counter {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: var(--fs-sm); /* 原 14px */
  font-weight: 500;
  z-index: 10;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.case-detail-image-container:hover .image-counter {
  opacity: 1;
}

/* Thumbnail Strip - Hidden by default, show on hover */
.image-thumbnails {
  display: flex;
  gap: 12px;
  padding: 0;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
  opacity: 0;
  transition: all 0.3s ease;
  max-height: 0;
  padding: 0;
}

.case-detail:hover .image-thumbnails {
  opacity: 1;
  max-height: 120px;
  padding: 16px;
}

.image-thumbnails::-webkit-scrollbar {
  height: 6px;
}

.image-thumbnails::-webkit-scrollbar-track {
  background: transparent;
}

.image-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.thumbnail-item {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  opacity: 0.6;
}

.thumbnail-item:hover {
  opacity: 1;
  transform: scale(1.05);
}

.thumbnail-item.active {
  border-color: var(--primary-color, #2563eb);
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Top bar with author info and close button */
.case-detail-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.case-detail:hover .case-detail-top-bar {
  opacity: 1;
  pointer-events: auto;
}

.case-detail-author-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
}

.case-detail-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.case-detail-author-name {
  font-weight: 500;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
}

.case-detail-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.case-detail-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Case detail info - Overlay style like Unsplash */
.case-detail-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
  padding: 3rem 2rem 2rem;
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

.case-detail:hover .case-detail-info {
  opacity: 1;
  pointer-events: auto;
}

.case-detail-info h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: white;
  font-size: 1.25rem;
}

.case-detail-meta {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0;
  border-bottom: none;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  opacity: 0.9;
}

.case-detail-meta .muted {
  color: rgba(255, 255, 255, 0.8);
}

.case-detail-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.case-detail-colors .color-chip {
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

.case-detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.case-detail-actions .btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

.case-detail-actions .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Hide description completely */
#detail-description {
  display: none !important;
}

.cases-loading {
  text-align: center;
  padding: 4rem 2rem;
}

.cases-loading .spinner {
  margin: 0 auto 1rem;
}

/* ============================================
   Facebook-Style Upload Modal
   ============================================ */

.fb-style-modal {
  max-width: 500px !important;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0 !important;
  background: white;
  border-radius: 8px;
}

.fb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e4e6eb;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.fb-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #050505;
}

.fb-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #e4e6eb;
  color: #65676b;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.fb-close-btn:hover {
  background: #d8dadf;
}

.fb-user-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}

.fb-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.fb-user-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #050505;
}

.fb-visibility {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm); /* 原 0.8125rem = 13px → 14px */
  color: #65676b;
  margin-top: 2px;
}

.fb-text-section {
  padding: 0 16px;
}

.fb-textarea {
  width: 100%;
  border: none;
  outline: none;
  font-size: 1.5rem;
  font-family: inherit;
  resize: none;
  min-height: 80px;
  color: #050505;
}

/* ============================================
   Pomodoro Timer Section
   ============================================ */

#pomodoro-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem;
}

.pomodoro-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
  color: white;
  text-align: center;
  margin-bottom: 2rem;
}

.pomodoro-modes {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  flex: 1;
  min-width: 140px;
}

.mode-btn small {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 0.2rem;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: white;
  color: #667eea;
  border-color: white;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
}

.timer-display {
  font-size: var(--fs-hero); /* 原 6rem = 96px */
  font-weight: 700;
  margin: 1.5rem 0;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.05em;
  line-height: 1;
}

.timer-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.timer-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.timer-input-group label {
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  font-weight: 600;
  opacity: 0.9;
  white-space: nowrap;
}

.timer-input-group input {
  width: 100px;
  padding: 0.6rem 0.8rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(10px);
}

.timer-input-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.timer-input-group input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.2);
}

.start-btn {
  background: white;
  border: none;
  color: #667eea;
  padding: 1rem 2.5rem;
  border-radius: 50px;
  font-size: var(--fs-lg-sm); /* 原 1.1rem = 17.6px → 18px */
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
  margin-top: 0.5rem;
  min-width: 160px;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4);
}

.start-btn:active {
  transform: translateY(0);
}

.start-btn.running {
  background: linear-gradient(135deg, #ffa726 0%, #ff5722 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(255, 87, 34, 0.4);
}

.start-btn.paused {
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

/* Progress Tracking Section */
.progress-section {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.progress-section h3 {
  color: #333;
  font-size: var(--fs-xl); /* 原 1.4rem = 22.4px → 24px */
  margin: 0 0 1.5rem 0;
  text-align: center;
  font-weight: 700;
}

.progress-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  margin-bottom: 2rem;
  align-items: start;
}

.progress-form input {
  padding: 0.85rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  transition: all 0.3s ease;
  font-family: inherit;
}

.progress-form input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.progress-form input::placeholder {
  color: #999;
}

.progress-form button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
  white-space: nowrap;
}

.progress-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.progress-display {
  margin-top: 1.5rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.progress-header h4 {
  color: #333;
  font-size: var(--fs-lg); /* 原 1.3rem = 20.8px → 20px */
  margin: 0;
  font-weight: 700;
}

.progress-count {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.progress-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.progress-item {
  background: white;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  padding: 1.25rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.progress-item:hover {
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.progress-item.completed {
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  border-color: #43a047;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.25);
}

.progress-item.completed:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.35);
}

.progress-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.progress-item.completed .progress-item-icon {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

.progress-item-number {
  font-size: var(--fs-xl); /* 原 1.4rem = 22.4px → 24px */
  font-weight: 700;
  color: #667eea;
}

.progress-item.completed .progress-item-number {
  color: white;
}

.progress-item-label {
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  font-weight: 600;
  color: #666;
  text-align: center;
}

.progress-item.completed .progress-item-label {
  color: white;
}

.progress-summary {
  margin-top: 2rem;
}

.progress-bar-wrapper {
  margin-bottom: 1.5rem;
}

.progress-bar-track {
  background: #f0f0f0;
  border-radius: 50px;
  height: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 100%;
  border-radius: 50px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  animation: shimmer 3s infinite;
  position: relative;
}

.progress-bar-text {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-complete-msg {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #333;
  padding: 1rem;
  border-radius: 10px;
  font-size: var(--fs-lg-sm); /* 原 1.1rem = 17.6px → 18px */
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.reset-progress-btn {
  background: white;
  border: 2px solid #e0e0e0;
  color: #666;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.reset-progress-btn:hover {
  background: #f5f5f5;
  border-color: #ff5722;
  color: #ff5722;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
  #pomodoro-section {
    padding: 1rem;
  }

  .pomodoro-container {
    padding: 2rem 1.25rem;
  }

  .timer-display {
    font-size: var(--fs-3xl); /* 原 4rem = 64px → 48px，較大變化 */
  }

  .pomodoro-modes {
    gap: 0.5rem;
  }

  .mode-btn {
    min-width: 100px;
    padding: 0.65rem 1rem;
    font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  }

  .mode-btn small {
    font-size: var(--fs-xs); /* 原 0.7rem = 11.2px → 12px */
  }

  .timer-controls {
    gap: 0.75rem;
  }

  .timer-input-group input {
    width: 85px;
    padding: 0.5rem 0.6rem;
  }

  .start-btn {
    padding: 0.9rem 2rem;
    font-size: 1rem;
  }

  .progress-section {
    padding: 1.5rem;
  }

  .progress-form {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .progress-form button {
    width: 100%;
  }

  .progress-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .progress-items {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .progress-item {
    padding: 1rem 0.75rem;
  }

  .progress-item-icon {
    width: 40px;
    height: 40px;
  }

  .progress-item-number {
    font-size: var(--fs-lg); /* 原 1.2rem = 19.2px → 20px */
  }
}

.fb-textarea::placeholder {
  color: #8a8d91;
}

.fb-upload-placeholder {
  margin: 16px;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.fb-upload-placeholder:hover {
  background: #f7f8fa;
}

.fb-upload-inner {
  padding: 40px;
  text-align: center;
}

.fb-upload-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.fb-upload-text {
  font-size: var(--fs-lg-sm); /* 原 1.0625rem = 17px → 18px */
  font-weight: 600;
  color: #050505;
}

.fb-image-container {
  margin: 16px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e4e6eb;
}

.fb-image-preview {
  width: 100%;
  display: block;
}

.fb-image-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.fb-edit-btn,
.fb-remove-btn {
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: white;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.2s;
}

.fb-edit-btn:hover,
.fb-remove-btn:hover {
  background: #f2f2f2;
}

.fb-options-section {
  margin: 8px 16px;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
}

.fb-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #050505;
}

.fb-option-item:not(:last-child) {
  border-bottom: 1px solid #e4e6eb;
}

.fb-option-item:hover {
  background: #f7f8fa;
}

.fb-toggle-icon {
  color: #65676b;
  font-size: 0.875rem;
  transition: transform 0.2s;
}

.fb-toggle-icon.expanded {
  transform: rotate(180deg);
}

.fb-option-content {
  padding: 12px;
  border-top: 1px solid #e4e6eb;
  background: #f7f8fa;
}

.fb-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccd0d5;
  border-radius: 20px;
  font-size: 0.9375rem;
  outline: none;
  margin-bottom: 8px;
}

.fb-input:focus {
  border-color: #1877f2;
}

.fb-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.fb-suggestions {
  margin-top: 8px;
  max-height: 150px;
  overflow-y: auto;
  background: white;
  border-radius: 8px;
  border: 1px solid #e4e6eb;
}

.fb-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
}

.fb-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.fb-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.fb-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.fb-switch input:checked + .fb-switch-slider {
  background-color: #1877f2;
}

.fb-switch input:checked + .fb-switch-slider:before {
  transform: translateX(16px);
}

.fb-submit-btn {
  width: calc(100% - 32px);
  margin: 16px;
  padding: 12px;
  background: #1877f2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.fb-submit-btn:hover {
  background: #166fe5;
}

.fb-submit-btn:disabled {
  background: #e4e6eb;
  color: #bcc0c4;
  cursor: not-allowed;
}

/* Like Button */
.case-detail-like {
  margin: 1rem 0;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 2px solid #ddd;
  border-radius: 24px;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.like-btn:hover {
  border-color: #ed4956;
  transform: scale(1.05);
}

.like-btn.liked {
  border-color: #ed4956;
  background: #fff5f6;
}

.like-icon {
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.like-btn.liked .like-icon {
  content: '♥';
  color: #ed4956;
  animation: likeAnimation 0.4s ease;
}

.like-count {
  font-weight: 600;
  color: #262626;
  min-width: 24px;
}

@keyframes likeAnimation {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* Edit Modal Images Preview */
.fb-images-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  margin-bottom: 8px;
}

.fb-images-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

/* Multiple Images Preview */
.fb-multi-images-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 16px;
  margin: 16px;
  background: #f7f8fa;
  border-radius: 8px;
}

.fb-multi-image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e4e6eb;
}

.fb-multi-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fb-multi-image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.fb-multi-image-remove:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.fb-multi-image-add {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e4e6eb;
  border: 2px dashed #bcc0c4;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  aspect-ratio: 1;
}

.fb-multi-image-add:hover {
  background: #d8dadf;
  border-color: #8a8d91;
}

.fb-multi-image-add-icon {
  font-size: 2rem;
  color: #65676b;
}

/* Responsive */
@media (max-width: 1024px) {
  .cases-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  /* case-detail now uses flexbox, no need for grid-template-columns */
}

@media (max-width: 768px) {
  .cases-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .cases-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cases-search {
    max-width: 100%;
  }

  .cases-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile photo gallery adjustments */
  .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 1rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  .case-detail {
    max-height: 100vh;
    gap: 1rem;
  }

  .case-detail-image-container {
    max-height: 50vh;
    border-radius: 8px;
  }

  .case-detail-image {
    max-height: 50vh;
  }

  .image-nav-btn {
    width: 44px;
    height: 44px;
    font-size: var(--fs-xl); /* 原 24px */
  }

  .image-nav-btn.prev {
    left: 10px;
  }

  .image-nav-btn.next {
    right: 10px;
  }

  .image-counter {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: var(--fs-sm); /* 原 13px ≈ 14px */
  }

  .image-thumbnails {
    gap: 8px;
    padding: 12px;
  }

  .thumbnail-item {
    width: 60px;
    height: 60px;
  }
}

/* ====================
   Batch Actions Toolbar
   ==================== */
.batch-actions-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: #f7f8fa;
  border-radius: 12px;
}

.case-item {
  position: relative;
}

.case-checkbox-wrapper {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  display: none;
}

.case-item.batch-mode .case-checkbox-wrapper {
  display: block;
}

.case-checkbox {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: #1877f2;
}

.case-item.selected {
  opacity: 0.7;
  outline: 3px solid #1877f2;
  outline-offset: -3px;
}

/* ============================================
   Stock Photo Styles (照片縮圖和預覽)
   ============================================ */

/* Photo cell in table */
.stock-photo-cell {
  width: 40px;
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
  justify-content: center;
}

.stock-photo-cell .na-tag {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

/* Photo thumbnail (29x29px - square crop) */
.stock-photo-thumbnail {
  width: 29px;
  height: 29px;
  object-fit: cover;
  object-position: center;
  border-radius: 2px;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Photo preview modal (click to view) */
.stock-photo-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.stock-photo-modal.show {
  display: flex;
}

.stock-photo-modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
  border: 3px solid white;
}

/* Photo preview in modal */
#stock-photo-preview-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#stock-photo-preview {
  max-width: 100px;
  max-height: 100px;
  border-radius: 8px;
  border: 1px solid var(--border-gray);
  object-fit: cover;
}
/* ============================================
   Tools Section (撠極??
   ============================================ */

#tools-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.tools-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  align-items: start;
}

/* 撌血嚗移蝪∠?? */
.tools-pomodoro {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 1.5rem;
  color: white;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
}

.tools-pomodoro h3 {
  margin: 0 0 1rem 0;
  font-size: var(--fs-lg-sm); /* 原 1.1rem = 17.6px → 18px */
  font-weight: 600;
  opacity: 0.9;
}

.pomodoro-compact {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pomodoro-modes-compact {
  display: flex;
  gap: 0.5rem;
}

.mode-btn-compact {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn-compact:hover {
  background: rgba(255, 255, 255, 0.25);
}

.mode-btn-compact.active {
  background: white;
  color: #667eea;
  border-color: white;
}

.timer-display-compact {
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  letter-spacing: 0.05em;
  margin: 0.5rem 0;
}

.timer-btn-compact {
  background: white;
  border: none;
  color: #667eea;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timer-btn-compact:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.timer-btn-compact.running {
  background: linear-gradient(135deg, #ffa726 0%, #ff5722 100%);
  color: white;
}

.timer-btn-compact.paused {
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  color: white;
}

/* ?喳嚗?獢恣??*/
.tools-projects {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  min-height: 400px;
}

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.projects-header h3 {
  margin: 0;
  font-size: var(--fs-lg); /* 原 1.3rem = 20.8px → 20px */
  font-weight: 700;
  color: #333;
}

.btn-add-project {
  background: var(--btn-secondary-bg);
  border: none;
  color: white;
  padding: var(--btn-padding-sm);
  border-radius: var(--btn-radius);
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-add-project:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.projects-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: #999;
  padding: 3rem 1rem;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
}

.project-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #fff 100%);
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover {
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.project-card-title {
  font-size: var(--fs-lg-sm); /* 原 1.05rem = 16.8px → 18px */
  font-weight: 700;
  color: #333;
  margin: 0;
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.project-card-progress {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-progress-bar {
  height: 8px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
}

.project-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.project-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: #666;
}

.project-progress-text strong {
  color: #667eea;
  font-weight: 700;
}

/* 敶?璅?? */
.project-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.project-modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

.project-modal-large {
  max-width: 700px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.project-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.75rem;
  border-bottom: 2px solid #f0f0f0;
}

.project-modal-header h3 {
  margin: 0;
  font-size: var(--fs-lg); /* 原 1.3rem = 20.8px → 20px */
  font-weight: 700;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  background: #f0f0f0;
  color: #666;
}

.project-form {
  padding: 1.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.25rem 1.75rem;
  border-top: 2px solid #f0f0f0;
}

.btn-cancel {
  background: white;
  border: 2px solid #e0e0e0;
  color: #666;
  padding: var(--btn-padding); /* 統一：0.7rem → 0.75rem */
  border-radius: var(--btn-radius);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cancel:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.btn-confirm {
  background: var(--btn-secondary-bg);
  border: none;
  color: white;
  padding: var(--btn-padding); /* 統一：0.7rem → 0.75rem */
  border-radius: var(--btn-radius);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-delete {
  background: var(--btn-danger-bg);
  border: none;
  color: white;
  padding: var(--btn-padding); /* 統一：0.7rem → 0.75rem */
  border-radius: var(--btn-radius);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(255, 87, 34, 0.3);
  margin-right: auto;
}

.btn-delete:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.4);
}

/* 撠?閰單? */
.project-detail-body {
  padding: 1.75rem;
}

.project-stats {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #fff 100%);
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.stat-item {
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  color: #666;
}

.stat-item strong {
  font-size: var(--fs-lg); /* 原 1.3rem = 20.8px → 20px */
  color: #667eea;
}

.project-sheets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.sheet-item {
  aspect-ratio: 1;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.sheet-item:hover {
  border-color: #667eea;
  transform: scale(1.05);
}

.sheet-item.completed {
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  border-color: #43a047;
  color: white;
}

.sheet-number {
  font-size: var(--fs-lg); /* 原 1.2rem = 19.2px → 20px */
  font-weight: 700;
  color: #667eea;
}

.sheet-item.completed .sheet-number {
  color: white;
}

.sheet-checkmark {
  font-size: 1.5rem;
  margin-top: 0.25rem;
}

/* ?踵?撘身閮?*/
@media (max-width: 900px) {
  .tools-container {
    grid-template-columns: 1fr;
  }

  .tools-pomodoro {
    max-width: 400px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  #tools-section {
    padding: 1rem;
  }

  .projects-list {
    grid-template-columns: 1fr;
  }

  .project-sheets-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
  }

  .project-modal-content {
    max-width: 100%;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }

  .btn-delete {
    margin-right: 0;
  }
}
/* ============================================
   Project Management Section (專案管理)
   ============================================ */

#tools-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
}

/* 懸浮番茄鐘球 */
.floating-timer {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.timer-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
  border: 3px solid transparent;
}

.timer-circle::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.timer-circle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.timer-circle:hover::before {
  opacity: 0.3;
  animation: ripple 1.5s ease-out infinite;
}

.timer-circle:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.timer-circle.active {
  border-color: rgba(255, 255, 255, 0.5);
  animation: timerPulse 2s ease-in-out infinite;
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@keyframes timerPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4); }
  50% { box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6); }
}

.timer-time {
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  font-weight: 700;
  color: white;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  letter-spacing: -0.5px;
}

.timer-controls-mini {
  display: flex;
  gap: 0.25rem;
  background: white;
  padding: 0.25rem;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timer-mode-btn {
  background: white;
  border: 1px solid #e0e0e0;
  color: #667eea;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 32px;
}

.timer-mode-btn:hover {
  background: #f5f5f5;
  border-color: #667eea;
}

.timer-mode-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

/* 專案管理容器 */
.projects-container {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  margin-bottom: 6rem; /* 為懸浮球預留空間 */
}

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #f0f0f0;
}

.projects-header h2 {
  margin: 0;
  font-size: var(--fs-2xl); /* 原 1.75rem = 28px → 32px */
  font-weight: 700;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 狀態篩選標籤 */
.status-filter-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.status-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  color: #666;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.status-tab:hover {
  border-color: #667eea;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.status-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.status-tab .tab-icon {
  font-size: var(--fs-lg); /* 原 1.2rem = 19.2px → 20px */
}

.status-tab .tab-label {
  font-weight: 600;
}

.status-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 0.5rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  font-weight: 700;
}

.status-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
}

.btn-primary {
  background: var(--btn-secondary-bg);
  border: none;
  color: white;
  padding: var(--btn-padding);
  border-radius: var(--btn-radius-lg);
  font-size: var(--fs-base); /* 原 1rem → 使用變數 */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: white;
  border: 2px solid #667eea;
  color: #667eea;
  padding: var(--btn-padding); /* 統一：0.7rem → 0.75rem */
  border-radius: var(--btn-radius);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #f0f4ff;
}

/* 專案列表 */
.projects-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: #999;
  padding: 4rem 1rem;
  font-size: 1rem;
}

/* 專案卡片 */
.project-card {
  background: white;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* 100% 完成的專案卡片特效 */
.project-card.completed-100 {
  background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
  border-color: #ffd700;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.project-card.completed-100::before {
  background: linear-gradient(90deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
  opacity: 1;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover {
  border-color: #667eea;
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(102, 126, 234, 0.15);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card.archived {
  opacity: 0.7;
  background: #f9f9f9;
}

/* 已完工專案卡片 - 精簡版 */
.project-card-completed {
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-color: #e0e0e0;
}

.project-card-completed::before {
  background: linear-gradient(90deg, #66bb6a 0%, #43a047 100%);
}

.project-card-completed:hover {
  border-color: #66bb6a;
  box-shadow: 0 8px 16px rgba(67, 160, 71, 0.15);
}

.project-card-completed .project-card-header {
  margin-bottom: 0;
}

.project-card-completed .project-card-title {
  font-size: var(--fs-lg-sm); /* 原 1.05rem = 16.8px → 18px */
}

.project-card-completed .project-card-number {
  font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.project-card-title {
  font-size: var(--fs-lg-sm); /* 原 1.15rem = 18.4px → 18px */
  font-weight: 700;
  color: #333;
  margin: 0 0 0.25rem 0;
}

.project-card-number {
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: #999;
  font-weight: 500;
}

/* 專案狀態徽章 */
.badge-completed {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  color: white;
  font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
  font-weight: 600;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(67, 160, 71, 0.25);
  white-space: nowrap;
}

.badge-overdue {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, #ff7043 0%, #ff5722 100%);
  color: white;
  font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
  font-weight: 600;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(255, 87, 34, 0.25);
  white-space: nowrap;
}

.project-card-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: #666;
}

.project-countdown {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: #fff3cd;
  color: #856404;
  border-radius: 6px;
  font-weight: 600;
  font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
  margin-bottom: 0.75rem;
}

.project-countdown.urgent {
  background: #f8d7da;
  color: #721c24;
  animation: urgentPulse 2s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.project-progress-bar {
  height: 8px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.project-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.project-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: #666;
}

.project-progress-text strong {
  color: #667eea;
  font-weight: 700;
}

/* 進度條完成特效 */
.project-progress-fill.progress-complete {
  background: linear-gradient(90deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* 右上角標籤容器 */
.project-tags {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
  z-index: 10;
  pointer-events: none;
}

/* 標籤樣式 */
.project-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.project-card:hover .project-tag {
  transform: translateX(-2px);
}

/* 工廠標籤 */
.project-tag.tag-factory {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  color: #1565c0;
  border: 1px solid #90caf9;
}

/* 安裝人員標籤 */
.project-tag.tag-installer {
  background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
  color: #6a1b9a;
  border: 1px solid #ce93d8;
}

/* 狀態標籤容器 */
.project-status-badges {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}

/* 狀態標籤 */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
  font-weight: 600;
  transition: all 0.2s ease;
}

.status-badge.status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-badge.status-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-badge.status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* 彈窗樣式 */
.project-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.project-modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

.project-modal-xl {
  max-width: 900px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.project-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.75rem 2rem;
  border-bottom: 2px solid #f0f0f0;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.project-modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
}

.modal-subtitle {
  margin: 0.5rem 0 0 0;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  color: #666;
  font-weight: 400;
}

.project-number {
  margin: 0.25rem 0 0 0;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  color: #999;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.modal-close:hover {
  background: #f0f0f0;
  color: #666;
  transform: rotate(90deg);
}

/* 表單樣式 */
.project-form {
  padding: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.form-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid-2 textarea {
  min-height: 120px;
}

/* 美化日期選擇器 */
input[type="date"] {
  position: relative;
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* 日期選擇器彈窗美化 */
input[type="date"]::-webkit-datetime-edit {
  padding: 0;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

input[type="date"]::-webkit-datetime-edit-text {
  padding: 0 0.25rem;
  color: #999;
}

input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  padding: 0 0.25rem;
  color: #333;
  font-weight: 500;
}

input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
  background: rgba(102, 126, 234, 0.1);
  border-radius: 4px;
  outline: none;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Chips 輸入 */
.chips-input-wrapper {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.5rem;
  transition: all 0.2s ease;
}

.chips-input-wrapper:focus-within {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  font-weight: 600;
}

.chip-remove {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md); /* 原 0.9rem = 14.4px → 15px */
  line-height: 1;
  transition: all 0.2s ease;
}

.chip-remove:hover {
  background: rgba(255, 255, 255, 0.5);
}

.chips-input-wrapper input {
  border: none;
  padding: 0.5rem;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  flex: 1;
  min-width: 150px;
}

.chips-input-wrapper input:focus {
  outline: none;
  box-shadow: none;
}

/* 選項勾選 */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  margin-bottom: 0;
  position: relative;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.checkbox-group label:hover {
  background: rgba(46, 117, 213, 0.05);
}

/* 隱藏原生 checkbox */
.checkbox-group input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  width: 0;
  height: 0;
}

/* 自訂 checkbox 樣式 */
.checkbox-group input[type="checkbox"] + * {
  position: relative;
  padding-left: 2rem;
}

.checkbox-group input[type="checkbox"] + *::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid #CBD5E0;
  border-radius: 6px;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Hover 狀態 */
.checkbox-group input[type="checkbox"]:hover + *::before {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 117, 213, 0.1);
}

/* 勾選狀態 */
.checkbox-group input[type="checkbox"]:checked + *::before {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(46, 117, 213, 0.3);
}

/* 勾選圖示 */
.checkbox-group input[type="checkbox"]:checked + *::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  animation: checkmark-appear 0.3s ease;
}

@keyframes checkmark-appear {
  0% {
    opacity: 0;
    transform: translateY(-50%) rotate(45deg) scale(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-50%) rotate(45deg) scale(1.2);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) rotate(45deg) scale(1);
  }
}

/* Focus 狀態（鍵盤導航） */
.checkbox-group input[type="checkbox"]:focus + *::before {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Disabled 狀態 */
.checkbox-group input[type="checkbox"]:disabled + *::before {
  background: #F7FAFC;
  border-color: #E2E8F0;
  cursor: not-allowed;
}

.checkbox-group input[type="checkbox"]:disabled + * {
  color: #A0AEC0;
  cursor: not-allowed;
}

/* 按鈕組 */
.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.5rem 2rem;
  border-top: 2px solid #f0f0f0;
  position: sticky;
  bottom: 0;
  background: white;
}

/* 重複定義已刪除：.btn-cancel 和 .btn-confirm 在第 5009 行已定義 */

.btn-complete {
  background: var(--btn-success-bg);
  border: none;
  color: white;
  padding: var(--btn-padding);
  border-radius: var(--btn-radius);
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(67, 160, 71, 0.3);
}

.btn-complete:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(67, 160, 71, 0.4);
}

.btn-complete.completed {
  background: var(--btn-completed-bg);
  box-shadow: 0 2px 8px rgba(251, 140, 0, 0.3);
}

.btn-complete.completed:hover {
  box-shadow: 0 4px 12px rgba(251, 140, 0, 0.4);
}

/* 重複定義已刪除：.btn-delete 在第 5044 行已定義 */

/* 專案詳情 */
.project-detail-body {
  padding: 2rem;
}

.project-info-section {
  margin-bottom: 2rem;
}

.countdown-alert {
  padding: 1rem 1.25rem;
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  color: #856404;
  font-weight: 600;
}

.countdown-alert.urgent {
  background: #f8d7da;
  border-left-color: #dc3545;
  color: #721c24;
}

.progress-section {
  background: linear-gradient(135deg, #f5f7fa 0%, #fff 100%);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
}

.progress-bar-large {
  height: 24px;
  background: #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill-large {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.75rem;
  color: white;
  font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
  font-weight: 700;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  color: #666;
}

.progress-stats strong {
  font-size: var(--fs-lg); /* 原 1.3rem = 20.8px → 20px */
  color: #667eea;
}

/* 設計圖網格 */
.sheets-section {
  margin-bottom: 2rem;
}

.sheets-section h4 {
  margin: 0 0 1rem 0;
  font-size: var(--fs-lg-sm); /* 原 1.15rem = 18.4px → 18px */
  font-weight: 700;
  color: #333;
}

.project-sheets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 0.6rem;
}

.sheet-item {
  aspect-ratio: 1;
  border: 1.5px solid #e0e0e0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sheet-item:hover {
  border-color: #667eea;
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.2);
}

.sheet-item.completed {
  background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
  border-color: #43a047;
  color: white;
  box-shadow: 0 2px 8px rgba(67, 160, 71, 0.25);
}

.sheet-number {
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  font-weight: 600;
  color: #667eea;
}

.sheet-item.completed .sheet-number {
  color: white;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
}

.sheet-checkmark {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  font-size: 0.75rem;
  line-height: 1;
}

/* PDF 列印樣式 */
@media print {
  body * {
    visibility: hidden;
  }

  #print-area,
  #print-area * {
    visibility: visible;
  }

  #print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  .no-print {
    display: none !important;
  }
}

.print-document {
  max-width: 21cm;
  margin: 0 auto;
  padding: 2cm;
  background: white;
  font-size: var(--fs-base); /* 原 12pt = 16px */
  line-height: 1.6;
}

.print-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid #333;
}

.print-title {
  font-size: var(--fs-2xl); /* 原 24pt = 32px */
  font-weight: 700;
  margin: 0 0 0.5rem 0;
}

.print-date {
  font-size: var(--fs-sm); /* 原 11pt ≈ 14.67px ≈ 14px */
  color: #666;
  text-align: right;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.print-table td {
  padding: 0.75rem;
  border: 1px solid #333;
}

.print-table .label-cell {
  background: #f5f5f5;
  font-weight: 700;
  width: 30%;
}

.print-table .value-cell {
  width: 70%;
}

.print-checkbox {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #333;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.print-checkbox.checked::after {
  content: '✓';
  font-weight: 700;
  font-size: var(--fs-lg-sm); /* 原 14pt ≈ 18.67px ≈ 18px */
}

/* 響應式設計 */
@media (max-width: 1024px) {
  .projects-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #tools-section {
    padding: 1rem;
  }

  .projects-container {
    padding: 1.5rem;
  }

  .projects-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .btn-primary {
    width: 100%;
  }

  .projects-list {
    grid-template-columns: 1fr;
  }

  .floating-timer {
    bottom: 1rem;
    right: 1rem;
  }

  .timer-circle {
    width: 70px;
    height: 70px;
  }

  .timer-time {
    font-size: var(--fs-sm); /* 原 0.8rem = 12.8px → 14px */
  }

  .project-modal-content {
    max-width: 100%;
    max-height: 95vh;
  }

  .project-form {
    padding: 1.5rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
    padding: 1.25rem 1.5rem;
  }

  .modal-actions button {
    width: 100%;
  }

  .btn-delete {
    margin-right: 0;
  }

  .project-sheets-grid {
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.5rem;
  }

  .sheet-number {
    font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  }
}

@media (max-width: 480px) {
  .project-modal-header,
  .modal-actions,
  .project-form {
    padding: 1.25rem;
  }

  .timer-controls-mini {
    flex-direction: column;
  }
}

/* ============================================
   Stock Photo Upload - Improved Layout
   ============================================ */

/* Prevent layout overlap in stock photo preview */
#stock-photo-preview {
  clear: both;
  overflow: hidden;
}

#stock-photo-preview-img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
}

#remove-stock-photo {
  transition: all 0.2s ease;
}

#remove-stock-photo:hover {
  background: rgba(220, 53, 69, 1) !important;
  transform: scale(1.05);
}

/* ============================================
   Factory Discount List Styles
   ============================================ */

.factory-discount-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.factory-discount-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-gray);
  transition: background 0.2s ease;
}

.factory-discount-list li:last-child {
  border-bottom: none;
}

.factory-discount-list li:hover {
  background: rgba(0, 123, 255, 0.02);
}

.factory-discount-list li > span:first-child {
  flex: 0 0 150px;
  font-weight: 500;
  color: var(--text-strong);
}

.factory-discount-list li input {
  flex: 0 0 120px;
  padding: 0.5rem;
  border: 1px solid var(--border-gray);
  border-radius: 6px;
  font-size: var(--fs-md); /* 原 0.95rem ≈ 15.2px → 15px */
  transition: all 0.2s ease;
}

.factory-discount-list li input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.factory-discount-list li .history {
  flex: 1;
  font-size: var(--fs-sm); /* 原 0.85rem ≈ 13.6px → 14px */
  color: var(--text-muted);
}

/* Adjust collapsible section spacing in factory list */
#factory-list .collapsible-section {
  margin-bottom: 1.5rem;
}

#factory-list .collapsible-content {
  margin-top: 0.75rem;
}

/* ============================================
   Notification Badge (Red Dot)
   ============================================ */

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #ff4757 0%, #dc3545 100%);
  color: white;
  border-radius: 10px;
  font-size: var(--fs-xs); /* 原 0.7rem = 11.2px → 12px */
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4), 0 0 0 2px white;
  animation: badge-pulse 2s ease-in-out infinite;
  z-index: 10;
}

@keyframes badge-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4), 0 0 0 2px white;
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.6), 0 0 0 2px white, 0 0 0 4px rgba(220, 53, 69, 0.2);
  }
}

/* Notification badge on buttons */
button[style*="position: relative"] .notification-badge {
  top: -8px;
  right: -8px;
}

/* =========================================
   Matrix: Construct Theme - Landing Page
   ========================================= */

/* Scoped Variables for Landing Page */
.landing-page {
  --bg-color: #050505;
  --text-main: #ffffff;
  --text-muted: #666666;
  --accent: #2E75D5;
  --grid-line: rgba(255, 255, 255, 0.08);
  --font-en: 'Inter', sans-serif;
  --font-tc: 'Noto Sans TC', sans-serif;

  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-tc);
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Grid Background */
.landing-page .grid-bg {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
}

/* Navigation */
.landing-nav {
  position: fixed;
  top: 0; width: 100%;
  padding: 2rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  mix-blend-mode: exclusion;
  background: transparent !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

.landing-logo {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -1px;
  color: white !important;
  text-decoration: none;
}

.landing-nav .menu-btn {
  cursor: pointer;
  font-family: var(--font-en);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.5rem 1.5rem;
  border-radius: 50px;
  transition: all 0.3s ease;
  background: transparent;
  color: white;
}

.landing-nav .menu-btn:hover {
  background: white;
  color: black;
}

/* Hero Section */
.landing-page .hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 5%;
  position: relative;
  z-index: 1;
}

.landing-page .hero-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.landing-page .hero-label {
  color: var(--accent);
  font-family: var(--font-en);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.landing-page .hero-label::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--accent);
  display: block;
}

.landing-page .hero-title {
  font-family: var(--font-en);
  font-size: clamp(4rem, 13vw, 11rem);
  line-height: 0.85;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.3);
  position: relative;
}

.landing-page .hero-title span {
  display: block;
  color: white;
  -webkit-text-stroke: 0;
}

.landing-page .hero-desc {
  margin-top: 3rem;
  max-width: 600px;
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 300;
  border-left: 2px solid var(--accent);
  padding-left: 2rem;
  line-height: 1.6;
}

/* CTA Button */
.landing-page .cta-btn {
  margin-top: 4rem;
  padding: 0.75rem 1.75rem;
  background: var(--text-main);
  color: var(--bg-color);
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0;
}

.landing-page .cta-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(255,255,255,0.1);
}

.landing-page .scroll-indicator {
  position: absolute;
  bottom: 3rem;
  right: 5%;
  font-family: var(--font-en);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  transform: rotate(90deg);
  transform-origin: right bottom;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.landing-page .scroll-indicator::after {
  content: '';
  width: 40px; height: 1px;
  background: var(--text-muted);
}

/* Section Styles */
.landing-page .section {
  padding: 10rem 5%;
  border-top: 1px solid var(--grid-line);
  position: relative;
  z-index: 1;
  background: var(--bg-color);
}

.landing-page .section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 6rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--grid-line);
}

.landing-page .section-title {
  font-size: 4rem;
  font-weight: 900;
  margin: 0;
  line-height: 1;
  color: white;
}

.landing-page .section-tag {
  font-family: var(--font-en);
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 2px;
}

/* Service List (Replacement for Cards) */
.landing-page .service-list {
  display: grid;
  grid-template-columns: 1fr;
}

.landing-page .service-item {
  border-top: 1px solid var(--grid-line);
  padding: 4rem 0;
  display: grid;
  grid-template-columns: 0.5fr 2fr 1.5fr auto;
  align-items: flex-start;
  transition: all 0.4s ease;
  cursor: pointer;
  color: var(--text-muted);
}

.landing-page .service-item:last-child {
  border-bottom: 1px solid var(--grid-line);
}

.landing-page .service-item:hover {
  background: rgba(255,255,255,0.03);
  padding-left: 2rem;
  color: white;
}

.landing-page .s-num {
  font-family: var(--font-en);
  color: var(--accent);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.landing-page .s-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  color: white;
}

.landing-page .s-desc {
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.6;
  max-width: 90%;
}

.landing-page .s-icon {
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.4s ease;
  font-size: 2rem;
  color: white;
}

.landing-page .service-item:hover .s-icon {
  opacity: 1;
  transform: translateX(0);
}

/* Stats Grid */
.landing-page .stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--grid-line);
  border-left: 1px solid var(--grid-line);
}

.landing-page .stat-box {
  aspect-ratio: 1;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.landing-page .stat-box:hover {
  background: var(--accent);
}

.landing-page .stat-box:hover * {
  color: white !important;
  -webkit-text-fill-color: white !important;
}

.landing-page .stat-num {
  font-family: var(--font-en);
  font-size: 4rem;
  font-weight: 800;
  color: white;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.landing-page .stat-label {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Footer */
.landing-footer {
  padding: 5rem 5%;
  border-top: 1px solid var(--grid-line);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  z-index: 1;
  background: #000;
}

.landing-footer .footer-brand h2 {
  font-family: var(--font-en);
  font-size: 2rem;
  margin: 0 0 1rem 0;
  color: white;
}

.landing-footer .footer-brand p {
  color: var(--text-muted);
  max-width: 300px;
}

.landing-footer .footer-copy {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-en);
}

/* Editor Toolbar */
.landing-editor-toolbar {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(20px);
  padding: 1rem 2rem;
  border-radius: 50px;
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.landing-editor-toolbar span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Editable Elements */
[data-editable] {
  transition: all 0.3s ease;
  position: relative;
}

.editing-mode [data-editable] {
  cursor: text;
  outline: 2px dashed rgba(46, 117, 213, 0.5);
  outline-offset: 4px;
}

.editing-mode [data-editable]:hover {
  outline-color: var(--accent);
  background: rgba(46, 117, 213, 0.05);
}

.editing-mode [data-editable]:focus {
  outline: 2px solid var(--accent);
  background: rgba(46, 117, 213, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .landing-page .hero-title { font-size: 6rem; }
  .landing-page .service-item { grid-template-columns: 0.2fr 1fr; gap: 1rem; }
  .landing-page .s-title { grid-column: 2; font-size: 1.8rem; }
  .landing-page .s-desc { grid-column: 2; font-size: 1rem; margin-top: 0.5rem; }
  .landing-page .s-icon, .landing-page .s-num { display: none; }
  .landing-page .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .landing-page .hero { padding-top: 20vh; justify-content: flex-start; }
  .landing-page .hero-title { font-size: 15vw; }
  .landing-page .section-title { font-size: 2.5rem; }
  .landing-page .section-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .landing-page .service-item { padding: 2rem 0; }
  .landing-page .stats-grid { grid-template-columns: 1fr; }
  .landing-page .stat-box { aspect-ratio: auto; padding: 3rem 2rem; }
  .landing-footer { flex-direction: column; gap: 3rem; align-items: flex-start; }
  .landing-page .scroll-indicator { display: none; }

  .landing-editor-toolbar {
    bottom: 20px;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 20px;
    width: 90%;
  }

  .landing-editor-toolbar span {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
  }
}


/* ==========================================================================
   MATRIX V2.0 COMPLETE VISUAL OVERHAUL
   包含：新版 Landing Page 樣式 + 內部系統視覺覆寫 (Daylight Blueprint)
   Based on Gemini's Design Reference
   ========================================================================== */

/* --- PART 1: 內部系統覆寫 (Light Blueprint Style) --- */

/* 強制覆寫核心變數 */
:root {
  --radius-md: 2px !important;
  --radius-pill: 2px !important;
  --btn-radius: 2px !important;
  --shadow-sm: none !important;
  --shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  --light-gray: #F8FAFC !important;
  --border-gray: #E2E8F0 !important;
  --matrix-blue: #2E75D5;
  --matrix-slate: #64748B;
  --matrix-text: #334155;
}

/* ===== 網格背景 - Light Blueprint ===== */
body.main-page {
  background-color: #F8FAFC !important;
  background-image:
    linear-gradient(rgba(46, 117, 213, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 117, 213, 0.04) 1px, transparent 1px) !important;
  background-size: 40px 40px !important;
  background-attachment: fixed !important;
}

/* 所有容器透明化，讓網格顯示 */
body.main-page #app-main-container,
body.main-page .container,
body.main-page main {
  background: transparent !important;
}

body.main-page .view {
  background: transparent !important;
}

/* ===== Header - Blueprint Style ===== */
body.main-page .app-header {
  background: #FFFFFF !important;
  border-bottom: 1px solid #E2E8F0 !important;
  box-shadow: none !important;
  height: 64px !important;
  padding: 0 2rem !important;
}

body.main-page .nav-btn {
  border-radius: 0 !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  color: #64748B !important;
  height: 64px !important;
  font-weight: 600 !important;
  background: transparent !important;
}

body.main-page .nav-btn:hover {
  background: rgba(46, 117, 213, 0.05) !important;
  color: #2E75D5 !important;
}

body.main-page .nav-btn.active {
  border-bottom-color: #2E75D5 !important;
  color: #2E75D5 !important;
  background: rgba(46, 117, 213, 0.05) !important;
}

body.main-page .g-header-accent::after {
  display: none !important;
}

/* ===== 卡片 - Blueprint Card ===== */
body.main-page .project-card,
body.main-page .summary-card,
body.main-page .search-controls,
body.main-page .palette-summary,
body.main-page .perf-kpi-card,
body.main-page .progress-section,
body.main-page .tools-projects,
body.main-page .modal-content,
body.main-page .units-section-header,
body.main-page .projects-container,
body.main-page #internal-summary,
body.main-page #medal-legend {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 2px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  backdrop-filter: none !important;
}

/* ===== 按鈕 - Blueprint Button ===== */
body.main-page .btn,
body.main-page button.btn-primary {
  background: #2E75D5 !important;
  color: white !important;
  border: 1px solid #2E75D5 !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

body.main-page .btn:hover,
body.main-page button.btn-primary:hover {
  background: #1a5fb4 !important;
  border-color: #1a5fb4 !important;
}

body.main-page .btn.outline {
  background: #FFFFFF !important;
  border: 1px solid #CBD5E1 !important;
  color: #64748B !important;
}

body.main-page .btn.outline:hover {
  border-color: #2E75D5 !important;
  color: #2E75D5 !important;
}

body.main-page .btn.ghost {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: #64748B !important;
}

body.main-page .btn.ghost:hover {
  background: #F1F5F9 !important;
  color: #334155 !important;
}

/* ===== 輸入框 - Blueprint Input ===== */
body.main-page input[type="text"],
body.main-page input[type="number"],
body.main-page input[type="email"],
body.main-page input[type="date"],
body.main-page select,
body.main-page textarea {
  background: #FFFFFF !important;
  border: 1px solid #CBD5E1 !important;
  border-radius: 2px !important;
  font-family: 'Roboto Mono', monospace !important;
  box-shadow: none !important;
  color: #334155 !important;
}

body.main-page input:focus,
body.main-page select:focus,
body.main-page textarea:focus {
  border-color: #2E75D5 !important;
  box-shadow: 0 0 0 2px rgba(46, 117, 213, 0.1) !important;
  outline: none !important;
}

/* ===== 表格 - Blueprint Table ===== */
body.main-page #results-table,
body.main-page .perm-table,
body.main-page .perf-table {
  border: 1px solid #E2E8F0 !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  background: #FFFFFF !important;
}

body.main-page .results-header,
body.main-page .results-header > div,
body.main-page #results-table th,
body.main-page .perm-table th {
  background: #F1F5F9 !important;
  color: #64748B !important;
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  border-bottom: 1px solid #E2E8F0 !important;
}

body.main-page #results-table td,
body.main-page .perm-table td {
  border-bottom: 1px solid #F1F5F9 !important;
  color: #334155 !important;
}

body.main-page #results-table td[data-col="code"],
body.main-page .num {
  font-family: 'Roboto Mono', monospace !important;
  font-weight: 500 !important;
  color: #2E75D5 !important;
}

/* ===== Section 區塊 - 白色背景 ===== */
body.main-page .section-head {
  background: transparent !important;
  border-bottom: 1px solid #E2E8F0 !important;
  padding-bottom: 1rem !important;
  margin-bottom: 1.5rem !important;
}

body.main-page .palette-toolbar {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 2px !important;
  padding: 1rem !important;
  margin-bottom: 1rem !important;
}

body.main-page .results-header-wrapper {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 2px 2px 0 0 !important;
}

body.main-page .results-table-wrapper {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-top: none !important;
  border-radius: 0 0 2px 2px !important;
}

/* ===== Chips - Blueprint Style ===== */
body.main-page .chip {
  border-radius: 2px !important;
  border: 1px solid #CBD5E1 !important;
  background: #FFFFFF !important;
  color: #64748B !important;
  font-weight: 600 !important;
}

body.main-page .chip:hover {
  background: #F8FAFC !important;
  border-color: #94A3B8 !important;
}

body.main-page .chip.active {
  background: #2E75D5 !important;
  color: white !important;
  border-color: #2E75D5 !important;
}

/* ===== 隱藏舊裝飾 ===== */
body.main-page .weave-bg,
body.main-page .weave-glow {
  display: none !important;
}

body.main-page .weave-full {
  background: transparent !important;
  box-shadow: none !important;
}

/* ===== 用戶頭像 - 方形 ===== */
body.main-page #user-info img,
body.main-page .modal-avatar {
  border-radius: 2px !important;
  border: 1px solid #E2E8F0 !important;
}

/* ===== 登出按鈕 ===== */
body.main-page #logout-btn {
  border-radius: 2px !important;
  background: transparent !important;
  border: 1px solid #CBD5E1 !important;
  color: #64748B !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  font-size: 0.75rem !important;
}

body.main-page #logout-btn:hover {
  background: #F1F5F9 !important;
  border-color: #94A3B8 !important;
}

/* --- PART 2: 新版首頁樣式 (Dark Construct Style) --- */
.landing-page {
  --bg-color: #050505;
  --text-main: #ffffff;
  --text-muted: #666666;
  --accent: #2E75D5;
  --grid-line: rgba(255, 255, 255, 0.08);
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Noto Sans TC', sans-serif;
  position: relative;
  min-height: 100vh;
}

.landing-page .grid-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none; z-index: 0;
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
}

.landing-nav {
  position: fixed; top: 0; width: 100%; padding: 2rem 5%;
  display: flex; justify-content: space-between; align-items: center; z-index: 100;
  mix-blend-mode: exclusion; background: transparent !important; border: none !important; box-shadow: none !important;
}
.landing-logo { font-family: 'Inter', sans-serif; font-weight: 900; font-size: 1.5rem; letter-spacing: -1px; color: white !important; text-decoration: none; }
.landing-nav .menu-btn {
  cursor: pointer; font-family: 'Inter', sans-serif; font-size: 0.8rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.3); padding: 0.5rem 1.5rem; border-radius: 50px !important;
  background: transparent !important; color: white !important;
}
.landing-nav .menu-btn:hover { background: white !important; color: black !important; }

.landing-page .hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 0 5%; position: relative; z-index: 1; }
.landing-page .hero-label { color: var(--accent); font-family: 'Inter', sans-serif; font-weight: 600; letter-spacing: 2px; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.landing-page .hero-label::before { content: ''; width: 8px; height: 8px; background: var(--accent); display: block; }
.landing-page .hero-title { font-family: 'Inter', sans-serif; font-size: clamp(4rem, 13vw, 11rem); line-height: 0.85; font-weight: 800; margin: 0; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,0.3); }
.landing-page .hero-title span { display: block; color: white; -webkit-text-stroke: 0; }
.landing-page .hero-desc { margin-top: 3rem; max-width: 600px; color: var(--text-muted); font-size: 1.2rem; border-left: 2px solid var(--accent); padding-left: 2rem; }

.landing-page .cta-btn {
  margin-top: 4rem; padding: 1.2rem 3rem; background: var(--text-main) !important; color: var(--bg-color) !important;
  border: none !important; font-weight: 700; font-size: 1rem; cursor: pointer; display: flex; align-items: center; gap: 1rem; border-radius: 0 !important;
}
.landing-page .cta-btn:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(255,255,255,0.1) !important; }

.landing-page .section { padding: 10rem 5%; border-top: 1px solid var(--grid-line); position: relative; z-index: 1; }
.landing-page .section-title { font-size: 4rem; font-weight: 900; color: white; margin: 0; }
.landing-page .service-list { display: grid; grid-template-columns: 1fr; }
.landing-page .service-item {
  border-top: 1px solid var(--grid-line); padding: 4rem 0; display: grid; grid-template-columns: 0.5fr 2fr 1.5fr auto;
  align-items: flex-start; cursor: pointer; color: var(--text-muted); transition: all 0.4s ease;
}
.landing-page .service-item:last-child { border-bottom: 1px solid var(--grid-line); }
.landing-page .service-item:hover { background: rgba(255,255,255,0.03); padding-left: 2rem; color: white; }
.landing-page .s-num { font-family: 'Inter', sans-serif; color: var(--accent); }
.landing-page .s-title { font-size: 2.5rem; font-weight: 700; color: white; margin: 0; }
.landing-page .s-icon { opacity: 0; font-size: 2rem; color: white; transition: all 0.4s ease; }
.landing-page .service-item:hover .s-icon { opacity: 1; transform: translateX(0); }

.landing-page .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--grid-line); border-left: 1px solid var(--grid-line); }
.landing-page .stat-box { aspect-ratio: 1; border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); padding: 2rem; display: flex; flex-direction: column; justify-content: center; }
.landing-page .stat-box:hover { background: var(--accent); }
.landing-page .stat-box:hover * { color: white !important; -webkit-text-fill-color: white !important; }
.landing-page .stat-num { font-family: 'Inter', sans-serif; font-size: 4rem; font-weight: 800; color: white; line-height: 1; margin-bottom: 0.5rem; }

.landing-footer { padding: 5rem 5%; border-top: 1px solid var(--grid-line); display: flex; justify-content: space-between; align-items: flex-end; background: #000; }
.landing-footer h2 { font-family: 'Inter', sans-serif; font-size: 2rem; color: white; margin: 0 0 1rem 0; }

@media (max-width: 768px) {
  .landing-page .hero-title { font-size: 15vw; }
  .landing-page .service-item { padding: 2rem 0; grid-template-columns: 0.2fr 1fr; gap: 1rem; }
  .landing-page .s-title { grid-column: 2; font-size: 1.5rem; }
  .landing-page .s-desc { grid-column: 2; }
  .landing-page .s-icon { display: none; }
  .landing-page .stats-grid { grid-template-columns: 1fr; }
  .landing-footer { flex-direction: column; align-items: flex-start; gap: 2rem; }
}

/* 滑鼠游移特效 - Mouse Cursor Glow Effect */
.cursor-glow {
  position: fixed;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 40%, transparent 80%);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%);
}

.cursor-glow.active {
  opacity: 1;
}

/* 滑鼠游移增強 - 為互動元素添加額外效果 */
.landing-page .service-item,
.landing-page .cta-btn,
.landing-page .stat-box,
.landing-page .menu-btn {
  position: relative;
  overflow: hidden;
}

.landing-page .service-item::before,
.landing-page .cta-btn::before,
.landing-page .stat-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle 200px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(102, 126, 234, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.landing-page .service-item:hover::before,
.landing-page .cta-btn:hover::before,
.landing-page .stat-box:hover::before {
  opacity: 1;
}

/* ===================================
   資料管理 Data Management Styles
   =================================== */

.data-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.data-stat-card {
  background: var(--light-gray);
  border: 1px solid var(--border-gray);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.data-stat-card .stat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.data-stat-card .stat-icon {
  font-size: var(--fs-xl);
}

.data-stat-card .stat-title {
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--text-color);
}

.data-stat-card .stat-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.data-stat-card .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.data-stat-card .stat-row strong {
  color: var(--text-color);
  font-weight: 600;
}

.btn.danger {
  background: var(--danger-color);
  color: #fff;
  border: none;
}

.btn.danger:hover {
  background: #c82333;
}

.btn.outline.danger {
  background: transparent;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.btn.outline.danger:hover {
  background: var(--danger-color);
  color: #fff;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: var(--fs-sm);
}
