/* =========================================================
 * Curves Flow Brand Theme (cv-mail v2)
 * 視覺語言沿用「2026 女神增肌減脂賽」：綠色品牌、左側選單、大字閱讀模式
 * 變數名稱（--brand-*）沿用舊版，避免大量改 class
 * =======================================================*/

:root {
  /* ---------- Curves 品牌綠 ---------- */
  --brand-50:  #f1f8f3;
  --brand-100: #dcefe2;
  --brand-200: #bfe0ca;
  --brand-300: #9fd9b3;
  --brand-400: #5fc283;
  --brand-500: #22a052;
  --brand-600: #15803d;   /* 主品牌色 (按鈕 / icon / 強調) */
  --brand-700: #116932;   /* hover、表頭 */
  --brand-800: #0d5228;
  --brand-900: #173a2b;   /* 標題深綠 */

  /* ---------- 背景 / 表面 ---------- */
  --bg:        #eef3ef;
  --bg-soft:   #F6F7FA;
  --surface:   #FFFFFF;
  --surface-2: #f5f9f6;
  --border:    #E4E7EE;
  --border-2:  #E5E7EB;

  /* ---------- 文字 ---------- */
  --ink:    #1F2330;
  --ink-2:  #3A3F4B;
  --ink-3:  #5F6470;
  --ink-4:  #8A909B;

  /* ---------- 語意色 ---------- */
  --success:    #1F6F2B;
  --success-bg: #E7F4E8;
  --warning:    #9A4A00;
  --warning-bg: #FFF3E3;
  --danger:     #B3261E;
  --danger-bg:  #FDECEA;
  --info:       #116932;
  --info-bg:    #e6f4ea;

  /* 梯次色（語意：第 1/2/3 批） */
  --batch-1: #15803d;
  --batch-2: #F07C00;
  --batch-3: #2563EB;

  /* ---------- 陰影 ---------- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .12);
  --shadow:    0 4px 14px rgba(17, 105, 50, .10), 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .18);

  /* ---------- 側欄 ---------- */
  --sidebar-w: 232px;

  /* ---------- 字體 ---------- */
  --font-sans: 'Noto Sans TC', system-ui, -apple-system, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
}

