/* ============================================
   ding 界面样式 v2.0 — 移动优先 · 琥珀品牌色
   设计规格见 DESIGN.md
   ============================================ */

/* ---- Design Tokens ---- */
:root {
  /* 品牌色 Amber */
  --brand-50: #FFFBEB;
  --brand-100: #FEF3C7;
  --brand-400: #FBBF24;
  --brand-500: #F59E0B;
  --brand-600: #D97706;
  --brand-700: #B45309;

  /* 中性色 Slate */
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --line: #E2E8F0;
  --text-1: #0F172A;
  --text-2: #475569;
  --text-3: #64748B;

  /* 语义色 */
  --ok: #059669;      --ok-weak: #ECFDF5;
  --bad: #DC2626;     --bad-weak: #FEF2F2;
  --pause: #64748B;   --pause-weak: #F1F5F9;
  --info: #0369A1;    --info-weak: #F0F9FF;

  /* 布局与动效 */
  --radius-card: 14px;
  --radius-btn: 10px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 8px 24px rgba(15, 23, 42, 0.12);
  --t-fast: 0.18s ease-out;
  --t-mid: 0.22s ease-out;
  --nav-h: 56px;
  --header-h: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }

/* ---- 键盘焦点可见（全局） ---- */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- 动效降级 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================
   布局骨架：header → main → nav.bottom
   ============================================ */
header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
}
.hd {
  max-width: 720px; margin: 0 auto; padding: 0 16px;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.hd .logo { font-weight: 700; font-size: 17px; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.hd .logo .bell { color: var(--brand-600); }
.hd .who { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.hd .who b { color: var(--text-1); }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 88px); }

/* ---- 导航：移动端底部标签栏 ---- */
.nav-top { display: none; }
.nav-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-bottom button {
  flex: 1;
  min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-3); font-size: 12px; line-height: 1.4;
  padding: 6px 0 4px;
  position: relative;
  transition: color var(--t-fast);
}
.nav-bottom button .ic { font-size: 18px; line-height: 1; }
.nav-bottom button::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%) scaleX(0);
  width: 24px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--brand-500);
  transition: transform var(--t-fast);
}
.nav-bottom button.on { color: var(--brand-700); font-weight: 600; }
.nav-bottom button.on::before { transform: translateX(-50%) scaleX(1); }

/* ---- FAB（移动端新建） ---- */
.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 19;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 48px; padding: 0 20px;
  background: var(--brand-500); color: var(--text-1);
  border: 0; border-radius: 999px; cursor: pointer;
  font-size: 15px; font-weight: 600;
  box-shadow: var(--shadow-2);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.97); }

/* ---- ≥768px：顶部导航接管 ---- */
@media (min-width: 768px) {
  main { padding-bottom: 48px; }
  .nav-bottom { display: none; }
  .fab { display: none; }
  .nav-top {
    display: inline-flex; gap: 4px; margin: 16px 0 20px; align-self: flex-start;
    background: #fff; border: 1px solid var(--line); border-radius: 999px;
    padding: 4px; box-shadow: var(--shadow-1);
  }
  .nav-top button {
    border: 0; background: transparent; color: var(--text-2);
    padding: 8px 18px; border-radius: 999px; cursor: pointer; font-size: 14px;
    min-height: 36px;
    transition: color var(--t-fast), background var(--t-fast);
  }
  .nav-top button.on { background: var(--brand-500); color: #1c1917; font-weight: 600; }
  .nav-top button:hover:not(.on) { color: var(--brand-700); background: var(--brand-50); }
}

/* ============================================
   通用组件
   ============================================ */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--t-mid), transform var(--t-mid);
}
@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
}

