/* ============ CALENDAR ============ */
.cal-hero { margin-bottom: 20px; }
.cal-hero .hero-title { font-size: clamp(24px, 2.4vw, 28px); margin-bottom: 6px; }
.cal-hero .hero-sub { font-size: 13.5px; }

.cal-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  animation: rise-in 600ms cubic-bezier(.2,.7,.2,1) both;
  animation-delay: 80ms;
}

/* ---- Left rail ---- */
.cal-rail { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.cal-quickadd {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 6px -1px var(--primary-ring);
  transition: background 180ms;
}
.cal-quickadd:hover { background: var(--primary-dark); }
.cal-quickadd svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

.cal-rail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 12px;
}
.cal-rail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.cal-rail-title {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--t-base);
  letter-spacing: -0.01em;
}
.cal-rail-tools { display: flex; gap: 2px; }

/* Mini calendar */
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.mini-cal-wd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--t-light);
  text-align: center;
  padding: 4px 0 6px;
  letter-spacing: 0.06em;
}
.mini-cal-day {
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 11.5px;
  color: var(--t-base);
  border-radius: 7px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
  position: relative;
}
.mini-cal-day:hover { background: var(--bg-hover); }
.mini-cal-day.is-other { color: var(--t-light); }
.mini-cal-day.is-today {
  background: var(--primary); color: #fff; font-weight: 700;
}
.mini-cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--primary);
}
.mini-cal-day.is-today.has-event::after { background: #fff; }

/* My calendars */
.cal-list { display: flex; flex-direction: column; gap: 2px; }
.cal-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 140ms ease;
}
.cal-list-item:hover { background: var(--bg-hover); }
.cal-list-check {
  width: 14px; height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  position: relative;
  border: 1.5px solid currentColor;
  background: currentColor;
}
.cal-list-check::after {
  content: '';
  position: absolute;
  left: 3px; top: 0;
  width: 3px; height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.cal-list-check.is-off { background: transparent; }
.cal-list-check.is-off::after { display: none; }
.cal-list-name { font-size: 12.5px; color: var(--t-base); flex: 1; min-width: 0; }
.cal-list-item.is-off .cal-list-name { color: var(--t-light); }
.cal-list-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--t-light);
  letter-spacing: 0.04em;
}

/* Upcoming list */
.upc-list { display: flex; flex-direction: column; }
.upc-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--border-soft);
  align-items: center;
}
.upc-item:first-child { border-top: 0; padding-top: 4px; }
.upc-date {
  text-align: center;
  line-height: 1.05;
  padding: 6px 0;
  border-radius: 8px;
  background: var(--bg-muted);
}
.upc-date .day {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--t-base);
  letter-spacing: -0.022em;
}
.upc-date .mo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--t-light);
  letter-spacing: 0.08em;
  margin-top: 2px;
  display: block;
  text-transform: uppercase;
}
.upc-date.is-today { background: var(--primary-soft); }
.upc-date.is-today .day { color: var(--primary); }
.upc-date.is-today .mo { color: var(--primary); }

.upc-meta { min-width: 0; line-height: 1.35; }
.upc-title {
  font-size: 13px;
  color: var(--t-base);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upc-time {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--t-muted);
  margin-top: 3px;
}
.upc-time .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.upc-time .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--t-light);
}

/* ---- Main calendar ---- */
.cal-main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.cal-toolbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cal-month {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--t-base);
  letter-spacing: -0.022em;
  line-height: 1;
  white-space: nowrap;
}
.cal-month .yr { color: var(--t-light); font-weight: 500; margin-left: 4px; }

.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--t-muted);
  transition: background 160ms, color 160ms;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.cal-nav-btn:hover { background: var(--bg-hover); color: var(--t-base); border-color: var(--t-light); }
.cal-nav-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }
.cal-today-btn {
  padding: 0 12px; height: 30px;
  font-size: 12px; font-weight: 600;
  color: var(--t-base);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-card);
  transition: border-color 160ms, background 160ms;
}
.cal-today-btn:hover { background: var(--bg-hover); border-color: var(--t-light); }

.cal-views {
  display: flex;
  background: var(--bg-muted);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.cal-view-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--t-muted);
  border-radius: 6px;
  transition: background 160ms, color 160ms, box-shadow 160ms;
}
.cal-view-tab:hover { color: var(--t-base); }
.cal-view-tab.is-active {
  background: var(--bg-card);
  color: var(--t-base);
  box-shadow: var(--shadow-sm);
}

.cal-toolbar-right { display: flex; align-items: center; gap: 8px; }

/* Weekday header row */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.cal-weekdays > div {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--t-light);
  font-weight: 500;
  padding: 10px 12px;
  text-align: left;
}

/* Month grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(110px, 1fr);
  flex: 1;
}
.cal-cell {
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 8px 6px;
  position: relative;
  min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
  transition: background 160ms ease;
}
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-grid > .cal-cell:nth-last-child(-n+7) { border-bottom: 0; }
.cal-cell.is-other { background: var(--bg-muted); }
.cal-cell.is-other:hover { background: var(--bg-hover); }

.cal-day-num {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--t-base);
  line-height: 1;
  align-self: flex-start;
  padding: 2px 4px;
  border-radius: 6px;
  margin-bottom: 2px;
}
.cal-cell.is-other .cal-day-num { color: var(--t-light); font-weight: 500; }
.cal-cell.is-today .cal-day-num {
  background: var(--primary);
  color: #fff;
  min-width: 22px;
  text-align: center;
  padding: 4px 6px;
}
.cal-cell.is-weekend:not(.is-today):not(.is-other) .cal-day-num { color: var(--t-muted); }

.cal-chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition: filter 160ms ease, transform 140ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  border-left: 2px solid transparent;
}
.cal-chip:hover { transform: translateX(1px); }
.cal-chip-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.cal-chip-title {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip.work     { background: var(--primary-soft); color: var(--primary);  border-left-color: var(--primary); }
.cal-chip.team     { background: var(--success-soft); color: var(--success);  border-left-color: var(--success); }
.cal-chip.personal { background: var(--purple-soft);  color: var(--purple);   border-left-color: var(--purple); }
.cal-chip.travel   { background: var(--info-soft);    color: var(--info);     border-left-color: var(--info); }
.cal-chip.finance  { background: var(--warning-soft); color: var(--warning);  border-left-color: var(--warning); }
.cal-chip.birthday { background: var(--pink-soft);    color: var(--pink);     border-left-color: var(--pink); }
.cal-chip.holiday  { background: var(--orange-soft);  color: var(--orange);   border-left-color: var(--orange); }
.cal-chip.solid    { color: #fff; }
.cal-chip.solid.work     { background: var(--primary); border-left-color: var(--primary-dark); }
.cal-chip.solid.team     { background: var(--success); border-left-color: var(--success); }
.cal-chip.solid.personal { background: var(--purple);  border-left-color: var(--purple); }

.cal-chip-more {
  padding: 3px 7px;
  font-size: 10.5px;
  color: var(--t-muted);
  font-weight: 600;
  cursor: pointer;
  transition: color 160ms;
}
.cal-chip-more:hover { color: var(--primary); }

