/* ---------- calendar toolbar ---------- */
.cal-nav { display: flex; gap: 6px; }
.cal-nav button { padding: 6px 12px; }
.cal-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.seg { display: flex; gap: 0; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.seg button.active { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }

/* ---------- month grid ---------- */
.cal-grid-wrap { overflow-x: auto; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-width: 640px;
}
.cal-dow {
  background: var(--panel);
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px;
  text-align: center;
}
.cal-cell {
  background: var(--panel);
  min-height: 104px;
  max-height: 148px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  overflow: hidden;
}
.cal-cell:hover { background: var(--panel2); }
.cal-cell.dim { opacity: 0.38; }
.cal-cell.today .cal-daynum {
  background: var(--text);
  color: var(--bg);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.cal-daynum { font-size: 13px; color: var(--dim); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-chip {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel2);
  border-left: 3px solid var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.cal-chip.kind-event { border-left-color: var(--accent); }
.cal-chip.kind-deadline { border-left-color: var(--amber); }
.cal-more { font-size: 11px; color: var(--dim); cursor: pointer; padding: 1px 6px; }
.cal-more:hover { color: var(--accent); }
.cal-cell.drop-hint { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- year view ---------- */
.cal-year {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.mini-month {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}
.mini-month:hover { border-color: var(--dim); }
.mini-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.mini-day {
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
}
.mini-day.dim { opacity: 0.2; }
.mini-day.busy { background: var(--dim); }
.mini-day.today { background: var(--text); }
.mini-day.busy.today { background: var(--text); outline: 2px solid var(--amber); }

/* ---------- agenda (list fallback + mobile) ---------- */
#cal-agenda { display: none; margin-top: 14px; }
.cal-list .item .meta { color: var(--dim); font-size: 12px; white-space: nowrap; }
.cal-list .item button { padding: 5px 10px; font-size: 12px; }
.cal-kind-event { color: var(--accent); }
.cal-kind-deadline { color: var(--amber); }

label.check { flex-direction: row !important; align-items: center; gap: 8px !important; }
label.check input { width: auto; }

@media (max-width: 700px) {
  .cal-grid-wrap { display: none; }
  #cal-agenda { display: block; }
  .cal-title { font-size: 14px; }
}
