/* ==========================================================================
   ui-modern.css — 2026 新版视觉（浅色统一 · 卡片化 · 现代感）
   --------------------------------------------------------------------------
   加载顺序（index.html）：
       style.css → tokens.css → ui-refresh.css → ui-modern.css
   回滚方式：删掉 index.html 里 ui-modern.css 那一行 <link> 即可，
             业务与其它样式完全不受影响。

   本层只做视觉，不碰任何业务逻辑与业务语义色：
     · 房态四色 / 渠道三色 / 财务红绿 一律不动（老板靠这个认房）
     · 只改「外壳」：侧边栏配色、留白节奏、卡片语言、字体栈
   ========================================================================== */

/* ---- 1. 统一字体栈（和客人端 H5 一致） ---- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif !important;
  -webkit-font-smoothing: antialiased;
}

/* ---- 2. 侧边栏：深色 Navy(#1B2434) → 浅色统一外壳 ----
   旧版深色侧栏是"老气"的主因，且和手机端浅色底栏是两套色。
   这里统一成：白底 + 浅分隔线 + 品牌蓝激活条，和手机底部栏同语言。 */
.sidebar {
  background: var(--surface) !important;
  color: var(--ink-1) !important;
  border-right: 1px solid var(--line);
}
.sidebar-logo {
  border-bottom: 1px solid var(--line) !important;
  color: var(--ink-1) !important;
}
.sidebar-menu a {
  color: var(--ink-2) !important;
  border-left: 3px solid transparent;
  margin: 2px 10px 2px 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  transition:
    background-color var(--dur) var(--ease),
    color            var(--dur) var(--ease);
}
.sidebar-menu a:hover {
  background: var(--canvas) !important;
  color: var(--ink-1) !important;
}
.sidebar-menu a.active {
  background: var(--brand-soft) !important;
  color: var(--brand-ink) !important;
  border-left-color: var(--brand);
  font-weight: 600;
}
.sidebar-footer {
  border-top: 1px solid var(--line) !important;
  color: var(--ink-3) !important;
}
.sidebar-user {
  border-top: 1px solid var(--line) !important;
  color: var(--ink-2) !important;
}
.sidebar-user .user-name { color: var(--ink-1) !important; }
.sidebar-user .logout-link { color: var(--c-danger-ink) !important; }

/* ---- 3. 主内容区：更透气（借鉴客人端 H5 的留白节奏） ---- */
@media (min-width: 769px) {
  .main { padding: var(--sp-6) var(--sp-6) var(--sp-8) !important; }
  .topbar { margin-bottom: var(--sp-3); }
}

/* ---- 4. 卡片语言：白卡 + 圆角 + 内部发丝分隔线 ---- */
.room-group,
.board-top,
.settlement-panel,
.settings-section,
.fin-chart-section,
.empty-tip {
  border-radius: var(--r-lg);
}
.room-group { padding: var(--sp-4) !important; }
.room-group + .room-group { margin-top: var(--sp-3); }

/* 房卡内信息区加一条发丝分隔线，让"房号价 / 客人信息"两块分得清
   （客人端 H5 的 .g-info-row 就是这么切子区域的） */
@media (min-width: 769px) {
  .room-card .rc-info {
    border-top: 1px solid var(--line);
    padding-top: var(--sp-2);
    margin-top: var(--sp-2);
  }
}

/* ---- 5. 统计卡：数字更突出 ---- */
.stat-card .num { letter-spacing: -.02em; }

/* ==========================================================================
   6. 办理入住弹窗 —— 区域分组 + 摘要卡 + 紧凑选项
   --------------------------------------------------------------------------
   解决三个老问题：
     1. 信息平铺没分区 —— 4 个浅色 ci-section 卡（客人 / 客源 / 价格 / 收款）
     2. 顶部没摘要  —— ci-summary 横排：房号·房价·天数·预计房费
     3. 大 emoji + 2px 粗描边 —— 图标缩小到 16px，描边 1.5px，inline 排版
   ========================================================================== */

/* 6.1 弹窗头部：左侧色条 + 房间号徽章（不动 HTML，只改 h2 内 span 字号） */
.modal-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  position: relative;
}
.modal-header::before {
  content: "";
  width: 4px;
  height: 18px;
  background: var(--brand);
  border-radius: 2px;
  flex-shrink: 0;
}
.modal-header h2 {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink-2);
}
.modal-header h2 > span {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--brand);
  font-feature-settings: "tnum";
  letter-spacing: -.01em;
}

