/* =========================================================
   常隆雷克萨斯 · 客户食堂餐券系统
   视觉规范：苹果白风格 —— 浅灰底 + 白色圆角卡片 + 墨黑强调
   不使用 emoji，图标一律 SVG；不使用蓝紫渐变
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f5f7;          /* 页面背景（苹果浅灰） */
  --card: #ffffff;        /* 卡片背景 */
  --ink: #1d1d1f;         /* 主文字（墨黑） */
  --ink-2: #6e6e73;       /* 次级文字 */
  --ink-3: #a1a1a6;       /* 弱化文字 */
  --line: #e5e5ea;        /* 分隔/描边 */
  --line-2: #f2f2f4;      /* 更浅填充 */
  --accent: #1d1d1f;      /* 主操作（黑） */
  --accent-h: #000000;
  --blue: #007aff;        /* 聚焦蓝（纯色非渐变） */
  --ok: #1a7f4b;
  --ok-bg: #e9f6ee;
  --warn: #b25000;
  --warn-bg: #fff3e4;
  --danger: #c0392b;
  --danger-bg: #fdecec;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
               "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
  display: flex; flex-direction: column;
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 通用 SVG 图标：继承文字颜色、线条风 */
.ic {
  display: inline-block; width: 1.1em; height: 1.1em;
  vertical-align: -0.2em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 18px; padding-bottom: 44px; }

/* ---------- 顶栏（白底 + 细分割线，iOS 风格） ---------- */
.topbar {
  position: relative; background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 54px; }
.brand { color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 600; letter-spacing: .3px; display: inline-flex; align-items: center; }
.brand-mark {
  background: var(--ink); color: #fff; border-radius: 7px;
  padding: 2px 8px; margin-right: 8px; font-size: 13px; font-weight: 700; letter-spacing: 1px;
}
.topbar nav { display: flex; gap: 2px; }
.topbar nav a {
  color: var(--ink-2); text-decoration: none; font-size: 14px;
  padding: 6px 11px; border-radius: 9px; transition: background .15s, color .15s;
}
.topbar nav a:hover { background: var(--line-2); color: var(--ink); }
.topbar .wrap { position: relative; }
.userbar { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; }
.user-chip { background: var(--line-2); color: var(--ink); font-size: 12px; padding: 4px 11px; border-radius: 20px; }
.userbar .logout,
.userbar .btn-logout {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--ink); color: #fff;
  font-size: 12px; text-decoration: none; padding: 5px 12px; border-radius: 20px;
  border: 1px solid transparent; transition: background .15s;
}
.userbar .logout:hover,
.userbar .btn-logout:hover { background: var(--danger); }

/* 窄屏（导航换列）时账号栏不再悬浮，改为顶栏内独立一行 */
@media (max-width: 700px) {
  .userbar { position: static; transform: none; margin-top: 6px; justify-content: flex-end; }
}

