/*
 * Week-calendar colour system.
 *
 * Two layers used to fight for the same hues: task chips are coloured by
 * URGENCY (red/amber/green/grey) and the energy bands behind them by ENERGY
 * STATE (green/yellow/red/slate). A red chip on a red band read as one signal.
 *
 * The split now runs by CHANNEL, not by hue:
 *   - bands own LUMINANCE — a single neutral sage wash whose alpha is an
 *     ordinal energy ramp (high > medium > low > recovery);
 *   - the state hue survives only on the band rail and the label dot;
 *   - chips own HUE — nothing behind them competes.
 */
:root {
  --wc-wash: #87a96b;
  --wc-line: 135, 169, 107;

  --wc-a-high: 20%;
  --wc-a-med: 13%;
  --wc-a-low: 8%;
  --wc-a-rec: 3.5%;

  --wc-hatch: rgba(135, 169, 107, 0.16);
  /* Near-black in light, near-white in dark: hue-independent by construction,
     so the focus ring clears 9:1 on every chip hue and every band step. */
  --wc-ring: var(--text, #1f2937);
}

[data-theme="dark"] {
  --wc-wash: #9bbd7d;
  /* Lighter sage: the same alphas over the dark board would be invisible. */
  --wc-line: 155, 189, 125;
  --wc-line-board: 0.26;
  --wc-line-strong: 0.22;
  --wc-line-soft: 0.16;
  --wc-line-hair: 0.13;

  --wc-a-high: 24%;
  --wc-a-med: 16%;
  --wc-a-low: 9.5%;
  --wc-a-rec: 4.5%;

  --wc-hatch: rgba(155, 189, 125, 0.14);
  --wc-ring: var(--text, #eef3e7);
}

.wc-page {
  padding: 5.75rem 0 3rem;
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%, rgba(135, 169, 107, 0.14), transparent 55%),
    var(--bg, #fdfcf8);
  min-height: 100vh;
  color: var(--text, #1f2a1a);
}

.wc-page-fullscreen {
  --wc-nav-h: 74px;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--wc-nav-h);
  bottom: 0;
  padding: 0;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 40;
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%, rgba(135, 169, 107, 0.14), transparent 55%),
    var(--bg, #fdfcf8);
}

.wc-page-fullscreen .wc-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: none;
  width: 100%;
  padding: 0;
  margin: 0;
}

.wc-page-fullscreen .wc-toolbar {
  position: relative;
  top: auto;
  z-index: 50;
  flex: 0 0 auto;
  flex-shrink: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  padding: 0.65rem 1rem;
  background: color-mix(in srgb, var(--bg, #fdfcf8) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(135, 169, 107, 0.22);
}

.wc-page-fullscreen .wc-session,
.wc-page-fullscreen .wc-error,
.wc-page-fullscreen .wc-loading {
  padding: 0.35rem 1rem;
  flex-shrink: 0;
}

.wc-page-fullscreen .wc-status-row {
  padding: 0.35rem 1rem;
  flex-shrink: 0;
}

.wc-page-fullscreen .wc-status-row .wc-session,
.wc-page-fullscreen .wc-status-row .wc-error {
  padding: 0;
}

.wc-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.wc-status-row .wc-error,
.wc-status-row .wc-status {
  margin-left: auto;
  text-align: right;
}

.wc-page-fullscreen .wc-workspace {
  flex: 1;
  min-height: 0;
}

.wc-page-fullscreen .wc-board {
  border-radius: 0;
  border: none;
  border-top: 1px solid rgba(var(--wc-line), var(--wc-line-strong, 0.2));
}

/* Sidebar + grid sit side by side; the grid owns the leftover width. */
.wc-workspace {
  display: flex;
  align-items: stretch;
  min-height: 0;
  gap: 0;
}

.wc-workspace .wc-board {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.wc-page-fullscreen .wc-scroll {
  flex: 1;
  max-height: none;
  min-height: 0;
}

.wc-intro {
  margin-bottom: 1.25rem;
}

.wc-shell {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wc-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(135, 169, 107, 0.25);
  position: sticky;
  top: 4.5rem;
  z-index: 20;
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .wc-toolbar {
  background: rgba(24, 28, 22, 0.88);
}

.wc-toolbar-nav,
.wc-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.wc-toolbar-nav {
  justify-self: start;
}

.wc-toolbar-actions {
  justify-self: end;
}

.wc-toolbar-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  justify-self: center;
}

.wc-filter-btn {
  position: relative;
}

.wc-filter-btn.is-active {
  background: rgba(135, 169, 107, 0.18);
  color: #3d4f32;
}

[data-theme="dark"] .wc-filter-btn.is-active {
  background: rgba(168, 197, 140, 0.22);
  color: #f0f4ec;
}

.wc-filter-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #87a96b;
  box-shadow: 0 0 0 1.5px #fff;
}

[data-theme="dark"] .wc-filter-badge {
  box-shadow: 0 0 0 1.5px #1a1a2e;
}

.wc-icon-btn {
  min-width: 2.25rem;
  padding-inline: 0.55rem;
  font-size: 1.25rem;
  line-height: 1;
}

.wc-week-label {
  font-weight: 700;
  margin-left: 0.35rem;
}

.wc-session {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-soft, #6b7280);
}

.wc-session-email {
  font-weight: 600;
}

.wc-session-sep {
  opacity: 0.5;
}

.wc-session-sync.is-busy {
  opacity: 0.7;
}

.wc-session-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #92400e;
  background: rgba(251, 191, 36, 0.22);
}

[data-theme="dark"] .wc-session-pending {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.16);
}

.wc-session .wc-link:disabled {
  opacity: 0.5;
  cursor: default;
}

.wc-link {
  background: none;
  border: none;
  color: #5b6b4a;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.wc-error {
  color: #b91c1c;
  margin: 0;
  font-size: 0.9rem;
}

.wc-status {
  color: #3f6212;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

[data-theme="dark"] .wc-status {
  color: #b7e063;
}

.wc-loading,
.wc-empty {
  color: var(--text-soft, #6b7280);
  padding: 1rem 0;
}

.wc-board {
  border-radius: 16px;
  border: 1px solid rgba(var(--wc-line), var(--wc-line-board, 0.25));
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .wc-board {
  background: rgba(20, 24, 18, 0.7);
}

.wc-dayheads {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid rgba(var(--wc-line), var(--wc-line-strong, 0.2));
  flex-shrink: 0;
}

.wc-day-head-cell {
  border-left: 1px solid rgba(var(--wc-line), var(--wc-line-soft, 0.15));
  padding: 0.45rem 0.35rem;
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  font-size: 0.75rem;
  color: var(--text-soft, #6b7280);
}

.wc-day-head-cell.is-today {
  background: color-mix(in srgb, var(--primary, #87a96b) 16%, transparent);
  box-shadow: inset 0 -2px 0 0 var(--primary, #87a96b);
  font-weight: 700;
}

.wc-day-head-cell strong {
  font-size: 0.95rem;
  color: inherit;
}

.wc-google-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.wc-google-btn {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.wc-google-btn iframe {
  margin: 0 auto !important;
}

.wc-auth-sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--text-soft, #6b7280);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wc-auth-sep::before,
.wc-auth-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(135, 169, 107, 0.35);
}

.wc-auth-sep span {
  white-space: nowrap;
}

.wc-sync-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.5rem 0 1rem;
}

.wc-sync-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-align: left;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: rgba(135, 169, 107, 0.06);
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wc-sync-option:hover:not(:disabled) {
  background: rgba(135, 169, 107, 0.14);
  border-color: rgba(135, 169, 107, 0.55);
}

.wc-sync-option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wc-sync-option strong {
  font-size: 0.95rem;
}

.wc-sync-option span {
  font-size: 0.8rem;
  line-height: 1.35;
  opacity: 0.75;
}

.wc-sync-option-both {
  border-color: rgba(255, 191, 0, 0.45);
  background: rgba(255, 191, 0, 0.08);
}

.wc-sync-option-both:hover:not(:disabled) {
  background: rgba(255, 191, 0, 0.16);
  border-color: rgba(255, 191, 0, 0.65);
}

[data-theme="dark"] .wc-sync-option {
  background: rgba(168, 197, 140, 0.08);
  border-color: rgba(168, 197, 140, 0.3);
}

.wc-origin-hint {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  opacity: 0.7;
}

.wc-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #87a96b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

/* ---------------- dump sidebar ---------------- */

.wc-sidebar {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid rgba(135, 169, 107, 0.25);
  border-top: 1px solid rgba(135, 169, 107, 0.2);
  background: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .wc-sidebar {
  background: rgba(20, 24, 18, 0.7);
}

.wc-sidebar.is-collapsed {
  flex-basis: auto;
  border-right: 1px solid rgba(135, 169, 107, 0.25);
}

.wc-sidebar.is-drop-target {
  background: rgba(135, 169, 107, 0.22);
  box-shadow: inset 0 0 0 2px rgba(135, 169, 107, 0.55);
}

.wc-sidebar-toggle {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.35rem;
  border-radius: 0;
}

.wc-sidebar-toggle-label {
  writing-mode: vertical-rl;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wc-sidebar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(135, 169, 107, 0.2);
  flex-shrink: 0;
}

.wc-sidebar-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  justify-self: start;
  min-width: 0;
}

.wc-sidebar-head-filter {
  display: flex;
  justify-self: center;
}

.wc-sidebar-head-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  justify-self: end;
}

.wc-sidebar-add-btn.btn-primary {
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  box-shadow: none;
}

.wc-sidebar-add-btn.btn-primary:hover,
.wc-sidebar-add-btn.btn-primary:active {
  transform: none;
  box-shadow: none;
}

.wc-sidebar.is-collapsed .wc-sidebar-add-btn {
  flex-shrink: 0;
  margin: 0.45rem auto 0.15rem;
}

.wc-sidebar.is-collapsed .wc-sidebar-toggle {
  height: auto;
  flex: 1;
}

.wc-sidebar-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
}

.wc-sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: stretch;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem 0.7rem 0.75rem;
  border-top: 1px solid rgba(135, 169, 107, 0.2);
  flex-shrink: 0;
}

.wc-organize-btn.btn-primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.15rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: none;
  transform: none;
}

.wc-organize-btn.btn-primary:hover,
.wc-organize-btn.btn-primary:active {
  transform: none;
  box-shadow: none;
}

.wc-organize-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wc-organize-btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wc-pro-badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  background: rgba(255, 191, 0, 0.95);
  color: #1a1a2e;
}

.wc-organize-preview {
  width: min(560px, 100%);
}

.wc-organize-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(52vh, 420px);
  overflow-y: auto;
}

.wc-organize-row {
  border: 1px solid rgba(135, 169, 107, 0.25);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .wc-organize-row {
  background: rgba(20, 24, 18, 0.55);
}

.wc-organize-row.is-skipped {
  opacity: 0.72;
}

.wc-organize-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-weight: 700;
}

.wc-organize-title {
  min-width: 0;
}

.wc-organize-reason {
  margin: 0.25rem 0 0.35rem 1.35rem;
}

.wc-organize-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
  margin-left: 1.35rem;
}

