/* ================================================================
   喵喵寄养管理系统 - 样式表
   ================================================================ */

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

html {
  height: 100%;
  overscroll-behavior: none;
}


:root {
  /* Brand */
  --primary: #FF6B6B;
  --primary-dark: #E05555;
  --primary-light: rgba(255,107,107,0.12);
  /* iOS System Colors */
  --success: #34C759;
  --success-light: rgba(52,199,89,0.12);
  --warning: #FF9F0A;
  --warning-light: rgba(255,159,10,0.12);
  --info: #007AFF;
  --info-light: rgba(0,122,255,0.12);
  --danger: #FF3B30;
  /* Backgrounds */
  --bg: #F5F0EC;
  --card-bg: #FFFFFF;
  /* iOS System Neutrals */
  --border: rgba(60,60,67,0.12);
  --separator: rgba(60,60,67,0.08);
  --text: #1C1C1E;
  --text-secondary: #3C3C43;
  --text-light: #8E8E93;
  --text-tertiary: #AEAEB2;
  /* Surfaces */
  --surface: #FFFFFF;
  --surface-grouped: rgba(255,255,255,0.82);
  /* Shadows */
  --shadow: 0 2px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  /* Radii */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  /* Glass */
  --glass-bg: rgba(255,255,255,0.72);
  --glass-bg-strong: rgba(255,255,255,0.88);
  --glass-border: rgba(255,255,255,0.6);
  --glass-blur: blur(24px) saturate(200%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'PingFang TC', 'Helvetica Neue', sans-serif;
  background: linear-gradient(160deg, #FFE8E3 0%, #FFF2EE 40%, #F5EDEA 70%, #FCEEE8 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================================================
   登录页
   ================================================================ */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: linear-gradient(160deg, #FFE8E3 0%, #FFF2EE 40%, #F5EDEA 70%, #FCEEE8 100%);
}

.login-card {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo {
  font-size: 72px;
  margin-bottom: 12px;
  display: block;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.login-card .subtitle {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 32px;
}

.error-msg {
  font-size: 13px;
  margin-top: 12px;
  color: var(--danger);
  display: none;
  background: rgba(255,59,48,0.07);
  border: 1px solid rgba(255,59,48,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: left;
  line-height: 1.5;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-6px); }
  40%,80%  { transform: translateX(6px); }
}
#login-form.shake { animation: shake 0.4s ease; }

.error-msg.success {
  color: var(--success);
}

/* ================================================================
   主应用布局
   ================================================================ */
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 顶部导航 */
.app-header {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(0,0,0,0.06);
  height: calc(56px + env(safe-area-inset-top));
}

/* 移动端居中标题 */
.header-title-center {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  white-space: nowrap;
  pointer-events: none;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
  text-decoration: none;
}

.app-logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #FF8C8C 0%, #FF6B6B 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 2px 8px rgba(255,107,107,0.30), inset 0 1px 0 rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.app-logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.app-logo-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.app-logo-sub {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  letter-spacing: 0.1px;
  line-height: 1;
}

@media (max-width: 480px) {
  .app-logo-sub { display: none; }
  .app-logo-icon { width: 38px; height: 38px; font-size: 22px; border-radius: 11px; }
  .app-logo-name { font-size: 17px; }
}

.header-right {
  flex-shrink: 0;
}

/* 桌面端顶部 tabs */
.desktop-tabs {
  display: flex;
  flex: 1;
  height: 100%;
}

.desktop-tabs .tab-btn {
  padding: 0 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  color: var(--text-light);
  transition: color 0.2s, border-color 0.2s;
  height: 100%;
  white-space: nowrap;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.1px;
}

.desktop-tabs .tab-btn:hover { color: var(--primary); }
.desktop-tabs .tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* 底部导航栏 */
/* iOS-style floating pill bottom nav */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: max(env(safe-area-inset-bottom), 4px);
  padding-top: 2px;
  pointer-events: none;
  background: transparent;
}

.bottom-nav-pill {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  padding: 3px;
  gap: 0;
  box-shadow: 0 8px 32px rgba(200, 100, 80, 0.18), 0 2px 8px rgba(0,0,0,0.08);
  pointer-events: all;
  --pill-index: 0;
}

/* Sliding active indicator pill */
.bottom-nav-pill::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc((100% - 6px) / 4);
  height: calc(100% - 6px);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,107,107,0.30) 0%, rgba(255,142,100,0.25) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 16px rgba(255,107,107,0.30), inset 0 1px 0 rgba(255,255,255,0.9);
  transform: translateX(calc(var(--pill-index) * 100%));
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.bottom-nav .tab-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 72px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  padding: 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: rgba(120, 80, 70, 0.55);
  transition: color 0.25s, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  border-radius: 22px;
}

