/* ============================================================
   房源出租看板 — 样式
   配色取自参考截图取样：底 #f1f6f7 / 在租 #df4e4b / 空置 #349d63 / 主色 #0575aa
   ============================================================ */

:root {
  --bg: #f1f6f7;
  --card: #ffffff;
  --ink: #141414;
  --ink-2: #4a4d4f;
  --muted: #848889;
  --label: #8e908f;
  --line: #e6ebeb;
  --line-soft: #eef2f2;

  --red: #df4e4b;
  --red-ink: #c54847;
  --green: #349d63;
  --green-ink: #328351;
  --blue: #0575aa;
  --blue-ink: #0275a9;
  --blue-track: rgba(5, 117, 170, 0.16);

  --radius-card: 10px;
  --radius-block: 6px;
  --shadow-card: 0 1px 2px rgba(16, 42, 51, 0.04), 0 2px 10px rgba(16, 42, 51, 0.03);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

/* 关键：作者样式的 display 会覆盖 [hidden]，必须显式兜底 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  max-width: 1680px;
  margin: 0 auto;
  padding: 34px 40px 56px;
}

/* ---------------- 头部 ---------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.head-title h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.25;
}

.head-title .sub {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.btn-ghost {
  background: transparent;
  border-color: #d9dee0;
  color: var(--ink-2);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.75); border-color: #c6cdd0; }

.btn-primary {
  background: var(--blue-ink);
  color: #fff;
  border-color: var(--blue-ink);
}
.btn-primary:hover { background: #016a9a; border-color: #016a9a; }
.btn-primary:disabled { opacity: 0.62; cursor: default; }
.btn-sm { height: 32px; padding: 0 18px; }

.btn.is-loading svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 提示条 ---------------- */

.banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  background: #fff8e8;
  border: 1px solid #f5e0b3;
  color: #7a5a12;
}
.banner-main { display: flex; flex-direction: column; gap: 4px; }
.banner-text { font-weight: 500; }
.banner-more > summary {
  cursor: pointer;
  font-size: 12.5px;
  color: #9a7a2a;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.banner-more > summary::-webkit-details-marker { display: none; }
.banner-more > summary::before {
  content: "";
  width: 5px; height: 5px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}
.banner-more[open] > summary::before { transform: rotate(45deg); }
.banner-more pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.035);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: #6b7175;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 180px;
  overflow: auto;
}
.banner.is-info {
  background: #eef6fb;
  border-color: #cfe3ef;
  color: #1e5b78;
}
.banner.is-info .banner-more > summary { color: #2c6f90; }
.banner.is-error { background: #fdeeee; border-color: #f3c9c9; color: #9c2b2b; }

/* ---------------- 指标卡 ---------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 26px;
}

.stat {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 20px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 14px;
  color: var(--label);
  line-height: 1.3;
}

.stat-value {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}
.stat-value.is-red { color: var(--red-ink); }
.stat-value.is-green { color: var(--green-ink); }
.stat-value.is-blue { color: var(--blue); }
.stat-value.is-empty { color: var(--muted); font-weight: 400; }

.stat-sub {
  margin-top: auto;
  padding-top: 12px;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stat-sub .num { color: var(--ink-2); }

.stat-track {
  margin-top: 12px;
  height: 6px;
  border-radius: 3px;
  background: var(--blue-track);
  overflow: hidden;
}
.stat-track > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------- 筛选 ---------------- */

.filters {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
}
.filter-label { color: var(--ink-2); }

.select { position: relative; display: inline-flex; }
.select::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.select select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid #dfe5e6;
  border-radius: 7px;
  height: 32px;
  min-width: 96px;
  padding: 0 30px 0 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}
.select select:hover { border-color: #c9d2d4; background: rgba(255, 255, 255, 0.6); }
.select select:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.filters-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 楼层卡片 ---------------- */

.section-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}

.floors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px 30px;
  align-items: start;
}

.floor {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px 18px 18px;
}

.floor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.floor-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.floor-area {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.floor-meta {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-2);
}
.floor-meta .pair { display: inline-flex; gap: 4px; }
.floor-meta .k { color: #6b7175; }
.floor-meta .v { color: var(--blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.floor-meta .v.is-zero { color: #b5bcbe; }

.floor-rate {
  margin-top: 11px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.floor-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--blue-track);
  overflow: hidden;
}
.floor-track > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.floor-pct {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue);
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rooms {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.room {
  height: 54px;
  border: 0;
  border-radius: var(--radius-block);
  color: #fff;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 0 4px;
  transition: transform 0.12s ease, filter 0.16s ease;
  will-change: transform;
}
.room:hover { filter: brightness(1.06); transform: translateY(-1px); }
.room:active { transform: translateY(0); }
.room:focus-visible { outline: 2px solid #141414; outline-offset: 2px; }

.room .no {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room .st {
  font-size: 11px;
  line-height: 1.1;
  opacity: 0.92;
}

.room.is-rented { background: var(--red); }
.room.is-vacant { background: var(--green); }

.empty {
  grid-column: 1 / -1;
  padding: 48px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--card);
  border-radius: var(--radius-card);
}

/* ---------------- 页脚 ---------------- */

.page-foot {
  margin-top: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #9aa2a4;
}
.page-foot .dot { color: #c3cbcd; }

/* ---------------- 弹窗 ---------------- */

.modal-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-root[hidden] { display: none; }

.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); animation: fade 0.16s ease; }

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(9, 28, 36, 0.24);
  display: flex;
  flex-direction: column;
  animation: pop 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
  outline: none;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 600; }

.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent;
  color: #6b7175; cursor: pointer;
  transition: background-color 0.16s ease;
}
.icon-btn:hover { background: #f2f5f6; }
.icon-btn svg { width: 14px; height: 14px; }

.modal-body { padding: 14px 20px 4px; overflow-y: auto; }

.room-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-radius: 8px;
  color: #fff;
}
.room-banner .b-no { font-size: 22px; font-weight: 700; letter-spacing: 0.4px; }
.room-banner .b-st { font-size: 15px; }
.room-banner.is-rented { background: var(--red); }
.room-banner.is-vacant { background: var(--green); }

.detail-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
}
.detail-item .k {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.detail-item .v {
  margin-top: 5px;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.45;
  word-break: break-word;
}
.detail-item .v.is-null { color: #b5bcbe; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  padding: 16px 20px 20px;
}

/* ---------------- toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(24, 30, 33, 0.92);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 80;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  animation: pop 0.18s ease;
}
.toast[hidden] { display: none; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1400px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .floors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .page { padding: 24px 20px 40px; }
  .head-title h1 { font-size: 23px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .floors { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .filters-meta { margin-left: 0; width: 100%; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat { min-height: 0; }
  .page-head { flex-direction: column; }
  .head-actions { padding-top: 0; }
  .rooms { gap: 8px; }
  .room { height: 50px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
