/* ==========================================================================
   recipes-sharing 现代暖调美食工坊设计系统
   UI/UX Pro Max + Frontend Design 规范实现
   ========================================================================== */

:root {
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --primary-light: #fff7ed;
  --primary-border: #fed7aa;
  --secondary: #059669;
  --secondary-light: #ecfdf5;
  --secondary-border: #a7f3d0;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fef2f2;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

img, svg, video, canvas {
  max-width: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #ea580c, #f97316);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

.brand-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary-hover);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.main-content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  flex: 1;
}

/* ==========================================================================
   Hero & Stat Hub
   ========================================================================== */
.hero-hub {
  background: linear-gradient(135deg, #ffffff 0%, #fffbf7 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.15rem;
  min-height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, #ea580c, #f97316);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #c2410c, #ea580c);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--border-subtle);
  border-color: #cbd5e1;
}

.btn-accent {
  background: var(--accent-light);
  color: #92400e;
  border-color: #fde68a;
}

.btn-accent:hover {
  background: #fef08a;
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
  color: var(--danger-hover);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.825rem;
  min-height: 32px;
  border-radius: var(--radius-sm);
}

.btn-icon-only {
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn.is-loading {
  pointer-events: none;
  cursor: wait;
}

.spinner-btn {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ==========================================================================
   Dual Column Section (Menus vs Recipes)
   ========================================================================== */
.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.section-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-badge {
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--border-subtle);
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Search Bars
   ========================================================================== */
.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.85rem 0.6rem 2.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.search-clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: none;
}

/* ==========================================================================
   Cards & Lists
   ========================================================================== */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 200px;
}

.item-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

.item-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: break-word;
}

.card-title a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.card-title a:hover {
  color: var(--primary);
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.badge-time {
  background: var(--accent-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-count {
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ingredients-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip-ingredient {
  font-size: 0.75rem;
  background: var(--secondary-light);
  color: var(--secondary);
  border: 1px solid var(--secondary-border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.chip-more {
  font-size: 0.75rem;
  background: var(--border-subtle);
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Empty & Loading States
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  gap: 0.75rem;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: #94a3b8;
  opacity: 0.7;
}

.empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.empty-desc {
  font-size: 0.825rem;
}

.loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(234, 88, 12, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ==========================================================================
   Modals & Dialogs
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}

.modal-close-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.modal-close-btn:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: #ffffff;
  transition: var(--transition);
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

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

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

/* ==========================================================================
   AI Smart Assistant Box (Recipe Creator)
   ========================================================================== */
.ai-box {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border: 1px dashed #f97316;
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.ai-box-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #9a3412;
}

.ai-box-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.825rem;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  background: #ffffff;
  resize: vertical;
  min-height: 60px;
}

/* ==========================================================================
   Recipe Tag Selector (Menu Creator)
   ========================================================================== */
.tag-selector-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.selected-tags-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.5rem;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  align-items: center;
}

.recipe-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary-hover);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.tag-remove-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0.15rem;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  position: relative;
}

.tag-remove-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.tag-remove-btn:hover {
  opacity: 1;
}

.tag-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 600;
}

.candidate-recipes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.candidate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.candidate-item:hover {
  border-color: var(--primary-border);
  background: #fffbf7;
}

.candidate-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.candidate-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

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

/* ==========================================================================
   Detail Pages (recipe.html & menu.html)
   ========================================================================== */
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-width: 900px;
  margin: 0 auto;
}

.detail-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.detail-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  word-break: break-word;
}

.detail-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.detail-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.step-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.step-text {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
  white-space: pre-wrap;
}

.menu-recipes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* ==========================================================================
   Dynamic Steps Editor (Multiple Single-line Inputs with Add/Move/Delete)
   ========================================================================== */
.steps-editor-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.step-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  transition: var(--transition);
}

.step-input-badge {
  width: 26px;
  height: 26px;
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-input-field {
  flex: 1;
}

.step-row-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-step-action {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  position: relative;
}

.btn-step-action::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.btn-step-action:hover:not(:disabled) {
  background: var(--border-subtle);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.btn-step-action:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-step-action.btn-delete:hover:not(:disabled) {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fecaca;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 400px;
  padding: 0.75rem 1.15rem;
  background: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast.success {
  background: #065f46;
  border-left: 4px solid #34d399;
}

.toast.error {
  background: #991b1b;
  border-left: 4px solid #f87171;
}

.toast.info {
  background: #1e293b;
  border-left: 4px solid #38bdf8;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   Responsive Breakpoints (4.9.1 规范三档适配：桌面 >1024px / 平板 768-1024px / 手机 <768px + 极窄 <480px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 平板端适配 (768px ~ 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .sections-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .main-content {
    padding: 1.5rem 1.25rem 3.5rem;
  }

  .hero-hub {
    padding: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   2. 手机端适配 (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* 导航栏 */
  .header-container {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .brand-subtitle {
    display: none; /* 移动端隐藏长副标题防拥挤折行 */
  }

  .brand-title {
    font-size: 1.1rem;
  }

  .user-nav {
    gap: 0.5rem;
  }

  .user-badge {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 主区域与 Hero Hub */
  .main-content {
    padding: 1rem 0.85rem 3rem;
  }

  .hero-hub {
    padding: 1.25rem 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
  }

  .hero-stats {
    width: 100%;
    justify-content: space-around;
    gap: 0.75rem;
  }

  .stat-item {
    align-items: center;
    text-align: center;
  }

  .stat-num {
    font-size: 1.45rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .hero-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }

  .hero-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  /* 列表与卡片面板 */
  .sections-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .section-panel {
    padding: 1.15rem 1rem;
    gap: 1rem;
  }

  .card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-badges {
    width: 100%;
  }

  .card-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  /* 表单与输入 */
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  /* 弹窗适配 */
  .modal-overlay {
    padding: 0.75rem;
    align-items: center;
  }

  .modal-card {
    max-height: 94vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 1rem 1.15rem;
  }

  .modal-body {
    padding: 1.15rem 1rem;
    gap: 1rem;
  }

  .modal-footer {
    padding: 0.85rem 1rem;
    flex-direction: column-reverse;
    gap: 0.6rem;
  }

  .modal-footer .btn {
    width: 100%;
    min-height: 44px;
  }

  /* 详情页适配 */
  .detail-card {
    padding: 1.25rem 1rem;
    gap: 1.25rem;
  }

  .detail-top-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .detail-top-nav > a.btn {
    width: 100%;
    min-height: 40px;
  }

  .detail-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }

  .detail-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 40px;
  }

  .detail-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .detail-title {
    font-size: 1.4rem;
  }

  /* 触控热区全量保证 (≥ 44×44px / 40px sm) */
  .btn {
    min-height: 44px;
    padding: 0.65rem 1.15rem;
    font-size: 0.925rem;
  }

  .btn-sm {
    min-height: 40px;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
  }

  .btn-step-action {
    width: 36px;
    height: 36px;
  }

  /* Toast 浮层在手机端通栏沉底 */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    max-width: 100%;
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   3. 超窄手机端适配 (< 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .header-container {
    padding: 0.6rem 0.75rem;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
  }

  .brand-title {
    font-size: 1rem;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }

  .stat-num {
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .step-card {
    padding: 0.85rem;
    gap: 0.75rem;
  }

  .step-number {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .detail-actions .btn {
    flex: 1 1 100%;
  }
}