.bottom-nav .tab-btn:active {
  transform: scale(0.86);
  transition: transform 0.08s ease-out, opacity 0.08s;
  opacity: 0.75;
}

.bottom-nav .tab-btn.active {
  color: var(--primary);
}

.bottom-nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav .tab-btn.active .bottom-nav-icon {
  transform: scale(1.12) translateY(-1px);
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Tab 内容区 */
.tab-content {
  display: none;
  padding: 20px;
  /* floating pill nav: ~76px height + safe area + extra breathing room */
  padding-bottom: calc(20px + 90px + env(safe-area-inset-bottom));
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.tab-content.active {
  display: block;
}


/* ================================================================
   统计卡片
   ================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--separator);
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:active { transform: scale(0.96); transition: transform 0.08s; box-shadow: var(--shadow-sm); }
.cat-card:active { transform: scale(0.96); transition: transform 0.08s; opacity: 0.88; }
.visit-card:active { transform: scale(0.96); transition: transform 0.08s; opacity: 0.88; }

.stat-icon {
  font-size: 28px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  flex-shrink: 0;
}
.stat-card.primary .stat-icon { background: var(--primary-light); }
.stat-card.success .stat-icon { background: var(--success-light); }
.stat-card.warning .stat-icon { background: var(--warning-light); }
.stat-card.info    .stat-icon { background: var(--info-light); }

.stat-info { flex: 1; min-width: 0; overflow: hidden; }
.stat-number {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  transition: font-size 0.2s;
}
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 2px; font-weight: 500; line-height: 1.3; }

/* ================================================================
   区块容器
   ================================================================ */
.section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--separator);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.section-date { font-size: 13px; color: var(--text-light); font-weight: 500; }

/* 操作栏 */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.actions-bar h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.actions-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================================================================
   今日猫咪网格
   ================================================================ */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* 横向滑动卡片条（modal 内旗下猫咪等） */
.hscroll-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* 逃出父级 padding，做全宽横滑（和 App Store 同款做法） */
  margin-left: -24px;
  margin-right: -24px;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 10px;
}
.hscroll-strip::-webkit-scrollbar { display: none; }
.hscroll-card {
  flex: 0 0 160px;
  min-width: 160px;
}

.cat-card {
  background: #FFFFFF;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 18px;
  padding: 14px;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
}

