/* ==========================================================================
   JORIE DAILY — work-schedule.css · Phase 43 · Smart Work Schedule ♡
   Additive styles only. Reuses the design system: .confirm / .sheet dialogs,
   .entry-type--tabs segmented control, .plan-btn, .tl-chip, .workday lines
   and the Calendar's masked-icon marks. Nothing existing is restyled.
   ========================================================================== */

/* ---------- Today timeline: the work entry ------------------------------ */
.tl-item[data-source="work"] > .tl-body { background: color-mix(in srgb, var(--tint-bg, var(--surface)) 38%, var(--tl-surface, var(--surface))); }
.tl-item[data-source="work"] > .tl-rail .tl-node { border-style: solid; }
.tl-item[data-source="work"][data-state="current"] > .tl-rail .tl-node { box-shadow: 0 0 0 4px rgb(var(--pink-rgb) / 0.35); }
/* Day Off ♡ is light and quiet: a dashed card, no time range. */
.tl-item[data-source="work"].is-dayoff:not(.tl-group):not(.tl-now):not(.tl-gap) > .tl-body { border-style: dashed; background: transparent; }

.tl-workbar { padding: 0 10px 12px 16px; margin-top: -6px; display: flex; flex-wrap: wrap; gap: 8px; }
.tl-workedit {
  position: relative;
  min-height: 32px; padding: 0 12px;
  font-size: var(--fs-xs); font-weight: 600;
}
.tl-workedit::after { content: ""; position: absolute; inset: -6px -2px; }          /* ≥ 44 px tap target */
.tl-workedit .icon { width: 13px; height: 13px; }
.tl-workedit:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Notes under the timeline (no work · trip day · loading) */
.ws-note .ws-note__body { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
/* Phase 44.7: a note with a button ("No work scheduled." · Add work hours): the
   icon and the text share the button's 30 px line, so all three are centred on
   one axis — also when the button wraps below on a narrow screen. */
.ws-note:has(.plan-btn) > span:first-child { height: 30px; align-items: center; }
.ws-note:has(.plan-btn) > span:first-child .icon { margin-top: 0; }
.ws-note:has(.plan-btn) .ws-note__body > span { display: inline-flex; align-items: center; min-height: 30px; }
.ws-note .plan-btn { min-height: 30px; padding: 0 12px; font-size: var(--fs-xs); }

/* ---------- Suggestion cards (public holiday, cancelled trip) ------------ */
.ws-holiday {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 44px 14px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: color-mix(in srgb, rgb(var(--pink-rgb)) 14%, var(--surface));
  color: var(--ink);
  animation: wsIn var(--dur-3, 320ms) var(--ease-out, ease-out) both;
}
:root[data-theme="dark"] .ws-holiday { background: rgb(var(--pink-rgb) / 0.08); }
.ws-holiday__icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.ws-holiday__icon .icon { width: 17px; height: 17px; }
.ws-holiday__body { min-width: 0; display: grid; gap: 4px; }
.ws-holiday__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); line-height: 1.3; }
.ws-holiday__text { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5; }
.ws-holiday__actions { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; }
.ws-holiday__actions .plan-btn { min-height: 34px; font-size: var(--fs-xs); }
.ws-holiday__x {
  position: absolute; top: 6px; right: 6px;
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer;
}
.ws-holiday__x:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ws-holiday__x:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.ws-holiday__x .icon { width: 16px; height: 16px; }
.ws-cancelled { padding-right: 14px; }
@keyframes wsIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Edit Workday dialog ----------------------------------------- */
.ws-dialog__normal { margin-top: 6px; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.45; }
.ws-dialog .ws-seg { min-width: 0; }
.ws-hours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.ws-hours[hidden] { display: none; }
.ws-hours .input { min-height: 46px; font-variant-numeric: tabular-nums; }
.ws-hours .input[aria-invalid="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ws-offnote { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgb(var(--pink-rgb) / 0.22); font-size: var(--fs-sm); color: var(--ink); line-height: 1.5; }
:root[data-theme="dark"] .ws-offnote { background: rgb(var(--pink-rgb) / 0.1); }
.ws-offnote[hidden] { display: none; }
.ws-offnote .icon { width: 15px; height: 15px; margin-top: 2px; flex: none; }
.ws-error { font-size: var(--fs-sm); font-weight: 600; color: var(--ds-attn, var(--ink)); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ws-error:empty { display: none; }
.ws-error__btn { min-height: 30px; font-size: var(--fs-xs); }
.ws-restore { padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--ink); display: grid; gap: 10px; }
.ws-restore[hidden] { display: none; }
.ws-restore__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ws-restore__btn { font-size: var(--fs-xs); min-height: 36px; }
.ws-restore__btn[hidden] { display: none; }
.ws-restore__btn .icon { width: 13px; height: 13px; }
.ws-dialog[aria-busy="true"] .sheet__inner { cursor: progress; }
@media (max-width: 560px) {
  .ws-dialog .sheet__actions { justify-content: flex-end; }
  .ws-dialog .ws-restore__btn { flex: 1 0 100%; justify-content: flex-start; }
}

/* ---------- Calendar ---------------------------------------------------- */
.ws-slot[hidden] { display: none; }
.details .ws-slot:not(:empty) { margin-bottom: 14px; }
.ws-cal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 4px; }
.ws-cal .workday { margin: 0; flex: 1 1 auto; min-width: 0; }
.ws-cal__line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ws-cal__line > span:first-child { display: inline-flex; }
.ws-cal__quiet { color: var(--ink-2); font-size: var(--fs-sm); }
.ws-cal__edit { min-height: 34px; font-size: var(--fs-xs); }
.ws-cal__edit .icon { width: 13px; height: 13px; }
.ws-cal__holiday { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: var(--fs-sm); color: var(--ink-2); }
.ws-cal__holiday .plan-btn { min-height: 32px; font-size: var(--fs-xs); }
.ws-chip { white-space: nowrap; }
/* A chip that works on any surface (light pages, the dark Calendar details card). */
.ws-chip:not(.tl-chip), .ws-cal .ws-chip {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 10px;
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.04em; line-height: 1.5;
  color: inherit; background: color-mix(in srgb, currentColor 12%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
}
/* Inside the Calendar's selected-day card the controls follow the card's own colours. */
.details .ws-cal .plan-btn {
  color: inherit; background: color-mix(in srgb, currentColor 8%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
}
.details .ws-cal .plan-btn:hover:not(:disabled) { background: color-mix(in srgb, currentColor 16%, transparent); }
.details .ws-cal .plan-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.details .ws-cal__holiday { color: inherit; opacity: 0.92; }

.cal-page {
  --jd-ico-ws-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19.5s-7-4.3-7-9.4A3.9 3.9 0 0 1 12 8a3.9 3.9 0 0 1 7 2.1c0 5.1-7 9.4-7 9.4Z'/%3E%3C/svg%3E");
  --jd-ico-ws-hours: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
  --jd-ico-ws-remote: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='10.5' rx='2'/%3E%3Cpath d='M2.5 19h19'/%3E%3C/svg%3E");
}
.cal-page .mark--ws-off { --jd-ico: var(--jd-ico-ws-off); }
.cal-page .mark--ws-hours { --jd-ico: var(--jd-ico-ws-hours); }
.cal-page .mark--ws-remote { --jd-ico: var(--jd-ico-ws-remote); }

/* ---------- Plan a Trip: card + dialog ---------------------------------- */
.ws-tripcard { display: grid; gap: 12px; padding: 18px 20px; margin-top: 16px; }
.ws-tripcard[hidden] { display: none; }
.ws-tripcard > .ws-holiday { margin: -4px; }
.ws-tripcard__head { display: flex; align-items: flex-start; gap: 12px; }
.ws-tripcard__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg, 1.15rem); line-height: 1.3; }
.ws-tripcard__text { margin-top: 2px; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5; }
.ws-tripcard__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

