/* =============================================================
   餐飲 AI × ERP — 現場端設計系統（長輩友善硬規格）
   本文 24px、主按鈕高 ≥64px、觸控目標 ≥48px、間距 ≥12px、對比 ≥4.5:1
   色系：森林綠 × 暖米白 × 深柿橘（主動作鈕 #b4551d，白字對比 4.93:1）
   規格依據：docs/02_畫面規劃與設計系統.md
   ============================================================= */
:root {
  --green-900: #1c3a28;
  --green-800: #24503a;
  --green-700: #2d6a4a;
  --green-600: #37845b;
  --green-100: #e3efe5;
  --green-50:  #f0f6f0;
  --cream:     #faf6ee;
  --card:      #ffffff;
  --ink:       #26301f;
  --ink-soft:  #55604a;
  --accent:    #d96f32;
  --accent-dark: #b4551d;
  --gold:      #e8a33d;
  --danger:    #c0392b;
  --danger-bg: #fdecea;
  --line:      #e6e0d2;

  --fs-body: 24px;
  --fs-small: 20px;
  --fs-h2: 30px;
  --fs-h1: 34px;
  --fs-price: 40px;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 4px 18px rgba(38, 48, 31, .09);
  --shadow-lg: 0 10px 32px rgba(38, 48, 31, .14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, #eef4e4 0%, transparent 60%),
    var(--cream);
  min-height: 100vh;
  padding-bottom: 60px;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 0 18px; }

/* ---------- 說明列 ---------- */
.devbar {
  background: #343b2e; color: #e8e5d6; font-size: 20px;
  padding: 10px 0; text-align: center; letter-spacing: 1px;
}
.devbar strong { color: #fff; }

/* ---------- 頂部橫幅 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-700) 70%, #3d7a52 100%);
  color: #fff;
  padding: 18px 0 20px;
  border-radius: 0 0 28px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 54px; height: 54px; border-radius: 16px;
  background: rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; border: 1px solid rgba(255,255,255,.25);
}
.brand-name { font-size: 26px; font-weight: 700; letter-spacing: 1px; }
.brand-sub  { font-size: 20px; opacity: .9; letter-spacing: 2px; }
.top-user { text-align: right; font-size: var(--fs-small); }
.top-user .hello { opacity: .92; font-size: 20px; }
.top-user .name { font-weight: 700; font-size: 23px; }

/* ---------- 分頁切換列 ---------- */
.tabbar {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.tabbar button {
  min-height: 68px; border-radius: 16px; cursor: pointer;
  border: 2.5px solid var(--line); background: var(--card);
  font-family: inherit; font-size: 24px; font-weight: 800; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  transition: transform .1s ease;
  padding: 6px 4px;
}
.tabbar button .ic { font-size: 26px; line-height: 1.2; }
.tabbar button:active { transform: scale(.97); }
.tabbar button.on {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  border-color: var(--green-700); color: #fff;
  box-shadow: 0 6px 16px rgba(45,106,74,.32);
}

/* ---------- 畫面切換 ---------- */
.screen { display: none; }
.screen.on { display: block; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pagehead { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.pagehead h1 { font-size: var(--fs-h1); color: var(--green-900); font-weight: 800; }
.pagehead .sub { font-size: 20px; color: var(--ink-soft); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(230, 224, 210, .8);
  overflow: hidden;
  margin-bottom: 18px;
}
.card-pad { padding: 22px; }

/* ---------- 首頁功能磚 ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tile {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(230,224,210,.8);
  padding: 24px 16px 20px;
  text-align: center; cursor: pointer;
  color: var(--ink); font-family: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
  position: relative;
}
.tile:active { transform: scale(.97); box-shadow: var(--shadow-lg); }
.tile-icon {
  width: 76px; height: 76px; margin: 0 auto 12px;
  border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 40px;
}
.tile-icon.g1 { background: linear-gradient(145deg, #e6f2e2, #d0e8cd); }
.tile-icon.g2 { background: linear-gradient(145deg, #fdeedd, #fbdfc0); }
.tile-icon.g3 { background: linear-gradient(145deg, #e5eef8, #cfe0f2); }
.tile-icon.g4 { background: linear-gradient(145deg, #f6e9f0, #eed3e2); }
.tile-icon.g5 { background: linear-gradient(145deg, #fdf3dc, #f7e2af); }
.tile-icon.g6 { background: linear-gradient(145deg, #e6f2ee, #c8e4d8); }
.tile-title { font-size: 26px; font-weight: 800; color: var(--green-900); }
.tile-sub { font-size: 20px; color: var(--ink-soft); margin-top: 2px; }
.tile .dot {
  position: absolute; top: 14px; right: 14px;
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 17px;
  background: var(--accent-dark); color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 按鈕 ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 64px;
  border: none; border-radius: 18px; cursor: pointer;
  font-family: inherit; font-size: 26px; font-weight: 800; letter-spacing: 1px;
  text-decoration: none; transition: transform .1s ease, filter .1s ease;
  color: var(--ink);
}
.btn:active { transform: scale(.98); filter: brightness(.95); }
.btn-primary { background: linear-gradient(135deg, var(--green-700), var(--green-600)); color: #fff; box-shadow: 0 6px 16px rgba(45,106,74,.32); }
.btn-accent  { background: var(--accent-dark); color: #fff; box-shadow: 0 6px 16px rgba(180,85,29,.32); } /* 純色 #b4551d，白字對比 4.93:1 */
.btn-outline { background: var(--card); color: var(--green-800); border: 2.5px solid var(--green-700); }
.btn-ghost   { background: var(--green-50); color: var(--green-800); min-height: 56px; font-size: 24px; }
.btn-danger-outline { background: var(--card); color: var(--danger); border: 2.5px solid var(--danger); }
.btn-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; min-width: 56px; flex: none;
  border: none; border-radius: 16px; cursor: pointer;
  background: var(--green-50); color: var(--green-800);
  font-size: 28px; font-weight: 800; text-decoration: none;
  transition: transform .1s ease, filter .1s ease;
}
.btn-back:active { transform: scale(.96); filter: brightness(.95); }
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center;
  font-size: 20px; font-weight: 700; padding: 6px 16px; border-radius: 999px;
}
.badge-ok     { background: #e3f2e5; color: #1e6b34; }
.badge-info   { background: #e3ecf8; color: #1f4e8c; }
.badge-warn   { background: #fdf1dc; color: #8a5a0a; }
.badge-accent { background: #fdeadd; color: #a34a12; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted  { background: #eeece6; color: #6b6a5f; }

/* ---------- 待辦 / 公告列 ---------- */
.notice {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 20px; border-bottom: 1.5px solid var(--green-50);
}
.notice:last-child { border-bottom: none; }
.notice .ic { font-size: 30px; line-height: 1.3; }
.notice .t { font-size: 23px; font-weight: 700; color: var(--green-900); }
.notice .d { font-size: 20px; color: var(--ink-soft); margin-top: 2px; }
.notice.urgent .t { color: var(--danger); }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 12px; }
.sec-head h2 { font-size: var(--fs-h2); color: var(--green-900); font-weight: 800; }
.sec-head .more { font-size: 20px; color: var(--green-700); font-weight: 700; }

/* ---------- 摘要列表 ---------- */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 0; border-bottom: 1.5px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-soft); font-size: 21px; }
.kv .v { font-weight: 700; text-align: right; }
.kv .v.big { font-size: 34px; color: var(--accent-dark); font-weight: 900; }
.kv .v.green { color: var(--green-700); }

/* ---------- POS：分類列 ---------- */
.cat-row {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 12px;
  -webkit-overflow-scrolling: touch;
}
.cat-row button {
  flex: 0 0 auto; min-height: 60px; padding: 0 22px;
  border-radius: 999px; border: 2.5px solid var(--line);
  background: var(--card); font-family: inherit; font-size: 24px; font-weight: 800;
  color: var(--ink); cursor: pointer;
}
.cat-row button.on { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* ---------- POS：商品九宮格 ---------- */
.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pos-item {
  background: var(--card); border: 1.5px solid rgba(230,224,210,.9);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 14px 8px 12px; text-align: center; cursor: pointer;
  font-family: inherit; color: var(--ink); min-height: 156px;
  transition: transform .1s ease;
  position: relative;
}
.pos-item:active { transform: scale(.96); border-color: var(--green-600); }
.pos-item .em { font-size: 42px; line-height: 1.25; }
.pos-item .nm { font-size: 24px; font-weight: 800; color: var(--green-900); line-height: 1.3; margin-top: 4px; }
.pos-item .pr { font-size: 24px; font-weight: 900; color: var(--accent-dark); margin-top: 2px; }
.pos-item .soldout {
  position: absolute; inset: 0; border-radius: var(--radius-sm);
  background: rgba(250,246,238,.82); display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900; color: var(--danger);
}

/* ---------- POS：訂單明細 ---------- */
.order-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1.5px dashed var(--line); }
.order-line:last-child { border-bottom: none; }
.order-line .nm { flex: 1; font-size: 24px; font-weight: 700; }
.order-line .nm .memo { display: block; font-size: 20px; color: var(--ink-soft); font-weight: 500; }
.order-line .amt { font-size: 23px; font-weight: 800; color: var(--accent-dark); min-width: 84px; text-align: right; }
.mini-qty { display: flex; align-items: center; gap: 12px; }
.mini-qty button {
  width: 48px; height: 48px; border-radius: 14px; border: none; cursor: pointer;
  background: var(--green-100); color: var(--green-800);
  font-size: 28px; font-weight: 800; line-height: 1; font-family: inherit;
}
.mini-qty button:active { background: var(--green-700); color: #fff; }
.mini-qty .n { min-width: 64px; text-align: center; font-size: 26px; font-weight: 900; color: var(--green-900); }

/* ---------- 底部固定送出列（sticky） ---------- */
.stickybar {
  position: sticky; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.97);
  border: 1.5px solid var(--line); border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 20px rgba(38,48,31,.12);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  margin: 0 -6px;
}
.stickybar .sum { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.stickybar .sum .k { font-size: 21px; color: var(--ink-soft); font-weight: 700; }
.stickybar .sum .v { font-size: 36px; font-weight: 900; color: var(--accent-dark); }

/* ---------- 叫貨：品項卡 ---------- */
.po-item { padding: 18px 20px; border-bottom: 1.5px solid var(--green-50); }
.po-item:last-child { border-bottom: none; }
.po-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.po-top .em { font-size: 34px; }
.po-top .nm { font-size: 25px; font-weight: 800; color: var(--green-900); }
.po-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 10px; }
.po-line2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.po-line2 .aik { font-size: 20px; color: var(--ink-soft); }
.po-line2 .aik b { color: var(--green-700); font-size: 22px; }
.step-qty { display: flex; align-items: center; gap: 12px; }
.step-qty button {
  width: 56px; height: 56px; border-radius: 16px; border: none; cursor: pointer;
  background: var(--green-100); color: var(--green-800);
  font-size: 32px; font-weight: 800; line-height: 1; font-family: inherit;
}
.step-qty button:active { background: var(--green-700); color: #fff; }
.step-qty .n { min-width: 88px; text-align: center; font-size: 32px; font-weight: 900; color: var(--green-900); }
.step-qty .u { font-size: 20px; color: var(--ink-soft); }

/* ---------- 驗收：三大判定按鈕 ---------- */
.gr-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 14px; }
.gr-btn {
  min-height: 88px; border-radius: 16px; cursor: pointer; font-family: inherit;
  border: 2.5px solid var(--line); background: var(--card);
  font-size: 24px; font-weight: 800; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .1s ease;
}
.gr-btn .ic { font-size: 30px; line-height: 1.2; }
.gr-btn:active { transform: scale(.96); }
.gr-btn.ok.sel     { background: #e3f2e5; border-color: var(--green-600); color: #1e6b34; }
.gr-btn.qty.sel    { background: #fdf1dc; border-color: var(--gold);      color: #8a5a0a; }
.gr-btn.bad.sel    { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.gr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

/* ---------- 驗收：效期快捷鍵列（防呆：不用自由打字） ---------- */
.date-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.date-btn {
  min-height: 80px; border-radius: 16px; cursor: pointer; font-family: inherit;
  border: 2.5px solid var(--line); background: var(--card); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .1s ease;
}
.date-btn:active { transform: scale(.96); }
.date-btn b { font-size: 24px; font-weight: 800; }
.date-btn span { font-size: 20px; color: var(--ink-soft); font-weight: 700; }
.date-btn.on { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.date-btn.on span { color: rgba(255,255,255,.92); }
.date-show { font-size: 22px; margin-top: 10px; color: var(--ink); }
.date-show b { color: var(--green-800); font-weight: 900; }

/* ---------- 表單 ---------- */
label.field-label { display: block; font-size: 20px; font-weight: 700; color: var(--green-900); margin: 0 0 6px; }
.input {
  width: 100%; min-height: 60px; padding: 10px 16px;
  font-family: inherit; font-size: 23px; color: var(--ink);
  background: #fff; border: 2.5px solid var(--line); border-radius: 16px;
  outline: none;
}
.input:focus { border-color: var(--green-600); box-shadow: 0 0 0 4px rgba(55,132,91,.15); }
.hint { font-size: 20px; color: var(--ink-soft); margin-top: 6px; }

/* ---------- 盤點 ---------- */
.zone-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 12px; }
.zone-row button {
  flex: 0 0 auto; min-height: 64px; padding: 6px 20px;
  border-radius: 999px; border: 2.5px solid var(--line);
  background: var(--card); font-family: inherit; font-size: 24px; font-weight: 800;
  color: var(--ink); cursor: pointer;
}
.zone-row button.on { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.zone-row button .st { font-size: 20px; font-weight: 700; opacity: .85; display: block; }
.progress { height: 18px; background: #e8e5da; border-radius: 999px; overflow: hidden; margin: 6px 0 2px; }
.progress .fill { height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green-700)); border-radius: 999px; }

.count-display {
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  background: var(--green-50); border: 2.5px solid var(--green-100);
  border-radius: 16px; padding: 10px 16px; margin: 12px 0;
}
.count-display .num { font-size: 54px; font-weight: 900; color: var(--green-900); letter-spacing: 1px; min-width: 120px; text-align: right; }
.count-display .u { font-size: 22px; color: var(--ink-soft); font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button {
  min-height: 68px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--card); box-shadow: var(--shadow);
  font-family: inherit; font-size: 32px; font-weight: 800; color: var(--green-900); cursor: pointer;
  transition: transform .08s ease;
}
.keypad button:active { transform: scale(.95); background: var(--green-100); }
.keypad button.fn { font-size: 24px; color: var(--danger); }
.keypad button.okk { background: linear-gradient(135deg, var(--green-700), var(--green-600)); color: #fff; border: none; font-size: 26px; }

/* ---------- 老闆報表 ---------- */
.stat2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(230,224,210,.8); padding: 18px 18px 16px;
}
.stat-card .k { font-size: 20px; color: var(--ink-soft); font-weight: 700; }
.stat-card .v { font-size: 38px; font-weight: 900; color: var(--green-900); letter-spacing: -1px; margin-top: 2px; }
.stat-card .v.orange { color: var(--accent-dark); }
.stat-card .delta { font-size: 20px; font-weight: 800; margin-top: 2px; }
.delta.up { color: #1e6b34; }
.delta.down { color: var(--danger); }
.ai-card {
  background: linear-gradient(145deg, #f2f7ee, #e8f1e4);
  border: 2px solid var(--green-100);
}
.ai-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.ai-head .ic {
  width: 48px; height: 48px; border-radius: 14px; font-size: 26px;
  background: var(--green-700); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.ai-head .t { font-size: 24px; font-weight: 800; color: var(--green-900); }
.ai-head .tag { margin-left: auto; }
.ai-body { padding: 12px 22px 20px; font-size: 23px; line-height: 1.65; }
.ai-body b { color: var(--accent-dark); }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.bar-row .lb { flex: 0 0 118px; font-size: 20px; font-weight: 700; color: var(--ink-soft); }
.bar-row .bar { flex: 1; height: 26px; background: #eeeade; border-radius: 8px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green-700)); border-radius: 8px; }
.bar-row .val { flex: 0 0 76px; text-align: right; font-size: 20px; font-weight: 800; color: var(--green-900); }

/* ---------- 二次確認彈窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(38,48,31,.45); z-index: 90;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow-lg);
  max-width: 480px; width: 100%; padding: 26px 22px; text-align: center;
}
.modal .big-ic { font-size: 54px; }
.modal h3 { font-size: 28px; color: var(--green-900); margin: 8px 0 4px; }
.modal p { font-size: 22px; color: var(--ink-soft); margin-bottom: 18px; }

/* ---------- 提示吐司 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--green-800); color: #fff; font-size: 22px; font-weight: 700;
  padding: 14px 26px; border-radius: 999px; box-shadow: var(--shadow-lg);
  z-index: 95; opacity: 0; pointer-events: none; transition: opacity .25s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: 20px; }

/* ---------- 盤點差異超過 5%：紅框二次確認卡（防呆示範） ---------- */
.diff-alert {
  border: 3px solid var(--danger); background: var(--danger-bg);
  border-radius: var(--radius); padding: 20px 18px; margin-top: 16px;
  text-align: center;
}
.diff-alert .big-ic { font-size: 46px; line-height: 1.2; }
.diff-alert h3 { font-size: 28px; font-weight: 900; color: var(--danger); margin: 6px 0 4px; }
.diff-alert p { font-size: 22px; color: var(--ink); margin-bottom: 16px; line-height: 1.5; }
.diff-alert .btn-row { gap: 12px; }

@media (max-width: 420px) {
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
  /* 字級維持 ≥24px，不再縮小 tabbar 文字 */
}
