/* style.css - Money Record 主样式(移动端优先) */

:root {
  --primary: #4CAF50;
  --primary-dark: #388E3C;
  --primary-light: #C8E6C9;
  --bg: #F5F5F5;
  --card-bg: #FFFFFF;
  --text: #212121;
  --text-secondary: #757575;
  --border: #E0E0E0;
  --danger: #F44336;
  --warning: #FF9800;
  --info: #2196F3;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-theme="dark"] {
  --bg: #121212;
  --card-bg: #1E1E1E;
  --text: #ECECEC;
  --text-secondary: #9E9E9E;
  --border: #2C2C2C;
  --primary-light: #2E3B2F;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* 顶部 */
.app-header {
  flex-shrink: 0;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: var(--primary);
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
  z-index: 10;
}
.app-header h1 {
  font-size: 18px;
  font-weight: 600;
}

/* 主内容 */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 12px 80px;
}

/* 底部导航 */
.bottom-nav {
  flex-shrink: 0;
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -1px 4px rgba(0,0,0,0.05);
  z-index: 10;
}
.nav-item {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  transition: color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.nav-item .emoji, .nav-item svg { font-size: 22px; line-height: 1; }
.nav-item.active { color: var(--primary); }
.nav-item.active span { font-weight: 600; }

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

/* 通用按钮 */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn-block { display: block; width: 100%; padding: 14px; font-size: 16px; }
.btn-secondary { background: var(--text-secondary); }
.btn-danger { background: var(--danger); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

/* 输入框 */
.input, .select, .textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.textarea { resize: vertical; min-height: 60px; }

/* 占位 */
.placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 14px;
}

/* ========== 首页 ========== */
.budget-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.budget-card .budget-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.budget-card .budget-label { font-size: 13px; opacity: 0.9; }
.budget-card .budget-amount { font-size: 26px; font-weight: 700; }
.budget-card .budget-amount .unit { font-size: 14px; opacity: 0.9; margin-left: 4px; }
.budget-bar {
  height: 6px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.budget-bar-fill {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.budget-bar-fill.over { background: #FFCDD2; }
.budget-card .budget-hint {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 6px;
}

/* 金额大输入 */
.amount-input-area {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.amount-display {
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
  min-height: 50px;
  line-height: 1.1;
  word-break: break-all;
}
.amount-display .currency { font-size: 18px; color: var(--text-secondary); margin-right: 4px; vertical-align: top; }
.amount-display.empty { color: var(--text-secondary); font-size: 22px; font-weight: 400; }
.amount-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.keypad-btn {
  padding: 16px 0;
  font-size: 22px;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s;
}
.keypad-btn:active { background: var(--border); }
.keypad-btn.fn { background: var(--primary-light); color: var(--primary-dark); }
.keypad-btn.fn-del { background: #FFEBEE; color: var(--danger); }

/* 分类网格 */
.category-section { margin-bottom: 12px; }
.category-section-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 0 4px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border: 2px solid transparent;
}
.category-item:active { background: var(--bg); }
.category-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}
.category-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.category-name { font-size: 12px; color: var(--text); }

/* 高级选项折叠 */
.advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.advanced-toggle .arrow { transition: transform 0.2s; }
.advanced-toggle.open .arrow { transform: rotate(180deg); }
.advanced-panel {
  display: none;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.advanced-panel.open { display: block; }
.advanced-panel .form-row { margin-bottom: 10px; }
.advanced-panel .form-row:last-child { margin-bottom: 0; }
.advanced-panel label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* 今日记录列表 */
.today-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.today-list-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.today-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.today-item:last-child { border-bottom: none; }
.today-item .icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.today-item .info { flex: 1; min-width: 0; }
.today-item .info .name { font-size: 14px; color: var(--text); }
.today-item .info .note {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-item .amount { font-size: 15px; font-weight: 600; color: var(--text); }
.today-item .amount.expense { color: var(--text); }
.today-item .amount.income { color: var(--primary); }

/* 切换收入浮动按钮 */
.fab-income {
  position: fixed;
  right: 16px;
  bottom: calc(72px + var(--safe-bottom));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--info);
  color: #fff;
  border: none;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(33,150,243,0.4);
  cursor: pointer;
  z-index: 5;
}
.fab-income:active { transform: scale(0.92); }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

/* ========== Modal ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card-bg);
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  line-height: 1;
}

/* ========== 设置页 ========== */
.settings-tabs {
  display: flex;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 4px;
  box-shadow: var(--shadow);
  gap: 4px;
}
.settings-tab {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.settings-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-header h3 { font-size: 16px; }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
}

.hint-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.hint-block {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 分类列表 */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.cat-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.cat-row-info { flex: 1; min-width: 0; }
.cat-row-name { font-size: 14px; color: var(--text); }
.cat-row-status { display: flex; gap: 4px; margin-top: 2px; }
.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.badge-active { background: var(--primary-light); color: var(--primary-dark); }
.badge-inactive { background: var(--border); color: var(--text-secondary); }
.badge-custom { background: #E3F2FD; color: #1976D2; }
.cat-row-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--card-bg);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { background: var(--border); }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* 图标/颜色选择器 */
.icon-picker, .color-picker {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.icon-picker { grid-template-columns: repeat(8, 1fr); }
.color-picker { grid-template-columns: repeat(10, 1fr); }
.icon-choice, .color-choice {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.icon-choice.selected, .color-choice.selected {
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(76,175,80,0.3);
}

/* 预算分类行 */
.cat-budget-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.cat-budget-row:last-child { border-bottom: none; }
.cat-budget-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cat-budget-info { flex: 1; font-size: 14px; }
.cat-budget-input { width: 90px; padding: 8px; }

/* 数据统计 */
.data-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.data-stat-item {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.data-stat-item .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
.data-stat-item .lbl {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* 主题选项 */
.theme-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.theme-option {
  padding: 16px;
  border: 2px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s;
}
.theme-option.active { border-color: var(--primary); background: var(--primary-light); }
.theme-preview {
  display: block;
  width: 100%;
  height: 40px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.theme-preview.light { background: linear-gradient(to bottom, #fff 50%, #F5F5F5 50%); border: 1px solid var(--border); }
.theme-preview.dark  { background: linear-gradient(to bottom, #1E1E1E 50%, #121212 50%); }

.form-row label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ========== 统计页 ========== */
.stats-view-tabs {
  display: flex;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 12px;
}
.stats-view-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.stats-view-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.stats-summary-item {
  background: var(--card-bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  text-align: center;
  box-shadow: var(--shadow);
}
.stats-summary-item .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.stats-summary-item .lbl { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.chart-card h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text);
}
.chart-container { width: 100%; height: 240px; }

/* 日历视图 */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  background: var(--card-bg);
  padding: 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.calendar-header .month-title { font-size: 16px; font-weight: 600; }
.calendar-header .nav-btn {
  width: 32px; height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}
.calendar-header .nav-btn:active { background: var(--border); }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  background: var(--card-bg);
  padding: 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.calendar-weekday {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 0;
  font-weight: 500;
}
.calendar-day {
  aspect-ratio: 1;
  border-radius: 6px;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  position: relative;
  min-height: 44px;
}
.calendar-day.empty { background: transparent; cursor: default; }
.calendar-day.today { border: 2px solid var(--primary); }
.calendar-day .day-num { font-size: 12px; line-height: 1; }
.calendar-day .day-amount {
  font-size: 9px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1;
}
.calendar-day.has-data { font-weight: 600; }
.calendar-day .reim-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--warning);
}
.calendar-day.selected { background: var(--primary); color: #fff; }
.calendar-day.selected .day-amount { color: #fff; }

.calendar-detail {
  margin-top: 12px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

/* ========== 报销专区 ========== */
.reim-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.reim-summary-item {
  background: var(--card-bg);
  padding: 12px 8px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
}
.reim-summary-item:active { transform: scale(0.97); }
.reim-summary-item .num { font-size: 18px; font-weight: 700; }
.reim-summary-item .lbl { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.reim-summary-item.pending .num { color: var(--warning); }
.reim-summary-item.submitted .num { color: var(--info); }
.reim-summary-item.received .num { color: var(--primary); }

.reim-status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.reim-status-badge.pending { background: #FFF3E0; color: #E65100; }
.reim-status-badge.submitted { background: #E3F2FD; color: #0D47A1; }
.reim-status-badge.received { background: var(--primary-light); color: var(--primary-dark); }

.reim-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.reim-item .reim-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.reim-item .reim-title { font-size: 14px; font-weight: 500; }
.reim-item .reim-amount { font-size: 16px; font-weight: 700; color: var(--text); }
.reim-item .reim-meta { font-size: 12px; color: var(--text-secondary); }
.reim-item .reim-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.reim-item .reim-actions .btn {
  flex: 1;
  padding: 6px;
  font-size: 12px;
}

.section-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 12px 0 8px;
  padding: 0 4px;
}

/* 报销快捷类别 */
.quick-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.quick-cat {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.quick-cat.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 图表图例与排行 */
.cat-legend { margin-top: 10px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.legend-item:last-child { border-bottom: none; }
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-name { flex: 1; }
.legend-pct { color: var(--text-secondary); font-size: 12px; }
.legend-amt { font-weight: 600; }

.rank-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.rank-item:last-child { border-bottom: none; }
.rank-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rank-info { flex: 1; min-width: 0; }
.rank-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.rank-header small { color: var(--text-secondary); }
.rank-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ========== 报销图片附件 ========== */
/* 列表中的缩略图 */
.reim-thumbs {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.reim-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.1s;
}
.reim-thumb:active { transform: scale(0.95); }

/* 编辑器中的附件网格 */
.att-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.att-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.att-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  display: block;
}
.att-thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.att-thumb-del:active { background: rgba(244,67,54,0.9); }
.att-add-btn {
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 24px;
  transition: all 0.15s;
}
.att-add-btn:active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.att-add-btn small {
  font-size: 10px;
}

/* 全屏图片查看器 */
.img-viewer-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.img-viewer-mask.show { display: flex; }
.img-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.img-viewer-close {
  position: absolute;
  top: calc(var(--safe-top, 0px) + 12px);
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
}
.img-viewer-close:active { background: rgba(255,255,255,0.35); }
.img-viewer-prev, .img-viewer-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
}
.img-viewer-prev { left: 12px; }
.img-viewer-next { right: 12px; }
.img-viewer-prev:active, .img-viewer-next:active { background: rgba(255,255,255,0.35); }
.img-viewer-counter {
  position: absolute;
  bottom: calc(var(--safe-bottom, 0px) + 20px);
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  background: rgba(0,0,0,0.4);
  padding: 4px 12px;
  border-radius: 12px;
  z-index: 2001;
}

