/* ================= 后台样式 ================= */
:root {
  --brand: #4a9edc;
  --brand-dark: #2f7cb2;
  --brand-soft: #eaf5fd;
  --text: #22323d;
  --muted: #8496a3;
  --line: #e8f0f6;
  --bg: #f4f9fd;
  --danger: #d9534f;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6;
}
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, #8ed0f2, #4a9edc 55%, #2c6c9e);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 20px;
  padding: 30px 26px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); text-align: center;
}
.brand-mark {
  width: 46px; height: 46px; border-radius: 14px; margin: 0 auto 14px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark.small { width: 36px; height: 36px; border-radius: 11px; font-size: 16px; margin: 0; }
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-tip { font-size: 12px; color: #9aa5aa; margin: 14px 0 0; }
.login-tip code { background: #f2f5f4; padding: 1px 5px; border-radius: 4px; }
.link-back { display: inline-block; margin-top: 16px; font-size: 12px; color: #8b969b; text-decoration: none; }

.pass-wrap { position: relative; display: block; }
.pass-wrap input { padding-right: 56px; }
.pass-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: #eef3f1; color: #5c686d; font-size: 12px;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; font-family: inherit;
}
.login-msg {
  margin: -4px 0 12px; font-size: 12.5px; color: #b4342a;
  background: #fdf1ef; border: 1px solid #f7dcd7; border-radius: 8px;
  padding: 7px 10px; text-align: left;
}
.forgot-link {
  display: inline-block; margin-top: 12px; font-size: 12px;
  color: #8b969b; text-decoration: none; border-bottom: 1px dashed #ccd5d2;
}
.js-error {
  margin: 14px 0 0; font-size: 12px; color: #b4342a;
  background: #fdf1ef; border-radius: 8px; padding: 8px 10px; text-align: left;
}
.storage-warn {
  margin: 0 0 16px; font-size: 12.5px; color: #8a5a00;
  background: #fff7e6; border: 1px solid #f6e0b5; border-radius: 10px;
  padding: 9px 12px; line-height: 1.6;
}

/* ---------- 表单元素 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 14px; }
.field > span:first-child { font-size: 12px; color: #5c686d; font-weight: 600; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  border: 1px solid #dfe5e3; border-radius: 10px; padding: 10px 12px;
  background: #fbfcfc; outline: none; width: 100%; transition: .16s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(14, 124, 102, .1);
}
textarea { resize: vertical; }
.btn-primary {
  border: none; background: var(--brand); color: #fff; font-weight: 600;
  font-size: 14px; padding: 11px 18px; border-radius: 10px; cursor: pointer;
  font-family: inherit; width: 100%; transition: .16s;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary.inline { width: auto; }
.btn-ghost {
  border: 1px solid #dfe5e3; background: #fff; color: #46534e;
  font-size: 14px; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  font-family: inherit; display: inline-flex; align-items: center; justify-content: center;
}
.btn-ghost:hover { border-color: #c8d2cf; background: #fafcfb; }
.btn-link {
  border: none; background: #f1f4f3; color: #46534e; font-size: 12.5px;
  padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none;
  font-family: inherit;
}
.btn-link.danger { color: var(--danger); background: #fdf1ef; }

/* ---------- 顶栏 ---------- */
.admin { max-width: 1080px; margin: 0 auto; padding: 22px 20px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.topbar-left { display: flex; align-items: center; gap: 11px; }
.topbar h1 { font-size: 17px; }
.topbar-sub { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; gap: 8px; }

.tabs { display: flex; gap: 6px; background: #eaeff0; padding: 4px; border-radius: 12px; margin-bottom: 18px; width: fit-content; }
.tab {
  border: none; background: transparent; font-size: 13.5px; color: #5c686d;
  padding: 8px 18px; border-radius: 9px; cursor: pointer; font-family: inherit;
}
.tab.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }

/* ---------- 面板 ---------- */
.panel { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: 0 4px 16px rgba(16, 40, 34, .05); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-pill {
  background: #f5f8f7; border: 1px solid #e8eeec; border-radius: 10px;
  padding: 7px 13px; font-size: 12px; color: #5c686d;
}
.stat-pill b { color: var(--text); font-size: 15px; margin-right: 3px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 180px; }
.toolbar select { width: 150px; }

.table-wrap { overflow-x: auto; }
.room-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
.room-table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fbfcfc;
}
.room-table td { padding: 10px; border-bottom: 1px solid #f2f5f4; vertical-align: middle; }
.room-table tr:hover td { background: #fafcfb; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  padding: 3px 9px; border-radius: 999px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; font-family: inherit;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.vacant { background: #e8f7ef; color: #0b8a5f; }
.pill.rented { background: #f0f2f3; color: #8a949a; }
.thumb-mini { width: 46px; height: 34px; border-radius: 6px; object-fit: cover; background: #eef1f0; display: block; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.mini-btn {
  border: 1px solid #e3e9e7; background: #fff; border-radius: 7px; cursor: pointer;
  font-size: 12px; padding: 4px 10px; color: #46534e; font-family: inherit;
}
.mini-btn:hover { border-color: var(--brand); color: var(--brand); }
.mini-btn.del:hover { border-color: #e2b4ae; color: var(--danger); }
.empty-row { text-align: center; color: var(--muted); padding: 30px 0; font-size: 13px; }
.hint { font-size: 12px; color: #96a1a5; margin: 12px 0 0; }

/* ---------- 设置 / 备份 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { flex-direction: row; gap: 10px; margin-top: 4px; }
.backup-box h2 { font-size: 15px; margin-bottom: 8px; }
.backup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.danger-text { color: var(--danger); }
.backup-meta { font-size: 12px; color: var(--muted); }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(12, 22, 19, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; z-index: 200; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: #fff; border-radius: 18px; width: 100%; max-width: 720px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px); opacity: .6 } to { transform: none; opacity: 1 } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; border-radius: 18px 18px 0 0; z-index: 2;
}
.modal-head h2 { font-size: 16px; }
.icon-btn { border: none; background: #f3f5f4; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: #5c686d; }
.modal-body { padding: 18px 20px 20px; }
.form-section { font-size: 13px; font-weight: 700; color: var(--brand); margin: 6px 0 12px; }
.form-section + .form-grid { margin-bottom: 6px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.modal-foot .btn-primary { width: auto; min-width: 110px; }

.uploader { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload-btn {
  border: 1px dashed #cbd6d2; background: #fafcfb; border-radius: 10px;
  padding: 9px 16px; font-size: 13px; color: var(--brand); cursor: pointer; font-weight: 600;
}
.upload-btn:hover { background: var(--brand-soft); border-color: var(--brand); }
.inline-hint { margin: 0; }
.thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb {
  position: relative; width: 92px; height: 70px; border-radius: 9px; overflow: hidden;
  border: 1px solid #e6ecea; background: #f2f5f4;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .cover-flag {
  position: absolute; left: 0; bottom: 0; font-size: 10px; color: #fff;
  background: rgba(14, 124, 102, .9); padding: 1px 6px; border-radius: 0 6px 0 6px;
}
.thumb .del {
  position: absolute; right: 3px; top: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; border: none; cursor: pointer;
  font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.thumb .set-cover {
  position: absolute; left: 3px; top: 3px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .88); color: #33403c; font-size: 10px;
  border-radius: 5px; padding: 1px 5px;
}

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 12px);
  background: rgba(23, 32, 29, .92); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .22s; z-index: 300;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 680px) {
  .admin { padding: 16px 12px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .toolbar select { width: 100%; }
  .tabs { width: 100%; }
  .tab { flex: 1; }
}

/* ---------- 楼栋管理 ---------- */
.panel-title { font-size: 15px; font-weight: 700; }
.panel-desc { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.bld-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.bld-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: linear-gradient(180deg, #fcfdff, #f8fbfe);
}
.bld-row-main { min-width: 0; }
.bld-row-title { display: flex; align-items: center; gap: 8px; }
.bld-row-name { font-size: 15px; font-weight: 700; color: #22323d; }
.bld-floor {
  font-size: 11px; font-weight: 600; color: var(--brand-dark);
  background: var(--brand-soft); padding: 2px 8px; border-radius: 999px;
}
.bld-row-meta { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.bld-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.inline-form {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  border-top: 1px dashed var(--line); padding-top: 16px; margin-top: 4px;
}
.inline-form input { flex: 1; min-width: 140px; }
.inline-form input[name="bldFloors"] { flex: 0 0 110px; min-width: 90px; }

.mini-btn:disabled { opacity: .38; cursor: not-allowed; }

/* ---------- 广告图管理 ---------- */
.banner-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.banner-row {
  display: flex; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  background: #fff;
}
.banner-thumb {
  width: 132px; height: 78px; flex-shrink: 0; border-radius: 10px;
  overflow: hidden; background: #eff6fb; display: flex;
  align-items: center; justify-content: center; color: #a9bac6; font-size: 12px;
}
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-info { flex: 1; min-width: 0; }
.banner-row-title { margin: 0; font-size: 14px; font-weight: 600; color: #22323d; }
.banner-row-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.banner-row-link { margin: 4px 0 0; font-size: 11px; color: var(--brand); word-break: break-all; }
.banner-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.thumb.wide { width: 100%; height: 148px; }
.thumb.wide img { object-fit: cover; }
.modal-card.narrow { max-width: 560px; }

@media (max-width: 680px) {
  .banner-row { flex-wrap: wrap; }
  .banner-thumb { width: 100%; height: 130px; }
  .banner-actions { width: 100%; justify-content: flex-start; }
}

.thumb.wide { flex: 1 1 100%; }

/* ===== 分页 ===== */
.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 4px 2px; flex-wrap: wrap;
}
.pager:empty { display: none; }
.pager-info { font-size: 12px; color: var(--muted); }
.pager .mini-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ===== 视频上传 ===== */
.video-row { display: flex; gap: 10px; align-items: stretch; }
.video-row input { flex: 1; }
.video-up-btn { white-space: nowrap; cursor: pointer; }
.video-up-btn.loading { opacity: .55; pointer-events: none; }
#videoPreview {
  display: block; width: 100%; max-height: 200px; margin-top: 8px;
  border-radius: 10px; background: #0b1520;
}
#videoPreview[hidden] { display: none; }

/* ===== 房源表格：缩略图 + 项目名 ===== */
.cell-room { display: flex; align-items: center; gap: 10px; }
.cell-room .thumb-mini { flex: 0 0 52px; }
.cell-room .cell-title { white-space: nowrap; }

/* ===== 推荐状态标签 ===== */
.pill.feat { background: #fff4e5; color: #b26b00; border-color: #ffe0b2; }
.pill.feat-off { background: #f4f7f9; color: #8a9aa5; border-color: var(--line); }

/* ===== 项目封面缩略图 ===== */
.proj-row { align-items: center; }
.proj-thumb {
  width: 108px; height: 66px; flex: 0 0 108px; border-radius: 10px;
  overflow: hidden; background: #eff6fb; display: flex; align-items: center;
  justify-content: center; color: #a9bac6; font-size: 12px;
}
.proj-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== 复选框字段 ===== */
.checkbox-field { flex-direction: row; align-items: center; gap: 9px; }
.checkbox-field input[type="checkbox"] { width: auto; flex: 0 0 auto; }
.checkbox-field > span { font-size: 13px; color: #33454f; font-weight: 500; }

@media (max-width: 680px) {
  .proj-row { flex-wrap: wrap; }
  .proj-thumb { width: 100%; height: 130px; flex: 1 1 100%; }
}
