:root {
  --overdue: #d93025;
  --waiting: #e8710a;
  --active: #1a73e8;
  --done: #188038;
  --idle: #80868b;
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e2e5e9;
  --text: #202124;
  --sub: #5f6368;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 15px; line-height: 1.6;
}
a { color: var(--active); text-decoration: none; }
header.topbar {
  background: #fff; border-bottom: 1px solid var(--border); padding: 10px 16px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; position: sticky; top: 0; z-index: 10;
}
header.topbar .brand { font-weight: 700; margin-right: 8px; }
header.topbar nav { display: flex; flex-wrap: wrap; gap: 12px; }
header.topbar .spacer { flex: 1; }
main { max-width: 1120px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; margin: 8px 0 16px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.metric { font-size: 26px; font-weight: 700; }
.metric.overdue { color: var(--overdue); }
.metric.waiting { color: var(--waiting); }
.metric.active { color: var(--active); }
.metric.done { color: var(--done); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--sub); font-weight: 600; white-space: nowrap; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; color: #fff; white-space: nowrap; }
.badge.PENDING, .badge.idle { background: var(--idle); }
.badge.ACTIVE { background: var(--active); }
.badge.WAITING_INTERNAL, .badge.WAITING_EXTERNAL { background: var(--waiting); }
.badge.COMPLETED { background: var(--done); }
.badge.CANCELLED { background: var(--idle); }
.badge.overdue { background: var(--overdue); }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--sub); margin-top: 8px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: #fff;
}
button, .btn {
  cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 6px; padding: 7px 12px; font-size: 14px;
}
button.primary { background: var(--active); border-color: var(--active); color: #fff; }
button.danger { background: var(--overdue); border-color: var(--overdue); color: #fff; }
.flash { background: #e8f0fe; border: 1px solid #c6dafc; color: #1a3d7c; padding: 10px; border-radius: 8px; margin-bottom: 12px; }
.error { background: #fce8e6; border: 1px solid #f5c4bf; color: #a50e0e; padding: 10px; border-radius: 8px; margin-bottom: 12px; }
.muted { color: var(--sub); font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
details summary { cursor: pointer; color: var(--sub); }
.code-box { font-family: ui-monospace, monospace; font-size: 22px; letter-spacing: 3px; background: #fff8e1; border: 1px dashed #f0b400; padding: 10px; border-radius: 8px; }
@media (max-width: 640px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  td { border: none; padding: 3px 0; }
  tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
  td::before { content: attr(data-label) "："; color: var(--sub); font-size: 12px; }
}