/* ========== Base ========== */
html, body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== 品牌區（綠漸層 + 右下圓弧） ========== */
.cv-brand {
  background:
    radial-gradient(circle at 18% 35%, rgba(170, 240, 195, 0.55) 0, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(20, 120, 60, 0.55) 0, transparent 50%),
    linear-gradient(135deg, #15803d 0%, #3fb36b 100%);
  border-bottom-right-radius: 70px 46px;
  color: #fff;
}
.logo-curves { display: block; width: auto; user-select: none; -webkit-user-drag: none; }
.logo-curves.white { filter: brightness(0) invert(1); }

/* ========== 左側選單 ========== */
.cv-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  width: var(--sidebar-w);
  background: #fff;
  display: flex; flex-direction: column;
  box-shadow: 1px 0 4px rgba(0, 0, 0, .08);
  transition: transform .2s ease;
}
.cv-sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 0 10px; }
.cv-menu-section {
  padding: 14px 16px 4px 18px;
  font-size: 12px; font-weight: 700; color: #8a8fa0; letter-spacing: .08em;
}
.cv-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 10px 16px;
  font-size: 15.5px; color: #2a2e38; text-align: left;
  cursor: pointer; transition: background .15s;
}
.cv-menu-item:hover { background: #edf7f0; }
.cv-menu-item svg { flex-shrink: 0; color: #7a8090; }
.cv-menu-item.active { background: linear-gradient(90deg, #22a052, #86d9a4); color: #fff; }
.cv-menu-item.active svg { color: #fff; }
.cv-menu-item.is-group { font-weight: 700; }
.cv-menu-sub { background: #f4f5f8; }
.cv-menu-sub .cv-menu-item { padding-left: 26px; font-size: 15px; min-height: 42px; }
.cv-menu-sub .cv-menu-item.active { background: #3fae68; }
.cv-menu-count { margin-left: auto; font-size: 12px; color: #8a8fa0; }
.cv-sidebar-user { padding: 12px 16px; border-top: 1px solid #eceef3; font-size: 13px; color: #5f6470; line-height: 1.6; }
.cv-sidebar-logout {
  height: 48px; flex-shrink: 0;
  background: var(--brand-600); color: #fff; font-weight: 700; font-size: 16px;
}
.cv-sidebar-logout:hover { background: var(--brand-700); }
.cv-sidebar-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(15, 23, 42, .35); }

.cv-shell { min-height: 100vh; }
@media (min-width: 1024px) {
  .cv-shell { padding-left: var(--sidebar-w); }
}
@media (max-width: 1023px) {
  .cv-sidebar { transform: translateX(-100%); }
  body.menu-open .cv-sidebar { transform: translateX(0); }
}

/* ========== 頁首（頁面標題 + 資料區間 + 動作） ========== */
.cv-topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(238, 241, 246, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid #dfe3ea;
}
.cv-page-title { font-size: 24px; font-weight: 700; line-height: 1.3; color: #1f2330; }
.cv-meta { font-size: 13.5px; color: #5f6470; }
@media (max-width: 767px) { .cv-page-title { font-size: 20px; } }

/* ========== Card ========== */
.cv-card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.cv-card-hd {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

/* ========== Section title（左邊一條綠色短粗 bar） ========== */
.cv-title-bar {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; color: var(--brand-900);
  font-size: 17px;
}
.cv-title-bar::before {
  content: ""; width: 4px; height: 18px; border-radius: 2px;
  background: var(--brand-600);
  flex-shrink: 0;
}

/* ========== Buttons ========== */
.cv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 18px; border-radius: 6px;
  font-weight: 700; font-size: 15px;
  min-height: 42px; line-height: 1.2;
  box-shadow: 0 2px 3px rgba(0, 0, 0, .12);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.cv-btn:active { transform: translateY(1px); }
.cv-btn[disabled] { opacity: .55; cursor: not-allowed; }

.cv-btn-primary { background: var(--brand-600); color: #fff; }
.cv-btn-primary:hover { background: var(--brand-700); }

.cv-btn-outline { background: #fff; border: 1px solid var(--brand-600); color: var(--brand-600); box-shadow: none; }
.cv-btn-outline:hover { background: var(--brand-50); }

.cv-btn-outline-green { background: #fff; border: 1px solid #b9dfbd; color: #1f6f2b; box-shadow: none; }
.cv-btn-outline-green:hover { background: #e7f4e8; }

.cv-btn-outline-orange { background: #fff; border: 1px solid #f6cf9c; color: #9a4a00; box-shadow: none; }
.cv-btn-outline-orange:hover { background: #fff3e3; }

.cv-btn-outline-rose { background: #fff; border: 1px solid #e3a29c; color: #b3261e; box-shadow: none; }
.cv-btn-outline-rose:hover { background: #fdecea; }

/* 舊 header 內的按鈕樣式，保留給 settings 頁 */
.cv-btn-ghost-on-dark { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: none; }
.cv-btn-ghost-on-dark:hover { background: rgba(255, 255, 255, .26); }
.cv-btn-solid-on-dark { background: #fff; color: var(--brand-700); }
.cv-btn-solid-on-dark:hover { background: var(--brand-50); }

/* ========== 舊 header（settings 頁仍使用） ========== */
.cv-header {
  background:
    radial-gradient(circle at 18% 35%, rgba(170, 240, 195, 0.45) 0, transparent 45%),
    linear-gradient(135deg, #15803d 0%, #3fb36b 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(17, 105, 50, .18);
}
.cv-header .cv-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: #fff; color: var(--brand-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px;
}
.cv-header .cv-title { font-weight: 900; letter-spacing: -0.01em; }
.cv-header .cv-subtitle { color: rgba(255, 255, 255, .85); font-size: 12px; }

/* ========== Form ========== */
.cv-input,
input[type=date].cv,
input[type=month].cv,
select.cv,
input[type=text].cv,
input[type=password].cv {
  background: #fff;
  border: 1px solid #c4c8d2;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 15px;
  min-height: 42px;
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.cv-input:focus,
input.cv:focus, select.cv:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(34, 160, 82, .18);
}

/* ========== Badges（圖示＋文字，不只靠顏色） ========== */
.cv-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 11px; border-radius: 9999px;
  font-weight: 600; font-size: 13px; line-height: 1.5;
  background: #e6f4ea; color: #116932; border: 1px solid #b3d9c0;
}
.cv-badge-ok      { background: #e7f4e8; color: #1f6f2b; border-color: #b9dfbd; }
.cv-badge-warn    { background: #fff3e3; color: #9a4a00; border-color: #f6cf9c; }
.cv-badge-danger  { background: #fdecea; color: #b3261e; border-color: #f4b7b2; }
.cv-badge-info    { background: #e6f4ea; color: #116932; border-color: #b3d9c0; }
.cv-badge-muted   { background: #f1f2f5; color: #5f6673; border-color: #dcdfe5; }

/* ========== 文字 utility ========== */
.cv-text-brand      { color: var(--brand-600); }
.cv-text-brand-deep { color: var(--brand-900); }
.cv-text-muted      { color: var(--ink-3); }
.cv-text-hint       { color: var(--ink-4); }

/* ========== Footer ========== */
.cv-footer {
  text-align: center;
  color: var(--ink-4);
  font-size: 12.5px;
  line-height: 1.8;
  padding: 24px 16px 32px;
}
.cv-footer .cv-footer-strong { color: var(--ink-3); font-weight: 500; }

/* ========== Animation ========== */
@keyframes cvSpin { to { transform: rotate(360deg); } }