.wc-organize-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.wc-sidebar>.wc-error {
  padding: 0.4rem 0.75rem 0;
}

.wc-sidebar-empty {
  padding: 0.5rem 0;
}

.wc-sidebar-hint {
  opacity: 0.75;
}

/* Draggable dump row — same chip vocabulary as a grid event. Height is a
   fixed inline style set per-row from ENERGY_LEVEL_CHIP_HEIGHT, not content —
   a min-height gets absorbed by the row's own title+actions, so low/medium/
   high energy rows ended up reading almost the same size. flex+space-between
   pins the actions row to the bottom while the (line-clamped) title fills
   the rest; overflow:hidden keeps a long title from pushing past the fixed
   height instead of clipping cleanly. */
.wc-dump-chip {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  background: var(--wc-ev-fill, rgba(135, 169, 107, 0.12));
  color: var(--wc-ev-ink, inherit);
  border: 1px solid transparent;
  border-left: 4px solid var(--wc-ev-ink, #475569);
  box-shadow: 0 1px 3px rgba(60, 82, 48, 0.08);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

/* --wc-ev-fill is an opaque pastel — far too bright on the dark board.
   Recompose it the same way .wc-event does. */
[data-theme="dark"] .wc-dump-chip {
  background: color-mix(in srgb, var(--wc-ev-ink, #475569) 22%, var(--bg-elev, #1b2a18));
  color: color-mix(in srgb, var(--wc-ev-ink, #475569) 28%, var(--text, #eef3e7));
  border-color: transparent;
  border-left-color: var(--wc-ev-ink, #475569);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.wc-dump-chip:focus-within {
  outline: 2px solid var(--wc-ring);
  outline-offset: 2px;
}

.wc-dump-chip.is-dragging {
  opacity: 0.4;
}

.wc-dump-chip-title {
  display: -webkit-box;
  flex-shrink: 0;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.wc-dump-chip-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.6rem;
  margin-top: 0.3rem;
  font-size: 0.72rem;
}

.wc-dump-chip-actions .wc-link {
  color: inherit;
  opacity: 0.75;
}

.wc-allday {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid rgba(var(--wc-line), var(--wc-line-strong, 0.2));
  min-height: 72px;
}

.wc-gutter-label {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0.4rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-soft, #6b7280);
}

.wc-allday-cell {
  border-left: 1px solid rgba(var(--wc-line), var(--wc-line-soft, 0.15));
  padding: 0.35rem;
  min-height: 72px;
}

/*
 * Today can no longer be a sage wash: the bands are sage now, so a tint on the
 * column would stack under every band and make today read as one step higher
 * energy all day. Edge treatment is orthogonal to the wash channel.
 */
.wc-allday-cell.is-today,
.wc-day-col.is-today {
  background: none;
  box-shadow:
    inset 1px 0 0 0 color-mix(in srgb, var(--primary, #87a96b) 60%, transparent),
    inset -1px 0 0 0 color-mix(in srgb, var(--primary, #87a96b) 60%, transparent);
}

.wc-day-head {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  color: var(--text-soft, #6b7280);
}

.wc-day-head strong {
  font-size: 0.95rem;
  color: inherit;
}

.wc-allday-tasks {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.wc-chip {
  font-size: 0.7rem;
  color: #fff;
  border-radius: 6px;
  padding: 0.2rem 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
}

.wc-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  border: 1px solid rgba(135, 169, 107, 0.35);
}

.wc-back:hover {
  background: rgba(135, 169, 107, 0.12);
}

.wc-scroll {
  overflow: auto;
  max-height: min(70vh, 820px);
}

.wc-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  position: relative;
  min-width: 720px;
}

.wc-hours {
  position: relative;
}

.wc-hour {
  position: absolute;
  right: 6px;
  transform: translateY(-50%);
  font-size: 0.68rem;
  color: var(--text-soft, #6b7280);
  font-variant-numeric: tabular-nums;
}

.wc-day-col {
  position: relative;
  border-left: 1px solid rgba(var(--wc-line), var(--wc-line-soft, 0.15));
}

.wc-day-col.is-dragging-over {
  outline: 1px dashed transparent;
}

.wc-day-col.is-drop-target {
  background: rgba(135, 169, 107, 0.12);
  box-shadow: inset 0 0 0 2px rgba(135, 169, 107, 0.45);
}

/*
 * Energy Time Map heat map.
 *
 * No background wash — hue is carried only by the 4px rail and the label
 * dot, both driven by --wc-band-tone / --wc-band-ink, which WeekCalendarApp
 * sets inline per period. That keeps a user's custom per-state accent visible
 * without the band competing with the urgency hues on the chips.
 */
.wc-band {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  overflow: hidden;
  border-left: 4px solid color-mix(in srgb, var(--wc-band-tone, transparent) 90%, transparent);
}

/*
 * Empty = no task anywhere in the week for this slot, so the row is already
 * collapsed to ~31px and height is the dominant signal: no wash, a diagonal
 * hatch, dashed edges and a dimmed rail.
 */
.wc-band-empty {
  background-image: repeating-linear-gradient(135deg,
      var(--wc-hatch) 0 2px,
      transparent 2px 7px);
  border-top: 1px dashed rgba(var(--wc-line), 0.35);
  border-bottom: 1px dashed rgba(var(--wc-line), 0.2);
  border-left-color: color-mix(in srgb,
      var(--wc-band-tone, transparent) 32%,
      transparent);
}

/*
 * Renders once per band inside `.wc-hours`, not per day column — the label
 * text is identical across all seven days, so `.wc-hours` is the one place
 * it needs to exist. No vertical room is reserved for it anywhere: chips in
 * the day columns start right at the top of their band.
 *
 * Positioned at the band's vertical mid-point (not its top, where an hour
 * tick from `.wc-hour` often sits) and left-anchored, opposite the
 * right-anchored hour numbers — the empty space in the gutter, not on top
 * of either.
 */
.wc-band-label {
  position: absolute;
  left: 2px;
  max-width: 48px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem 0.35rem;
  /* Contrast is baked into --wc-band-ink by resolveEnergyStateColors(); no
     opacity here, it would silently undo that. */
  color: var(--wc-band-ink, var(--text-soft, #6b7280));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* The state's hue, restated right where the state is named. */
.wc-band-label::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wc-band-tone, currentColor);
}

.wc-band-label-empty {
  font-size: 0.55rem;
  font-weight: 600;
  opacity: 0.78;
  line-height: 1.1;
  padding: 0.12rem 0.3rem;
}

.wc-band-label-empty::before {
  width: 5px;
  height: 5px;
}

/* Same hue as the light-mode ink, lifted so it reads on a dark wash. */
[data-theme="dark"] .wc-band-label {
  color: color-mix(in srgb, var(--wc-band-ink, var(--text)) 40%, var(--text, #eef3e7));
}

[data-theme="dark"] .wc-band-empty {
  border-top-color: rgba(var(--wc-line), 0.4);
  border-bottom-color: rgba(var(--wc-line), 0.22);
}

.wc-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(var(--wc-line), var(--wc-line-hair, 0.12));
  pointer-events: none;
}

.wc-hour.is-now-hidden {
  visibility: hidden;
}

/* Current-time horizon — same idea as Google Calendar / the app bubble cloud. */
.wc-now-label {
  position: absolute;
  right: 4px;
  transform: translateY(-50%);
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  background: var(--primary, #87a96b);
  border-radius: 6px;
  padding: 1px 5px;
  z-index: 4;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  line-height: 1.35;
  white-space: nowrap;
}

.wc-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--primary, #87a96b);
  z-index: 3;
  pointer-events: none;
}

.wc-now-dot {
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary, #87a96b);
  box-shadow: 0 0 0 2px var(--bg, #fdfcf8);
}

[data-theme="dark"] .wc-now-dot {
  box-shadow: 0 0 0 2px var(--bg, #1a1a2e);
}

/*
 * Task chips match the same task's look in the sidebar dump list: opaque
 * pastel fill (`--wc-ev-fill`) + dark ink text (`--wc-ev-ink`), the same pair
 * `.wc-dump-chip` paints with (see the "same chip vocabulary" note above it).
 *
 * `left` carries extra margin beyond `right` on purpose — the thick left
 * rail (Google Calendar's colored accent stripe) needs room to read as a
 * distinct bar rather than crowding the day-column divider.
 *
 * Top/bottom/right borders are transparent and clipped out of the paint via
 * `background-clip: padding-box` — box-sizing keeps the box's outer edges
 * pinned to the real start/end time (set inline as top/height in px), while
 * the transparent border insets the visible fill so back-to-back chips get a
 * real vertical gap instead of touching edge-to-edge.
 * Like Google Calendar, we skip tracing the chip edge with a hairline border,
 * relying instead on the solid color fill, soft drop shadow, and clean 4px
 * border radius for a modern flat look. Left is the bolder category-color rail.
 */
.wc-event {
  position: absolute;
  left: 5px;
  right: 8px;
  box-sizing: border-box;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  margin: 2px 0;
  --wc-ev-bg: var(--wc-ev-tone, color-mix(in srgb, var(--wc-ev-fill, #f4f7ef) 50%, var(--wc-ev-ink, #475569) 50%));
  background-color: var(--wc-ev-bg);
  background-clip: padding-box;
  color: var(--wc-ev-tone-text, var(--wc-ev-ink, #475569));
  font-size: 0.72rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(60, 82, 48, 0.08);
  z-index: 2;
  line-height: 1.2;
  border: none;
  border-left: 4px solid var(--wc-ev-ink, #475569);
  cursor: grab;
  text-align: left;
  font: inherit;
  display: flex;
  flex-direction: column;
  /* Centred on the block axis. `safe` is load-bearing on the short Low-energy
     chip: centred content that outgrows an overflow:hidden box spills past
     BOTH ends, so a 4-line title would lose its first line off the top with no
     way to reach it. `safe` drops back to flex-start exactly in that case, and
     the unprefixed `center` above it is the fallback for engines that don't
     parse the keyword. */
  justify-content: center;
  justify-content: safe center;
  align-items: stretch;
  gap: 0.05rem;
  width: auto;
  min-height: 0;
  touch-action: none;
  user-select: none;
  transition: background-color 120ms var(--ease, ease), box-shadow 120ms var(--ease, ease);
}

.wc-event.is-compact {
  padding: 0 0.4rem;
}

[data-theme="dark"] .wc-event {
  /* --bg-elev, not --bg: the board is rgba(20,24,18,.7) over --bg, so a chip
     mixed over --bg lands at the same luminance as the mid bands. Same
     recompose `.wc-dump-chip` does — the raw --wc-ev-fill pastel is an
     opaque light color and would be far too bright on the dark board. */
  background-color: color-mix(in srgb, var(--wc-ev-ink, #475569) 22%, var(--bg-elev, #1b2a18));
  color: color-mix(in srgb, var(--wc-ev-ink, #475569) 28%, var(--text, #eef3e7));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Hover deliberately carries no transform: .wc-event is the drag handle
   (touch-action: none + pointer handlers), so a translate would hop the
   element out from under an active pointer mid-gesture. */
.wc-event:hover {
  background-color: color-mix(in srgb, var(--wc-ev-bg) 95%, white 5%);
  box-shadow: 0 3px 10px rgba(60, 82, 48, 0.18);
  z-index: 4;
}

[data-theme="dark"] .wc-event:hover {
  background-color: color-mix(in srgb, var(--wc-ev-ink, #475569) 30%, var(--bg-elev, #1b2a18));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* The --bg halo keeps the ring readable where two chips sit edge to edge. */
.wc-event:focus-visible {
  outline: 2px solid var(--wc-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--bg, #faf8f2), 0 3px 10px rgba(60, 82, 48, 0.18);
  z-index: 6;
}

[data-theme="dark"] .wc-event:focus-visible {
  box-shadow: 0 0 0 2px var(--bg, #121d11), 0 4px 14px rgba(0, 0, 0, 0.55);
}

.wc-event:active {
  cursor: grabbing;
}

.wc-event.is-dragging {
  opacity: 0.35;
  cursor: grabbing;
  z-index: 5;
  box-shadow: none;
}

.wc-drag-ghost {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  max-width: 180px;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  background-color: var(--wc-ev-fill, #f4f7ef);
  color: var(--wc-ev-ink, #475569);
  border: 1px solid transparent;
  border-left: 4px solid var(--wc-ev-ink, #475569);
  background-clip: padding-box;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Kept a small shadow for the ghost since it floats */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .wc-drag-ghost {
  background-color: color-mix(in srgb, var(--wc-ev-ink, #475569) 22%, var(--bg-elev, #1b2a18));
  color: color-mix(in srgb, var(--wc-ev-ink, #475569) 28%, var(--text, #eef3e7));
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.wc-event-time {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  opacity: 0.85;
  font-size: 0.65rem;
  line-height: 1.1;
  min-height: 0.85rem;
}

.wc-event-note {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.95;
}

.wc-event-note svg {
  display: block;
}

.wc-event-title {
  font-weight: 700;
  font-size: 0.68rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  color: color-mix(in srgb, var(--wc-ev-bg) 25%, black 75%);
}

/* Done chips deliberately drop the hue (see `.wc-event.is-done` above) — a
   darker tint of the same color here would put it right back, so fall back
   to the neutral grey `.wc-event.is-done` sets on the chip itself. */
.wc-event.is-done .wc-event-title {
  color: inherit;
}

.wc-event.is-compact .wc-event-title {
  font-size: 0.64rem;
  line-height: 1.15;
}

.wc-event-repeat {
  opacity: 0.85;
  font-weight: 400;
}

/*
 * Done: hollow, not dissolved.
 *
 * Two earlier attempts each failed for the opposite reason. `opacity: 0.55`
 * dropped the whole chip toward the band and took the text contrast with it.
 * Replacing that with a paler *tint* of the same ink fixed the contrast but
 * left the chip reading as not-done — the fill moved barely 0.10 in relative
 * luminance and the text stayed the urgency hue at the same ratio (doNow went
 * 5.90:1 → 6.01:1), so a finished task still shouted "urgent red".
 *
 * What actually separates the two states is dropping the HUE, not the
 * lightness. A transparent fill lets the energy band show straight through so
 * the chip melts into the board, while text and border stay fully opaque — the
 * "melt into the band" effect of opacity without its contrast cost. The text
 * then goes flat neutral, so a done chip no longer competes in the urgency
 * colour system at all. Only the left rail keeps a dimmed tint, enough to
 * still tell at a glance what the task was.
 */
.wc-event.is-done {
  opacity: 1;
  background-color: transparent;
  /* Neutral slate, no hue. 4.80:1 over the darkest (high-energy) band and
     5.65:1 over bare --bg, so it clears AA everywhere a chip can land. */
  color: #5b6470;
  /* Since base border is transparent, we use an inset hairline to make the 
     hollow box visible without eating into the gap. */
  border-left: 4px solid color-mix(in srgb, var(--wc-ev-ink, #475569) 45%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #5b6470 30%, transparent);
}

/* .wc-event:hover ties .is-done on specificity and loses on source order, so
   without this a finished chip would go completely dead under the pointer. */
.wc-event.is-done:hover {
  background-color: color-mix(in srgb, #5b6470 10%, var(--bg, #faf8f2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #5b6470 45%, transparent),
    0 2px 8px rgba(60, 82, 48, 0.14);
}

[data-theme="dark"] .wc-event.is-done {
  background-color: transparent;
  /* 6.06:1 over the lightest (high-energy) band, and plainly dimmer than the
     near-white text a pending chip carries in dark mode. */
  color: var(--text-soft, #b6c7a6);
  border-left-color: color-mix(in srgb, var(--wc-ev-ink, #475569) 60%, transparent);
  box-shadow: inset 0 0 0 1px rgba(238, 243, 231, 0.07);
}

[data-theme="dark"] .wc-event.is-done:hover {
  background-color: color-mix(in srgb, var(--text-soft, #b6c7a6) 12%, var(--bg-elev, #1b2a18));
  box-shadow: inset 0 0 0 1px rgba(238, 243, 231, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.wc-event.is-done .wc-event-title {
  text-decoration: line-through;
}

/* A tick carries the state without spending colour, so it survives greyscale,
   colour blindness and the 24px-tall compact chip alike. `inline-block` is
   load-bearing: text-decoration propagates into pseudo-elements and cannot be
   switched off from inside, so a plain inline ::before would come out struck
   through along with the title. */
.wc-event.is-done .wc-event-title::before {
  content: "✓";
  display: inline-block;
  margin-right: 0.25rem;
  font-weight: 700;
}

/*
 * Repeating occurrences can't be dragged — the API has no per-day move — so the
 * cursor stops promising a grab. They used to also carry a dashed left rail
 * (a segmented background-image, with border-left-color forced transparent to
 * make room for it); the `↻` glyph in the title already says "recurring", so
 * the rail was dropped and the solid urgency edge every other chip has is back.
 */
.wc-event.is-repeating {
  cursor: pointer;
}

.wc-event.is-repeating:active {
  cursor: pointer;
}

.wc-convert {
  margin-top: 0.5rem;
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(135, 169, 107, 0.18), rgba(255, 191, 0, 0.12));
  border: 1px solid rgba(135, 169, 107, 0.28);
}

.wc-convert p {
  margin: 0 0 0.85rem;
  font-weight: 600;
}

/* Modals */
.wc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 18, 0.45);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.wc-modal {
  width: min(440px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--bg, #fdfcf8);
  color: var(--text, #1f2a1a);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .wc-modal {
  background: #1a1f18;
}

.wc-modal-wide {
  width: min(520px, 100%);
}

.wc-modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.wc-modal-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

.wc-modal-heading h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.wc-emoji-picker {
  position: relative;
  flex-shrink: 0;
}

.wc-emoji-trigger {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1px solid rgba(135, 169, 107, 0.4);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-soft, #6b7280);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.wc-emoji-trigger.has-emoji {
  background: rgba(135, 169, 107, 0.14);
  color: inherit;
}

.wc-emoji-trigger:hover,
.wc-emoji-trigger[aria-expanded="true"] {
  border-color: #87a96b;
}

[data-theme="dark"] .wc-emoji-trigger {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(168, 197, 140, 0.35);
}

.wc-emoji-menu {
  display: grid;
  grid-template-columns: repeat(8, 1.85rem);
  gap: 0.2rem;
  padding: 0.45rem;
  z-index: 95;
}

.wc-emoji-menu>li {
  display: contents;
}

.wc-emoji-cell {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wc-emoji-cell:hover,
.wc-emoji-cell.is-active {
  background: rgba(135, 169, 107, 0.18);
}

.wc-emoji-clear {
  color: var(--text-soft, #6b7280);
  font-size: 1.1rem;
  font-weight: 700;
}

.wc-modal-sub,
.wc-hint {
  margin: 0 0 1rem;
  color: var(--text-soft, #6b7280);
  font-size: 0.9rem;
  line-height: 1.45;
}

.wc-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wc-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.wc-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.wc-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: rgba(255, 255, 255, 0.6);
  color: inherit;
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wc-pill.is-active {
  background: #87a96b;
  border-color: #87a96b;
  color: #fff;
}

.wc-energy-pills {
  flex-wrap: nowrap;
}

.wc-energy-pill-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

[data-theme="dark"] .wc-pill {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(168, 197, 140, 0.3);
}

[data-theme="dark"] .wc-pill.is-active {
  background: #87a96b;
  border-color: #87a96b;
  color: #fff;
}

.wc-day-pill {
  min-width: 2.4rem;
  text-align: center;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
}

.wc-time-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wc-time-24 {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.wc-time-24 select {
  flex: 1;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.wc-time-24-sep {
  font-weight: 700;
  opacity: 0.7;
}

.wc-form input,
.wc-form select,
.wc-form textarea {
  font: inherit;
  font-weight: 500;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: rgba(255, 255, 255, 0.8);
  color: inherit;
}

[data-theme="dark"] .wc-form input,
[data-theme="dark"] .wc-form select,
[data-theme="dark"] .wc-form textarea {
  background: rgba(0, 0, 0, 0.25);
}

/* Looks like a one-line text input but grows downward as content wraps
   past the first line, instead of scrolling internally. */
.wc-title-input {
  font: inherit;
  font-weight: 500;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: rgba(255, 255, 255, 0.8);
  color: inherit;
  resize: none;
  overflow: hidden;
  min-height: 2.5rem;
  line-height: 1.35;
}

[data-theme="dark"] .wc-title-input {
  background: rgba(0, 0, 0, 0.25);
}

.wc-notes-input {
  min-height: 4.5rem;
}

.wc-add-note {
  align-self: flex-start;
  width: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.wc-add-note:hover,
.wc-add-note:focus-visible {
  color: #3f6212;
}

.wc-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
  font-weight: 500 !important;
}

.wc-modal-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.wc-modal-actions .btn {
  flex: 0 1 auto;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.wc-modal-actions a.btn {
  text-decoration: none;
  box-sizing: border-box;
}

.wc-modal-confirm {
  width: min(420px, 100%);
}

.btn-danger {
  background: #b91c1c;
  border: 1px solid #b91c1c;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #991b1b;
  border-color: #991b1b;
}

.wc-delete-btn {
  color: #b91c1c;
  margin-right: auto;
}

.wc-repeat-note {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-soft, #6b7280);
  background: rgba(135, 169, 107, 0.14);
}

.wc-auto-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.85rem 0 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.wc-auto-toggle input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.wc-auto-toggle>span {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.wc-auto-toggle .wc-hint {
  margin: 0;
}

.wc-auto-pill {
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #3f6212;
  background: rgba(135, 169, 107, 0.3);
}

[data-theme="dark"] .wc-auto-pill {
  color: #b7e063;
  background: rgba(135, 169, 107, 0.25);
}

/*
 * One row per Energy Time Map state: swatch + label on the left, a
 * "change color" control pinned to the right edge of the row. The picked
 * accent is browser-local only (no server field, no mobile equivalent).
 */
.wc-map-legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.wc-map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.15rem 0;
}

.wc-map-legend-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.wc-map-legend-item i,
.wc-map-row i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
}

.wc-map-legend-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}

.wc-map-legend-reset {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-soft, #6b7280);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.wc-map-legend-reset:hover:not(:disabled) {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.4);
}

.wc-map-legend-reset:disabled {
  opacity: 0.5;
  cursor: default;
}

[data-theme="dark"] .wc-map-legend-reset {
  background: rgba(20, 24, 18, 0.6);
  border-color: rgba(168, 197, 140, 0.3);
}

/*
 * The visible swatch button; the real <input type="color"> sits on top,
 * invisible, so a click opens the browser's native color picker directly
 * on the swatch. `onChange` (fires when the user confirms a color) is what
 * persists and repaints the calendar — i.e. the "apply" moment.
 */
.wc-color-swatch {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(31, 42, 26, 0.25);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  display: inline-block;
  flex-shrink: 0;
  overflow: hidden;
}

.wc-color-swatch input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  opacity: 0;
  cursor: pointer;
}

[data-theme="dark"] .wc-color-swatch {
  border-color: rgba(240, 244, 236, 0.3);
}

.wc-map-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
  max-height: 360px;
  overflow: auto;
}

.wc-map-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(135, 169, 107, 0.08);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.wc-map-row.is-selected {
  border-color: #87a96b;
  background: rgba(135, 169, 107, 0.18);
}

.wc-map-row-line {
  display: grid;
  grid-template-columns: 14px auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}

.wc-map-row-line>span:nth-child(2) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.wc-map-row select {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.2rem 0.35rem;
  border-radius: 8px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: rgba(255, 255, 255, 0.8);
  color: inherit;
  min-width: 0;
  max-width: 100%;
  justify-self: start;
}

[data-theme="dark"] .wc-map-row select {
  background: rgba(0, 0, 0, 0.25);
}

.wc-map-row-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-left: 0;
}

.wc-map-icon-btn {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft, #6b7280);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wc-map-icon-btn:hover:not(:disabled) {
  background: rgba(135, 169, 107, 0.28);
  color: inherit;
}

.wc-map-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

[data-theme="dark"] .wc-map-icon-btn {
  color: #c5d0bc;
}

.wc-map-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.wc-slot-hint {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(135, 169, 107, 0.45);
  background: rgba(135, 169, 107, 0.1);
  font-size: 0.85rem;
  line-height: 1.35;
}

.wc-slot-hint i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.wc-slot-hint strong {
  display: block;
  margin-bottom: 0.15rem;
}

.wc-slot-hint span {
  color: var(--text-soft, #6b7280);
  font-size: 0.8rem;
}

.wc-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wc-field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft, #6b7280);
}

.wc-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.wc-field-label-text {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.wc-gear-btn {
  min-width: 1.75rem;
  padding-inline: 0.4rem;
  font-size: 1rem;
}

.wc-swatch-cluster {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.wc-swatch-cluster i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
}

.wc-swatch-cluster i:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
}

.wc-slot-select {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.wc-slot-select.is-open {
  border-color: rgba(135, 169, 107, 0.7);
  box-shadow: 0 0 0 2px rgba(135, 169, 107, 0.18);
}

.wc-slot-select-text,
.wc-slot-select-placeholder {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.wc-slot-select-placeholder {
  color: var(--text-soft, #6b7280);
}

.wc-slot-caret {
  flex-shrink: 0;
  opacity: 0.55;
  font-size: 0.75rem;
}

.wc-slot-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.wc-slot-menu {
  position: fixed;
  z-index: 90;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(135, 169, 107, 0.35);
  background: #fff;
  box-shadow: 0 10px 28px rgba(31, 42, 26, 0.14);
}

.wc-slot-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.wc-slot-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wc-slot-option:hover,
.wc-slot-option.is-active {
  background: rgba(135, 169, 107, 0.12);
}

/* Non-interactive group heading inside a combined filter menu (e.g. the
   sidebar's single energy+priority dropdown). */
.wc-slot-section {
  padding: 0.5rem 0.6rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft, #6b7280);
}

.wc-slot-check {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--primary, #87a96b);
}

[data-theme="dark"] .wc-slot-select,
[data-theme="dark"] .wc-slot-menu {
  background: #1f2a1a;
  border-color: rgba(168, 197, 140, 0.28);
  color: #f0f4ec;
}

[data-theme="dark"] .wc-slot-option:hover,
[data-theme="dark"] .wc-slot-option.is-active {
  background: rgba(168, 197, 140, 0.16);
}

[data-theme="dark"] .wc-slot-section {
  color: var(--text-soft, #b6c7a6);
}

.wc-detail-list {
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wc-detail-list div {
  display: grid;
  gap: 0.2rem;
}

.wc-detail-list dt {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft, #6b7280);
}

.wc-detail-list dd {
  margin: 0;
  font-size: 0.95rem;
}

.wc-energy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.wc-energy-pill i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.wc-view-title-done {
  text-decoration: line-through;
  color: var(--text-soft, #6b7280);
}

.wc-view-notes {
  white-space: pre-wrap;
  color: var(--text-soft, #6b7280);
}

.wc-done-btn svg {
  flex-shrink: 0;
}

.wc-muted {
  color: var(--text-soft, #6b7280);
  font-size: 0.85rem;
}

.wc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Month calendar icon button — sits right after the week label. */
.wc-month-btn {
  color: var(--text-soft, #6b7280);
}

/*
 * Month/year date picker (opened from the toolbar's calendar icon). Reuses
 * the base .wc-modal shell; header switches between day/month/year levels
 * the same way most date pickers do — click the label to zoom out, arrows
 * step within the current level.
 */
.wc-modal-datepicker {
  width: min(380px, 100%);
  /* Content is compact (header + 6-row grid + actions) — size to it instead
     of inheriting .wc-modal's scrollable max-height. */
  max-height: none;
  overflow: visible;
}

.wc-datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.wc-datepicker-title {
  background: none;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  color: inherit;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  font: inherit;
}

.wc-datepicker-title:hover:not(:disabled) {
  background: rgba(135, 169, 107, 0.12);
}

.wc-datepicker-title:disabled {
  cursor: default;
}

.wc-datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft, #6b7280);
  margin-bottom: 0.35rem;
}

.wc-datepicker-grid {
  display: grid;
  gap: 0.25rem;
}

.wc-datepicker-grid-days {
  grid-template-columns: repeat(7, 1fr);
}

.wc-datepicker-grid-months,
.wc-datepicker-grid-years {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.wc-datepicker-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0.35rem 0.2rem;
  aspect-ratio: 1 / 1;
}

.wc-datepicker-cell:hover {
  background: rgba(135, 169, 107, 0.14);
}

.wc-datepicker-cell.is-outside {
  color: var(--text-soft, #6b7280);
  opacity: 0.5;
}

.wc-datepicker-cell.is-today {
  border-color: #87a96b;
}

.wc-datepicker-cell.is-selected {
  background: #87a96b;
  color: #fff;
}

.wc-datepicker-daynum {
  font-size: 0.85rem;
  font-weight: 600;
}

.wc-datepicker-count {
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.05rem 0.32rem;
  border-radius: 999px;
  background: rgba(255, 191, 0, 0.25);
  color: #92400e;
}

.wc-datepicker-cell.is-selected .wc-datepicker-count {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.wc-datepicker-cell-wide {
  aspect-ratio: auto;
  padding: 0.6rem 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

[data-theme="dark"] .wc-datepicker-cell.is-selected {
  background: #a8c58c;
  color: #14180f;
}

[data-theme="dark"] .wc-datepicker-count {
  background: rgba(251, 191, 36, 0.22);
  color: #fcd34d;
}

[data-theme="dark"] .wc-datepicker-cell.is-selected .wc-datepicker-count {
  background: rgba(20, 24, 15, 0.3);
  color: #14180f;
}

@media (max-width: 720px) {
  .wc-page-fullscreen {
    --wc-nav-h: 74px;
  }

  html.mobile-app-banner-visible .wc-page-fullscreen {
    --wc-nav-h: 138px;
  }

  .wc-toolbar {
    top: 3.75rem;
    grid-template-columns: 1fr 1fr;
  }

  .wc-toolbar-filters {
    grid-column: 1 / -1;
  }

  .wc-page-fullscreen .wc-toolbar {
    top: auto;
  }

  .wc-dayheads,
  .wc-allday {
    min-width: 720px;
  }

  .wc-board {
    overflow-x: auto;
  }

  /* No room for a permanent column — the sidebar becomes an overlay drawer
     pinned to the left edge of the workspace. */
  .wc-workspace {
    position: relative;
  }

  /* Expanded: floats over the grid. Collapsed: a thin rail that keeps its
     place in the row so it never hides the hour gutter. */
  .wc-sidebar:not(.is-collapsed) {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    flex-basis: min(78vw, 300px);
    width: min(78vw, 300px);
    box-shadow: 6px 0 18px rgba(0, 0, 0, 0.18);
  }

  .wc-sidebar.is-collapsed .wc-sidebar-toggle-label {
    display: none;
  }
}