/* ============================================
   宜早鲜 全局样式规范 v1.0
   基准：Tailwind CSS 原子类 + 原生 CSS 变量
   ============================================ */

/* === 1. CSS 自定义属性（有机绿色系）=== */
:root {
  /* 主色：有机绿 */
  --primary:        #4A8C3F;
  --primary-light:  #6BA85A;
  --primary-dark:   #3A6F2F;
  --primary-bg:     #EDF5E9;

  /* 功能色 */
  --danger:         #EF4444;
  --danger-light:   #F87171;
  --warning:        #F59E0B;
  --success:        #4A8C3F;
  --info:           #3B82F6;

  /* 中性色 */
  --text-primary:   #1F2937;
  --text-secondary: #6B7280;
  --text-hint:      #9CA3AF;
  --bg-page:        #F5F5F5;
  --bg-card:        #FFFFFF;
  --border:         #E5E7EB;
  --disabled-bg:    #D1D5DB;
  --disabled-text:  #9CA3AF;

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 22px;
}

/* === 2. 全局重置 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }

/* === 3. 按钮标准 === */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #FFF; border: none;
  border-radius: var(--radius-full); padding: 10px 24px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  min-height: 44px; transition: background 0.15s;
  -webkit-user-select: none; user-select: none;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-primary:active { background: var(--primary-dark); transform: scale(0.97); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: #FFF; color: var(--primary);
  border: 1.5px solid var(--primary); border-radius: var(--radius-full);
  padding: 10px 24px; font-size: 15px; font-weight: 600;
  cursor: pointer; min-height: 44px; transition: all 0.15s;
}
.btn-secondary:hover { background: var(--primary-bg); }
.btn-secondary:active { transform: scale(0.97); }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #FFF; border: none;
  border-radius: var(--radius-full); padding: 10px 24px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  min-height: 44px; transition: background 0.15s;
}
.btn-danger:hover { background: var(--danger-light); }
.btn-danger:active { transform: scale(0.97); }

.btn-disabled {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--disabled-bg); color: var(--disabled-text);
  border: none; border-radius: var(--radius-full);
  padding: 10px 24px; font-size: 15px; font-weight: 600;
  cursor: not-allowed; min-height: 44px; pointer-events: none;
}

.btn-text {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--primary); border: none;
  padding: 8px 12px; font-size: 14px; cursor: pointer;
  transition: color 0.15s;
}
.btn-text:hover { color: var(--primary-light); }

.btn-full {
  display: flex; align-items: center; justify-content: center;
  width: 100%; background: var(--primary); color: #FFF; border: none;
  border-radius: var(--radius-full); padding: 12px 24px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  min-height: 48px; transition: background 0.15s;
}
.btn-full:hover { background: var(--primary-light); }
.btn-full:active { background: var(--primary-dark); }

/* === 4. 状态标签 === */
.tag-green  { display:inline-block; padding:2px 10px; border-radius:10px; font-size:12px; background:var(--primary-bg); color:var(--primary); }
.tag-gray   { display:inline-block; padding:2px 10px; border-radius:10px; font-size:12px; background:#F3F4F6; color:var(--text-secondary); }
.tag-orange { display:inline-block; padding:2px 10px; border-radius:10px; font-size:12px; background:#FFF7ED; color:#EA580C; }
.tag-red    { display:inline-block; padding:2px 10px; border-radius:10px; font-size:12px; background:#FEF2F2; color:var(--danger); }

/* === 5. 统一导航头部 === */
.nav-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 12px; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-back {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: transparent; border: none;
  color: var(--text-primary); cursor: pointer; border-radius: 50%;
  flex-shrink: 0;
}
.nav-back:active { background: var(--primary-bg); }
.nav-title {
  font-size: 17px; font-weight: 600; color: var(--text-primary);
  text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-action {
  width: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}

/* === 6. 弹窗/Sheet 关闭按钮 === */
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sheet-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: transparent; border: none;
  color: var(--text-secondary); cursor: pointer; border-radius: 50%;
  flex-shrink: 0;
}
.sheet-close:active { background: #F3F4F6; }
.sheet-title {
  font-size: 17px; font-weight: 600; color: var(--text-primary);
  text-align: center; flex: 1;
}
.sheet-action {
  width: 32px; flex-shrink: 0;
}

/* === 7. 表单元素 === */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 14px; font-weight: 500;
  color: var(--text-primary); margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px;
  color: var(--text-primary); background: #FFF;
  transition: border-color 0.15s; outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-hint); }

/* === 8. 卡片 === */
.card {
  background: var(--bg-card); border-radius: var(--radius-md);
  padding: 16px; margin: 0 16px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-info {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 13px; color: var(--text-secondary); margin-bottom: 4px;
}
.card-actions {
  display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end;
}
.highlight { color: var(--primary); font-weight: 600; }

/* === 9. 空状态 === */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-hint);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 15px; }

/* === 10. 加载中 === */
.loading {
  text-align: center; padding: 40px; color: var(--text-hint);
  font-size: 14px;
}
.loading::before {
  content: ''; display: block; width: 28px; height: 28px;
  margin: 0 auto 12px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === 11. 底部提交栏 === */
.submit-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-card); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); z-index: 50;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.submit-bar .total {
  font-size: 20px; font-weight: 700; color: var(--danger);
}
.submit-btn {
  background: var(--primary); color: #FFF; border: none;
  border-radius: var(--radius-full); padding: 12px 32px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  min-height: 44px; transition: background 0.15s;
}
.submit-btn:hover { background: var(--primary-light); }
.submit-btn:disabled {
  background: var(--disabled-bg); color: var(--disabled-text);
  cursor: not-allowed; pointer-events: none;
}

/* === 12. Tab 切换 === */
.tab-bar-row {
  display: flex; background: var(--bg-card); border-bottom: 1px solid var(--border);
  position: sticky; top: 48px; z-index: 50;
}
.tab-btn {
  flex: 1; padding: 12px 0; text-align: center; font-size: 14px;
  color: var(--text-secondary); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer; transition: all 0.15s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* === 13. 列表项 === */
.list-card {
  background: var(--bg-card); margin: 0 16px 8px; padding: 14px 16px;
  border-radius: var(--radius-md); box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.list-card .card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.list-card .card-meta { font-size: 12px; color: var(--text-hint); margin-bottom: 2px; }
.list-card .card-amount {
  font-size: 16px; font-weight: 700; color: var(--primary);
}
.list-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

/* === 14. 分页 === */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 20px; font-size: 13px; color: var(--text-secondary);
}
.pagination button {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #FFF; color: var(--text-primary); cursor: pointer; font-size: 13px;
}
.pagination button:disabled {
  color: var(--disabled-text); background: #F9FAFB; cursor: not-allowed;
}
.pagination button:not(:disabled):hover { border-color: var(--primary); color: var(--primary); }

/* === 15. 动画 === */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* === 16. 手风琴菜单 === */
.menu-group-header {
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.menu-group-header:active { background: var(--primary-bg); }
.menu-sub-item:active { transform: scale(0.96); background: var(--primary-bg); }

/* === 17. 统计卡片 === */
.stat-card { transition: transform 0.15s; }
.stat-card:active { transform: scale(0.97); }