:root {
  --primary: #1f6f5c; --primary-dark: #14503f; --bg: #f2f5f4; --ink: #1c2b27; --muted: #5e6e69; --line: #dce4e1;
  --voice: #7b4fb8; --schedule: #2f6fde; --playback: #e07a1f; --holiday: #2e8b57; --bad: #c0392b; --warn: #b9770e;
  --ok: #1f8a5b; --backup: #0f8a9d; --log: #4a5bc4; --trash: #6b7280; --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif; font-size: 16px; line-height: 1.55;
}
main { max-width: 980px; margin: 0 auto; padding: 16px; }
main.narrow { max-width: 440px; padding-top: 48px; }
h1 { font-size: 1.45rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0; }
a { color: var(--primary); }
.hidden { display: none !important; }
.err { color: var(--bad); }
.muted { color: var(--muted); font-size: .9rem; }

/* 頂部橫幅 */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 22px 22px; color: #fff; margin-bottom: 16px;
  background: linear-gradient(120deg, #1f6f5c, #2e9c7e 60%, #52b69a);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22) 0 30%, rgba(255,255,255,.12) 31% 55%, rgba(255,255,255,.06) 56% 100%);
}
.hero .title { font-size: 1.6rem; font-weight: 700; }
.hero .sub { opacity: .92; margin-top: 4px; }
.hero .right { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); z-index: 1; width: 64px; height: 64px;
  border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 34px; }
.hero .bar { position: relative; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* 分頁 */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.tab { border: 0; background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 999px; font-size: 1rem; cursor: pointer;
  white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tab.active { background: var(--primary); color: #fff; }

/* 卡片 */
.card { background: #fff; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 14px; overflow: hidden; }
.card > .body { padding: 16px; }
.narrow .card { padding: 22px; }
.section-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.badge { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 20px; flex: none; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* 提醒卡片 */
.rem { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rem-top { display: flex; gap: 12px; align-items: center; }
.time { min-width: 76px; text-align: center; padding: 8px 10px; border-radius: 14px; font-size: 1.35rem; font-weight: 700;
  color: var(--schedule); background: rgba(47,111,222,.12); }
.rem.off .time { color: var(--trash); background: rgba(107,114,128,.12); }
.rem.manual .time { color: var(--bad); background: rgba(192,57,43,.12); font-size: 1.1rem; }
.rem-title { font-weight: 700; font-size: 1.05rem; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border-radius: 999px; padding: 3px 10px; font-size: .85rem; font-weight: 600; }
.p-ok { color: var(--ok); background: rgba(31,138,91,.12); }
.p-bad { color: var(--bad); background: rgba(192,57,43,.12); }
.p-warn { color: var(--warn); background: rgba(185,119,14,.14); }
.p-play { color: var(--playback); background: rgba(224,122,31,.12); }
.p-voice { color: var(--voice); background: rgba(123,79,184,.12); }
.p-sched { color: var(--schedule); background: rgba(47,111,222,.12); }
.p-white { color: #fff; background: rgba(255,255,255,.22); }

/* 按鈕與表單 */
button, .btn { font: inherit; border-radius: 12px; padding: 10px 16px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
button.primary, .btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
button.danger { color: var(--bad); border-color: rgba(192,57,43,.4); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; }
label.field { display: block; margin: 12px 0 4px; font-weight: 700; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #b7c4bf; border-radius: 12px; background: #fff; color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 10px; padding: 8px 12px; border: 1px solid #b7c4bf; background: #fff; cursor: pointer; user-select: none; }
.chip.on { background: rgba(47,111,222,.14); border-color: var(--schedule); color: var(--schedule); font-weight: 700; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.toggle input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.hint { color: var(--muted); font-size: .88rem; }

/* 對話框 */
dialog { border: 0; border-radius: 22px; padding: 0; width: min(640px, 96vw); max-height: 92vh; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .dhead { position: sticky; top: 0; background: #fff; padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; z-index: 1; }
dialog .dbody { padding: 4px 18px 18px; }
dialog .dfoot { position: sticky; bottom: 0; background: #fff; padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
fieldset { border: 1px solid var(--line); border-radius: 16px; margin: 14px 0 0; padding: 4px 14px 12px; }
legend { font-weight: 700; padding: 0 6px; }

.banner { border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner.warn { background: rgba(185,119,14,.12); }
.banner.bad { background: rgba(192,57,43,.1); }
.banner.ok { background: rgba(31,138,91,.1); }
.code { font-size: 2.6rem; letter-spacing: .3em; font-weight: 700; text-align: center; color: var(--primary); padding: 10px 0; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { main { padding: 12px; } .hero .right { display: none; } .grid { grid-template-columns: 1fr; } }
