:root {
  --bg: #f5f7f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7780;
  --accent: #0f766e;
  --error: #b42318;
  --border: #e3e8ea;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111618;
    --card: #1b2225;
    --text: #e6ecee;
    --muted: #94a2a8;
    --accent: #2dd4bf;
    --error: #f97066;
    --border: #2a3338;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 17px;
  line-height: 1.5;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--accent);
  color: #fff;
}
.topbar h1 { margin: 0; font-size: 20px; }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 6px 0; }
input {
  width: 100%;
  font-size: 18px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin: 8px 0;
}
button {
  width: 100%;
  font-size: 18px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.6; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); margin-top: 8px; }
button.link { width: auto; background: none; padding: 4px 8px; font-size: 15px; color: #fff; }
.muted { color: var(--muted); }
.error { color: var(--error); }
.status { list-style: none; padding: 0; margin: 0; }
.status li { padding: 4px 0; }
[hidden] { display: none !important; }

button.back { width: auto; margin: 0 0 12px; padding: 6px 14px; font-size: 16px; }
.file-button {
  display: block;
  text-align: center;
  padding: 12px;
  margin: 8px 0;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  color: var(--accent);
  cursor: pointer;
}
.file-button input { display: none; }
.preview { display: block; width: 100%; border-radius: 10px; margin: 8px 0; }
.warnings { padding-left: 0; list-style: none; color: var(--error); margin: 8px 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.roster { border-collapse: collapse; font-size: 14px; }
.roster th, .roster td { border: 1px solid var(--border); padding: 3px 4px; text-align: center; min-width: 26px; line-height: 1.2; }
.roster th { font-weight: normal; color: var(--muted); font-size: 12px; }
.roster th.weekend { color: var(--error); }
.roster th.name { position: sticky; left: 0; background: var(--card); color: var(--text); font-size: 14px; text-align: left; white-space: nowrap; z-index: 1; }
.roster .code-duty { color: var(--accent); font-weight: bold; }
.roster .code-E { background: #fef3c7; color: #92400e; font-weight: bold; }
.roster .code-N { background: #e0e7ff; color: #3730a3; font-weight: bold; }
.roster td.total { font-weight: bold; }
.roster tr.count td { color: var(--muted); font-size: 12px; }
details { margin-top: 12px; }
pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; max-height: 300px; overflow: auto; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: 15px; }
.check input { width: auto; margin: 4px 0 0; }
.field { display: block; margin: 8px 0 0; font-size: 15px; color: var(--muted); }
.field input { margin-top: 4px; font-size: 16px; }
