/* ========== 全局变量 ========== */
:root {
  --bg: #f7f4ed;
  --surface: #fffdf8;
  --surface-2: #f1ece3;
  --surface-3: #faf7f1;
  --border: #ded6c9;
  --text: #25211d;
  --text-2: #746b5f;
  --text-3: #9a9083;
  --primary: #a86143;
  --primary-2: #8f4f35;
  --primary-soft: #ead8cd;
  --danger: #b7473f;
  --success: #5f7f67;
  --warning: #b9833b;
  --shadow-sm: 0 1px 2px rgba(49, 43, 35, .04), 0 1px 3px rgba(49, 43, 35, .06);
  --shadow-md: 0 6px 16px rgba(49, 43, 35, .08);
  --shadow-lg: 0 18px 45px rgba(49, 43, 35, .10);
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ========== 图标 ========== */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.ui-icon,
.empty-svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ui-icon {
  width: 16px;
  height: 16px;
}
.hero-icon {
  width: 28px;
  height: 28px;
  margin-right: 10px;
  color: var(--primary);
}
.empty-svg {
  width: 58px;
  height: 58px;
  color: var(--primary);
}

/* ========== 布局 ========== */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ========== 头部 Hero ========== */
.hero {
  background: #fbf8f2;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 32px;
  color: var(--text);
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.hero::before { display: none; }
.hero-title h1 {
  display: flex;
  align-items: center;
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}
.subtitle {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: transform .15s, border-color .15s, background .15s;
}
.stat-card:hover {
  background: #ffffff;
  border-color: #cfc4b4;
  transform: translateY(-2px);
}
.stat-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.stat-card.urgent {
  background: #f3e8dc;
  border-color: #d8c3ad;
}
.stat-card.urgent .stat-num { color: var(--primary); }

/* ========== 工具栏 ========== */
.toolbar {
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.filter-group {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.filter-group input,
.filter-group select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.filter-group input { flex: 1; min-width: 0; }
.filter-group select { min-width: 116px; }
.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(168, 97, 67, .12);
}
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 220px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-3);
  transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(168, 97, 67, .12);
}
.search-field input {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  color: var(--text);
}
.search-field input:focus {
  border-color: transparent;
  box-shadow: none;
}
.action-group {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { background: #e8dfd2; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-2); }
.btn-ghost {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: #cfc4b4;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ========== 卡片网格 ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-color, var(--primary));
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card.expired { opacity: 0.75; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  word-break: break-word;
  flex: 1;
  line-height: 1.4;
}
.card-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}
/* ========== 日期模式切换 ========== */
.date-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 8px;
  width: fit-content;
}
.date-tab {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.date-tab:hover { color: var(--text); }
.date-tab.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* ========== 视图切换 ========== */
.view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.view-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.view-tab:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: #cfc4b4;
}
.view-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== 日历选择器 ========== */
.calendar-wrap .calendar-widget {
  border: none;
  border-radius: 0;
  padding: 10px 12px 12px;
}
.calendar-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.cal-title {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.cal-year-select,
.cal-month-select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  max-width: 110px;
}
.cal-nav {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  padding: 0;
}
.cal-nav:hover { background: #e5e7eb; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  padding: 4px 0;
  line-height: 1;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 36px;
  gap: 4px;
  width: 100%;
}
.cal-grid-lunar {
  grid-auto-rows: 44px;
}
.cal-cell {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .12s, color .12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  font-family: inherit;
  line-height: 1.2;
  box-sizing: border-box;
}
.cal-cell.empty {
  pointer-events: none;
  visibility: hidden;
}
.cal-cell.day:hover { background: var(--surface-2); }
.cal-cell.day.today {
  font-weight: 700;
  color: var(--primary);
}
.cal-cell.day.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.cal-cell.day.selected.today { color: #fff; }
.cal-cell.lunar .lunar-day { font-size: 11px; line-height: 1.15; }
.cal-cell.lunar .solar-sub {
  font-size: 9px;
  opacity: 0.65;
  line-height: 1;
  margin-top: 1px;
}
.cal-cell.day.selected .solar-sub { opacity: 0.85; color: #fff; }
.cal-lunar-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.cal-footer {
  margin-top: 8px;
  text-align: center;
}
.cal-today { margin: 0; }
.cal-unsupported {
  padding: 20px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}

/* ========== 时间线 ========== */
.timeline-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.timeline-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.timeline-toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-width: 120px;
}
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.tl-group {
  margin-bottom: 24px;
}
.tl-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px -28px;
  padding-left: 28px;
  position: relative;
}
.tl-group-title::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--primary);
}
.tl-item {
  position: relative;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--tl-color, var(--primary));
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.tl-item:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}
.tl-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tl-color, var(--primary));
  border: 2px solid var(--surface);
}
.tl-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.tl-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.tl-item-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.tl-item-date {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.tl-item-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}
.tl-item.tl-past {
  opacity: 0.72;
}
.tl-item.tl-past .tl-item-meta { color: var(--text-3); }
.timeline-empty { padding: 60px 20px; }

