/* ===========================
   糖宝工作台 - Stylesheet
   =========================== */

:root {
  --primary: #FF6B8A;
  --primary-dark: #E85575;
  --primary-light: #FFB5C5;
  --primary-bg: #FFF5F7;
  --bg: #FFF5F7;
  --card-bg: #FFFFFF;
  --text: #2D2D2D;
  --text-light: #888888;
  --text-lighter: #BBBBBB;
  --border: #FFE4EC;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --shadow: 0 2px 12px rgba(255, 107, 138, 0.08);
  --shadow-lg: 0 4px 20px rgba(255, 107, 138, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --tab-bar-h: 60px;
  --header-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* Header */
.app-header {
  height: var(--header-h);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(255, 107, 138, 0.2);
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.35);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  padding-bottom: calc(var(--tab-bar-h) + 24px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

/* Tab Content */
.tab-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Titles */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px;
  padding-left: 4px;
}

/* Tab Bar */
.tab-bar {
  height: var(--tab-bar-h);
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
  cursor: pointer;
  color: var(--text-light);
  transition: color 0.2s;
  min-width: 0;
  min-height: 40px;
}

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

.tab-icon {
  font-size: 18px;
  line-height: 1;
}

.tab-label {
  font-size: 10px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.tab-btn.active .tab-icon {
  transform: scale(1.15);
  transition: transform 0.2s;
}

/* Date Card */
.date-card {
  text-align: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.date-text {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.date-lunar {
  font-size: 14px;
  opacity: 0.9;
}

/* Checkin */
.checkin-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkin-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.checkin-btn.done {
  background: var(--success);
}

.checkin-btn:active {
  transform: scale(0.96);
}

.streak-badge {
  background: var(--primary-bg);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

/* Mood */
.mood-section {
  text-align: center;
}

.mood-buttons {
  display: flex;
  justify-content: space-around;
  margin-top: 8px;
}

.mood-btn {
  background: var(--primary-bg);
  border: 2px solid transparent;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mood-btn.selected {
  border-color: var(--primary);
  background: #fff;
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

/* Task List */
.task-list {
  padding: 8px 0;
}

.task-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--primary-bg);
}

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

.task-check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--primary-light);
  border-radius: 6px;
  margin-right: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.task-check.done {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-size: 14px;
}

.task-text {
  flex: 1;
  font-size: 14px;
}

.task-item.done .task-text {
  text-decoration: line-through;
  color: var(--text-lighter);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  text-align: center;
  padding: 14px 8px;
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

/* FAB */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tab-bar-h) + 20px + var(--safe-bottom));
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 107, 138, 0.3);
  z-index: 50;
  transition: all 0.2s;
}

.fab:active {
  transform: scale(0.95);
}

/* Finance */
.finance-summary {
  padding: 16px;
}

.finance-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.finance-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.finance-label {
  font-size: 12px;
  color: var(--text-light);
}

.finance-amount {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}

.finance-amount.income {
  color: var(--success);
}

.finance-amount.expense {
  color: var(--danger);
}

.budget-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-light);
}