.ws-tripdlg__quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: var(--fs-xs); color: var(--ink-2); font-weight: 600; }
.ws-tripdlg__quick .plan-btn { min-height: 32px; font-size: var(--fs-xs); }
.ws-triplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ws-triplist__month {
  position: sticky; top: -2px; z-index: 1;
  padding: 6px 0 4px; background: var(--surface);
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
}
.ws-triprow {
  display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 10px 14px; align-items: start;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color var(--dur-1, 120ms) ease, background-color var(--dur-2, 200ms) ease;
}
.ws-triprow.is-changed { border-color: var(--line-2); background: color-mix(in srgb, rgb(var(--pink-rgb)) 10%, var(--surface)); }
:root[data-theme="dark"] .ws-triprow.is-changed { background: rgb(var(--pink-rgb) / 0.06); }
.ws-triprow__day { display: grid; gap: 2px; min-width: 0; }
.ws-triprow__date { font-weight: 700; color: var(--ink); }
.ws-triprow__norm { font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.4; }
.ws-triprow .ws-chip { justify-self: start; margin-top: 4px; white-space: normal; }
.ws-triprow .ws-hours, .ws-triprow .ws-error { grid-column: 2; }
.ws-seg--row .entry-type__body { min-height: 38px; padding: 4px 8px; }
.ws-seg--row .entry-type__body strong { font-size: var(--fs-xs); white-space: normal; }
.ws-tripdlg__weekend { font-size: var(--fs-sm); color: var(--ink-2); }
.ws-tripdlg__count { font-size: var(--fs-xs); color: var(--ink-2); font-weight: 600; }
.ws-tripdlg__alert:empty { display: none; }
.ws-tripdlg__alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ws-tripdlg .sheet__actions { position: sticky; bottom: calc(-1 * clamp(22px, 4vw, 34px)); margin: 0 calc(-1 * clamp(22px, 4vw, 34px)) calc(-1 * clamp(22px, 4vw, 34px)); padding: 12px clamp(22px, 4vw, 34px); background: var(--surface); border-top: 1px solid var(--line); }
@media (max-width: 600px) {
  .ws-triprow { grid-template-columns: minmax(0, 1fr); }
  .ws-triprow .ws-hours, .ws-triprow .ws-error { grid-column: 1; }
}

