/* ============================================================
 * 员工餐投票 H5 样式（移动端优先，电脑居中浏览）
 * ============================================================ */

:root {
  --p: #ff7a45;          /* 主题橙 */
  --p-dark: #f0632a;
  --p-bg: #fff3ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #eceef1;
  --tx: #24292f;
  --tx2: #86909c;
  --ok: #00b578;
  --bad: #f53f3f;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--tx);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.hidden { display: none !important; }
a { color: var(--p); cursor: pointer; text-decoration: none; }
p { margin: 0.4em 0; }

/* ---------- 访问密码门 ---------- */
.gate {
  display: flex; flex-direction: column; align-items: center;
  padding: 88px 32px 0; text-align: center;
}
.gate-logo {
  width: 84px; height: 84px; border-radius: 24px;
  background: var(--p-bg); display: flex; align-items: center; justify-content: center;
  font-size: 44px; margin-bottom: 16px;
}
.gate h1 { margin: 0; font-size: 26px; letter-spacing: 2px; }
.gate-sub { color: var(--tx2); margin: 8px 0 28px; }
.gate .input { text-align: center; letter-spacing: 4px; }
.gate .btn { margin-top: 14px; }
.gate-err { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 8px; }
.gate-tip { color: var(--tx2); font-size: 12px; margin-top: 22px; }

/* ---------- 通用组件 ---------- */
.input, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; font-size: 15px; color: var(--tx);
  background: #fff; outline: none; font-family: inherit;
}
.input:focus, .textarea:focus { border-color: var(--p); }
.textarea { resize: vertical; line-height: 1.6; }

.btn {
  border: none; border-radius: 10px; padding: 11px 22px;
  font-size: 15px; cursor: pointer; font-family: inherit;
  background: #eef0f3; color: var(--tx); transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn.primary { background: var(--p); color: #fff; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: #fff; color: var(--p); border: 1px solid var(--p); }
.btn.block { display: block; width: 100%; }
.btn.small { padding: 7px 16px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}

.err-text { color: var(--bad); font-size: 13px; }
.loading { text-align: center; color: var(--tx2); padding: 60px 0; }
.empty { text-align: center; color: var(--tx2); padding: 24px 0; font-size: 14px; }

/* ---------- 主界面骨架 ---------- */
#main { padding: 14px 14px 96px; }
#view { min-height: 60vh; }

.page-head { margin: 4px 0 12px; }
.page-title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.page-sub { color: var(--tx2); font-size: 12px; margin-top: 2px; }
.back { color: var(--tx2); font-size: 14px; display: inline-block; margin-bottom: 6px; }

.badge { font-size: 11px; border-radius: 20px; padding: 2px 9px; font-weight: 400; }
.badge.on { background: #e8f7f1; color: var(--ok); }
.badge.off { background: #f2f3f5; color: var(--tx2); }

/* ---------- 随机提示条 ---------- */
.prompt-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--p-bg); border: 1px dashed var(--p);
  color: var(--p-dark); border-radius: 10px;
  padding: 9px 12px; margin-bottom: 12px; font-size: 13px;
}
.prompt-bar a { font-weight: 600; white-space: nowrap; }
.prompt-bar a + a { margin-left: 10px; }

/* ---------- 餐次卡片 ---------- */
.meal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.meal-title { font-weight: 700; font-size: 16px; }
.editor { color: var(--tx2); font-size: 11px; }

.empty-meal {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--tx2); font-size: 14px; padding: 6px 0;
}

.dish-row { padding: 10px 0; border-top: 1px solid var(--line); }
.dish-row:first-of-type { border-top: none; }
.dish-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dish-name { font-weight: 600; font-size: 15px; word-break: break-all; }
.stat { color: var(--tx2); font-size: 12px; white-space: nowrap; }
.dish-line2 {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 6px;
}
.my { color: var(--tx2); font-size: 12px; }
.comment-link { font-size: 12px; white-space: nowrap; }

