/* 「飲食日記」頁面專屬視覺樣式（2026-08-05）——只影響 index.html，不影響 admin.html。
   白底＋細線＋留白的輕量版，取代原本水墨紙感編輯風的墨黑實心色塊。
   原本版本備份在 index.pre-diary-redesign-backup.html（改回去只要把該檔內容貼回 index.html，
   或直接移除本檔案的 <link> 即可）。
   做法：先覆寫 style.css 既有的 CSS 變數（--page-bg/--surface/--ink/--ink-soft/--hairline/--accent2…），
   讓大部分沿用 var(--...) 的既有規則自動套用新配色；再針對「用實色色塊表示選中/強調」的少數元件
   （按鈕、分頁、提示框、chip、check-btn、med-icon 等）逐一從實心填色改成外框／底線樣式，
   避免只換顏色、黑色塊變綠色塊，沒有真的達到「拿掉所有黑色實心色塊」的目標。 */

:root {
  --bg: #FFFFFF;
  --ink: #141414;
  --dim: #8C8C87;
  --line: #EAEAE6;
  --acc: #2C5347;
  --pen: #2563EB;

  --page-bg: var(--bg);
  --surface: var(--bg);
  --ink-title: var(--ink);
  --ink-soft: var(--dim);
  --hairline: var(--line);
  --accent2: var(--acc);
  --accent2-text: var(--acc);

  --text: var(--ink);
  --text-soft: var(--dim);
  --text-muted: var(--dim);
  --border: var(--line);
  --danger: var(--acc);
}

body {
  background: var(--bg);
  font-family: "PingFang TC", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.brand-font { font-family: inherit; font-weight: 600; }

/* ---------- 1. Header ---------- */
.topbar {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.topbar .brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar .brand i { display: none; }

.topbar .actions-row {
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar .btn {
  width: auto;
  padding: 0;
  gap: 6px;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 400;
  border-radius: 0;
}
.topbar .btn:hover { opacity: 1; color: var(--ink); }

/* ---------- 2. 問候區（不用卡片） ---------- */
#homeView > .card:first-child {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-bottom: 36px;
}
#homeView > .card:first-child h1 {
  font-size: 27px;
  font-weight: 600;
  margin: 0 0 10px;
}
#homeView > .card:first-child .subtitle {
  font-size: 13px;
  line-height: 1.85;
  color: var(--dim);
  max-width: 30ch;
  margin: 0;
}

/* ---------- 3. 主分頁：文字分頁 ---------- */
.tabs {
  gap: 22px;
  padding-bottom: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 0 0 12px;
  margin-bottom: -1px;
  background: transparent;
  box-shadow: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--dim);
  font-weight: 400;
}
.tab i { display: none; }

.tab.active {
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--acc);
}

/* ---------- 4. 提示訊息 ---------- */
.reminder-box {
  display: block;
  background: transparent;
  color: #5E5E59;
  border: none;
  border-left: 1px solid var(--acc);
  border-radius: 0;
  padding: 2px 0 2px 13px;
  font-size: 12.5px;
  line-height: 1.85;
  margin-bottom: 24px;
}
.reminder-box i { display: none; }

/* ---------- 5. 表單欄位：無外框，只留底線 ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: none;
  padding: 28px;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 0;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.field:has(.chip-group) {
  display: block;
}
.field:has(.chip-group) label {
  display: block;
  margin-bottom: 10px;
}

.field label {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 0;
}

.field > div:only-child { flex: 1 1 auto; width: 100%; }

.field label + input,
.field label + select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  text-align: right;
}

.field input,
.field select {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: 14.5px;
  min-width: 0;
}

.field input:focus,
.field select:focus,
.macro-input:focus,
.qty-input:focus,
.exchange-search:focus,
.pending-item-name-input:focus {
  outline: 2px solid var(--acc);
  outline-offset: 1px;
  border-color: var(--acc);
}

.section-title {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

/* ---------- 6. 主要按鈕：外框樣式 ---------- */
.btn,
.btn-outline,
.btn-danger,
.btn-moss {
  background: transparent;
  color: var(--acc);
  border: 1px solid var(--acc);
  border-radius: 2px;
  font-weight: 600;
  box-shadow: none;
}
.btn:hover { background: rgba(44, 83, 71, 0.06); opacity: 1; }
.btn:disabled { opacity: 0.35; }

