/* pages-room-ops.css —— S6 客房运营（数据概览）样式
 *
 * 命名空间：与 css/pages.css / css/pages-s4.css 同口径，**所有规则都以 .pages-room-ops / .pages-rops-* 开头**，
 * 不触碰 styles.css、css/pages.css、css/board2.css 的既有类名，可随时挂载/卸载。
 *
 * 依赖：必须 **排在 css/pages.css 之后**（品牌变量 --pg-brand / --pg-ink / --pg-line … 由 .pages 定义，
 * 本文件同时给 fallback，顺序写错也不丢色）。基础控件（.btn / .table / .table-wrap / .empty-state /
 * .callout / .pages-field）复用现有类的视觉，不重复定义。
 *
 * 断点：模块只在桌面（≥900px）挂载；≥1250px 为「1 大卡 + 2×2 小卡」的非对称布局（与 docs/20 §3.6 一致），
 * 900–1249px 降为两列，<900px 单列兜底（预览页 / 窄窗不塌）。
 *
 * 视觉基准（与 0.7 / S2S3 / S4 一致）：13px 正文、#087c61 主色、#dbe7f2 描边、14px 圆角面板、等宽数字。
 */

/* ========================================================================== */
/* 1. 变量与外壳                                                               */
/* ========================================================================== */
.pages-room-ops {
  --rops-brand: var(--pg-brand, #087c61);
  --rops-brand-deep: var(--pg-brand-deep, #0b3d66);
  --rops-ink: var(--pg-ink, #193b34);
  --rops-ink-soft: var(--pg-ink-soft, #31546e);
  --rops-muted: var(--pg-muted, #7c9188);
  --rops-line: var(--pg-line, #dbe7f2);
  --rops-line-soft: var(--pg-line-soft, #edf3f9);
  --rops-surface: var(--pg-surface, #ffffff);
  --rops-up: #0b8968;          /* docs/20 §7.5：正增长绿 */
  --rops-down: #c0392b;        /* docs/20 §7.5：负增长红 */
  --rops-flat: #6f8298;
  --rops-up-bg: #e6f5ee;
  --rops-down-bg: #fbeae7;
  --rops-flat-bg: #eef2f7;
  --rops-attention: #b5762a;
  --rops-attention-bg: #fdf2e2;

  position: relative;
}

.pages-room-ops *,
.pages-room-ops *::before,
.pages-room-ops *::after {
  box-sizing: border-box;
}

/* —— 页头：标题 + 固定口径声明 + 操作 —— */
.pages-rops-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
  padding: 18px 20px;
  background: var(--rops-surface);
  border: 1px solid var(--rops-line);
  border-radius: 14px;
  box-shadow: 0 5px 20px #37648a10;
}

.pages-rops-head-main {
  flex: 1 1 520px;
  min-width: 0;
}

.pages-rops-kicker {
  margin: 0 0 4px;
  color: var(--rops-muted);
  font-size: 11px;
  letter-spacing: .2px;
}

.pages-rops-title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
  color: var(--rops-ink);
}

.pages-rops-declaration {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  max-width: 92ch;
  color: var(--rops-ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.pages-rops-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

/* —— ⓘ 口径按钮（tooltip 用原生 title，点击展开页内口径框） —— */
.pages-rops-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid #c3d5cb;
  border-radius: 50%;
  background: #f4faf7;
  color: #4f7a68;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
}

.pages-rops-help:hover,
.pages-rops-help:focus-visible {
  border-color: var(--rops-brand);
  background: #e8f5ee;
  color: #0a5c46;
  outline: none;
}

.pages-rops-help-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid #cfe6db;
  border-left: 3px solid var(--rops-brand);
  border-radius: 10px;
  background: #f3faf6;
  color: #2f5d4c;
  font-size: 12px;
  line-height: 1.7;
}

.pages-rops-help-box strong {
  flex: 0 0 auto;
  color: #0a5c46;
}

.pages-rops-help-box p {
  flex: 1 1 320px;
  margin: 0;
}

/* —— 页内 tabs（数据概览 / 营业统计表 / 营收明细） —— */
.pages-rops-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 0 4px;
  border-bottom: 1px solid var(--rops-line);
}

.pages-rops-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--rops-ink-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pages-rops-tab:hover:not(:disabled) {
  color: var(--rops-brand);
}

.pages-rops-tab.is-active {
  border-bottom-color: var(--rops-brand);
  color: var(--rops-brand);
}

.pages-rops-tab:disabled {
  color: #9aab9f;
  cursor: not-allowed;
}

.pages-rops-soon {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--rops-flat-bg);
  color: #6f8298;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .3px;
}

/* ========================================================================== */
/* 2. 区间工具条                                                               */
/* ========================================================================== */
.pages-rops-range {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--rops-surface);
  border: 1px solid var(--rops-line);
  border-radius: 14px;
  box-shadow: 0 5px 20px #37648a10;
}

/* 第一行：8 个快捷区间；第二行：日期区间 + 粒度/对比/查询（放不下才折行）；第三行：说明 */
.pages-rops-quick {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pages-rops-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.pages-rops-quick-btn {
  padding: 7px 11px;
  min-height: 32px;
  border: 1px solid var(--rops-line);
  border-radius: 8px;
  background: #fff;
  color: #3d5c4f;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}

.pages-rops-quick-btn:hover {
  border-color: #7ebc9e;
  background: #f6fcf9;
}

.pages-rops-quick-btn.is-active {
  border-color: var(--rops-brand);
  background: #e9f7f0;
  color: #0a5c46;
  box-shadow: 0 0 0 2px #087c611a;
}

.pages-rops-dates {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex: 0 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}

.pages-rops-dates .pages-field {
  flex: 0 0 auto;
}

.pages-rops-dates input[type="date"] {
  width: 150px;
}

.pages-rops-tilde {
  align-self: center;
  padding-bottom: 9px;
  color: var(--rops-muted);
  font-size: 12px;
}

.pages-rops-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

/* 标签文字不折行；下拉给固定宽度，避免「对比」被压成竖排或选项文字被裁 */
.pages-rops-controls .pages-field-inline {
  white-space: nowrap;
  flex: 0 0 auto;
}

.pages-rops-controls select {
  width: 128px;
  min-width: 128px;
}

.pages-rops-controls select[name="compare"] {
  width: 186px;
  min-width: 186px;
}

.pages-rops-range-hint {
  margin: 0;
}

/* ========================================================================== */
/* 3. KPI 卡（1 大卡 + 2×2 小卡 + 口径条）                                     */
/* ========================================================================== */
.pages-rops-kpis-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pages-rops-kpis {
  display: grid;
  grid-template-columns: minmax(280px, 1.18fr) repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(118px, auto);
  gap: 12px;
}

.pages-rops-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 15px 16px;
  background: var(--rops-surface);
  border: 1px solid var(--rops-line);
  border-radius: 13px;
  box-shadow: 0 4px 16px #37648a0d;
}

.pages-rops-kpi-main {
  grid-row: span 2;
  justify-content: space-between;
  gap: 10px;
  background:
    radial-gradient(120px 120px at 108% -12%, #e4f5ec 0%, #e4f5ec00 70%),
    linear-gradient(180deg, #fbfefc 0%, #ffffff 58%);
  border-color: #cfe6db;
}

.pages-rops-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pages-rops-kpi-label {
  display: inline-flex;
  align-items: center;
  color: #5d7a6c;
  font-size: 12px;
  font-weight: 800;
}

.pages-rops-kpi-sub {
  color: var(--rops-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2px;
}

.pages-rops-kpi-value {
  color: var(--rops-ink);
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.pages-rops-kpi-main .pages-rops-kpi-value {
  font-size: 36px;
}

.pages-rops-kpi-note {
  color: var(--rops-muted);
  font-size: 11px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* —— 环比：正绿 ▲ / 负红 ▼ / 无数据「—」 —— */
.pages-rops-delta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  color: var(--rops-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.pages-rops-delta strong {
  font-weight: 800;
}

.pages-rops-delta[data-tone="up"] {
  color: var(--rops-up);
}

.pages-rops-delta[data-tone="down"] {
  color: var(--rops-down);
}

.pages-rops-delta[data-tone="flat"] {
  color: var(--rops-flat);
}

.pages-rops-delta[data-tone="none"] {
  color: var(--rops-muted);
}

.pages-rops-delta[data-tone="none"] strong {
  color: #647a6e;
}

.pages-rops-delta-note {
  color: var(--rops-muted);
  font-size: 10px;
  font-weight: 400;
}

/* —— 大卡营收拆分（有效 / 已删除 / 其他消费） —— */
.pages-rops-split {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed #cfe4da;
}

.pages-rops-split > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.pages-rops-split dt {
  color: var(--rops-muted);
  font-size: 11px;
  font-weight: 700;
}

.pages-rops-split dd {
  margin: 0;
  color: var(--rops-ink-soft);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* —— 口径条：可售房晚 / 订间夜 / 日租率（分母显式化，避免用户猜） —— */
.pages-rops-denoms {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pages-rops-denom {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--rops-line-soft);
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--rops-ink-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pages-rops-denom em {
  color: var(--rops-muted);
  font-style: normal;
  font-weight: 700;
}

.pages-rops-denom strong {
  font-size: 13px;
  font-weight: 800;
}

.pages-rops-denom small {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--rops-flat-bg);
  color: #6f8298;
  font-size: 9px;
  font-weight: 800;
}

.pages-rops-denom.is-muted strong {
  color: #8ea197;
}

/* ========================================================================== */
/* 4. 趋势图（自绘 SVG）                                                       */
/* ========================================================================== */
.pages-rops-panel {
  padding: 16px 18px;
  min-width: 0;
}

.pages-rops-panel-head {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pages-rops-panel-title {
  margin: 0;
  color: var(--rops-ink);
  font-size: 14px;
}

.pages-rops-chart-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: 9px;
  background: #f1f6f3;
}

.pages-rops-chart-tab {
  padding: 6px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #628072;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pages-rops-chart-tab:hover {
  color: var(--rops-brand);
}

.pages-rops-chart-tab.is-active {
  background: #fff;
  color: #0a5c46;
  box-shadow: 0 2px 7px #213b2616;
}

.pages-rops-gran {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  border-radius: 8px;
  background: #f1f6f3;
}

.pages-rops-gran-btn {
  min-width: 38px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #628072;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.pages-rops-gran-btn.is-active {
  background: #fff;
  color: #0a5c46;
  box-shadow: 0 2px 7px #213b2616;
}

.pages-rops-chart-body {
  position: relative;
  min-height: 180px;
  border-radius: 10px;
  outline: none;
}

.pages-rops-chart-body:focus-visible {
  box-shadow: 0 0 0 3px #087c6122;
}

.pages-rops-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.pages-rops-plot-bg {
  fill: #fbfdfe;
  stroke: #eef4f0;
}

.pages-rops-grid-line {
  stroke: #e3ece7;
  stroke-width: 1;
  stroke-dasharray: 4 5;
}

.pages-rops-baseline {
  stroke: #cfded7;
  stroke-width: 1;
}

.pages-rops-axis {
  fill: #7c9188;
  font-family: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pages-rops-area {
  fill: #087c611f;
  stroke: none;
}

.pages-rops-line {
  fill: none;
  stroke: var(--rops-brand);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.pages-rops-dot {
  fill: #fff;
  stroke: var(--rops-brand);
  stroke-width: 1.6;
}

.pages-rops-cross {
  stroke: #7fae9b;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.pages-rops-active-dot {
  fill: var(--rops-brand);
  stroke: #fff;
  stroke-width: 2;
}

.pages-rops-chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--rops-muted);
  font-size: 12px;
}

.pages-rops-chart-empty {
  padding: 34px 16px;
}

.pages-rops-chart-empty .btn {
  margin-top: 10px;
}

/* —— hover tooltip —— */
.pages-rops-tip {
  position: absolute;
  z-index: 6;
  min-width: 168px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #10312b;
  color: #e8f4ee;
  box-shadow: 0 12px 28px #0b2b2433;
  font-size: 11px;
  line-height: 1.55;
  transform: translateX(-50%);
  pointer-events: none;
}

.pages-rops-tip[hidden] {
  display: none;
}

.pages-rops-tip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 5px;
  margin-bottom: 5px;
  border-bottom: 1px solid #ffffff26;
}

.pages-rops-tip-head strong {
  color: #fff;
  font-size: 12px;
}

.pages-rops-tip-head span {
  color: #9ec4b5;
  font-size: 10px;
}

.pages-rops-tip-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}

.pages-rops-tip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.pages-rops-tip-row dt {
  color: #a9c9bb;
  font-weight: 400;
}

.pages-rops-tip-row dd {
  margin: 0;
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pages-rops-tip-row.is-active dt,
.pages-rops-tip-row.is-active dd {
  color: #7ce0b6;
}

.pages-rops-chart-foot {
  margin: 8px 0 0;
  color: var(--rops-muted);
  font-size: 11px;
  line-height: 1.6;
}

/* ========================================================================== */
/* 5. 对比表 / 明细表                                                          */
/* ========================================================================== */
.pages-rops-table th,
.pages-rops-table td {
  padding: 10px 12px;
}

.pages-rops-table thead th {
  color: #7c9188;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.pages-rops-table tbody th[scope="row"] {
  position: static;
  padding: 11px 12px;
  background: transparent;
  color: var(--rops-ink);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.pages-rops-table tbody tr:hover th[scope="row"] {
  background: #fafdff;
}

.pages-rops-table tbody td {
  color: #35564a;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pages-rops-range-text {
  display: block;
  margin-top: 2px;
  color: var(--rops-muted);
  font-size: 10px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.pages-rops-compare tbody tr[data-rops-compare-row="delta"] td {
  border-top: 1px solid var(--rops-line-soft);
  font-weight: 700;
}

.pages-rops-details {
  padding: 12px 16px;
  background: var(--rops-surface);
  border: 1px solid var(--rops-line);
  border-radius: 12px;
  box-shadow: 0 4px 14px #37648a0d;
}

.pages-rops-details > summary {
  cursor: pointer;
  color: #41604e;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.pages-rops-details > summary::-webkit-details-marker {
  display: none;
}

.pages-rops-details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: var(--rops-muted);
  transition: transform .12s;
}

.pages-rops-details[open] > summary::before {
  transform: rotate(90deg);
}

.pages-rops-series-wrap {
  margin-top: 10px;
  max-height: 360px;
  overflow: auto;
}

.pages-rops-series-wrap .pages-table {
  min-width: 720px;
}

.pages-rops-callout {
  margin-top: 0;
  line-height: 1.75;
}

/* ========================================================================== */
/* 6. 加载骨架 / 空态 / 状态条                                                 */
/* ========================================================================== */
.pages-rops-skeleton .pages-rops-kpi {
  justify-content: flex-start;
}

.pages-rops-sk-line {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eaf1ec 0%, #f5faf7 50%, #eaf1ec 100%);
  background-size: 220% 100%;
  animation: pages-rops-shimmer 1.4s ease-in-out infinite;
}

.pages-rops-sk-line.tall {
  height: 30px;
}

.pages-rops-sk-line.w40 { width: 40%; }
.pages-rops-sk-line.w50 { width: 50%; }
.pages-rops-sk-line.w60 { width: 60%; }
.pages-rops-sk-line.w70 { width: 70%; }

@keyframes pages-rops-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -80% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pages-rops-sk-line { animation: none; }
}

.pages-rops-flash {
  background: #f3faf6;
  border-color: #d5ebdf;
  color: #2f5d4c;
}

.pages-rops-empty {
  padding: 34px 16px;
}

.pages-rops-empty .btn {
  margin-top: 10px;
}

/* ========================================================================== */
/* 7. 响应式                                                                   */
/* ========================================================================== */
@media (max-width: 1249px) {
  .pages-rops-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pages-rops-kpi-main {
    grid-row: span 1;
    grid-column: 1 / -1;
  }

  .pages-rops-kpi-main .pages-rops-kpi-value {
    font-size: 32px;
  }
}

@media (max-width: 1150px) {
  .pages-rops-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .pages-rops-controls {
    justify-content: flex-start;
    margin-left: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 899px) {
  .pages-rops-head {
    padding: 14px 15px;
  }

  .pages-rops-head-actions {
    width: 100%;
  }

  .pages-rops-head-actions .btn {
    flex: 1 1 auto;
  }

  .pages-rops-kpis {
    grid-template-columns: minmax(0, 1fr);
  }

  .pages-rops-kpi-main {
    grid-column: auto;
  }

  .pages-rops-dates,
  .pages-rops-controls {
    width: 100%;
  }

  .pages-rops-quick-btn {
    flex: 1 1 auto;
  }

  .pages-rops-dates .pages-field {
    flex: 0 0 auto;
  }

  .pages-rops-controls .pages-field {
    flex: 1 1 46%;
  }

  .pages-rops-controls .btn {
    flex: 1 1 100%;
  }

  .pages-rops-gran {
    margin-left: 0;
  }

  .pages-rops-compare .table-wrap,
  .pages-rops-series-wrap {
    overflow-x: auto;
  }

  .pages-rops-compare .pages-table {
    min-width: 640px;
  }
}

/* ========================================================================== */
/* 8. 打印（口径声明与表格保留；交互控件隐藏）                                  */
/* ========================================================================== */
@media print {
  .pages-rops-range,
  .pages-rops-tabs,
  .pages-rops-head-actions,
  .pages-rops-chart-tabs,
  .pages-rops-gran,
  .pages-rops-help,
  .pages-rops-denoms .pages-rops-denom small,
  .pages-rops-tip {
    display: none !important;
  }

  .pages-rops-head,
  .pages-rops-kpi,
  .pages-rops-panel,
  .pages-rops-details {
    border: 0;
    box-shadow: none;
  }

  .pages-rops-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pages-rops-kpi-main {
    grid-column: 1 / -1;
    grid-row: span 1;
  }

  .pages-rops-table {
    font-size: 10px;
  }

  .pages-rops-table th,
  .pages-rops-table td {
    padding: 6px 8px;
  }
}
