/* ==================== 基础重置与变量 ==================== */
:root {
  --primary: #3b82f6;
  --primary-light: #60a5fa;
  --primary-dark: #2563eb;
  --primary-bg: #eff6ff;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

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

html, body {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
}

/* ==================== 顶部导航栏 ==================== */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 0;
  padding-top: env(safe-area-inset-top);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-inner .logo-img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: contain;
  flex-shrink: 0;
}

.header-inner h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* 全站统一顶部 tab 导航 */
.top-nav-bar {
  border-top: 1px solid rgba(255,255,255,0.18);
  padding: 0 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.top-nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  white-space: nowrap;
}

.top-nav a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.top-nav a:hover {
  color: rgba(255,255,255,0.9);
}

.top-nav a.active {
  color: #fff;
  border-bottom-color: #fff;
}

/* 首页专用操作栏（导航下方） */
.action-bar {
  background: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  position: sticky;
  top: 0;
  z-index: 99;
}

.action-bar .search-box {
  flex: 1;
}

.action-bar .search-box input {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #1e293b;
}

.action-bar .search-box input::placeholder {
  color: #94a3b8;
}

.action-bar .search-box input:focus {
  background: #fff;
  border-color: var(--primary);
}

.action-bar .search-icon {
  color: #94a3b8;
}

.action-bar .search-clear {
  color: #94a3b8;
}

.action-bar .btn-add {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.action-bar .btn-add-smart {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-color: #3b82f6;
}

.action-bar .btn-add-manual {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
}

.action-bar .btn-add:active {
  opacity: 0.85;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
}

.logo h1 {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.header-bottom {
  display: flex;
  width: 100%;
}

/* 搜索框 */
.search-box {
  position: relative;
  width: 100%;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.6);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 7px 32px 7px 32px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
}

.search-box input::placeholder {
  color: rgba(255,255,255,0.5);
}

.search-box input:focus {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.search-box.has-value .search-clear {
  display: flex;
}

/* 新增按钮 */
.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-add svg {
  width: 14px;
  height: 14px;
}

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

/* ==================== 统计栏 ==================== */
.stats-bar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stats-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-right: 1px solid var(--border);
}

.stat-item:last-child {
  border-right: none;
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-item:nth-child(2) .stat-number {
  color: var(--warning);
}

.stat-item:nth-child(3) .stat-number {
  color: var(--success);
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==================== 筛选与排序栏 ==================== */
.filter-bar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 86px; /* 动态调整，匹配 header 高度 */
  z-index: 90;
}

.filter-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-group, .sort-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sort-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  margin-right: 4px;
}

.filter-tag, .sort-tag {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
}

.filter-tag::after, .sort-tag::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 2px;
}

.filter-tag.active, .sort-tag.active {
  color: var(--primary);
  font-weight: 700;
}

.filter-tag.active::after, .sort-tag.active::after {
  width: 60%;
}

.filter-tag:hover:not(.active), .sort-tag:hover:not(.active) {
  color: var(--text);
}

/* ==================== 卡片列表 ==================== */
.card-list {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ==================== 送气卡片 ==================== */
.order-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  animation: cardIn 0.3s ease;
}

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

.order-card:hover {
  box-shadow: var(--shadow-md);
}

.order-card.completed {
  opacity: 0.7;
}

.order-card.completed .card-status {
  background: var(--success-bg);
  color: var(--success);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
}

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--warning-bg);
  color: var(--warning);
}

.card-status svg {
  width: 12px;
  height: 12px;
}

.online-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #ecfdf5;
  color: #059669;
  margin-left: 6px;
}

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

.card-body {
  padding: 12px 16px;
}

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
}

.card-row svg {
  width: 18px;
  height: 18px;
  color: var(--text-light);
  flex-shrink: 0;
  margin-top: 1px;
}

.card-label {
  font-size: 12px;
  color: var(--text-light);
  min-width: 42px;
  flex-shrink: 0;
}