/* 6.2 摘要卡：开房前一眼看到房价/天数/预计 */
.ci-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand-soft);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.ci-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ci-summary-item-label {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.2;
}
.ci-summary-item-value {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink-1);
  line-height: 1.3;
  font-feature-settings: "tnum";
}
.ci-summary-item-value.is-price { color: var(--c-danger); }
.ci-summary-item-value.is-room  { color: var(--brand); }
.ci-summary-divider {
  width: 1px;
  height: 22px;
  background: var(--line-strong);
  flex-shrink: 0;
}

/* 6.3 分区分隔：参考轻量分隔式 —— 白底 + 发丝线 + 居中小标题（不再用灰色大卡） */
.ci-section {
  background: transparent;
  padding: 0 0 var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.ci-section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.ci-section-title {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: .08em;
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.ci-section-title::before { content: none; }
.ci-section .form-group { margin-bottom: var(--sp-3); }
.ci-section .form-group:last-child { margin-bottom: 0; }
.ci-section .form-group > label {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.ci-section .form-group > label > .req {
  color: var(--c-danger);
  font-weight: 700;
  margin-left: 2px;
}
/* 分段控件组的标签居中（参考图动线：渠道/类型组标题居中） */
.ci-seg-group > label { text-align: center; display: block; }

/* 6.4 通栏分段控件（参考 segmented control：选中实心品牌蓝白字） */
.ci-section .pay-methods {
  display: flex;
  gap: 0;
  padding: 3px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.ci-section .pay-method {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  padding: var(--sp-1) var(--sp-2);
  border: none;
  border-radius: calc(var(--r-md) - 3px);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  text-align: center;
  cursor: pointer;
}
.ci-section .pay-method .icon { font-size: 15px; line-height: 1; }
.ci-section .pay-method.selected {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* 6.5 同住人：标题行右侧放「添加同住人」链接（参考图动线）+ 浅灰卡片 */
.ci-companion-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.ci-companion-row > label { margin-bottom: 0; }
.ci-link-btn {
  background: transparent;
  border: none;
  color: var(--brand-ink);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 4px 8px;
  min-height: 32px;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background-color var(--dur) var(--ease);
}
.ci-link-btn:hover { background: var(--brand-soft); }
.ci-companion {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.ci-companion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-1);
}
.ci-companion-del {
  font-size: var(--fs-xs);
  color: var(--c-danger-ink);
  background: var(--c-danger-soft);
  padding: 2px 10px;
  border-radius: var(--r-sm);
  border: none;
  cursor: pointer;
  min-height: 28px;
  font-weight: 500;
}
.ci-companion-del:hover { background: var(--c-danger); color: #fff; }

/* 6.6 弹窗底部：主按钮全宽 + 取消按钮 ghost */
.ci-checkin-footer { gap: var(--sp-2); }
.ci-checkin-footer .btn-primary {
  flex: 1;
  min-height: 44px;
  font-weight: 600;
  font-size: var(--fs-base);
}
.ci-checkin-footer .btn-default {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  padding: var(--sp-2) var(--sp-4);
  min-height: 44px;
}
.ci-checkin-footer .btn-default:hover {
  color: var(--ink-1);
  background: var(--canvas);
}

/* 6.7 手机端：摘要更紧凑，分区/分段微调 */
@media (max-width: 768px) {
  .ci-summary { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); margin-bottom: var(--sp-3); }
  .ci-summary-item-value { font-size: var(--fs-sm); }
  .ci-summary-item-label { font-size: 10px; }
  .ci-summary-divider { height: 18px; }
  .ci-section { padding: 0 0 var(--sp-3); margin-bottom: var(--sp-3); }
  .ci-section .pay-method { min-height: 38px; padding: 4px 6px; font-size: 13px; }
  .ci-section .pay-method .icon { font-size: 14px; }
}

/* ==========================================================================
   7. 手机端所有弹窗加固 —— 治「弹窗要左右/上下滑才能看全」
   --------------------------------------------------------------------------
   现象：X5 系内核（QQ浏览器等）有时把 fixed 弹窗当普通文档流渲染，
   页面能滑、弹窗跟着滑、宽度还可能超屏。
   三层防御：
     ① 弹窗内 pay-methods 全部通栏分段化（和办理入住同款，天然窄屏友好）
     ② .modal overflow-x:hidden，内部内容再宽也只裁剪、不撑宽文档
     ③ html.modal-open 滚动锁：弹窗开着时冻结页面滚动（JS 在 app.js init）
   ========================================================================== */
@media (max-width: 768px) {
  .modal { overflow-x: hidden; }
  .modal .pay-methods {
    display: flex;
    gap: 0;
    padding: 3px;
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
  }
  .modal .pay-method {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 38px;
    padding: 4px 6px;
    border: none;
    border-radius: calc(var(--r-md) - 3px);
    background: transparent;
    color: var(--ink-2);
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
  }
  .modal .pay-method .icon { font-size: 14px; display: inline; margin: 0; }
  .modal .pay-method.selected {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
  }
  .modal .pay-method.selected .pm-sub { color: rgba(255,255,255,.85); }
  /* 滚动锁：弹窗开着时页面不许滑（配合 app.js 的 modal-open 类） */
  html.modal-open, html.modal-open body { overflow: hidden !important; }
}

/* ==========================================================================
   8. 手机房态日历一屏铺满 —— 治「日历要左右滑才能看全 5 天」
   --------------------------------------------------------------------------
   根因：.cal-table 是 table-layout:auto，预订胶囊/客人名的最小内容宽度
   把日期列撑到 ~75px，5 列 + 房间列 ≈ 435px > 390px 屏宽 → 出横向滚动。
   改 table-layout:fixed：房间列定宽 50px，5 个日期列均分剩余宽度
   （390 屏 ≈ 68px/列），内容超宽时在格内裁剪省略，表格永远正好一屏。
   ========================================================================== */
@media (max-width: 768px) {
  .cal-table { table-layout: fixed; }
  .cal-room-col { width: 50px !important; min-width: 50px !important; max-width: 50px !important; }
  .cal-date-col { min-width: 0; width: auto; }
  .cal-cell-body, .cal-guest { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .cal-cell-body .pill {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
    padding: 2px 2px;        /* 均分列 (~63px) 里也能放下 ¥58.06 整价 */
    letter-spacing: -.3px;   /* 再挤出 2-3px，订¥87.4 这类长胶囊也不截断 */
  }
}

/* ==========================================================================
   9. 添加消费弹窗（需求4）+ 中行码手续费（需求5）
   --------------------------------------------------------------------------
   移动端分段控件复用 §7 的 .modal .pay-methods 全栏样式（添加消费弹窗就在
   .modal 里，天然继承）；这里只补 PC 端分段外观、7 个选项的换行、
   已收开关、以及"实际到账"输入框的 PC-only / mobile-only 控制。
   ========================================================================== */

/* 9.1 添加消费弹窗：PC 端分段控件外观（与 §6.4 办理入住同款语言） */
@media (min-width: 769px) {
  .modal .bill-pay-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px;
    background: var(--canvas);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
  }
  .modal .bill-pay-methods .pay-method {
    flex: 1 1 13%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 36px;
    padding: var(--sp-1) var(--sp-2);
    border: none;
    border-radius: calc(var(--r-md) - 3px);
    background: transparent;
    color: var(--ink-2);
    font-size: var(--fs-sm);
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
  }
  .modal .bill-pay-methods .pay-method .icon { font-size: 15px; line-height: 1; }
  .modal .bill-pay-methods .pay-method.selected {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
  }
}
/* 手机端 7 个选项允许换行（两行各 4+3），避免一行塞 7 个被压扁 */
@media (max-width: 768px) {
  .modal .bill-pay-methods { flex-wrap: wrap; }
  .modal .bill-pay-methods .pay-method { flex: 1 1 24%; }
}

/* 9.2 已收开关：放大触达面积（老板手指点） */
.bill-paid-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink-1);
  cursor: pointer;
  min-height: 36px;
  margin-bottom: 0;
}
.bill-paid-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  flex-shrink: 0;
}

/* 9.3 对账页"实际到账"列：仅 PC 显示，手机隐藏（手机在金额列只读展示手续费） */
.pc-only { display: table-cell; }
.mobile-only { display: none; }
@media (max-width: 768px) {
  .pc-only { display: none !important; }
  .mobile-only { display: table-cell; }
}
.actual-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}
.actual-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-feature-settings: "tnum";
}
.actual-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
/* 手续费红色小标签（对账行 + 月报通用） */
.fee-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-danger);
  white-space: nowrap;
}

