/* =========================================================================
   拼豆计时管理系统  styles.css
   风格: iOS 26 液态玻璃 (Liquid Glass)
   ========================================================================= */

/* ===== 基础与变量 ===== */
:root {
  /* 状态色 - Apple 系统色 */
  --c-idle: #8e8e93;
  --c-running: #34c759;
  --c-paused: #0a84ff;
  --c-overtime: #ff3b30;
  --c-pending: #ff9500;
  --c-accent: #0a84ff;

  /* 液态玻璃核心参数 (低白染色 + 内高光 + 强模糊) */
  --glass-bg: rgba(255, 255, 255, 0.14);
  --glass-bg-strong: rgba(255, 255, 255, 0.24);
  --glass-bg-heavy: rgba(255, 255, 255, 0.40);
  --glass-blur: 28px;
  --glass-sat: 1.6;
  --hi-top: rgba(255, 255, 255, 0.65);   /* 顶部刀刃高光 */
  --hi-bot: rgba(255, 255, 255, 0.08);    /* 底部微光 */
  --edge: rgba(255, 255, 255, 0.35);      /* 玻璃描边 */
  --edge-soft: rgba(255, 255, 255, 0.22);

  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --shadow-outer: 0 8px 32px rgba(31, 42, 68, 0.18);
  --shadow-outer-lg: 0 24px 60px rgba(31, 42, 68, 0.24);
  --hairline: rgba(0, 0, 0, 0.08);

  --radius: 26px;
  --radius-lg: 32px;
  --radius-sm: 14px;

  /* 弹性缓动 */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* 桌台卡片尺寸(设置"桌台卡片大小"可调,三档预设见下方 data-card-size 规则) */
  --tc-min: 255px;      /* 单卡最小列宽 */
  --tc-gap: 18px;
  --tc-pad: 20px;
  --tc-radius: var(--radius);
  --tc-name: 17px;
  --tc-time: 26px;
  --tc-cust: 13px;
}

/* 桌台卡片大小档位:app.js 依据设置在 <html> 上写入 data-card-size */
html[data-card-size="compact"] { --tc-min: 136px; --tc-gap: 6px; --tc-pad: 9px 11px; --tc-radius: 14px; --tc-name: 13px; --tc-time: 16px; --tc-cust: 11px; --tc-h: 120px; }
html[data-card-size="large"]   { --tc-min: 320px; --tc-gap: 22px; --tc-pad: 24px; --tc-radius: 30px; --tc-name: 19px; --tc-time: 30px; --tc-cust: 14px; }
/* 紧凑档:状态胶囊与剩余/超时行同步缩小 */
html[data-card-size="compact"] .tc-status { font-size: 10px; padding: 2px 8px; }
html[data-card-size="compact"] .tc-remaining { font-size: 11px; }
/* 起始时间行(补记用):与 .tc-remaining 同风格,略小一档 */
.tc-start { font-size: 11px; color: var(--text-muted); position: relative; z-index: 2; font-weight: 500; opacity: 0.85; }
html[data-card-size="compact"] .tc-start { font-size: 10px; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  /* iOS 26 风格柔和壁纸:冷暖光影交错,有明暗层次,承载液态玻璃折射 */
  background-color: #e7ecf5;
  background-image:
    radial-gradient(1100px 780px at 8% -8%, rgba(178, 205, 255, 0.55), transparent 60%),
    radial-gradient(950px 680px at 102% -2%, rgba(214, 186, 255, 0.48), transparent 56%),
    radial-gradient(880px 680px at 88% 104%, rgba(255, 205, 182, 0.42), transparent 56%),
    radial-gradient(820px 620px at 12% 104%, rgba(168, 228, 216, 0.44), transparent 56%),
    linear-gradient(160deg, #dfe6f3 0%, #eae4f0 45%, #e4ecf4 100%);
  background-attachment: fixed;
  background-size: cover;
}

#app { min-height: 100vh; display: flex; flex-direction: column; position: relative; }

/* ===== 液态玻璃通用配方 ===== */
.liquid {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow:
    inset 0 1px 0 var(--hi-top),
    inset 0 -1px 0 var(--hi-bot),
    var(--shadow-outer);
  border: 1px solid var(--edge);
}

/* ===== 顶部栏 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; flex-wrap: wrap; gap: 14px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(32px) saturate(1.7);
  -webkit-backdrop-filter: blur(32px) saturate(1.7);
  box-shadow:
    inset 0 1px 0 var(--hi-top),
    0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 24px rgba(31, 42, 68, 0.10);
  border-bottom: 1px solid var(--edge-soft);
  position: sticky; top: 0; z-index: 50;
  color: var(--text);
}
.topbar-left { display: flex; align-items: center; gap: 18px; }
.logo { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.shop-name {
  font-size: 12px; opacity: 0.65; font-weight: 500;
  padding: 4px 12px; background: rgba(0, 0, 0, 0.04); border-radius: 100px;
}
.clock {
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.today-summary {
  font-size: 12px; font-weight: 600; padding: 7px 16px; border-radius: 100px;
  background: rgba(255, 255, 255, 0.34); color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--edge-soft); white-space: nowrap;
}

/* ===== 导航 ===== */
.nav {
  display: flex; gap: 6px; padding: 12px 28px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border-bottom: 1px solid var(--edge-soft);
  position: sticky; top: 63px; z-index: 40;
}
.nav-btn {
  border: none; background: transparent; padding: 9px 18px; cursor: pointer;
  font-size: 14px; color: var(--text-muted); border-radius: 100px;
  transition: all 0.3s var(--ease-smooth); font-weight: 600; letter-spacing: -0.01em;
  position: relative;
}
.nav-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.28); }
.nav-btn.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 16px rgba(31, 42, 68, 0.14);
}

