/* =====================================================================
   设计令牌（2026-11 改版：参见 prototype/redesign-2026-11.html）
   ===================================================================== */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --border: #e8eaf2;
  --text: #191b27;
  --text-muted: #6b7280;
  --text-faint: #9aa0ad;
  --primary: #4f5bf0;
  --primary-soft: #eef0ff;

  --leave: #3b82f6;      /* 请假 */
  --leave-soft: #e8f0ff;
  --wfh: #10b981;        /* 居家办公 */
  --wfh-soft: #e2f8ef;
  --holiday: #e11d48;    /* 法定节假日 */
  --holiday-soft: #ffe9ee;
  --workday: #ea8a0c;    /* 节假日补班 */
  --workday-soft: #fff1e0;
  --intent: #0ea5e9;     /* 占位意向 */
  --intent-soft: #e6f7fe;
  --rose: #f43f5e;
  --rose-soft: #ffe9ed;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20,20,43,.05), 0 1px 3px rgba(20,20,43,.07);
  --shadow-md: 0 10px 30px -12px rgba(31,41,90,.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, #e8ebff 0%, transparent 60%),
    radial-gradient(900px 420px at -10% 110%, #e6f7fe 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* =====================================================================
   登录前遮罩（auth.js 控制）——两个页面共用
   ===================================================================== */
body.auth-pending .app-shell,
body.auth-pending .app {
  visibility: hidden;
}

.boot-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  opacity: 1;
  transition: opacity 0.25s ease;
}
.boot-loading.boot-loading-hidden {
  opacity: 0;
  pointer-events: none;
}
.boot-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: boot-spin 0.8s linear infinite;
}
.boot-text { color: var(--text-muted); font-size: 14px; }
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* =====================================================================
   顶栏（日历页 + 管理页共用）
   ===================================================================== */
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 12px; z-index: 20;
  animation: fadeDown .45s ease both;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff; display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 4px 12px -4px rgba(79,91,240,.55);
}
.brand-name { font-size: 15.5px; font-weight: 800; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.topbar-nav { display: flex; gap: 6px; margin-left: auto; }
.nav-link {
  padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  color: var(--text-muted); transition: all .15s ease;
}
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-link:hover:not(.active) { background: var(--surface-soft); color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.month-nav { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: #d9dcff; transform: translateY(-1px); }
.month-title { font-size: 16px; font-weight: 800; min-width: 110px; text-align: center; }

.btn-ghost {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  padding: 7px 14px; border-radius: 10px; font-size: 13px; transition: all .15s ease;
}
.btn-ghost:hover { color: var(--primary); border-color: #d9dcff; background: var(--primary-soft); }
.btn-subtle {
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 10px; font-size: 13px;
}
.btn-subtle:hover { background: var(--surface-soft); color: var(--text); }
.btn-primary {
  border: none; background: linear-gradient(135deg, var(--primary), #7c5cf6);
  color: #fff; padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(79,91,240,.55);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(79,91,240,.6); }
.btn-outline {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
}
.btn-outline:hover { background: var(--surface-soft); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #0ea5e9);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px;
}

/* =====================================================================
   日历页整体布局：三行网格撑满视口，桌面端不滚动（只有侧栏内部滚动）
   ===================================================================== */
.app {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr 330px;
  grid-template-areas: "top top" "cal side";
  gap: 14px;
  height: 100vh;
  padding: 14px 18px 16px;
  max-width: 1560px;
  margin: 0 auto;
}

/* ===== 日历主区 ===== */
.cal-card {
  grid-area: cal;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px 16px;
  display: flex; flex-direction: column;
  min-height: 0;
  animation: fadeUp .5s .05s ease both;
}
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface-soft);
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; transition: all .15s ease;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.active { background: #fff; color: var(--text); border-color: #c9cdff; box-shadow: var(--shadow-sm); }
.chip:hover { transform: translateY(-1px); }
.chip[data-filter="leave"]   .dot { background: var(--leave); }
.chip[data-filter="wfh"]     .dot { background: var(--wfh); }
.chip[data-filter="holiday"] .dot { background: var(--holiday); }
.chip[data-filter="workday"] .dot { background: var(--workday); }
.chip[data-filter="intent"]  .dot { background: var(--intent); }

.weekday-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  padding: 0 2px 8px;
}
.weekday-row span { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-faint); }

.cal-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 6px;
}
/* 加载失败：占满整格的错误面板，和"本月确实没有数据"的空月区分开 */
.cal-error {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 56px 16px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.cal-error-title { font-size: 15px; font-weight: 700; color: var(--text); }
.cal-error-msg { font-size: 12.5px; color: var(--text-muted); }
.cal-error .btn { margin-top: 6px; }
.day-cell {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 6px 7px; display: flex; flex-direction: column; gap: 3px;
  min-height: 0; overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  animation: popIn .35s ease both;
}
.day-cell:hover { border-color: #c9cdff; box-shadow: var(--shadow-md); transform: translateY(-2px); z-index: 2; }
.day-cell.outside { opacity: .38; }
.day-cell.outside .day-num { font-size: 11.5px; } /* "月份/日期"（如 11/29）比纯数字宽，缩小一号防挤压 */
.day-cell.weekend { background: #f6f7fd; }
.day-cell.today {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f2f3ff, #fff);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.day-head { display: flex; align-items: center; gap: 5px; }
.day-num { font-size: 14px; font-weight: 700; }
.day-num.weekend { color: var(--holiday); }
.day-cell.today .day-num { color: var(--primary); }
.today-badge {
  font-size: 10px; font-weight: 800; color: #fff;
  background: var(--primary); border-radius: 999px; padding: 1px 7px;
}
.day-flag { font-size: 12px; margin-left: auto; }
.day-events { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.pill {
  font-size: 11px; line-height: 1.45; padding: 1px 7px;
  border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: filter .12s ease, box-shadow .12s ease;
}
.pill:hover { filter: brightness(.94); box-shadow: var(--shadow-sm); }
.pill-leave   { background: var(--leave-soft);   color: #1d4ed8; }
.pill-wfh     { background: var(--wfh-soft);     color: #047857; }
.pill-holiday { background: var(--holiday-soft); color: #be123c; font-weight: 700; }
.pill-workday { background: var(--workday-soft); color: #c2410c; font-weight: 600; }
.pill-intent  { background: var(--intent-soft);  color: #0369a1; border: 1px dashed #7dd3fc; }
.pill-more { color: var(--text-faint); font-size: 10.5px; }

/* ===== 右侧栏 ===== */
.side { grid-area: side; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.side-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 13px 14px;
  animation: fadeUp .5s ease both;
}
.side-card:nth-child(1) { animation-delay: .10s; }
.side-card:nth-child(2) { animation-delay: .16s; }
.side-card h3 { font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.side-card h3 .cnt {
  margin-left: auto; font-size: 11px; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px; padding: 2px 9px;
}
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat {
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 12px;
}
.stat .v { font-size: 20px; font-weight: 800; line-height: 1.2; }
.stat .l { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.stat.leave   .v { color: var(--leave); }
.stat.holiday .v { color: var(--holiday); }
.stat.workday .v { color: var(--workday); }
.stat.intent  .v { color: var(--intent); }

.slist { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; overflow-y: auto; }
.slist li {
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.slist li:hover { background: #eef2ff; border-color: #d9dcff; box-shadow: var(--shadow-sm); }
.slist .tag { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; margin-top: 1px; }
.tag-holiday { background: var(--holiday-soft); color: #be123c; }
.tag-workday { background: var(--workday-soft); color: #c2410c; }
.tag-leave   { background: var(--leave-soft);   color: #1d4ed8; }
.tag-wfh     { background: var(--wfh-soft);     color: #047857; }
.tag-intent  { background: var(--intent-soft);  color: #0369a1; }
.slist .s-main { flex: 1; min-width: 0; }
.slist .s-title { font-weight: 700; }
.slist .s-meta { color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.slist .s-note { color: var(--text-muted); font-size: 11px; margin-top: 3px; }
.slist .cancel {
  border: none; background: none; color: var(--holiday);
  font-size: 11px; font-weight: 700; flex-shrink: 0; padding: 2px 4px;
  opacity: 0; transition: opacity .15s ease;
}
.slist li:hover .cancel { opacity: 1; }
.side-scroll { overflow-y: auto; overflow-x: hidden; min-height: 0; flex: 1; scrollbar-width: thin; }

/* =====================================================================
   日点击弹层
   ===================================================================== */
.popover {
  position: fixed; z-index: 90; min-width: 230px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 10px;
  animation: popIn .18s ease both;
}
.popover .p-head {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; font-size: 13px;
  padding: 2px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.popover .p-row { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 5px 4px; border-radius: 8px; }
.popover .p-row:hover { background: var(--surface-soft); }
.popover .p-note { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.popover .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }

/* =====================================================================
   登记占位意向弹窗 + 自定义日历范围选择器
   ===================================================================== */
.overlay {
  position: fixed; inset: 0; background: rgba(18,20,40,.42); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  width: min(420px, calc(100vw - 40px));
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 22px;
  transform: translateY(14px) scale(.97); transition: transform .22s ease;
}
.overlay.show .modal { transform: none; }
.modal h3 { font-size: 16px; font-weight: 800; }
.modal .desc { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 14px; }
.field { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.field input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; outline: none;
  background: #fff; color: var(--text); font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,91,240,.14); }
.field .hint { font-size: 11.5px; color: var(--text-faint); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.datebox {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  user-select: none;
}
.datebox:hover { border-color: #c9cdff; background: var(--surface-soft); }
.datebox.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,91,240,.14); }
.datebox .ph { color: var(--text-faint); }
.datebox .dval { font-weight: 700; }
.datebox .dval .wk { color: var(--primary); font-weight: 600; font-size: 12px; margin-left: 5px; }
.datebox svg { width: 15px; height: 15px; stroke: var(--text-faint); flex-shrink: 0; }

.daycount {
  margin-top: 12px; padding: 9px 12px;
  background: var(--primary-soft); border-radius: 10px;
  font-size: 12.5px; display: flex; align-items: center; gap: 6px;
  animation: popIn .18s ease both;
}
.daycount b { color: var(--primary); font-size: 15px; }
.daycount .wknd { color: var(--text-muted); font-size: 11.5px; }

.dcalendar {
  position: fixed; z-index: 150;
  width: 268px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 12px;
  animation: popIn .16s ease both;
}
.dc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dc-title { font-size: 13.5px; font-weight: 800; }
.dc-nav { width: 26px; height: 26px; font-size: 14px; }
.dc-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--text-faint); font-weight: 700; padding-bottom: 6px; }
.dc-week span:nth-child(1), .dc-week span:nth-child(7) { color: #f43f5e; }
.dc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dc-day {
  position: relative; height: 32px; display: grid; place-items: center;
  font-size: 12.5px; border-radius: 8px; color: var(--text);
  transition: background .1s ease, color .1s ease;
}
.dc-day:hover { background: var(--primary-soft); }
.dc-day.out { color: #cdd1dc; font-size: 11px; }
.dc-day.wknd { color: #f43f5e; }
.dc-day.today::after {
  content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px;
  border-radius: 50%; background: var(--primary);
}
.dc-day.sel { background: var(--primary); color: #fff; font-weight: 800; }
.dc-day.sel::after { background: #fff; }
.dc-day.range { background: var(--primary-soft); color: var(--primary); border-radius: 0; }
.dc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.dc-quick {
  border: none; background: var(--primary-soft); color: var(--primary);
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.dc-quick:hover { filter: brightness(.96); }
.dc-hint { font-size: 11px; color: var(--text-faint); }

/* =====================================================================
   Toast
   ===================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--text); color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 999px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   动画
   ===================================================================== */
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(12px); }  to { opacity: 1; transform: none; } }
@keyframes popIn    { from { opacity: 0; transform: scale(.94) translateY(4px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   登录提示页（auth.js 渲染）
   ===================================================================== */
.login-gate {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 70vh; text-align: center; gap: 14px;
}
.login-gate h2 { font-size: 20px; }
.login-gate p { color: var(--text-muted); max-width: 360px; }
.login-gate .btn { margin-top: 6px; }

/* =====================================================================
   管理页（保留原布局，仅跟随新主题变量）
   ===================================================================== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.content {
  flex: 1;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

.admin-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.admin-nav {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px; box-shadow: var(--shadow-sm);
  position: sticky; top: 84px;
}
.admin-nav button {
  text-align: left; border: none; background: transparent;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  transition: background .12s ease, color .12s ease;
}
.admin-nav button:hover { background: var(--surface-soft); color: var(--text); }
.admin-nav button.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.admin-section { display: none; flex-direction: column; gap: 18px; }
.admin-section.active { display: flex; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: 4px; font-size: 16px; font-weight: 700; }
.card .desc { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-size: 11.5px; letter-spacing: .02em; text-transform: uppercase;
  color: var(--text-faint); padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.link-btn { background: none; border: none; color: var(--primary); font-size: 12.5px; font-weight: 600; padding: 4px 6px; }
.link-btn.danger { color: var(--rose); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field select {
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px;
  font-size: 13.5px; background: #fff; color: var(--text); font-family: inherit;
}
.field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,91,240,.14); }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch-row .label { font-size: 13.5px; font-weight: 600; }
.switch-row .sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #e2e4ea; border: none; flex-shrink: 0; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .15s ease;
}
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(18px); }

.source-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.source-row:last-child { border-bottom: none; }
.source-main { display: flex; align-items: center; gap: 12px; }
.source-flag { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 15px; background: var(--surface-soft); }
.source-title { font-size: 13.5px; font-weight: 700; }
.source-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* =====================================================================
   响应式
   ===================================================================== */
@media (max-width: 1080px) {
  /* 窄屏放弃"不滚动"，改为上下排布，可用性优先 */
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "top" "cal" "side";
    height: auto; min-height: 100vh;
  }
  .cal-card { min-height: 70vh; }
  .side-scroll { overflow: visible; }
  .topbar { position: static; }
}
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; }
  .admin-nav button { white-space: nowrap; }
}
@media (max-width: 640px) {
  .app { padding: 10px; gap: 10px; }
  .brand-sub { display: none; }
  .topbar { flex-wrap: wrap; }
  .topbar-right { width: 100%; justify-content: flex-end; }
  .month-title { min-width: 90px; font-size: 15px; }
  .cal-grid { gap: 3px; }
  .day-cell { padding: 4px; border-radius: 9px; }
  .day-num { font-size: 12px; }
  .pill { font-size: 10px; padding: 1px 5px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .legend { display: none; }
}
