:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e3e6ea;
  --line-strong: #cfd4da;
  --text: #191f28;
  --text-2: #5b6472;
  --text-3: #8b94a2;
  --accent: #0f766e;
  --accent-soft: #e6f4f1;
  --accent-line: #a7d7d0;
  --warn: #b45309;
  --warn-soft: #fdf4e3;
  --danger: #be123c;
  --danger-soft: #fdeef1;
  --ok: #15803d;
  --ok-soft: #eaf6ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --radius: 8px;
  --radius-sm: 6px;
  --rail-w: 336px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #21262e;
    --line: #2c323b;
    --line-strong: #3b434f;
    --text: #e9edf3;
    --text-2: #a2acbb;
    --text-3: #78828f;
    --accent: #2dd4bf;
    --accent-soft: #12312e;
    --accent-line: #1f5f59;
    --warn: #f0b24a;
    --warn-soft: #322711;
    --danger: #fb7185;
    --danger-soft: #381a22;
    --ok: #4ade80;
    --ok-soft: #14291b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }

button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex: none; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.app {
  min-height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}
.brand__mark svg { width: 20px; height: 20px; }

.brand__text h1 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0;
}

.brand__text p {
  font-size: 12.5px;
  color: var(--text-3);
}

.topbar__actions { display: flex; align-items: center; gap: 8px; }

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
  max-width: 260px;
}
.sync-pill__text { overflow: hidden; text-overflow: ellipsis; }
.sync-pill__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.sync-pill[data-state="ok"] { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.sync-pill[data-state="ok"] .sync-pill__dot { background: var(--ok); }
.sync-pill[data-state="error"] { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.sync-pill[data-state="error"] .sync-pill__dot { background: var(--danger); }
.sync-pill[data-state="syncing"] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.sync-pill[data-state="syncing"] .sync-pill__dot {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
.sync-pill[data-state="pending"] { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.sync-pill[data-state="pending"] .sync-pill__dot { background: var(--warn); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 16px; height: 16px; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn--block { width: 100%; }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn--danger { color: var(--danger); border-color: var(--line-strong); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--surface); color: var(--text); border-color: var(--line); }
.icon-btn--close { display: none; }

:where(button, input, select, textarea, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}

/* ---------- notice ---------- */

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: var(--warn);
  font-size: 13px;
}

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.month-nav { display: flex; align-items: center; gap: 4px; }

.month-label {
  min-width: 148px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.month-label:hover { background: var(--surface); border-color: var(--line); }

.toolbar__right { display: flex; align-items: center; gap: 8px; }

.pill-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-w);
  gap: 14px;
  align-items: start;
}

/* ---------- calendar ---------- */

.calendar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.weekdays span {
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-align: right;
}
.weekdays span.is-weekend { color: color-mix(in srgb, var(--danger) 70%, var(--text-3)); }

.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(104px, 1fr);
}

.day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 8px 8px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  min-width: 0;
  transition: background .1s ease;
}
.day:nth-child(7n) { border-right: 0; }
.day:hover { background: var(--surface-2); }
.day.is-outside { background: color-mix(in srgb, var(--bg) 60%, var(--surface)); }
.day.is-outside .day__num { color: var(--text-3); }
.day.is-selected { background: var(--accent-soft); }
.day.is-selected::after {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid var(--accent);
  border-radius: 2px;
  pointer-events: none;
}

.day__top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