.date-preview {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 4px;
  display: inline-block;
}
.lunar-preview {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 4px;
  display: inline-block;
}
.btn-today {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.btn-today:hover { background: #e5e7eb; color: var(--text); }

.type-countdown { background: #eef2ff; color: #4f46e5; }
.type-anniversary { background: #fce7f3; color: #be185d; }
.type-birthday { background: #fff7ed; color: #ea580c; }
.lunar-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #fef3c7;
  color: #b45309;
  margin-left: 4px;
  font-weight: 500;
}
.type-birthday { background: #fef3c7; color: #b45309; }

.card-category {
  font-size: 12px;
  color: var(--text-2);
  margin: 4px 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-category::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-3);
}

.card-countdown {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
  color: var(--card-color, var(--primary));
  letter-spacing: 0;
  margin: 8px 0 4px;
  line-height: 1.2;
}
.card-countdown.expired { color: var(--text-3); }
.card-countdown .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-left: 2px;
}
.card-countdown .seconds {
  font-size: 16px;
  color: var(--text-2);
  margin-left: 4px;
  font-weight: 500;
}

.card-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 6px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  gap: 6px;
}
.card-date {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.card-actions {
  display: flex;
  gap: 4px;
}
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }

.urgent-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--warning);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ========== 空状态 ========== */
.empty {
  text-align: center;
  padding: 96px 20px;
  color: var(--text-2);
}
.empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.empty h2 { color: var(--text); font-weight: 600; margin: 0 0 8px; }
.empty p { margin: 0; }

/* ========== 模态框 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn .15s ease;
  pointer-events: auto;
}
.modal-mask[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
/* 用 opacity + margin 替代 transform，避免 Chromium <input type="date">
   原生 picker 因 ancestor transform 错位的问题；此处为加固兜底 */
@keyframes slideUp { from { opacity: 0; margin-top: 12px; } to { opacity: 1; margin-top: 0; } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: background .15s;
  cursor: pointer;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--surface-2); }
.modal-close:active { background: var(--border); }
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ========== 表单 ========== */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.req { color: var(--danger); }
.hint { color: var(--text-3); font-weight: normal; font-size: 12px; }
.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="time"],
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.modal-event {
  max-width: 640px;
}
.modal-header-text { flex: 1; min-width: 0; }
.modal-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 400;
}

/* ========== 表单向导 ========== */
.form-wizard { padding: 0 !important; }
.form-wizard .modal-footer {
  margin: 0;
  padding: 16px 24px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.form-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }

