/* ============================================================
   World Calendar · V1 Classic Grid
   ============================================================ */

:root {
  --bg:           #FFFFFF;
  --bg-soft:      #FAFAF8;
  --bg-sidebar:   #FFFFFF;
  --bg-topbar:    #1A1A1A;
  --bg-hover:     #F4F4F0;
  --ink:          #1A1A1A;
  --ink-soft:     #3A3A3A;
  --ink-muted:    #707070;
  --ink-faint:    #8B8B85;
  --rule:         #E5E5E0;
  --rule-soft:    #EFEFEA;
  --accent:       #C8232C;   /* 节日红 (federal) */
  --weekend:      #E64545;   /* 周末红 (Sat/Sun) */
  --accent-soft:  #FFE9E9;
  --accent-2:     #B85510;   /* observed 橙 */
  --accent-2-soft:#FCE7D5;
  --link:         #2E7DD8;
  --link-hover:   #1A5FB4;
  --shadow-card:  0 1px 2px rgba(20,20,20,0.04), 0 1px 1px rgba(20,20,20,0.03);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Noto Sans SC", "Noto Sans TC", "Noto Sans JP",
               "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
}

/* —— Reset —— */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  background: #F1F1ED;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
ul, ol { list-style: none; padding: 0; margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   Layout shell —— 最大宽 1280px，居中，背景白色
   ============================================================ */

.app {
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--rule), 0 8px 32px rgba(20,20,20,0.04);
  position: relative;
}

/* —— Topbar —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-topbar);
  color: #fff;
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}
.topbar__hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.0);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.topbar__hamburger:hover { background: rgba(255,255,255,0.08); }
.topbar__brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #C8232C 0%, #B85510 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.topbar__nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
}
.topbar__nav a {
  color: #A0A0A0;
  transition: color .15s ease;
  font-weight: 500;
}
.topbar__nav a:hover { color: #fff; }
.topbar__nav a.is-current { color: #fff; }

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.topbar__btn:hover { background: #f4f4f4; }
.topbar__btn--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.topbar__btn--ghost:hover { background: rgba(255,255,255,0.08); }

/* —— Body (sidebar + main) —— */
.body {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  align-items: stretch;
  background: var(--bg);
  min-height: 0;
}

/* —— Sidebar —— */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--rule);
  padding: 24px 24px 32px;
  font-size: 13px;
}
.sidebar__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.sidebar__sub {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 3px;
  margin-bottom: 0;
}

/* Sidebar groups are <details> elements:
   desktop → CSS 强制显示全部内容，summary 仅作静态标签
   mobile  → tap summary 展开 / 折叠（依赖 details[open] 原生行为） */
.sidebar__group {
  margin-top: 22px;
}
.sidebar__group--top { margin-top: 0; }
.sidebar__group > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  user-select: none;
}
.sidebar__group > summary::-webkit-details-marker { display: none; }
.sidebar__group__chev {
  display: none;
  color: var(--ink-faint);
  font-size: 10px;
  transition: transform .15s ease;
}
.sidebar__group[open] > summary .sidebar__group__chev { transform: rotate(180deg); }

/* Desktop: summary 不可点击（JS 会把所有 sidebar__group 设为 open，
   并保持同步；这里只是禁止用户点击折叠它们） */
@media (min-width: 881px) {
  .sidebar__group > summary { pointer-events: none; }
}

.sidebar__label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 10px;
  text-transform: uppercase;
}
.sidebar__group > summary .sidebar__label { margin-bottom: 0; }
.sidebar__group[open] > summary .sidebar__label { margin-bottom: 10px; }

/* Year segmented —— 3 个独立 chip，未选中白底浅灰边框，选中浅灰底黑色边框 */
.year-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.year-seg__btn {
  flex: 1 1 auto;
  min-width: 46px;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 6px 4px;
  background: #FFF;
  border: 1px solid var(--rule);
  border-radius: 6px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.year-seg__btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.year-seg__btn.is-current {
  background: var(--bg-soft);
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 700;
}
/* 暂无数据的未来年：置灰、不可点 */
.year-seg__btn.is-disabled {
  opacity: .45;
  color: var(--ink-faint);
  background: var(--bg-soft);
  border-style: dashed;
  cursor: not-allowed;
  pointer-events: none;
}

/* Week-start segmented —— 2 个 chip，跟 year-seg 同款风格 */
.ws-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.ws-seg__btn {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 6px 4px;
  background: #FFF;
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.ws-seg__btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.ws-seg__btn.is-current {
  background: var(--bg-soft);
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 700;
}

/* List items (country / region) */
.list-nav { display: flex; flex-direction: column; gap: 2px; }
.list-nav__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  color: var(--ink-soft);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.list-nav__item:hover { background: var(--bg-hover); color: var(--ink); }
.list-nav__item.is-current {
  background: var(--bg-soft);
  border-color: var(--rule);
  color: var(--ink);
  font-weight: 600;
}
.list-nav__item__check {
  display: none;
  flex: 0 0 auto;
  color: var(--ink);
}
.list-nav__item.is-current .list-nav__item__check { display: inline-flex; }
.list-nav__more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--link);
  padding: 8px 11px;
  border-radius: 6px;
  transition: background .15s ease;
}
.list-nav__more:hover { background: var(--bg-hover); }
.list-nav__more__chev {
  flex: 0 0 auto;
  color: var(--link);
}