/* ---------- 通用 focus 可見度（鍵盤操作）---------- */
.btn:focus-visible,
.tab:focus-visible,
.chip:focus-visible,
.stepper-btn:focus-visible,
.check-btn:focus-visible,
.category-tag-btn:focus-visible,
.exchange-row:focus-visible,
.category-select-btn:focus-visible,
.category-select-option:focus-visible,
a:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

/* ---------- 延伸套用到同一頁其他元件，維持同一套白底＋細線語言 ---------- */
.chip {
  background: transparent;
  box-shadow: none;
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 2px;
}
.chip.selected {
  background: transparent;
  border-color: var(--acc);
  color: var(--acc);
  font-weight: 500;
}

/* 代換表面板的六大類切換：收合時只佔一行，點開才往下展開選項，取代原本固定佔一整排的chip橫排 */
.category-select-wrap {
  position: relative;
}
.category-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.category-select-btn .lbl-prefix {
  color: var(--dim);
  font-weight: 400;
  margin-right: 4px;
}
.category-select-btn .chev {
  color: var(--dim);
  font-size: 12px;
  transition: transform 0.15s ease;
}
.category-select-btn.open .chev {
  transform: rotate(180deg);
}
.category-select-panel {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.category-select-option {
  padding: 11px 14px;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.category-select-option:last-child { border-bottom: none; }
.category-select-option.selected {
  color: var(--acc);
  font-weight: 500;
  background: rgba(44, 83, 71, 0.05);
}
.category-select-option .check {
  color: var(--acc);
  font-size: 13px;
  visibility: hidden;
}
.category-select-option.selected .check {
  visibility: visible;
}

.check-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dim);
}
.check-btn.checked {
  background: transparent;
  border-color: var(--acc);
  color: var(--acc);
}

.med-icon {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--acc);
}

.stepper-btn.plus.active {
  background: transparent;
  border-color: var(--acc);
  color: var(--acc);
}

.exchange-tier-tab.on {
  background: transparent;
  border-color: var(--acc);
  color: var(--acc);
}

.stat-pill {
  background: transparent;
  border: 1px solid var(--line);
}

.badge,
.badge-root,
.badge-member,
.badge-active,
.badge-suspended {
  background: transparent;
  border: 1px solid var(--line);
}

.modal {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: none;
}

/* ---------- 照片圈選＋備注（AI拍照辨識用，2026-08-05）---------- */
.photo-annotate-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 8px;
}
.photo-annotate-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}
.photo-annotate-wrap {
  position: relative;
  width: 100%;
  border-radius: 2px;
  overflow: hidden;
  background: #F2F2EF;
}
/* 只有按下「畫筆」進入標記模式時才鎖住手勢＋讓canvas接收觸控，
   平常照片區域維持一般滑動頁面的行為，不會誤觸畫線 */
.photo-annotate-wrap.pen-active { touch-action: none; outline: 2px solid var(--pen); outline-offset: -2px; }
.photo-annotate-wrap img { width: 100%; height: auto; display: block; }
.photo-annotate-wrap canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.photo-annotate-wrap.pen-active canvas { pointer-events: auto; cursor: crosshair; }
.photo-annotate-hint { font-size: 11px; color: var(--dim); margin: 6px 0 0; }
/* 畫筆/清除按鈕都浮在照片右上角（不是排在照片下方的工具列），畫圈當下手指就在附近，不用移到別處按 */
.photo-annotate-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pen-toggle-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.pen-toggle-btn.active {
  border-color: var(--pen);
  color: #fff;
  font-weight: 600;
  background: var(--pen);
}
.clear-icon-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 13px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.photo-note-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: var(--ink);
}
.photo-note-input:focus { outline: none; border-bottom-color: var(--acc); }