/* ---- 提醒条目（状态左色条 + 视觉层级） ---- */
.rem { display: flex; justify-content: space-between; gap: 14px; align-items: center; border-left: 4px solid var(--line); }
.rem.st-active { border-left-color: var(--brand-500); }
.rem.st-paused { border-left-color: var(--pause); background: var(--pause-weak); }
.rem.st-done, .rem.st-expired { opacity: 0.72; }
.rem .info { flex: 1; min-width: 0; }
.rem .title { font-size: 17px; font-weight: 700; line-height: 1.4; letter-spacing: 0.2px; }
.rem .meta { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.rem .next {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  background: var(--brand-50); color: var(--brand-700);
  border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rem.st-paused .next { background: var(--pause-weak); color: var(--text-2); }
.acts { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ---- 徽章（文字+颜色双通道） ---- */
.badge.tgl { cursor: pointer; border: 0; font: inherit; font-size: inherit; padding: inherit; transition: opacity var(--t-fast); }
.badge.tgl:hover { opacity: 0.75; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; line-height: 1.6; font-weight: 600; vertical-align: 1px;
}
.b-active { background: var(--ok-weak); color: var(--ok); }
.b-paused { background: var(--pause-weak); color: var(--pause); }
.b-done { background: var(--info-weak); color: var(--info); }
.b-expired { background: var(--bad-weak); color: var(--bad); }
.b-success { background: var(--ok-weak); color: var(--ok); }
.b-failed { background: var(--bad-weak); color: var(--bad); }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 38px;
  border: 1px solid var(--line); background: var(--card); color: var(--text-1);
  padding: 6px 16px; border-radius: var(--radius-btn); cursor: pointer; font-size: 14px;
  transition: transform var(--t-fast), border-color var(--t-fast), color var(--t-fast), background var(--t-fast), opacity var(--t-fast);
}
.btn:hover { border-color: var(--brand-500); color: var(--brand-700); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--brand-500); border-color: var(--brand-500); color: var(--text-1); font-weight: 600; }
.btn.primary:hover { background: var(--brand-400); border-color: var(--brand-400); color: var(--text-1); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { min-height: 32px; padding: 2px 12px; font-size: 12px; }

/* ---- 表单 ---- */
label.fl { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; margin: 14px 0 6px; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="time"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-btn);
  padding: 10px 12px; font-size: 16px; /* ≥16px 防止 iOS 聚焦缩放 */
  background: #fff; color: var(--text-1);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}
/* 时间选择器：等宽数字对齐 + 触控友好的时钟图标 */
input[type="time"] {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 18px; font-weight: 600; letter-spacing: 0.5px;
  min-height: 48px; /* 触控目标 ≥44px */
}
input[type="time"]::-webkit-calendar-picker-indicator {
  width: 28px; height: 28px; cursor: pointer; opacity: 0.55;
  transition: opacity var(--t-fast);
}
input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
input[type="time"]::-webkit-calendar-picker-indicator:focus-visible {
  outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 4px;
}
textarea { resize: vertical; min-height: 72px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius-btn); overflow: hidden; }
.seg button { flex: 1; min-height: 40px; border: 0; background: #fff; padding: 8px; cursor: pointer; color: var(--text-2); transition: background var(--t-fast), color var(--t-fast); }
.seg button.on { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
/* 筛选 chip（提醒列表的状态/类型筛选） */
#remFilters button {
  min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--text-2); font-size: 13px; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
#remFilters button:hover { border-color: var(--brand-400); color: var(--brand-700); }
#remFilters button.on { background: var(--brand-500); border-color: var(--brand-500); color: #1c1917; font-weight: 600; }
#remFilters button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.err { background: var(--bad-weak); color: var(--bad); border-radius: var(--radius-btn); padding: 8px 12px; margin: 10px 0; font-size: 14px; }
.ok-box { background: var(--ok-weak); color: var(--ok); border-radius: var(--radius-btn); padding: 8px 12px; margin: 10px 0; font-size: 14px; word-break: break-all; }
.preview { background: var(--brand-50); border-radius: var(--radius-btn); padding: 10px 12px; margin: 10px 0; font-size: 14px; color: var(--brand-700); font-weight: 600; }

/* ---- 表格 ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-3); font-weight: 600; font-size: 12px; }

/* ---- 模态框（遮罩淡入 + 面板上滑） ---- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 48px 16px; overflow: auto;
}
.mask.show { display: flex; animation: fadeIn var(--t-mid); }
.modal {
  background: var(--card); border-radius: var(--radius-card); padding: 20px;
  width: 100%; max-width: 520px; box-shadow: var(--shadow-2);
  animation: riseUp var(--t-mid);
}
.modal h3 { font-size: 20px; line-height: 28px; margin-bottom: 4px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Toast ---- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; max-width: 90vw;
  animation: dropIn 0.25s ease-out;
}
@keyframes dropIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- 空态 ---- */
.empty { text-align: center; color: var(--text-3); padding: 48px 0; font-size: 14px; }

/* ---- 登录页 ---- */
.auth-wrap { max-width: 380px; margin: 48px auto 0; padding: 0 16px; }
.auth-wrap .card { padding: 24px; }
.auth-wrap h1 { font-size: 32px; line-height: 40px; text-align: center; margin-bottom: 4px; }
.auth-wrap h1 .bell { color: var(--brand-600); }
.auth-wrap .sub { text-align: center; color: var(--text-3); font-size: 12px; margin-bottom: 16px; }
.wd { font-size: 12px; color: var(--text-3); }
code.tk { background: var(--pause-weak); padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
h3 { font-size: 16px; line-height: 24px; }

/* ---- 小屏细节 ---- */
@media (max-width: 374px) {
  .acts { width: 100%; justify-content: flex-start; }
  .rem { flex-direction: column; align-items: flex-start; }
}
