/* web.css —— 品肴轩管理后台（浅色暖纸白 + 古铜金设计系统）
   主色：#F6F3EC / #FFFFFF  点缀金：#9A7B2E / #B5934F */
:root {
  --bg-base: #F6F3EC;
  --bg-panel: #FFFFFF;
  --bg-elev: #FBF8F2;
  --gold: #9A7B2E;        /* 深古铜，浅底上才读得清 */
  --gold-2: #B5934F;      /* 古铜描边/填充 */
  --line: #E6DFD2;        /* 浅暖边框 */
  --text: #2B2620;        /* 近黑暖字 */
  --text-dim: #6E6557;
  --muted: #6B6356;  /* WCAG AA 对比度 ≥4.5:1（原 #9A9082 仅 2.7:1） */
  --ok: #2E7D4F;
  --warn: #9A6B00;
  --info: #1F6FB2;
  --danger: #C0392B;
  --shadow: 0 1px 3px rgba(40,30,15,.08), 0 1px 2px rgba(40,30,15,.06);
  --thumb-a: #ECE5D8;
  --thumb-b: #DBD0BC;
  /* 字体栈：正文无衬线，标题/数据用衬线增加精致度 */
  --font-sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); padding: 16px 0; }
.loading { color: var(--text-dim); padding: 40px; text-align: center; }

/* ===== 状态块：加载失败 / 无数据（组合式空态，替代单行灰字） ===== */
.state-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 56px 24px; text-align: center; color: var(--text-dim);
}
.state-box .state-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--gold-2);
  font-size: 24px; font-family: var(--font-serif); margin-bottom: 6px;
}
.state-box .state-title { font-size: 16px; color: var(--text); font-weight: 600; font-family: var(--font-serif); }
.state-box .state-desc { font-size: 13px; color: var(--muted); max-width: 320px; line-height: 1.6; }
.state-box .state-action { margin-top: 14px; }
.table-empty-row td { padding: 0; border-bottom: none; }
.table-empty-row .state-box { padding: 40px 24px; }

/* 数字统一等宽对齐（看板数值 / 表格金额 / 订单小计） */
.stat-val, .data-table td, .dish-price, .od-total, .bar-val {
  font-variant-numeric: tabular-nums;
}