/* Language */
.lang-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}
.lang-btn:hover { border-color: var(--ink-faint); }
.lang-btn__inner { display: inline-flex; gap: 10px; align-items: center; }
.lang-btn__chev { flex: 0 0 auto; color: var(--ink-muted); transition: transform .15s ease; }
.dd[open] > .lang-btn .lang-btn__chev { transform: rotate(180deg); }
.dd {
  position: relative;
}
.dd > summary {
  list-style: none;
}
.dd > summary::-webkit-details-marker { display: none; }
.dd__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(20,20,20,0.08);
  padding: 6px;
  z-index: 20;
}
.dd__menu li a {
  display: block;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--ink-soft);
}
.dd__menu li a:hover { background: var(--bg-hover); color: var(--ink); }
.dd__menu li a.is-current { background: var(--bg-soft); color: var(--ink); font-weight: 600; }

/* —— Main —— */
.main {
  padding: 24px 32px 40px;
  background: var(--bg);
  min-width: 0;
}

/* Main header */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 24px;
  flex-wrap: wrap;
}
.page-head__title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.page-head__year {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.page-head__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.page-head__sub {
  font-size: 11px;
  color: var(--ink-muted);
  margin-left: 8px;
}
.page-head__actions {
  display: flex;
  gap: 8px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  padding: 9px 14px;
  border-radius: 6px;
  transition: background .15s ease;
}
.btn-primary:hover { background: #000; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid var(--rule);
}
.btn-secondary:hover { border-color: var(--ink-faint); background: var(--bg-soft); }

/* Calendar grid · 默认 3 列 × 4 行 */
.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.month-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}
.month-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.month-card__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.month-card__badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}

