:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #222426;
  --muted: #8a919a;
  --brand: #2f6fed;
  --brand-ink: #ffffff;
  --green: #0aa06e;
  --red: #e5484d;
  --line: #eceef1;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.logo { font-weight: 700; font-size: 17px; }
.badge { font-size: 12px; color: var(--muted); }
.badge.on { color: var(--green); }

main { flex: 1; overflow-y: auto; padding: 14px 14px 24px; }
.tabbar {
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: 0; background: none; padding: 6px 0 6px;
  font-size: 20px; line-height: 1.2; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: inherit;
}
.tab span { font-size: 11px; }
.tab.active { color: var(--brand); font-weight: 600; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(20,24,40,.04);
}
.hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }

/* 记一笔 */
.mic-wrap { display: flex; flex-direction: column; align-items: center; padding: 10px 0 6px; }
.mic {
  width: 108px; height: 108px; border-radius: 50%; border: 0;
  background: var(--brand); color: var(--brand-ink); font-size: 40px;
  box-shadow: 0 6px 18px rgba(47,111,237,.35); touch-action: none; user-select: none;
}
.mic.recording { background: var(--red); animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.06);} }
.mic-tip { margin-top: 10px; font-size: 13px; color: var(--muted); }
/* 录音音量条：按住时显示，宽度跟随说话音量 */
.vol {
  width: 150px; height: 8px; margin-top: 12px; border-radius: 4px;
  background: #e8ecf2; overflow: hidden; opacity: 0; transition: opacity .15s;
}
.vol.on { opacity: 1; }
.vol > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), #41d99a);
  border-radius: 4px;
}
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
textarea#textIn {
  width: 100%; min-height: 72px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 15px; font-family: inherit; resize: vertical; background: #fafbfc;
}
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; font-size: 15px; font-family: inherit;
  background: var(--brand); color: var(--brand-ink); width: 100%;
}
.btn.ghost { background: #eef3fd; color: var(--brand); }
.btn.gray { background: #f0f2f5; color: var(--muted); }
.btn.sm { width: auto; padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; }

/* 草稿/修正表单 */
.field { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field label { width: 56px; color: var(--muted); font-size: 13px; flex: none; }
.field input, .field select {
  flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 15px; font-family: inherit; background: #fafbfc;
}
.reason { font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.row2 { display: flex; gap: 8px; }
.row2 .btn { flex: 1; }
audio { width: 100%; margin-top: 6px; }

/* 列表 */
.item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .amt { margin-left: auto; font-weight: 700; font-size: 16px; white-space: nowrap; }
.amt.exp { color: var(--ink); } .amt.inc { color: var(--green); }
.item .t1 { font-size: 15px; }
.item .t2 { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { background: #f0f3f8; border-radius: 6px; padding: 1px 6px; }
.chip.cat { color: var(--brand); }
.play { border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: 12px; padding: 1px 8px; }
.thumbs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.thumbs img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }
.addpic { width: 54px; height: 54px; border: 1px dashed #c6cdd6; border-radius: 8px; color: var(--muted); background: none; font-size: 20px; }

/* 统计 */
.sum { display: flex; gap: 10px; margin-bottom: 12px; }
.sum .card { flex: 1; text-align: center; margin: 0; padding: 12px 6px; }
.sum .num { font-size: 20px; font-weight: 700; }
.sum .lab { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar-row { margin: 8px 0; }
.bar-row .cap { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar { height: 8px; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.seg { display: flex; background: #e9edf3; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 0; font-size: 14px; border-radius: 8px; color: var(--muted); font-family: inherit; }
.seg button.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: rgba(20,24,30,.88); color: #fff; border-radius: 10px;
  padding: 9px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; }
/* 麦克风授权预检卡片（需要授权/被拒时显示） */
.mic-perm { margin-bottom: 4px; text-align: center; }

/* 额度与兑换（402 月额度用完时展开） */
#usageLine a { color: var(--brand); text-decoration: none; }
.redeem { display: flex; gap: 8px; margin-bottom: 10px; }
.redeem input {
  flex: 1; min-width: 0; border: 1px solid #dfe5ee; border-radius: 8px;
  padding: 8px 10px; font-size: 14px; font-family: inherit; background: #fff;
}
.redeem input:focus { outline: none; border-color: var(--brand); }