/* Subtle left color accent stripe */
.cat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 18px 0 0 18px;
  background: var(--primary);
}
.cat-card.room-standard::before { background: #007AFF; }
.cat-card.room-luxury::before   { background: #FF9F0A; }

/* Subtle tinted bg */
.cat-card.room-standard { background: #F5F9FF; }
.cat-card.room-luxury   { background: #FFFBF2; }

.cat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.10); }
.cat-card-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; letter-spacing: -0.1px; padding-left: 6px; }
.cat-card-info { font-size: 12px; color: var(--text-light); margin-top: 3px; font-weight: 500; padding-left: 6px; }

.cat-card-room {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  margin-top: 10px;
  margin-left: 6px;
  font-weight: 700;
  background: rgba(0,0,0,0.06);
  color: var(--text-light);
}

/* ================================================================
   今日上门喂养
   ================================================================ */
.visits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.visit-card {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-top: 3px solid var(--info);
  border-radius: var(--radius);
  padding: 14px;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.visit-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.visit-card-time { font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--info); }
.visit-card-info { font-size: 12px; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

/* ================================================================
   本周预览
   ================================================================ */
.week-preview-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.week-day-col {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  min-height: 80px;
  transition: background 0.15s, transform 0.15s;
}

.week-day-col:hover { background: #FFF8F5; transform: translateY(-1px); }
.week-day-empty { opacity: 0.4; }

.week-day-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.week-day-date {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.week-cat-chip {
  display: block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-cat-chip.room-standard { background: rgba(0,122,255,0.12); color: #007AFF; }
.week-cat-chip.room-luxury   { background: rgba(255,159,10,0.14); color: #B8720A; }

.week-no-cats {
  color: #CCC;
  font-size: 18px;
  display: block;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .week-preview-grid {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .week-day-col {
    flex: 0 0 130px;
    min-width: 130px;
  }
}

/* ================================================================
   数据表格
   ================================================================ */
.table-container {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.table-filters {
  padding: 12px 16px;
  border-bottom: 1px solid var(--separator);
  background: rgba(60,60,67,0.04);
}

.data-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  background: rgba(60,60,67,0.04);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  border-bottom: 1px solid var(--separator);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--separator);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: rgba(255,107,107,0.04);
}

/* ================================================================
   表单元素
   ================================================================ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group small {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  display: block;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.10);
}

.form-group input[readonly],
.form-group input:disabled {
  background: rgba(60,60,67,0.05);
  color: var(--text-light);
  cursor: default;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ================================================================
   按钮
   ================================================================ */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.1px;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), opacity 0.18s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.93);
  opacity: 0.80;
  transition: transform 0.08s, opacity 0.08s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 10px rgba(255,107,107,0.30);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 16px rgba(255,107,107,0.40); }

.btn-secondary {
  background: rgba(60,60,67,0.08);
  color: var(--text);
}
.btn-secondary:hover { background: rgba(60,60,67,0.13); }

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 2px 10px rgba(255,59,48,0.25);
}
.btn-danger:hover { background: #E0251A; box-shadow: 0 4px 16px rgba(255,59,48,0.35); }

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 2px 10px rgba(52,199,89,0.25);
}
.btn-success:hover { background: #28A745; }

.btn-outline {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: rgba(255,255,255,0.85); }

.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-xs { padding: 5px 12px; font-size: 12px; }
.btn-xs.btn-danger { background: rgba(255,59,48,0.12); color: #FF3B30; border: none; box-shadow: none; }
.btn-xs.btn-danger:hover { background: rgba(255,59,48,0.20); }
.btn-full { width: 100%; justify-content: center; }

/* ================================================================
   链接分享 Action Sheet（iOS 18 风格）
   ================================================================ */
.link-action-sheet {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
  animation: modalSlideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 500px;
  margin: 0 auto;
}

.link-sheet-card {
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-radius: 20px;
  padding: 24px 20px 20px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.link-sheet-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.link-sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.link-sheet-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.link-sheet-url {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  background: rgba(255,107,107,0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  user-select: all;
  -webkit-user-select: all;
  line-height: 1.5;
}

.link-sheet-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  padding: 17px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s;
  letter-spacing: -0.1px;
}
.link-sheet-btn:active { opacity: 0.7; }

.link-sheet-btn-primary {
  background: linear-gradient(135deg, #FF6B6B, #FF8E64);
  color: white;
  box-shadow: 0 4px 20px rgba(255,107,107,0.35);
}

.link-sheet-btn-cancel {
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  color: var(--primary);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* ================================================================
   弹窗 (Modals)
   ================================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  transition: opacity 0.3s;
}

.modal-content {
  position: relative;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.10);
  animation: modalIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* modal 内的表格：全宽逃出 padding，横向可滑 */
.modal-content .table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-left: -24px;
  margin-right: -24px;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.modal-overlay {
  animation: overlayIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* iOS sheet drag handle + slide-up entrance */
@media (max-width: 768px) {
  .modal-content {
    animation: modalSlideUp 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .modal-content::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(60,60,67,0.22);
    border-radius: 2px;
    margin: 10px auto 4px;
  }
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-content.modal-large { max-width: 680px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--separator);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1;
  border-radius: 24px 24px 0 0;
}

.modal-header h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }

.modal-close {
  background: rgba(60,60,67,0.10);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: all 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.modal-close:hover { background: rgba(60,60,67,0.18); color: var(--text); }
.modal-close:active { transform: scale(0.90); transition: transform 0.08s; }

.modal form {
  padding: 24px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ================================================================
   Grouped modal (owner/cat/booking detail) — warm bg base
   ================================================================ */
.modal-grouped {
  background: var(--bg) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
/* keep header/footer white within grouped modal */
.modal-grouped .modal-header,
.modal-grouped .modal-footer {
  background: var(--surface);
}
/* inner detail-info-grid: white card on cream bg */
.modal-grouped .detail-info-grid {
  background: var(--surface);
  border-color: var(--border);
}

/* ================================================================
   Booking Detail — new iOS-native design
   ================================================================ */

/* Hero banner */
.bd-hero {
  position: relative;
  background: linear-gradient(145deg, #FF6B6B, #FF9361);
  padding: 28px 24px 24px;
  text-align: center;
  color: white;
}
.bd-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.22);
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.bd-hero-emoji { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.bd-hero-names { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.bd-hero-owner { font-size: 14px; opacity: 0.85; margin-top: 3px; }
.bd-hero-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.bd-hero-dates {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.92;
}
.bd-hero-arrow { opacity: 0.7; }
.bd-hero-nights {
  background: rgba(255,255,255,0.22);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 4px;
}

/* iOS-style grouped sections */
.bd-section { padding: 0 16px; margin-top: 24px; }
.bd-section:last-of-type { margin-bottom: 8px; }
.bd-section-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 4px 6px;
}
.bd-rows {
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
}
.bd-row {
  display: flex;
  align-items: baseline;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.bd-row:last-child { border-bottom: none; }
.bd-row-full { flex-direction: column; gap: 3px; }
.bd-row-label {
  font-size: 14px;
  color: var(--text-light);
  flex-shrink: 0;
  width: 36px;
}
.bd-row-full .bd-row-label { width: auto; }
.bd-row-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  text-align: right;
  word-break: break-word;
}
.bd-row-full .bd-row-value { text-align: left; color: var(--text-secondary); }
.bd-link { color: var(--primary); text-decoration: none; }

/* Multi-cat tabs */
.bd-cat-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bd-cat-tabs::-webkit-scrollbar { display: none; }
.bd-cat-tab {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.18s;
}
.bd-cat-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.bd-cat-panel { display: none; }
.bd-cat-panel.active { display: block; }

/* Footer action buttons */
.bd-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}
.bd-action-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
}
.bd-action-btn:active { opacity: 0.75; transform: scale(0.98); }
.bd-action-btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.bd-action-confirm {
  background: linear-gradient(135deg, #34C759, #30B855);
  color: white;
  box-shadow: 0 4px 16px rgba(52,199,89,0.30);
}
.bd-action-reject {
  background: rgba(255,59,48,0.10);
  color: #FF3B30;
}

/* Detail grid for booking detail modal (legacy, keep for now) */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.detail-item { display: flex; flex-direction: column; gap: 2px; }

/* ================================================================
   多选日历
   ================================================================ */
.visit-calendar {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--primary);
  color: white;
}

.cal-header button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cal-header button:hover { background: rgba(255,255,255,0.35); }
.cal-header span { font-weight: 700; font-size: 15px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: white;
}

.cal-weekday {
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
  background: #FAF6F4;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

.cal-day {
  text-align: center;
  padding: 10px 4px;
  cursor: pointer;
  font-size: 13px;
  border: 1px solid #F8F5F2;
  transition: all 0.15s;
  user-select: none;
}

.cal-day:hover { background: var(--primary-light); }
.cal-day.selected { background: var(--primary); color: white; font-weight: 700; }
.cal-day.today { font-weight: 700; color: var(--primary); }
.cal-day.today.selected { color: white; }
.cal-day.empty { cursor: default; background: #FAFAFA; }
.cal-day.has-visit { background: #E8F5E9; }
.cal-day.has-visit.selected { background: var(--primary); }

/* 已选日期展示 */
.selected-dates-display {
  background: #F8F6F4;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 40px;
  font-size: 13px;
  color: var(--text-light);
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  margin: 2px;
  font-weight: 600;
}

/* ================================================================
   状态标签
   ================================================================ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-active { background: var(--success-light); color: var(--success); }
.badge-completed { background: var(--info-light); color: var(--info); }
.badge-cancelled { background: rgba(255,59,48,0.10); color: var(--danger); }

/* ================================================================
   设置页
   ================================================================ */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--separator);
}

.settings-section.demo-card {
  background: linear-gradient(135deg, #FFF8F5 0%, #FFF2EE 100%);
  border: 1.5px solid rgba(255,107,107,0.25);
  box-shadow: 0 2px 12px rgba(255,107,107,0.08);
}
.settings-section.demo-card h2 { color: var(--primary); }
.demo-card-desc { font-size: 13px; color: var(--text-light); margin-top: 4px; line-height: 1.5; }

/* ================================================================
   性别标签
   ================================================================ */
.gender-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px 2px 6px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  line-height: 1;
}
.gender-badge.male    { background: rgba(0,122,255,0.10); color: #007AFF; }
.gender-badge.female  { background: rgba(255,45,85,0.10); color: #FF2D55; }
.gender-badge.unknown { background: rgba(142,142,147,0.12); color: var(--text-light); }

/* 房型徽章 */
.room-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.room-badge-standard { background: var(--info-light); color: var(--info); border: none; }
.room-badge-luxury   { background: var(--warning-light); color: var(--warning); border: none; }
.room-badge-other    { background: rgba(175,82,222,0.12); color: #AF52DE; border: none; }
.room-badge-unknown  { background: rgba(142,142,147,0.12); color: var(--text-light); border: none; }

/* 可点击文字 */
.link-text {
  cursor: pointer;
  color: var(--info);
  font-weight: 600;
  text-decoration: none;
}
.link-text:hover { opacity: 0.75; }

/* ================================================================
   详情面板
   ================================================================ */
.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  background: rgba(60,60,67,0.04);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--separator);
}

.detail-info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
}

.detail-val {
  font-size: 14px;
  color: var(--text);
}

@media (max-width: 480px) {
  .detail-info-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   Toast 通知
   ================================================================ */
.toast {
  position: fixed;
  bottom: calc(100px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: rgba(30,30,30,0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  color: white;
  padding: 12px 22px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  transition: all 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.15);
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: rgba(52,199,89,0.92); }
.toast.error { background: rgba(255,59,48,0.92); }

/* ================================================================
   Pull-to-refresh indicator
   ================================================================ */
#ptr-indicator {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-56px);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ptr-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ptr-bubble {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(255,107,107,0.25), 0 2px 8px rgba(0,0,0,0.10);
  border: 1px solid rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transform-origin: center;
  transition: transform 0.1s;
}

.ptr-cat {
  font-size: 26px;
  line-height: 1;
  position: absolute;
}

.ptr-arrow {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
  position: absolute;
  bottom: 4px;
  right: 2px;
  opacity: 0;
  transition: transform 0.2s, opacity 0.15s;
}

.ptr-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

#ptr-indicator.ptr-ready .ptr-bubble {
  box-shadow: 0 6px 24px rgba(255,107,107,0.40), 0 2px 8px rgba(0,0,0,0.12);
  background: rgba(255,235,232,0.95);
}

#ptr-indicator.ptr-ready .ptr-label {
  color: var(--primary);
}

#ptr-indicator.ptr-loading .ptr-cat {
  animation: ptr-spin 0.6s linear infinite;
}

@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ================================================================
   Loading 遮罩
   ================================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(242,235,230,0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 900;
  gap: 16px;
}

.loading-overlay p { color: var(--text-light); font-size: 14px; }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   空状态
   ================================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
  /* Span all columns when inside a CSS grid */
  grid-column: 1 / -1;
}

.empty-icon { font-size: 52px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ================================================================
   工具类
   ================================================================ */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.btn-gap { display: flex; gap: 6px; }

/* ================================================================
   响应式
   ================================================================ */

/* 桌面端：顶部 tabs 显示，底部导航隐藏 */
@media (min-width: 769px) {
  .bottom-nav { display: none; }
  .desktop-tabs { display: flex; }
  .tab-content {
    padding-bottom: 40px;
  }
  /* 桌面端 header 高度 */
  .app-header {
    height: 72px;
    padding-top: 0;
  }
  /* 桌面端表格悬停行更明显 */
  .data-table tbody tr:hover td {
    background: #FFF5F0;
  }
  /* 桌面端统计卡片悬停动效 */
  .stat-card.clickable:active { transform: translateY(-1px); }
  /* 桌面端弹窗居中，不贴底 */
  .modal { padding: 24px; align-items: center; }
  .modal-content { border-radius: 24px; }
  .modal-header { border-radius: 24px 24px 0 0; }
}

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

/* 移动端：隐藏顶部 tabs，显示底部导航 */
@media (max-width: 768px) {
  .desktop-tabs { display: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab-content { padding: 16px; padding-bottom: 24px; }
  .app-header { padding: 0 12px; padding-top: env(safe-area-inset-top); }
  .header-title-center { display: block; }
  .app-logo-text { display: none; }
  .actions-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .visits-grid { grid-template-columns: 1fr; }
  .table-container { overflow-x: auto; }
  .data-table { min-width: 600px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-content { border-radius: 24px 24px 0 0; max-height: 92vh; }
  .modal-header { border-radius: 24px 24px 0 0; }
  /* Compact logout on mobile */
  #logout-btn { font-size: 12px; padding: 6px 10px; }
  /* Smaller empty state on mobile */
  .empty-state { padding: 32px 16px; }
  .empty-icon { font-size: 40px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: 14px; }
  .stat-icon { font-size: 30px; }
  .stat-number { font-size: 18px; }
  .cats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .login-card { padding: 32px 24px; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .cats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .cat-card { padding: 10px; }
  .cat-card-name { font-size: 13px; }
  .cat-card-info { font-size: 11px; }
}