.mini {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.mini thead th {
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-faint);
  text-align: center;
  padding: 6px 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mini tbody td {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  padding: 4px 0;
  position: relative;
  font-weight: 500;
}
.mini tbody td.is-out  { color: #C9C9C5; font-weight: 400; }
.mini tbody td.is-weekend { color: var(--weekend); }
/* 上/下月溢出的周末：用淡红，跟本月周末的鲜红区分 */
.mini tbody td.is-out.is-weekend { color: #F0B5B5; }
.mini__cell {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}
.mini tbody td.is-holiday .mini__cell,
.mini tbody td.is-substitute .mini__cell {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
/* 连休段中的周末：和 holiday 一样的红圆，但无虚下划线 —— 区分"真假"节假日 */
.mini tbody td.is-streak .mini__cell {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.mini tbody td.is-work .mini__cell {
  color: var(--ink-soft);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.mini tbody td.is-today .mini__cell {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

/* === Mini-month cell · tooltip + 点击跳转 ====================
   - .mini__cell--link：<a>，hover/focus 显示 tooltip + 点击滚到列表
   - .mini__cell--info：<span>，仅 hover 显示 tooltip（不可点击）
   ============================================================ */
.mini__cell--link,
.mini__cell--info {
  position: relative;
}
.mini__cell--link {
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.mini__cell--link:hover { transform: scale(1.08); }
.mini__cell--link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.mini__cell--info { cursor: help; }

/* tooltip 气泡 —— 内容来自 data-tooltip 属性，link 和 info 共用 */
.mini__cell[data-tooltip]::before,
.mini__cell[data-tooltip]::after {
  display: none;
  position: absolute;
  left: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 30;
}
.mini__cell[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(2px);
  background: #1f1f1d;
  color: #fff;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0;
  white-space: pre-line;
  text-align: left;
  width: max-content;
  max-width: 220px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
}
.mini__cell[data-tooltip]::before {
  content: "";
  bottom: calc(100% + 2px);
  transform: translateX(-50%) translateY(2px);
  border: 5px solid transparent;
  border-top-color: #1f1f1d;
}
.mini__cell[data-tooltip]:hover::before,
.mini__cell[data-tooltip]:hover::after,
.mini__cell--link[data-tooltip]:focus-visible::before,
.mini__cell--link[data-tooltip]:focus-visible::after {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 760px) {
  .mini__cell[data-tooltip]::before,
  .mini__cell[data-tooltip]::after {
    content: none;
    display: none;
  }
}

/* 点击 → 目标行底色闪烁 3 次 */
@keyframes hday-flash {
  0%, 100% { background-color: transparent; }
  50%      { background-color: var(--accent-soft); }
}
.holiday-table tbody tr.is-target > td {
  animation: hday-flash 0.5s ease-out 3;
}

/* Holiday list table */
.holidays {
  margin-top: 32px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.holidays__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rule);
  gap: 16px;
  flex-wrap: wrap;
}
.holidays__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.holidays__sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 4px 0 0;
}

.holiday-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.holiday-table thead th {
  background: var(--bg-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-transform: uppercase;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.holiday-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
.holiday-table tbody tr:last-child td { border-bottom: 0; }
.holiday-table tbody tr:hover { background: var(--bg-soft); }
.holiday-table td.col-date {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  width: 90px;
}
.holiday-table td.col-day {
  color: var(--ink-muted);
  white-space: nowrap;
  width: 90px;
}
.holiday-table td.col-name {
  color: var(--ink);
  font-weight: 500;
  max-width: 260px;
}
.holiday-table td.col-type { width: 1%; white-space: nowrap; }
.holiday-table td.col-desc {
  color: var(--ink-muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.holiday-table .badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.holiday-table .badge--public,
.holiday-table .badge--federal { background: var(--accent-soft); color: var(--accent); }
.holiday-table .badge--substitute { background: var(--accent-2-soft); color: var(--accent-2); }
.holiday-table .badge--observance,
.holiday-table .badge--observed { background: var(--accent-2-soft); color: var(--accent-2); }
.holiday-table .badge--regional { background: #E9F0FB; color: var(--link); }
.holiday-table .badge--working { background: #EEEEEC; color: var(--ink-muted); }

.holiday-section-head {
  background: var(--bg-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
  padding: 10px 16px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* Country list (index page) */
.country-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.country-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-card);
}
.country-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20,20,20,0.06);
}
.country-card__flag {
  font-size: 22px;
  line-height: 1;
}
.country-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.country-card__sub {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Footer */
.page-footer {
  margin-top: auto;
  padding: 16px 32px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ============================================================
   Responsive
   ============================================================ */
/* 第一断点：sidebar 占用 260px，剩下空间不够 3 列时收成 2 列 6 行 */
@media screen and (max-width: 1080px) {
  .year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   Mobile-only：M Filter（inline 在 main 顶部）
   ============================================================ */
.m-filter { display: none; }   /* desktop 默认隐藏，mobile media query 内显示 */

/* m-filter__title 现在是 H1 元素：清除 H1 默认 margin / font，由子 span 控制视觉 */
.m-filter__title {
  display: flex; flex-direction: column; gap: 2px;
  margin: 0; padding: 0;
  font-size: inherit; font-weight: inherit; line-height: inherit;
}
.m-filter__year {
  margin: 0;
  font-family: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
  line-height: 1;
}
.m-filter__name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.m-filter__sub { margin: 0; color: var(--ink-muted); font-size: 11px; }

.m-filter__chips { display: flex; gap: 6px; align-items: stretch; }
.m-filter__chip {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  background: #FFF;
  border: 1px solid var(--rule);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}
.m-filter__chip.is-current {
  background: var(--bg-soft);
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 700;
}
.m-filter__chip.is-disabled {
  opacity: .45;
  color: var(--ink-faint);
  border-style: dashed;
  cursor: not-allowed;
  pointer-events: none;
}

.m-filter__rows { display: flex; flex-direction: column; gap: 8px; }
.m-filter__row {
  border-radius: 6px;
  border: 1px solid #E5E5E0;
  background: #FFF;
  overflow: hidden;
}
.m-filter__row > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.m-filter__row > summary::-webkit-details-marker { display: none; }
.m-filter__row-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-filter__row-label {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.m-filter__row-value {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-filter__chev {
  color: var(--ink-muted);
  font-size: 12px;
  transition: transform .15s ease;
}
.m-filter__row[open] > summary .m-filter__chev { transform: rotate(180deg); }
.m-filter__list {
  list-style: none;
  padding: 4px 0;
  margin: 0;
  border-top: 1px solid var(--rule-soft);
  max-height: 240px;
  overflow-y: auto;
}
.m-filter__item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
}
.m-filter__item:hover { background: var(--bg-hover); }
.m-filter__item.is-current {
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 700;
}

/* ============================================================
   Mobile-only：Menu Drawer（右侧 slide-in）
   ============================================================ */
.menu-drawer {
  display: none;     /* desktop 默认隐藏 */
}

@media screen and (max-width: 880px) {
  /* —— Topbar: 显示汉堡（右侧），nav 收起 —— */
  .topbar { padding: 12px 16px; gap: 8px; }
  .topbar__nav { display: none; }
  .topbar__actions { gap: 4px; }
  .topbar__btn--print { display: none; }   /* mobile 上 print 移到 drawer 里 */
  .topbar__hamburger { display: inline-flex; }

  /* —— body: 单列；sidebar 隐藏，m-filter inline 显示 —— */
  .body { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  /* main 顶部：m-filter inline；隐藏原 page-head —— */
  .main { padding: 0; }
  .m-filter {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: #FFF;
    border-bottom: 1px solid #EBE9E1;
  }
  .page-head { display: none; }

  /* 月历区 —— */
  .main > .year-grid,
  .main > .holidays,
  .main > .country-cards,
  .main > p { margin: 0 16px; }
  .main > .year-grid { margin-top: 16px; gap: 12px; }
  .year-grid { grid-template-columns: 1fr; }
  .month-card { padding: 14px; }
  .month-card__name { font-size: 18px; }
  .mini__cell { width: 30px; height: 30px; }
  .mini tbody td { font-size: 13px; padding: 4px 0; }
  .mini thead th { font-size: 10px; padding: 6px 0; }

  .holiday-table .col-day { display: none; }
  .holiday-table .col-desc { display: none; }
  .page-footer { padding: 14px 18px; }

  /* —— Menu Drawer：从右侧滑入 ——
     注意：transform translateX(100%) 让 fixed 元素正好停在 viewport 右边界，
     不会产生横向溢出（避免出现右侧空白 + 破坏 topbar sticky） */
  .menu-drawer {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 86%);
    background: #FFF;
    z-index: 60;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .22s ease;
    box-shadow: -6px 0 24px rgba(0,0,0,0);
  }
  body.is-menu-open .menu-drawer {
    transform: translateX(0);
    box-shadow: -6px 0 24px rgba(0,0,0,0.18);
  }
  body.is-menu-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(20,20,20,0.42);
    z-index: 55;
  }

  .menu-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #EBE9E1;
    background: #FFF;
  }
  .menu-drawer__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--ink);
  }
  .menu-drawer__close {
    width: 32px;
    height: 32px;
    background: #F5F5F0;
    border: 0;
    border-radius: 6px;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .menu-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .menu-drawer__label {
    margin: 0 0 4px;
    color: var(--ink-faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
  }
  .menu-drawer__row {
    border-radius: 6px;
    border: 1px solid #EBE9E1;
    background: #FFF;
    overflow: hidden;
  }
  .menu-drawer__row > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    gap: 8px;
  }
  .menu-drawer__row > summary::-webkit-details-marker { display: none; }
  .menu-drawer__row-name { color: var(--ink-muted); font-size: 12px; }
  .menu-drawer__row-r { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .menu-drawer__row-value {
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }
  .menu-drawer__chev {
    color: var(--ink-muted);
    font-size: 14px;
    transition: transform .15s ease;
  }
  .menu-drawer__row[open] > summary .menu-drawer__chev { transform: rotate(90deg); }
  .menu-drawer__sublist {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    border-top: 1px solid var(--rule-soft);
    max-height: 220px;
    overflow-y: auto;
  }
  .menu-drawer__sublist--year { display: flex; padding: 8px; gap: 6px; }
  .menu-drawer__sublist--year li { flex: 1; }
  .menu-drawer__sublist--year .menu-drawer__sub-item {
    display: block;
    padding: 8px 4px;
    text-align: center;
    border-radius: 6px;
    border: 1px solid var(--rule);
    background: #FFF;
    font-size: 13px;
    color: var(--ink-muted);
  }
  .menu-drawer__sublist--year .menu-drawer__sub-item.is-current {
    background: var(--bg-soft);
    border-color: var(--ink);
    color: var(--ink);
    font-weight: 700;
  }
  .menu-drawer__sublist--year .menu-drawer__sub-item.is-disabled {
    opacity: .45;
    color: var(--ink-faint);
    border-style: dashed;
    cursor: not-allowed;
    pointer-events: none;
  }
  .menu-drawer__sub-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: none;
    /* 让 <button> sub-item 看起来和 <a>/<span> sub-item 完全一致 */
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
  }
  .menu-drawer__sub-item:hover { background: var(--bg-hover); }
  .menu-drawer__sub-item.is-current {
    background: var(--bg-soft);
    color: var(--ink);
    font-weight: 700;
  }

  .menu-drawer__actions { margin-top: 10px; }
  .menu-drawer__btn-primary {
    width: 100%;
    padding: 14px 16px;
    background: var(--ink);
    color: #FFF;
    border: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
  }

  .menu-drawer__footer {
    padding: 20px 16px;
    background: #FAFAF7;
    border-top: 1px solid #EBE9E1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--ink-faint);
  }
  .menu-drawer__footer span:first-child { font-size: 11px; }
}

@media screen and (max-width: 480px) {
  .year-grid { grid-template-columns: 1fr; }
  .month-card { padding: 12px; }
  .topbar__brand { font-size: 14px; }
  .topbar__brand-mark { width: 28px; height: 28px; font-size: 12px; }
  .holiday-table .col-type { width: auto; }
}

/* ============================================================
   A4 Print —— A4 portrait
   ============================================================ */
@page { size: A4 portrait; margin: 8mm 9mm; }

@media print {
  body { background: #fff; color: #000; font-size: 10pt; }
  .app { max-width: none; margin: 0; box-shadow: none; border: 0; }
  .topbar, .sidebar, .page-head__actions, .m-filter, .menu-drawer, .page-footer {
    display: none !important;
  }
  .body { display: block; }
  .main { padding: 0; }

  /* page-head：紧凑 inline 标题 */
  .page-head { margin-bottom: 4mm; }
  .page-head__year { font-size: 22pt; line-height: 1; font-weight: 800; }
  .page-head__name { font-size: 11pt; }
  .page-head__count { font-size: 9pt; }

  /* A4 portrait: 3 列 × 4 行，month-card 填满 */
  .year-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3.5mm;
  }
  .month-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #D7D5CC;
    border-radius: 3px;
    padding: 3mm 3mm 2mm;
    gap: 2mm;
  }
  .month-card__name { font-size: 12pt; font-weight: 700; }
  .month-card__badge { display: none; }

  /* mini table：撑满宽度，列均分；cell 略微放大让月历更舒展 */
  .mini { width: 100%; table-layout: fixed; }
  .mini thead th {
    font-size: 7.5pt;
    font-weight: 600;
    color: #707070;
    text-align: center;
    padding: 0.9mm 0;
    letter-spacing: 0.04em;
  }
  .mini tbody td {
    font-size: 10pt;
    color: #1a1a1a;
    text-align: center;
    padding: 0.8mm 0;
  }
  .mini tbody td.is-out { color: #C9C9C5; }
  .mini tbody td.is-out.is-weekend { color: #F0B5B5; }
  .mini__cell {
    display: inline-flex;
    width: 7mm;
    height: 7mm;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
  }
  .mini tbody td.is-holiday .mini__cell,
  .mini tbody td.is-substitute .mini__cell {
    background: #FCE8EA; color: #C8232C; font-weight: 700;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
  }
  .mini tbody td.is-streak .mini__cell {
    background: #FCE8EA; color: #C8232C; font-weight: 700;
  }

  /* 隐藏交互式 tooltip + flash 动画 */
  .mini__cell::before,
  .mini__cell::after { display: none !important; }
  .holiday-table tbody tr.is-target > td { animation: none !important; background: transparent !important; }

  /* Holiday list 表格：换页继续，header 重复 */
  .holidays {
    margin-top: 4mm;
    border: 1px solid #D7D5CC;
    box-shadow: none;
    page-break-inside: auto;
    border-radius: 3px;
  }
  .holidays__head { padding: 2mm 4mm; }
  .holidays__title { font-size: 10.5pt; font-weight: 700; margin: 0; }
  .holidays__sub { font-size: 8pt; margin: 1mm 0 0; }
  .holiday-table { width: 100%; }
  .holiday-table thead { display: table-header-group; }
  .holiday-table thead th {
    font-size: 7.5pt;
    padding: 1mm 3mm;
    background: #FAFAF7;
  }
  .holiday-table tbody td {
    font-size: 9pt;
    padding: 0.9mm 3mm;
  }
  .holiday-table .col-desc { display: table-cell !important; font-size: 8.5pt; }
  .holiday-table .badge { font-size: 7.5pt; padding: 0.4mm 1.6mm; }
  .holiday-table tr { page-break-inside: avoid; }

  a { color: inherit; text-decoration: none; }
}