/* ---------- 基础 ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin:0; font-family:"Microsoft YaHei","PingFang SC","Helvetica Neue",Arial,sans-serif;
  background:#f4f6fa; color:#1f2937; font-size:14px; }
a { color:#2563eb; text-decoration:none; }
button, input, select, textarea { font-family:inherit; font-size:14px; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; border:0; cursor:pointer;
  padding:8px 16px; border-radius:8px; background:#2563eb; color:#fff; font-size:14px; transition:.15s; }
.btn:hover { filter:brightness(1.08); }
.btn:active { transform:scale(.98); }
.btn.ghost { background:#fff; color:#374151; border:1px solid #d1d5db; }
.btn.gray { background:#6b7280; }
.btn.green { background:#059669; }
.btn.red { background:#dc2626; }
.btn.sm { padding:5px 10px; font-size:13px; border-radius:6px; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
input, select, textarea { padding:8px 10px; border:1px solid #d1d5db; border-radius:8px; outline:none; background:#fff; }
input:focus, select:focus, textarea:focus { border-color:#2563eb; }
.card { background:#fff; border-radius:12px; padding:16px; box-shadow:0 1px 3px rgba(0,0,0,.06); margin-bottom:12px; }
.row { display:flex; gap:10px; align-items:center; }
.between { display:flex; justify-content:space-between; align-items:center; }
.muted { color:#6b7280; }
.small { font-size:13px; }
.tag { display:inline-block; padding:2px 8px; border-radius:20px; font-size:12px; background:#eef2ff; color:#4338ca; }
.tag.g { background:#ecfdf5; color:#047857; }
.tag.r { background:#fef2f2; color:#b91c1c; }
.tag.y { background:#fffbeb; color:#b45309; }
.tag.gray { background:#f3f4f6; color:#4b5563; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th, td { padding:8px 8px; border-bottom:1px solid #eef0f3; text-align:left; white-space:nowrap; }
th { color:#6b7280; font-weight:600; background:#fafbfc; position:sticky; top:0; }
tbody tr:hover { background:#fafbff; }
.scroll { overflow:auto; }
.empty { text-align:center; color:#9ca3af; padding:30px 0; }
.hidden { display:none !important; }

/* ---------- 租客端 ---------- */
.app { max-width:520px; margin:0 auto; min-height:100vh; background:#f4f6fa; padding-bottom:70px; }
.hd { background:linear-gradient(135deg,#2563eb,#1d4ed8); color:#fff; padding:18px 16px 22px; border-radius:0 0 18px 18px; }
.hd .t { font-size:15px; opacity:.9; }
.hd .big { font-size:34px; font-weight:700; margin:6px 0; }
.hd .sub { font-size:13px; opacity:.9; display:flex; gap:14px; flex-wrap:wrap; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.stat { background:#fff; border-radius:12px; padding:12px; text-align:center; }
.stat .v { font-size:20px; font-weight:700; color:#111827; }
.stat .k { font-size:12px; color:#6b7280; margin-top:2px; }
.tabs { position:fixed; bottom:0; left:0; right:0; background:#fff; display:flex; border-top:1px solid #e5e7eb;
  max-width:520px; margin:0 auto; z-index:20; }
.tabs div { flex:1; text-align:center; padding:9px 0 7px; color:#9ca3af; font-size:12px; cursor:pointer; }
.tabs div.on { color:#2563eb; }
.tabs .ico { font-size:18px; display:block; margin-bottom:2px; }
.pad { padding:12px; }
.list-item { display:flex; justify-content:space-between; align-items:center; padding:11px 0; border-bottom:1px solid #f1f3f6; }
.list-item:last-child { border:0; }
.alert { border-radius:10px; padding:10px 12px; font-size:13px; margin-bottom:12px; }
.alert.warn { background:#fffbeb; color:#92400e; border:1px solid #fde68a; }
.alert.err { background:#fef2f2; color:#991b1b; border:1px solid #fecaca; }
.alert.info { background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; }
.qrbox { text-align:center; padding:14px; }
.qrbox img { max-width:230px; width:80%; border:1px solid #e5e7eb; border-radius:10px; }
.amount-btns { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:10px 0; }
.amount-btns button { padding:9px 0; border:1px solid #d1d5db; background:#fff; border-radius:8px; cursor:pointer; }
.amount-btns button.on { border-color:#2563eb; background:#eff6ff; color:#1d4ed8; font-weight:600; }
.tips { margin:10px 0 0; padding-left:22px; line-height:2; font-size:14px; color:#374151; }
.tips li { margin:4px 0; }
.tips b, .tips .hl { color:#111827; font-weight:600; }

/* ---------- 后台 ---------- */
.wrap { display:flex; min-height:100vh; }
.side { width:180px; background:#111827; color:#cbd5e1; padding:16px 0; flex-shrink:0; }
.side .logo { color:#fff; font-size:14px; font-weight:700; padding:0 16px 16px; line-height:1.45;
  word-break:break-all; }
.side a { display:block; padding:11px 20px; color:#cbd5e1; cursor:pointer; font-size:14px; }
.side a:hover { background:#1f2937; color:#fff; }
.side a.on { background:#2563eb; color:#fff; }
.main { flex:1; padding:18px 22px; overflow:auto; }
.topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:14px; }
.kpi { background:#fff; border-radius:12px; padding:14px; box-shadow:0 1px 3px rgba(0,0,0,.06); }
.kpi .v { font-size:22px; font-weight:700; }
.kpi .k { font-size:12px; color:#6b7280; margin-top:3px; }
.toolbar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.modal-mask { position:fixed; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:center;
  justify-content:center; z-index:99; padding:20px; }
.modal { background:#fff; border-radius:14px; width:100%; max-width:560px; max-height:88vh; overflow:auto; }
.modal .mh { padding:14px 18px; border-bottom:1px solid #eef0f3; font-weight:700; display:flex;
  justify-content:space-between; align-items:center; }
.modal .mb { padding:16px 18px; }
.modal .mf { padding:12px 18px; border-top:1px solid #eef0f3; display:flex; justify-content:flex-end; gap:8px; }
.fld { margin-bottom:12px; }
.fld label { display:block; font-size:13px; color:#4b5563; margin-bottom:4px; }
.fld input, .fld select, .fld textarea { width:100%; }
.fld textarea { min-height:80px; }
.grid3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
.grid2b { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.toast { position:fixed; top:16px; left:50%; transform:translateX(-50%); background:#111827; color:#fff;
  padding:10px 18px; border-radius:8px; z-index:200; font-size:14px; }
pre.json { background:#0f172a; color:#a5f3fc; padding:12px; border-radius:8px; font-size:12px;
  overflow:auto; max-height:260px; white-space:pre-wrap; word-break:break-all; }
@media (max-width:900px){
  .wrap{flex-direction:column;} .side{width:100%;display:flex;overflow:auto;}
  .side .logo{display:none;} .side a{padding:10px 14px;white-space:nowrap;} .main{padding:12px;}
  .grid3{grid-template-columns:1fr;}
}

/* ===== 合并版新增：模式切换 / 房间平铺视图 ===== */
.seg { display:inline-flex; border:1px solid #d1d5db; border-radius:8px; overflow:hidden; }
.seg button { border:0; background:#fff; padding:6px 14px; font-size:13px; cursor:pointer; color:#374151; }
.seg button + button { border-left:1px solid #d1d5db; }
.seg button.on { background:#2563eb; color:#fff; }
.grid4 { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }

.floor-block { margin-bottom:16px; }
.floor-title { font-size:14px; font-weight:700; color:#111827; padding:6px 0 8px; border-bottom:1px solid #e5e7eb; margin-bottom:10px; }
.tile-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(104px,1fr)); gap:10px; }
.tile { position:relative; border-radius:10px; padding:10px 8px; cursor:pointer; text-align:center;
        border:1px solid #e5e7eb; background:#fff; transition:.15s; }
.tile:hover { box-shadow:0 4px 12px rgba(37,99,235,.18); transform:translateY(-2px); border-color:#93c5fd; }
.tile.empty { background:#f9fafb; }
.tile.part  { background:#eff6ff; border-color:#bfdbfe; }
.tile.full  { background:#ecfdf5; border-color:#a7f3d0; }
.tile .t-no { font-size:17px; font-weight:700; color:#111827; }
.tile .t-live { font-size:12px; color:#6b7280; margin-top:2px; }
.tile .t-ent { font-size:11px; color:#374151; margin-top:4px; height:26px; overflow:hidden; line-height:1.3; }
.tile .t-flag { position:absolute; top:4px; right:4px; font-size:10px; padding:1px 5px; border-radius:8px; }
.tile .t-flag.red { background:#fee2e2; color:#b91c1c; }
.tile .t-flag.blue { background:#dbeafe; color:#1d4ed8; right:auto; left:4px; }
@media (max-width:900px){ .grid4{grid-template-columns:1fr 1fr;} }

/* ===== 房间使用属性（客户住房/员工自用/维修房/需保洁） ===== */
.ut { display:inline-block; font-size:12px; padding:2px 8px; border-radius:10px;
      border:1px solid transparent; white-space:nowrap; }
.ut.clickable { cursor:pointer; transition:.15s; }
.ut.clickable:hover { filter:brightness(.94); transform:translateY(-1px); }
.ut.on { outline:2px solid #2563eb; outline-offset:1px; }
.ut-normal { background:#ecfdf5; color:#047857; border-color:#a7f3d0; }
.ut-staff  { background:#ede9fe; color:#6d28d9; border-color:#ddd6fe; }
.ut-fix    { background:#ffedd5; color:#c2410c; border-color:#fed7aa; }
.ut-clean  { background:#cffafe; color:#0e7490; border-color:#a5f3fc; }

/* 平铺格子底部的使用属性条 */
.tile .t-ut { margin-top:5px; font-size:11px; padding:1px 0; border-radius:6px; }
.tile .t-ut:hover { text-decoration:underline; }
.tile.ut-tile { border-width:2px; }

/* ===== 企业 → 批量关联房间的房间选择格子 ===== */
.er-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(118px,1fr)); gap:6px; margin-bottom:8px; }
.er-cell { display:flex; align-items:center; gap:6px; padding:5px 7px; border:1px solid #e5e7eb;
           border-radius:8px; background:#fff; cursor:pointer; font-size:13px; }
.er-cell:hover { border-color:#93c5fd; background:#f8fafc; }
.er-cell.taken { background:#fffbeb; border-color:#fde68a; }
.er-cell.in { background:#eff6ff; border-color:#bfdbfe; }
.er-cell input { margin:0; }
.er-cell span { display:flex; flex-direction:column; line-height:1.25; overflow:hidden; }
.er-cell i { font-style:normal; font-size:11px; color:#6b7280; white-space:nowrap;
             overflow:hidden; text-overflow:ellipsis; }

/* ===== 执行过程日志时间线 ===== */
.lg-row { display: flex; gap: 10px; padding: 6px 2px; border-bottom: 1px dashed #eef1f5; }
.lg-row:last-child { border-bottom: none; }
.lg-t { flex: 0 0 62px; font-size: 12px; color: #94a3b8; font-variant-numeric: tabular-nums; padding-top: 1px; }
.lg-b { flex: 1; font-size: 13px; line-height: 1.7; color: #334155; word-break: break-all; }
.lg-tag { display: inline-block; font-size: 11px; line-height: 15px; padding: 0 5px; margin-right: 6px;
  border: 1px solid currentColor; border-radius: 4px; vertical-align: 1px; }
.lg-timeline { max-height: 56vh; overflow: auto; padding-right: 4px; }
.lg-timeline .lg-row { align-items: flex-start; }
#dc-logs .empty { padding: 18px 4px; }

/* ==================================================================
   P0–P2 扩展：导航分组 / 待办 / 账单 / 流水 / 权限 / 移动端适配
   ================================================================== */
.side { overflow-y:auto; }
.navgrp { padding:14px 20px 6px; font-size:11px; letter-spacing:.08em; color:#6b7280; }
.side a { display:flex; align-items:center; justify-content:space-between; gap:6px; }
.navbadge { background:#dc2626; color:#fff; font-size:11px; border-radius:9px; padding:0 6px; line-height:16px; }
.nowrap { white-space:nowrap; }

/* 待办 */
.todo-list { display:flex; flex-direction:column; gap:8px; }
.todo-item { display:flex; align-items:center; justify-content:space-between; gap:12px;
  border:1px solid #eef1f5; border-left:4px solid #93c5fd; border-radius:10px; padding:10px 12px; background:#fbfcfe; }
.todo-item.err { border-left-color:#dc2626; background:#fff7f7; }
.todo-item.warn { border-left-color:#f59e0b; background:#fffdf6; }
.todo-title { font-weight:600; font-size:14px; color:#111827; }
.todo-sub { font-size:12.5px; color:#6b7280; margin-top:3px; }

/* 流水分类标签 */
.chipbar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.chip { background:#f3f4f6; border-radius:16px; padding:4px 10px; font-size:12.5px; color:#374151; }

/* 横向占比条 */
.bar-row { display:flex; align-items:center; gap:10px; margin-bottom:8px; font-size:13px; }
.bar-row span { flex:0 0 96px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-row .bar { flex:1; height:8px; background:#eef2f7; border-radius:5px; overflow:hidden; }
.bar-row .bar i { display:block; height:100%; background:linear-gradient(90deg,#60a5fa,#2563eb); }
.bar-row b { flex:0 0 34px; text-align:right; }

/* 角色卡片 */
.role-matrix { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:10px; }
.role-card { border:1px solid #e5e7eb; border-radius:10px; padding:10px 12px; background:#fafbff; }
.role-name { font-weight:700; margin-bottom:4px; color:#1d4ed8; }

/* 表格里的小输入 */
td input[type=number], td input[type=text] { padding:4px 6px; }

/* 打印友好 */
@media print {
  .side, .topbar .row, .tabs, .mf { display:none !important; }
  body { background:#fff; }
  .card { box-shadow:none; border:1px solid #e5e7eb; }
}

/* ---------- P2-18 移动端适配 ---------- */
@media (max-width: 860px) {
  .wrap { display:block; }
  .side { width:100%; display:flex; overflow-x:auto; padding:8px 6px; gap:2px;
          position:sticky; top:0; z-index:30; align-items:center; }
  .side .logo { display:none; }
  .side .navgrp { display:none; }
  .side a { padding:8px 12px; white-space:nowrap; border-radius:8px; font-size:13px; }
  .side a.on { background:#2563eb; }
  .side a[onclick="logout()"] { margin-top:0 !important; }
  .main { padding:12px 10px 40px; }
  .topbar { flex-direction:column; align-items:flex-start; gap:8px; }
  .topbar .row { flex-wrap:wrap; }
  .kpis { grid-template-columns:1fr 1fr; }
  .grid3, .grid4, .grid2b { grid-template-columns:1fr; }
  .modal { max-width:96vw; }
  table { font-size:12.5px; }
  .scroll { -webkit-overflow-scrolling:touch; }
  .btn.sm { padding:6px 9px; }
}

/* ---------- 租客端 H5 组件 ---------- */
.h5-tabs { position:fixed; bottom:0; left:0; right:0; background:#fff; display:flex;
  border-top:1px solid #e5e7eb; z-index:50; padding-bottom:env(safe-area-inset-bottom); }
.h5-tabs .tab { flex:1; text-align:center; padding:8px 0 6px; color:#9ca3af; font-size:11.5px; cursor:pointer; }
.h5-tabs .tab.on { color:#2563eb; }
.h5-tabs .tab .ico { display:block; font-size:19px; margin-bottom:2px; }
.h5-tabs .tab .dot { position:absolute; margin-left:14px; margin-top:-2px; width:7px; height:7px;
  background:#dc2626; border-radius:50%; }
.bill-card { background:#fff; border-radius:12px; padding:12px 14px; margin-bottom:10px; box-shadow:0 1px 3px rgba(0,0,0,.05); }
.bill-card.paid { opacity:.62; }
.bill-top { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.bill-title { font-weight:600; font-size:14.5px; color:#111827; }
.bill-meta { font-size:12px; color:#9ca3af; margin-top:3px; }
.bill-amt { font-size:19px; font-weight:700; color:#dc2626; white-space:nowrap; }
.bill-amt.paid { color:#059669; }
.pay-sheet { position:fixed; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:flex-end; z-index:80; }
.pay-sheet .panel { background:#fff; width:100%; border-radius:16px 16px 0 0; padding:18px 16px 26px; max-height:86vh; overflow:auto; }
.pay-sheet h4 { margin:0 0 4px; }
.pay-amt-big { font-size:30px; font-weight:800; text-align:center; margin:10px 0; }
.h5-empty { text-align:center; color:#9ca3af; padding:40px 10px; font-size:13px; }
.h5-sec-title { font-size:13px; color:#6b7280; margin:16px 4px 8px; }

/* 首页快捷服务 */
.quick { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:12px; }
.quick div { background:#f5f8ff; border:1px solid #e3ecff; border-radius:12px; padding:12px 4px;
  text-align:center; font-size:12px; color:#334155; cursor:pointer; }
.quick div span { display:block; font-size:22px; margin-bottom:4px; }
.quick div:active { background:#e8f0ff; }
