.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  /* Safari < 17 fallback */
  min-height: 100vh;
  height: 100vh;
  /* Dynamic Viewport Height — 自动减去 Safari 工具栏,根因解 14寸 Safari 翻页/底部按钮被截 */
  min-height: 100dvh;
  height: 100dvh;
  overflow-y: auto;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.backBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-btn);
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.backBtn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.pageTitle {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
}

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

.username {
  color: var(--color-text-secondary);
  font-size: 13px;
}

.changePwBtn {
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--color-border-card);
  border-radius: 6px;
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.changePwBtn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.logoutBtn {
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--color-border-card);
  border-radius: 6px;
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.logoutBtn:hover {
  background: var(--color-bg-hover);
}

/* Warning banners */
.warningBanner {
  padding: 10px 16px;
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius-card);
  color: var(--color-warning);
  font-size: 13px;
  margin-bottom: 20px;
  text-align: center;
}

.dangerBanner {
  padding: 10px 16px;
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-card);
  color: var(--color-danger);
  font-size: 13px;
  margin-bottom: 20px;
  text-align: center;
}

/* Sections */
.overviewSection,
.trendSection,
.recordsSection {
  margin-bottom: 24px;
}

.sectionTitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 14px;
}

/* Overview grid */
.overviewGrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.quotaCard {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-card-light);
}

.quotaLabel {
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
}

.quotaValue {
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.progressBar {
  width: 100%;
  height: 6px;
  background: var(--color-bg-placeholder);
  border-radius: 3px;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.quotaPercent {
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-top: 6px;
  text-align: right;
}

/* Trend section */
.trendHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.trendHeader .sectionTitle {
  margin-bottom: 0;
}

.trendTabs {
  display: flex;
  gap: 4px;
  background: var(--color-bg-card);
  border-radius: 8px;
  padding: 3px;
}

.tab,
.tabActive {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab {
  background: transparent;
  color: var(--color-text-secondary);
}

.tab:hover {
  color: var(--color-text-primary);
}

.tabActive {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.sparklineWrapper {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-card-light);
}

/* Records */
.recordsList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty {
  text-align: center;
  color: var(--color-text-secondary);
  padding: 40px 0;
  font-size: 14px;
}

.recordItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-card);
  transition: border-color 0.2s;
  box-shadow: var(--shadow-card-light);
}

.recordItem:hover {
  border-color: var(--color-border-card);
}

.recordLeft {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

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

.recordPrompt {
  color: var(--color-text-primary);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recordRight {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: 16px;
}

.recordSeconds {
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 600;
}

.recordMode {
  color: var(--color-text-secondary);
  font-size: 12px;
  padding: 2px 8px;
  background: var(--color-bg-upload);
  border-radius: 4px;
}

.recordStatus {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
}

.queued {
  color: var(--color-text-secondary);
  background: var(--color-bg-upload);
}

.processing {
  color: var(--color-primary);
  background: var(--color-info-bg-hover);
}

.completed {
  color: var(--color-success);
  background: var(--color-success-bg-hover);
}

.failed {
  color: var(--color-danger);
  background: var(--color-danger-bg-hover);
}

.loadMoreBtn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-card);
  color: var(--color-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.loadMoreBtn:hover {
  background: var(--color-bg-hover);
}

/* Skeleton */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 60px;
}

.skeletonBar {
  height: 32px;
  width: 180px;
  background: var(--color-bg-card);
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeletonCards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  height: 180px;
}

@media (max-width: 900px) {
  .skeletonCards {
    grid-template-columns: 1fr 1fr;
  }
}

.skeletonCards::before,
.skeletonCards::after {
  content: '';
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  animation: pulse 1.5s ease-in-out infinite;
}

.skeletonChart {
  height: 120px;
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (max-width: 900px) {
  .overviewGrid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Password Modal — aligned with ConfirmModal / TeamsPage modal */
.modalOverlay {
  position: fixed;
  inset: 0;
  background: var(--color-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal {
  background: var(--color-bg-modal-elevated);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-card);
  padding: 24px;
  width: 400px;
  max-width: 90vw;
}

.modalTitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 20px;
}

.formGroup {
  margin-bottom: 16px;
}

.formLabel {
  display: block;
  color: var(--color-text-secondary);
  font-size: 13px;
  margin-bottom: 6px;
}

.formInput {
  width: 100%;
  padding: 8px 12px;
  background: var(--color-bg-page);
  border: 1px solid var(--color-border-card);
  border-radius: 8px;
  color: var(--color-text-primary);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

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

.formError {
  color: var(--color-danger);
  font-size: 12px;
  margin-bottom: 12px;
}

.modalActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.cancelBtn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--color-border-card);
  border-radius: 8px;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.saveBtn {
  padding: 8px 16px;
  background: var(--color-primary);
  border: none;
  border-radius: 8px;
  color: var(--color-on-primary);
  font-size: 13px;
  cursor: pointer;
}

.saveBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .overviewGrid {
    grid-template-columns: 1fr;
  }
  .header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .recordRight {
    flex-wrap: wrap;
    gap: 6px;
  }
}
