/* ============ 备忘录提醒系统 ============ */
:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --primary: #2f6fed;
  --primary-hover: #2563eb;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2ff; border-radius: 4px; padding: 1px 6px; font-size: 13px; word-break: break-all; }

/* 顶部导航 */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-dark { background: #111827; border-bottom: none; }
.topbar-dark .nav-links a, .topbar-dark .brand { color: #e5e7eb; }
.topbar-dark .brand:hover, .topbar-dark .nav-links a:hover { color: #fff; text-decoration: none; }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a { padding: 6px 12px; border-radius: 8px; color: #374151; font-size: 14px; }
.nav-links a:hover { background: #f3f4f6; text-decoration: none; }
.topbar-dark .nav-links a:hover { background: #1f2937; }
.nav-user { color: var(--muted); font-size: 13px; padding: 0 4px; }
.nav-badge { background: var(--danger); color: #fff; font-size: 11px; border-radius: 99px; padding: 0 7px; margin-left: 3px; vertical-align: 2px; font-weight: 700; }

/* 布局 */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.main-content { min-height: calc(100vh - 180px); padding: 24px 20px; }
.footer { text-align: center; color: #9ca3af; font-size: 12.5px; padding: 24px 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* 页头 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; margin: 0; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

/* 统计块 */
.stat { text-align: center; padding: 22px 14px; }
.stat-num { font-size: 32px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* 表格 */
.table-wrap { overflow-x: auto; margin: -4px; padding: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.table-plain tr:hover td { background: transparent; }
.table-plain td { border-bottom: 1px solid #f3f4f6; }
.row-muted td { opacity: .55; }
.th-actions { width: 1%; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.memo-title { font-weight: 600; }
.text-nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.muted { color: var(--muted); }
.sub { font-size: 12.3px; color: var(--muted); margin-top: 3px; font-weight: 400; }

/* 徽章 */
.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: #eef2ff; color: #4f46e5; margin: 1px 2px 1px 0; white-space: nowrap; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warn { background: #fef3c7; color: #b45309; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

/* 按钮 */
.btn { display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer; font-weight: 500; background: #fff; color: var(--text); text-decoration: none; line-height: 1.5; font-family: inherit; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border-color: #d1d5db; color: #374151; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { border-color: #fca5a5; color: var(--danger); background: #fff; }
.btn-danger-outline:hover { background: #fef2f2; }
.btn-light { background: #fff; color: #111827; }
.btn-sm { padding: 4px 10px; font-size: 12.8px; border-radius: 6px; }
.btn-block { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input[type="text"], .field input[type="password"], .field input[type="number"], .field input[type="email"],
.field input[type="datetime-local"], .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(47, 111, 237, .2); border-color: var(--primary); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 4px; }
.req { color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* 重复规则 */
.rule-fieldset { border: 1px dashed #d1d5db; border-radius: 10px; padding: 14px 16px 4px; margin: 0 0 16px; }
.rule-fieldset legend { font-size: 13.5px; font-weight: 700; padding: 0 8px; color: #374151; }
.rule-block { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.weekday-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.weekday { position: relative; }
.weekday input { position: absolute; opacity: 0; }
.weekday span { display: inline-block; min-width: 40px; text-align: center; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; cursor: pointer; background: #fff; font-size: 13.5px; }
.weekday input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.interval-row { display: flex; gap: 10px; }
.interval-row input { flex: 1; }

/* 渠道选择 */
.channel-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.channel-item { border: 1px solid #d1d5db; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; position: relative; background: #fff; }
.channel-item:hover { border-color: var(--primary); }
.channel-item input { position: absolute; top: 12px; right: 12px; }
.channel-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.channel-name { font-weight: 600; font-size: 13.5px; padding-right: 24px; }
.channel-unbound { background: #fffbeb; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 10px 0; }
.checkbox-line input { width: 16px; height: 16px; accent-color: var(--primary); }

/* 预设标签 */
.preset-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid #c7d2fe; background: #eef2ff; color: #4338ca; border-radius: 99px; padding: 5px 14px; font-size: 13px; cursor: pointer; font-family: inherit; }
.chip:hover { background: #c7d2fe; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 7px 16px; border-radius: 99px; background: #e5e7eb; color: #374151; font-size: 13.5px; }
.tab:hover { text-decoration: none; background: #d1d5db; }
.tab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* 闪存消息 / 提示条 */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; animation: fadeIn .2s ease; }
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.flash-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; word-break: break-all; }
.flash.fade { opacity: 0; transition: opacity .5s; }
.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13.8px; }
.banner-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; word-break: break-all; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14px; }

/* 登录注册 */
.auth-wrap { min-height: calc(100vh - 200px); display: flex; align-items: center; justify-content: center; padding: 30px 0; }
.auth-card { width: 100%; max-width: 400px; padding: 30px; }
.auth-title { text-align: center; font-size: 20px; margin: 0 0 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-switch { text-align: center; margin: 16px 0 0; font-size: 13.5px; color: var(--muted); }
.blank-body { background: var(--bg); }

/* 消息中心 */
.notification-list { display: flex; flex-direction: column; gap: 10px; }
.notification-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: #fff; }
.notification-item.unread { border-color: #bfdbfe; background: #f0f6ff; }
.notification-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notification-time { font-weight: 400; }
.notification-content { color: #4b5563; font-size: 13.3px; margin-top: 5px; white-space: pre-wrap; }
.dot { width: 8px; height: 8px; background: var(--danger); border-radius: 50%; display: inline-block; }

/* 搜索 / 筛选 */
.search-form { display: flex; gap: 8px; }
.search-form input, .filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13.5px; background: #fff; }
.search-form input[type="text"] { min-width: 200px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.page-info { color: var(--muted); font-size: 13.5px; }

/* 测试按钮区 */
.test-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* 日志消息列 */
.log-msg { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 响应式 */
@media (max-width: 640px) {
  .nav-wrap { padding: 10px 12px; }
  .container { padding: 0 12px; }
  .main-content { padding: 16px 12px; }
  .card { padding: 14px; }
  .search-form { width: 100%; }
  .search-form input[type="text"] { min-width: 0; flex: 1; }
  .actions { flex-direction: column; align-items: stretch; }
}
