/* 妈妈的记账本 V1 — 手机风，字大，简洁 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: #f3f4f6; color: #1f2937; font-size: 18px; line-height: 1.5; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 24px rgba(0,0,0,0.05);
}

.bar {
  position: sticky; top: 0; z-index: 10;
  background: #10b981;
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.bar h1 { margin: 0; font-size: 22px; font-weight: 600; flex: 1; text-align: center; }
.bar .back { color: #fff; text-decoration: none; font-size: 28px; width: 32px; }
.bar .spacer { width: 32px; }

.content { padding: 18px; flex: 1; }

.foot { text-align: center; color: #9ca3af; font-size: 14px; padding: 16px; }

/* === 首页大卡 === */
.hero {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border-radius: 18px;
  padding: 24px 22px;
  margin-bottom: 18px;
  box-shadow: 0 8px 20px rgba(16,185,129,0.3);
}
.hero .label { font-size: 16px; opacity: 0.9; }
.hero .month { font-size: 22px; font-weight: 600; margin-bottom: 14px; }
.hero .balance { font-size: 42px; font-weight: 700; letter-spacing: 0.5px; }
.hero .balance.neg { color: #fee2e2; }
.hero .row { display: flex; gap: 16px; margin-top: 18px; }
.hero .cell { flex: 1; }
.hero .cell .k { font-size: 14px; opacity: 0.85; }
.hero .cell .v { font-size: 24px; font-weight: 600; }

/* === 主功能按钮（两大块） === */
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.big-btn {
  display: block;
  padding: 22px 16px;
  border-radius: 16px;
  text-decoration: none;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.1s;
}
.big-btn:active { transform: scale(0.96); }
.big-btn.in { background: #10b981; color: #fff; box-shadow: 0 4px 14px rgba(16,185,129,0.3); }
.big-btn.out { background: #ef4444; color: #fff; box-shadow: 0 4px 14px rgba(239,68,68,0.3); }

/* === 查询入口 === */
.link-row { display: flex; gap: 12px; }
.link-card {
  flex: 1;
  display: block;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
  text-decoration: none;
  color: #1f2937;
  font-size: 18px;
  font-weight: 500;
}
.link-card:active { background: #f3f4f6; }
.link-card .icon { font-size: 28px; display: block; margin-bottom: 4px; }

/* === 表单 === */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 18px; font-weight: 500; color: #374151; }
.field input, .field textarea, .field select {
  font-size: 24px;
  padding: 14px 16px;
  border: 2px solid #d1d5db;
  border-radius: 12px;
  background: #fff;
  width: 100%;
  font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: #10b981;
}
.field input.amount { font-size: 32px; font-weight: 700; text-align: right; padding-right: 18px; }

.quick-reasons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.quick-reasons button {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
}
.quick-reasons button:active { background: #e5e7eb; }

.submit {
  font-size: 24px;
  font-weight: 700;
  padding: 18px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  color: #fff;
  margin-top: 8px;
}
.submit.in { background: #10b981; box-shadow: 0 4px 14px rgba(16,185,129,0.3); }
.submit.out { background: #ef4444; box-shadow: 0 4px 14px rgba(239,68,68,0.3); }
.submit:active { transform: scale(0.98); }

/* === 列表 === */
.summary {
  background: #f9fafb;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
}
.summary .cell { flex: 1; text-align: center; }
.summary .k { font-size: 14px; color: #6b7280; }
.summary .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.summary .v.in { color: #10b981; }
.summary .v.out { color: #ef4444; }
.summary .v.bal { color: #1f2937; }
.summary .v.bal.neg { color: #ef4444; }

.day-group { margin-top: 18px; }
.day-head {
  font-size: 16px;
  color: #6b7280;
  padding: 6px 4px;
  margin: 10px 0 6px;
  font-weight: 500;
}
.item {
  display: flex;
  align-items: center;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid #f3f4f6;
  gap: 12px;
}
.item .tag {
  width: 8px;
  height: 36px;
  border-radius: 4px;
}
.item .tag.in { background: #10b981; }
.item .tag.out { background: #ef4444; }
.item .body { flex: 1; min-width: 0; }
.item .reason { font-size: 18px; font-weight: 500; }
.item .meta { font-size: 14px; color: #9ca3af; margin-top: 2px; word-break: break-all; }
.item .amt { font-size: 22px; font-weight: 700; white-space: nowrap; }
.item .amt.in { color: #10b981; }
.item .amt.out { color: #ef4444; }
.item .del {
  font-size: 14px;
  color: #9ca3af;
  text-decoration: none;
  padding: 6px;
}
.item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.item-actions form { margin: 0; }
.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.mini-btn.edit:hover { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.mini-btn.del:hover { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.type-toggle label {
  border: 2px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}
.type-toggle input { display: none; }
.type-toggle label.active.in { border-color: #10b981; color: #047857; background: #ecfdf5; }
.type-toggle label.active.out { border-color: #ef4444; color: #b91c1c; background: #fef2f2; }

.empty { text-align: center; color: #9ca3af; font-size: 18px; padding: 40px 20px; }

.notice {
  background: #ecfdf5;
  border: 2px solid #10b981;
  color: #065f46;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 17px;
}
.notice.err { background: #fef2f2; border-color: #ef4444; color: #991b1b; }

/* 日期选择行 */
.range-form {
  background: #f9fafb;
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 18px;
}
.range-form .row { display: flex; gap: 10px; align-items: end; }
.range-form .row .field { flex: 1; gap: 6px; }
.range-form .row .field label { font-size: 14px; color: #6b7280; }
.range-form .row .field input { font-size: 18px; padding: 10px 12px; }
.range-form button {
  font-size: 18px;
  padding: 10px 18px;
  background: #1f2937;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

/* === V2 语音记账 === */
.voice-box {
  background: #fef3c7;
  border: 2px solid #fbbf24;
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 18px;
  text-align: center;
}
.voice-title {
  font-size: 18px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 14px;
}
.voice-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 8px 22px rgba(217,119,6,0.4);
  cursor: pointer;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.08s, box-shadow 0.15s;
}
.voice-btn:active,
.voice-btn.rec {
  transform: scale(0.94);
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 4px 14px rgba(185,28,28,0.5);
  animation: voicePulse 1.2s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(185,28,28,0.5); }
  50%      { box-shadow: 0 4px 14px rgba(185,28,28,0.9), 0 0 0 12px rgba(239,68,68,0.18); }
}
.voice-btn .vmic { font-size: 52px; line-height: 1; }
.voice-btn .vlabel { font-size: 18px; font-weight: 600; margin-top: 6px; }
.voice-tips {
  margin-top: 12px;
  font-size: 14px;
  color: #92400e;
  line-height: 1.55;
}
.voice-status {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 500;
  min-height: 22px;
  color: #78350f;
}
.voice-status.ok  { color: #065f46; }
.voice-status.err { color: #991b1b; }
.voice-text {
  margin-top: 10px;
  font-size: 17px;
  color: #1f2937;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  word-break: break-all;
}

/* ============ V4 队列卡片 (2026-06-01) ============ */
.voice-box.v3 { background: linear-gradient(135deg,#fff8e7,#fff3d0); border: 1px solid #f0d678; }
.voice-box.v4 { background: linear-gradient(135deg,#f0fdfa,#eef2ff); border: 1px solid #9bc7ff; }
.voice-box.v3 .voice-tips { font-size: 14px; color: #7a5e1c; }
.voice-box.v4 .voice-tips { color: #31506f; }

.queue { margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.qcard {
  background: #fff; border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06); border: 1px solid #eee;
  transition: opacity .25s, transform .25s;
}
.qcard.queued      { border-left: 4px solid #b0b0b0; }
.qcard.asr         { border-left: 4px solid #38bdf8; background: #f0f9ff; }
.qcard.processing  { border-left: 4px solid #4a9eff; background: #f4f9ff; }
.qcard.done        { border-left: 4px solid #2dbe60; background: #f3fbf5; }
.qcard.no_amount   { border-left: 4px solid #f0a836; background: #fff8ea; }
.qcard.fail        { border-left: 4px solid #e0524a; background: #fff2f1; }
.qcard.deleted     { opacity: .4; }

.qhdr { font-size: 15px; color: #333; margin-bottom: 6px; }
.qsay { font-weight: 500; }
.qtext { font-size: 14px; color: #53606d; margin: 4px 0 8px; line-height: 1.35; }
.qbody { font-size: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.qbody.ok   { color: #1c8443; }
.qbody.warn { color: #a67410; }
.qbody.err  { color: #b03830; }

.qamt {
  font-size: 22px; font-weight: 700;
  background: #2dbe60; color: white; padding: 4px 10px; border-radius: 8px;
}
.qrsn { font-size: 17px; font-weight: 500; }

.qdel, .qretry {
  margin-left: auto; padding: 6px 12px; border-radius: 8px; border: 1px solid #ddd;
  background: white; color: #555; font-size: 14px; cursor: pointer;
}
.qdel:hover  { background: #fee; color: #b03830; border-color: #f4b4b0; }
.qretry:hover{ background: #eef; color: #2563a8; border-color: #b5c8e8; }

.qspin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid #c8def0; border-top-color: #2563a8; border-radius: 50%;
  animation: qspin 0.8s linear infinite; margin-right: 8px; vertical-align: middle;
}
@keyframes qspin { to { transform: rotate(360deg); } }

.manual-fallback {
  margin-top: 16px; padding: 10px 12px; background: #f7f7f7; border-radius: 10px;
}
.manual-fallback > summary {
  font-size: 14px; color: #777; cursor: pointer; padding: 4px 0;
  list-style: none;
}
.manual-fallback > summary::before { content: '▸ '; color: #aaa; }
.manual-fallback[open] > summary::before { content: '▾ '; }
.manual-fallback .form { margin-top: 10px; }