/* ==========================================================================
   10. 今日退房（需求2）：看板卡片 + 列表弹窗 + 分级提醒
   --------------------------------------------------------------------------
   复用 .rent-reminder-bar / .rent-reminder-chip 的骨架（与收租提醒同一语言），
   这里只补：红色左边条、红点、紧急高亮、列表条目排版、手机横幅色。
   ========================================================================== */

/* 10.1 看板卡片：红色左边条提示"要处理人"，无超时时用中性色 */
.checkout-reminder-bar { border-left: 4px solid var(--c-danger); }
.checkout-reminder-bar.co-lv-none,
.checkout-reminder-bar.co-lv-upcoming { border-left-color: var(--line-strong); }

/* 10.2 红点（已自动退房未已知悉的计数，常驻直到点已知悉） */
.co-red-dot {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 9px;
  background: var(--c-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}

/* 10.3 urgent/final 的到期 chip 高亮（红底白字，一眼看到该赶人了） */
.rent-reminder-chip.co-chip-urgent {
  background: var(--c-danger);
  border-color: var(--c-danger);
}
.rent-reminder-chip.co-chip-urgent b,
.rent-reminder-chip.co-chip-urgent > span { color: #fff !important; }

/* 10.4 列表弹窗条目 */
.co-item {
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
}
.co-item.co-urgent { border-left: 4px solid var(--c-danger); background: #fffafa; }
.co-item.co-done { opacity: .62; background: var(--canvas); }
.co-item-main {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.co-item-main .co-room {
  font-size: var(--fs-lg);
  color: var(--brand);
  font-feature-settings: "tnum";
}
.co-item-main .co-guest { font-weight: 600; color: var(--ink-1); }
.co-item-main .co-src { font-size: var(--fs-xs); color: var(--ink-3); }
.co-badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: var(--r-sm);
  background: var(--canvas);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.co-badge-month { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.co-item-sub {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin: 6px 0;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.co-item-btns {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* 10.5 手机横幅：退房超时用红底（区别于新订单的深色） */
.order-alert-bar.checkout-alert-banner {
  background: var(--c-danger);
  color: #fff;
}

/* ==========================================================================
   11. 物品损坏费拍照留证（需求3）
   ========================================================================== */

/* 11.1 缩略图网格（退房弹窗内预览，可删） */
.damage-photos {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}
.damage-photo-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--canvas);
}
.damage-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}
.damage-photo-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
.damage-photo-del:hover { background: var(--c-danger); }

/* 11.2 大图查看器（操作记录 / 弹窗预览共用，深色沉浸底） */
.photo-viewer-overlay {
  z-index: 1000;
  background: rgba(0, 0, 0, .82);
}
.photo-viewer {
  position: relative;
  max-width: min(92vw, 860px);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-viewer img {
  max-width: 100%;
  max-height: 88vh;
  border-radius: var(--r-md);
  box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
}
.photo-viewer-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--ink-1);
  font-size: 18px;
  line-height: 30px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.photo-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  color: var(--ink-1);
  font-size: 22px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
}
.photo-viewer-prev { left: -50px; }
.photo-viewer-next { right: -50px; }
.photo-viewer-count {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .85);
  font-size: 12px;
  font-feature-settings: "tnum";
}
@media (max-width: 768px) {
  .photo-viewer-prev { left: 8px; }
  .photo-viewer-next { right: 8px; }
}

/* ===== 第12节：ICP 备案页脚（2026-09-11 备案通过） ===== */
.icp-footer { padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); text-align: center; font-size: 12px; color: #8a94a6; }
.icp-footer a { color: inherit; text-decoration: none; margin-right: 8px; }

/* ===== 第13节：今天空白格二选一浮层（办理入住/挂为今日预订） ===== */
.plus-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  min-width: 220px;
  max-width: calc(100vw - 16px);
}
.plus-menu-title {
  font-size: 12px;
  color: var(--text-tertiary, #8a94a6);
  padding: 0 2px 2px;
}
.plus-opt-btn {
  padding: 10px 12px;
  min-height: 40px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  background: var(--canvas, #f7f8fa);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: all .12s;
  white-space: nowrap;
}
.plus-opt-btn:hover { background: #eef3ff; border-color: var(--brand, #2F6BFF); color: var(--brand, #2F6BFF); }
.plus-opt-btn.plus-opt-cancel { background: transparent; border-style: dashed; color: var(--text-tertiary, #8a94a6); font-weight: 400; }
.plus-opt-btn.plus-opt-cancel:hover { background: #f5f5f5; color: #666; border-color: #d9d9d9; }