.text-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.progress-bar {
  height: 8px;
  background: var(--primary-bg);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.budget-text {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

/* Chart */
.chart-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 8px;
  height: 140px;
  padding: 16px 12px 28px;
  position: relative;
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 70%;
  max-width: 32px;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
  position: relative;
}

.chart-bar-label {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 4px;
}

.chart-bar-value {
  font-size: 9px;
  color: var(--text-light);
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Transaction List */
.tx-group-date {
  font-size: 12px;
  color: var(--text-light);
  padding: 8px 4px 4px;
  font-weight: 600;
}

.tx-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}

.tx-category {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-right: 12px;
  flex-shrink: 0;
}

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

.tx-note {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-cat-text {
  font-size: 12px;
  color: var(--text-light);
}

.tx-amount {
  font-size: 15px;
  font-weight: 700;
}

.tx-amount.income {
  color: var(--success);
}

.tx-amount.expense {
  color: var(--text);
}

.tx-delete {
  background: none;
  border: none;
  color: var(--text-lighter);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 8px;
}

/* Fitness */
.fitness-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.fitness-stats .stat-card {
  padding: 10px 4px;
}

.fitness-stats .stat-value {
  font-size: 18px;
}

.fitness-stats .stat-label {
  font-size: 10px;
}

/* Heatmap */
.heatmap-container {
  overflow-x: auto;
  padding: 12px;
}

.heatmap-grid {
  display: flex;
  gap: 3px;
}

.heatmap-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #F0F0F0;
}

.heatmap-cell.level-1 { background: #FFD0DC; }
.heatmap-cell.level-2 { background: #FF9DB3; }
.heatmap-cell.level-3 { background: #FF6B8A; }
.heatmap-cell.level-4 { background: #E85575; }

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--text-light);
  padding: 0 4px 8px;
}

.heatmap-legend .heatmap-cell {
  width: 12px;
  height: 12px;
}

/* Fitness list */
.fitness-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}

.fitness-type-icon {
  font-size: 24px;
  margin-right: 12px;
}

.fitness-info {
  flex: 1;
}

.fitness-detail {
  font-size: 14px;
  font-weight: 500;
}

.fitness-date {
  font-size: 12px;
  color: var(--text-light);
}

/* Skills */
.skill-card {
  margin-bottom: 10px;
}

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

.skill-name {
  font-size: 15px;
  font-weight: 600;
}

.skill-percent {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.skill-progress-bar {
  height: 10px;
  background: var(--primary-bg);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}

.skill-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 5px;
  transition: width 0.5s ease;
}

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

.skill-btn {
  background: var(--primary-bg);
  border: none;
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
}

.skill-btn:active {
  background: var(--primary-light);
}

/* Learning log */
.learning-log-item {
  padding: 12px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary-light);
}

.log-skill {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.log-meta {
  font-size: 12px;
  color: var(--text-light);
}

.log-notes {
  font-size: 13px;
  margin-top: 4px;
  color: var(--text);
}

/* Outfits */
.outfit-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  margin-bottom: 12px;
  white-space: nowrap;
}

.filter-tag {
  background: var(--primary-bg);
  border: none;
  color: var(--text-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.filter-tag.active {
  background: var(--primary);
  color: #fff;
}

.outfit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.outfit-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.outfit-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--primary-bg);
}

.outfit-info {
  padding: 8px 10px;
}

.outfit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.outfit-tag {
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

.outfit-date {
  font-size: 11px;
  color: var(--text-light);
}

.outfit-empty-img {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--primary-light);
}

/* Weekly Review */
.weekly-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.weekly-stat {
  text-align: center;
  padding: 10px;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
}

.weekly-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.weekly-stat-label {
  font-size: 12px;
  color: var(--text-light);
}

.mood-chart-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

/* Review History */
.review-card {
  margin-bottom: 12px;
}

.review-week {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.review-section-text {
  font-size: 13px;
  margin-bottom: 4px;
}

.review-section-label {
  font-weight: 600;
  color: var(--text-light);
}

/* Clinical */
.privacy-note {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  color: #8D6E63;
  font-size: 13px;
  text-align: center;
}

.search-bar {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-bottom: 12px;
}

.search-bar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  font-size: 14px;
  background: var(--bg);
}

.search-bar select {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0 8px;
  font-size: 13px;
  background: var(--bg);
}

.patient-card {
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.patient-card:active {
  box-shadow: var(--shadow-lg);
}

.patient-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.patient-name {
  font-size: 16px;
  font-weight: 600;
}

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

.status-初诊 { background: #E3F2FD; color: #1976D2; }
.status-治疗中 { background: #FFF3E0; color: #F57C00; }
.status-已完成 { background: #E8F5E9; color: #388E3C; }
.status-随访 { background: #F3E5F5; color: #7B1FA2; }

.patient-info-row {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 6px;
}

.patient-complaint {
  font-size: 13px;
  margin-top: 4px;
  color: var(--text);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
}

.modal-sheet {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 20px 24px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-size: 14px;
  background: var(--bg);
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.type-toggle button {
  flex: 1;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.type-toggle button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.category-btn {
  padding: 8px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.category-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.primary-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.primary-btn:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.secondary-btn {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.checkbox-item.checked {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  accent-color: var(--primary);
}

/* Photo upload */
.photo-upload-area {
  width: 100%;
  aspect-ratio: 3/4;
  border: 2px dashed var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.photo-upload-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-upload-area .placeholder {
  text-align: center;
  color: var(--primary);
  font-size: 14px;
}

.photo-upload-area .placeholder span {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

/* Tag selector */
.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-option {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg);
  transition: all 0.2s;
}

.tag-option.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Settings Panel */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.settings-overlay.active {
  display: block;
  opacity: 1;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  height: 100%;
  background: #fff;
  z-index: 151;
  padding: 20px;
  transition: right 0.3s ease;
  overflow-y: auto;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.1);
}

.settings-panel.active {
  right: 0;
}

.settings-panel h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text);
}

.settings-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 8px;
  color: var(--text);
}

.settings-item.danger {
  color: var(--danger);
  border-color: #FFCDD2;
}

.settings-item:active {
  background: var(--primary-bg);
}

.settings-panel hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.settings-close {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 14px;
  cursor: pointer;
}

.swim-days-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.swim-days-picker label {
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
}

.swim-days-picker input {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  accent-color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--tab-bar-h) + 30px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-lighter);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state .empty-text {
  font-size: 14px;
}

/* Case gallery */
.case-photo-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.case-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-xs);
  background: var(--primary-bg);
}

.case-photo-label {
  font-size: 11px;
  text-align: center;
  color: var(--text-light);
  margin-top: -4px;
}

.case-section {
  margin-top: 12px;
}

.visit-item {
  padding: 10px;
  border-left: 3px solid var(--primary-light);
  margin-bottom: 6px;
  background: var(--bg);
  border-radius: var(--radius-xs);
}

/* Slider */
.range-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-control input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.range-value {
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
  text-align: right;
}

/* Responsive */
@media (min-width: 481px) {
  #app {
    max-width: 480px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
  }

  .fab {
    right: calc(50% - 240px + 20px);
  }
}

@media (max-width: 360px) {
  .tab-label {
    font-size: 9px;
  }
  .tab-icon {
    font-size: 16px;
  }
  .stats-grid {
    gap: 8px;
  }
  .stat-value {
    font-size: 18px;
  }
}

/* Sub-tabs */
.sub-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 12px;
}

.sub-tab-btn {
  flex: 1;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
}

.sub-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Wardrobe filters */
.wardrobe-filters {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-bottom: 12px;
}

.wardrobe-filter-select {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 13px;
  background: var(--bg);
}

/* Wardrobe grid */
.wardrobe-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin: 12px 0 8px;
  padding-left: 4px;
}

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

.wardrobe-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}

