.cal-sheet {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 35%, transparent);
}
.cal-bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.cal-bar h1 { text-align: center; font-family: "Source Serif 4", serif; font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; }
.cal-step { min-height: 44px; display: grid; place-items: center; text-decoration: none; font-size: 28px; color: var(--ink); }
.cal-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.cal-tools button, .cal-tools a, .cal-pick summary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
}
/* Custom can-chi switch (same pattern as tools.css .switch — no native checkbox look). */
.can-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 4px 0 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.can-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.can-toggle > span {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  flex: 0 0 auto;
}
.can-toggle > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card);
  transition: left 0.15s ease;
}
.can-toggle input:checked + span { background: var(--seal); }
.can-toggle input:checked + span::after { left: 21px; }
.can-toggle input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 2px; }
.cal-pick { position: relative; }
.cal-pick summary { cursor: pointer; list-style: none; }
.pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.pick-grid a { justify-content: center; }
.month-layout { display: grid; gap: 16px; }
@media (min-width: 960px) {
  .month-layout { grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr); align-items: start; }
}
.month-grid, .mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow { text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.dow.is-sat, .cell.is-sat strong { color: #1e4d6b; }
.dow.is-sun, .cell.is-sun strong { color: var(--seal); }
html[data-theme="muc"] .dow.is-sat,
html[data-theme="muc"] .cell.is-sat strong,
html[data-theme="go"] .dow.is-sat,
html[data-theme="go"] .cell.is-sat strong,
html[data-theme="thuy"] .dow.is-sat,
html[data-theme="thuy"] .cell.is-sat strong { color: #8eb4cc; }
.cell {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.cell strong { font-family: "Source Serif 4", serif; font-size: 1.15rem; }
.cell small, .cell em { font-style: normal; color: var(--muted); font-size: 12px; }
.cell .can { display: none; }
.cal-sheet:has(#show-can:checked) .can { display: block; }
.cell.mute { background: transparent; border-color: transparent; }
.cell.is-today { outline: 2px solid var(--seal); outline-offset: -2px; }
.cell.is-selected { background: color-mix(in srgb, var(--gold) 22%, var(--card)); box-shadow: inset 0 -3px 0 var(--gold); }
.le-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--seal); font-size: 10px; font-weight: 700; }
.cell.is-hoang strong { color: #8a6232; }
.lunar-start { color: var(--seal); font-weight: 700; }
.dots { display: flex; gap: 3px; margin-top: auto; min-height: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-hoang-dao { background: #c6a15a; }
.dot-hac-dao { background: #8d847b; }
html[data-theme="muc"] .dot-hac-dao,
html[data-theme="go"] .dot-hac-dao,
html[data-theme="thuy"] .dot-hac-dao { background: #a39890; }
.dot-le { background: var(--seal); }
.dot-tiet { background: var(--good); }
.dot-gio { background: #1e4d6b; }
.cell:not(.has-gio) .dot-gio { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; list-style: none; padding: 0; margin: 14px 0; color: var(--muted); font-size: 13px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.day-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: color-mix(in srgb, var(--bg) 70%, var(--card));
}
.day-panel h2 { font-family: "Source Serif 4", serif; margin: 0 0 4px; font-size: 1.35rem; }
.day-panel h2 a { color: var(--ink); text-decoration: none; }
.day-panel .note { margin: 0; }
.panel-top { display: flex; gap: 12px; align-items: center; }
.panel-top .gauge-sm { margin-left: auto; }
.seal-mini { width: 72px; height: 72px; flex: none; box-shadow: 0 0 0 2px #c6a15a, 0 0 0 4px #6e241f; }
.seal-mini b { font-size: 26px; }
.gauge-sm { width: 72px; height: 72px; }
.gauge-sm text { font-size: 22px; }
.hour-chips, .panel-events { list-style: none; padding: 0; margin: 8px 0; }
.hour-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hour-chips li { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 13px; background: var(--bg); }
.hour-chips small { color: var(--muted); }
.panel-events li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.open-day {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--seal);
  color: var(--seal-ink);
  text-decoration: none;
  font-weight: 700;
}
/* HOME2: keep primary actions on one row; compare link below so it never wraps mid-label. */
.day-panel .shortlist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.day-panel .shortlist-actions .compare-link {
  flex: 1 0 100%;
  white-space: nowrap;
}
.year-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.year-stats p { margin: 0; min-width: 0; padding: 10px 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.year-stats a, #month-events a, .term-list a, .holiday-list a, .mini-year h2 a { text-decoration: underline; text-underline-offset: 2px; }
.year-stats a, #month-events a, .term-list a, .holiday-list a, .mini-year h2 a { text-decoration: underline; text-underline-offset: 2px; }
.year-stats strong { white-space: nowrap; }
.year-stats .nap { display: block; }
.term-list, .holiday-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.term-list { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.term-list li, .holiday-list li { display: flex; gap: 8px; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.filters button[aria-pressed="true"] { background: color-mix(in srgb, var(--gold) 28%, var(--card)); border-color: #c6a15a; }
.year-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.mini-year { border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: var(--bg); min-width: 0; }
.mini-year h2 { margin: 0 0 8px; font-size: 1rem; }
.mini-year h2 a { color: var(--ink); text-decoration: none; }
.yday { min-height: 36px; text-align: center; text-decoration: none; color: var(--ink); border-radius: 8px; padding: 2px 0; }
.yday b, .yday small { display: block; }
.yday small { color: var(--muted); font-size: 10px; }
.yday.is-hoang b { color: #8a6232; }
.year-board[data-on="le"] .yday:not([data-le]),
.year-board[data-on="moc"] .yday:not([data-moc]),
.year-board[data-on="hoang"] .yday:not([data-hoang]),
.year-board[data-on="tiet"] .yday:not([data-tiet]),
.year-board[data-on="event"] .yday:not([data-le]):not(.has-gio) { opacity: 0.2; }
.year-jump input, form[data-year-jump] input { width: 8ch; min-height: 40px; }
@media (max-width: 800px) {
  .cell { min-height: 58px; padding: 4px; border-radius: 8px; }
  .cell strong { font-size: 1rem; }
  .lunar-start { font-size: 10px; }
}
@media print {
  .cal-tools, .filters, .cal-step { display: none !important; }
  .year-board .yday { opacity: 1 !important; }
  .cal-sheet { box-shadow: none; }
}
