:root {
  --primary: #07c160;
  --primary-dark: #06ad56;
  --bg: #ededed;
  --card: #ffffff;
  --text: #191919;
  --text-secondary: #999999;
  --text-light: #b2b2b2;
  --border: #e5e5e5;
  --danger: #fa5151;
  --success: #07c160;
  --warning: #ffc300;
  --chat-self: #95ec69;
  --chat-other: #ffffff;
  --header-bg: #ededed;
  --nav-bg: #f7f7f7;
  --nav-border: #e5e5e5;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}

.page {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#auth-page {
  background: var(--card);
  justify-content: flex-start;
}

.auth-logo {
  text-align: center;
  padding: 60px 0 30px;
}

.logo-circle {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.auth-logo p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.auth-tabs {
  display: flex;
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
  padding: 0 20px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

.auth-form {
  display: none;
  padding: 24px 20px;
}

.auth-form.active { display: block; }

.form-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 4px;
}

.form-icon {
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
  margin-right: 12px;
  flex-shrink: 0;
}

.form-item input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  background: transparent;
}

.form-item input::placeholder { color: var(--text-light); }

.code-row {
  display: flex;
  gap: 0;
}

.code-input { flex: 1; }

.btn-code {
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  min-width: 90px;
  flex-shrink: 0;
  margin-left: 8px;
}

.btn-code:disabled { background: #ccc; cursor: not-allowed; }

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 24px;
  transition: background 0.2s;
}

.btn-login:active { background: var(--primary-dark); }

.link-text {
  text-align: center;
  color: var(--primary);
  font-size: 14px;
  margin-top: 20px;
  cursor: pointer;
}

#main-page { background: var(--bg); }

.main-page {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0; left: 0; right: 0;
  bottom: 56px;
}

.main-page.active { display: flex; }

.page-header {
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  background: var(--header-bg);
  flex-shrink: 0;
}

.page-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--nav-bg);
  border-top: 0.5px solid var(--nav-border);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.nav-item.active { color: var(--primary); }
.nav-item svg { width: 24px; height: 24px; }
.nav-item span { font-size: 10px; }

.cell-group {
  background: var(--card);
  margin-top: 8px;
}

.cell {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.cell:active { background: #ececec; }
.cell:last-child { border-bottom: none; }

.cell-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cell-icon svg { width: 20px; height: 20px; }

.cell-body {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-left: 14px;
  font-size: 16px;
}

.cell-arrow::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-top: 1.5px solid var(--text-light);
  border-right: 1.5px solid var(--text-light);
  transform: rotate(45deg);
}

.cell-logout { justify-content: center; }

.me-header {
  display: flex;
  align-items: center;
  padding: 24px 16px 20px;
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
}

.me-avatar {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 500;
  flex-shrink: 0;
}

.me-info { margin-left: 16px; }
.me-name { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.me-id { font-size: 13px; color: var(--text-secondary); }

.detail-header {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 56px;
  background: var(--header-bg);
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--border);
}

.detail-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.detail-back svg { width: 24px; height: 24px; color: var(--text); }

.detail-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  margin: 0 8px;
}

.detail-actions { display: flex; gap: 8px; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
  background: var(--bg);
}

.msg-row {
  display: flex;
  margin-bottom: 16px;
  align-items: flex-start;
}

.msg-row.self { justify-content: flex-end; }
.msg-row.other { justify-content: flex-start; }

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
}

.msg-row.other .msg-avatar { background: #576b95; margin-right: 8px; }
.msg-row.self .msg-avatar { background: var(--primary); margin-left: 8px; order: 1; }

.msg-content-wrap { max-width: 65%; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

.msg-row.other .msg-bubble { background: var(--chat-other); color: var(--text); }
.msg-row.self .msg-bubble { background: var(--chat-self); color: var(--text); }

.msg-bubble img { max-width: 180px; border-radius: 4px; display: block; }

.msg-time-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin: 12px 0;
}

.chat-footer {
  background: var(--card);
  border-top: 0.5px solid var(--border);
  flex-shrink: 0;
}

.chat-toolbar {
  display: flex;
  padding: 6px 12px;
  gap: 4px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 6px;
  transition: background 0.15s;
}

.tool-btn:active { background: var(--bg); }
.tool-btn svg { width: 22px; height: 22px; color: var(--text-secondary); }

.emoji-panel {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg);
  max-height: 160px;
  overflow-y: auto;
}

.emoji-item {
  font-size: 24px;
  text-align: center;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}

.emoji-item:active { background: var(--border); }

.chat-input-row {
  display: flex;
  padding: 8px 12px;
  gap: 8px;
  align-items: flex-end;
}

.chat-input-row input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 6px;
  color: var(--text);
}

.chat-input-row input::placeholder { color: var(--text-light); }

.btn-send {
  padding: 10px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-send:active { background: var(--primary-dark); }

.sub-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.admin-list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.admin-list-item:active { background: #ececec; }

.admin-avatar {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #576b95;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 500;
  flex-shrink: 0;
  position: relative;
}

.admin-avatar .online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--card);
}

.admin-info {
  flex: 1;
  margin-left: 12px;
}

.admin-name { font-size: 16px; font-weight: 400; }
.admin-status { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.room-card {
  background: var(--card);
  margin: 8px 12px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.room-img {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, #576b95, #07c160);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 40px;
}

.room-info { padding: 14px 16px 8px; }
.room-name { font-size: 17px; font-weight: 500; margin-bottom: 4px; }
.room-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.4; }
.room-price { font-size: 20px; color: var(--danger); font-weight: 600; }
.room-price span { font-size: 12px; color: var(--text-secondary); font-weight: normal; }

.room-actions {
  display: flex;
  gap: 8px;
  padding: 8px 16px 14px;
}

.btn-book {
  flex: 1;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-book:active { background: var(--primary-dark); }

.btn-detail {
  padding: 12px 20px;
  background: #f5f5f5;
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.order-card {
  background: var(--card);
  margin: 8px 12px;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.order-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.order-id { font-size: 12px; color: var(--text-secondary); }

.order-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.order-status.pending { background: #fdf6ec; color: var(--warning); }
.order-status.confirmed { background: #f0f9eb; color: var(--success); }
.order-status.cancelled { background: #fef0f0; color: var(--danger); }
.order-status.completed { background: #f0f9eb; color: var(--success); }

.order-detail { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.order-price { font-size: 18px; color: var(--danger); font-weight: 600; margin-top: 8px; }

.room-detail-img {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #576b95, #07c160);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 48px;
}

.room-detail-info {
  background: var(--card);
  padding: 16px;
}

.room-detail-name { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.room-detail-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }

.room-detail-features {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.feature-tag {
  padding: 4px 10px;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.room-detail-price {
  font-size: 24px;
  color: var(--danger);
  font-weight: 700;
  margin-bottom: 16px;
}

.room-detail-price span { font-size: 14px; color: var(--text-secondary); font-weight: normal; }

.room-booking {
  background: var(--card);
  padding: 16px;
  margin-top: 8px;
}

.booking-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.booking-label {
  font-size: 14px;
  color: var(--text-secondary);
  width: 80px;
  flex-shrink: 0;
}

.booking-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  outline: none;
}

.booking-input:focus { border-color: var(--primary); }

.btn-book-full {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
}

.btn-book-full:active { background: var(--primary-dark); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 14px;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  animation: fadeInOut 2s ease;
  pointer-events: none;
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}