/* ---------- Plan a Trip · Step 1 “My Work Arrangements” (Phase 43.1, Marjorie only) ---------- */
.ws-plan { display: grid; gap: var(--space-4, 16px); min-width: 0; }
.ws-plan__lede { margin: 0; color: var(--ink-2); line-height: 1.5; }
.ws-plan__facts { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5; }
.ws-plan__range { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.ws-plan__range > legend { padding: 0; margin-bottom: 8px; font-weight: 700; color: var(--ink); }
.ws-plan__range .input[aria-invalid="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ws-plan__rangebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ws-plan__state:empty, .ws-plan__result:empty { display: none; }
.ws-plan__result:focus { outline: none; }
.ws-plan__quick[hidden], .ws-plan__actions[hidden] { display: none; }
.ws-plan__list .ws-triplist__month { background: var(--surface); }
.ws-plan__row .ws-plan__rowmsg { grid-column: 2; margin: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.ws-plan__row .ws-plan__rowmsg:empty { display: none; }
.ws-plan__row.is-failed { border-style: dashed; border-color: var(--line-2); }
.ws-plan__row.is-failed .ws-plan__rowmsg { color: var(--ds-attn, var(--ink)); }
.ws-seg--five { flex-wrap: wrap; }
.ws-seg--five .entry-type__card { flex: 1 1 88px; }
.ws-plan__actions {
  position: sticky; bottom: 0; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 12px 0; background: var(--surface); border-top: 1px solid var(--line);
}
.ws-plan[aria-busy="true"] { cursor: progress; }
.ws-plan__skip { margin-top: calc(-1 * var(--space-2, 8px)); }
.ws-plan__datesnote { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ws-plan__datesnote .plan-btn { min-height: 32px; font-size: var(--fs-xs); }
.tp-newwork { display: grid; gap: 10px; padding: 18px 20px; margin: var(--space-4, 16px) 0; }
.tp-newwork__kicker { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tp-newwork__body { display: grid; gap: 12px; justify-items: start; min-width: 0; }
.tp-newwork__body > .ws-plan { justify-self: stretch; }
@media (max-width: 600px) {
  .ws-plan__row .ws-plan__rowmsg { grid-column: 1; }
  .ws-seg--five .entry-type__card { flex: 1 1 30%; }
  .entry-type.entry-type--tabs.ws-seg--five { flex-wrap: wrap; }
  .tp-newwork { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-holiday { animation: none; }
  .ws-triprow { transition: none; }
}
