/* 貘布 指令中心 — 系統字型；以貘算為範本（深藍 #1B2B4F）；紙感底色。顏色避開八隻貘的角色色。 */
:root {
  --ink: #1B2B4F; --ink-2: #4a5470; --muted: #7a8196; --paper: #F4F1EA; --card: #FFFDF8; --line: rgba(27,43,79,.12);
  --accent: #2E6F73;  /* 指令中心的小代表色（青石綠，和角色色分開） */
  --warn: #A5522B; --ok: #2E6F73;
  --safe-top: env(safe-area-inset-top, 0px);
  --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--paper) radial-gradient(120% 60% at 10% 0%, rgba(255,255,255,.7), rgba(255,255,255,0) 60%);
  -webkit-text-size-adjust: 100%; overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.top { position: relative; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-top)) 12px 8px 16px; min-height: calc(52px + var(--safe-top)); background: var(--ink); color: #fff; }
.wm { height: 24px; width: auto; display: block; }
.top-t { font-size: 14px; opacity: .8; margin-right: auto; padding-left: 2px; }
.top-btn { min-height: 44px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: rgba(255,255,255,.1); color: #fff; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.top-btn.icon { padding: 0; }
.main { padding: 12px 14px calc(16px + var(--mobu-nav-h, 50px)); max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 2px 10px rgba(27,43,79,.05); }

/* 指令區 */
.cmd { padding: 12px 12px 12px; }
.cmd-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 8px; }
.pet { width: 64px; height: 64px; flex: none; }
.pet.hop { animation: hop .6s ease; }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-8px); } 70% { transform: translateY(1px); } }
@media (prefers-reduced-motion: reduce) { .pet.hop { animation: none; } }
.bubble { position: relative; flex: 1; background: #EEF1F6; border-radius: 14px; padding: 7px 12px 8px; margin-bottom: 6px; }
.bubble::before { content: ""; position: absolute; left: -6px; bottom: 12px; border: 6px solid transparent; border-right-color: #EEF1F6; border-left: 0; }
.pet-name { margin: 0; font-size: 12px; color: var(--muted); }
.pet-say { margin: 0; font-size: 15px; }
textarea { width: 100%; min-height: 64px; resize: none; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 10px 12px; font-size: 16px; line-height: 1.45; outline: none; }
textarea:focus { border-color: rgba(27,43,79,.45); }
.cmd-row { display: flex; gap: 8px; margin-top: 8px; }
.btn { min-height: 44px; border-radius: 14px; border: 1px solid transparent; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 15px; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.cmd-row .primary { flex: 1; }
.hint { margin: 6px 2px 0; font-size: 13px; color: var(--muted); }
.hint.small { font-size: 12px; }
.link { border: 0; background: none; color: var(--accent); font-size: 14px; min-height: 44px; padding: 0 4px; }

/* 四個 app 入口 */
.apps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.app-card { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 8px; min-height: 84px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; box-shadow: 0 2px 10px rgba(27,43,79,.05); }
.app-card img { width: 60px; height: 60px; object-fit: contain; flex: none; }
.app-card b { display: block; font-size: 17px; }
.app-card small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.app-card:active { transform: scale(.98); }

/* 確認卡 */
.cards { display: flex; flex-direction: column; gap: 10px; }
.acard { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ink); border-radius: var(--r); padding: 10px 12px; box-shadow: 0 2px 10px rgba(27,43,79,.06); }
.acard.t-expense { border-left-color: var(--warn); }
.acard.t-delete { border-left-color: #8a3b3b; }
.acard.t-note { border-left-color: var(--muted); }
.acard header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.tag { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #E8ECF3; color: var(--ink); white-space: nowrap; }
.tag.sm { font-size: 12px; padding: 1px 8px; }
.t-expense .tag, .tag.t-expense { background: #F6E7DD; color: #7a3a1c; }
.why { font-size: 12.5px; color: var(--muted); text-align: right; }
.f { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.f input, .f select { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 8px; font-size: 15px; color: var(--ink); width: 100%; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.grid3 { display: grid; grid-template-columns: 1.25fr 1fr .8fr; gap: 6px; margin-top: 6px; }
.acard footer { display: flex; gap: 8px; margin-top: 10px; }
.acard footer .primary { flex: 1; }
.say { margin: 2px 0; font-size: 15px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chipbtn { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.close-cards { align-self: center; }

/* 列表 */
.rows { list-style: none; margin: 0; padding: 0; }
.row, .done-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); min-height: 52px; }
.rows .row:first-child, .rows .done-row:first-child { border-top: 0; }
.done { background: #EAF2F1; border-radius: var(--r); padding: 2px 12px; }
.done-row .ok { color: var(--ok); font-weight: 700; }
.row .d, .done-row .d { flex: 1; min-width: 0; }
.row .what { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row small, .done-row small { display: block; font-size: 12px; color: var(--muted); }
.done-row small { display: inline; }
.row.s-undone .what { text-decoration: line-through; color: var(--muted); }
.undo { flex: none; min-height: 40px; min-width: 56px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--ink); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.recent { padding: 6px 12px 6px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; }
.recent h2 { margin: 0; font-size: 15px; }

/* 底部面板 */
.backdrop { position: fixed; inset: 0; background: rgba(20,24,36,.35); z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 82dvh; overflow: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px)); max-width: 560px; margin: 0 auto; box-shadow: 0 -10px 30px rgba(27,43,79,.18); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet h3 { margin: 14px 0 2px; font-size: 15px; }
.code { font: 600 22px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 1px; background: #EEF1F6; border-radius: 12px; padding: 10px 12px; margin: 8px 0 4px; text-align: center; user-select: all; -webkit-user-select: all; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.row-btns .primary { flex: 1; }
.mem-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mem-add input, .mem-add select { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; background: #fff; flex: 1 1 100px; min-width: 0; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(14px + var(--mobu-nav-h, 50px)); z-index: 40; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; font-size: 14px; display: flex; align-items: center; gap: 8px; max-width: 520px; margin: 0 auto; box-shadow: 0 6px 20px rgba(27,43,79,.25); }
.toast[hidden], [hidden] { display: none !important; }
.toast button { margin-left: auto; border: 0; background: rgba(255,255,255,.15); color: #fff; border-radius: 10px; min-height: 36px; padding: 0 12px; }
