/* 视觉风格：Material Design（Google 风格）
   —— 蓝主色、大圆角、柔和阴影、克制的分隔线
   类名与结构保持原样，只改外观 */

:root {
  /* Material 3 亮色 */
  --bg: #f8f9fa;
  --card: #ffffff;
  --card-2: #f1f3f4;
  --text: #202124;
  --muted: #5f6368;
  --faint: #80868b;
  --line: #dadce0;
  --divider: #e8eaed;

  --accent: #1a73e8;
  --accent-hover: #1765cc;
  --accent-soft: #e8f0fe;
  --accent-on: #ffffff;

  --expired: #d93025;
  --expired-soft: #fce8e6;
  --soon: #e8710a;
  --soon-soft: #fef7e0;
  --low: #1a73e8;
  --low-soft: #e8f0fe;
  --ok: #188038;
  --ok-soft: #e6f4ea;

  --e1: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --e2: 0 1px 2px rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --e3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124;
    --card: #292a2d;
    --card-2: #35363a;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --faint: #80868b;
    --line: #5f6368;
    --divider: #3c4043;

    --accent: #8ab4f8;
    --accent-hover: #aecbfa;
    --accent-soft: #2a3a55;
    --accent-on: #202124;

    --expired: #f28b82;
    --expired-soft: #4a2926;
    --soon: #fdd663;
    --soon-soft: #453a1e;
    --low: #8ab4f8;
    --low-soft: #2a3a55;
    --ok: #81c995;
    --ok-soft: #23392c;

    --e1: 0 1px 3px rgba(0,0,0,.5);
    --e2: 0 2px 6px rgba(0,0,0,.5);
    --e3: 0 4px 12px rgba(0,0,0,.6);
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Google Sans", Roboto, -apple-system, BlinkMacSystemFont,
               "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 84px; }
a { color: var(--accent); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  padding: 16px 20px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar h1 { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -.01em; }
.topbar .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- 内容 ---------- */
.wrap { padding: 6px 16px 8px; max-width: 720px; margin: 0 auto; }
.section { margin-bottom: 26px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 10px; gap: 8px; padding: 0 4px;
}
.section-head h2 { font-size: 15px; font-weight: 500; margin: 0; letter-spacing: 0; }
.section-head .more { font-size: 13px; color: var(--muted); }

/* 二级标题 */
.subhead {
  font-size: 12.5px; font-weight: 500; color: var(--muted);
  margin: 0 0 8px; letter-spacing: .02em;
}

/* ---------- 统计条 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.stat {
  background: var(--card); border: none; border-radius: var(--r-lg);
  padding: 14px 8px 12px; text-align: center; box-shadow: var(--e1);
  cursor: pointer;
}
.stat .n { font-size: 24px; font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .l { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.stat.expired .n { color: var(--expired); }
.stat.soon .n { color: var(--soon); }
.stat.low .n { color: var(--low); }

/* ---------- 列表 ---------- */
.list {
  background: var(--card); border: none; border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--e1);
}
.list.plain { background: transparent; box-shadow: none; }

.row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-top: 1px solid var(--divider);
  text-align: left; width: 100%; background: none;
  border-left: 0; border-right: 0; border-bottom: 0;
  color: inherit; font: inherit; cursor: pointer;
  transition: background .12s;
}
.row:first-child { border-top: none; }
.row:active { background: var(--card-2); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-size: 15px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { color: var(--faint); font-size: 15px; flex: none; }

.thumb {
  width: 46px; height: 46px; border-radius: var(--r-md); flex: none;
  background: var(--card-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--faint); overflow: hidden;
}
.thumb.sm { width: 40px; height: 40px; border-radius: 10px; font-size: 17px; }

.pill {
  font-size: 11.5px; font-weight: 500; padding: 4px 9px; border-radius: var(--r-sm);
  white-space: nowrap; flex: none; line-height: 1.4; letter-spacing: .02em;
}
.pill.expired { color: var(--expired); background: var(--expired-soft); }
.pill.soon { color: var(--soon); background: var(--soon-soft); }
.pill.low { color: var(--low); background: var(--low-soft); }
.pill.out { color: var(--expired); background: var(--expired-soft); }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.muted { color: var(--muted); background: var(--card-2); }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; letter-spacing: .01em;
  padding: 9px 20px; border-radius: var(--r-pill); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .14s, box-shadow .14s;
}
.btn:active { opacity: .82; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-on);
  box-shadow: var(--e1);
}
.btn.danger { color: var(--expired); border-color: var(--line); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 14px; font-size: 13px; }
.btn[disabled] { opacity: .38; pointer-events: none; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 7px; color: var(--muted); }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=month], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 12px 14px; appearance: none;
  transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
