/* 情浓餐饮点菜系统 - 管理端样式（葡萄叶绿主题） */
:root {
  --brand: #4a7c2f;        /* 葡萄叶绿 */
  --brand-dark: #3a6224;
  --brand-light: #eaf3e4;
  --accent: #c9a227;       /* 金色点缀 */
  --bg: #f4f6f1;
  --card: #ffffff;
  --text: #2b3323;
  --text2: #6b7560;
  --line: #e3e8dd;
  --danger: #c0392b;
  --warn: #e67e22;
  --ok: #2e9e44;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(60, 80, 40, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3a6224 0%, #5a8a38 55%, #7a9e4c 100%);
}
.login-card {
  width: 380px; max-width: 92vw; background: #fff; border-radius: 16px;
  padding: 36px 34px; box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.login-logo {
  text-align: center; font-size: 26px; font-weight: 700; color: var(--brand-dark);
  margin-bottom: 4px; letter-spacing: 2px;
}
.login-sub { text-align: center; color: var(--text2); margin-bottom: 26px; font-size: 13px; }
.login-card label { display: block; margin: 14px 0 6px; color: var(--text2); font-size: 13px; }
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none; transition: border .2s;
}
.login-card input:focus { border-color: var(--brand); }
.btn-primary {
  width: 100%; padding: 12px; background: var(--brand); color: #fff; border: none;
  border-radius: 8px; font-size: 15px; font-weight: 600; margin-top: 22px;
}
.btn-primary:hover { background: var(--brand-dark); }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--text2); background: var(--brand-light); border-radius: 8px; padding: 10px 12px; line-height: 1.7; }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: #2f4a1d; color: #eaf3e4; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
  padding: 20px 18px; font-size: 18px; font-weight: 700; letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar .logo small { display: block; font-size: 11px; font-weight: 400; opacity: .7; margin-top: 3px; }