.card-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}

.card-value.address {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.card-value.name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.card-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.card-photos img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.card-value.phone {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 2px;
}

.card-value.phone:hover {
  color: var(--primary-dark);
}

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

.card-remark-empty {
  color: var(--text-light);
  font-size: 13px;
  font-style: italic;
}

/* 卡片底部操作栏 */
.card-actions {
  display: flex;
  border-top: 1px solid var(--border);
}

.card-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 0;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.card-action-btn svg {
  width: 16px;
  height: 16px;
}

.card-action-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.card-action-btn:hover {
  background: var(--bg);
}

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

.card-action-btn.call {
  color: var(--primary);
  text-decoration: none;
}

.card-action-btn.complete {
  color: var(--success);
}

.card-action-btn.edit {
  color: var(--warning);
}

.card-action-btn.delete {
  color: var(--danger);
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state svg {
  width: 100px;
  height: 100px;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-light);
}

/* ==================== 弹窗 ==================== */
.modal-overlay,
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.show,
.confirm-overlay.show {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--card-bg);
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

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

/* ==================== 弹窗标签切换 ==================== */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.modal-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 0;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.modal-tab svg {
  width: 16px;
  height: 16px;
}

.modal-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  border-radius: 2px;
  background: transparent;
  transition: var(--transition);
}

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

.modal-tab.active::after {
  background: var(--primary);
}

.modal-tab:hover:not(.active) {
  color: var(--text);
  background: rgba(0,0,0,0.03);
}

/* ==================== 标签面板 ==================== */
.tab-panel {
  display: none;
}

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

/* ==================== 智能添加面板 ==================== */
.smart-step {
  padding: 20px;
}

.smart-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  background: var(--primary-bg);
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--primary-dark);
  line-height: 1.5;
}

.smart-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}

.smart-form textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  margin-bottom: 16px;
}

.smart-form textarea:focus {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ---------- 语音输入按钮 ---------- */
.voice-input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.btn-voice-mic {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2.5px solid var(--primary);
  background: #fff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.btn-voice-mic svg {
  width: 24px;
  height: 24px;
}
.btn-voice-mic.recording {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 0 0 6px rgba(239,68,68,.18);
  transform: scale(1.12);
}
.btn-voice-mic.recording {
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%,100% { box-shadow: 0 0 0 6px rgba(239,68,68,.18); }
  50%     { box-shadow: 0 0 0 14px rgba(239,68,68,.08); }
}
.voice-label {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}
.voice-label.active {
  color: var(--primary);
  font-weight: 600;
}

.btn-ai-parse {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  background: linear-gradient(135deg, #6366f1 0%, var(--primary) 100%);
  border: none;
  gap: 8px;
}

.btn-ai-parse:hover {
  background: linear-gradient(135deg, #4f46e5 0%, var(--primary-dark) 100%);
}

.btn-ai-parse:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-ai-parse svg {
  width: 20px;
  height: 20px;
}

/* 加载动画 */
.smart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.smart-loading p {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 预览确认 - 多卡片 */
.smart-preview {
  padding: 0;
}

.preview-header {
  margin-bottom: 12px;
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 6px;
}

.preview-title svg {
  width: 20px;
  height: 20px;
}

.preview-count {
  font-size: 12px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 2px;
}

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

/* 预览卡片列表 - 利用 modal 自身滚动 */
.preview-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 0;
}

/* 单张预览卡片 */
.preview-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  position: relative;
  flex-shrink: 0;
}

.preview-card.saved {
  opacity: 0.45;
  pointer-events: none;
}

.preview-card.saved::after {
  content: '已保存';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--success);
  color: white;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  z-index: 2;
  letter-spacing: 2px;
}

.preview-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
}

.preview-card-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 10px;
  border-radius: 10px;
}

.preview-card-actions {
  display: flex;
  gap: 6px;
}

.btn-card-confirm {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  background: var(--success);
  color: white;
}

