/* ============================================================
   影子 PMS — 全局样式
   桌面优先（侧边栏布局），移动端降级（底部导航）
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: #1a1a1a;
  background: #f5f6f8;
  min-height: 100vh;
}

a { color: #1890ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 210px;
  min-width: 210px;
  background: #001529;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  line-height: 1.4;
}
.sidebar-brand small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: #fff;
  background: #1890ff;
  border-left-color: #69c0ff;
}
.sidebar-nav a .icon { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-footer {
  padding: 12px 16px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: 210px;
  padding: 0;
  min-height: 100vh;
}
.page-header {
  background: #fff;
  padding: 14px 24px;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-header h1 { font-size: 1.15rem; font-weight: 600; }
.page-header .meta { font-size: 0.78rem; color: #888; }
.sync-info { font-size: 0.75rem; color: #8c8c8c; }
.sync-info.warn { color: #faad14; font-weight: 500; }
.page-body { padding: 20px 24px 32px; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 16px 20px; }

/* ── Stat Cards Row ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border-radius: 6px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}
a.stat-card:hover {
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
  transform: translateY(-1px);
  text-decoration: none;
}
.stat-card .stat-label { font-size: 0.78rem; color: #888; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-delta {
  font-size: 0.75rem;
  margin-top: 4px;
}
.stat-delta.up { color: #52c41a; }
.stat-delta.down { color: #ff4d4f; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
thead th {
  background: #fafafa;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #e8e8e8;
  white-space: nowrap;
  font-size: 0.82rem;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
tbody tr:hover { background: #fafcff; }
tbody tr.row-green { border-left: 3px solid #52c41a; }
tbody tr.row-yellow { border-left: 3px solid #faad14; }
tbody tr.row-red { border-left: 3px solid #ff4d4f; }
tbody tr.row-expanded { background: #f6f9ff; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-green { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.badge-yellow { background: #fffbe6; color: #d48806; border: 1px solid #ffe58f; }
.badge-red { background: #fff2f0; color: #cf1322; border: 1px solid #ffa39e; }
.badge-blue { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }
.badge-gray { background: #fafafa; color: #888; border: 1px solid #d9d9d9; }
.badge-orange { background: #fff7e6; color: #d46b08; border: 1px solid #ffd591; }

/* Status badges */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.status-dot.booked { background: #1890ff; }
.status-dot.checked_in { background: #722ed1; }
.status-dot.checked_out { background: #faad14; }
.status-dot.settled { background: #52c41a; }
.status-dot.invoiced { background: #13c2c2; }
.status-dot.archived { background: #888; }
.status-dot.cancelled, .status-dot.noshow { background: #d9d9d9; }

/* ── Order Detail Panel ── */
.order-detail {
  display: none;
  background: #f9faff;
  border: 1px solid #d6e4ff;
  border-radius: 6px;
  padding: 18px 20px;
  margin: 6px 0 10px;
}
.order-detail.show { display: block; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin-bottom: 14px;
}
.detail-grid .dl { display: flex; gap: 8px; }
.detail-grid .dt { color: #888; font-size: 0.8rem; min-width: 70px; }
.detail-grid .dd { font-weight: 500; font-size: 0.88rem; }

.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
}
.checklist .cl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 6px 0;
}
.cl-item .cl-icon { font-size: 1rem; }
.cl-item .cl-label { color: #555; }
.cl-item .cl-detail { color: #888; font-size: 0.78rem; margin-left: auto; }

.timeline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: #555;
}
.timeline .t-step {
  background: #e6f7ff;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
  color: #1890ff;
}
.timeline .t-arrow { color: #bbb; }
.timeline .t-missing {
  background: #fff2f0;
  color: #cf1322;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.filter-bar select, .filter-bar input {
  padding: 6px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 0.85rem;
  background: #fff;
  font-family: inherit;
}
.filter-bar input[type="text"] { min-width: 200px; }
.filter-bar select { cursor: pointer; }
.filter-bar .filter-info { font-size: 0.8rem; color: #888; margin-left: auto; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 4px;
  border: 1px solid #d9d9d9;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: #1890ff; color: #1890ff; }
.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.btn-danger { color: #ff4d4f; border-color: #ffa39e; }
.btn-danger:hover { color: #fff; background: #ff4d4f; border-color: #ff4d4f; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0;
}
.pagination a, .pagination span {
  padding: 5px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  font-size: 0.82rem;
  color: #555;
}
.pagination .current {
  background: #1890ff;
  color: #fff;
  border-color: #1890ff;
  font-weight: 600;
}
.pagination a:hover { border-color: #1890ff; color: #1890ff; text-decoration: none; }

/* ── Alerts ── */
.alert-list { list-style: none; }
.alert-list li {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-list li.severe { background: #fff2f0; border: 1px solid #ffccc7; }
.alert-list li.warning { background: #fffbe6; border: 1px solid #ffe58f; }
.alert-list li.info { background: #f6ffed; border: 1px solid #b7eb8f; }

/* ── Room Grid ── */
.room-floor { margin-bottom: 14px; }
.room-floor h3 {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #f0f0f0;
}
.room-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.room-cell {
  width: 52px;
  height: 44px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s;
  position: relative;
}
.room-cell:hover { transform: scale(1.08); z-index: 5; }
.room-cell.vacant { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.room-cell.occupied { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.room-cell.dirty { background: #fffbe6; color: #faad14; border: 1px solid #ffe58f; }
.room-cell.maintenance { background: #f5f5f5; color: #888; border: 1px solid #d9d9d9; }
.room-cell.reserved { background: #f9f0ff; color: #722ed1; border: 1px solid #d3adf7; }

/* ── Operations ── */
.daemon-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.daemon-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #e8e8e8;
  background: #fff;
}
.daemon-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.daemon-dot.running { background: #52c41a; box-shadow: 0 0 4px #52c41a; }
.daemon-dot.stopped { background: #ff4d4f; box-shadow: 0 0 4px #ff4d4f; }
.daemon-info { flex: 1; }
.daemon-info .dn { font-weight: 600; font-size: 0.85rem; }
.daemon-info .dm { font-size: 0.72rem; color: #888; }

.op-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}
.op-log {
  font-size: 0.82rem;
  color: #555;
  max-height: 300px;
  overflow-y: auto;
}
.op-log .log-entry {
  padding: 5px 0;
  border-bottom: 1px solid #f5f5f5;
  display: flex;
  gap: 10px;
}
.op-log .log-time { color: #888; white-space: nowrap; }
.op-log .log-msg { flex: 1; }

/* ── Guest Search ── */
.guest-search { margin-bottom: 16px; }
.guest-search input {
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

/* ── Hamburger Menu (mobile) ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  color: #333;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ── Mobile Bottom Nav ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e8e8e8;
  z-index: 100;
  justify-content: space-around;
  padding: 4px 0 env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  font-size: 0.66rem;
  color: #888;
}
.bottom-nav a .bn-icon { font-size: 1.15rem; }
.bottom-nav a.active { color: #1890ff; }

/* ── Responsive: Tablet ── */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .checklist { grid-template-columns: 1fr; }
}

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open {
    display: flex;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 220px;
    z-index: 150;
  }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; padding-bottom: 56px; }
  .page-header { padding: 10px 14px; }
  .page-header h1 { font-size: 1rem; }
  .page-body { padding: 12px 14px 24px; }
  .hamburger { display: inline-block; }
  .bottom-nav { display: flex; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .stat-value { font-size: 1.3rem; }
  .filter-bar { gap: 6px; }
  .filter-bar input[type="text"] { min-width: 120px; }
  table { font-size: 0.78rem; }
  thead th, tbody td { padding: 6px 8px; }
  .daemon-list { grid-template-columns: 1fr; }
  .op-buttons { flex-direction: column; }
  .op-buttons .btn { width: 100%; text-align: center; }
}

/* ── Timeline bar (shared) ── */
.timeline-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 0;
  flex-wrap: wrap;
  font-size: 0.84rem;
}
.tb-step {
  padding: 4px 12px;
  border-radius: 16px;
  font-weight: 500;
  white-space: nowrap;
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.3;
}
.tb-step.done { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.tb-step.miss { background: #fff2f0; color: #cf1322; border: 1px solid #ffa39e; }
.tb-step.pend { background: #f5f5f5; color: #888; border: 1px solid #d9d9d9; }
.tb-arrow { color: #bbb; margin: 0 3px; font-size: 0.75rem; }

/* ── Section cards (detail page) ── */
.section-card { background:#fff; border-radius:6px; border:1px solid #e8e8e8; margin-bottom:8px; overflow:hidden; }
.section-card.ok { border-left:3px solid #52c41a; }
.section-card.miss { border-left:3px solid #ff4d4f; }
.sc-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; cursor:pointer; user-select:none;
  transition:background 0.12s;
}
.sc-header:hover { background:#fafafa; }
.sc-title { font-weight:600; font-size:0.9rem; display:flex; align-items:center; gap:6px; }
.sc-meta { display:flex; align-items:center; gap:6px; }
.sc-source { font-size:0.68rem; color:#aaa; background:#fafafa; padding:1px 6px; border-radius:3px; }
.sc-count { font-size:0.75rem; color:#888; }
.sc-toggle { font-size:0.75rem; color:#1890ff; }
.sc-detail-link { font-size:0.72rem; color:#aaa; margin-left:4px; }
.sc-detail-link:hover { color:#1890ff; }
.sc-body { display:none; padding:0 14px 12px; border-top:1px solid #f0f0f0; }
.sc-body.open { display:block; }
.sc-summary { font-size:0.82rem; color:#555; padding:8px 0 2px; }
.sc-loading { text-align:center; color:#bbb; padding:12px; font-size:0.8rem; }
.sc-table { width:100%; border-collapse:collapse; font-size:0.78rem; margin-top:6px; }
.sc-table th { background:#fafafa; padding:5px 8px; text-align:left; font-weight:600; color:#555; border-bottom:1px solid #e8e8e8; font-size:0.72rem; white-space:nowrap; }
.sc-table td { padding:4px 8px; border-bottom:1px solid #f5f5f5; vertical-align:top; max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:0.78rem; }
.sc-table td.long { max-width:400px; }
.sc-empty { color:#bbb; padding:10px 0; font-size:0.8rem; text-align:center; }

/* ── Section nav (sub-pages) ── */
.sd-nav { display:flex; gap:3px; flex-wrap:wrap; margin-bottom:12px; }
.sd-nav a { padding:4px 10px; border-radius:4px; font-size:0.76rem; color:#555; border:1px solid #e8e8e8; background:#fff; }
.sd-nav a:hover { border-color:#1890ff; color:#1890ff; text-decoration:none; }
.sd-nav a.active { background:#1890ff; color:#fff; border-color:#1890ff; }

/* ── Message cards ── */
.msg-card { transition: box-shadow 0.12s; }
.msg-card:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
.msg-expand { animation: msgSlide 0.15s ease; }
@keyframes msgSlide { from { opacity:0; max-height:0; } to { opacity:1; max-height:600px; } }

/* ── Misc ── */
.clickable { cursor: pointer; }
.clickable:hover { background: #f0f5ff; }
.text-right { text-align: right; }
.text-muted { color: #888; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.gap-info { cursor: help; border-bottom: 1px dotted #888; }
.placeholder-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: #bbb;
  font-size: 1rem;
}
