:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #66718a;
  --line: #e3e8f2;
  --brand: #0f6fd6;
  --brand-ink: #0a55a8;
  --ok: #177245;
  --ok-bg: #e4f6ea;
  --err: #b3261e;
  --err-bg: #fdeaea;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
a { color: var(--brand); }

/* 頂部列 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  background: #10233f; color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.topnav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topnav a { color: #cfd9ea; text-decoration: none; font-size: 14px; }
.topnav a:hover { color: #fff; }
.topnav .who { color: #9fc2ec; font-size: 14px; }
.btn-mini { background: var(--brand); color: #fff !important; padding: 6px 12px; border-radius: 8px; }
.inline { display: inline; }
.linkbtn { background: none; border: none; color: #cfd9ea; font: inherit; font-size: 14px; cursor: pointer; padding: 0; }
.linkbtn:hover { color: #fff; }

.wrap { max-width: 1080px; margin: 24px auto; padding: 0 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(16, 35, 63, .06);
}
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.card.wide { max-width: 100%; }
h2 { margin: 0 0 12px; font-size: 21px; }
h3 { margin: 26px 0 10px; font-size: 16px; color: var(--brand-ink); border-left: 4px solid var(--brand); padding-left: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }

/* 首頁 */
.hero { text-align: center; padding: 48px 16px; }
.hero h1 { font-size: 30px; margin-bottom: 12px; }
.lead { color: var(--muted); max-width: 560px; margin: 0 auto 24px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* 按鈕 */
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: none;
  padding: 10px 22px; border-radius: 9px; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-ink); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost:hover { background: #eaf2fc; }
.btn.danger { background: var(--err); }
.btn.danger:hover { background: #8f1d17; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.car-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* 欄位 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.req { color: var(--err); font-style: normal; margin-left: 4px; }
.note { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.err { color: var(--err); font-size: 13px; margin: 4px 0 0; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #c9d2e3; border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3ef; border-color: var(--brand); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
textarea { resize: vertical; }
.hidden { display: none; }
.sep { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

/* 後台操作鈕 */
table.list td.actions { white-space: nowrap; position: sticky; right: 0; background: #fff; box-shadow: -6px 0 10px rgba(16,35,63,.10); }
table.list tbody tr:nth-child(even) td.actions { background: #eaf1fa; }
table.list tbody tr:hover td.actions { background: #d9e8f8; }
table.list th:last-child { position: sticky; right: 0; z-index: 2; box-shadow: -6px 0 10px rgba(16,35,63,.15); }
table.list td.actions .btn { margin: 2px 0; }
.btn.danger { background: #c0392b; border-color: #a93226; color: #fff; }
.btn.danger:hover { background: #a93226; }
.role-form { display: inline-flex; align-items: center; gap: 6px; }
.role-form select { padding: 6px 8px; border: 1px solid #c9d2e3; border-radius: 8px; font-size: 13px; background: #fff; }

/* LINE 加好友橫幅 */
.line-banner { display: flex; align-items: center; gap: 12px; margin: 12px 0 16px; padding: 12px 16px; border-radius: 12px; background: linear-gradient(135deg, #06c755, #03b14c); color: #fff; text-decoration: none; box-shadow: 0 3px 10px rgba(6,199,85,.35); transition: transform .12s, box-shadow .12s; }
.line-banner:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(6,199,85,.45); }
.line-banner .lb-icon { font-size: 30px; }
.line-banner .lb-text { flex: 1; font-size: 13.5px; line-height: 1.5; }
.line-banner .lb-go { background: #fff; color: #03a146; font-weight: 800; font-size: 13px; padding: 8px 14px; border-radius: 999px; white-space: nowrap; }

/* 後台群發信面板 */
.mailpanel { margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; background: #f7fafd; }
.mailpanel summary { cursor: pointer; padding: 10px 14px; font-weight: 700; color: #10233f; }
.mailpanel form { padding: 4px 14px 14px; }
.mailpanel .field { margin: 8px 0; }
@media (max-width: 760px) {
  table.list td.actions { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; }
  table.list td.actions .btn { width: 62px; text-align: center; }
}

/* 驗證碼 */
.captcha-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.captcha-row input { flex: 0 1 150px; letter-spacing: 3px; font-weight: 700; }
.captcha-row img {
  width: 120px; height: 44px; border: 1px solid #c9d2e3; border-radius: 8px;
  background: #fff; cursor: pointer; display: block;
}
.captcha-row img:hover { border-color: var(--brand); box-shadow: 0 0 0 2px #9cc3ef; }

/* 勾選 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chips.col { flex-direction: column; align-items: flex-start; }
.ck, .rd {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid #c9d2e3; border-radius: 999px; padding: 7px 14px;
  font-size: 14px; cursor: pointer; background: #fff; user-select: none;
}
.chips.col .ck { border-radius: 10px; }
.ck input, .rd input { accent-color: var(--brand); width: 16px; height: 16px; }
.ck:has(input:checked), .rd:has(input:checked) { border-color: var(--brand); background: #eaf2fc; color: var(--brand-ink); font-weight: 600; }

/* 提示列 */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err-box, .flash.err { background: var(--err-bg); color: var(--err); }
.alt { color: var(--muted); font-size: 14px; margin-top: 14px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* 我的車輛卡片 */
.car-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fbfcfe; }
.car-title { font-weight: 700; font-size: 16px; }
.car-title .plate { margin-left: 10px; font-weight: 600; color: var(--brand-ink); background: #eaf2fc; border-radius: 6px; padding: 2px 8px; font-size: 13.5px; }
.car-meta { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* 管理後台 */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.filters .f label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.filters .fbtns { display: flex; align-items: end; gap: 8px; }
.table-scroll { overflow-x: auto; }
table.list { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: nowrap; vertical-align: top; }
table.list th { background: #10233f; color: #fff; position: sticky; top: 0; }
table.list tbody tr:nth-child(odd) td { background: #ffffff; }
table.list tbody tr:nth-child(even) td { background: #eaf1fa; }
table.list tbody tr:hover td { background: #d9e8f8; }
table.list td.name-col { font-weight: 700; color: #10233f; background: #fdf3e3 !important; }
table.list td.plate-col { font-weight: 700; color: var(--brand-ink); background: #e8f3ff !important; letter-spacing: .5px; }
table.list td.smoke-no { color: var(--ok); font-weight: 600; }
table.list td.smoke-yes { color: var(--err); font-weight: 600; }
table.list tr:hover td.name-col { background: #fbe8c8 !important; }
table.list tr:hover td.plate-col { background: #c8e2fb !important; }
table.list td.areas { white-space: normal; min-width: 140px; }
table.detail { border-collapse: collapse; width: 100%; font-size: 14.5px; }
table.detail th, table.detail td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; }
table.detail th { width: 180px; color: var(--muted); font-weight: 600; background: #f7f9fc; }

.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px 0 32px; }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .card { padding: 16px; }
  table.detail th { width: 110px; }
}
