/* ===== 全局主题（CSS 变量，浅色简洁风） ===== */
:root {
  --primary: #d97706;
  --primary-dark: #b45309;
  --primary-light: #fef3c7;
  --bg: #f7f5f2;
  --panel: #ffffff;
  --border: #e5e0d8;
  --text: #292524;
  --text-light: #78716c;
  --danger: #dc2626;
  --success: #16a34a;
  --info: #2563eb;
  --warning: #d97706;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
}
.hidden { display: none !important; }
a { color: var(--info); text-decoration: none; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 40%, #fbbf24 100%);
}
.login-card {
  background: var(--panel); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.12);
  padding: 36px 40px; width: 380px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .sub { color: var(--text-light); margin-bottom: 24px; }

/* ===== 表单元素 ===== */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 13px; }
.form-item label .req { color: var(--danger); margin-left: 2px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="month"], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(217,119,6,.12); }
textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-item { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.form-error { font-size: 13px; color: var(--danger); margin: 6px 0 0; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 16px;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  font-size: 14px; background: var(--primary); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 3px 10px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #f5f2ec; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-link { background: none; border: none; color: var(--info); padding: 2px 6px; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }

/* ===== 顶栏与菜单 ===== */
.topbar {
  display: flex; align-items: center; gap: 20px; height: 52px;
  background: #fff; border-bottom: 1px solid var(--border); padding: 0 18px;
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 700; font-size: 16px; color: var(--primary-dark); white-space: nowrap; }
.menu { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.menu-item {
  padding: 6px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  color: var(--text-light); font-size: 14px; border: none; background: none;
}
.menu-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.menu-item.active { background: var(--primary); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.current-user { color: var(--text-light); font-size: 13px; }
.notif-badge { cursor: pointer; position: relative; font-size: 17px; }
.notif-badge .dot {
  position: absolute; top: -4px; right: -8px; background: var(--danger); color: #fff;
  font-size: 11px; border-radius: 9px; padding: 0 4px; min-width: 16px; text-align: center; line-height: 15px;
}

/* ===== 页签栏（PRD 2.3 多页签导航） ===== */
.tabbar-wrap { background: #fff; border-bottom: 1px solid var(--border); padding: 0 12px; }
.tabbar { display: flex; gap: 4px; overflow-x: auto; height: 38px; align-items: flex-end; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 14px;
  border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0;
  background: #f1ede6; cursor: pointer; font-size: 13px; color: var(--text-light); white-space: nowrap;
}
.tab.active { background: var(--bg); color: var(--text); font-weight: 600; border-color: var(--primary); }
.tab .close { font-style: normal; color: #a8a29e; padding: 0 3px; border-radius: 4px; }
.tab .close:hover { color: var(--danger); background: rgba(220,38,38,.08); }
.tab .close.home { display: none; } /* 工作台页签不可关闭 */

/* ===== 视图容器 ===== */
.views { padding: 16px 18px 40px; }
.view-panel { display: none; }
.view-panel.active { display: block; }

/* ===== 通用面板/卡片 ===== */
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.panel-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }
.panel-title .actions { display: flex; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.stat-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat-card .label { color: var(--text-light); font-size: 13px; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.stat-card .value.small { font-size: 16px; }
.stat-card .sub { color: var(--text-light); font-size: 12px; margin-top: 2px; }

/* ===== 工具栏与筛选 ===== */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.grid th { background: #faf8f5; font-weight: 600; color: var(--text-light); white-space: nowrap; }
table.grid tr:hover td { background: #fdfbf7; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid .row-actions { white-space: nowrap; }
.empty-tip { color: var(--text-light); text-align: center; padding: 26px 0; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 18px; white-space: nowrap; }
.tag-gray { background: #f0efec; color: #57534e; }
.tag-orange { background: var(--primary-light); color: var(--primary-dark); }
.tag-green { background: #dcfce7; color: #15803d; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-purple { background: #ede9fe; color: #6d28d9; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(41,37,36,.45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow: auto;
}
.modal {
  background: #fff; border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.2);
  width: 640px; max-width: 96vw; padding: 20px 22px;
}
.modal.wide { width: 900px; }
.modal.narrow { width: 420px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--text-light); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ===== Toast ===== */
#toast-root { position: fixed; top: 68px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #292524; color: #fff; border-radius: 8px; padding: 10px 16px; font-size: 13.5px;
  box-shadow: var(--shadow); max-width: 380px; animation: slidein .18s ease-out;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== 甘特图（PRD 7.1 房态图） ===== */
.gantt-wrap { overflow-x: auto; }
.gantt { display: grid; gap: 0; min-width: 100%; }
.gantt-row { display: contents; }
.gantt .cell-head { position: sticky; top: 0; background: #faf8f5; font-size: 12px; color: var(--text-light); text-align: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
.gantt .cell-head.today { color: var(--danger); font-weight: 700; }
.gantt .cell-room { font-size: 13px; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); white-space: nowrap; }
.gantt .cell-room .rt { color: var(--text-light); font-size: 12px; }
.gantt .cell-day {
  border-bottom: 1px solid #efede9; border-right: 1px solid #f3f1ed; position: relative; height: 34px;
}
.gantt .cell-day.today-col { background: rgba(220,38,38,.04); }
.gantt .cell-day.weekend { background: rgba(0,0,0,.015); }
.gantt .bar {
  position: absolute; top: 4px; bottom: 4px; left: 0; right: 0; margin: 0 -1px;
  border-radius: 5px; font-size: 11.5px; line-height: 26px; padding: 0 8px;
  color: #fff; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.gantt .bar:hover { filter: brightness(1.08); }
.gantt-legend { display: flex; gap: 14px; margin: 10px 0 4px; font-size: 12.5px; color: var(--text-light); flex-wrap: wrap; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

/* ===== 护理打卡（PRD 7.8：按房间分组、批量勾选） ===== */
.care-group { margin-bottom: 14px; }
.care-group-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #faf8f5;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; font-weight: 600;
}
.care-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; padding: 0 2px; }
.care-item {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; background: #fff; cursor: pointer; user-select: none;
}
.care-item:hover { border-color: var(--primary); }
.care-item.done { background: #f0fdf4; border-color: #bbf7d0; }
.care-item.done .care-name { color: var(--text-light); text-decoration: line-through; }
.care-item input { width: 16px; height: 16px; accent-color: var(--success); }
.care-item .care-name { flex: 1; font-size: 13.5px; }
.care-item .allergy { font-size: 12px; color: var(--danger); }
.care-item.abnormal { border-color: var(--danger); background: #fef2f2; }

/* ===== 购物车/收银（PRD 6.4） ===== */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } }
.cart-panel { position: sticky; top: 100px; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.cart-line .name { flex: 1; }
.qty-input { width: 64px !important; text-align: center; padding: 3px 6px !important; }
.cart-total { display: flex; justify-content: space-between; padding: 10px 0 4px; font-size: 15px; font-weight: 700; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.product-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; background: #fff; }
.product-card:hover { border-color: var(--primary); background: #fffbeb; }
.product-card.disabled { opacity: .45; cursor: not-allowed; }
.product-card .p-name { font-weight: 600; font-size: 13.5px; }
.product-card .p-meta { color: var(--text-light); font-size: 12.5px; margin-top: 2px; display:flex; justify-content: space-between; }

/* ===== 详情描述列表 ===== */
.desc { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin-bottom: 10px; }
.desc .d-item .k { color: var(--text-light); font-size: 12.5px; }
.desc .d-item .v { font-size: 14px; font-weight: 500; }

/* ===== 通知下拉 ===== */
.notif-pop {
  position: absolute; top: 46px; right: 12px; width: 340px; max-height: 420px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.14); z-index: 90;
}
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.notif-item:hover { background: #fdfbf7; }
.notif-item.unread { background: #fffbeb; }
.notif-item .t { color: var(--text-light); font-size: 12px; }

/* ===== 打印（报表导出场景可直接浏览器打印） ===== */
@media print {
  .topbar, .tabbar-wrap, .sidebar, .toolbar, .modal-foot, .row-actions { display: none !important; }
  body { background: #fff; }
}

/* ================================================================
 * 基础资料选择器（Picker）—— 与写死的枚举下拉明确区分的交互组件
 * 触发方式：字段显示放大镜 🔍，点击弹出独立选择窗口
 * ================================================================ */

/* ---- 触发器字段 ---- */
.picker-field {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 8px;
  height: 38px; padding: 0 10px 0 12px; background: #fff;
  cursor: pointer; user-select: none;
}
.picker-field:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(217,119,6,.08); }
.picker-field:focus-within, .picker-field:focus { outline: none; border-color: var(--primary); }
.picker-field .pf-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.picker-field .pf-text.placeholder { color: var(--text-light); }
.picker-field .pf-clear { border: none; background: none; color: var(--text-light); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 4px; }
.picker-field .pf-clear:hover { color: var(--danger); background: #fef2f2; }
.picker-field .pf-icon { font-size: 15px; opacity: .8; flex-shrink: 0; }
.picker-field.disabled { background: var(--bg); cursor: not-allowed; opacity: .8; }
.picker-field.disabled:hover { border-color: var(--border); box-shadow: none; }

/* ---- 选择弹窗 ---- */
.picker-modal { width: 900px; max-width: 94vw; }
.picker-head-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.picker-title-hint { color: var(--text-light); font-size: 12.5px; }
.picker-search {
  width: 240px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px;
}
.picker-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(217,119,6,.08); }

.picker-body { display: flex; gap: 14px; }
.picker-main { flex: 1; min-width: 0; }
.picker-table-box { min-height: 120px; max-height: 380px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.picker-table table { margin: 0; }
.picker-table tr { cursor: pointer; }
.picker-table tbody tr:hover { background: #fffbeb; }
.picker-table tbody tr.picked { background: #fef3c7; }
.picker-table td.pc-col, .picker-table th.pc-col { width: 36px; text-align: center; }

/* ---- 已选面板（多选） ---- */
.picker-chosen { width: 250px; flex-shrink: 0; border-left: 1px solid var(--border); padding-left: 14px; display: flex; flex-direction: column; }
.picker-chosen-head { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-light); padding: 2px 0 8px; }
.picker-chosen-head b { color: var(--primary); }
.picker-chosen-list { flex: 1; overflow: auto; max-height: 350px; }
.pc-item { display: flex; align-items: center; gap: 6px; padding: 5px 8px; margin-bottom: 4px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; font-size: 13px; }
.pc-item .pc-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-item .pc-remove { border: none; background: none; color: var(--text-light); cursor: pointer; font-size: 12px; padding: 0 2px; }
.pc-item .pc-remove:hover { color: var(--danger); }
.pc-empty { color: var(--text-light); font-size: 12.5px; text-align: center; padding: 24px 0; }

/* ---- 分页控件 ---- */
.picker-pagebar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.picker-pagebar .pager-info { color: var(--text-light); font-size: 12.5px; flex: 1; text-align: center; }

/* ================================================================
 * 分组模块菜单（工作台 / 业务云 / 财务云 / 基础服务云）
 * 顶栏放模块按钮；点击模块后左侧边栏展示该组二级菜单
 * ================================================================ */
.body-wrap { display: flex; align-items: stretch; min-height: calc(100vh - 52px); }
.content-wrap { flex: 1; min-width: 0; }
.sidebar {
  width: 192px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border);
  padding: 10px 10px 24px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 52px; align-self: flex-start;
  height: calc(100vh - 52px); overflow-y: auto;
}
.sidebar.collapsed { display: none; } /* 工作台无二级菜单时收起 */
.sidebar-title {
  font-size: 12px; color: var(--text-light); padding: 10px 10px 8px; letter-spacing: 2px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.sidebar .menu-item { display: flex; align-items: center; width: 100%; text-align: left; border-radius: 7px; padding: 8px 12px; }

/* ================================================================
 * 房态卡片（入住台账：所有房间卡片网格，颜色区分状态）
 * 空闲=绿 / 入住中=橙 / 已预订=紫 / 清洁中=蓝 / 隔离中=红 / 维护中=灰
 * ================================================================ */
.room-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.room-card {
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 9px; padding: 10px 12px; position: relative;
  transition: box-shadow .15s, transform .15s;
}
.room-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.10); }
.room-card.st-free { border-left-color: var(--success); }
.room-card.st-occupied { border-left-color: var(--primary); background: #fffdf8; }
.room-card.st-reserved { border-left-color: #8b5cf6; }
.room-card.st-cleaning { border-left-color: var(--info); }
.room-card.st-isolating { border-left-color: var(--danger); }
.room-card.st-repairing { border-left-color: #a8a29e; background: #faf9f8; }
.room-card .rc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.room-card .rc-name { font-weight: 700; font-size: 15px; }
.room-card .rc-type { color: var(--text-light); font-size: 12px; margin-top: 1px; }
.room-card .rc-info { font-size: 12.5px; margin-top: 6px; line-height: 1.5; min-height: 19px; }
.room-card .rc-info b { font-weight: 600; }
.room-card .rc-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.room-card .rc-actions .btn { padding: 3px 10px; font-size: 12.5px; }

/* 状态图例（房态图面板顶部） */
.status-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-light); margin-bottom: 10px; }
.status-legend .sl-item { display: inline-flex; align-items: center; gap: 5px; }
.status-legend .sl-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