/* ===== 视图 ===== */
.view { display: none; padding: 28px 30px 48px; flex: 1; max-width: 1500px; margin: 0 auto; width: 100%; }
.view.active { display: block; animation: fade-in 0.4s var(--ease-smooth); }
@keyframes fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== 工具栏 ===== */
.dashboard-toolbar, .sales-toolbar, .storage-toolbar {
  display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 13px; color: var(--text-muted); white-space: nowrap; font-weight: 600; }
.legend {
  display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; padding: 8px 16px;
  background: rgba(255, 255, 255, 0.22); border-radius: 100px;
  backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid var(--edge-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
.dot.idle { background: var(--c-idle); }
.dot.running { background: var(--c-running); }
.dot.paused { background: var(--c-paused); }
.dot.overtime { background: var(--c-overtime); }

/* ===== 输入与选择 ===== */
.input, .date-input, .area-input, .tables-input, .price-input {
  border: 1px solid var(--edge-soft); border-radius: var(--radius-sm);
  padding: 9px 14px; font-size: 14px;
  background: rgba(255, 255, 255, 0.30);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--text); outline: none;
  transition: all 0.25s var(--ease-smooth); font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.input:focus, .date-input:focus, .area-input:focus, .tables-input:focus, .price-input:focus {
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.5);
}
.input.full { width: 100%; }

/* ===== 桌台看板 ===== */
.table-board { display: flex; flex-direction: column; gap: 28px; }
.area-section h3 {
  font-size: 18px; margin-bottom: 14px; color: var(--text); display: flex;
  align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em;
}
.area-section h3 .area-count {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  background: rgba(255, 255, 255, 0.30); padding: 4px 12px; border-radius: 100px;
  border: 1px solid var(--edge-soft); backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tc-min), 1fr)); gap: var(--tc-gap); }