/* ===== 图片上传卡片（分类/菜品的image字段） ===== */
.field-image .img-upload-card {
  position: relative;
  width: 140px;
  height: 140px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: all .2s;
}
.field-image .img-upload-card:hover {
  border-color: var(--accent);
  background: rgba(201,162,74,0.06);
}
.field-image .img-ph {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px;
  text-align: center;
  pointer-events: none;
}
.field-image .img-ph.hide,
.field-image .img-remove.hide {
  display: none !important;
}
.field-image .img-preview {
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.field-image .img-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}
.field-image .img-remove {
  position: absolute;
  right: 6px;
  bottom: 6px;
  border: none;
  background: rgba(120, 80, 60, 0.85);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.field-image .img-remove:hover {
  background: rgba(170, 100, 70, 0.95);
}

/* 骨架屏（列表加载态微光占位，提升「感知性能」） */
.table-scroll .skeleton thead th { background: transparent; border-color: transparent; }
.skeleton td { padding: 14px 16px; }
.sk-bar { display: block; height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, var(--thumb-a) 25%, var(--thumb-b) 37%, var(--thumb-a) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* 数据看板骨架屏 */
.dash-skeleton { padding: 8px 0; }
.dash-skeleton .sk-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.dash-skeleton .sk-stat-card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.dash-skeleton .sk-stat-title { height: 13px; width: 80px; margin-bottom: 10px; }
.dash-skeleton .sk-stat-val { height: 32px; width: 100px; margin-bottom: 8px; }
.dash-skeleton .sk-stat-sub { height: 12px; width: 120px; }
.dash-skeleton .sk-dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.dash-skeleton .sk-panel { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.dash-skeleton .sk-panel-title { height: 15px; width: 140px; margin-bottom: 16px; }
.dash-skeleton .sk-bars { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 10px; }
.dash-skeleton .sk-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dash-skeleton .sk-bar-block { width: 60%; height: 100px; border-radius: 6px; background: linear-gradient(180deg, var(--thumb-a), var(--thumb-b)); }
.dash-skeleton .sk-bar-label { height: 11px; width: 40px; }
.dash-skeleton .sk-share-row,
.dash-skeleton .sk-top-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dash-skeleton .sk-share-name { height: 14px; width: 80px; }
.dash-skeleton .sk-share-val { height: 14px; width: 100px; }
.dash-skeleton .sk-top-name { height: 14px; width: 100px; }
.dash-skeleton .sk-top-val { height: 14px; width: 50px; }

/* 视图进入淡入（每次菜单切换触发一次，让初始化更顺滑） */
#content.view-enter { animation: contentIn .34s cubic-bezier(.16,1,.3,1) both; }
@keyframes contentIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== 登录（浅色暖纸白 + 古铜金，分栏动效）===== */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; padding: 24px;
  background:
    radial-gradient(1100px 560px at 12% -12%, #FBF8F2, transparent 60%),
    linear-gradient(135deg, #F6F3EC 0%, #EFE9DD 55%, #E7DFCF 100%);
}
.login-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.38; animation: blobFloat 20s ease-in-out infinite; }
.blob-1 { width: 420px; height: 420px; background: radial-gradient(circle, #C9A24B, transparent 70%); top: -120px; left: -80px; }
.blob-2 { width: 520px; height: 520px; background: radial-gradient(circle, #9A7B2E, transparent 70%); bottom: -160px; right: -100px; animation-delay: -7s; }
.blob-3 { width: 320px; height: 320px; background: radial-gradient(circle, #B5934F, transparent 70%); top: 45%; left: 55%; animation-delay: -14s; }
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(70px, -50px) scale(1.08); }
  66% { transform: translate(-50px, 40px) scale(0.94); }
}

.login-split {
  position: relative; z-index: 1; width: 100%; max-width: 940px;
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 24px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(60,45,20,.16), 0 4px 12px rgba(60,45,20,.08);
  animation: cardIn .9s cubic-bezier(.16,1,.3,1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.98); } to { opacity: 1; transform: none; } }

/* 左：古铜金品牌 hero */
.login-hero {
  position: relative; padding: 44px 40px; color: #FBF3E0;
  background: radial-gradient(120% 80% at 0% 0%, #B5934F 0%, #8A6E2C 45%, #5E4A1C 100%);
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.login-hero::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,245,220,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,245,220,.05) 1px, transparent 1px);
  background-size: 32px 32px; opacity: .6;
}
.hero-top, .hero-center, .hero-bottom { position: relative; z-index: 1; }
/* Hero 品牌 logo 图 —— 近似正方形(1.47:1)，三花瓣图形占主体，放大清晰展示 */
.hero-logo {
  height: 90px; width: auto; max-width: 260px; border-radius: 14px;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,.25));
  animation: sealIn .8s cubic-bezier(.16,1,.3,1) both;
}
.hero-slogan { margin: 14px 0 0; font-size: 16px; letter-spacing: 3px; color: rgba(255,247,230,.9); animation: fadeUp .7s .25s both; }
.hero-desc { font-size: 14px; line-height: 1.7; color: rgba(255,247,230,.78); animation: fadeUp .7s .35s both; }
.hero-rule { width: 54px; height: 3px; border-radius: 3px; margin-top: 18px; background: linear-gradient(90deg, #F3E3BE, transparent); }
@keyframes sealIn { from { transform: rotate(-12deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* 右：登录表单卡片 */
.login-panel { position: relative; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; animation: fadeUp .7s .2s both; }
.login-shine {
  position: absolute; top: -60%; left: -60%; width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 38%, rgba(154,123,46,.10) 48%, rgba(154,123,46,.16) 50%, rgba(154,123,46,.10) 52%, transparent 62%);
  transform: rotate(45deg); animation: shine 9s linear infinite; pointer-events: none;
}
@keyframes shine { 0% { transform: translateX(-120%) rotate(45deg); } 100% { transform: translateX(120%) rotate(45deg); } }
.panel-head { display: flex; align-items: center; justify-content: center; margin-bottom: 36px; }
/* 面板主标题（无 logo 时居中独显） */
.panel-cn { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: 2px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* 登录表单字段 - 浅色适配 */
.login .field { position: relative; margin-bottom: 16px; }
.login .field label { display: block; color: var(--text-dim); font-size: 13px; margin-bottom: 7px; }
.login .field input {
  width: 100%; background: var(--bg-elev); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 14px 44px 14px 16px; font-size: 15px; transition: all .25s ease;
}
.login .field input::placeholder { color: var(--muted); }
.login .field input:focus {
  outline: none; border-color: var(--gold-2); background: #fff;
  box-shadow: 0 0 0 3px rgba(154,123,46,.14), 0 6px 18px rgba(60,45,20,.10);
  transform: translateY(-1px);
}
.field-icon-wrap .field-icon {
  position: absolute; right: 14px; top: 42px; font-size: 16px;
  opacity: .45; transition: opacity .2s; pointer-events: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.login .field input:focus ~ .field-icon,
.field-icon-wrap:focus-within .field-icon { opacity: .85; }

/* 登录按钮 */
.btn-login {
  width: 100%; padding: 14px; font-size: 16px; font-weight: 600; letter-spacing: 6px;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #2B2620; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(154,123,46,.3), inset 0 1px 0 rgba(255,255,255,.25);
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeUp .5s .45s both;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(154,123,46,.45), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-login:active { transform: translateY(0); }
.btn-login .btn-label { position: relative; z-index: 1; }
.btn-login::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transition: left .5s;
}
.btn-login:hover::after { left: 100%; }
.btn-login.loading .btn-label { opacity: 0; }
.btn-login .btn-loader {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 20px; height: 20px; border: 2px solid rgba(43,38,32,.25);
  border-top-color: #2B2620; border-radius: 50%; opacity: 0;
  animation: spin .6s linear infinite;
}
.btn-login.loading .btn-loader { opacity: 1; }
/* 通用主按钮加载态（裁剪确认等） */
.btn-primary { position: relative; }
.btn-primary.loading .btn-label { opacity: 0; }
.btn-primary .btn-loader {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 18px; height: 18px; border: 2px solid rgba(43,38,32,.3);
  border-top-color: #2B2620; border-radius: 50%; opacity: 0; pointer-events: none;
  animation: spin .6s linear infinite;
}
.btn-primary.loading .btn-loader { opacity: 1; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* 启动占位（刷新瞬间显示，避免闪登录页） */
.boot-loading {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: linear-gradient(135deg, #F6F3EC 0%, #EFE9DD 55%, #E7DFCF 100%);
}
.boot-loading .boot-logo {
  height: 68px; width: auto; max-width: 220px; border-radius: 16px;
  object-fit: contain;
  box-shadow: 0 8px 22px rgba(154,123,46,.25);
  animation: sealIn .8s cubic-bezier(.16,1,.3,1) both;
}
.boot-loading .boot-text { color: var(--text-dim); font-size: 14px; letter-spacing: 2px; }

.login-footer {
  text-align: center; margin-top: 24px;
  color: var(--muted); font-size: 11px; letter-spacing: 1px;
  animation: fadeUp .5s .6s both;
}
.login-remember {
  display: flex; align-items: center; gap: 8px;
  margin: 14px 0 0; cursor: pointer; user-select: none;
  color: var(--text-dim); font-size: 13px;
  animation: fadeUp .5s .55s both;
}
.login-remember input {
  width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--gold);
}
.login-remember:hover { color: var(--ink); }
.login .error { color: var(--danger); text-align: center; margin-top: 12px; animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

@media (max-width: 820px) {
  .login-split { grid-template-columns: 1fr; max-width: 420px; }
  .login-hero { display: none; }
}
@media (max-width: 420px) {
  .login-panel { padding: 36px 24px; }
  .login-split { border-radius: 20px; }
}

/* ===== 布局 ===== */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg-panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 0; box-shadow: var(--shadow);
  height: 100vh;
}
.brand { padding: 0 22px 18px; border-bottom: 1px solid var(--line); }
.brand-en { color: var(--gold); letter-spacing: 2px; font-size: 12px; }
.brand-cn { color: var(--text); font-size: 15px; margin-top: 4px; font-weight: 600; font-family: var(--font-serif); }
.nav { flex: 1; padding: 14px 0; display: flex; flex-direction: column; }
.nav-item {
  color: var(--text-dim); padding: 12px 22px; cursor: pointer; text-decoration: none;
  font-size: 14px; border-left: 3px solid transparent; transition: .2s;
}
.nav-item:hover { background: var(--bg-elev); color: var(--text); }
.nav-item.active { color: var(--gold); border-left-color: var(--gold); background: var(--bg-elev); }
.user { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; color: var(--text-dim); font-size: 13px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; overflow-y: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-base); z-index: 1; }
.topbar h1 { font-size: 20px; color: var(--text); font-family: var(--font-serif); letter-spacing: 1px; }
.content { padding: 24px 28px; flex: 1; }

/* ===== 按钮 ===== */
.btn-primary, .btn-sm, .btn-danger, .btn-text, .btn-warning {
  font-family: inherit; cursor: pointer; border: none; border-radius: 8px;
  transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease, filter .2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1A1612; font-weight: 700; padding: 11px 18px; font-size: 14px;
  box-shadow: 0 1px 2px rgba(154,123,46,.25);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 3px 10px rgba(154,123,46,.3); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; filter: none; box-shadow: none; }
.btn-sm { background: var(--bg-elev); color: var(--text); border: 1px solid var(--line); padding: 6px 12px; font-size: 13px; }
.btn-sm:hover { border-color: var(--gold-2); color: var(--gold); }
.btn-sm:active { transform: scale(.97); }
.btn-sm:disabled { opacity: .4; cursor: not-allowed; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(192,57,43,.4); padding: 6px 12px; font-size: 13px; }
.btn-danger:hover { background: rgba(192,57,43,.12); border-color: var(--danger); }
.btn-danger:active { transform: scale(.97); }
.btn-danger:disabled { opacity: .4; cursor: not-allowed; }
.btn-text { background: transparent; color: var(--gold-2); padding: 6px 10px; font-size: 13px; }
.btn-text:hover { color: var(--gold); }
.btn-text:active { transform: scale(.97); }
.btn-warning {
  background: transparent; color: var(--warn); border: 1px solid rgba(154, 107, 0, 0.4);
  padding: 6px 12px; font-size: 13px;
}
.btn-warning:hover { background: rgba(154, 107, 0, 0.12); border-color: var(--warn); }
.btn-warning:active { transform: scale(.97); }

/* ===== 表单字段 ===== */
.field { margin-bottom: 16px; }
.field label { display: block; color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.field .req { color: var(--danger); }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg-elev); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold-2); }
.field textarea { resize: vertical; }

/* ===== 工具条 / 表格 / 徽标 ===== */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar select { background: var(--bg-elev); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.toolbar input[type="search"], .toolbar .dish-search { flex: 0 1 240px; min-width: 140px; background: var(--bg-elev); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 14px; }.toolbar input[type="search"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.toolbar .toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pager { display: flex; gap: 14px; align-items: center; margin-top: 18px; color: var(--text-dim); justify-content: flex-end; }

/* 表格底栏：提示文字 + 分页同行 */
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.table-foot .pager { margin-top: 0; }
.foot-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; border: 1px solid transparent; }
.badge.ok { color: var(--ok); border-color: rgba(46,125,79,.35); background: rgba(46,125,79,.10); }
.badge.off, .badge.muted { color: var(--muted); border-color: rgba(107,99,86,.35); background: rgba(107,99,86,.10); }
.badge.warn { color: var(--warn); border-color: rgba(154,107,0,.35); background: rgba(154,107,0,.10); }
.badge.info { color: var(--info); border-color: rgba(31,111,178,.35); background: rgba(31,111,178,.10); }

/* 表格横线策略：border-bottom 统一画在 <tr> 上（collapse 模式下 tr 的边框是
   一整条连续横线，不受各单元格内部高度差异影响——彻底消除"行高不等→分隔线/按钮错位"）。
   之前错误地在每个 td 上画 border-bottom：当行高因内容（如 dish-tags）不同时，
   vertical-align:middle 的居中点逐行漂移，导致操作列按钮上下跳动 + 视觉线条断开。 */
.data-table { width: 100%; border-collapse: collapse; border-spacing: 0; font-size: 14px; }
.data-table .row-idx { color: var(--text-dim); font-variant-numeric: tabular-nums; width: 64px; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 14px;
  vertical-align: middle;
  /* 不在单元格上画任何 border —— 横线统一由 tr 承担 */
  border: none;
  border-radius: 0;
}
/* 表头：顶部线 + 背景区分 */
.data-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}
/* 每行底部分隔线：只画一次，整行连续，不因单元格内容高低而断裂 */
.data-table tbody tr { border-bottom: 1px solid var(--line); }
.data-table tbody tr:hover { background: var(--bg-elev); }
/* 空态行：不画底分隔线 */
.data-table tbody tr.table-empty-row { border-bottom: none; }
.table-empty-row td { padding: 0; }

/* 操作列：.row-actions 是挂在 <td> 上的 class。
   关键坑：不能给这个 td 设 display:flex —— flex 容器不再是表格单元格，
   vertical-align:middle 立即失效，按钮会按 26px 内容高度贴行顶（即反复出现的"偏上"）。
   正确做法：保留 td 为普通表格单元格，继承 .data-table td 的 vertical-align:middle 自然居中；
   按钮用 inline-block + margin 间距排布。 */
.row-actions { vertical-align: middle; white-space: nowrap; text-align: left; }
.row-actions .btn-sm,
.row-actions .btn-text,
.row-actions .btn-danger {
  vertical-align: middle;
  margin-right: 8px;
  padding-top: 4px;
  padding-bottom: 4px;
  line-height: 18px;
  height: 26px;
}
.row-actions .btn-sm:last-child,
.row-actions .btn-text:last-child,
.row-actions .btn-danger:last-child { margin-right: 0; }
/* 表格包裹区：scroll 单独包一层，圆角不做 data-table 本身即可 */

/* ===== 数据看板 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--bg-panel); border: 1px solid var(--line); border-left: 3px solid var(--gold-2); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .25s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(40,30,15,.1), var(--shadow); }
.stat-title { color: var(--text-dim); font-size: 13px; }
.stat-val { color: var(--text); font-size: 28px; font-weight: 700; margin: 8px 0 4px; font-family: var(--font-serif); letter-spacing: .5px; }
.delta { font-size: 13px; margin-right: 8px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); }
.stat-sub { color: var(--muted); font-size: 12px; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.dash-grid .panel:last-child { grid-column: 1 / -1; }
.panel { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 15px; color: var(--text); margin-bottom: 16px; font-family: var(--font-serif); letter-spacing: .5px; }.bars { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 60%; background: linear-gradient(180deg, #8A6E3C, #54441F); border-top: 2px solid var(--gold-2); border-radius: 6px 6px 0 0; min-height: 4px; transition: height .4s; }
.bar-val { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.bar-lab { font-size: 11px; color: var(--muted); }
.share-row, .top-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.share-name, .top-name { color: var(--text); }
.share-val, .top-val { color: var(--text); }
.top-rank { color: var(--gold); font-weight: 700; margin-right: 10px; }

/* ===== 菜品列表 ===== */
.dish-name { font-size: 15px; color: var(--text); font-weight: 600; }
.dish-name .en { color: var(--text-dim); font-weight: 400; font-size: 13px; margin-left: 4px; }
.dish-cat { color: var(--gold-2); font-size: 12px; margin: 4px 0; }
.dish-price { color: var(--text); font-size: 15px; font-weight: 600; }
.dish-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--bg-elev); color: var(--text-dim); font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); }
.dish-actions { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ===== 缩略图 ===== */
.thumb { width: 100%; aspect-ratio: 4/3; background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b)); border-radius: 0 0 0 0; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.ph { color: var(--gold-2); font-size: 32px; font-weight: 700; }
.cell-thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b)); color: var(--gold-2); font-size: 18px; font-weight: 700; }

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(30,22,10,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 16px; width: 520px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(40,30,15,.18), var(--shadow); animation: modalIn .28s cubic-bezier(.16,1,.3,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-wide { width: 760px; }
.modal-sm { width: 380px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; color: var(--text); }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 24px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
/* 裁剪框四角延伸式手柄（从角向两边延伸的 L 型线段 + 圆点） */
.crop-handle { position: absolute; width: 24px; height: 24px; z-index: 2; }
.crop-handle::before, .crop-handle::after {
  content: ''; position: absolute; background: #fff;
  border-radius: 1px;
  box-shadow: 0 0 4px rgba(0,0,0,.5), 0 0 8px rgba(0,0,0,.3);
}
/* ┌ nw 角：横线向右 + 竖线向下 */
.crop-handle[data-h="nw"] { left: -12px; top: -12px; cursor: nwse-resize; }
.crop-handle[data-h="nw"]::before { left: 50%; top: 10px; width: 2px; height: 22px; margin-left: -1px; } /* 竖线向下 */
.crop-handle[data-h="nw"]::after { left: 10px; top: 50%; width: 22px; height: 2px; margin-top: -1px; } /* 横线向右 */

/* ┐ ne 角：横线向左 + 竖线向下 */
.crop-handle[data-h="ne"] { right: -12px; top: -12px; cursor: nesw-resize; }
.crop-handle[data-h="ne"]::before { right: 50%; top: 10px; width: 2px; height: 22px; margin-right: -1px; }
.crop-handle[data-h="ne"]::after { right: 10px; top: 50%; width: 22px; height: 2px; margin-top: -1px; }

/* └ sw 角：横线向右 + 竖线向上 */
.crop-handle[data-h="sw"] { left: -12px; bottom: -12px; cursor: nesw-resize; }
.crop-handle[data-h="sw"]::before { left: 50%; bottom: 10px; width: 2px; height: 22px; margin-left: -1px; }
.crop-handle[data-h="sw"]::after { left: 10px; bottom: 50%; width: 22px; height: 2px; margin-bottom: -1px; }

/* ┘ se 角：横线向左 + 竖线向上 */
.crop-handle[data-h="se"] { right: -12px; bottom: -12px; cursor: nwse-resize; }
.crop-handle[data-h="se"]::before { right: 50%; bottom: 10px; width: 2px; height: 22px; margin-right: -1px; }
.crop-handle[data-h="se"]::after { right: 10px; bottom: 50%; width: 22px; height: 2px; margin-bottom: -1px; }

/* 旋转按钮 */
[data-rotate] { transition: transform .2s ease; }
[data-rotate]:hover { transform: rotate(90deg); }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 22px; border-top: 1px solid var(--line); }

/* 上传行 / 动态子行 */
.upload-row { display: flex; align-items: center; gap: 12px; }
.upload-row .thumb { width: 64px; aspect-ratio: 4/5; border-radius: 10px; }
.sub-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.price-row input, .price-row select { background: var(--bg-base); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 8px; font-size: 13px; font-family: inherit; }
.price-row .ip-unit { flex: 2; } .price-row .ip-price { flex: 1; width: 80px; }
.method-row { align-items: flex-start; background: var(--bg-base); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.method-img { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.method-img .thumb { width: 56px; aspect-ratio: 4/5; border-radius: 8px; }
.method-img .m-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.method-img .thumb.m-ph { width: 56px; aspect-ratio: 4/5; }
/* 图片上传加载动效：覆盖在缩略图所在位置，上传完成移除 */
.up-spinner {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(246, 243, 236, .82); border-radius: 10px;
}
.spin-ring {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(154, 123, 46, .22);
  border-top-color: var(--gold);
  animation: upRingSpin .7s linear infinite;
}
.up-spin-text { font-size: 12px; color: var(--gold-2); letter-spacing: 1px; }
@keyframes upRingSpin { to { transform: rotate(360deg); } }
@keyframes uploadPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.method-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.method-fields input { background: var(--bg-base); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 7px 9px; font-size: 13px; font-family: inherit; }
.row-del { color: var(--danger) !important; font-size: 18px !important; align-self: center; }

/* ===== 订单改单（Web 后台改单入口，调用 orderUpdate）===== */
.od-edit { display: inline-flex; align-items: center; gap: 6px; }
.od-edit b { min-width: 22px; text-align: center; color: var(--text); }
.od-edit-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.od-edit-row label { color: var(--text-dim); font-size: 13px; min-width: 48px; }
.od-edit-row input { flex: 1; background: var(--bg-base); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; }

/* ===== 订单详情 ===== */
.od-meta { color: var(--text-dim); font-size: 13px; margin-bottom: 12px; }
.od-items { background: var(--bg-base); border-radius: 10px; padding: 12px; }
.od-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--line); align-items: center; }
.od-item:last-child { border-bottom: none; }
.od-name { flex: 1; min-width: 0; }
.od-item .muted { color: var(--muted); font-size: 12px; }
.od-total { text-align: right; color: var(--text); font-size: 16px; font-weight: 700; margin: 12px 0; }
.od-note { color: var(--text-dim); font-size: 13px; }
.confirm-text { color: var(--text); font-size: 15px; padding: 6px 0; }

/* ===== Toast ===== */
.toast-box { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-elev); border: 1px solid var(--line); color: var(--text); padding: 12px 20px; border-radius: 10px; font-size: 14px; opacity: 0; transform: translateY(-10px); transition: .3s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(192,57,43,.5); color: var(--danger); }
.toast.info { border-color: rgba(31,111,178,.5); color: var(--info); }
.toast.success { border-color: rgba(46,125,79,.45); color: var(--ok); }
.toast.warn { border-color: rgba(154,107,0,.5); color: var(--warn); }

/* ===== 响应式：三档断点（桌面 / 平板 / 手机）===== */
.hamburger { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; margin-right: 12px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.hamburger span { display: block; width: 16px; height: 2px; background: var(--gold); position: relative; }
.hamburger span::before, .hamburger span::after { content: ''; position: absolute; left: 0; width: 16px; height: 2px; background: var(--gold); }
.hamburger span::before { top: -5px; }
.hamburger span::after { top: 5px; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 80; }
.scrim.show { display: block; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
/* 筛选/翻页等待反馈：表格轻微变淡，提示正在加载 */
.tbl-loading { opacity: 0.45; pointer-events: none; transition: opacity 0.15s ease; }

@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .content { padding: 20px; }
  .topbar { padding: 16px 20px; }
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 90;
    width: 220px; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .data-table { min-width: 640px; }
  .modal { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .modal-overlay { padding: 0; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { width: calc(100% - 32px); margin: 16px; padding: 36px 24px 28px; }
}

/* ===== 可访问性：键盘焦点环（1.4.11） + 动效降级 ===== */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible,
.od-edit-row input:focus-visible, .toolbar select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .toast { transition: none; }
}


/* ===== 状态切换开关 ===== */
.status-toggle { display: flex; align-items: center; gap: 12px; }
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #d1cdc4; border-radius: 26px; transition: 0.3s;
}
.slider::before {
  content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--gold), var(--gold-2)); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.status-label { font-size: 14px; color: var(--text-dim); }
.status-toggle:has(input:checked) .status-label { color: var(--gold); }

/* ===== Key徽章 ===== */
.key-badge {
  display: inline-block; padding: 2px 10px; border-radius: 6px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--gold-2); font-size: 12px; font-family: 'SF Mono', Consolas, monospace;
}

/* ===== 账户管理表格 ===== */
#accounts .data-table td:first-child { font-family: var(--font-mono); color: var(--gold-2); }

/* ===== 分类表格 ===== */
#categories .data-table th:first-child,
#categories .data-table td:first-child { color: var(--gold-2); font-family: var(--font-mono); }
