:root {
  --bg: #f4f6f8; --card: #fff; --text: #212529; --muted: #6c757d; --line: #dee2e6;
  --brand: #06c755; --brand-dark: #05a647; --danger: #d63939; --warn: #f0ad4e; --blue: #2f6fed;
  --bubble-me: #d9fdd3; --bubble-bot: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--blue); }
header { background: #1f2d3d; color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header h1 { font-size: 18px; margin: 0; flex: 1; }
header .who { font-size: 13px; opacity: .85; }
header button { background: transparent; border: 1px solid #fff6; color: #fff; }
nav { display: flex; gap: 4px; padding: 8px 12px 0; overflow-x: auto; background: #1f2d3d; }
nav button { background: transparent; color: #cfd8e3; border: none; border-radius: 8px 8px 0 0; padding: 10px 14px; white-space: nowrap; }
nav button.on { background: var(--bg); color: var(--text); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px #0001; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 13px; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #06c75544; border-color: var(--brand); }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; background: #e9ecef; }
.pill.run { background: #d3f9d8; color: #1b7a33; }
.pill.pause { background: #fff3bf; color: #8a6100; }
.pill.end { background: #dbe4ff; color: #2b44a8; }
.err { color: var(--danger); white-space: pre-wrap; }
.ok { color: #1b7a33; }
pre.summary { white-space: pre-wrap; background: #f8f9fa; padding: 12px; border-radius: 8px; margin: 8px 0 0; font-family: inherit; }
.hide { display: none !important; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #212529; color: #fff;
  padding: 10px 18px; border-radius: 99px; z-index: 9; font-size: 14px; }

/* 模擬聊天 */
.chat { height: 60vh; min-height: 360px; overflow-y: auto; background: #8cabd9; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg .from { font-size: 12px; color: var(--muted); display: block; margin-bottom: 2px; }
.msg.me { align-self: flex-end; background: var(--bubble-me); }
.msg.bot { align-self: flex-start; background: var(--bubble-bot); }
.msg img { max-width: min(100%, 380px); border-radius: 8px; display: block; cursor: zoom-in; }
.composer { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.composer input[type=text] { flex: 1; min-width: 160px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick button { font-size: 13px; padding: 5px 10px; border-radius: 99px; }

/* 設定編輯 */
.days input { width: 100%; }
.days td:first-child { width: 140px; }
.days td:nth-child(2) { width: 80px; }
.days td:last-child { width: 50px; }

/* 登入 */
.login { max-width: 360px; margin: 12vh auto; }
.login input { width: 100%; margin-bottom: 12px; }
.login button { width: 100%; }

@media (max-width: 640px) {
  main { padding: 10px; }
  .card { padding: 12px; }
  .msg { max-width: 92%; }
  th, td { padding: 6px 4px; }
}