.table-card {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(30px) saturate(1.7);
  -webkit-backdrop-filter: blur(30px) saturate(1.7);
  border-radius: var(--tc-radius); padding: var(--tc-pad); cursor: pointer;
  /* 固定卡高:紧凑档下带备注/超时行的卡片不会把整行撑高,计时始终贴底 */
  display: flex; flex-direction: column; height: var(--tc-h, auto);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease-smooth);
  border: 1px solid var(--edge); position: relative; overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 6px 22px rgba(31, 42, 68, 0.12);
}
.table-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,0.28), transparent);
  pointer-events: none; border-radius: var(--radius) var(--radius) 0 0;
}
.table-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(31, 42, 68, 0.20), inset 0 1px 0 rgba(255,255,255,0.9); }
.table-card::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 5px;
  background: var(--c-idle); border-radius: 0 4px 4px 0; z-index: 1;
}
.table-card.running::before { background: var(--c-running); box-shadow: 0 0 14px rgba(52,199,89,0.55); }
.table-card.paused::before { background: var(--c-paused); box-shadow: 0 0 14px rgba(10,132,255,0.55); }
.table-card.overtime::before { background: var(--c-overtime); box-shadow: 0 0 14px rgba(255,59,48,0.65); }
.table-card.overtime { animation: pulse-red 1.6s ease-in-out infinite; }
@keyframes pulse-red {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 6px 22px rgba(31,42,68,0.12), 0 0 0 0 rgba(255,59,48,0.28); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 6px 22px rgba(31,42,68,0.12), 0 0 0 8px rgba(255,59,48,0.14); }
}

.tc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; position: relative; z-index: 2; }
.tc-name { font-size: var(--tc-name); font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-status {
  flex-shrink: 0; margin-left: 8px;
  font-size: 11px; padding: 3px 11px; border-radius: 100px; color: #fff;
  background: var(--c-idle); white-space: nowrap; font-weight: 700; letter-spacing: 0.02em;
}
.table-card.running .tc-status { background: var(--c-running); }
.table-card.paused .tc-status { background: var(--c-paused); }
.table-card.overtime .tc-status { background: var(--c-overtime); }

.tc-customer { font-size: var(--tc-cust, 13px); color: var(--text); margin-bottom: 2px; position: relative; z-index: 2; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-notes {
  font-size: var(--tc-cust, 13px); color: var(--text-muted); margin: 0 0 2px; position: relative; z-index: 2; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-time {
  font-size: var(--tc-time); font-weight: 800; font-variant-numeric: tabular-nums; margin: auto 0 4px;
  letter-spacing: -0.03em; position: relative; z-index: 2;
}
.tc-remaining { font-size: 12px; color: var(--text-muted); position: relative; z-index: 2; font-weight: 500; }
.tc-remaining.warn { color: var(--c-pending); }
.tc-remaining.over { color: var(--c-overtime); }
.tc-price { font-size: 11px; color: var(--text-muted); margin-top: 8px; position: relative; z-index: 2; }
.tc-items-badge {
  position: absolute; top: 16px; right: 16px; background: var(--c-pending); color: #fff;
  font-size: 11px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 100px;
  display: none; align-items: center; justify-content: center; font-weight: 700; z-index: 3;
  box-shadow: 0 2px 8px rgba(255,149,0,0.45);
}

/* ===== 表格 ===== */
.table-wrap {
  background: rgba(255, 255, 255, 0.22); border-radius: var(--radius); overflow: auto;
  backdrop-filter: blur(30px) saturate(1.7); -webkit-backdrop-filter: blur(30px) saturate(1.7);
  border: 1px solid var(--edge-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 28px rgba(31, 42, 68, 0.14);
}
.data-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.data-table th, .data-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.data-table th {
  background: rgba(255, 255, 255, 0.38); font-weight: 600; color: var(--text-muted);
  position: sticky; top: 0; white-space: nowrap; letter-spacing: -0.01em;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.data-table tr { transition: background 0.15s; }
.data-table tr:hover { background: rgba(10, 132, 255, 0.07); }
.data-table .empty-row td { text-align: center; color: var(--text-muted); padding: 48px; }

/* ===== 销售汇总 ===== */
.sales-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 16px; margin-bottom: 24px;
}
.summary-card {
  background: rgba(255, 255, 255, 0.22); border-radius: var(--radius); padding: 20px 22px;
  backdrop-filter: blur(30px) saturate(1.7); -webkit-backdrop-filter: blur(30px) saturate(1.7);
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 20px rgba(31, 42, 68, 0.12);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-smooth);
  position: relative; overflow: hidden;
}
.summary-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--c-accent); border-radius: 4px;
}
.summary-card:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 16px 36px rgba(31,42,68,0.20); }
.summary-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.summary-card .value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.summary-card .value.small { font-size: 17px; }