.day__num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 20px;
}
.day.is-today .day__num {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
  line-height: 19px;
}
.day.is-weekend .day__num { color: color-mix(in srgb, var(--danger) 65%, var(--text-2)); }
.day.is-today.is-weekend .day__num { color: #fff; }

.day__hours {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 6px;
  line-height: 16px;
  white-space: nowrap;
}
.day.is-outside .day__hours { background: transparent; }

.day__chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 1.45;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.chip__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.cat--meeting { color: #1d4ed8; background: #eef3ff; border-color: #d5e0ff; }
.cat--dev { color: #6d28d9; background: #f4f1fe; border-color: #e2dafb; }
.cat--ops { color: #a16207; background: #fdf6e6; border-color: #f6e6c0; }
.cat--doc { color: #047857; background: #ecfaf3; border-color: #cdeee0; }
.cat--other { color: #475569; background: #f2f4f7; border-color: #e1e5ea; }

@media (prefers-color-scheme: dark) {
  .cat--meeting { color: #93b4ff; background: #1b2743; border-color: #26365c; }
  .cat--dev { color: #c4b5fd; background: #241f3d; border-color: #362f5c; }
  .cat--ops { color: #f2cf7a; background: #302711; border-color: #45391a; }
  .cat--doc { color: #6ee7b7; background: #122e26; border-color: #1d4438; }
  .cat--other { color: #c3cad6; background: #262b33; border-color: #363d47; }
}

.day__more { font-size: 11px; color: var(--text-3); padding-left: 2px; }

/* ---------- rail ---------- */

.rail {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 40px);
}

.rail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.rail__title { font-size: 15px; font-weight: 650; }
.rail__meta { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

.rail__body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
}

.rail__foot { padding: 12px; border-top: 1px solid var(--line); }

.entry {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.entry.is-pending { border-style: dashed; border-color: var(--warn); }

.entry__head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.entry__title { font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.entry__body { font-size: 13px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.entry__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.entry__meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.entry__actions { display: flex; gap: 2px; }
.entry__actions .icon-btn { width: 28px; height: 28px; }
.entry__actions .icon-btn svg { width: 15px; height: 15px; }

.tag {
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}

.status { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent; }
.status--todo { color: var(--text-2); background: var(--surface); border-color: var(--line); }
.status--doing { color: #1d4ed8; background: #eef3ff; }
.status--done { color: var(--ok); background: var(--ok-soft); }
.status--blocked { color: var(--danger); background: var(--danger-soft); }
@media (prefers-color-scheme: dark) {
  .status--doing { color: #93b4ff; background: #1b2743; }
}

.empty {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 26px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  line-height: 1.7;
}

/* ---------- 本月概览 ---------- */

.stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.stats__cats { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 9px; }

.stats__bar { display: flex; gap: 3px; height: 8px; }
.stats .stats__seg { flex: 1; min-width: 6px; border-radius: 999px; background: currentColor; }

.stats__legend { display: flex; flex-wrap: wrap; gap: 5px 16px; font-size: 12px; color: var(--text-2); }
.stats__item { display: inline-flex; align-items: center; gap: 5px; }
.stats__item b { font-weight: 650; color: var(--text); }
.stats__item i { font-style: normal; color: var(--text-3); }
.stats__item--sep { padding-left: 16px; border-left: 1px solid var(--line); }
.stats .stats__dot { width: 8px; height: 8px; border-radius: 3px; background: currentColor; flex: none; }

.stats__status { display: flex; flex-wrap: wrap; gap: 6px; }
.stats__status-item {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text-2);
  background: var(--surface-2);
}
.stats__status-item b { font-weight: 700; }
.stats__status-item.is-zero { opacity: .42; }

/* ---------- 搜索 ---------- */

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 240px;
  max-width: 400px;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s ease;
}
.searchbox:focus-within { border-color: var(--accent); }
.searchbox__icon { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.searchbox input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
}
.searchbox input::placeholder { color: var(--text-3); }
.searchbox input::-webkit-search-cancel-button { display: none; }
.searchbox__clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  cursor: pointer;
}
.searchbox__clear svg { width: 13px; height: 13px; }
.searchbox__clear:hover { color: var(--text); background: var(--line); }

.results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.results__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.results__ranges { display: flex; flex-wrap: wrap; gap: 6px; }
.range-chip {
  font: inherit;
  font-size: 12px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}
.range-chip:hover { color: var(--text); border-color: var(--line-strong); }
.range-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.results__count { margin-left: auto; font-size: 12px; color: var(--text-3); }

.results__list { max-height: 380px; overflow: auto; padding: 4px 0 6px; }
.rgroup + .rgroup { border-top: 1px solid var(--line); }
.rgroup__date {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-3);
  background: var(--surface);
}
.ritem { display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px; cursor: pointer; }
.ritem:hover, .ritem:focus { background: var(--surface-2); outline: none; }
.ritem__dot { width: 8px; height: 8px; border-radius: 3px; margin-top: 5px; background: currentColor; flex: none; }
.ritem__main { flex: 1 1 auto; min-width: 0; }
.ritem__title { font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.ritem__body {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ritem__hours { font-size: 12px; color: var(--text-3); flex: none; padding-top: 2px; }
.ritem .status { flex: none; }

@media (max-width: 760px) {
  .searchbox { flex: 1 1 100%; max-width: none; }
  .results__count { margin-left: 0; }
  .results__list { max-height: 300px; }
}

/* ---------- 状态指示灯 ---------- */

.status__lamp {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 5px;
  vertical-align: middle;
}

/* ---------- 未完成待办 · 悬浮按钮 + 抽屉 ---------- */

.todo-fab {
  position: fixed;
  top: 46%;
  right: 0;
  transform: translateY(-50%);
  z-index: 58;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.todo-fab:hover { color: var(--text); }
.todo-fab svg { width: 18px; height: 18px; }
.todo-fab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.todo-fab.is-empty { opacity: .5; }
.todo-fab__count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.todo-fab.is-active .todo-fab__count { background: rgba(255, 255, 255, .25); color: #fff; }
.todo-fab.is-empty .todo-fab__count { background: var(--surface-2); color: var(--text-3); }

.todo-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 57;
  width: min(360px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px -18px rgba(16, 24, 40, .4);
  transform: translateX(102%);
  transition: transform .2s ease;
}
.todo-drawer.is-open { transform: none; }

.todo-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.todo-drawer__head h2 { font-size: 14.5px; font-weight: 650; }
.todo-drawer__n {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.todo-drawer__body { flex: 1 1 auto; overflow: auto; padding: 8px; }

.titem {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.titem + .titem { margin-top: 7px; }
.titem:hover { border-color: var(--line-strong); background: var(--surface); }
.titem__lamp {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
  background: currentColor;
}
.titem__lamp.status--todo { color: var(--text-3); background: var(--text-3); }
.titem__lamp.status--doing { color: #1d4ed8; background: #1d4ed8; }
.titem__lamp.status--done { color: var(--ok); background: var(--ok); }
.titem__lamp.status--blocked { color: var(--danger); background: var(--danger); }
@media (prefers-color-scheme: dark) {
  .titem__lamp.status--doing { color: #93b4ff; background: #93b4ff; }
}
.titem__main { flex: 1 1 auto; min-width: 0; }
.titem__title { font-size: 13px; font-weight: 600; line-height: 1.45; word-break: break-word; }
.titem__meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.titem .status { flex: none; }

.day__dots { display: none; }

@media (max-width: 900px) {
  .day__dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: auto;
    padding-top: 4px;
  }
  .day__dots .ddot {
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: currentColor;
    opacity: .9;
  }
  /* 跨天任务的点拉长成小条，连续几天看起来像"串起来" */
  .day__dots .ddot.is-task {
    width: 15px;
    border-radius: 3px;
  }
  .day__dots .ddot--more { background: var(--text-3); opacity: .5; }
}

@media (max-width: 620px) {
  .todo-fab { padding: 9px 10px 9px 12px; }
  .todo-drawer { width: min(320px, 94vw); }
}

/* ---------- 跨天任务 ---------- */


.chip__task {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  padding: 0 4px;
  margin-right: 4px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
}

.entry__task {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  margin-bottom: 2px;
}
.entry__task-sum { font-weight: 500; color: var(--text-2); }

.entry__wx { white-space: nowrap; }

/* ---------- 待办 · 任务行 ---------- */

.titem.is-open { border-color: var(--accent-line); }

.titem__chev {
  display: inline-block;
  width: 12px;
  color: var(--text-3);
  transition: transform .15s ease;
}
.titem--task.is-open .titem__chev { transform: rotate(90deg); }

.titem__days {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tday {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--text-2);
  cursor: pointer;
}
.tday:hover { background: var(--surface); color: var(--text); }
.tday__d { flex: none; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tday__t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tday__h { flex: none; color: var(--text-3); }

/* ---------- modal ---------- *//* ---------- modal ---------- *//* ---------- modal ---------- *//* ---------- modal ---------- */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(12, 16, 22, .48);
  backdrop-filter: blur(1.5px);
}

.modal__panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}
.modal__panel--sm { width: min(460px, 100%); }

.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.modal__head h3 { font-size: 15px; font-weight: 650; }

.modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px 16px;
}

.form { display: flex; flex-direction: column; gap: 13px; padding: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--narrow { max-width: 108px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.label__hint { font-weight: 400; color: var(--text-3); margin-left: 6px; font-size: 11.5px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field__help { font-size: 12px; color: var(--text-3); line-height: 1.6; }

.form__error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.modal__foot.form__foot { padding: 0; }
.form .modal__foot { padding: 2px 0 0; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 210px;
  max-width: 340px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in .16s ease-out;
}
.toast[data-kind="ok"] { border-left: 3px solid var(--ok); }
.toast[data-kind="error"] { border-left: 3px solid var(--danger); }
.toast[data-kind="info"] { border-left: 3px solid var(--accent); }
.toast svg { width: 16px; height: 16px; }
.toast[data-kind="ok"] svg { color: var(--ok); }
.toast[data-kind="error"] svg { color: var(--danger); }
.toast[data-kind="info"] svg { color: var(--accent); }

@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  :root { --rail-w: 300px; }
  .app { padding: 16px 16px 28px; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }

  .rail {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(400px, 92vw);
    max-height: none;
    z-index: 50;
    border-radius: 0;
    border-right: 0;
    transform: translateX(101%);
    transition: transform .2s ease;
  }
  .rail.is-open { transform: none; }
  .icon-btn--close { display: inline-grid; }

  .grid { grid-auto-rows: minmax(78px, 1fr); }
  .day { padding: 5px 6px 6px; }
  .day__chips { display: none; }
  .day__hours { display: none; }
  .day__count {
    display: block;
    margin-top: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
  }
}

@media (min-width: 901px) {
  .day__count { display: none; }
}

@media (max-width: 620px) {
  .app { padding: 12px 10px 24px; gap: 10px; }
  .weekdays span { padding: 7px 6px; font-size: 11px; }
  .brand__text h1 { font-size: 16px; }
  .sync-pill__text { max-width: 110px; }
  .month-label { min-width: 120px; font-size: 15px; padding: 0 4px; }
  .grid { grid-auto-rows: minmax(64px, 1fr); }
  .day__num { font-size: 12px; }
  .field-row { flex-wrap: wrap; }
  .field--narrow { max-width: none; flex: 1 1 100%; }
  .toasts { right: 10px; left: 10px; bottom: 10px; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}


/* 移动端：当日面板的遮罩层（点它关闭面板，不会穿透到底下的日历） */
.rail-backdrop { display: none; }

@media (max-width: 900px) {
  .rail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(12, 16, 22, .42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .rail-backdrop.is-open { opacity: 1; pointer-events: auto; }
}

/* 跨天任务：横贯多天的连续线（相邻格子的横条互相衔接） */
.task-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 1px;
}

.task-bars .tbar {
  display: block;
  height: 4px;
  /* 用负外边距顶到格子左右边缘，这样相邻两天能连成一条线 */
  margin-left: -8px;
  margin-right: -8px;
  background: currentColor;
  opacity: .85;
}

.task-bars .tbar--start { border-radius: 3px 0 0 3px; }
.task-bars .tbar--end { border-radius: 0 3px 3px 0; }
.task-bars .tbar--single { border-radius: 3px; }

@media (max-width: 900px) {
  .day { padding-left: 6px; padding-right: 6px; }
  .task-bars .tbar { margin-left: -6px; margin-right: -6px; height: 5px; opacity: .9; }
}

/* 跨天横条无缝相接：延续到下一天的格子去掉右边框 */
.day.cont-right { border-right-width: 0; }

/* ---------- 节假日标记 ---------- */
.day__numwrap { display: flex; align-items: center; gap: 4px; min-width: 0; }

.day__tag {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  padding: 0 4px;
  border-radius: 3px;
}
.day__tag--rest { background: var(--danger-soft); color: var(--danger); }
.day__tag--work { background: var(--warn-soft); color: var(--warn); }

.day.is-holiday { background: color-mix(in srgb, var(--danger-soft) 40%, var(--surface)); }
.day.is-holiday .day__num { color: var(--danger); font-weight: 700; }
.day.is-workday .day__num { color: var(--warn); }
.day.is-holiday.is-selected { background: var(--accent-soft); }
.day.is-outside.is-holiday { background: color-mix(in srgb, var(--danger-soft) 18%, var(--surface)); }

/* ---------- 待办抽屉遮罩 ---------- */
.todo-backdrop {
  position: fixed;
  inset: 0;
  z-index: 56;
  background: rgba(12, 16, 22, .42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.todo-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ---------- 品牌图标按钮（点击切换 工作 / 生活 日历） ---------- */
button.brand__mark {
  border: 1px solid var(--accent-line);
  cursor: pointer;
  font: inherit;
  padding: 0;
  transition: transform .12s ease, background .15s ease, color .15s ease;
}
button.brand__mark:hover { background: var(--accent); color: #fff; }
button.brand__mark:active { transform: scale(.94); }
.brand__text .brand__space { font-size: 11px; color: var(--text-3); }

/* ---------- 日历同步设置 / 勾选框 ---------- */
.settings-sep { height: 1px; background: var(--line); margin: 6px 0 2px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin: 0; }
.check span { line-height: 1.5; }

.del__text { font-size: 14px; line-height: 1.6; margin-bottom: 12px; word-break: break-word; }

/* 日历格子右上角：天气图标 + 工时 */
.day__right { display: flex; align-items: center; gap: 4px; flex: none; }
.day__wx { font-size: 12px; line-height: 1; }
.day.is-outside .day__wx { opacity: .45; }
@media (max-width: 900px) {
  .day__wx { font-size: 13px; }
}

/* ---------- 登录界面 ---------- */
.login {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}
.login__card {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 20px 18px;
}
.login__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login__mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-size: 18px;
}
.login__brand h2 { font-size: 17px; font-weight: 650; }
.login__sub { font-size: 12.5px; color: var(--text-3); margin: 4px 0 14px; line-height: 1.6; }
.login__card .field { margin-bottom: 10px; }
.login__card input { width: 100%; }
.login__err { color: var(--danger); font-size: 12.5px; margin: 2px 0 8px; }
.login__note { font-size: 11.5px; color: var(--text-3); text-align: center; margin-top: 12px; }

/* ===== 条目自定义颜色（日历只显示颜色，不显示标题）===== */
/* 群晖 Calendar 风格：彩色底 + 标题文字（文字色按亮度自动选） */
.chip--color {
  background: var(--c, #475569) !important;
  border-color: transparent !important;
  color: var(--t, #fff) !important;
  border-radius: 4px;
  box-shadow: none;
  opacity: .97;
  overflow: hidden;
}
.chip--color.is-span { opacity: .62; }
.chip--color .chip__text { font-size: 11px; font-weight: 500; }
.ddot { background: var(--c, #94a3b8) !important; }
.ddot.is-span { opacity: .5; }
.field--color input[type="color"] {
  width: 100%; height: 40px; padding: 3px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface, #fff);
}

/* ==================================================================
   群晖 Synology Calendar 风格复刻（token 实测自 192.168.50.99:5001）
   字体 Inter/Arial/微软雅黑 · 13px ｜ 文字 #414b55(100/60/40%)
   边框 #c6d4e0(90/70/40%) ｜ 主色 #057FEB (hover #006DCC)
   圆角 1/2/3/4/5px 五档
   ================================================================== */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: rgba(198, 212, 224, .9);
  --line-strong: #c6d4e0;
  --text: #414b55;
  --text-2: rgba(65, 75, 85, .6);
  --text-3: rgba(65, 75, 85, .4);
  --accent: #057FEB;
  --accent-soft: rgba(5, 127, 235, .08);
  --accent-line: rgba(5, 127, 235, .3);
  --radius: 4px;
  --radius-sm: 3px;
  --sy-green: #009E05; --sy-blue: #057FEB; --sy-orange: #F58414;
  --sy-red: #E64040; --sy-teal: #00A6A6; --sy-grey: #ADB1B5;
}
body {
  font-family: Inter, Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13px;
  color: #414b55;
}
/* 事件卡：浅色底 + 左侧 6×18 全圆角色条 + 同色系深色文字 */
.chip--color {
  background: var(--tint, rgba(5, 127, 235, .16)) !important;
  border: 1px solid transparent !important;
  color: var(--ink, #414b55) !important;
  border-radius: 4px !important;
  padding: 1px 4px !important;
  gap: 4px !important;
  min-height: 20px;
  opacity: 1;
}
.chip--color .chip__bar {
  width: 6px; height: 18px; border-radius: 1000px;
  background: var(--c, #057FEB); flex: none;
}
.chip--color .chip__text { font-size: 13px; font-weight: 700; line-height: 20px; }
.chip--color.is-span { opacity: .62; }
/* 日历网格线对齐群晖的分档边框 */
.calendar-grid, .grid { border-color: var(--line-strong) !important; }
.day { border-color: rgba(198, 212, 224, .7) !important; }
.weekday { color: rgba(65, 75, 85, .6) !important; font-size: 13px; }
.day__num { font-size: 13px; }
.day.is-today .day__num { background: #057FEB; color: #fff; border-radius: 1000px; }

/* ==================================================================
   群晖 Synology Calendar 全面复刻 · v2
   实测：按钮 32×32 全圆 fs15/600 · 日期格边框 rgba(0,0,0,.06)
        事件卡 22px 高 radius4 py1px4 13px/700 · 文字 #414b55
   ================================================================== */
:root {
  --sy-fg: #414b55;
  --sy-fg2: rgba(65, 75, 85, .6);
  --sy-fg3: rgba(65, 75, 85, .4);
  --sy-line: rgba(198, 212, 224, .9);
  --sy-line-soft: rgba(0, 0, 0, .06);
  --sy-primary: #057FEB;
  --sy-primary-hover: #006DCC;
  --sy-primary-active: #005CAD;
  --sy-r1: 1px; --sy-r2: 2px; --sy-r3: 3px; --sy-r4: 4px; --sy-r5: 5px;
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f7f9fb;
  --line: rgba(198,212,224,.9); --line-strong: #c6d4e0;
  --text: #414b55; --text-2: rgba(65,75,85,.6); --text-3: rgba(65,75,85,.4);
  --accent: #057FEB; --accent-soft: rgba(5,127,235,.08); --accent-line: rgba(5,127,235,.3);
  --radius: 4px; --radius-sm: 3px;
}

/* --- 基础排版 --- */
body { font-family: Inter, Arial, "Microsoft YaHei", "PingFang SC", sans-serif; font-size: 13px; color: #414b55; background: #fff; }

/* --- 按钮：文字按钮 4px 圆角 / 图标按钮 32px 全圆 --- */
.btn, .v-btn, button:not(.icon-btn):not(.tab) {
  font-size: 13px; font-weight: 600; border-radius: 4px;
  border: 1px solid var(--sy-line); background: #fff; color: #414b55;
  min-height: 32px; padding: 4px 12px; transition: background .15s, border-color .15s;
}
.btn:hover, button:not(.icon-btn):not(.tab):hover { border-color: var(--sy-primary); color: var(--sy-primary); background: rgba(5,127,235,.05); }
.btn.primary, .btn--primary { background: var(--sy-primary); border-color: var(--sy-primary); color: #fff; }
.btn.primary:hover { background: var(--sy-primary-hover); border-color: var(--sy-primary-hover); color: #fff; }
.icon-btn { width: 32px; height: 32px; min-width: 32px; border-radius: 1000px !important; border: 0; background: transparent; color: #2e2e2e; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(0,0,0,.05); color: #2e2e2e; }

/* --- 输入控件 --- */
input[type="text"], input[type="date"], input[type="number"], input[type="search"], input[type="password"], input[type="url"], input[type="color"], select, textarea {
  font-size: 13px; color: #414b55; border: 1px solid var(--sy-line); border-radius: 3px; background: #fff; padding: 5px 8px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sy-primary); box-shadow: 0 0 0 2px rgba(5,127,235,.14); }

/* --- 卡片 / 面板 --- */
.card, .panel, .rail, .modalbox, .todo-drawer, .results, .searchbox {
  border: 1px solid var(--sy-line); border-radius: 5px; background: #fff; box-shadow: none;
}

/* --- 顶部工具条 / 月份导航 --- */
.toolbar, header, .topbar, .brand { color: #414b55; }
.month-label { font-size: 15px; font-weight: 600; color: #414b55; }

/* --- 日历：格子用群晖的极细边框，今日用蓝色圆形高亮 --- */
.day { border: 1px solid rgba(0, 0, 0, .06) !important; border-radius: 0 !important; background: #fff; }
.day:hover { background: rgba(5, 127, 235, .04); }
.day.is-outside { background: #fafbfc; color: rgba(65,75,85,.4); }
.day.is-today .day__num { background: var(--sy-primary); color: #fff; border-radius: 1000px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.day__num { font-size: 13px; color: #414b55; }
.weekday { color: var(--sy-fg2); font-size: 13px; font-weight: 400; border-top: 1px solid rgba(0,0,0,.06); }
.day.has-task .day__num { font-weight: 700; }

/* --- 事件卡（对齐群晖 main-view-event-card） --- */
.chip--color { height: 22px; padding: 1px 4px !important; border-radius: 4px !important; gap: 4px !important; }
.chip--color .chip__bar { width: 6px; height: 18px; border-radius: 1000px; }
.chip--color .chip__text { font-size: 13px; font-weight: 700; line-height: 20px; }

/* --- 表格 --- */
table { font-size: 13px; }
th { color: var(--sy-fg2); font-weight: 600; border-bottom: 1px solid var(--sy-line); }
td { border-bottom: 1px solid rgba(198,212,224,.4); color: #414b55; }

/* --- 弹窗 --- */
.modalhead { border-bottom: 1px solid var(--sy-line); font-size: 15px; font-weight: 600; }
.modal { background: rgba(20, 24, 30, .4); }

/* --- 滚动条 --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(198,212,224,.9); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ==================================================================
   v3 布局改造：全屏日历 + 群晖式左栏(小日历/标签) + 头像菜单
   1 格子撑满屏幕  2 顶部瘦身  3 详情面板不再横向滚动
   ================================================================== */
html, body { height: 100%; }
body { overflow: hidden; }
.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; padding: 0; gap: 0; }

/* --- 2) 顶部瘦身 --- */
.topbar { flex: none; padding: 6px 12px; min-height: 44px; gap: 10px; border-bottom: 1px solid var(--sy-line); }
.brand__text h1 { font-size: 14px; }
.brand__space, #monthSummary { display: none; }
.toolbar { flex: none; padding: 4px 12px; gap: 8px; border-bottom: 1px solid var(--sy-line); }
.notice { flex: none; padding: 4px 12px; }
.stats, .results { flex: none; }

/* --- 1) 主体撑满 + 左侧栏 --- */
.layout { flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch; gap: 0; }
.sidebar { flex: none; width: 212px; border-right: 1px solid var(--sy-line); padding: 10px; overflow-y: auto; }
.sidebar__sec { margin-top: 14px; }
.sidebar__h { font-size: 12px; font-weight: 600; color: var(--sy-fg2); margin: 0 0 8px; }
.calendar { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.weekdays { flex: none; height: 26px; border-bottom: 1px solid var(--sy-line); }
.grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); }
.day { min-height: 0; min-width: 0; overflow: hidden; }

/* --- 3) 右侧详情面板：不再横向滚动 --- */
.rail { flex: none; width: 336px; overflow: hidden; min-width: 0; border-left: 1px solid var(--sy-line); }
.rail__body { min-width: 0; overflow-x: hidden; overflow-y: auto; }
.rail__body * { min-width: 0; }
.rail-span__title, .rail-item__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- 小日历（群晖风格） --- */
.mini { user-select: none; }
.mini__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mini__label { font-size: 13px; font-weight: 600; color: var(--sy-fg); }
.mini__nav { display: flex; gap: 2px; }
.mini__nav button { width: 24px; height: 24px; border-radius: 1000px; border: 0; background: transparent; color: #2e2e2e; cursor: pointer; font-size: 13px; line-height: 1; }
.mini__nav button:hover { background: rgba(0,0,0,.05); }
.mini__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini__wd { font-size: 11px; color: var(--sy-fg3); text-align: center; padding: 2px 0; }
.mini__d { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--sy-fg); border-radius: 1000px; cursor: pointer; border: 0; background: transparent; }
.mini__d:hover { background: rgba(5,127,235,.1); }
.mini__d.is-out { color: rgba(65,75,85,.3); }
.mini__d.is-today { box-shadow: inset 0 0 0 1px var(--sy-primary); color: var(--sy-primary); font-weight: 700; }
.mini__d.is-sel { background: var(--sy-primary); color: #fff; font-weight: 700; }
.mini__d.has { position: relative; }
.mini__d.has::after { content: ""; position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 1000px; background: var(--sy-primary); }

/* --- 侧栏标签 --- */
.side-tags { display: flex; flex-direction: column; gap: 6px; }
.side-tag { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--sy-fg); }
.side-tag i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.side-tag b { margin-left: auto; color: var(--sy-fg2); font-weight: 600; font-size: 12px; }

/* --- 头像菜单 --- */
.userbox { position: relative; }
.avatar { width: 32px; height: 32px; min-width: 32px; border-radius: 1000px; border: 0; background: var(--sy-primary); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.avatar:hover { background: var(--sy-primary-hover); }
.userbox__menu { position: absolute; right: 0; top: 38px; z-index: 60; width: 232px; background: #fff; border: 1px solid var(--sy-line); border-radius: 5px; box-shadow: 0 8px 26px rgba(16,24,40,.14); padding: 6px; }
.userbox__head { padding: 8px 10px 10px; border-bottom: 1px solid var(--sy-line); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.userbox__name { font-size: 13px; font-weight: 600; color: var(--sy-fg); }
.userbox__mail { font-size: 12px; color: var(--sy-fg3); overflow: hidden; text-overflow: ellipsis; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 4px; font-size: 13px; color: var(--sy-fg); cursor: pointer; }
.menu-item:hover { background: rgba(5,127,235,.08); color: var(--sy-primary); }
.menu-item--danger { color: #E64040; }
.menu-item--danger:hover { background: rgba(230,64,64,.08); color: #E64040; }
/* 原来的三个图标按钮收进头像菜单 */
#btnSync, #btnLogout, #btnSettings { display: none !important; }

/* ===== v4：群晖式单行顶栏（48px，月份导航居中）===== */
.topbar { display: flex; align-items: center; height: 48px; min-height: 48px; padding: 0 12px; position: relative; gap: 8px; }
.sy-left { display: flex; align-items: center; gap: 8px; flex: none; }
.sy-title { font-size: 14px; font-weight: 600; color: #414b55; margin: 0; }
.sy-center { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; pointer-events: none; }
.sy-center > * { pointer-events: auto; }
.sy-nav { display: flex; align-items: center; gap: 4px; height: 32px; }
.sy-nav .month-label { font-size: 15px; font-weight: 600; min-width: 116px; text-align: center; border: 0; background: transparent; border-radius: 4px; }
.sy-nav .month-label:hover { background: rgba(5,127,235,.08); }
.sy-today { height: 28px; padding: 0 10px; margin-left: 6px; border: 1px solid var(--sy-line); border-radius: 4px; background: #fff; color: #414b55; font-size: 13px; cursor: pointer; }
.sy-today:hover { border-color: var(--sy-primary); color: var(--sy-primary); }
.sy-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.sy-div { width: 1px; min-width: 1px; height: 16px; background: var(--sy-line); }
.topbar .searchbox { height: 32px; border-radius: 4px; }
.topbar .searchbox input { width: 150px; height: 30px; padding: 0 8px; border: 0; background: transparent; }
.topbar #btnNew { height: 32px; min-height: 32px; padding: 0 12px; }
.topbar .sync-pill { height: 28px; }
.topbar .avatar { width: 32px; height: 32px; }
/* 顶栏这两个隐藏项在新布局里不再需要 */
.brand__space, #monthSummary { display: none !important; }

/* ==================================================================
   v5 修正：撑满屏幕 / 侧栏间距 / 小日历更大气 / 右侧详情可收起
   ================================================================== */
/* ① 撑满屏幕：干掉原来的 max-width 与内边距 */
.app { max-width: none !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
.layout { width: 100%; gap: 0; }

/* ② 侧栏：加宽 + 留白 + 分区线，和小日历拉开距离 */
.sidebar { width: 236px; padding: 16px 16px 20px; background: #fbfcfd; border-right: 1px solid var(--sy-line); }
.sidebar__sec { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--sy-line); }
.sidebar__h { font-size: 12.5px; letter-spacing: .02em; }

/* ③ 日历区去掉卡片边框，直接铺满 */
.calendar { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: #fff; }
.weekdays { height: 28px; }

/* ④ 小日历：更大更舒展（对齐群晖的留白感） */
.mini { padding: 2px 0 4px; }
.mini__head { margin-bottom: 10px; }
.mini__label { font-size: 14px; }
.mini__grid { gap: 3px; }
.mini__wd { font-size: 11.5px; padding: 3px 0 6px; }
.mini__d { min-height: 26px; font-size: 13px; }
.mini__d.is-sel { box-shadow: 0 1px 4px rgba(5,127,235,.35); }
.mini__d.has::after { width: 4px; height: 4px; bottom: 3px; }
.side-tag { padding: 3px 0; }
.side-tag i { width: 10px; height: 10px; border-radius: 3px; }

/* ⑤ 右侧详情可收起 */
body.rail-collapsed .rail { display: none !important; }
.sy-railbtn.is-on { background: rgba(5,127,235,.1); color: var(--sy-primary); }

/* ⑥ 搬迁后的包裹层（保持水平排列） */
.sy-brandwrap { display: flex; align-items: center; gap: 8px; }
.sy-brandwrap .brand__text { display: flex; align-items: center; gap: 8px; }
.sy-actwrap { display: flex; align-items: center; gap: 8px; }

/* 窄屏：收起侧栏 */
@media (max-width: 1100px) { .sidebar { display: none !important; } }

/* ==================================================================
   v6：手机端顶栏修正（右簇 509px 放不下被换行裁掉 → 紧凑化）
   ================================================================== */
.topbar { flex-wrap: nowrap; }
.sy-right { min-width: 0; }
@media (max-width: 900px) {
  /* 左：只留图标 */
  .sy-brandwrap .brand__text { display: none !important; }
  button.brand__mark { width: 32px; height: 32px; }
  /* 中：改回流式（避免绝对定位在窄屏挤压），月份标签收窄 */
  .sy-center { position: static !important; transform: none !important; margin: 0 auto; }
  .sy-nav .month-label { min-width: 92px; font-size: 14px; padding: 0 4px; }
  .sy-today { display: none; }
  /* 右：只留最必要的 —— 新增(+) 与 头像/面板 */
  .topbar .searchbox { display: none !important; }
  .topbar .sync-pill { display: none !important; }
  .sy-div { display: none !important; }
  .topbar #btnNew { padding: 0 10px; }
  .topbar #btnNew span { display: none; }
  .sy-actwrap { gap: 4px; }
  .sy-railbtn { display: none; }
  /* 顶栏允许横向不溢出 */
  .topbar { overflow: hidden; gap: 6px; padding: 0 8px; }
}
@media (max-width: 420px) {
  .sy-nav .month-label { min-width: 76px; font-size: 13px; }
}

/* ==================================================================
   v7：左侧栏（小日历 + 标签）
   ① 修掉小日历的横向滚动条   ② 可拖拽调宽   ③ 可收起
   ==================================================================
   横向滚动条的根因（无头浏览器实测）：
   本文件后面的「群晖复刻 v2」写了一条很宽的按钮规则
     button:not(.icon-btn):not(.tab){ min-height:32px; padding:4px 12px;
                                       border:1px solid; background:#fff; border-radius:4px }
   它的特异性 (0,2,1) 盖过了 .mini__d / .mini__nav button (0,1,x)，
   于是每个日期格最小 32~40px 宽，7 格 + 间距 > 侧栏内容区(204px)，
   而 .mini__grid 的 1fr 轨道不能收缩（1fr = minmax(auto,1fr)）→ 溢出 → 横向滚动条。
   顺带把被这条规则吃掉的群晖样式（透明底 / 圆形 / 选中高亮 / 悬停）按更高特异性还回来。 */

/* ① 轨道允许收缩；格子不再有最小宽度与内边距 */
.sidebar { overflow-x: hidden; }
.sidebar .mini__grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.sidebar .mini__wd, .sidebar .side-tag { min-width: 0; }
.sidebar .side-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 日期格：还原圆形透明样式（(0,3,1) > 那条按钮规则的 (0,2,1)） */
.sidebar .mini__grid button.mini__d {
  min-width: 0; min-height: 0; width: 100%; padding: 0;
  border: 0; background: transparent; border-radius: 1000px;
  font-size: 13px; font-weight: 400; color: var(--sy-fg);
  transition: background .12s, color .12s;
}
.sidebar .mini__grid button.mini__d:hover { background: rgba(5,127,235,.12); color: var(--sy-fg); }
.sidebar .mini__grid button.mini__d.is-out { color: rgba(65,75,85,.3); }
.sidebar .mini__grid button.mini__d.is-today { color: var(--sy-primary); font-weight: 700; box-shadow: inset 0 0 0 1px var(--sy-primary); }
.sidebar .mini__grid button.mini__d.is-sel { background: var(--sy-primary); color: #fff; font-weight: 700; }
.sidebar .mini__grid button.mini__d.is-sel:hover { background: var(--sy-primary-hover); color: #fff; }

/* 小日历的 ‹ › 导航按钮：同样别被那条按钮规则带偏 */
.sidebar .mini__head .mini__nav button { min-width: 0; min-height: 0; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; border-radius: 1000px; color: var(--sy-fg); font-size: 13px; font-weight: 400; line-height: 1; }
.sidebar .mini__head .mini__nav button:hover { background: rgba(0,0,0,.05); color: var(--sy-fg); }

/* ② 拖拽手柄：位于侧栏与日历之间（拖动改宽度 · 单击/双击＝收起/展开） */
.sidebar-resizer { flex: none; width: 7px; align-self: stretch; cursor: col-resize; position: relative; touch-action: none; }
.sidebar-resizer::before { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: var(--sy-line); }
.sidebar-resizer::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 3px; height: 34px; border-radius: 1000px; background: transparent; transition: background .15s; }
.sidebar-resizer:hover::after, .sidebar-resizer.is-drag::after { background: var(--sy-primary); opacity: .6; }
.sidebar-resizer:hover::before, .sidebar-resizer.is-drag::before { background: var(--sy-primary); }
body.is-resizing { cursor: col-resize; }
body.is-resizing .app * { user-select: none !important; }

/* ③ 收起左侧栏 */
body.sidebar-collapsed .sidebar { display: none !important; }
.sy-sidebtn.is-on { background: rgba(5,127,235,.1); color: var(--sy-primary); }

/* ④ 窄屏（<1100px 侧栏本来就隐藏）：手柄与开关一起隐藏 */
@media (max-width: 1100px) {
  .sidebar-resizer { display: none !important; }
  .sy-sidebtn { display: none !important; }
}