.form-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.section-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-badge-type {
  background: var(--surface-2);
  font-size: 16px;
  width: 32px;
  height: 32px;
}
.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.section-desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.form-section-type.theme-countdown { background: #f8fafc; }
.form-section-type.theme-anniversary { background: #f8fafc; }
.form-section-type.theme-birthday { background: #f8fafc; }
.form-section-type.theme-countdown .section-badge-type { background: #eef2ff; }
.form-section-type.theme-anniversary .section-badge-type { background: #fce7f3; }
.form-section-type.theme-birthday .section-badge-type { background: #ffedd5; }

.form-field { margin-bottom: 14px; }
.form-field:last-child { margin-bottom: 0; }
.form-field > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-field input[type="text"],
.form-field input[type="time"],
.form-field input[type="number"],
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
  font-size: 14px;
}
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.form-field input.invalid { border-color: var(--danger); }
.input-lg {
  font-size: 16px !important;
  font-weight: 500;
  padding: 11px 14px !important;
}
.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}
.calendar-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  background: var(--surface);
}
.date-solar,
.date-lunar {
  width: 100%;
}
#solarCalendar,
#lunarCalendar {
  width: 100%;
}

/* 类型选择 Pills */
.type-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.type-pill {
  cursor: pointer;
  position: relative;
}
.type-pill input { position: absolute; opacity: 0; pointer-events: none; }
.type-pill-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all .18s;
}
.type-pill:hover .type-pill-inner { border-color: #c7d2fe; background: #fafafe; }
.type-pill input:checked + .type-pill-inner,
.type-pill.active .type-pill-inner {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .1);
}
.type-pill-icon { font-size: 24px; margin-bottom: 4px; }
.type-pill-label { font-weight: 600; font-size: 13px; color: var(--text); }
.type-pill-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* 选项卡片（倒计时到期行为） */
.option-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.option-card {
  cursor: pointer;
  position: relative;
}
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card-body {
  display: block;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all .15s;
}
.option-card:hover .option-card-body { border-color: #c7d2fe; }
.option-card input:checked + .option-card-body {
  border-color: var(--primary);
  background: #eef2ff;
}
.option-card-title { display: block; font-weight: 600; font-size: 13px; color: var(--text); }
.option-card-desc { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 开关 Toggle */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.switch-label { flex: 1; min-width: 0; }
.switch-title { display: block; font-size: 13px; font-weight: 500; color: var(--text); }
.switch-desc { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: background .2s;
  cursor: pointer;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* 步进器 */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  width: fit-content;
}
.stepper-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background .12s;
  font-family: inherit;
}
.stepper-btn:hover { background: #e5e7eb; }
.stepper input {
  width: 48px !important;
  text-align: center;
  border: none !important;
  border-left: 1px solid var(--border) !important;
  border-right: 1px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-weight: 600;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper-unit {
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-2);
  height: 36px;
  line-height: 36px;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
}

.type-panel[hidden] { display: none !important; }

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

.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  position: relative;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.selected {
  border-color: var(--text);
  transform: scale(1.1);
}
.color-dot.selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

@media (max-width: 720px) {
  .type-pills { grid-template-columns: 1fr; }
  .form-section { padding: 16px 18px; }
  .modal-event { max-width: 100%; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ========== 抽屉 ========== */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 90;
  animation: fadeIn .15s;
  pointer-events: auto;
}
.drawer-mask[hidden] { display: none !important; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  overflow-y: auto;
  animation: slideInRight .2s ease;
  z-index: 91;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: 6px;
}
.drawer-close:hover { background: var(--surface-2); }
.drawer-body { margin-top: 20px; }
.drawer-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  word-break: break-word;
}
.drawer-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.drawer-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
}
.drawer-countdown {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--card-color, var(--primary));
  font-variant-numeric: tabular-nums;
  margin: 16px 0 8px;
  line-height: 1.2;
}
.drawer-countdown .unit {
  font-size: 18px;
  color: var(--text-2);
  font-weight: 500;
}
.drawer-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.drawer-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.drawer-section p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ========== 归档列表 ========== */
.archive-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.archive-item-title { font-weight: 500; }
.archive-item-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.archive-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text-2);
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  z-index: 200;
  animation: toastIn .2s ease;
  box-shadow: var(--shadow-lg);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ========== 响应式 ========== */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .toolbar { grid-template-columns: 1fr; }
  .filter-group { flex-wrap: wrap; }
  .action-group { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .app { padding: 16px 12px 40px; }
  .hero { padding: 22px 20px; }
  .hero-title h1 { font-size: 22px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-num { font-size: 22px; }
  .toolbar { align-items: stretch; }
  .filter-group, .action-group { width: 100%; }
  .filter-group select,
  .search-field { flex: 1 1 100%; width: 100%; }
  .action-group .btn,
  .toolbar > .btn { flex: 1; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .radio-group { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .drawer { max-width: 100%; }
}
