:root {
  --primary: #2563EB;
  --primary-dark: #1E40AF;
  --primary-light: #EFF6FF;
  --accent: #F59E0B;
  --text: #1F2329;
  --muted: #646A73;
  --line: #DEE3E8;
  --bg: #F7F8FA;
  --danger: #DC2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg); font-size: 14px;
}

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary-dark); }
.login-card { background: #fff; border-radius: 12px; padding: 36px 40px; width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.login-title { font-size: 18px; font-weight: 700; }
.login-sub { font-size: 13px; color: var(--muted); margin: 4px 0 24px; }
.login-hint { font-size: 12px; color: var(--muted); margin-top: 12px; text-align: center; }

/* ---------- 布局 ---------- */
/* hidden 属性必须生效：显式 display 会覆盖 HTML hidden，登录/主页视图切换靠它控制 */
.login-wrap[hidden],
.main-wrap[hidden] { display: none !important; }
.main-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; }
.brand { padding: 20px 18px; font-weight: 700; font-size: 16px; color: var(--primary-dark); line-height: 1.5; border-bottom: 1px solid var(--line); }
.nav { flex: 1; padding: 12px 10px; }
.nav-item { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; margin-bottom: 4px; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.sidebar-foot { padding: 12px 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.hotel-label { font-size: 12px; color: var(--muted); }
.hotel-select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff; outline: none; }
.switch-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.switch-row input { width: 18px; height: 18px; }
.qr-code-row input[type=text] { width: 160px; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.content { flex: 1; margin-left: 220px; padding: 24px 28px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 20px; }
.tag { font-size: 12px; background: var(--primary-light); color: var(--primary-dark); border-radius: 10px; padding: 3px 10px; font-weight: 600; }

/* ---------- 组件 ---------- */
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.text-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; }
.text-input:focus { border-color: var(--primary); }
.btn { border: none; border-radius: 8px; padding: 10px 16px; font-size: 14px; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-warn { background: var(--accent); color: #fff; }
.btn-warn:hover:not(:disabled) { background: #D97706; }
.btn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { background: #fff; }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* ---------- 卡片与表格 ---------- */
.cards { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; min-width: 160px; flex: 1 1 160px; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 4px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2 { font-size: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg); font-weight: 600; font-size: 13px; color: var(--muted); }
td { font-size: 13px; }
tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.status-online { color: #15803D; font-weight: 600; }
.status-offline { color: var(--muted); }
.status-row { display: inline-flex; gap: 6px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: #22C55E; }
.dot.offline { background: #CBD5E1; }

/* ---------- 表单区 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
.img-field { display: flex; gap: 8px; align-items: center; }
.img-field .text-input { flex: 1; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- 广告位 ---------- */
.ad-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ad-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.ad-card .ad-title { font-weight: 700; margin-bottom: 6px; }
.ad-card .ad-meta { font-size: 12px; color: var(--muted); line-height: 1.7; margin-bottom: 10px; }
.ad-badge { font-size: 11px; border-radius: 6px; padding: 2px 8px; font-weight: 600; }
.ad-badge.on { background: #DCFCE7; color: #15803D; }
.ad-badge.off { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 480px; max-width: 92vw; padding: 22px 24px; }
.modal h3 { margin-bottom: 6px; }
.modal .btn-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- 素材库选择 ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 60vh; overflow: auto; margin-top: 12px; }
.lib-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; background: #fff; transition: border-color .15s; }
.lib-item:hover { border-color: var(--primary); }
.lib-item img { width: 100%; height: 72px; object-fit: cover; display: block; background: var(--bg); }
.lib-video { width: 100%; height: 72px; display: flex; align-items: center; justify-content: center; background: #0F172A; color: #fff; font-size: 22px; }
.lib-name { font-size: 12px; color: var(--text); padding: 6px 8px; word-break: break-all; line-height: 1.4; }

/* ---------- 提示 ---------- */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: #fff; border-radius: 8px; padding: 10px 16px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.ok { background: #15803D; }
.toast.err { background: var(--danger); }

/* ---------- 酒店详情 ---------- */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.hotel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.hotel-head-info .hotel-name { font-size: 18px; font-weight: 700; }
.hotel-head-info .hotel-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hotel-head-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hotel-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.hotel-link:hover { text-decoration: underline; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tab { border: none; background: none; padding: 10px 16px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-dark); font-weight: 600; border-bottom-color: var(--primary); }
.tab-body { min-height: 200px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; }
  .content { margin-left: 0; }
  .nav { display: flex; flex-wrap: wrap; }
  .form-grid, .ad-grid { grid-template-columns: 1fr; }
}

/* 基础配置分组 */
.config-group {
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #fbfcfe;
}
.config-group h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #1f2329;
  padding-bottom: 8px;
  border-bottom: 1px solid #e8ecf1;
}