.menu-btn { display: none; }
.sb-drop { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar nav a {
  display: block; padding: 11px 20px; color: #cfe0bf; font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--accent); font-weight: 600; }
.sidebar .userbox { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; }
.sidebar .userbox b { display: block; font-size: 13px; margin-bottom: 2px; }
.sidebar .userbox a { color: #cfe0bf; cursor: pointer; }
.sidebar .userbox a:hover { color: #fff; }

.main { flex: 1; padding: 22px 26px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { color: var(--text2); font-size: 13px; margin-top: 3px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; border-left: 4px solid var(--brand); }
.stat-card .label { color: var(--text2); font-size: 12px; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat-card.warn { border-left-color: var(--warn); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.gold { border-left-color: var(--accent); }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { background: var(--brand-light); color: var(--brand-dark); font-size: 12.5px; padding: 9px 10px; text-align: left; font-weight: 600; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.tbl tr:hover td { background: #fafbf8; }
.tbl .num { text-align: right; }
.tbl-wrap { overflow-x: auto; }

/* ---------- 表单/按钮 ---------- */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: #fff; font-size: 13px; color: var(--text); }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.green { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.green:hover { background: var(--brand-dark); color: #fff; }
.btn.red { background: #fff; color: var(--danger); border-color: #e8c4bd; }
.btn.red:hover { background: #fdf0ee; }
.btn.ghost { background: transparent; }
input.in, select.in, textarea.in {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px;
  outline: none; background: #fff; width: 100%;
}
input.in:focus, select.in:focus { border-color: var(--brand); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.form-row label { font-size: 13px; color: var(--text2); min-width: 70px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; background: #eef2ea; color: var(--text2); }
.tag.green { background: #e4f2dc; color: #2e7d32; }
.tag.red { background: #fdecea; color: var(--danger); }
.tag.gold { background: #fdf3d7; color: #a97b00; }
.tag.blue { background: #e3effa; color: #1f6fb2; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20,30,15,.45); display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 94vw; max-height: 88vh; overflow-y: auto; padding: 22px; }
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal .close { float: right; cursor: pointer; color: var(--text2); font-size: 20px; line-height: 1; }
.modal-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 二维码 ---------- */
.qr-box { text-align: center; padding: 12px; }
.qr-box img { width: 250px; height: 250px; border-radius: 8px; border: 1px solid var(--line); }
.qr-table-no { font-size: 18px; font-weight: 700; margin: 10px 0 2px; }
.qr-url { font-size: 11px; color: var(--text2); word-break: break-all; margin-top: 6px; }

/* ---------- 图表 ---------- */
.chart { width: 100%; height: 320px; }

/* ---------- 提示条 ---------- */
.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 1200; background: #2b3323; color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--text2); padding: 30px 0; font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  /* 手机/平板：侧栏变顶部条，logo + 汉堡按钮 */
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 90;
    flex-direction: row; align-items: center; padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
  }
  .sidebar .logo { border-bottom: none; padding: 10px 14px; font-size: 16px; flex: 1; min-width: 0; }
  .sidebar .logo small { display: none; }
  .sidebar .logo img { width: 26px; height: 26px; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; margin-right: 6px;
    background: transparent; border: none; color: #fff; font-size: 24px; cursor: pointer;
  }
  .menu-btn:active { background: rgba(255,255,255,.15); border-radius: 8px; }
  /* 下拉面板（默认收起） */
  .sb-drop {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #2f4a1d; max-height: calc(100vh - 50px); overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
  }
  .sidebar.open .sb-drop { display: block; }
  .sb-drop nav { flex: none; padding: 6px 0; overflow-y: visible; }
  .sb-drop nav a { padding: 14px 18px; font-size: 15px; border-left: none; border-bottom: 1px solid rgba(255,255,255,.07); }
  .sb-drop nav a.active { border-bottom-color: transparent; background: rgba(255,255,255,.12); }
  .sb-drop .userbox { padding: 14px 18px; }
  .sb-drop .userbox .tag { font-size: 11px; }
  .main { padding: 14px; }
}

/* ---------- 收银台（代客下单） ---------- */
.cashier-wrap { display: flex; gap: 14px; align-items: flex-start; }
.cashier-left { flex: 1.1; min-width: 0; }
.cashier-mid { flex: 1.6; min-width: 0; }
.cashier-right { flex: 1.25; min-width: 0; }
.cs-table-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-table { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; width: calc(33.333% - 8px); box-sizing: border-box; background: #fff; }
.cs-table:hover { border-color: var(--accent); }
.cs-table.sel { border-color: var(--brand); background: rgba(74,124,47,.08); }
.cs-table-no { font-weight: 700; font-size: 15px; }
.cs-table-info { font-size: 11px; color: var(--text2); }
.cs-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cs-dish-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.cs-dish { border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: calc(33.333% - 10px); box-sizing: border-box; cursor: pointer; position: relative; background: #fff; }
.cs-dish:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.cs-dish-name { font-size: 13.5px; margin-bottom: 4px; }
.cs-dish-price { color: var(--danger); font-weight: 700; }
.cs-dish-add { position: absolute; right: 8px; top: 8px; background: var(--brand); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.cs-cart { max-height: 260px; overflow-y: auto; margin-bottom: 10px; }
.cs-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cs-cart-ops .form-row { margin-bottom: 8px; }
.cs-mem { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 4px 0; cursor: pointer; font-size: 13px; background: #fff; }
.cs-mem:hover { border-color: var(--brand); }
.cs-mem-empty { color: var(--text2); font-size: 12px; padding: 4px 0; }
.cs-total-row { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 6px; }
.cs-total-label { font-size: 13px; color: var(--text2); }
.cs-total-num { font-size: 26px; font-weight: 800; color: var(--danger); }
@media (max-width: 1000px) { .cashier-wrap { flex-direction: column; } .cashier-left, .cashier-mid, .cashier-right { width: 100%; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs .tab { padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 13px; color: var(--text2); }
.tabs .tab.active { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }

/* ---------- 收银台放大版（v1.1） ---------- */
.cashier-left { flex: 1.25; }
.cashier-mid { flex: 1.8; }
.cashier-right { flex: 1.35; }
.cashier-wrap .card { padding: 20px; }
.cs-table { padding: 14px 16px; border-radius: 12px; width: calc(50% - 8px); }
.cs-table-no { font-size: 18px; }
.cs-table-info { font-size: 13px; }
.cs-dish { padding: 16px; border-radius: 14px; width: calc(50% - 10px); }
.cs-dish-name { font-size: 16px; }
.cs-dish-price { font-size: 16px; }
.cs-dish-add { width: 27px; height: 27px; font-size: 18px; }
.cs-item { padding: 10px 0; }
.cs-item b { font-size: 14px; }
.cs-cart { max-height: 310px; }
.cs-cart-ops .form-row { margin-bottom: 10px; }
.cs-cart-ops .in, .cs-cart-ops select { font-size: 14px; padding: 6px 8px; }
.cs-mem { font-size: 14px; padding: 10px 12px; }
.cs-total-label { font-size: 15px; }
.cs-total-num { font-size: 32px; }
#cs-submit { font-size: 16px; padding: 13px; }
.cs-empty { width: 100%; border: 1px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; box-sizing: border-box; }

/* ---------- 开关(switch)样式 ---------- */
.switch { position: relative; display: inline-block; width: 52px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; cursor: pointer; inset: 0; background: #d5d9d2; border-radius: 28px; transition: .2s; }
.switch span:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand, #4a7c2f); }
.switch input:checked + span:before { transform: translateX(24px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

/* ================= 安卓手机端适配（≤520px） ================= */
@media (max-width: 520px) {
  body { font-size: 14px; }
  .main { padding: 10px; }
  .card { padding: 12px; border-radius: 10px; }
  .card-title { font-size: 15px; margin-bottom: 10px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h2 { font-size: 17px; }
  .page-head .filters { flex-wrap: wrap; gap: 6px; }
  .sidebar .logo { padding: 10px 12px; font-size: 15px; }
  .sidebar nav a { padding: 13px 12px; font-size: 13.5px; }
  .sidebar .userbox { font-size: 12px; }

  /* 输入与按钮：44px 触控目标 */
  .in { min-height: 44px; font-size: 15px; }
  .btn { min-height: 42px; padding: 9px 16px; font-size: 15px; }
  .btn.sm { min-height: 34px; padding: 5px 10px; font-size: 13px; }
  .btn-primary { min-height: 44px; font-size: 16px; }
  select.in, select { min-height: 42px; font-size: 14px; }
  .form-row label { font-size: 13.5px; }

  /* 弹窗全宽化 */
  .modal { width: 96%; max-width: 96%; padding: 14px; max-height: 90vh; overflow-y: auto; }
  .modal h3 { font-size: 15px; margin-bottom: 12px; }
  .modal .form-row { flex-wrap: wrap; }
  .modal .form-row > * { flex: 1 1 100%; }

  /* 表格：小字号 + 横滑 */
  .tbl th, .tbl td { padding: 7px 6px; font-size: 12.5px; white-space: nowrap; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; }

  /* 收银台：菜品/桌台两列大按钮 */
  .cs-table { width: calc(50% - 8px); padding: 10px; }
  .cs-dish { width: calc(50% - 10px); padding: 12px; }
  .cs-dish-name { font-size: 14px; }
  .cs-dish-price { font-size: 14px; }
  .cs-cats .cs-cat { min-height: 36px; padding: 7px 12px; font-size: 13.5px; }
  .cs-total-num { font-size: 28px; }
  #cs-submit { font-size: 17px; padding: 14px; min-height: 50px; }

  /* 统计卡 */
  .stat-card .value { font-size: 21px; }
  .stat-card .label { font-size: 12px; }

  /* 桌台网格 */
  .table-grid .t-cell { min-height: 56px; font-size: 14px; }
  .t-cell { width: calc(33.333% - 8px) !important; }

  /* 报表筛选与图表容器 */
  .filters select, .filters .in { min-height: 40px; }
  .chart-box { height: 240px !important; }

  /* 打印卡片 */
  .print-card { padding: 12px; }
  .form-row { flex-wrap: wrap; }

  /* 登录页 */
  .login-card { width: 92%; padding: 26px 20px; }
  .login-logo { font-size: 20px; }
}
