/* hotpot-comment-bot 營運後台 — 手機優先
 *
 * 刻意與店家後台（admin.css）不同調：
 * 店家後台是暖紅（餐飲、對客人的溫度），營運後台是石墨藍（工具、對數字的冷靜）。
 * 換色不是裝飾——你會同時開兩個分頁，一眼要能分出「我現在在誰的後台」。 */
:root {
  --ink: #1c2530;
  --ink-soft: #3d4a5a;
  --accent: #2563a8;
  --accent-dark: #1b4b80;
  --green: #1e8e3e;
  --amber: #b26a00;
  --red: #c0392b;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2530;
  --muted: #7b8794;
  --line: #e3e8ee;
  --warn-bg: #fff6e8;
  --danger-bg: #fdeeec;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red); margin-top: 10px; }
.warn-text { color: var(--amber); }

/* ---- 登入 ---- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px 28px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 10px 38px rgba(28,37,48,.10), 0 2px 8px rgba(28,37,48,.04);
}
.login-logo { font-size: 34px; margin-bottom: 12px; }
.login-card h1 { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.login-label { display: block; text-align: left; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.login-label-gap { margin-top: 14px; }
.login-card input {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 1px solid #cfd7e0; border-radius: 9px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,168,.14); }
.login-submit { margin-top: 18px; width: 100%; border-radius: 9px; padding: 11px 0; font-size: 15px; }
.login-foot { margin-top: 18px; font-size: 13px; color: var(--muted); }
.login-foot a { color: var(--accent); }

/* ---- 版頭 ---- */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; flex: 1; white-space: nowrap; }
.topbar-right { display: flex; gap: 8px; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.28); background: transparent; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.12); }

.tabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 53px; z-index: 19; }
.tab {
  flex: 1; padding: 13px 8px; border: none; background: none; font-size: 15px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

main { padding: 16px; max-width: 980px; margin: 0 auto; }

/* ---- 按鈕 ---- */
.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 9px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: #fff; color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 13px; font-size: 14px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.btn-ghost:hover { background: #f0f3f7; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ---- 期別切換 ---- */
.period-bar { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 14px; }
.period-label { font-size: 16px; font-weight: 700; min-width: 120px; text-align: center; }

/* ---- 金額主視覺 ----
   數字要大到「掃一眼就知道這個月收多少」，這是這頁存在的理由 */
.money-hero {
  background: var(--ink); color: #fff; border-radius: 16px; padding: 22px 20px; margin-bottom: 16px;
}
.money-label { font-size: 13px; opacity: .72; display: block; }
.money-num { font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.money-split { display: flex; gap: 26px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.16); }
.money-split div { display: flex; flex-direction: column; }
.money-split span { font-size: 19px; font-weight: 700; }
.money-split small { font-size: 12px; opacity: .68; }
.money-split .warn-text span { color: #ffc46b; }
.money-split .warn-text { color: inherit; }

/* ---- 提醒條 ---- */
.alert-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 11px;
  margin-bottom: 10px; font-size: 14px; border: 1px solid;
}
.alert-row.warn { background: var(--warn-bg); border-color: #f0dcc0; color: #7a4a00; }
.alert-row.danger { background: var(--danger-bg); border-color: #f2cfca; color: #8c2d20; }

/* ---- 帳單列 ---- */
.bill-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  padding: 14px 16px; margin-bottom: 10px;
}
.bill-top { display: flex; align-items: baseline; gap: 10px; }
.bill-name { font-weight: 700; font-size: 15px; flex: 1; }
.bill-amount { font-size: 19px; font-weight: 800; white-space: nowrap; }
.bill-amount.unpriced { font-size: 14px; font-weight: 600; color: var(--muted); }
.bill-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.bill-breakdown { font-size: 13px; color: var(--muted); margin-top: 5px; }
.bill-actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }

.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.pill.paid { background: #e6f6ea; color: var(--green); }
.pill.billed { background: var(--warn-bg); color: var(--amber); }
.pill.pending { background: #eef1f5; color: var(--muted); }
.pill.unpriced { background: #f0e8f7; color: #6b3fa0; }
.pill.plan { background: #eaf1f9; color: var(--accent); }

/* ---- 成本條 ---- */
.cost-strip {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 16px; padding: 12px 14px; background: #eef4ec; border: 1px solid #d7e6d8;
  border-radius: 11px; font-size: 13px; color: #2a5c37;
}

/* ---- 店家卡 ---- */
.store-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
}
.store-card:hover { border-color: #cbd6e2; }
.store-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.store-name { font-weight: 700; font-size: 15px; }
.store-nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.store-nums b { color: var(--text); font-size: 15px; }

.badge { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.badge.on { background: #e6f6ea; color: var(--green); }
.badge.off { background: #eef1f5; color: var(--muted); }
.badge.fb { background: #e7f0fb; color: #1877f2; }
.badge.ig { background: #fdeaf4; color: #c13584; }
.badge.line { background: #e6f6ea; color: #06c755; }
.badge.alert { background: var(--red); color: #fff; }

/* ---- 單店詳情面板 ---- */
.overlay { position: fixed; inset: 0; background: rgba(28,37,48,.45); z-index: 40; display: flex; justify-content: flex-end; }
.detail-panel {
  background: var(--bg); width: 100%; max-width: 560px; height: 100%; overflow-y: auto;
  padding: 0 0 40px; animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.detail-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
.detail-title { font-weight: 700; }
#detail-body { padding: 16px; }

.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 16px; margin-bottom: 14px; }
.form-card h3 { font-size: 14px; margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 5px; }
.form-card input, .form-card select, .form-card textarea {
  width: 100%; padding: 9px 11px; font-size: 15px; border: 1px solid #cfd7e0;
  border-radius: 8px; background: #fff; outline: none; font-family: inherit;
}
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,168,.12);
}
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* 開通功能的勾選列。整列可按（不只小方塊），手機上點得到 */
.feat-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.feat-row:last-of-type { border-bottom: none; }
/* .form-card input 的 width:100% 會把 checkbox 撐成一整條，要蓋回去 */
.form-card .feat-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }

.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }

.pay-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pay-row:last-child { border-bottom: none; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; z-index: 60; max-width: 88vw;
}
.toast.err { background: var(--red); }

@media (min-width: 700px) {
  .money-num { font-size: 46px; }
}