.wardrobe-item:active {
  transform: scale(0.96);
}

.wardrobe-item-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #fff;
  border-bottom: 1px solid var(--primary-bg);
}

.wardrobe-item-photo-empty {
  width: 100%;
  aspect-ratio: 1;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--primary-light);
  border-bottom: 1px solid var(--primary-bg);
}

.wardrobe-item-info {
  padding: 4px 6px 6px;
}

.wardrobe-item-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.wardrobe-item-season {
  font-size: 10px;
  color: var(--text-light);
}

.wardrobe-item-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #ddd;
  vertical-align: middle;
  margin-left: 4px;
}

/* Outfit creator */
.outfit-creator-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  padding: 16px;
}

.outfit-slot {
  width: 100%;
  max-width: 200px;
  text-align: center;
}

.outfit-slot-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}

.outfit-slot-thumb {
  width: 100%;
  aspect-ratio: 1;
  border: 2px dashed var(--primary-light);
  border-radius: var(--radius);
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}

.outfit-slot-thumb.filled {
  border-style: solid;
  border-color: var(--primary);
}

.outfit-slot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.outfit-slot-placeholder {
  font-size: 28px;
  color: var(--primary-light);
}

/* Saved outfits gallery */
.saved-outfits-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
}

.saved-outfit-card {
  flex-shrink: 0;
  width: 120px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.saved-outfit-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px;
  background: var(--primary-bg);
}