textarea { resize: vertical; min-height: 64px; }
.inline { display: flex; gap: 12px; align-items: flex-end; }
.inline > * { flex: 1; min-width: 0; }

/* 分段控件 */
.seg {
  display: flex; gap: 0; background: var(--card); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden;
}
.seg button {
  flex: 1; appearance: none; border: 0; border-left: 1px solid var(--line);
  background: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 9px 4px; cursor: pointer; transition: background .14s, color .14s;
}
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

/* 筛选芯片 */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; appearance: none; font: inherit; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 7px 15px; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 500; }

/* 筛选区的二级标题布局 */
.filter-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 18px; }

/* 开关行 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; font-size: 14.5px; cursor: pointer;
  border-top: 1px solid var(--divider);
}
.switch-row:first-of-type { border-top: none; }
.switch-row input[type=checkbox] {
  appearance: none; width: 46px; height: 26px; border-radius: var(--r-pill);
  background: var(--line); position: relative; flex: none; margin: 0; cursor: pointer;
  transition: background .18s;
}
.switch-row input[type=checkbox]::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch-row input[type=checkbox]:checked { background: var(--accent); }
.switch-row input[type=checkbox]:checked::after { transform: translateX(20px); }
@media (prefers-color-scheme: dark) {
  .switch-row input[type=checkbox]::after { background: #bdc1c6; }
  .switch-row input[type=checkbox]:checked::after { background: var(--accent-on); }
}

/* ---------- 照片 ---------- */
.photo-pick {
  width: 100%; aspect-ratio: 4/3; border-radius: var(--r-lg); border: 1px dashed var(--line);
  background: var(--card) center/cover no-repeat; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 13.5px; cursor: pointer; margin-bottom: 18px; overflow: hidden;
}
.photo-pick.has { border-style: solid; color: transparent; }
.photo-hero {
  width: 100%; max-height: 300px; object-fit: cover;
  border-radius: var(--r-lg); margin-bottom: 16px; display: block;
  background: var(--card-2); box-shadow: var(--e1);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: none; border-radius: var(--r-lg);
  padding: 16px 18px; box-shadow: var(--e1);
}
.kv {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-top: 1px solid var(--divider); font-size: 14px;
}
.kv:first-child { border-top: none; }
.kv .k { color: var(--muted); flex: none; }
.kv .v { text-align: right; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 10px; color: var(--faint); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--divider);
  display: flex; padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1; appearance: none; border: 0; background: none; color: var(--faint);
  font: inherit; font-size: 11.5px; font-weight: 500; letter-spacing: .02em;
  padding: 4px 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tabbar button.on { color: var(--accent); }
.tabbar .ico { position: relative; display: block; font-size: 20px; line-height: 1; }
.tabbar .badge {
  position: absolute; top: -4px; left: 100%; margin-left: -10px;
  background: var(--expired); color: #fff; font-size: 10px; font-weight: 600;
  min-width: 16px; height: 16px; border-radius: var(--r-pill); line-height: 16px;
  padding: 0 4px; text-align: center;
}

.fab {
  position: fixed; right: 20px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 25;
  width: 56px; height: 56px; border-radius: var(--r-lg); border: 0;
  background: var(--accent); color: var(--accent-on);
  font-size: 28px; font-weight: 400; line-height: 1; cursor: pointer;
  box-shadow: var(--e3);
  display: flex; align-items: center; justify-content: center;
}
.fab:active { box-shadow: var(--e1); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 400;
  padding: 12px 18px; border-radius: var(--r-sm); z-index: 60; opacity: 0;
  transition: opacity .18s; pointer-events: none; max-width: 86vw; text-align: center;
  box-shadow: var(--e2); line-height: 1.5;
}
.toast.show { opacity: .96; }

/* ---------- 登录 ---------- */
.auth { max-width: 400px; margin: 0 auto; padding: 60px 24px; }
.auth .logo { font-size: 44px; text-align: center; margin-bottom: 12px; }
.auth h1 { font-size: 24px; font-weight: 500; text-align: center; margin: 0 0 8px; letter-spacing: -.01em; }
.auth p.lead { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.auth .err { color: var(--expired); font-size: 13px; margin: 4px 0 12px; text-align: center; min-height: 18px; }

.hint { font-size: 12.5px; color: var(--faint); margin-top: 8px; line-height: 1.65; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

/* 窄屏下统计条折成两行 */
@media (max-width: 380px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
