
/* The bottom padding is the dots' lane, on every day so that a row's numbers line up. */
.day-cell {
  min-width: 0;
  min-height: 0;
  padding: 0 0 4px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  position: relative;
  font-size: 13.5px;
  line-height: 1;
  font-weight: 850;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.day-cell:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb),0.28);
  background: rgba(var(--accent-rgb),0.055);
}

.day-cell.empty { opacity: 0; pointer-events: none; }
.day-cell.today { color: var(--green); border-color: rgba(var(--accent-rgb),0.32); }
.day-cell.selected { background: rgba(var(--accent-rgb),0.16); border-color: rgba(var(--accent-rgb),0.56); color: var(--text); }

/* The dots under a day: one per calendar colour that day, at most three, side by
   side and centred. --dot is the calendar's colour; with none (a local event) the
   dot keeps the accent it always had, and its glow follows whichever it is. */
.day-dots {
  position: absolute;
  left: 50%;
  bottom: 2px;
  display: flex;
  gap: 3px;
  transform: translateX(-50%);
  pointer-events: none;
}
.day-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dot, var(--green));
  box-shadow: 0 0 10px color-mix(in srgb, var(--dot, var(--accent)) 55%, transparent);
}

.upcoming-block {
  min-height: 0;
  padding: 8px 9px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}

.upcoming-title {
  color: var(--muted-text);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* The minimum here is the width of a whole ITEM, not of the name inside it, and
   that distinction is the bug it used to have. An item spends ~70px on its dot,
   its two gaps, its padding and the time on the right, so a 130px column left the
   title about eight characters and the second column arrived as soon as the tile
   passed ~265px. On a Xeneon Edge — wide, short, every tile narrow — that read as
   two columns of one word each: "FC Barcel…" beside "Levante - FC…". Reported
   with a screenshot from an Edge.

   300px is the width at which real event titles survive — measured against the
   ones in that report ("FC Barcelona - Feyenoord", "Festiwal Roślin w Poznaniu"),
   which need about 230px of name after the ~70px of furniture. So a second column
   now appears only where it reads as well as one, and a tile wide enough for two
   full titles still gets them side by side. `data-cols` is the user overriding
   the whole question from Settings → Calendar.

   `min(300px, 100%)` and not a bare 300px: a grid track never shrinks below its
   own minimum, so on a tile narrower than that the row would run past the edge
   and .upcoming-block, which hides its overflow, would simply clip the time off
   the right of every event. The min() caps the track at the width there is. */
.upcoming-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 5px;
}

/* minmax(0, …) rather than 1fr: a grid track's automatic minimum is its content,
   so a long event name would push the column wider than the tile and take the
   row with it. */
.upcoming-list[data-cols="1"] { grid-template-columns: minmax(0, 1fr); }
.upcoming-list[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.upcoming-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid rgba(255,255,255,0.05);
}

.upcoming-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--dot, var(--green));
  box-shadow: 0 0 8px color-mix(in srgb, var(--dot, var(--accent)) 50%, transparent);
}

.upcoming-name {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upcoming-when {
  color: var(--green);
  font-size: 10.5px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upcoming-list .event-empty {
  padding: 6px;
  border-radius: 9px;
  font-size: 11px;
}

/* ── Calendar / Task view toggle ────────────────────────────── */

.cal-task-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface-alt);
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 22px;
  padding: 3px;
}

.cal-task-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: none;
  border-radius: 18px;
  padding: 6px 10px;
  cursor: pointer;
  background: transparent;
  color: var(--dim-text);
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
  will-change: background, color;
}
/* `display: flex` above outranks the UA `[hidden]{display:none}` rule — without
   this an extracted Attività/Timer/Note tab stays clickable and opens an empty pane. */
.cal-task-btn[hidden] { display: none; }

.cal-task-btn svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal-task-btn.active {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  box-shadow: 0 1px 6px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ── Calendar / Task panes ──────────────────────────────────── */

.cal-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
  overflow: hidden;
}

.cal-pane[hidden] { display: none; }

/* The month keeps its height and fills what the events leave; the pane scrolls whatever
   does not fit, so no event is lost in a short tile. */
.cal-pane .calendar-card { flex: 1 0 auto; }
.cal-pane[data-calpane="calendar"] { overflow-y: auto; }
.cal-pane[data-calpane="calendar"] .upcoming-block { flex: 0 0 auto; }

/* tasks pane inherits TasksPanel.css selectors — just reset outer padding */
.cal-pane .tasks-add-row,
.cal-pane .tasks-controls-row,
.cal-pane .tasks-scroll {
  flex-shrink: 0;
}

.cal-pane .tasks-scroll {
  flex: 1;
  min-height: 0;
}

/* Standalone Calendar widget (extracted from the Agenda hub) */
.calendar-panel {
  padding: 16px;
  overflow: hidden auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* The moved .calendar-card must FILL the tile (like it does via flex:1 inside the
   hub's .cal-pane), otherwise the month grid collapses to its minimum and the
   days render tiny instead of filling the available box. */
.calendar-panel > .calendar-card { flex: 1 0 auto; }
