/* Calendar surfaces follow the user's mood, including the body-portal preview. */
.tsp-calendar-redesigned, .spark-calendar-hover {
  --cal-surface:#fffdf8; --cal-subtle:#f4f2ed; --cal-ink:#28282d;
  --cal-muted:#65616b; --cal-line:#d8d3cb; --cal-today:#f4ead2;
  --cal-priority-bg:#fff6df; --cal-priority-ink:#201e1c; --cal-priority-border:#302b28;
  --cal-positive:#176747; --cal-positive-bg:#eef7f1; --cal-positive-line:#bdd8c8;
  --cal-star:#805b00; --cal-link:#665075;
}
[data-theme="focus"] .tsp-calendar-redesigned, .spark-calendar-hover[data-theme="focus"] {
  --cal-surface:#fcfcfa; --cal-subtle:#f0f1ef; --cal-today:#eeeae0;
}
[data-theme="after-hours"] .tsp-calendar-redesigned, .spark-calendar-hover[data-theme="after-hours"] {
  --cal-surface:#232832; --cal-subtle:#292f3a; --cal-ink:#edf1f6;
  --cal-muted:#bbc2cc; --cal-line:#485160; --cal-today:#36352f;
  --cal-priority-bg:#151a21; --cal-priority-ink:#f2e4bd; --cal-priority-border:#c8b889;
  --cal-positive:#8dd8b2; --cal-positive-bg:#1e3830; --cal-positive-line:#527b66;
  --cal-star:#efcc75; --cal-link:#d1bce8;
  color-scheme:dark;
}
.tsp-calendar-redesigned [data-testid="calendar-timegrid"]>div:first-child { background:var(--cal-surface)!important; }
.tsp-calendar-redesigned [data-testid^="colhead-"][aria-current="date"] { background:var(--cal-today)!important; }
.tsp-calendar-redesigned .tsp-calendar-list-toggle { color:var(--cal-muted)!important; }
.tsp-calendar-redesigned .spark-calendar-type-legend,
.tsp-calendar-redesigned .spark-calendar-type-legend small { color:var(--cal-muted)!important; }
.tsp-calendar-redesigned .spark-calendar-own { background:var(--cal-surface); border-color:var(--cal-line); border-left-color:var(--cal-priority-border); }
.tsp-calendar-redesigned .spark-calendar-own>strong { color:var(--cal-ink); }
.tsp-calendar-redesigned .spark-calendar-own>strong small { color:var(--cal-muted); }
.tsp-calendar-redesigned .spark-calendar-own button { background:var(--cal-priority-bg); color:var(--cal-priority-ink); border-color:var(--cal-priority-border); }
.tsp-calendar-redesigned .spark-calendar-own button>small { color:var(--cal-priority-ink); }
.tsp-calendar-redesigned .spark-calendar-own button:hover { background:color-mix(in srgb,var(--cal-priority-bg) 90%,var(--cal-priority-border)); }
.tsp-calendar-redesigned .spark-calendar-up-next { color:var(--cal-positive); }
.tsp-calendar-redesigned button.spark-calendar-own-event { background:var(--cal-priority-bg)!important; color:var(--cal-priority-ink)!important; border-color:var(--cal-priority-border)!important; }
.tsp-calendar-redesigned .spark-calendar-focus-summary details,
.tsp-calendar-redesigned .spark-calendar-focus-summary details button { background:var(--cal-surface); color:var(--cal-ink); border-color:var(--cal-line); }
.tsp-calendar-redesigned .spark-calendar-focus-summary :is(small,summary span:not(.spark-important-icon)) { color:var(--cal-muted); }
.tsp-calendar-redesigned .spark-calendar-focus-summary summary b { color:var(--cal-star); }
.tsp-calendar-redesigned .spark-calendar-more-tasks { color:var(--cal-link); }
.tsp-calendar-redesigned .spark-calendar-review,
.tsp-calendar-redesigned .spark-calendar-review-footer { background:var(--cal-surface); color:var(--cal-ink); border-color:var(--cal-line); }
.tsp-calendar-redesigned .spark-calendar-review-footer>small { color:var(--cal-muted); }
.tsp-calendar-redesigned .spark-calendar-review-footer button:not(.spark-calendar-call-next) { background:var(--cal-surface); color:var(--cal-ink); border-color:var(--cal-line); }
.tsp-calendar-redesigned .spark-calendar-review .appointment-text--sent { background:var(--cal-positive-bg)!important; border-color:var(--cal-positive-line)!important; }
.tsp-calendar-redesigned .spark-calendar-review .appointment-text--sent :is(strong,button) { color:var(--cal-positive)!important; }
/* White exclamation marks remain readable even at the small event-title size. */
.spark-important-icon[aria-pressed="true"],
.spark-calendar-review-heading-actions button.spark-important-icon[aria-pressed="true"],
.spark-important-icon--small { background:#b9381f; border-color:#8c2b18; color:#fff; }
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-calendar-event:not(.spark-calendar-own-event) {
  background:color-mix(in srgb,var(--cal-event-accent) 20%,var(--cal-surface))!important;
  color:var(--cal-ink)!important;
  border-color:color-mix(in srgb,var(--cal-event-accent) 65%,var(--cal-line))!important;
  border-left-color:color-mix(in srgb,var(--cal-event-accent) 70%,#fff)!important;
}
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-calendar-event[data-status="completed"]:not(.spark-calendar-own-event) {
  background:color-mix(in srgb,var(--cal-event-accent) 8%,var(--cal-surface))!important;
  color:var(--cal-muted)!important;
}
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-calendar-event [aria-label="Starred for daily calls"] { color:var(--cal-star)!important; }
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-calendar-event [aria-label="Sold appointment"] { color:var(--cal-positive)!important; }
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-calendar-event[data-sold="true"] { box-shadow:inset 0 0 0 1px var(--cal-positive)!important; }
[data-theme="after-hours"] .tsp-calendar-redesigned .tsp-calendar-day-list { background:var(--cal-surface)!important; color:var(--cal-ink); border-color:var(--cal-line)!important; }
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-calendar-review .appointment-text:not(.appointment-text--sent) { background:#342e23; color:var(--cal-ink); border-color:#a38850; }
[data-theme="after-hours"] .tsp-calendar-redesigned .appointment-text__hint { color:#d5c8ae; }
[data-theme="after-hours"] .tsp-calendar-redesigned .appointment-text__confirm { background:var(--cal-positive-bg); color:var(--cal-positive); border-color:var(--cal-positive-line); }
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-star-icon,
.spark-calendar-hover[data-theme="after-hours"] .spark-star-icon { background:#373022; color:#efcc75; border-color:#b69b58; }
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-star-icon[aria-pressed="true"],
.spark-calendar-hover[data-theme="after-hours"] .spark-star-icon[aria-pressed="true"] { background:#efcc75; color:#34291a; }
[data-theme="after-hours"] .tsp-calendar-redesigned .spark-important-icon[aria-pressed="false"],
.spark-calendar-hover[data-theme="after-hours"] .spark-important-icon[aria-pressed="false"] { background:#442b27; color:#ffb79f; border-color:#df927b; }
/* Legacy inline grid tokens need the same dark foreground and background pair. */
[data-theme="after-hours"] .tsp-calendar-redesigned {
  --workspace-ivory:#191e27; --workspace-card:#232832; --workspace-charcoal:#edf1f6;
  --workspace-muted:#bbc2cc; --workspace-muted2:#bbc2cc; --workspace-outline:#485160;
  --workspace-whisper:#39414e; --workspace-subtle:#292f3a; --workspace-selected:#32435d;
  --workspace-controlBorder:#8290a2; --background:220 23% 10%; --foreground:210 21% 95%;
  --card:216 20% 15%; --card-foreground:210 21% 95%; --muted:215 19% 18%;
  --muted-foreground:215 14% 74%; --border:215 16% 35%; --primary:230 100% 78%;
  --primary-foreground:220 23% 10%; background:var(--spark-canvas,#141820); color:var(--cal-ink);
}
[data-theme="after-hours"] .tsp-calendar-redesigned [data-testid="open-full"] { background:var(--cal-subtle)!important; color:var(--cal-ink)!important; border-color:var(--cal-line)!important; }
[data-theme="after-hours"] .tsp-calendar-redesigned [data-testid="appointment-sold"] { background:var(--cal-positive-bg)!important; color:var(--cal-positive)!important; border-color:var(--cal-positive-line)!important; }

[data-theme="after-hours"] .tsp-calendar-redesigned [data-testid="cancel-appointment"],
[data-theme="after-hours"] .tsp-calendar-redesigned [data-testid="cancel-appointment-go"] { color:#ffb4a2!important; border-color:#cc8e7d!important; background:#352a2c!important; }
[data-theme="after-hours"] .tsp-calendar-redesigned [data-testid="cancel-appointment-confirm"] { color:var(--cal-ink); }
[data-theme="after-hours"] .tsp-calendar-redesigned .calendar-call-choice { background:var(--cal-surface); color:var(--cal-ink); border-color:var(--cal-line); }
[data-theme="after-hours"] .tsp-calendar-redesigned .calendar-call-options>a,
[data-theme="after-hours"] .tsp-calendar-redesigned .calendar-call-options>.contact-application-launch>button { background:var(--cal-subtle); color:var(--cal-ink); border-color:var(--cal-line); border-top-color:#b69b58; }
.tsp-calendar-redesigned .spark-calendar-focus-summary summary b.spark-important-icon { color:#fff; }
.tsp-calendar-redesigned .spark-calendar-event [aria-label="Starred for daily calls"] { color:var(--cal-star)!important; }
.spark-calendar-amount { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:8px; margin-bottom:5px; }
.spark-calendar-amount>strong { background:var(--cal-subtle); color:var(--cal-ink); border:1px solid var(--cal-line); border-radius:5px; padding:1px 5px; white-space:nowrap; font-size:12px; }