.saved-outfit-thumb {
  width: calc(50% - 2px);
  aspect-ratio: 1;
  border-radius: 4px;
  object-fit: cover;
  background: #fff;
}

.saved-outfit-thumb-empty {
  width: calc(50% - 2px);
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.5);
}

.saved-outfit-info {
  padding: 6px 8px;
}

.saved-outfit-name {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-outfit-occasion {
  font-size: 10px;
  color: var(--primary);
}

/* FAB row for multiple FABs */
.fab-row {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tab-bar-h) + 20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  align-items: flex-end;
}

.fab-inline {
  position: static;
}

.fab-secondary {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary-light);
  box-shadow: 0 4px 12px rgba(255, 107, 138, 0.15);
}

/* Recipe grid */
.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.recipe-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

.recipe-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--primary-bg);
}

.recipe-photo-empty {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.recipe-info {
  padding: 8px 10px;
}

.recipe-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.recipe-tag {
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

.recipe-meal-type {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.recipe-star-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.recipe-star-btn.active {
  background: #FFF3CD;
}

/* Meal plan grid */
.meal-plan-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-bottom: 12px;
}

.meal-plan-toolbar .skill-btn {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
}

.meal-plan-grid {
  overflow-x: auto;
  padding: 8px;
}

.meal-plan-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.meal-plan-day {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  width: 38px;
  flex-shrink: 0;
  text-align: center;
}

.meal-plan-cell {
  flex: 1;
  min-height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-align: center;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--text-light);
  overflow: hidden;
  transition: border-color 0.2s;
}

.meal-plan-cell.filled {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-light);
  font-weight: 600;
}

.meal-plan-cell:active {
  border-color: var(--primary);
}

.meal-plan-header {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.meal-plan-header-cell {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-align: center;
}

.meal-plan-header-spacer {
  width: 38px;
  flex-shrink: 0;
}

/* Import preview table */
.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}

.import-preview-table th {
  background: var(--primary-bg);
  color: var(--primary);
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
}

.import-preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.import-preview-table tr.skip {
  opacity: 0.4;
}

.category-mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}

.category-mapping-table th {
  background: var(--primary-bg);
  color: var(--primary);
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
}

.category-mapping-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.category-mapping-table select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
  background: var(--bg);
}

.import-summary {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
  text-align: center;
}

.import-duplicate-info {
  font-size: 12px;
  color: var(--warning);
  margin-bottom: 8px;
  text-align: center;
}

/* Shopping list */
.shopping-list-item {
  display: flex;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.shopping-list-source {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* =================== Login Screen =================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #FF6B8A 0%, #FFB5C5 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 28px 32px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  text-align: center;
}
.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin: 0 0 4px;
}
.login-subtitle {
  font-size: 14px;
  color: #999;
  margin: 0 0 24px;
}
.login-tabs {
  display: flex;
  margin-bottom: 20px;
  background: #FFF5F7;
  border-radius: 12px;
  padding: 4px;
}
.login-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  font-size: 15px;
  color: #999;
  border-radius: 8px;
  transition: all 0.2s;
  cursor: pointer;
}
.login-tab.active {
  background: #fff;
  color: #FF6B8A;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #f0f0f0;
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.login-input:focus {
  outline: none;
  border-color: #FF6B8A;
}
.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #FF6B8A, #FF8FA8);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
  margin-top: 4px;
}
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.6; }
.login-hint {
  font-size: 13px;
  color: #bbb;
  margin: 16px 0 0;
  line-height: 1.5;
}

/* Sync Status */
.sync-status {
  font-size: 13px;
  padding: 10px 12px;
  background: #FFF5F7;
  border-radius: 8px;
  margin-bottom: 8px;
  line-height: 1.6;
}
