*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #181818;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #666;
  --text-dim: #3a3a3a;
  --accent: #00d4a0;
  --accent-dim: rgba(0,212,160,0.08);
  --accent-border: rgba(0,212,160,0.25);
  --error: #ff5f5f;
  --error-dim: rgba(255,95,95,0.08);
  --warn: #f0a500;
  --warn-dim: rgba(240,165,0,0.08);
  --warn-border: rgba(240,165,0,0.25);
  --alipay: #1677FF;
  --alipay-dim: rgba(22,119,255,0.12);
  --wechat: #07C160;
  --wechat-dim: rgba(7,193,96,0.12);
  --feishu: #3370FF;
  --feishu-dim: rgba(51,112,255,0.12);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface2: #f0f0f0;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --text-muted: #888;
    --text-dim: #bbb;
    --accent: #00a87e;
    --accent-dim: rgba(0,168,126,0.08);
    --accent-border: rgba(0,168,126,0.3);
    --error: #e03030;
    --error-dim: rgba(224,48,48,0.07);
    --warn: #c47f00;
    --warn-dim: rgba(196,127,0,0.07);
    --warn-border: rgba(196,127,0,0.25);
    --alipay-dim: rgba(22,119,255,0.08);
    --wechat-dim: rgba(7,193,96,0.08);
    --feishu-dim: rgba(51,112,255,0.08);
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 0.3s, color 0.3s;
}

/* 全局宽度约束 */
.topbar,
.tab-bar,
.hotel-wrap,
.page > .main {
  width: 100%;
  max-width: 600px;
}

.topbar {
  padding: env(safe-area-inset-top, 20px) 20px 0;
  padding-top: max(env(safe-area-inset-top), 20px);
  display: flex;
  align-items: center;
  gap: 10px;
}
/* ── 登录页 ── */
.login-page {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* 深色底 + 点阵纹理 */
  background-color: #07100d;
  background-image: radial-gradient(circle, rgba(0,212,160,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
}
/* 光晕 orb 1 — 左上，青绿 */
.login-page::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,212,160,0.22) 0%, transparent 65%);
  top: -220px; left: -180px;
  animation: loginOrb1 14s ease-in-out infinite;
  pointer-events: none;
}
/* 光晕 orb 2 — 右下，蓝紫 */
.login-page::after {
  content: '';
  position: absolute;
  width: 550px; height: 550px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(60,120,255,0.14) 0%, transparent 65%);
  bottom: -160px; right: -120px;
  animation: loginOrb2 18s ease-in-out infinite;
  pointer-events: none;
}
@keyframes loginOrb1 {
  0%,100% { transform: translate(0,0) scale(1); }
  35%     { transform: translate(70px,50px) scale(1.1); }
  70%     { transform: translate(-40px,80px) scale(0.92); }
}
@keyframes loginOrb2 {
  0%,100% { transform: translate(0,0) scale(1); }
  40%     { transform: translate(-60px,-50px) scale(1.08); }
  75%     { transform: translate(50px,-30px) scale(0.94); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 40px 36px;
  border-radius: 20px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(0,212,160,0.15);
  box-shadow: 0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,212,160,0.04);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.login-dot { color: var(--accent); font-size: 14px; }
.login-brand-name { font-family: var(--mono); font-size: 22px; color: #e8f8f4; letter-spacing: 0.1em; font-weight: 600; }
.login-sub { font-size: 13px; color: rgba(255,255,255,0.4); margin: 0; }
.login-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(0,212,160,0.2);
  background: rgba(255,255,255,0.05);
  color: #e8f8f4;
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2300d4a0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s;
}
.login-select:focus { border-color: var(--accent); }
.login-select option { background: #0f1f19; color: #e8f8f4; }
.login-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #00d4a0 0%, #00b888 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,212,160,0.35);
  transition: opacity 0.15s, box-shadow 0.15s;
  transition: opacity 0.15s;
}
.login-btn:hover { opacity: 0.88; }
.login-btn:hover  { opacity: 0.9; box-shadow: 0 6px 24px rgba(0,212,160,0.45); }
.login-btn:active { opacity: 0.75; box-shadow: none; }

/* 登录加载状态 */
.login-loading-hotel {
  font-size: 14px;
  font-weight: 600;
  color: #e8f8f4;
  margin: 0 0 20px;
  letter-spacing: 0.04em;
}
.login-progress-wrap {
  height: 3px;
  border-radius: 2px;
  background: rgba(0,212,160,0.15);
  overflow: hidden;
  margin-bottom: 14px;
}
.login-progress-bar {
  height: 100%;
  width: 45%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #00d4a0, transparent);
  animation: loginSweep 1.4s ease-in-out infinite;
}
@keyframes loginSweep {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.login-loading-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.38);
  margin: 0;
  text-align: center;
}

