/* 共用樣式。兩個頁面的使用情境差很多：
   查詢頁是客人在直播留言後、用手機單手操作；後台是小編在電腦前對帳。
   所以版面以手機優先，後台在寬螢幕才展開成多欄。 */
:root {
  --bg: #f6f4f1;
  --card: #fff;
  --ink: #22201e;
  --muted: #7d7671;
  --line: #e6e1db;
  --brand: #c2410c;
  --brand-dark: #9a3412;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px -12px rgba(0,0,0,.15);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
        "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.3; margin: 0; }

.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 64px; }
.wrap-wide { max-width: 1180px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card > h2 { font-size: 17px; margin-bottom: 12px; }

label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
input, select, textarea, button {
  font: inherit;
  color: inherit;
}
input[type=text], input[type=password], input[type=tel], input[type=number], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  /* 手機上 font-size 小於 16px 時，Safari 會在聚焦時整頁放大，很難按回來 */
  font-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; min-width: 0; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
}
button:hover { background: #faf8f6; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.danger { color: var(--bad); border-color: #f3c8c8; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 14px; font-weight: 500; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 14px; }
.hidden { display: none !important; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
.tag-plain { background: #f1ede9; color: var(--muted); }

.msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 15px; }
.msg-bad { background: var(--bad-bg); color: var(--bad); }
.msg-ok { background: var(--ok-bg); color: var(--ok); }
.msg-warn { background: var(--warn-bg); color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: #faf8f6; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }

.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid #fff6; border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