/* ===== 设置 ===== */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
.settings-card {
  background: rgba(255, 255, 255, 0.22); border-radius: var(--radius); padding: 26px;
  backdrop-filter: blur(30px) saturate(1.7); -webkit-backdrop-filter: blur(30px) saturate(1.7);
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 20px rgba(31, 42, 68, 0.12);
}
.settings-card.wide { grid-column: 1 / -1; }
.settings-card h3 {
  font-size: 16px; margin-bottom: 18px; display: flex; justify-content: space-between;
  align-items: center; font-weight: 700; letter-spacing: -0.02em; gap: 12px;
}
.settings-card h3 .wallpaper-hint { font-size: 12px; font-weight: 500; color: var(--text-muted); }

/* ===== 壁纸工具 ===== */
.wp-row {
  display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
  flex-wrap: wrap;
}
.wp-upload-label { display: inline-flex; align-items: center; cursor: pointer; }
.wp-mode { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.wp-mode select, .wp-mode input[type=range] {
  border: 1px solid var(--edge-soft); border-radius: 100px;
  padding: 6px 14px; background: rgba(255, 255, 255, 0.30);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-family: inherit; font-size: 13px; outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.wp-mode input[type=range] { padding: 0; accent-color: var(--c-accent); }
.wp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px;
}
.wp-item {
  border-radius: var(--radius-sm); overflow: hidden; position: relative;
  background: rgba(0,0,0,.06); aspect-ratio: 1;
  border: 2px solid transparent; cursor: pointer; transition: all .25s var(--ease-smooth);
}
.wp-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.wp-item.active {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(10,132,255,.2);
}
.wp-item::after {
  content: attr(data-name); position: absolute; left: 0; right: 0; bottom: 0;
  padding: 4px 6px; background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: #fff; font-size: 11px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; opacity: 0; transition: opacity .15s;
}
.wp-item:hover::after, .wp-item:hover .wp-remove { opacity: 1; }
.wp-remove {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255, 59, 48, 0.92); color: #fff; border: none;
  cursor: pointer; font-size: 16px; line-height: 1; display: flex;
  align-items: center; justify-content: center; opacity: 0; transition: opacity .15s;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.wp-remove:hover { background: #ff3b30; }
.wp-empty {
  grid-column: 1 / -1; padding: 40px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px;
  border: 2px dashed rgba(0,0,0,.12); border-radius: var(--radius-sm);
}
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.form-row label { font-size: 13px; color: var(--text); flex-shrink: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form-row .input { width: 170px; }
.color-input { width: 54px; height: 36px; border: 1px solid var(--edge-soft); border-radius: var(--radius-sm); cursor: pointer; padding: 3px; background: rgba(255,255,255,0.3); }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 14px; line-height: 1.6; }

.area-manager { display: flex; flex-direction: column; gap: 10px; }
.area-row {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  background: rgba(255, 255, 255, 0.20); border-radius: var(--radius-sm); flex-wrap: wrap;
  border: 1px solid var(--edge-soft);
}
.area-row .area-input { width: 110px; }
.area-row .tables-input { flex: 1; min-width: 200px; }
.area-row .price-input { width: 110px; }

.data-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== 按钮 ===== */
.btn {
  border: none; border-radius: 100px; padding: 10px 20px; font-size: 14px; cursor: pointer;
  transition: all 0.25s var(--ease-smooth); font-weight: 600; white-space: nowrap; letter-spacing: -0.01em;
  font-family: inherit;
}
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-primary {
  background: linear-gradient(135deg, #0a84ff, #0066ff); color: #fff;
  box-shadow: 0 2px 10px rgba(10, 132, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(10, 132, 255, 0.5), inset 0 1px 0 rgba(255,255,255,0.35); transform: translateY(-1px); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.30); color: var(--text); border: 1px solid var(--edge-soft);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.5); }
.btn-danger {
  background: linear-gradient(135deg, #ff453a, #ff3b30); color: #fff;
  box-shadow: 0 2px 10px rgba(255, 59, 48, 0.32), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-danger:hover { box-shadow: 0 6px 18px rgba(255, 59, 48, 0.45), inset 0 1px 0 rgba(255,255,255,0.35); transform: translateY(-1px); }
.btn-success {
  background: linear-gradient(135deg, #34c759, #30b94e); color: #fff;
  box-shadow: 0 2px 10px rgba(52, 199, 89, 0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-success:hover { box-shadow: 0 6px 18px rgba(52, 199, 89, 0.5), inset 0 1px 0 rgba(255,255,255,0.35); transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 40, 0.30);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
  animation: overlay-in 0.25s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: rgba(255, 255, 255, 0.30); border-radius: var(--radius-lg); width: 100%; max-width: var(--modal-max, 460px);
  max-height: 84vh; display: flex; flex-direction: column;
  backdrop-filter: blur(40px) saturate(1.8); -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid var(--edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    0 28px 70px rgba(31, 42, 68, 0.30);
  animation: modal-in 0.4s var(--ease-spring);
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.92) translateY(20px); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 26px; border-bottom: 1px solid var(--hairline); }
.modal-header h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
  background: rgba(0, 0, 0, 0.05); border: none; font-size: 22px; cursor: pointer; color: var(--text-muted);
  line-height: 1; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s var(--ease-smooth);
}
.modal-close:hover { background: rgba(0, 0, 0, 0.1); color: var(--text); }
.modal-body { padding: 24px 26px; overflow-y: auto; }
.modal-footer { padding: 16px 26px; border-top: 1px solid var(--hairline); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.modal-body .field { margin-bottom: 16px; }
.modal-body .field label { display: block; font-size: 13px; margin-bottom: 7px; color: var(--text); font-weight: 600; letter-spacing: -0.01em; }
.modal-body .field input, .modal-body .field select, .modal-body .field textarea {
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; border: 1px solid var(--edge-soft); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  background: rgba(255, 255, 255, 0.40);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--text); outline: none; transition: all 0.25s var(--ease-smooth);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.modal-body .field input:focus, .modal-body .field select:focus, .modal-body .field textarea:focus {
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.6);
}
.modal-body .field textarea { resize: vertical; min-height: 64px; }
.modal-body .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-body .row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
/* 允许收缩:紧凑弹窗下数字输入框的固有宽度会溢出网格轨道,压到旁边控件 */
.modal-body .row-2 > .field, .modal-body .row-3 > .field { min-width: 0; }

/* 补记起始时间:时间输入与「补记开始」按钮同行 */
.bf-row { display: flex; align-items: center; gap: 10px; }
.modal-body .field .bf-row input[type="time"] { width: auto; flex: 1 1 auto; min-width: 0; }
.bf-row .btn { flex: 0 0 auto; white-space: nowrap; }

.bill-section { margin-bottom: 18px; }
.bill-section h4 { font-size: 13px; margin-bottom: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.bill-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.bill-row.total {
  font-size: 20px; font-weight: 800; border-top: 2px solid var(--hairline); margin-top: 10px;
  padding-top: 14px; color: var(--c-accent); letter-spacing: -0.02em;
}
.items-list { margin-bottom: 12px; }
.item-row {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  background: rgba(255, 255, 255, 0.25); border-radius: var(--radius-sm); margin-bottom: 8px;
  border: 1px solid var(--edge-soft);
}
.item-row input { flex: 1; border: 1px solid var(--edge-soft); border-radius: 8px; padding: 8px 12px; font-size: 14px; background: rgba(255,255,255,0.5); outline: none; }
.item-row input:focus { border-color: var(--c-accent); }
.item-row .price-col { width: 90px; }
.item-row .qty-col { width: 70px; }
.item-row .remove-item {
  width: 30px; height: 30px; background: rgba(255, 59, 48, 0.12); color: var(--c-overtime);
  border: none; border-radius: 8px; cursor: pointer; font-size: 18px; transition: all 0.15s;
}
.item-row .remove-item:hover { background: rgba(255, 59, 48, 0.22); }

.status-badge { padding: 3px 11px; border-radius: 100px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-badge.stored { background: rgba(10, 132, 255, 0.15); color: #0066ff; }
.status-badge.picked { background: rgba(52, 199, 89, 0.18); color: #1a8c3d; }
.status-badge.overdue { background: rgba(255, 59, 48, 0.15); color: #d70015; }
.action-btns { display: flex; gap: 6px; }
.action-btns .btn { padding: 5px 12px; font-size: 12px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(30, 34, 50, 0.60);
  backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  color: #fff; padding: 13px 24px; border-radius: 100px; font-size: 14px; font-weight: 600;
  z-index: 2000; box-shadow: 0 12px 36px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.2);
  animation: toast-in 0.4s var(--ease-spring);
}
.toast.success { background: rgba(52, 199, 89, 0.92); }
.toast.error { background: rgba(255, 59, 48, 0.92); }
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 24px) scale(0.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.16); border-radius: 100px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.28); background-clip: padding-box; }

/* ===== 手机端 (移动版) ===== */
@media (max-width: 720px) {
  /* 顶栏滚走 + 导航吸顶,切换视图始终可达 */
  .topbar {
    position: static;
    flex-wrap: wrap; row-gap: 8px;
    padding: 10px 14px;
  }
  .topbar-left { order: 1; gap: 8px; }
  .logo { font-size: 15px; white-space: nowrap; }
  .shop-name { display: none; }
  .topbar-center { order: 2; margin-left: auto; }
  .clock { font-size: 20px; }
  .topbar-right { order: 3; flex-basis: 100%; text-align: center; }
  .today-summary { font-size: 12px; padding: 6px 14px; white-space: normal; }

  .nav {
    position: sticky; top: 0; z-index: 40;
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 12px; gap: 6px;
  }
  .nav-btn { flex: 0 0 auto; min-height: 44px; padding: 8px 16px; font-size: 14px; }

  .view { padding: 16px 14px 28px; }
  .dashboard-toolbar, .sales-toolbar, .storage-toolbar { gap: 10px; margin-bottom: 16px; }

  /* 桌台卡:跟随"桌台卡片大小"设置(紧凑档手机上可两列) */
  .table-grid { grid-template-columns: repeat(auto-fill, minmax(var(--tc-min), 1fr)); gap: var(--tc-gap); }
  .table-card { padding: var(--tc-pad); }

  /* 销售汇总:两列 */
  .sales-summary { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .summary-card { padding: 16px; }
  .summary-card .value { font-size: 22px; }

  /* 表格横向平滑滚动 */
  .table-wrap { -webkit-overflow-scrolling: touch; border-radius: 20px; }

  /* 设置:单列 + 表单项竖排 */
  .settings-grid { grid-template-columns: 1fr; gap: 14px; }
  .settings-card { padding: 18px; }
  .form-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .form-row .input { width: 100%; }
  .area-row { flex-direction: column; align-items: stretch; }
  .area-row .area-input, .area-row .price-input { width: 100%; }

  /* 按钮:加大触屏高度 */
  .btn { min-height: 44px; padding: 8px 18px; }

  /* 弹窗:底部悬浮小卡片(不再全宽铺满)，宽度跟随设置里的"弹窗大小" */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: auto;
    max-width: min(var(--modal-max, 460px), calc(100vw - 28px));
    max-height: 84vh;
    margin: 0 auto 14px;
    border-radius: 24px;
  }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-footer {
    position: sticky; bottom: 0; flex-wrap: wrap;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  }
  .modal-footer .btn { flex: 1 1 auto; min-height: 46px; }
  .modal-footer .btn-success, .modal-footer .btn-primary { flex: 2 1 40%; }
  .modal-body .row-2, .modal-body .row-3 { grid-template-columns: 1fr; }

  /* 输入防 iOS 自动缩放 */
  .input, .date-input, select,
  .modal-body .field input, .modal-body .field select, .modal-body .field textarea {
    font-size: 16px;
  }

  /* 附加消费行可换行 */
  .item-row { flex-wrap: wrap; }
  .item-row input { font-size: 16px; }
  .item-row .price-col { width: 100px; }
  .item-row .qty-col { width: 80px; }

  .toast { max-width: 88vw; white-space: normal; }
  .legend { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}