/* 整餐留言（餐次卡片底部：预览 + 发表行） */
.meal-comments { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.mc-title { font-size: 12px; color: var(--tx2); margin-bottom: 6px; }
.mc-item { font-size: 13px; padding: 3px 0; word-break: break-all; }
.mc-item b { color: var(--p-dark, #388e3c); }
.mc-more { font-size: 12px; display: inline-block; margin: 6px 0; }
.mc-input { display: flex; gap: 8px; }
.mc-input .input { flex: 1; min-width: 0; padding: 8px 12px; font-size: 13px; }

/* 星星 */
.stars { display: inline-flex; gap: 2px; font-size: 20px; line-height: 1; }
.stars .star { color: #dcdfe4; cursor: pointer; user-select: none; }
.stars .star.on { color: var(--p); }
.stars.ro .star { cursor: default; }
.big-stars .star { font-size: 26px; }

/* ---------- 底部投票条 ---------- */
.bottom-bar {
  position: fixed; bottom: calc(64px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px); max-width: 532px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .14);
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  z-index: 30;
}
.bottom-bar span { font-size: 13px; color: var(--tx2); }

/* ---------- 排行 ---------- */
.rank-tabs {
  display: flex; background: #fff; border-radius: 10px;
  padding: 4px; margin-bottom: 12px;
}
.rank-tabs .tab {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 8px;
  color: var(--tx2); font-size: 14px; cursor: pointer;
}
.rank-tabs .tab.active { background: var(--p); color: #fff; font-weight: 600; }

.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.rank-row:last-child { border-bottom: none; }
.rank-no {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: #f2f3f5; color: var(--tx2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.rank-no.top1 { background: #ffd76e; color: #8a6100; }
.rank-no.top2 { background: #e3e8ef; color: #5a6472; }
.rank-no.top3 { background: #f4cfae; color: #955b22; }
.rank-name { flex: 1; font-weight: 600; word-break: break-all; }
.rank-avg { color: var(--p); font-weight: 700; white-space: nowrap; }
.rank-cnt { color: var(--tx2); font-size: 12px; white-space: nowrap; }

/* ---------- 菜品详情 ---------- */
.center { text-align: center; padding: 20px 14px; }
.muted { color: var(--tx2); font-size: 13px; margin-top: 4px; }
.section-title { font-weight: 700; margin-bottom: 8px; }

.dist-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; color: var(--tx2); }
.dist-row span { width: 28px; flex: none; }
.dist-row b { width: 20px; text-align: right; flex: none; color: var(--tx); }
.dist-bar { flex: 1; height: 8px; background: #f2f3f5; border-radius: 4px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--p); border-radius: 4px; }

.dates { display: flex; flex-wrap: wrap; gap: 8px; }
.date-chip { background: var(--p-bg); color: var(--p-dark); border-radius: 20px; padding: 3px 12px; font-size: 12px; }

.comment { border-top: 1px solid var(--line); padding: 10px 0; }
.comment:first-child { border-top: none; }
.comment-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--tx2); margin-bottom: 3px; }
.comment-head b { color: var(--tx); font-size: 13px; }
.comment p { margin: 0; word-break: break-all; }
.comments { margin-top: 12px; }

/* ---------- 我的 ---------- */
.me-row { display: flex; align-items: center; gap: 10px; }
.me-row span:first-child { color: var(--tx2); }
.me-row b { flex: 1; word-break: break-all; }
.menu-list { padding: 4px 14px; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.foot-tip { text-align: center; color: var(--tx2); font-size: 12px; margin-top: 28px; }

/* ---------- 管理后台 ---------- */
.admin-block { margin-bottom: 12px; }
.admin-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.admin-row .input { width: auto; flex: 1; min-width: 130px; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-actions .btn { flex: none; }

.hist-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.hist-row:last-child { border-bottom: none; }
.hist-date { font-weight: 700; cursor: pointer; color: var(--p); white-space: nowrap; }
.hist-info { flex: 1; color: var(--tx2); }

.admin-comment { border-top: 1px solid var(--line); padding: 9px 0; font-size: 13px; }
.admin-comment:first-of-type { border-top: none; }
.admin-comment .meta { color: var(--tx2); font-size: 11px; margin-bottom: 2px; }

/* ---------- 弹层 ---------- */
#modal .mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40;
}
.modal {
  position: fixed; z-index: 41; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal-tip { color: var(--tx2); font-size: 12px; margin: 0 0 10px; }
.modal-btns { display: flex; gap: 10px; margin-top: 14px; }
.modal-btns .btn { flex: 1; }
.modal .textarea { margin-bottom: 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: rgba(0, 0, 0, .78); color: #fff; font-size: 14px;
  border-radius: 8px; padding: 9px 18px; max-width: 80vw;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 60;
  text-align: center; word-break: break-all;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: rgba(207, 49, 49, .92); }

/* ---------- 底部导航 ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; z-index: 35;
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar a {
  flex: 1; text-align: center; padding: 7px 0 6px;
  color: var(--tx2); font-size: 11px; cursor: pointer;
}
#tabbar a span { display: block; font-size: 20px; line-height: 1.3; }
#tabbar a i { font-style: normal; }
#tabbar a.active { color: var(--p); font-weight: 600; }

/* ---------- 未配置引导页 ---------- */
.setup { padding: 40px 20px; }
.setup h2 { font-size: 18px; }
.setup ol { padding-left: 20px; color: var(--tx2); font-size: 14px; line-height: 2; }
.setup code { background: #f2f3f5; border-radius: 4px; padding: 1px 6px; font-size: 13px; color: var(--p-dark); }
