/* ==========================================================================
   欢乐浔®DIY手工坊 —— 拼豆店管理系统 样式
   移动端优先，全部自适应
   ========================================================================== */

:root {
  --teal: #0aa5a5;
  --teal-dark: #078a8a;
  --teal-soft: #e6f7f7;
  --orange: #f08a24;
  --orange-dark: #d9741a;
  --orange-soft: #fff3e4;

  --free: #16a34a;
  --free-soft: #e7f8ed;
  --reserved: #2563eb;
  --reserved-soft: #e8f0fe;
  --inuse: #f08a24;
  --inuse-soft: #fff3e4;
  --over: #e11d48;
  --over-soft: #ffe9ee;

  --enough: #16a34a;
  --low: #f08a24;
  --out: #e11d48;

  --text: #1f2937;
  --text-soft: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --bg: #f5f6f8;
  --card: #ffffff;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 30px rgba(16, 24, 40, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--teal-dark); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.3; }
p { margin: 0 0 .6em; }
img { max-width: 100%; }

/* ---------------------------------------------------------------- 公共组件 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-title h3 { margin: 0; font-size: 16px; }
.card-title .hint { color: var(--text-soft); font-size: 12.5px; }

.muted { color: var(--text-soft); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.w100 { width: 100%; }

.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > * { flex: 1 1 220px; min-width: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.7;
  border: 1px solid transparent;
}
.badge-free     { color: var(--free);     background: var(--free-soft);     border-color: #bfe8cd; }
.badge-reserved { color: var(--reserved); background: var(--reserved-soft); border-color: #c3d8fb; }
.badge-inuse    { color: var(--inuse);    background: var(--inuse-soft);    border-color: #fbd8ae; }
.badge-over     { color: var(--over);     background: var(--over-soft);     border-color: #fbc3cf; }
.badge-enough   { color: var(--enough);   background: var(--free-soft);     border-color: #bfe8cd; }
.badge-low      { color: var(--low);      background: var(--inuse-soft);    border-color: #fbd8ae; }
.badge-out      { color: var(--out);      background: var(--over-soft);     border-color: #fbc3cf; }
.badge-gray     { color: var(--text-soft);background: #f3f4f6;              border-color: var(--line); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { background: #f9fafb; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-dark); }
.btn-danger { background: var(--over); border-color: var(--over); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal-dark); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 38px; height: 38px; padding: 0; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}

/* 表单 */
label.field { display: block; margin-bottom: 12px; }
label.field > span.lbl {
  display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: #374151;
}
input[type=text], input[type=password], input[type=number], input[type=time],
input[type=search], select, textarea {
  width: 100%; padding: 10px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; color: var(--text); background: #fff;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10, 165, 165, .14);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field-help { font-size: 12.5px; color: var(--text-soft); margin-top: 4px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
/* 带按钮的一行：控件与按钮放进同一个 flex 行，用 align-items:center 居中，
   结构上保证两者中线对齐（比"靠隐藏标签撑高度"更稳，不受字体/行高影响） */
.control-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.control-row > input, .control-row > select, .control-row > textarea { flex: 1 1 130px; width: auto; }
.control-row > .qty-input { flex: 0 0 auto; }
/* 按钮保持自身高度，既不拉伸也不压缩（否则会比输入框高/矮） */
.control-row > .btn {
  flex: 0 0 auto; width: auto;
  align-self: center;
  height: 42px;            /* 与同排输入框实测高度一致（42px） */
  padding-top: 0; padding-bottom: 0;
  margin-top: 13px;        /* 配合 align-self:center，实际下移约 6.5px，使中线与输入框对齐 */
}
.control-row.v-center { min-height: 42px; }
.inline-form > * { flex: 1 1 160px; }
.inline-form .btn { flex: 0 0 auto; }
/* 表单里与输入框同一行的纯文字说明：与输入框底部对齐 */
.inline-form > .inline-note { align-self: flex-end; padding-bottom: 11px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--teal); }

/* 提示条 */
.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: var(--radius-sm); margin-bottom: 12px;
  font-size: 14px; border: 1px solid transparent;
}
.alert-icon {
  flex: 0 0 19px; width: 19px; height: 19px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; margin-top: 1px;
}
.alert-success { background: var(--free-soft); border-color: #bfe8cd; color: #166534; }
.alert-success .alert-icon { background: var(--free); }
.alert-error { background: var(--over-soft); border-color: #fbc3cf; color: #9f1239; }
.alert-error .alert-icon { background: var(--over); }
.alert-warning { background: var(--orange-soft); border-color: #fbd8ae; color: #9a5b12; }
.alert-warning .alert-icon { background: var(--orange); }
.alert-info { background: var(--teal-soft); border-color: #b7e6e6; color: #0f5f5f; }
.alert-info .alert-icon { background: var(--teal); }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.15; }
.stat-label { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.stat-card.free .stat-value { color: var(--free); }
.stat-card.reserved .stat-value { color: var(--reserved); }
.stat-card.inuse .stat-value { color: var(--inuse); }
.stat-card.over .stat-value { color: var(--over); }
.stat-card.enough .stat-value { color: var(--enough); }
.stat-card.low .stat-value { color: var(--low); }
.stat-card.out .stat-value { color: var(--out); }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.data th, table.data td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { background: #fafafa; font-size: 12.5px; color: #4b5563; font-weight: 600; position: sticky; top: 0; }
table.data tbody tr:hover { background: #fafcff; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 空态 */
.empty { text-align: center; padding: 30px 12px; color: var(--text-soft); }
.empty .big { font-size: 30px; display: block; margin-bottom: 6px; }

/* ================================================================== 前台看板 */
.public-wrap { max-width: 1040px; margin: 0 auto; padding: 16px 14px 40px; }

.board-title { text-align: center; padding: 10px 0 4px; }
.board-title h1 {
  font-size: 25px; color: var(--orange); font-weight: 800;
  letter-spacing: 1px; margin: 0;
}
.board-title h2 {
  font-size: 19px; color: var(--orange); font-weight: 600;
  letter-spacing: 5px; margin: 6px 0 0; padding-left: 5px;
}
.board-meta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px 14px; margin: 12px 0 16px; font-size: 13px; color: var(--text-soft);
}
.board-clock { font-variant-numeric: tabular-nums; font-weight: 600; color: #374151; }
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--free); margin-right: 5px; animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; margin-bottom: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #374151; }
.legend i { width: 15px; height: 15px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.08); }
.legend .lg-free { background: var(--free); }
.legend .lg-reserved { background: var(--reserved); }
.legend .lg-inuse { background: var(--inuse); }
.legend .lg-over { background: var(--over); }

.room {
  border: 2px solid #b9bec6; background: #fff; border-radius: 6px;
  display: flex; margin-bottom: 18px; overflow: hidden;
}
.room-label {
  flex: 0 0 76px; background: #f4f4f5; border-right: 1px solid #d6d9de;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #374151; letter-spacing: 1px;
}
.room-body {
  flex: 1 1 auto; min-width: 0; background: #f7f8f9;
  padding: 16px; display: flex; flex-direction: column;
}
/* ============================ 自由画布（所见即所得，前台与编辑器共用坐标）
   高度用「宽度 × 比例」的方式实现（padding 撑高 + 绝对定位铺满），
   不依赖 aspect-ratio，兼容所有浏览器与内嵌外壳。
   画布比例由 --ratio 控制：画布高度 = 宽度 × (--ratio / 100)。 */
.canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 80px;
  height: 0;
  padding-bottom: calc(var(--ratio, 60) * 1%);
}
.canvas {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  background:
    linear-gradient(#eef1f4 1px, transparent 1px) 0 0 / 100% 12.5%,
    linear-gradient(90deg, #eef1f4 1px, transparent 1px) 0 0 / 10% 100%,
    #f7f8f9;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.canvas .seat {
  position: absolute; margin: 0;
  /* 不要在这里写 height/width：会让内联的百分比尺寸失效（保持留空即可） */
  flex: none;                   /* 覆盖默认的弹性布局 */
  min-height: 0; min-width: 0;
}
.canvas .seat-tag { font-size: clamp(11px, 1.15vw, 19px); }
.canvas .seat-mini { font-size: clamp(8px, .75vw, 12px); }

/* 编辑器画布（同样用 padding 撑高，保证任何环境下色块都有高度） */
.ed-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 120px;
  height: 0;
  padding-bottom: calc(var(--ratio, 60) * 1%);
}
.ed-canvas {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  background:
    linear-gradient(#e4e8ec 1px, transparent 1px) 0 0 / 100% 6.25%,
    linear-gradient(90deg, #e4e8ec 1px, transparent 1px) 0 0 / 5% 100%,
    #fbfcfd;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  overflow: hidden; touch-action: none; user-select: none;
}
.ed-seat {
  position: absolute; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  background: #cdeeee; border: 2px solid var(--teal); border-radius: 6px;
  color: #0f6f6f; font-weight: 700; font-size: clamp(11px, 1.1vw, 16px);
  cursor: move; overflow: hidden; text-align: center; padding: 0 2px;
  touch-action: none; z-index: 2;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
}
.ed-debug {
  margin-top: 8px; font-size: 12px; color: var(--text-soft);
  background: #f6f8fa; border: 1px dashed var(--line-strong); border-radius: 8px; padding: 8px 10px;
  white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.ed-seat.dragging { opacity: .85; cursor: grabbing; z-index: 5; }
/* 编辑器里按座位真实状态着色，便于对照前台看板 */
.ed-seat.st-free     { background: var(--free-soft);     border-color: var(--free);     color: #166534; }
.ed-seat.st-reserved { background: var(--reserved-soft); border-color: var(--reserved); color: #1e40af; }
.ed-seat.st-inuse    { background: var(--inuse-soft);    border-color: var(--inuse);    color: #9a5b12; }
.ed-seat.st-over     { background: var(--over-soft);     border-color: var(--over);     color: #9f1239; }
.ed-seat.st-new      { background: #e6f7f7;              border-color: var(--teal);     color: #0f6f6f; border-style: dashed; }
/* 选中样式放在最后，保证优先级高于状态配色 */
.ed-seat.sel { outline: 2px solid #7c3aed; outline-offset: 1px; background: #f0e8ff; border-color: #7c3aed; border-style: solid; color: #5b21b6; z-index: 3; }
.ed-seat .ed-label {
  display: block; width: 100%; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}
.ed-seat .ed-grip {
  position: absolute; right: -1px; bottom: -1px;
  width: 15px; height: 15px; cursor: nwse-resize;
  background: #7c3aed; border-radius: 4px 0 4px 0;
  display: none;
}
.ed-seat .ed-grip::after {
  content: ""; position: absolute; right: 2px; bottom: 2px;
  width: 6px; height: 6px; border-right: 2px solid #fff; border-bottom: 2px solid #fff;
}
.ed-seat.sel .ed-grip { display: block; }
.ed-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 10px; font-size: 12.5px; color: var(--text-soft);
}
.ed-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.ed-status { position: absolute; left: 6px; bottom: 6px; font-size: 11px; color: #6b7280; background: rgba(255,255,255,.75); padding: 1px 5px; border-radius: 4px; }

.seat {
  display: flex; align-items: center; justify-content: center;
  min-height: 42px;
  border: 1px solid #b9bec6; margin: 0;
  color: #fff; font-weight: 700; cursor: pointer;
  transition: filter .15s, transform .1s;
  position: relative; padding: 0 2px;
}
.seat:hover { filter: brightness(1.06); }
.seat:active { transform: scale(.98); }
.seat.st-free { background: var(--free); }
.seat.st-reserved { background: var(--reserved); }
.seat.st-inuse { background: var(--inuse); }
.seat.st-over { background: var(--over); animation: flash 1.1s infinite; }
.seat.st-unknown { background: #9ca3af; }
@keyframes flash { 0%,100% { background: var(--over); } 50% { background: #ff8fa6; } }
.seat .seat-tag {
  font-size: 17px; font-weight: 800; letter-spacing: .5px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .12);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px;
}
.seat .seat-mini {
  position: absolute; right: 3px; bottom: 2px;
  font-size: 10px; font-weight: 600; opacity: .92;
}

.board-foot { text-align: center; font-size: 12.5px; color: var(--text-soft); padding: 6px 0 20px; }

/* 座位弹层 */
.modal {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .5);
  display: none; align-items: center; justify-content: center; padding: 18px; z-index: 60;
}
.modal.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 16px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700;
}
.modal-body { padding: 16px; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #fafafa; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-soft); }
.kv .v { font-weight: 600; text-align: right; }
.countdown { font-size: 26px; font-weight: 800; text-align: center; padding: 10px 0 4px; font-variant-numeric: tabular-nums; }
.countdown.warn { color: var(--orange); }
.countdown.over { color: var(--over); }

/* ============================================================= 后台框架 */
.layout { min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 236px; z-index: 50;
  background: #10232b; color: #cbd8dd;
  display: flex; flex-direction: column; overflow-y: auto;
  transform: translateX(-100%); transition: transform .22s ease;
}
.sidebar.open { transform: translateX(0); }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; }
.sidebar-brand small { color: #8fa6ae; font-size: 12px; }
.brand-dot {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  background: linear-gradient(135deg, var(--teal), var(--orange));
}
.sidebar-nav { padding: 10px 8px; flex: 1 1 auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 3px;
  color: #cbd8dd; font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--teal); color: #fff; font-weight: 600; }
.nav-icon { width: 20px; text-align: center; font-size: 15px; }
.sidebar-foot { padding: 12px 8px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.user-line { display: flex; align-items: center; gap: 10px; padding: 6px 12px 10px; }
.user-line strong { display: block; color: #fff; font-size: 14px; }
.user-line small { color: #8fa6ae; font-size: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: var(--orange); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-mask {
  position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 45; display: none;
}
.sidebar-mask.show { display: block; }

.content { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
}
.topbar-title { font-size: 16px; font-weight: 700; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.content-body { padding: 14px; flex: 1 1 auto; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-head .sub { color: var(--text-soft); font-size: 13px; margin-top: 2px; }

/* 座位管理网格 */
.seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.seat-card {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-sm);
  background: #fff; padding: 10px; cursor: pointer; transition: .15s;
}
.seat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.seat-card.s-free { border-left-color: var(--free); }
.seat-card.s-reserved { border-left-color: var(--reserved); }
.seat-card.s-inuse { border-left-color: var(--inuse); }
.seat-card.s-over { border-left-color: var(--over); background: #fff7f9; }
.seat-card .sc-code { font-size: 19px; font-weight: 800; letter-spacing: .5px; }
.seat-card .sc-state { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; min-height: 18px; }
.seat-card .sc-exp { font-size: 11.5px; color: var(--text-soft); margin-top: 2px; }

.room-section { margin-bottom: 18px; }
.room-section > .rs-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 9px; padding-left: 2px;
}
.room-section > .rs-head h3 { margin: 0; font-size: 16px; }

/* 时长选择（弹层内） */
.dur-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dur-grid.two { grid-template-columns: repeat(2, 1fr); }
.dur-opt {
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; padding: 11px 6px; text-align: center;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .14s;
}
.dur-opt small { display: block; font-size: 11px; font-weight: 500; color: var(--text-soft); margin-top: 2px; }
.dur-opt:hover { border-color: var(--teal); }
.dur-opt.sel { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.dur-opt.sel small { color: var(--teal-dark); }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-opt {
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; padding: 10px 4px; text-align: center;
  font-weight: 700; font-size: 14px; cursor: pointer; transition: .14s;
}
.status-opt small { display: block; font-size: 11px; font-weight: 500; color: var(--text-soft); margin-top: 2px; }
.status-opt[data-status=free].sel { border-color: var(--free); background: var(--free-soft); color: var(--free); }
.status-opt[data-status=reserved].sel { border-color: var(--reserved); background: var(--reserved-soft); color: var(--reserved); }
.status-opt[data-status=inuse].sel { border-color: var(--inuse); background: var(--inuse-soft); color: var(--inuse); }
.form-section { margin-bottom: 14px; }
.form-section > .fs-label { font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 7px; }

/* 开关式勾选项（如「前台看板需要登录」） */
.switch-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line-strong, #d1d5db);
  border-radius: 12px; background: #fbfcfd; cursor: pointer;
}
.switch-row:hover { border-color: var(--teal); background: #f6fdfd; }
.switch-row input[type="checkbox"] {
  flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--teal); cursor: pointer;
}
.switch-row > span { font-size: 14px; line-height: 1.5; }
.switch-row b { font-size: 14.5px; }

/* ===== 房间排序 ===== */
.sort-bar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sort-handle {
  flex: none; cursor: grab; user-select: none; touch-action: none;
  font-size: 19px; line-height: 1; color: var(--muted, #94a3b8);
  padding: 4px 6px; margin-right: 2px; border-radius: 8px;
}
.sort-handle:hover { background: #eef2f7; color: var(--teal); }
.sort-handle:active { cursor: grabbing; }
.room-card.dragging { opacity: .55; box-shadow: 0 10px 28px rgba(16, 24, 40, .2); }
.room-placeholder {
  height: 74px; margin: 12px 0; border-radius: 14px;
  border: 2px dashed var(--teal); background: var(--teal-soft, #e6f6f6);
}
.sort-pos { flex: none; }
.sort-actions { flex: none; display: inline-flex; gap: 4px; margin-left: auto; }
.sort-actions form { display: inline; }
.sort-actions .icon-btn {
  width: 32px; height: 32px; border-radius: 9px; font-size: 15px; font-weight: 700;
  border: 1px solid var(--line-strong, #d1d5db); background: #fff; color: #334155; cursor: pointer;
}
.sort-actions .icon-btn:hover:not([disabled]) { border-color: var(--teal); color: var(--teal); }
.sort-actions .icon-btn[disabled] { opacity: .35; cursor: not-allowed; }

/* ===== 页脚：技术支持 ===== */
.site-foot {
  margin-top: auto;                       /* 内容不足时贴到内容区底部 */
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  text-align: center; font-size: 12.5px; line-height: 1.7;
  color: #94a3b8;
  border-top: 1px solid var(--line, #e5e7eb);
  background: transparent;
}
.site-foot a {
  color: var(--teal); text-decoration: none; font-weight: 600;
  border-bottom: 1px dashed rgba(10, 165, 165, .45);
}
.site-foot a:hover { color: #0b8f8f; border-bottom-style: solid; }
/* 公开页面（前台看板）页脚：与看板同宽居中，视觉上连成一体 */
.site-foot-public {
  max-width: 1040px; margin: 0 auto;
  padding: 14px 14px calc(26px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eef2f6;
}
@media print {
  .site-foot { display: none; }
}

/* 豆仓 */
.family-block { margin-bottom: 16px; }
.family-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 9px 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0; border-bottom: none;
}
.family-head .fam-name { font-weight: 700; font-size: 15px; }
.family-head .fam-dot { width: 13px; height: 13px; border-radius: 4px; background: var(--teal); }
.family-body { background: #fff; border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); padding: 12px; }
.bean-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 9px; }
.bean-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; background: #fdfdfd;
}
.bean-card.lv-low { border-color: #fbd8ae; background: #fffbf6; }
.bean-card.lv-out { border-color: #fbc3cf; background: #fff7f9; }
.bean-card .bc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.bean-card .bc-code { font-weight: 800; font-size: 15px; letter-spacing: .3px; }
.bean-card .bc-num { display: flex; gap: 10px; margin-top: 6px; font-size: 12.5px; color: var(--text-soft); flex-wrap: wrap; }
.bean-card .bc-num b { color: var(--text); font-size: 13.5px; }
.bean-card .bc-actions { display: flex; gap: 6px; margin-top: 8px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line-strong); background: #fff; border-radius: 999px;
  padding: 3px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.chip.sel { background: var(--teal); border-color: var(--teal); color: #fff; }

/* 库存状态筛选：色系标题上的「充足/告急/缺货」标签可点击 */
.lv-chip { cursor: pointer; user-select: none; transition: transform .08s ease, box-shadow .12s ease; }
.lv-chip:hover { box-shadow: 0 2px 6px rgba(16, 24, 40, .12); }
.lv-chip:active { transform: scale(.96); }
.lv-chip.sel { outline: 2px solid var(--teal); outline-offset: 1px; font-weight: 700; }

/* 筛选提示条：始终可一键「显示全部」 */
.filter-hint {
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 8px 12px; border-radius: 10px;
  background: var(--teal-soft, #e6f6f6); color: #0f6f6f; font-size: 13px; font-weight: 600;
}
.filter-hint.show { display: flex; }
.filter-hint .btn { flex: none; }

.fam-empty { padding: 10px 2px; }

/* ===== 座位到期提醒：面板 + 右下角弹窗 ===== */
.warn-panel .warn-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
/* 需要用户点一下才能发声时，给按钮加个跳动的提示 */
.btn.attention {
  background: #fff7ed; border-color: #fdba74; color: #b45309;
  animation: attnPulse 1.4s ease-in-out infinite;
}
@keyframes attnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(253, 186, 116, .7); }
  50%      { box-shadow: 0 0 0 6px rgba(253, 186, 116, 0); }
}
.warn-panel .warn-min {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #475569;
}
.warn-panel .warn-min input {
  width: 68px; padding: 5px 8px; border: 1px solid var(--line-strong, #d1d5db);
  border-radius: 8px; text-align: center; font-size: 14px;
}
.warn-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.warn-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: #b45309; background: #fef3c7; border: 1px solid #fbd8ae;
}
.warn-chip.over { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }

.toast-wrap {
  position: fixed; right: 16px; bottom: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(340px, calc(100vw - 32px));
}
.toast {
  position: relative; padding: 12px 34px 12px 14px; border-radius: 12px;
  font-size: 14px; line-height: 1.45; color: #7c2d12;
  background: #fff7ed; border: 1px solid #fdba74;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .16);
  animation: toastIn .22s ease-out;
}
.toast.toast-over { color: #7f1d1d; background: #fef2f2; border-color: #fca5a5; }
.toast b { font-size: 15px; }
.toast .toast-x {
  position: absolute; right: 6px; top: 6px; width: 22px; height: 22px;
  border: 0; background: transparent; color: inherit; opacity: .6;
  font-size: 14px; cursor: pointer; line-height: 1; border-radius: 6px;
}
.toast .toast-x:hover { opacity: 1; background: rgba(0, 0, 0, .06); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
  .toast-wrap { right: 8px; left: 8px; bottom: 8px; max-width: none; }
}

.qty-input { display: flex; align-items: center; gap: 6px; }
.qty-input button {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: #fff; font-size: 17px; font-weight: 700; cursor: pointer; line-height: 1;
}
.qty-input input { text-align: center; width: 74px; }

.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
}
.log-item .li-icon {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
  background: #f3f4f6;
}
.log-item .li-icon.inbound { background: var(--free-soft); }
.log-item .li-icon.outbound { background: var(--over-soft); }
.log-item .li-icon.transfer { background: var(--reserved-soft); }
.log-item .li-main { flex: 1 1 auto; min-width: 0; }
.log-item .li-title { font-size: 14px; font-weight: 600; }
.log-item .li-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.log-item .li-amount { font-weight: 700; font-variant-numeric: tabular-nums; }

/* 登录页 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(160deg, #0d3b40 0%, #10232b 55%, #241a10 100%);
}
.login-box { width: 100%; max-width: 370px; background: #fff; border-radius: 18px; padding: 26px 22px 22px; box-shadow: var(--shadow-lg); }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand h1 { font-size: 21px; color: var(--orange); margin: 0 0 4px; }
.login-brand p { color: var(--text-soft); font-size: 13px; margin: 0; }
.login-logo {
  width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--teal), var(--orange));
  display: flex; align-items: center; justify-content: center; font-size: 25px;
}

/* 安装 / 自检页 */
.setup-wrap { max-width: 760px; margin: 0 auto; padding: 24px 14px 40px; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.check-list li:last-child { border-bottom: none; }
.check-list .ck { font-weight: 700; }
.check-list .ok { color: var(--free); }
.check-list .no { color: var(--over); }
pre.code {
  background: #10232b; color: #d7e6ea; padding: 13px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 12.5px; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ------------------------------------------------- 房间布局（后台预览/编辑器） */
.mini-board { overflow-x: auto; }
.mini-board .canvas { background: #f7f8f9; }
.mini-board .seat { cursor: default; }
.mini-board .seat:hover { filter: none; }

.ed-mini {
  width: auto; padding: 5px 8px; font-size: 12.5px; border-radius: 8px;
}
select.ed-mini { padding-right: 26px; }

/* 色系配置表 */
#famTable input { max-width: 100%; }

/* 底部工具条（移动端） */
.mobile-actions { display: none; }

/* ============================================================== 响应式增强 */
@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .content-body { padding: 18px; }
  .public-wrap { padding: 22px 20px 50px; }
  .board-title h1 { font-size: 33px; }
  .board-title h2 { font-size: 25px; letter-spacing: 8px; }
  .room-label { flex: 0 0 92px; font-size: 19px; }
  .room-body { padding: 20px 24px; }
  .seat { min-height: 54px; }
  .seat .seat-tag { font-size: 18px; }
}

@media (min-width: 900px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; flex: 0 0 236px; }
  .layout { display: flex; }
  .sidebar-mask { display: none !important; }
  .menu-btn { display: none; }
  .content { flex: 1 1 auto; min-width: 0; }
  .content-body { padding: 22px 26px; }
  .topbar { padding: 12px 26px; }
  .seat { min-height: 62px; }
  .bean-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
}

@media (max-width: 400px) {
  .room-label { flex: 0 0 62px; font-size: 15px; }
  .room-body { padding: 12px 10px; }
  .seat { min-height: 38px; }
  .seat .seat-tag { font-size: 13px; }
  .dur-grid { grid-template-columns: repeat(2, 1fr); }
  .status-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 13px; }
}

@media print {
  .board-meta .no-print, .legend .no-print { display: none; }
  body { background: #fff; }
  .room { break-inside: avoid; }
}

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