/* 顶栏酒店指示 */
.topbar-hotel {
  margin-left: auto;
  display: none;
  align-items: center;
  gap: 8px;
}
#topbarHotelName {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-switch-btn {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.topbar-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.topbar-title { font-family: var(--mono); font-size: 15px; color: var(--text-muted); letter-spacing: 0.12em; }
.topbar-version {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #b8882a, #f0d080, #c8962e, #f5e090, #a87828);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

/* -- Tab 导航 -- */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
}
.tab-btn {
  flex: 1;
  padding: 9px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* -- 电费预览页 -- */
.page { display: none; }
.page.active { display: contents; }

.reserve-list-card { display: flex; flex-direction: column; gap: 0; }
.reserve-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  margin: 0 -20px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  gap: 12px;
  transition: background 0.15s;
}
.reserve-row:last-child { border-bottom: none; }
.reserve-row.clickable { cursor: pointer; }
.reserve-row-left { flex: 1; min-width: 0; }
.reserve-row-name { font-size: 14px; color: var(--text); word-break: break-all; line-height: 1.4; }
.reserve-row-meta { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.reserve-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.reserve-row-val {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
}
.reserve-row-val.ok   { color: var(--accent); }
.reserve-row-val.warn { color: var(--warn); }
.reserve-row-val.err  { color: var(--error); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.reserve-row-hint {
  font-size: 10px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
}
@media (hover: hover) {
  .reserve-row.clickable:hover { background: var(--accent-dim); }
  .reserve-row.clickable:hover .reserve-row-hint { opacity: 1; transform: translateX(0); }
}
.preview-status { font-size: 13px; color: var(--text-muted); padding: 16px 0; text-align: center; }
.preview-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.summary-low  { color: #f59e0b; font-weight: 600; }
.summary-ok   { color: var(--success, #22c55e); font-weight: 600; }
.summary-time { color: var(--text-muted); font-family: var(--mono); font-size: 11px; }
.preview-progress {
  display: flex; align-items: center;
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.main {
  flex: 1;
  padding: 24px 20px 40px;
  padding-bottom: max(env(safe-area-inset-bottom), 40px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: background 0.3s, border-color 0.3s;
}

.field { margin-bottom: 16px; }

/* 快捷金额 */
.amount-quick {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.amount-chip {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.amount-chip:hover  { border-color: var(--accent-border); color: var(--accent); }
.amount-chip.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.amount-error { font-size: 12px; color: var(--error, #e03030); margin-top: 6px; min-height: 16px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* -- 房间选择行 -- */
.room-row { display: flex; gap: 8px; align-items: stretch; }

/* -- 搜索下拉 -- */
.room-search-wrap { position: relative; flex: 1; }
.room-search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
}
.room-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.room-search-input::placeholder { color: var(--text-dim); }
.room-search-input:disabled { opacity: 0.5; cursor: default; }

.room-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
}
.room-dropdown.open { display: block; animation: fadeUp 0.15s ease; }
.room-option {
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.room-option:hover, .room-option.active { background: var(--accent-dim); color: var(--accent); }
.room-option.no-result { color: var(--text-muted); font-size: 13px; cursor: default; }
.room-option mark { background: none; color: var(--accent); font-weight: 600; }
.room-option-owner {
  font-size: 11px;
  margin-top: 2px;
  background: linear-gradient(90deg, #c8a96e, #f0d080, #c8a96e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.btn-refresh {
  flex-shrink: 0;
  width: 48px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-refresh:active { transform: scale(0.93); }
.btn-refresh:disabled { opacity: 0.4; pointer-events: none; }
.btn-refresh svg { width: 16px; height: 16px; }
.btn-refresh.spinning svg { animation: spin 0.8s linear infinite; }

/* 电表号只读展示 */
.meter-display {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  min-height: 40px;
  transition: border-color 0.2s, background 0.2s;
}
.meter-display.has-value { border-color: var(--accent-border); background: var(--accent-dim); }
.meter-label { font-family: var(--mono); font-size: 10px; color: var(--text-muted); letter-spacing: 0.08em; flex-shrink: 0; }
.meter-value { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--accent); flex: 1; }
.meter-value.empty { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.meter-info { flex: 1; min-width: 0; }
.meter-room-name { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.meter-room-name.empty { display: none; }

input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 17px;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
}
input[type="number"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
input[type="number"]::placeholder { color: var(--text-dim); }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* -- 余额条 -- */
.reserve-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  min-height: 42px;
  transition: background 0.2s, border-color 0.2s;
  animation: fadeUp 0.2s ease;
}
.reserve-bar.ok   { background: var(--accent-dim); border-color: var(--accent-border); }
.reserve-bar.warn { background: var(--warn-dim);   border-color: var(--warn-border); }
.reserve-bar.err  { background: var(--error-dim);  border-color: rgba(255,95,95,0.25); }
@media (prefers-color-scheme: light) {
  .reserve-bar.err { border-color: rgba(224,48,48,0.25); }
  .room-dropdown {
    background: rgba(255,255,255,0.82);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  }

  /* 登录页浅色模式 */
  .login-page {
    background-color: #eef8f5;
    background-image: radial-gradient(circle, rgba(0,168,126,0.09) 1px, transparent 1px);
  }
  .login-page::before {
    background: radial-gradient(circle, rgba(0,168,126,0.18) 0%, transparent 65%);
  }
  .login-page::after {
    background: radial-gradient(circle, rgba(60,120,255,0.1) 0%, transparent 65%);
  }
  .login-card {
    background: rgba(255,255,255,0.65);
    border-color: rgba(0,168,126,0.18);
    box-shadow: 0 24px 64px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,168,126,0.06);
  }
  .login-brand-name { color: #0f2a1e; }
  .login-sub        { color: rgba(0,0,0,0.45); }
  .login-select {
    background-color: rgba(255,255,255,0.8);
    border-color: rgba(0,168,126,0.25);
    color: #0f2a1e;
  }
  .login-select option { background: #fff; color: #0f2a1e; }
  .login-loading-hotel { color: #0f2a1e; }
  .login-loading-sub   { color: rgba(0,0,0,0.4); }
}
.reserve-spinner {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.reserve-icon { font-size: 15px; flex-shrink: 0; line-height: 1; }
.reserve-text { font-family: var(--mono); font-size: 12px; line-height: 1.5; flex: 1; }
.reserve-text .val  { font-size: 15px; font-weight: 600; }
.reserve-text .meta { opacity: 0.5; font-size: 11px; margin-top: 1px; }
.reserve-bar.ok   .reserve-text { color: var(--accent); }
.reserve-bar.warn .reserve-text { color: var(--warn); }
.reserve-bar.err  .reserve-text { color: var(--error); }
.reserve-bar:not(.ok):not(.warn):not(.err) .reserve-text { color: var(--text-muted); }

/* -- 支付按钮 -- */
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-grid .btn-feishu-full { grid-column: 1 / -1; }
.pay-grid .btn-qrpay       { grid-column: 1 / -1; }
.btn-qrpay { background: linear-gradient(135deg, rgba(22,119,255,0.1), rgba(7,193,96,0.1)); color: var(--text); border-color: var(--border); }
.btn-pay {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px; border: 1px solid; border-radius: 14px;
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  cursor: pointer; transition: opacity 0.2s, transform 0.1s, background 0.3s;
  -webkit-tap-highlight-color: transparent; box-shadow: var(--shadow);
}
.btn-pay:active { transform: scale(0.97); }
.btn-pay:disabled { opacity: 0.35; pointer-events: none; }
.btn-alipay      { background: var(--alipay-dim); color: var(--alipay); border-color: rgba(22,119,255,0.25); }
.btn-wechat      { background: var(--wechat-dim); color: var(--wechat); border-color: rgba(7,193,96,0.25); }
.btn-feishu-full { background: var(--feishu-dim); color: var(--feishu); border-color: rgba(51,112,255,0.25); }
.pay-icon { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pay-icon svg { width: 16px; height: 16px; }
.pay-icon-alipay { background: var(--alipay); }
.pay-icon-wechat { background: var(--wechat); }
.pay-icon-feishu { background: var(--feishu); }

/* -- 操作结果 -- */
.result { border-radius: 12px; padding: 14px 16px; display: none; border: 1px solid; animation: fadeUp 0.2s ease; }
.result.success { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent); display: block; }
.result.error   { background: var(--error-dim);  border-color: rgba(255,95,95,0.25); color: var(--error);  display: block; }
@media (prefers-color-scheme: light) { .result.error { border-color: rgba(224,48,48,0.25); } }
.result-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.6; margin-bottom: 5px; }
.result-body  { font-family: var(--mono); font-size: 13px; line-height: 1.8; white-space: pre-wrap; word-break: break-all; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.2); border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }

.bills-card { display: none; }
.bills-title { font-family: var(--mono); font-size: 10px; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 12px; }
.bills-loading { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.bills-empty { font-size: 13px; color: var(--text-muted); padding: 8px 0; }
.bill-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); transition: background 0.3s; }
.bill-item:last-child { border-bottom: none; }
.bill-new { background: var(--accent-dim); border-radius: 8px; padding: 10px 8px; animation: fadeUp 0.4s ease; }
.bill-left { display: flex; flex-direction: column; gap: 3px; }
.bill-name { font-size: 14px; color: var(--text); }
.bill-time { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.bill-amount { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--accent); }

/* -- 酒店选择 -- */
.hotel-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0 8px;
}
.hotel-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.hotel-chip:active { transform: scale(0.95); }
.hotel-chip.active {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}
.hotel-chip.loading  { opacity: 0.5; pointer-events: none; }
.hotel-chip.disabled { opacity: 0.4; pointer-events: none; cursor: not-allowed; }

.install-hint { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; font-size: 12px; color: var(--text-muted); text-align: center; line-height: 1.6; transition: background 0.3s, border-color 0.3s; }
.install-hint.visible { display: block; }

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn   { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

/* ── 二维码支付弹窗 ───────────────────────────────────────────────────────── */
.qr-modal {
  display: none;
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.6);
  align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.qr-modal.open { display: flex; }
.qr-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 300px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: popIn 0.18s ease;
}
.qr-modal-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
}
.qr-modal-title  { font-size: 15px; font-weight: 600; color: var(--text); }
.qr-modal-close  { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 0 2px; line-height: 1; }
.qr-modal-close:hover { color: var(--text); }
.qr-modal-img-wrap { position: relative; width: 220px; height: 220px; }
.qr-modal-svg { width: 220px; height: 220px; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; transition: opacity 0.2s; }
.qr-modal-svg svg { width: 220px; height: 220px; border-radius: 8px; display: block; }
.qr-generating { font-size: 12px; color: #888; }
.qr-modal-mask   {
  display: none; position: absolute; inset: 0;
  background: rgba(0,0,0,0.55); border-radius: 8px;
  align-items: center; justify-content: center;
}
.qr-refresh-btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 18px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.qr-refresh-btn:hover { background: var(--surface2); }
.qr-modal-hint   { font-size: 12px; color: var(--text-muted); }
.qr-modal-meta   { display: flex; align-items: center; justify-content: space-between; width: 100%; font-size: 13px; color: var(--text); }
.qr-modal-amount { font-size: 18px; font-weight: 700; color: var(--accent); }
.qr-modal-order  { font-size: 10px; font-family: var(--mono); color: var(--text-muted); letter-spacing: 0.05em; }

/* ── 桌面端布局 ────────────────────────────────────────────────────────────── */
.desktop-only { display: none; }
.mobile-only  { display: flex; }
.pages-wrap   { width: 100%; display: contents; } /* 手机端透明容器 */

@media (min-width: 900px) {
  body {
    align-items: stretch;
    padding: 0 32px;
  }

  /* 顶栏 & 酒店栏放开宽度限制 */
  .topbar,
  .tab-bar,
  .hotel-wrap {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }

  /* topbar 与内容用分割线隔开 */
  .topbar {
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 4px;
  }

  /* 隐藏 tab 导航，两栏始终并排 */
  .tab-bar { display: none; }

  /* 桌面端显隐控制 */
  .desktop-only { display: flex; }
  .mobile-only  { display: none !important; }

  /* pages-wrap 变为三列网格：电费预览 | 充值缴费 | 缴费记录 */
  .pages-wrap {
    display: contents;       /* reset */
    display: grid;
    grid-template-columns: 1fr 360px 260px;
    gap: 0 20px;
    align-items: start;
    width: 100%;
    margin-top: 8px;
  }

  /* 三页始终可见 */
  .page        { display: block !important; }
  .page > .main { max-width: none; }

  /* 列顺序：电费预览(1) | 充值缴费(2) | 缴费记录(3) */
  #pagePreview { order: 1; }
  #pagePay     { order: 2; }
  #pageBills   { order: 3; }

  /* 中间栏（充值缴费）：sticky，内部滚动 */
  #pagePay {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 32px;
  }

  /* 右栏（缴费记录）：sticky，内部滚动 */
  #pageBills {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  #pageBills > .main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 16px;
  }

  #billsCardDesktop {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  /* 左栏（电费预览）：sticky，整列滚动（同 pagePay） */
  #pagePreview {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 32px;
  }

  /* 栏标题 */
  .desktop-only {
    display: block;
    font-size: 11px;
    font-family: var(--mono);
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 12px 0 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
  }

  /* panel-title 不参与 flex 伸缩 */
  /* 电费预览：标题+汇总条固定在列顶部，随列滚动时保持可见 */
  .preview-sticky-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg);
    padding-bottom: 8px;
    margin-bottom: 4px;
  }
  .preview-sticky-header .panel-title { margin-bottom: 4px; }
}

/* ── AI 聊天助手 ─────────────────────────────────────────────────────────────── */

.chat-fab {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,212,160,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,212,160,0.55);
}
.chat-fab:active { transform: scale(0.95); }

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: calc(max(20px, env(safe-area-inset-bottom, 20px)) + 64px);
  width: 340px;
  max-height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 48px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  z-index: 199;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) translateY(16px);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
.chat-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

/* 手机端：底部全宽弹出 */
@media (max-width: 500px) {
  .chat-panel {
    right: 0; left: 0;
    bottom: 0;
    width: 100%;
    max-height: 78vh;
    border-radius: 18px 18px 0 0;
    transform-origin: bottom center;
    transform: translateY(100%);
  }
  .chat-panel.open { transform: translateY(0); }
  .chat-fab {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
  cursor: grab;
}
.chat-header:active { cursor: grabbing; }
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-header-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.chat-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.chat-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 3px 5px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}
.chat-close:hover { color: var(--text); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}
.chat-msg.user { align-items: flex-end; }
.chat-msg.ai   { align-items: flex-start; }

.chat-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg.user .chat-bubble {
  background: var(--accent);
  color: #0f0f0f;
  border-bottom-right-radius: 5px;
}
.chat-msg.ai .chat-bubble {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
}

/* 加载中 loading 气泡 */
.chat-bubble.chat-loading {
  min-width: 52px;
  text-align: center;
  padding: 12px 16px;
}
.chat-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.chat-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  animation: chatdot 1.3s infinite ease-in-out;
}
.chat-dots span:nth-child(2) { animation-delay: 0.18s; }
.chat-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes chatdot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

/* 充值确认按钮 */
.chat-confirm-btn {
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 2px 10px rgba(0,212,160,0.3);
}
.chat-confirm-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.chat-confirm-btn:active { transform: translateY(0); }
.chat-confirm-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  font-family: var(--sans);
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { border-color: var(--accent); }
.chat-input:disabled { opacity: 0.6; }

.chat-send {
  background: var(--accent);
  color: #0f0f0f;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  font-family: var(--sans);
}
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; }
.chat-send:not(:disabled):hover { opacity: 0.85; }

/* ── 支付方式选择面板（手机端 AI 充值）──────────────────────────────────────── */
.pay-picker-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 400;
  align-items: flex-end;
  justify-content: center;
}
.pay-picker-mask.open {
  display: flex;
}
.pay-picker {
  width: 100%;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom, 20px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: pickerSlideUp 0.28s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pickerSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.pay-picker-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.pay-picker-meta {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: -6px;
}
.pay-picker-btns {
  display: flex;
  gap: 12px;
}
.pay-picker-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.pay-picker-btn:active { transform: scale(0.97); }
.pay-picker-alipay:hover { background: var(--alipay-dim); border-color: var(--alipay); }
.pay-picker-wechat:hover { background: var(--wechat-dim); border-color: var(--wechat); }
.pay-picker-btn .pay-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}
.pay-picker-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 14px;
}
.pay-picker-cancel {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.pay-picker-cancel:hover { background: var(--surface); color: var(--text); }