/* ---------- 首页入口 ---------- */
.hero { margin-bottom: 18px; }
.hero-date { color: var(--ink-2); font-size: 13px; margin: 4px 2px 10px; }
.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
.entry {
  background: var(--card); border-radius: var(--radius-lg); padding: 22px 18px;
  text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .04);
  transition: transform .18s ease, box-shadow .18s ease;
}
.entry:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, .08); }
.entry-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--line-2); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.entry-icon svg { width: 24px; height: 24px; }
.entry b { font-size: 16px; }
.entry span { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.entry-issue .entry-icon { background: #eceef2; color: var(--ink); }
.entry-canteen .entry-icon { background: #f6efe2; color: #8a6a25; }
.entry-admin .entry-icon { background: #e8eef8; color: #24508f; }

/* ---------- 统计卡片 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat-card {
  background: var(--card); border-radius: var(--radius-md); padding: 14px 10px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .04);
}
.stat-card .num { display: block; font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: .5px; }
.stat-card span { font-size: 12px; color: var(--ink-2); }
.pending-num { color: var(--warn) !important; }
.done-num { color: var(--ok) !important; }
.stat-row-small { margin: 14px 0; }

/* ---------- 备餐参考卡：今日待就餐人数 ---------- */
.prep-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--warn-bg); border: 1px solid rgba(178, 80, 0, .16);
  border-radius: var(--radius-lg); padding: 14px 18px; margin: 0 0 12px;
  box-shadow: var(--shadow);
}
.prep-num { line-height: 1; flex: 0 0 auto; letter-spacing: .5px; }
.prep-num b { font-size: 38px; font-weight: 800; color: var(--warn); }
.prep-num i { font-size: 15px; font-style: normal; font-weight: 600; color: var(--warn); margin-left: 3px; }
.prep-txt strong { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.prep-txt span { font-size: 12px; color: var(--ink-2); }

/* ---------- 通用卡片 / 表单 ---------- */
.card {
  background: var(--card); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .04);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.page-title { font-size: 21px; font-weight: 700; color: var(--ink); margin-bottom: 14px; letter-spacing: .2px; }
.sec-title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 18px 2px 10px; }
.dim { color: var(--ink-3); font-weight: 400; font-size: 12px; }

.form { max-width: 560px; }
.form-tight { max-width: none; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.field > span i { color: #d93025; font-style: normal; }

input[type=text], input[type=number], input[type=password], input[type=date], select {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-size: 16px; background: #fff; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3.5px rgba(0, 122, 255, .13); }
input::placeholder { color: var(--ink-3); }

.seg { display: flex; gap: 8px; }
.seg-item { flex: 1; position: relative; }
.seg-item input { position: absolute; opacity: 0; }
.seg-item span {
  display: block; text-align: center; padding: 11px 0; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font-size: 15px; background: #fff; cursor: pointer; user-select: none;
  transition: background .15s, color .15s, border-color .15s;
}
.seg-item input:checked + span {
  background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700;
}

/* ---------- 按钮 ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 13px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm); font-size: 16px; font-weight: 700; cursor: pointer;
  text-align: center; text-decoration: none; transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-primary:active { transform: scale(.985); }
.btn-ghost, .btn-export {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 14px; background: var(--line-2); color: var(--ink);
  border: none; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn-ghost:hover, .btn-export:hover { background: #e7e7eb; }
.btn-export { background: var(--ink); color: #fff; font-weight: 600; }
.btn-export:hover { background: var(--accent-h); }
.btn-sm { padding: 8px 12px; font-size: 14px; width: auto; }
.inline { display: inline; }
.btn-logout {
  display: inline-flex; align-items: center; gap: 5px; padding: 8px 16px;
  background: var(--danger); color: #fff; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; text-decoration: none; transition: background .15s;
}
.btn-logout:hover { background: #a93226; }

/* 内容区顶部账号条 */
.acct-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid rgba(0, 0, 0, .04); border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 10px 16px; margin: 0 0 14px; font-size: 14px; color: var(--ink-2);
}
.acct-bar .acct-info { display: inline-flex; align-items: center; gap: 6px; }
.acct-bar .acct-info b { color: var(--ink); }

/* ---------- 提示 ---------- */
.flash {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 15px; border-radius: var(--radius-md); margin-bottom: 14px;
  font-size: 14px; line-height: 1.6;
}
.flash-ok { background: var(--ok-bg); color: #14532d; }
.flash-error { background: var(--danger-bg); color: #8a2020; }
.tip { font-size: 13px; color: var(--ink-2); line-height: 1.7; margin-top: 10px; }
.empty {
  background: var(--card); border: 1.5px dashed var(--line); border-radius: var(--radius-lg);
  color: var(--ink-2); padding: 28px; text-align: center; font-size: 14px; line-height: 1.8; margin-bottom: 16px;
}

/* ---------- 食堂记录 ---------- */
.search-bar { display: flex; gap: 10px; align-items: center; }
.search-bar input { flex: 1; }
.search-bar .btn-primary { width: auto; padding: 11px 20px; }
.record {
  background: var(--card); border: 1px solid rgba(0, 0, 0, .04); border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}
.record-pending { border-left: 4px solid var(--warn); }
.record-done { border-left: 4px solid var(--ok); opacity: .88; }
.record-main { flex: 1; min-width: 0; }
.record-plate {
  font-size: 19px; font-weight: 800; letter-spacing: 1px; color: var(--ink);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.record-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.6; }
.record-op { text-align: right; flex-shrink: 0; }
.done-mark { color: var(--ok); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; }

.tag { font-size: 11px; font-style: normal; font-weight: 700; border-radius: 6px; padding: 2px 8px; vertical-align: middle; }
.tag-sale { background: #e8f0fe; color: #24508f; }
.tag-service { background: #fdf3e3; color: #92600a; }
.tag-supp { background: #f0eefe; color: #5b4bb5; }
.tag-other { background: var(--line-2); color: var(--ink-2); }
.tag-perm { background: var(--line-2); color: var(--ink-2); }

/* 分页器 */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0 2px; color: var(--ink-3); font-size: 13px; }
.pager a.disabled { pointer-events: none; opacity: .4; }

/* 后台配置页签 */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 16px; }
.admin-tabs a {
  padding: 8px 15px; border-radius: 10px; text-decoration: none; font-size: 14px;
  color: var(--ink-2); background: var(--line-2); transition: background .15s, color .15s;
}
.admin-tabs a:hover { background: #e7e7eb; }
.admin-tabs a.on { background: var(--ink); color: #fff; font-weight: 600; }

/* 权限勾选 */
.chk-line { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 2px 0 6px; }
.chk-line label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink); cursor: pointer; }
.chk-line input { width: 15px; height: 15px; accent-color: var(--ink); }
.supp-box summary, .record-edit summary { cursor: pointer; list-style: none; }
.supp-box summary::-webkit-details-marker, .record-edit summary::-webkit-details-marker { display: none; }
.supp-box summary { font-size: 14px; color: var(--ink-2); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.supp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }

/* ---------- 后台表格 ---------- */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.filter-bar input[type=date] { width: auto; padding: 8px 10px; font-size: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--ink-2); font-weight: 600; padding: 7px 8px; border-bottom: 1.5px solid var(--line); font-size: 13px; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line-2); }
.tbl tr:last-child td { border-bottom: none; }
.txt-done { color: var(--ok); font-weight: 700; }
.txt-pending { color: var(--warn); font-weight: 700; }
.tbl-scroll { overflow-x: auto; }
.tbl-detail td, .tbl-detail th { white-space: nowrap; }

/* 柱状图（纯色无渐变） */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 70%; max-width: 34px; background: var(--ink); border-radius: 5px 5px 0 0; min-height: 2px; opacity: .9; }
.bar-num { font-size: 11px; color: var(--ink-2); font-weight: 700; margin-top: 3px; height: 14px; }
.bar-label { font-size: 10px; color: var(--ink-3); margin-top: 2px; }

/* 登录 */
.login-hint { text-align: center; color: var(--ink-2); font-size: 13px; margin-top: 12px; }
.footer { text-align: center; color: var(--ink-3); font-size: 12px; padding: 18px 0 28px; }

/* 扫码核销 */
.locked-seg { opacity: 1; }
.seg-item.seg-active span { font-weight: 700; }
.locked-input { background: var(--line-2); color: var(--ink-2); }
.field-hint { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.btn-scan { width: 100%; padding: 15px; font-size: 16px; margin-bottom: 12px; border-radius: var(--radius-md); }

.scan-mask { position: fixed; inset: 0; background: rgba(15, 15, 20, .66); z-index: 99; display: flex; align-items: center; justify-content: center; padding: 16px; }
.scan-modal { background: var(--card); border-radius: 20px; width: 100%; max-width: 420px; padding: 16px; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.scan-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 15px; font-weight: 700; color: var(--ink); }
.scan-close { border: none; background: none; font-size: 15px; color: var(--ink-2); cursor: pointer; padding: 4px 8px; display: inline-flex; align-items: center; gap: 4px; }
.scan-view { width: 100%; min-height: 220px; background: #0b0b0f; border-radius: 14px; overflow: hidden; }
.scan-view video { width: 100% !important; border-radius: 14px; }
.scan-view img { width: 100%; border-radius: 14px; }
.scan-tip { font-size: 13px; color: var(--ink-2); text-align: center; margin: 10px 0; }
.scan-result {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 0 10px; padding: 11px 13px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 700;
}
.scan-result b { display: block; font-weight: 700; }
.scan-result small { display: block; font-weight: 400; opacity: .85; margin-top: 3px; line-height: 1.4; }
.scan-result.ok { background: var(--ok-bg); color: #14532d; border: 1.5px solid #b5e2c4; }
.scan-result.err { background: var(--danger-bg); color: #8a2020; border: 1.5px solid #f0c1bd; }
.scan-result .ic { margin-top: 2px; }
.scan-actions { display: flex; flex-direction: column; gap: 8px; }
.op-group { margin-right: 4px; }

.scan-mask[hidden] { display: none !important; }
/* 全局：任何带 hidden 属性的元素一律隐藏（防止 .field 等 display 规则覆盖 hidden） */
[hidden] { display: none !important; }
.scan-actions label.btn-primary { display: flex; width: 100%; text-align: center; margin: 0; }
.file-hidden { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* ---------- 响应式 ---------- */
@media (max-width: 700px) {
  .entry-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .topbar .wrap { flex-direction: column; height: auto; padding: 8px 0; gap: 4px; }
  .record { flex-direction: column; align-items: stretch; }
  .record-op { text-align: right; }
  .search-bar { flex-wrap: wrap; }
  .search-bar input { min-width: 100%; }
}
