/* ============================================================
   ahlum&enger 日程杂事 · 青绿主题
   ============================================================ */
:root {
  --primary: #0D9488;
  --primary-dark: #0F766E;
  --primary-light: #14B8A6;
  --bg: #F0FDFA;
  --card: #ffffff;
  --text: #134E4A;
  --text-dim: #6B7280;
  --border: #E5E7EB;
  --danger: #EF4444;
  --ahlum: #0D9488;
  --enger: #F59E0B;
  --both: #6366F1;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(13, 148, 136, 0.08), 0 4px 12px rgba(13, 148, 136, 0.06);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

body { padding-bottom: 70px; }

/* ---------- 顶部 ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.app-title { display: flex; align-items: center; gap: 10px; }
.title-emoji { font-size: 24px; }
.app-title h1 { font-size: 18px; font-weight: 600; }
.app-header { display: flex; align-items: center; justify-content: space-between; }
.user-switch { display: flex; background: rgba(255,255,255,.2); border-radius: 16px; padding: 3px; }
.user-btn {
  background: none; border: none; color: #fff; font-size: 13px; font-weight: 600;
  padding: 4px 12px; border-radius: 13px; cursor: pointer; opacity: .7;
}
.user-btn.active { background: #fff; color: var(--primary); opacity: 1; }

/* ---------- 页面切换 ---------- */
.page { display: none; padding: 16px; }
.page.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.block-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; color: var(--text); }

/* ---------- 按钮 ---------- */
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  border-radius: 12px; padding: 12px 16px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost {
  background: transparent; color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; font-size: 16px; cursor: pointer;
}
.btn-danger {
  background: var(--danger); color: #fff; border: none;
  border-radius: 12px; padding: 12px 16px; font-size: 16px; cursor: pointer;
}
.btn-add {
  background: var(--primary); color: #fff; border: none;
  border-radius: 20px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.hidden { display: none !important; }

/* ---------- 底部 tab ---------- */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; background: none; border: none; padding: 8px 0 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-dim); font-size: 11px; cursor: pointer;
}
.tab-ico { font-size: 20px; }
.tab.active { color: var(--primary); font-weight: 600; }

/* ---------- 今天页 ---------- */
.today-banner {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius); color: #fff; padding: 18px; margin-bottom: 16px;
}
.today-date { font-size: 26px; font-weight: 700; }
.today-week { font-size: 14px; opacity: .9; margin-top: 2px; }

.today-block { margin-bottom: 18px; }
.today-list { display: flex; flex-direction: column; gap: 8px; }
.empty-tip { color: var(--text-dim); font-size: 14px; text-align: center; padding: 18px 0; }

/* ---------- 列表项 ---------- */
.list-item {
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
}
.list-item .item-body { flex: 1; min-width: 0; }
.list-item .item-title { font-size: 15px; font-weight: 600; }
.list-item .item-title.done-title { text-decoration: line-through; color: var(--text-dim); }
.list-item .item-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.list-item .item-time { font-size: 13px; color: var(--primary); font-weight: 600; white-space: nowrap; }

/* 人物标签 */
.tag {
  display: inline-block; font-size: 11px; font-weight: 600; color: #fff;
  border-radius: 8px; padding: 2px 7px; margin-right: 4px;
}
.tag-ahlum { background: var(--ahlum); }
.tag-enger { background: var(--enger); }
.tag-both { background: var(--both); }
.tag-overdue { background: var(--danger); }

/* 完成勾选 */
.done-check {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border);
  background: none; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; transition: all .15s;
}
.done-check.checked { background: var(--primary); border-color: var(--primary); }

/* ---------- 日历 ---------- */
.calendar { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 16px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 16px; font-weight: 600; }
.cal-arrow { background: none; border: none; font-size: 24px; color: var(--primary); cursor: pointer; padding: 4px 12px; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-cell {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px; cursor: pointer; font-size: 14px; position: relative;
}
.cal-cell.other-month { color: #CBD5E1; }
.cal-cell.today { background: var(--primary); color: #fff; font-weight: 700; }
.cal-cell.selected { outline: 2px solid var(--primary); }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary-light); margin-top: 2px; }
.cal-cell.today .cal-dot { background: #fff; }
.cal-cell.has-event { font-weight: 600; }

/* ---------- 日程列表 ---------- */
.day-events-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.day-events-head .block-title { margin-bottom: 0; }
.event-list { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 杂事页 ---------- */
.chore-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.chore-filter { display: flex; gap: 8px; margin-bottom: 12px; }
.chore-filter-btn {
  flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 0; font-size: 13px; color: var(--text-dim); cursor: pointer;
}
.chore-filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.chore-list { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 人物切换 ---------- */
.person-switch { display: flex; gap: 6px; }
.person-btn {
  flex: 1; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 0; font-size: 14px; color: var(--text-dim); cursor: pointer;
}
.person-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; }
.form-row input[type="text"], .form-row input[type="number"],
.form-row input[type="date"], .form-row input[type="time"],
.form-row input[type="datetime-local"], .form-row select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; color: var(--text); background: #fff;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--primary); }
.form-inline { display: flex; align-items: center; gap: 10px; }
.form-inline label { margin-bottom: 0; }
.form-inline input[type="time"] { flex: 1; }
.switch { width: 44px; height: 26px; }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50;
  display: none; align-items: flex-end; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  padding: 20px; max-height: 88vh; overflow-y: auto;
  animation: slideUp .2s ease;
}
.modal h3 { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-danger { flex: 1; }
.modal-actions .btn-ghost { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(17, 24, 39, .9); color: #fff; border-radius: 10px; padding: 10px 18px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100;
}
.toast.show { opacity: 1; }

/* ---------- 推送按钮与预览 ---------- */
.push-btn { background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 2px; flex-shrink: 0; }
.push-preview { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 4px; }
.push-preview-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.push-preview-content { font-size: 13px; color: var(--text-dim); white-space: pre-line; }
