/* style.css — 移动端优先，桌面端以 480px 手机框居中预览 */
:root {
  --brand: #0f8a7e;
  --brand-dark: #0b6d63;
  --brand-light: #e6f5f2;
  --brand-soft: #ccede7;
  --ink: #1b2b2a;
  --ink-2: #5b6f6d;
  --ink-3: #93a5a3;
  --line: #e6ecea;
  --bg: #f4f7f6;
  --white: #fff;
  --warn: #d97706;
  --warn-bg: #fff7e8;
  --danger: #dc4a4a;
  --shadow: 0 4px 18px rgba(15, 80, 72, .07);
  --shadow-lg: 0 12px 36px rgba(15, 80, 72, .16);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); font-size: 15px; line-height: 1.5;
  background: #dfe9e7;
  background-image: radial-gradient(circle at 20% 10%, #eef6f4, transparent 45%), radial-gradient(circle at 85% 80%, #e3efec, transparent 40%);
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.phone {
  position: relative; width: 100%; max-width: 480px; min-height: 100vh; margin: 0 auto;
  background: var(--bg); overflow: hidden;
}
@media (min-width: 560px) {
  .phone { min-height: 92vh; margin: 3vh auto; border-radius: 26px; box-shadow: var(--shadow-lg); border: 1px solid #d5e3e0; }
}
.view { min-height: 100vh; }
@media (min-width: 560px) { .view { min-height: 92vh; } }

/* ---------- 登录 ---------- */
.login-view { background: #fff; display: flex; flex-direction: column; }
.login-hero {
  position: relative; overflow: hidden; padding: 62px 26px 54px;
  color: #fff; background: linear-gradient(140deg, #14a294 0%, #0f8a7e 48%, #0b6d63 100%);
  border-bottom-left-radius: 30px; border-bottom-right-radius: 30px;
}
.hero-deco { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.hero-deco.d1 { width: 220px; height: 220px; right: -70px; top: -90px; }
.hero-deco.d2 { width: 130px; height: 130px; left: -50px; bottom: -70px; background: rgba(255, 255, 255, .07); }
.hero-logo {
  width: 60px; height: 60px; border-radius: 19px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .28); margin-bottom: 20px;
}
.login-hero h1 { margin: 0 0 8px; font-size: 25px; font-weight: 700; letter-spacing: .5px; }
.login-hero p { margin: 0; font-size: 13px; opacity: .82; letter-spacing: 1px; }
.login-form { padding: 30px 26px 40px; flex: 1; }
.demo-tip {
  background: var(--warn-bg); color: #9a5b06; border: 1px solid #f6dcae;
  border-radius: 12px; padding: 11px 13px; font-size: 12.5px; line-height: 1.6; margin-bottom: 20px;
}
.demo-tip b { color: #7c4700; }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; font-weight: 600; }
.field input, .field select, .field textarea, .inp {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fbfdfc; outline: none; transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 138, 126, .1); background: #fff;
}
.field textarea { resize: vertical; min-height: 66px; }
.login-foot { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 22px; }

/* ---------- 通用 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 11px; font-weight: 600; font-size: 14px;
  background: #eef4f2; color: var(--brand-dark); transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 5px 14px rgba(15, 138, 126, .24); }
.btn-ghost { background: #fff; border: 1.5px solid var(--line); color: var(--ink-2); }
.btn-danger { background: #fdeaea; color: var(--danger); }
.btn-block { width: 100%; padding: 14px; font-size: 15.5px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--ink-3); font-size: 12.5px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.tag-green { background: var(--brand-light); color: var(--brand-dark); }
.tag-gray { background: #eef1f0; color: var(--ink-2); }
.tag-orange { background: var(--warn-bg); color: var(--warn); }
.tag-red { background: #fdeaea; color: var(--danger); }

/* ---------- 主框架 ---------- */
.app-view { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 15px; color: #fff;
  background: linear-gradient(120deg, #14a294, #0d7d72);
  box-shadow: 0 3px 14px rgba(11, 109, 99, .18);
}
.topbar-title { display: flex; flex-direction: column; gap: 2px; }
.topbar-title span { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.topbar-title small { font-size: 11.5px; opacity: .8; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 12px; background: rgba(255, 255, 255, .2);
  color: #fff; font-weight: 700; font-size: 14px; border: 1px solid rgba(255, 255, 255, .3);
}
.main { flex: 1; padding: 14px 14px 92px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  max-width: 480px; margin: 0 auto; background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(15, 80, 72, .06);
  padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(10px);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px; color: var(--ink-3); font-size: 11px;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--brand); font-weight: 700; }

/* ---------- 卡片 / 区块 ---------- */
.card { background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; width: 3px; height: 15px; border-radius: 3px; background: var(--brand); }
.sec-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 18px 4px 10px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 2px 12px; }
.page-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.page-head .muted { margin-top: 2px; }

/* ---------- 报餐页 ---------- */
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.date-strip::-webkit-scrollbar { display: none; }
.date-chip {
  flex: 0 0 auto; min-width: 60px; padding: 9px 10px; border-radius: 13px; text-align: center;
  background: #fff; border: 1.5px solid var(--line); color: var(--ink-2); line-height: 1.3;
}
.date-chip .dw { font-size: 11px; color: var(--ink-3); }
.date-chip .dd { font-size: 17px; font-weight: 700; margin-top: 2px; }
.date-chip .dm { font-size: 10px; color: var(--ink-3); }
.date-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 5px 14px rgba(15, 138, 126, .25); }
.date-chip.active .dw, .date-chip.active .dm { color: rgba(255, 255, 255, .8); }
.date-chip.today::after { content: ''; display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--brand); margin: 3px auto 0; }
.date-chip.active.today::after { background: #fff; }
.week-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.week-nav .btn-sm { padding: 5px 11px; }
.notice { background: var(--warn-bg); border: 1px solid #f6e2c0; color: #9a5b06; border-radius: 12px; padding: 10px 13px; font-size: 12.5px; margin-bottom: 12px; }
.day-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(120deg, #e9f7f4, #f4fbf9); border: 1px solid #d8efe9;
  border-radius: 14px; padding: 12px 15px; margin-bottom: 12px;
}
.day-summary .ds-date { font-size: 16px; font-weight: 700; }
.day-summary .ds-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.day-summary .ds-count { font-size: 22px; font-weight: 800; color: var(--brand); }
.day-summary .ds-count small { font-size: 11px; font-weight: 500; color: var(--ink-2); display: block; text-align: right; }

.meal-card { background: #fff; border-radius: 16px; padding: 15px; margin-bottom: 11px; box-shadow: var(--shadow); border: 1.5px solid transparent; transition: border-color .2s; }
.meal-card.reported { border-color: var(--brand-soft); }
.meal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.meal-name { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.meal-time { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.meal-count { font-size: 12px; color: var(--brand-dark); background: var(--brand-light); padding: 5px 10px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.meal-menu { font-size: 13px; color: var(--ink-2); margin-top: 10px; background: #f7faf9; border-radius: 9px; padding: 8px 11px; }
.meal-menu span { color: var(--ink-3); }
.meal-cut { font-size: 11.5px; color: var(--ink-3); margin-top: 9px; display: flex; align-items: center; gap: 5px; }
.meal-cut.closed { color: var(--warn); }
.meal-actions { display: flex; gap: 9px; margin-top: 12px; }
.meal-actions .btn { flex: 1; }
.btn-eat { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(15, 138, 126, .2); }
.btn-eat.done { background: var(--brand-light); color: var(--brand-dark); box-shadow: none; border: 1.5px solid var(--brand-soft); }
.btn-lock { background: #f1f4f3; color: var(--ink-3); pointer-events: none; }
.remark-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.remark-row input { flex: 1; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 10px; background: #fbfdfc; outline: none; font-size: 13px; }
.remark-row input:focus { border-color: var(--brand); }

/* ---------- 统计 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 12px; }
.kpi { background: #fff; border-radius: 14px; padding: 13px 10px; text-align: center; box-shadow: var(--shadow); }
.kpi .v { font-size: 22px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.kpi .l { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.range-row { display: flex; gap: 8px; align-items: center; }
.range-row input { flex: 1; min-width: 0; padding: 9px 8px; border: 1.5px solid var(--line); border-radius: 10px; background: #fbfdfc; font-size: 13px; outline: none; }
.range-row input:focus { border-color: var(--brand); }
.quick-row { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.chip-btn { padding: 5px 11px; border-radius: 20px; background: #eef4f2; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.chip-btn.active { background: var(--brand); color: #fff; }
.day-stat { border-bottom: 1px solid var(--line); padding: 11px 0; }
.day-stat:last-child { border-bottom: none; padding-bottom: 2px; }
.day-stat .dh { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; margin-bottom: 8px; }
.day-stat .dh em { font-style: normal; color: var(--brand); font-size: 12px; }
.meal-pills { display: flex; gap: 7px; flex-wrap: wrap; }
.meal-pill { background: #f4f8f7; border-radius: 9px; padding: 6px 10px; font-size: 12px; color: var(--ink-2); }
.meal-pill b { color: var(--brand-dark); font-size: 14px; margin-left: 4px; }
.bar { height: 7px; border-radius: 7px; background: #eef2f1; overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #2bb3a3, #0f8a7e); border-radius: 7px; }
.empty { text-align: center; color: var(--ink-3); padding: 32px 10px; font-size: 13px; }

/* ---------- 管理 ---------- */
.subtabs { display: flex; gap: 6px; background: #e9f0ee; padding: 4px; border-radius: 12px; margin-bottom: 13px; }
.subtab { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.subtab.active { background: #fff; color: var(--brand); box-shadow: 0 2px 7px rgba(15, 80, 72, .08); }
.user-item { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.user-item:last-child { border-bottom: none; }
.u-avatar { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-light); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.u-info { flex: 1; min-width: 0; }
.u-name { font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.u-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-ops { display: flex; gap: 5px; flex: 0 0 auto; }
.icon-btn { width: 30px; height: 30px; border-radius: 9px; background: #f2f6f5; color: var(--ink-2); font-size: 12px; display: grid; place-items: center; }
.icon-btn.red { background: #fdeaea; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.form-grid .full { grid-column: 1 / -1; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: none; }
.switch { width: 44px; height: 25px; border-radius: 20px; background: #d8e0de; position: relative; transition: background .2s; flex: 0 0 auto; }
.switch i { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.switch.on { background: var(--brand); }
.switch.on i { left: 22px; }
.meal-edit { border: 1.5px solid var(--line); border-radius: 13px; padding: 12px; margin-bottom: 10px; background: #fbfdfc; }
.meal-edit .me-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.meal-edit .me-top input { flex: 1; font-weight: 700; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; outline: none; }
.meal-edit .me-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.meal-edit .me-grid label { font-size: 11px; color: var(--ink-3); display: block; margin-bottom: 4px; }
.meal-edit .me-grid input { width: 100%; padding: 8px 9px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; outline: none; font-size: 13px; }
.meal-edit .me-grid .wide { grid-column: 1 / -1; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th, table.tbl td { padding: 9px 7px; text-align: left; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--ink-3); font-weight: 600; font-size: 11.5px; background: #f8fbfa; }
table.tbl td b { color: var(--brand-dark); }
.tbl-scroll { overflow-x: auto; margin: 0 -4px; }

/* ---------- 我的 ---------- */
.profile { background: linear-gradient(130deg, #14a294, #0b6d63); color: #fff; border-radius: 18px; padding: 20px; display: flex; align-items: center; gap: 14px; margin-bottom: 13px; }
.profile .p-avatar { width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 20px; font-weight: 700; border: 1px solid rgba(255,255,255,.3); }
.profile .p-name { font-size: 18px; font-weight: 700; }
.profile .p-sub { font-size: 12px; opacity: .82; margin-top: 3px; }
.info-line { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.info-line:last-child { border-bottom: none; }
.info-line span:first-child { color: var(--ink-2); }

/* ---------- Toast / Modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 100;
  background: rgba(24, 46, 43, .94); color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 13.5px; max-width: 82%; text-align: center; box-shadow: var(--shadow-lg);
}
.toast.bad { background: #a63a3a; }
.modal-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(15, 35, 32, .46);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.modal-box {
  width: 100%; max-width: 480px; background: #fff; border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto;
  animation: slideUp .22s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { font-size: 20px; color: var(--ink-3); width: 30px; height: 30px; }
.modal-actions { display: flex; gap: 9px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.confirm-text { font-size: 14px; color: var(--ink-2); line-height: 1.7; }
