:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --line: #d8dee4;
  --late: #c62828;
  --late-bg: #fdecea;
  --badge-text: #ffffff;
  --done: #8c959f;
  --today: #9a5b00;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --card: #161b22;
    --text: #e6edf3;
    --muted: #8d96a0;
    --line: #30363d;
    --late: #f85149;
    --late-bg: #3b1214;
    --badge-text: #0d1117;
    --done: #6e7681;
    --today: #e3a008;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.5;
}

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.5rem; margin: 0 0 20px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }

.filter { margin-bottom: 12px; }
.filter label { font-weight: 600; }
.filter select {
  margin-left: 8px; padding: 6px 10px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
}
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 0.9rem; color: var(--muted); background: var(--bg); }
td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.done td { color: var(--done); }
tr.late { background: var(--late-bg); box-shadow: inset 4px 0 0 var(--late); }
.late-badge {
  display: inline-block; margin-left: 4px; padding: 1px 10px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  background: var(--late); color: var(--badge-text);
}
.today-badge {
  display: inline-block; margin-left: 4px; padding: 0 9px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  color: var(--today); border: 1px solid currentColor;
}
.summary { margin: 0 0 12px; font-weight: 600; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* 휴대폰: 표를 행별 카드로 바꾼다. 글자 크기는 그대로 둔다 */
@media (max-width: 600px) {
  table, thead, tbody, tr, td { display: block; }
  table { border: none; background: none; }
  thead { display: none; }
  #rows tr {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 8px; margin-bottom: 10px; padding: 6px 0;
  }
  #rows tr.late { background: var(--late-bg); }
  td { border: none; padding: 4px 14px; display: flex; gap: 12px; overflow-wrap: anywhere; }
  td::before {
    content: attr(data-label); flex: 0 0 4em;
    color: var(--muted); font-size: 0.9rem; padding-top: 1px;
  }
  td.empty { display: block; padding: 24px; }
  td.empty::before { content: none; }
}