.btn-card-confirm:hover {
  background: #16a34a;
}

.btn-card-confirm:active {
  transform: scale(0.95);
}

.btn-card-confirm svg {
  width: 14px;
  height: 14px;
}

.btn-card-remove {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--card-bg);
  color: var(--text-light);
  border: 1px solid var(--border);
}

.btn-card-remove:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-card-remove svg {
  width: 14px;
  height: 14px;
}

.preview-card-body {
  display: flex;
  flex-direction: column;
}

.preview-row {
  display: flex;
  align-items: center;
  min-height: 40px;
  border-bottom: 1px solid var(--border);
}

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

.preview-label {
  flex-shrink: 0;
  width: 56px;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border-right: 1px solid var(--border);
  text-align: center;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

.preview-input:focus {
  background: var(--primary-bg);
}

.preview-input::placeholder {
  color: var(--text-light);
  font-style: italic;
}

/* 底部操作栏 */
.preview-bottom-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* 表单 */
.modal-form {
  padding: 20px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.form-group label svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

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

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-cancel {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-cancel:hover {
  background: var(--border);
}

.btn-submit {
  background: var(--primary);
  color: white;
}

.btn-submit svg {
  width: 18px;
  height: 18px;
}

.btn-submit:hover {
  background: var(--primary-dark);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* 确认弹窗 */
.confirm-dialog {
  background: var(--card-bg);
  width: 90%;
  max-width: 340px;
  border-radius: var(--radius-lg);
  padding: 28px 24px 22px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s ease;
  margin-bottom: auto;
  margin-top: auto;
}

.confirm-overlay.show .confirm-dialog {
  transform: scale(1);
}

.confirm-icon svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.confirm-dialog h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-dialog p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

.confirm-actions.vertical {
  flex-direction: column;
}

.confirm-actions.vertical .btn {
  width: 100%;
}

/* 图片查看器 */
.image-viewer-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-viewer-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.viewer-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
}

.viewer-close svg {
  width: 24px;
  height: 24px;
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
}

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

/* 下拉刷新 */
.pull-to-refresh {
  height: 0;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.2s ease;
}

.pull-to-refresh.pulling {
  height: 60px;
}

.pull-content {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.pull-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 加载更多 */
.load-more {
  padding: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.load-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 上传中覆盖层 */
.uploading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.upload-content {
  text-align: center;
}

.upload-content p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

/* ==================== 桌面端适配 ==================== */
@media (min-width: 768px) {
  .header-inner {
    padding: 12px 24px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .header-top {
    justify-content: flex-start;
    gap: 24px;
    flex: 0 0 auto;
  }

  .header-bottom {
    flex: 1;
    max-width: 400px;
    margin-left: auto;
  }

  .logo h1 {
    font-size: 20px;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
  }

  .stats-inner {
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    gap: 60px;
  }

  .stat-item {
    border-right: none;
    min-width: 100px;
  }

  .stat-number {
    font-size: 26px;
  }

  .stat-label {
    font-size: 13px;
  }

  .filter-inner {
    padding: 12px 24px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .filter-bar {
    top: 64px;
  }

  .card-list {
    padding: 20px 24px;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .modal-overlay {
    align-items: center;
  }

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

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

@media (min-width: 1024px) {
  .card-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==================== 小屏手机适配 ==================== */
@media (max-width: 374px) {
  .logo h1 {
    font-size: 16px;
  }

  .btn-add-text {
    display: none;
  }

  .btn-add {
    padding: 8px;
  }

  .add-group {
    gap: 6px;
  }

  .search-box input {
    font-size: 13px;
  }
}

/* ==================== 打印样式 ==================== */
@media print {
  .header, .stats-bar, .filter-bar, .card-actions, .btn-add {
    display: none !important;
  }

  .card-list {
    padding: 0;
  }

  .order-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}

/* ==================== 安全区域适配 ==================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .modal {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}
