:root {
  --paper: #f3efe6;
  --ink: #1c1915;
  --muted: #6b6458;
  --line: #d9d0c3;
  --posted: #2f6b4f;
  --posted-bg: #dceadf;
  --missing: #9a3b2a;
  --missing-bg: #f3ddd6;
  --empty: #9a9488;
  --empty-bg: #eee9df;
  --watch: #8a5a12;
  --watch-bg: #f4e6c8;
  --chip: #ece6da;
  --panel: #fbf8f2;
  --accent: #1c1915;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.06);
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
html[data-theme="dark"] {
  --paper: #161412;
  --ink: #f0ebe3;
  --muted: #a89f92;
  --line: #3a342c;
  --posted: #8fcead;
  --posted-bg: #1e3329;
  --missing: #e39a8a;
  --missing-bg: #3a221d;
  --empty: #6e675c;
  --empty-bg: #241f1a;
  --watch: #e3c07a;
  --watch-bg: #3a2e18;
  --chip: #241f1a;
  --panel: #1d1a16;
  --accent: #f0ebe3;
  --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
}
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}
header.mast {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 18px;
  margin-bottom: 28px;
}
h1 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.15;
}
.sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 8px;
}
.period-modes button {
  min-width: 76px;
  font-weight: 600;
  border-radius: 0;
  position: relative;
}
.period-modes button + button {
  margin-left: -1px;
}
.period-modes button:first-child {
  border-radius: 999px 0 0 999px;
}
.period-modes button:last-child {
  border-radius: 0 999px 999px 0;
}
.period-modes button:hover,
.period-modes button.active {
  z-index: 1;
}
.week-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.week-picks .chip {
  height: 24px;
  line-height: 22px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}
.month-select {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 28px 6px 12px;
  min-width: 132px;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.month-select:hover { border-color: var(--ink); }
.month-select:focus {
  outline: none;
  border-color: var(--ink);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.toolbar.period-modes {
  gap: 0;
  justify-content: flex-start;
}
button, .chip {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}
button .btn-ico {
  width: 13px;
  height: 13px;
  display: block;
  flex: none;
}
#btn-member,
#btn-day {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover, .chip:hover { border-color: var(--ink); }
button:disabled, .chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--line);
}
button:disabled:hover, .chip:disabled:hover { border-color: var(--line); }
button.active, .chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 22px 0 28px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat b {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.stat span { color: var(--muted); font-size: 12px; }
.stat.warn b { color: var(--missing); }

.heat-block { margin: 0 0 22px; }
.heat-block h3,
.week-label {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px;
}
.week-block { margin: 0 4px 12px; }
details.person > .week-block { padding: 0 12px; }
details.person > .week-block:last-child { padding-bottom: 8px; }
.week-section { margin: 0 0 22px; }
.heat {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 6px;
  margin: 0 0 28px;
}
.heat .col-name { width: 120px; }
.heat .col-rate { width: 40px; }
.heat .col-day { width: auto; }
.heat-block .heat { margin-bottom: 0; }
.heat th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 0 8px 4px;
}
.heat td { padding: 0; }
.cell {
  display: block;
  width: 100%;
  min-height: 40px;
  text-align: left;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  border: 0;
}
.cell.posted { background: var(--posted-bg); color: var(--posted); }
.cell.missing { background: var(--missing-bg); color: var(--missing); }
.cell.empty {
  background: var(--empty-bg);
  color: var(--empty);
  cursor: default;
  opacity: 0.7;
}
.name-cell {
  font-weight: 600;
  padding: 10px 8px !important;
  white-space: nowrap;
}
.rate { color: var(--muted); font-size: 12px; font-weight: 500; }

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 18px;
}
.toolbar.view-modes {
  gap: 8px;
  justify-content: flex-start;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.section-title {
  font-family: var(--serif);
  font-size: 22px;
  margin: 8px 0 14px;
}

details.person {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
details.person > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-weight: 600;
}
details.person > summary::-webkit-details-marker { display: none; }
.chev {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
}
details[open] > summary .chev { transform: rotate(45deg); }
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}
.swatch.quang { background: #3b6ea5; }
.swatch.vu { background: #2f6b4f; }
.swatch.nam { background: #c2782a; }
.swatch.toan { background: #6b4ea1; }
.meta { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.days { padding: 0 12px 14px; display: grid; gap: 8px; }

details.day {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
details.day > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}
details.day > summary::-webkit-details-marker { display: none; }
.badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: auto;
}
.badge.posted { background: var(--posted-bg); color: var(--posted); }
.badge.missing { background: var(--missing-bg); color: var(--missing); }
.badge.empty { background: var(--empty-bg); color: var(--empty); }
details.pending > summary { color: var(--muted); font-weight: 500; }
.day-body { padding: 0 14px 14px; display: grid; gap: 12px; }
.block h3 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.block ul { margin: 0; padding: 0 0 0 18px; }
.block li { margin: 0 0 4px; }
.empty { color: var(--muted); font-style: italic; margin: 0; }
.tickets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ticket {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
}
.note {
  margin-top: 28px;
  padding: 14px 16px;
  border-left: 3px solid var(--watch);
  background: var(--watch-bg);
  border-radius: 0 10px 10px 0;
  font-size: 13px;
}
.note strong { display: block; margin-bottom: 4px; }
.hidden { display: none !important; }
footer {
  margin-top: 36px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 2px;
}
footer p { margin: 0; }
footer .foot-updated {
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 760px) {
  header.mast { flex-direction: column; align-items: stretch; }
  .toolbar { justify-content: flex-start; }
  .period-bar { flex-direction: column; align-items: stretch; }
  .week-picks,
  .filters {
    padding-left: 0;
    border-left: 0;
  }
  h1 { font-size: 28px; }
}
@media print {
  body { background: white; }
  .toolbar, button { display: none !important; }
  details { break-inside: avoid; }
  details:not([open]) { display: block; }
}
