:root {
  --bg: #0b0f17;
  --bg-card: rgba(20, 28, 42, 0.85);
  --primary: #00e5ff;
  --text-main: #e8f4f8;
  --text-muted: #8ba4be;
  --border: rgba(139, 164, 190, 0.16);
  --success: #00d9a6;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

/* 登录 */
.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(0, 229, 255, 0.08), transparent 45%),
    var(--bg);
  padding: 20px;
  z-index: 1000;
}

.login-card {
  width: 100%;
  max-width: 340px;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.brand-title { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.brand-sub { font-size: 1rem; color: var(--text-main); margin-top: 4px; }
.text-muted { color: var(--text-muted); }

.card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card input, .card select, .card textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
  font-size: 1rem;
}
.login-card input:focus { outline: none; border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
  font-size: 0.95rem;
  cursor: pointer;
}
.btn.primary { background: linear-gradient(135deg, #0099cc, var(--primary)); color: #071018; border: none; font-weight: 600; width: 100%; }
.btn.ghost { background: transparent; border: none; color: var(--text-muted); padding: 6px 10px; }

.login-error { color: #ff4d6a; font-size: 0.85rem; min-height: 20px; margin: 10px 0 0; }

/* 应用 */
.app { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 70px; }

.app-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(11, 15, 23, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.app-main { flex: 1; padding: 16px; }

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.avatar { width: 56px; height: 56px; border-radius: 50%; background: rgba(0, 229, 255, 0.12); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.profile-info .name { font-size: 1.15rem; font-weight: 600; }
.profile-info .meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-box .value { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 0.95rem; color: var(--primary); }

.record-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.record-item:last-child { border-bottom: none; }
.record-date { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.record-main { font-size: 0.9rem; }

.appointment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.appointment-item:last-child { border-bottom: none; }
.appointment-time { font-weight: 600; color: var(--primary); }
.appointment-info { flex: 1; margin-left: 12px; }
.appointment-store { font-size: 0.85rem; }
.appointment-tags { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.status-pill {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 217, 166, 0.12);
  color: var(--success);
  border: 1px solid rgba(0, 217, 166, 0.25);
}

.chart-wrap { width: 100%; height: 160px; }
#trendChart { width: 100%; height: 100%; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: rgba(11, 15, 23, 0.96);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  z-index: 20;
}
.bottom-nav .nav-item {
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 6px 0;
  text-decoration: none;
}
.bottom-nav .nav-item.active { color: var(--primary); }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 2000;
}
.toast.show { opacity: 1; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  width: 95%;
  max-width: 720px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { margin: 0; font-size: 1rem; color: var(--primary); }

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

/* 新版客户手机端 */
.client-mobile .app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(11, 15, 23, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand h1 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-main);
}

.brand-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.brand-avatar.sm {
  width: 36px;
  height: 36px;
  border-width: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
}

.user-pill {
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.1);
  color: var(--primary);
  border: 1px solid rgba(0, 229, 255, 0.25);
}

.tab-content {
  display: none;
}

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

.status-card {
  text-align: center;
}

.status-card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text-main);
}

.radar-wrap {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

.radar-wrap canvas {
  width: 100%;
  height: 100%;
}

.status-hint {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quick-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}

.quick-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.quick-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.loading, .empty-state {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.task-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.task-card:last-child {
  border-bottom: none;
}

.task-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.task-card strong {
  font-size: 0.95rem;
  font-weight: 500;
}

.task-card p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1000;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(720px, 94vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--primary);
}

.drawer-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.archive-item, .feedback-item, .report-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.archive-item:last-child,
.feedback-item:last-child,
.report-item:last-child {
  border-bottom: none;
}

.archive-title, .feedback-category, .report-status {
  font-size: 0.95rem;
  font-weight: 500;
}

.archive-date, .feedback-time, .report-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.feedback-content, .report-desc {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.5;
}

.report-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
}

.family-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.family-item:last-child {
  border-bottom: none;
}

.family-item:not(.pending) {
  cursor: pointer;
}

.family-item.pending {
  opacity: 0.85;
}

.family-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.family-info {
  flex: 1;
  min-width: 0;
}

.family-name {
  font-weight: 500;
}

.family-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.family-arrow {
  color: var(--text-muted);
  font-size: 1.4rem;
  padding-left: 4px;
}

.family-search {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: stretch;
}

.family-search input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(139, 164, 190, 0.35);
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  font-size: 1.05rem;
  line-height: 1.4;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.25);
}

.family-search input::placeholder {
  color: #8ba4be;
  opacity: 1;
}

.family-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15), inset 0 1px 3px rgba(0,0,0,0.2);
}

.family-search .btn {
  padding: 14px 20px;
  white-space: nowrap;
  font-size: 1rem;
  border-radius: 12px;
}

.info-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.info-row:last-child {
  border-bottom: none;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

@media (min-width: 768px) {
  .client-mobile .app-main {
    max-width: 520px;
    margin: 0 auto;
  }
}

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

.client-typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: clientTypingBounce 1.4s infinite ease-in-out both;
}
.client-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.client-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes clientTypingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}
.client-report-chat::-webkit-scrollbar { width: 4px; }
.client-report-chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
