/* 宽度基准：1366 屏 → 侧栏 168 + 内容区 ~1150；大屏封顶 1200 居中，不铺满 */
  :root{
    --ink:#2b2419; --ink2:#6b6257; --ink3:#a1957f;
    --line:#e8e0d1; --line2:#f2ece0; --bg:#f6f3ea; --card:#fffdf8;
    --brand:#9a7b4f; --brand2:#7a5c24; --brand-l:#f3e9d6;
    --danger:#b4342a; --ok:#4a7c3f;
    --side:168px; --head:54px;
  }
  *{box-sizing:border-box}
  html,body{height:100%}
  body{
    margin:0; background:var(--bg); color:var(--ink);
    font:13.5px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  }
  ::-webkit-scrollbar{width:10px;height:10px}
  ::-webkit-scrollbar-thumb{background:#ded4c2;border-radius:5px;border:2px solid var(--bg)}
  ::-webkit-scrollbar-track{background:transparent}

  /* ---------------- 顶栏 ---------------- */
  .head{
    position:relative; z-index:20; height:var(--head); padding:0 20px;
    display:flex; align-items:center; gap:14px;
    background:var(--card); border-bottom:1px solid var(--line);
  }
  .brand{font-size:14px; font-weight:650; letter-spacing:.6px}
  /* 团队切换：横排标签，仅切换查看，不改小程序当前团队 */
  .teamtabs{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
  .teamtab{
    height:38px; padding:0 16px; line-height:38px; border-radius:9px; cursor:pointer;
    border:1px solid var(--line); background:#fff; color:var(--ink2); font-size:14px;
    max-width:220px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;
  }
  .teamtab:hover{border-color:var(--brand); color:var(--brand2)}
  .teamtab.on{background:var(--brand-l); border-color:var(--brand); color:var(--brand2); font-weight:700}

  .grow{flex:1 1 auto}
  .who{font-size:12.5px; color:var(--ink3)}
  .who b{color:var(--ink2); font-weight:600}
  .link{font-size:12.5px; color:var(--ink3); cursor:pointer}
  .link:hover{color:var(--brand)}

  /* ---------------- 侧栏 ---------------- */
  .wrap{display:flex; height:calc(100% - var(--head))}
  .side{
    width:var(--side); flex:0 0 var(--side); padding:12px 10px;
    border-right:1px solid var(--line); background:var(--card);
    display:flex; flex-direction:column; gap:2px;
  }
  .nav{
    display:flex; align-items:center; gap:10px; height:46px; padding:0 14px;
    border-radius:9px; color:var(--ink2); cursor:pointer; font-size:15px; user-select:none;
  }
  .nav:hover{background:#f7f2e7}
  .nav.on{background:var(--brand-l); color:var(--brand2); font-weight:600}
  .nav i{width:7px;height:7px;border-radius:2px;background:currentColor;opacity:.35;flex:0 0 auto}
  .nav.on i{opacity:.9; transform:rotate(45deg)}

  /* ---------------- 主区 ---------------- */
  .main{flex:1 1 0; min-width:0; overflow:auto}
  .inner{max-width:1200px; margin:0 auto; padding:18px 20px 40px}
  .page-h{display:flex; align-items:center; gap:12px; margin:2px 0 14px}
  .page-h h1{font-size:19px; margin:0; font-weight:650}
  .page-h .sub{font-size:12.5px; color:var(--ink3)}

  .card{background:var(--card); border:1px solid var(--line); border-radius:11px; overflow:hidden}
  .card + .card{margin-top:14px}
  .card-h{
    display:flex; align-items:center; gap:10px; padding:10px 14px;
    border-bottom:1px solid var(--line2); font-size:13px; font-weight:600;
  }

  select,.ipt{
    height:42px; padding:0 14px; border:1px solid var(--line); border-radius:9px;
    background:#fff; color:var(--ink); font-size:14.5px; outline:none;
  }
  select:focus,.ipt:focus{border-color:var(--brand)}
  .btn{
    height:42px; padding:0 20px; border-radius:9px; border:1px solid var(--line);
    background:#fff; color:var(--ink2); font-size:14.5px; cursor:pointer; white-space:nowrap;
  }
  .btn:hover{color:var(--brand); border-color:var(--brand)}
  .btn.danger{color:var(--danger); border-color:#f0c9c4}
  .btn.danger:hover{color:#fff; background:var(--danger); border-color:var(--danger)}
  .btn.primary{background:var(--brand); border-color:var(--brand); color:#fff; font-weight:600}
  .btn.primary:hover{background:var(--brand2); border-color:var(--brand2); color:#fff}
  .btn:disabled{opacity:.45; cursor:not-allowed}
  /* 选中过去日期时「新建预订」置灰（仍可点，点了给提示） */
  .btn.primary.off{background:#ded4c2; border-color:#ded4c2; cursor:not-allowed}

  /* ---------------- 表格 ---------------- */
  table{width:100%; border-collapse:collapse}
  th,td{padding:14px 16px; text-align:left; font-size:14px; border-bottom:1px solid var(--line2)}
  th{color:var(--ink3); font-weight:500; font-size:13px; background:#fdfbf5; position:sticky; top:0; z-index:1}
  tbody tr{cursor:pointer}
  tbody tr:hover{background:#fbf7ee}
  tr:last-child td{border-bottom:0}
  .muted{color:var(--ink3)}
  .tag{
    display:inline-block; padding:0 8px; border-radius:9px; font-size:11.5px; line-height:18px;
    background:var(--brand-l); color:var(--brand2); white-space:nowrap;
  }
  .tag.cancel{background:#fbeceb; color:var(--danger)}

  /* ---------------- 日历 ---------------- */
  .cal-wrap{display:flex; gap:16px; align-items:flex-start}
  .cal{flex:1 1 0; min-width:0}
  .cal-top{display:flex; align-items:center; gap:12px; padding:14px 16px; border-bottom:1px solid var(--line2); flex-wrap:wrap}
  .cal-m{font-size:14px; font-weight:650; min-width:92px}
  .cal-grid{display:grid; grid-template-columns:repeat(7,1fr); gap:1px; background:var(--line2)}
  .cal-w{padding:9px 0; text-align:center; font-size:13.5px; font-weight:600; color:#8c7f6a; background:#fdfbf5; letter-spacing:1px}
  .cal-d{
    min-height:96px; padding:6px 7px; background:#fff; cursor:pointer;
    display:flex; flex-direction:column; gap:4px; position:relative; border:1px solid transparent;
  }
  .cal-d:hover{background:#fdf9f0}
  .cal-d.out{background:#fbf9f4; color:#c9bfae}
  /* 过去的日子：整体压暗，只能查看不能新建 */
  .cal-d.past{background:#faf8f2}
  /* 过去的日子仍然要读得清，只是弱一档 */
  .cal-d.past .dnum{color:#b6a992; font-weight:600}
  .cal-d.past .chip{opacity:.55}
  .cal-d.today .dnum{color:var(--brand2); font-weight:800}
  .cal-d.sel{border-color:var(--brand); background:#fffaf0; z-index:1}
  .dnum{font-size:18px; font-weight:700; color:#4a4136; line-height:1.15; letter-spacing:.5px}
  .dlist{display:flex; flex-direction:column; gap:2px; overflow:hidden}
  .chip{
    font-size:12.5px; line-height:19px; padding:0 7px; border-radius:5px;
    background:#f4ead7; color:#7d6231; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;
  }
  .chip.cancel{background:#f7e7e5; color:#a5524a; text-decoration:line-through}

  /* 右侧当日面板 */
  /* 当日面板：高度撑到视口内可用空间，内容多就在面板里滚，别把整页顶出滚动条 */
  .day{
    flex:0 0 344px; width:344px; align-self:flex-start;
    display:flex; flex-direction:column;
    height:calc(100vh - 190px);
  }
  .day-h{padding:11px 14px; border-bottom:1px solid var(--line2); display:flex; align-items:baseline; gap:8px}
  .day-h b{font-size:13.5px}
  .day-h span{font-size:12px; color:var(--ink3)}
  .day-b{flex:1 1 auto; min-height:0; overflow:auto; padding:10px 12px 14px}

  /* 餐段分组：一条米色带当小标题，下面是一摞订单卡片 */
  .day-g + .day-g{margin-top:18px}
  /* 分组标题：文字 + 细分割线（不再用底色带，避免跟卡片抢视觉） */
  .day-g-h{display:flex; align-items:center; gap:10px; padding:0; margin:0 0 2px}
  .g-name{font-size:13px; font-weight:700; color:#5c4522; letter-spacing:1.2px; white-space:nowrap}
  .g-line{
    flex:1 1 auto; height:1px; min-width:16px;
    background:linear-gradient(90deg, rgba(154,123,79,.45), rgba(154,123,79,.12));
  }
  .g-n{
    font-size:12px; font-weight:600; color:#8a6a33; white-space:nowrap;
    font-variant-numeric:tabular-nums; letter-spacing:.3px;
  }

  /* 一单一张卡：白底 + 描边，鼠标移上去描边加深、微微投影 */
  .ord{
    margin-top:8px; padding:10px 12px;
    background:#fff; border:1px solid var(--line); border-radius:10px;
    cursor:pointer; transition:border-color .14s, box-shadow .14s;
  }
  .ord:hover{border-color:#d9c7a0; box-shadow:0 2px 10px rgba(90,70,35,.08)}
  .ord-t{display:flex; align-items:center; gap:8px}
  .ord-n{font-size:14px; font-weight:700; color:var(--ink)}
  .ord-time{margin-left:auto; font-size:12.5px; color:var(--ink2); font-variant-numeric:tabular-nums}
  /* 信息徽章：统一米金底，不加第二种色 */
  .ord-b{display:flex; flex-wrap:wrap; gap:6px; margin-top:8px}
  .bd{
    display:inline-block; padding:0 10px; height:26px; line-height:26px;
    border-radius:6px; background:#f5eddd; color:#7d6231;
    font-size:13px; letter-spacing:.2px; white-space:nowrap;
    max-width:100%; overflow:hidden; text-overflow:ellipsis;
  }

  /* ---------------- 网格模式（单日餐位墙） ---------------- */
  .seg{display:flex; border:1px solid var(--line); border-radius:7px; overflow:hidden}
  .seg-i{padding:0 18px; height:40px; line-height:40px; font-size:14.5px; color:var(--ink2); cursor:pointer; background:#fff; white-space:nowrap}
  .seg-i + .seg-i{border-left:1px solid var(--line)}
  .seg-i.on{background:var(--brand-l); color:var(--brand2); font-weight:600}
  /* 选中项前面加对号：不用靠颜色分辨；未选中留同宽空位，避免切换时按钮跳动 */
  .seg-i::before{content:''; display:inline-block; width:15px; margin-right:3px; font-weight:700}
  .seg-i.on::before{content:'✓'; color:var(--brand2)}

  .gb{display:flex; gap:14px; align-items:flex-start; padding:14px; box-sizing:border-box}
  .gb-main{flex:1 1 0; min-width:0}
  .wall{display:grid; grid-template-columns:repeat(auto-fill, minmax(152px, 1fr)); gap:12px; user-select:none; -webkit-user-select:none}

  .sw{
    position:relative; box-sizing:border-box; padding:11px 14px 12px; border-radius:10px; cursor:pointer;
    user-select:none; -webkit-user-select:none; -ms-user-select:none;
    border:1px solid var(--line); background:#fff; min-height:92px;
    display:flex; flex-direction:column; justify-content:center;
    transition:border-color .12s, background .12s, box-shadow .12s, transform .12s;
  }
  .sw:hover{border-color:#d9c9a8}
  /* 餐位名是这格的主信息，必须最显眼 */
  .sw .top{display:flex; align-items:center; justify-content:space-between; gap:8px}
  .sw .n{font-size:16.5px; font-weight:700; color:var(--ink); letter-spacing:.5px; line-height:1.2; overflow:hidden; white-space:nowrap; text-overflow:ellipsis}
  /* 人数：小徽章贴右侧，和餐位名同一行 */
  .sw .p{flex:0 0 auto; font-size:12.5px; line-height:20px; padding:0 8px; border-radius:5px; background:#f1e7d3; color:#8a6a33}
  /* 客户名：格子里的主角，压在实际内容上 */
  .sw .v{margin-top:7px; font-size:16.5px; font-weight:700; color:#5c4522;
    overflow:hidden; white-space:nowrap; text-overflow:ellipsis; line-height:1.25}
  /* 兼容：老结构里的 .m 已由 .by 取代 */
  /* 右下角小标注：图标 + 名字，弱到不影响阅读流 */
  .sw .by{
    position:absolute; right:11px; bottom:9px; max-width:58%;
    display:flex; align-items:center; gap:4px;
    font-size:11px; color:#c3b9a6; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .sw .by svg{width:11px; height:11px; flex:0 0 auto; fill:none; stroke:currentColor; stroke-width:1.1; stroke-linecap:round}
  /* 可订 = 白块；已订 = 米金块；已取消 = 红字 */
  .sw.free{background:#fff}
  .sw.free .v{color:#a89b85; font-weight:500}
  /* 可订：绿色标签撑起主位 */
  .sw.free .gs{font-size:13.5px; line-height:26px; padding:0 12px; margin-top:6px; align-self:flex-start}
  /* 状态标签：可订绿 / 已订金 / 已取消红 */
  .gs{display:inline-block; font-size:13px; padding:0 10px; border-radius:6px; line-height:24px; white-space:nowrap}
  .gs.free{background:#e9f0e2; color:#557a45}
  .gs.taken{background:var(--brand-l); color:var(--brand2)}
  .gs.cancel{background:#fbeceb; color:var(--danger)}
  .sw.taken{background:#fdf5e6; border-color:#eddfc4}
  .sw.cancel{background:#fbf3f2; border-color:#f2d9d6}
  .sw.cancel .v{color:var(--danger); font-weight:500}
  /* 选中：还是原来那种「边框高亮」，只是颜色更深、边框更粗 */
  .sw.sel{
    border-color:#6f5320;
    box-shadow:inset 0 0 0 2px #6f5320;
  }
  /* 拖拽换位 */
  .sw.taken{cursor:grab}
  .sw.taken:active{cursor:grabbing}
  .sw.dragging{opacity:.4}
  .sw.drop-ok{border-color:var(--brand); background:#fffaf0; box-shadow:0 0 0 2px rgba(154,123,79,.16)}
  .sw.drop-bad{border-color:#e0a5a0; background:#fff6f5}

  .gside{flex:0 0 320px; width:320px}
  .gside-h{
    padding:12px 15px; border-bottom:1px solid var(--line2);
    background:#f6efdf; border-left:3px solid var(--brand);
    display:flex; align-items:baseline; gap:8px;
  }
  .gside-h b{font-size:16.5px; font-weight:700; color:#5c4522; letter-spacing:.4px}
  .gside-h .when{font-size:12px; color:#8a6a33}
  .gside-b{padding:2px 15px 10px}
  .gside-f{padding:11px 15px; border-top:1px solid var(--line2); display:flex; gap:8px; justify-content:flex-end}

  /* 屏幕不高时把日历格压矮一点，避免小屏一进来就出滚动条 */
  @media (max-height:760px){
    .cal-d{min-height:58px}
    .cal-d .chip{display:none}
  }

  @media (max-width:1280px){
    .gside{flex:0 0 280px; width:280px}
    .wall{grid-template-columns:repeat(auto-fill, minmax(118px, 1fr))}
  }
  /* ---------------- 菜单 ---------------- */
  /* ---------------- 抽屉 ---------------- */
  .mask{
    position:fixed; inset:0; background:rgba(30,24,16,.32); opacity:0; pointer-events:none;
    transition:opacity .16s; z-index:60;
  }
  .mask.on{opacity:1; pointer-events:auto}
  .drawer{
    position:fixed; top:0; right:0; bottom:0; width:460px; max-width:94vw;
    background:var(--card); border-left:1px solid var(--line); z-index:61;
    transform:translateX(100%); transition:transform .2s ease; display:flex; flex-direction:column;
    box-shadow:-12px 0 40px rgba(40,28,12,.1);
  }
  .drawer.on{transform:none}
  .dr-h{padding:14px 18px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:10px}
  .dr-h b{font-size:14px}
  .dr-b{flex:1 1 0; overflow:auto; padding:6px 18px 18px}
  .kv{display:flex; align-items:baseline; padding:11px 0; border-bottom:1px solid var(--line2); font-size:13px}
  .kv .k{width:64px; flex:0 0 64px; color:var(--ink3); font-size:12px}
  .kv .v{flex:1 1 0; min-width:0; word-break:break-all; font-size:15px; font-weight:600; color:var(--ink)}
  .kv:last-child{border-bottom:0}
  .dr-f{padding:12px 18px; border-top:1px solid var(--line); display:flex; gap:8px; justify-content:flex-end}

  /* ---------------- 小弹层 ---------------- */
  .modal{
    position:fixed; left:50%; top:50%; transform:translate(-50%,-50%) scale(.98);
    width:340px; background:var(--card); border:1px solid var(--line); border-radius:12px;
    box-shadow:0 20px 60px rgba(40,28,12,.18); z-index:70; opacity:0; pointer-events:none;
    transition:opacity .15s, transform .15s;
  }
  .modal.on{opacity:1; pointer-events:auto; transform:translate(-50%,-50%) scale(1)}
  .md-h{padding:14px 16px 6px; font-size:14px; font-weight:650}
  .md-b{padding:6px 16px 14px}
  .cm-t{font-size:15px; color:var(--ink); line-height:1.7; word-break:break-all}
  /* 换位这类带对比的提示，用块状排版代替一整句 */
  .cm-name{font-size:17px; font-weight:700; color:var(--ink); margin-bottom:12px}
  .cm-move{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
  .cm-s{
    padding:5px 14px; border-radius:8px; background:#f5eddd; color:#7a5c24;
    font-size:15.5px; font-weight:600;
  }
  .cm-to{background:var(--brand-l); color:var(--brand2); border:1px solid #d9c39a}
  .cm-ar{color:#b3a68e; font-size:17px; line-height:1}
  /* 预订确认单：客户名当主信息，下面逐行 */
  .ok-name{font-size:19px; font-weight:700; color:var(--ink); margin:2px 0 8px}
  .md-b .ipt{width:100%}
  .md-f{padding:10px 16px; border-top:1px solid var(--line); display:flex; gap:8px; justify-content:flex-end}


  /* ---------------- 表单（建单 / 改单共用） ---------------- */
  .fm{padding:2px 18px 18px}
  .fm-row{display:flex; gap:10px}
  .fm-row > *{flex:1 1 0; min-width:0}
  .fm-f{margin-top:12px}
  .fm-l{font-size:11.5px; color:var(--ink3); margin-bottom:5px}
  .fm-l .req{color:#c2703a; margin-left:2px}
  .fm-i{
    width:100%; height:34px; padding:0 10px; box-sizing:border-box;
    border:1px solid var(--line); border-radius:7px; background:#fff;
    font-size:13px; color:var(--ink); outline:none;
  }
  .fm-i:focus{border-color:var(--brand)}
  .fm-i::placeholder{color:#c9bfae}
  select.fm-i{cursor:pointer}
  /* 餐位选择：格子，已订的压灰划掉 */
  /* 一行 4 个，等宽；不做 flex 自动折行，避免宽度不同就变 5 个 / 4 个 */
  .fm-seats{display:grid; grid-template-columns:repeat(4,1fr); gap:9px; margin-top:2px}
  .fm-seat{
    min-width:0; height:40px; padding:0 6px; line-height:38px; text-align:center;
    border:1px solid var(--line); border-radius:8px; background:#fff;
    font-size:14px; color:var(--ink2); cursor:pointer; box-sizing:border-box;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .fm-seat:hover{border-color:var(--brand)}
  .fm-seat.on{background:#fdf3e0; border-color:var(--brand); color:var(--brand2); font-weight:600}
  .fm-seat.off{
    background:#f5f1e9; color:#c7bcaa; border-color:#eee7da;
    text-decoration:line-through; cursor:not-allowed;
  }
  .fm-tip{font-size:11.5px; color:var(--ink3); margin-top:6px}
  .fm-lock{height:34px; line-height:34px; padding:0 10px; border-radius:7px; background:#f6f2e9; border:1px solid var(--line); font-size:13px; color:var(--ink2)}
  .fm-err{color:var(--danger); font-size:12px; margin-top:10px; min-height:16px}

  /* 右面板换日期时的轻淡入：比整页重绘自然得多 */
  @keyframes dayFlash {
    from { opacity: .35; transform: translateY(2px); }
    to { opacity: 1; transform: none; }
  }
  .day.flash .day-b { animation: dayFlash .18s ease-out; }

  .empty{padding:44px 20px; text-align:center; color:var(--ink3); font-size:12.5px}
  .toast{
    position:fixed; left:50%; bottom:34px; transform:translateX(-50%);
    background:rgba(30,24,16,.92); color:#fff; padding:8px 16px; border-radius:8px;
    font-size:12.5px; opacity:0; pointer-events:none; transition:opacity .16s; z-index:90;
  }
  .toast.on{opacity:1}
  .toast.err{background:rgba(180,52,42,.95)}


  /* ---------------- 登录覆盖层 ---------------- */
  #login{
    position:fixed; inset:0; z-index:150; display:flex; align-items:center; justify-content:center;
    background:var(--bg);
  }
  #login.off{display:none}
  .lg-card{
    width:400px; padding:30px 32px 26px; background:var(--card);
    border:1px solid var(--line); border-radius:16px; box-shadow:0 14px 44px rgba(60,45,25,.1);
    text-align:center;
  }
  .lg-card h1{font-size:18px; margin:0 0 3px; letter-spacing:.5px}
  .lg-card .sub{font-size:12.5px; color:var(--ink3); margin-bottom:20px}
  .lg-qr{
    width:208px; height:208px; margin:0 auto; padding:9px; background:#fff;
    border:1px solid var(--line); border-radius:12px;
    display:flex; align-items:center; justify-content:center;
  }
  .lg-qr img{width:100%; height:100%; display:block; border-radius:6px}
  .lg-qr .ph{color:var(--ink3); font-size:12px; line-height:1.7}
  .lg-pair{margin-top:16px; font-size:12.5px; color:var(--ink2)}
  .lg-pair b{font-size:19px; letter-spacing:4px; color:var(--brand); margin-left:6px}
  .lg-status{margin-top:12px; font-size:12.5px; min-height:19px; color:var(--ink3)}
  .lg-status.err{color:var(--danger)}
  .lg-again{
    margin-top:14px; height:32px; padding:0 16px; border-radius:8px; cursor:pointer;
    border:1px solid var(--line); background:#fff; color:var(--ink2); font-size:12.5px;
  }
  .lg-again:hover{color:var(--brand); border-color:var(--brand)}
  .lg-again[disabled]{opacity:.5; cursor:not-allowed}

  @media (max-width:1280px){
    .day{flex:0 0 300px; width:300px}
    .cal-d{min-height:76px}
  }
