*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --sidebar-bg: #0f2744;
  --sidebar-hover: #1a3a5c;
  --sidebar-active: #1e4976;
  --sidebar-text: #94b8d8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --cyan: #06b6d4;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── 載入動畫 ── */
.loading-state { display: flex; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px; gap: 10px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 空白狀態 ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { width: 64px; height: 64px; background: var(--primary-light); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: white; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; z-index: 1000; opacity: 0; transition: all 0.25s ease; white-space: nowrap; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 按鈕 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* ④ LED 燈點效果 */
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.badge.claimed { background: var(--success-bg); color: var(--success); }
.badge.claimed .badge-dot { background: var(--success); box-shadow: 0 0 5px var(--success), 0 0 10px rgba(22,163,74,0.5); animation: led-g 2s ease-in-out infinite; }
.badge.unclaimed { background: var(--danger-bg); color: var(--danger); }
.badge.unclaimed .badge-dot { background: var(--danger); box-shadow: 0 0 5px var(--danger), 0 0 10px rgba(220,38,38,0.5); animation: led-r 2s ease-in-out infinite; }
@keyframes led-g { 0%,100% { box-shadow: 0 0 4px var(--success), 0 0 8px rgba(22,163,74,0.4); } 50% { box-shadow: 0 0 8px var(--success), 0 0 18px rgba(22,163,74,0.7); } }
@keyframes led-r { 0%,100% { box-shadow: 0 0 4px var(--danger), 0 0 8px rgba(220,38,38,0.4); } 50% { box-shadow: 0 0 8px var(--danger), 0 0 18px rgba(220,38,38,0.7); } }

/* ═══════════════════════════
   登入頁
═══════════════════════════ */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #0a1a2e 0%, #0f2744 40%, #1a3a5c 100%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: rgba(255,255,255,0.97); border-radius: 16px; padding: 48px 40px; width: 100%; max-width: 420px; box-shadow: 0 25px 60px rgba(0,0,0,0.35), 0 0 0 1px rgba(59,130,246,0.1); }
.login-logo-wrap { width: 76px; height: 76px; background: linear-gradient(135deg, #0f2744, #2563eb); border-radius: 18px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; box-shadow: 0 8px 24px rgba(37,99,235,0.4); position: relative; overflow: hidden; }
.login-logo-wrap::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent); }
.login-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 11px; color: var(--text-muted); text-align: center; letter-spacing: 0.8px; margin-bottom: 12px; }
.login-divider { width: 40px; height: 2px; background: linear-gradient(90deg, var(--primary), var(--cyan)); margin: 0 auto 28px; border-radius: 2px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.8px; }
.field-wrap { position: relative; }
.field-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: 0.4; display: flex; align-items: center; }
.field input { width: 100%; padding: 12px 14px 12px 38px; border: 2px solid var(--border); border-radius: 8px; font-size: 15px; color: var(--text); background: #f8fafc; transition: border-color 0.15s; appearance: none; }
.field input:focus { outline: none; border-color: var(--primary); background: white; }
.login-btn { width: 100%; padding: 14px; background: linear-gradient(135deg, #1d4ed8, #2563eb); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 14px rgba(37,99,235,0.4); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-footer { text-align: center; margin-top: 20px; font-size: 11px; color: var(--text-muted); }
.error-msg { background: var(--danger-bg); color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; text-align: center; }

/* ═══════════════════════════
   主框架
═══════════════════════════ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── 側邊欄 ── */
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-logo { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.07); display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.logo-mark { width: 40px; height: 40px; background: linear-gradient(135deg, #1d4ed8, #2563eb); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 4px 10px rgba(37,99,235,0.3); }
.logo-name { font-size: 14px; font-weight: 700; color: white; line-height: 1.2; }
.logo-sub { font-size: 9.5px; color: var(--sidebar-text); margin-top: 1px; letter-spacing: 0.8px; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section-label { font-size: 9.5px; font-weight: 700; color: rgba(148,184,216,0.4); text-transform: uppercase; letter-spacing: 1.2px; padding: 12px 18px 5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--sidebar-text); font-size: 13.5px; font-weight: 500; cursor: pointer; border-left: 3px solid transparent; transition: all 0.15s; user-select: none; }
.nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.9); }
.nav-item.active { background: var(--sidebar-active); color: white; border-left-color: #3b82f6; }
.nav-item.disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.nav-icon { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ni-blue { background: rgba(37,99,235,0.2); } .ni-teal { background: rgba(13,148,136,0.2); }
.ni-green { background: rgba(22,163,74,0.2); } .ni-orange { background: rgba(217,119,6,0.2); }
.ni-purple { background: rgba(124,58,237,0.2); }
.nav-item.active .ni-blue { background: rgba(59,130,246,0.3); }
.nav-item.active .ni-teal { background: rgba(20,184,166,0.3); }
.nav-badge { margin-left: auto; background: rgba(59,130,246,0.3); color: #93c5fd; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.nav-badge.soon { background: rgba(148,184,216,0.1); color: rgba(148,184,216,0.45); }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; background: linear-gradient(135deg, #2563eb, #7c3aed); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: white; flex-shrink: 0; }
.user-name { font-size: 13px; color: white; font-weight: 600; }
.user-role { font-size: 10px; color: var(--sidebar-text); }
.logout-btn { margin-left: auto; background: none; border: none; color: var(--sidebar-text); cursor: pointer; opacity: 0.7; padding: 4px; display: flex; align-items: center; }
.logout-btn:hover { opacity: 1; }

/* ── 主內容區 ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ⑤ Topbar 裝飾線 */
.topbar { background: var(--card); padding: 0 24px; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex-shrink: 0; position: relative; }
.topbar::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent 0%, #3b82f6 25%, #06b6d4 50%, #3b82f6 75%, transparent 100%); }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-back { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 500; padding: 6px 10px 6px 6px; border-radius: 6px; transition: all 0.15s; }
.topbar-back:hover { background: var(--bg); color: var(--text); }
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 13px; color: var(--text-muted); }
.menu-btn { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 6px; }

.content { flex: 1; overflow-y: auto; padding: 22px 24px 100px; }

/* ── 底部導航（手機） ── */
.bottom-nav { display: none; height: var(--bottomnav-h); background: var(--card); border-top: 1px solid var(--border); position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; }
.bn-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--text-muted); cursor: pointer; transition: color 0.15s; border: none; background: none; flex: 1; }
.bn-item.active { color: var(--primary); }
.bn-item.disabled { opacity: 0.4; pointer-events: none; }
.bn-icon { font-size: 22px; line-height: 1; }

/* ── FAB ── */
.fab { position: fixed; bottom: calc(var(--bottomnav-h) + 14px); right: 18px; width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: white; border: none; font-size: 26px; cursor: pointer; box-shadow: 0 4px 14px rgba(37,99,235,0.5); display: none; align-items: center; justify-content: center; z-index: 90; transition: transform 0.15s; }
.fab:active { transform: scale(0.92); }

/* ═══════════════════════════
   儀表板
═══════════════════════════ */
.welcome-banner { background: linear-gradient(135deg, #0f2744 0%, #1e4976 100%); border-radius: var(--radius); padding: 22px 24px; color: white; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; position: relative; overflow: hidden; }
.banner-text h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; position: relative; }
.banner-text p { font-size: 13px; opacity: 0.7; position: relative; }
.banner-badge { background: rgba(59,130,246,0.3); border: 1px solid rgba(59,130,246,0.5); color: #93c5fd; font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 20px; white-space: nowrap; position: relative; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-sub { font-size: 12px; color: var(--text-muted); }
.stat-sub .up { color: var(--success); font-weight: 600; }
.stat-sub .down { color: var(--danger); font-weight: 600; }

/* ③ 工業圖標 */
.ind-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ind-icon.blue { background: #eff6ff; } .ind-icon.green { background: #f0fdf4; }
.ind-icon.orange { background: #fff7ed; } .ind-icon.purple { background: #f5f3ff; }
.ind-icon.teal { background: #f0fdfa; }

.section-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 16px; }
.section-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

/* ═══════════════════════════
   午餐功能
═══════════════════════════ */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.page-header h2 { font-size: 18px; font-weight: 700; }
.summary-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.sum-card { background: var(--card); border-radius: 10px; padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.sum-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.sum-value { font-size: 22px; font-weight: 700; }
.sum-value.red { color: var(--danger); } .sum-value.green { color: var(--success); }
.filter-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.filter-tab { padding: 6px 16px; border-radius: 20px; border: 2px solid var(--border); background: var(--card); font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-muted); transition: all 0.15s; }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: white; }

/* 電腦版表格 */
.record-table { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.table-header { display: grid; grid-template-columns: 100px 1fr 100px 100px 110px 60px; padding: 10px 20px; background: #f8fafc; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.table-row { display: grid; grid-template-columns: 100px 1fr 100px 100px 110px 60px; padding: 13px 20px; border-bottom: 1px solid var(--border); font-size: 14px; align-items: center; cursor: pointer; transition: background 0.1s; }
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: #f8fafc; }
.table-row .items-text { font-size: 13px; color: var(--text-muted); }
.table-row .amount { font-weight: 600; }
.table-edit-btn { color: var(--primary); background: none; border: none; cursor: pointer; font-size: 13px; font-weight: 600; }

/* 手機版卡片 */
.record-cards { display: none; }
.record-card { background: var(--card); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow); border: 1px solid var(--border); cursor: pointer; transition: transform 0.1s; }
.record-card:active { transform: scale(0.98); }
.rc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rc-date { font-weight: 700; font-size: 15px; }
.rc-items { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.6; }
.rc-bottom { display: flex; justify-content: space-between; font-size: 13px; border-top: 1px solid var(--border); padding-top: 8px; }
.rc-total { font-weight: 700; }
.rc-gap { color: var(--danger); font-weight: 600; }
.rc-gap.zero { color: var(--success); }

/* ═══════════════════════════
   表單
═══════════════════════════ */
.form-section { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.form-section-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-input { width: 100%; padding: 11px 14px; border: 2px solid var(--border); border-radius: 8px; font-size: 15px; color: var(--text); background: white; transition: border-color 0.15s; appearance: none; }
.form-input:focus { outline: none; border-color: var(--primary); }
.item-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.item-row .form-input:first-child { flex: 2; }
.item-row .form-input:last-of-type { flex: 1; }
.remove-item-btn { background: none; border: none; color: var(--danger); font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; flex-shrink: 0; }
.add-item-btn { width: 100%; padding: 10px; border: 2px dashed var(--border); border-radius: 8px; background: none; color: var(--primary); font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 4px; transition: all 0.15s; }
.add-item-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.claim-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.toggle-btn { flex: 1; padding: 11px; border: 2px solid var(--border); border-radius: 8px; background: white; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s; color: var(--text-muted); }
.toggle-btn.active-unclaimed { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.toggle-btn.active-claimed { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-value { font-weight: 600; }
.info-value.red { color: var(--danger); }
.info-value.green { color: var(--success); }
.form-actions { position: fixed; bottom: 0; left: var(--sidebar-w); right: 0; background: var(--card); border-top: 1px solid var(--border); padding: 12px 16px; display: flex; gap: 10px; z-index: 80; }

/* ── 開發中 ── */
.coming-soon { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60vh; text-align: center; }
.cs-icon { width: 80px; height: 80px; background: var(--primary-light); border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 36px; margin-bottom: 20px; }
.cs-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.cs-sub { color: var(--text-muted); font-size: 14px; max-width: 280px; }

/* ═══════════════════════════
   手機響應式
═══════════════════════════ */
/* 側邊欄覆蓋層（手機） */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(-1 * var(--sidebar-w) - 10px);
    z-index: 200;
    transition: left 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { left: 0; }
  .menu-btn { display: flex; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); }
  .fab { display: flex; }
  .content { padding: 16px 16px 140px; }
  .topbar { padding: 0 16px; }
  .topbar-date { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-value { font-size: 20px; }
  .summary-row { grid-template-columns: 1fr 1fr; }
  .summary-row .sum-card:last-child { grid-column: 1 / -1; }
  .record-table { display: none; }
  .record-cards { display: block; }
  .filter-tabs { overflow-x: auto; padding-bottom: 4px; flex-wrap: nowrap; }
  .form-actions { left: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .welcome-banner { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ── Modal (AIM管理頁) ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 16px;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.modal-title {
  font-size: 17px; font-weight: 700;
  margin-bottom: 20px; color: var(--text);
}
.btn-secondary {
  flex: 1; padding: 12px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--sidebar-hover); }

/* modal inputs without icon */
.modal-card .field input,
.modal-card .field input[type="number"] {
  padding: 12px 14px;
}

/* ══════════════════════════════════════
   缺失檢點項目 — 卡片列表 (dark theme)
══════════════════════════════════════ */
.cl-list { display: flex; flex-direction: column; gap: 10px; }

.cl-item {
  background: #0f2744;
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s;
}
.cl-item:hover { border-color: rgba(59,130,246,0.35); }
.cl-item.disabled { opacity: 0.55; }

.cl-thumb {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0; overflow: hidden;
}
.cl-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.cl-thumb-empty { opacity: 0.35; }

.cl-info { flex: 1; min-width: 0; }
.cl-name { font-size: 15px; font-weight: 700; color: #e2eaff; margin-bottom: 4px; }
.cl-desc { font-size: 12px; color: #64748b; line-height: 1.4; }
.cl-no-desc { font-size: 12px; color: #64748b; opacity: 0.5; font-style: italic; }

.cl-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* iOS Toggle */
.toggle-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.toggle-label { font-size: 10px; color: #64748b; white-space: nowrap; }
.toggle-label.on { color: #86efac; }
.cl-toggle {
  width: 40px; height: 22px;
  border-radius: 11px;
  position: relative; cursor: pointer;
  transition: background 0.2s;
  border: none; padding: 0;
  flex-shrink: 0;
}
.cl-toggle.on  { background: #22c55e; }
.cl-toggle.off { background: rgba(255,255,255,0.18); }
.cl-toggle-thumb {
  position: absolute; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  transition: left 0.18s;
  pointer-events: none;
}
.cl-toggle.on  .cl-toggle-thumb { left: 21px; }
.cl-toggle.off .cl-toggle-thumb { left: 3px; }

.btn-edit-cl {
  padding: 8px 14px; border-radius: 8px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: #93c5fd;
  font-size: 12px; font-weight: 700; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
}
.btn-edit-cl:hover { background: rgba(59,130,246,0.2); }

/* AIM 管理員 page header sub-title */
.page-sub { font-size: 13px; color: #64748b; margin-bottom: 16px; }

/* ═══════════════════════════
   備料項目清單 重設計
═══════════════════════════ */
.mat-cat-group-header { padding: 8px 16px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); background: #f8fafc; border-top: 1px solid var(--border); }
.mat-cat-group-header.first { border-top: none; }
.mat-item-row { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.mat-item-row:last-child { border-bottom: none; }
.mat-item-row:hover { background: #f8fafc; }
.mat-item-top { display: flex; align-items: center; gap: 10px; }
.mat-item-name { font-weight: 600; font-size: 14px; flex: 1; color: var(--text); }
.mat-item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mat-qty-badge { font-size: 12px; color: var(--text-muted); background: #f1f5f9; padding: 2px 9px; border-radius: 10px; white-space: nowrap; border: 1px solid var(--border); }
.mat-sub-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.mat-sub-sep { color: var(--border); font-size: 12px; }
.mat-spec-text { font-size: 12px; color: var(--text-muted); }
.mat-label-chip { font-size: 11px; background: #eff6ff; color: #2563eb; padding: 1px 8px; border-radius: 10px; font-weight: 600; letter-spacing: 0.3px; border: 1px solid #bfdbfe; }
.mat-cc-label-group { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.mat-cc-name { font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 1px 6px; border-radius: 6px; }
