/* Scheduler module: month > week > day > job (builds on base.css tokens). */

:root {
  --st-process: #5f3dc4; --st-process-soft: #ede8fd; --st-process-line: #cbbff5;
  --st-print: #2f49b5; --st-print-soft: #e5ebfc; --st-print-line: #b9c6f5;
  --st-coat: #0b6670; --st-coat-soft: #dcf1f3; --st-coat-line: #a9dbe1;
  --st-finish: #a8430a; --st-finish-soft: #ffe8d9; --st-finish-line: #f6c6a5;
  --st-ship: #1f6e2f; --st-ship-soft: #e3f5e7; --st-ship-line: #b4e0bd;
}
:root[data-theme="dark"], .theme-dark {
  --st-process: #b9a6ff; --st-process-soft: rgba(151, 117, 250, 0.2); --st-process-line: rgba(151, 117, 250, 0.45);
  --st-print: #a3b6ff; --st-print-soft: rgba(109, 140, 255, 0.2); --st-print-line: rgba(109, 140, 255, 0.45);
  --st-coat: #7fd3dc; --st-coat-soft: rgba(21, 170, 191, 0.2); --st-coat-line: rgba(21, 170, 191, 0.45);
  --st-finish: #ffb385; --st-finish-soft: rgba(253, 126, 20, 0.2); --st-finish-line: rgba(253, 126, 20, 0.45);
  --st-ship: #8ce99a; --st-ship-soft: rgba(64, 192, 87, 0.2); --st-ship-line: rgba(64, 192, 87, 0.45);
}
.st-process { --st: var(--st-process); --st-soft: var(--st-process-soft); --st-line: var(--st-process-line); }
.st-print { --st: var(--st-print); --st-soft: var(--st-print-soft); --st-line: var(--st-print-line); }
.st-coat { --st: var(--st-coat); --st-soft: var(--st-coat-soft); --st-line: var(--st-coat-line); }
.st-finish { --st: var(--st-finish); --st-soft: var(--st-finish-soft); --st-line: var(--st-finish-line); }
.st-ship { --st: var(--st-ship); --st-soft: var(--st-ship-soft); --st-line: var(--st-ship-line); }

/* -- page & columns ------------------------------------------------------------------ */

.sch-page { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; background: var(--bg); }
.sch-header { background: var(--surface); }
.sch-body { flex: 1; min-height: 0; display: flex; transition: opacity 0.15s; }
.sch-body.is-loading { opacity: 0.7; }
.sch-col { min-width: 0; min-height: 0; overflow: auto; }
.sch-col-main { flex: 1; display: flex; flex-direction: column; }
.sch-col-mini { flex: 0 0 264px; background: var(--surface-2); border-right: 1px solid var(--border); }
.sch-col-strip { flex: 0 0 48px; background: var(--surface-2); border-right: 1px solid var(--border); overflow: hidden; }
.sch-col-tiles { flex: 0 0 88px; background: var(--surface-2); border-right: 1px solid var(--border); }
.sch-col-daylist { flex: 0 0 clamp(230px, 22%, 300px); background: var(--surface-2); border-right: 1px solid var(--border); }
.is-job .sch-col-main { background: var(--surface); }

/* the header's "needs attention" line */
.sch-att { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.sch-att-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.sch-att-chip.is-late { background: var(--red-soft); color: var(--red-text); }
.sch-att-chip.is-behind { background: var(--yellow-soft); color: var(--yellow-text); }
.sch-att-chip.is-active { background: var(--accent-soft); color: var(--accent-text); }
.sch-att-chip:hover { filter: brightness(0.96); box-shadow: inset 0 0 0 1px currentColor; }
.sch-att-ok { display: inline-flex; align-items: center; gap: 4px; color: var(--green-text); font-weight: 600; }
.sch-att-extra { white-space: nowrap; }
.sch-att-pop { display: flex; flex-direction: column; padding: 6px; max-height: 360px; overflow: auto; }
.sch-att-pop-title { display: flex; align-items: center; gap: 6px; padding: 4px 6px 8px; font-size: 12px; font-weight: 700; }
.sch-att-pop-title.is-late { color: var(--red-text); }
.sch-att-pop-title.is-behind { color: var(--yellow-text); }
.sch-att-pop-title.is-active { color: var(--accent-text); }
.sch-att-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 8px; border-radius: var(--radius); text-align: left; }
.sch-att-item:hover { background: var(--hover); }
.sch-att-name { font-size: 13px; font-weight: 650; }
.sch-att-meta { font-size: 12px; color: var(--text-3); }

/* breadcrumb */
.sch-crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.sch-crumb { height: 30px; padding: 0 6px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
button.sch-crumb:hover { background: var(--hover); color: var(--text); }
.sch-crumb.is-here { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; }
.sch-crumb-sep { color: var(--text-3); flex: none; }
.sch-crumbs .sch-crumb:first-child { margin-left: -6px; }

/* -- month: full grid ----------------------------------------------------------------- */

.sch-month { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px 16px 16px; gap: 0; overflow: auto; }
.sch-month-head, .sch-mweek { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; }
.sch-month-head { grid-template-columns: 22px repeat(7, minmax(0, 1fr)); gap: 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); position: sticky; top: -12px; z-index: 3; background: var(--bg); }
.sch-month-dow { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 6px; }
.sch-month-weeks { display: flex; flex-direction: column; flex: 1; }
.sch-month-weekbtn { display: flex; align-items: center; justify-content: center; border-radius: var(--radius); color: var(--text-3); }
.sch-month-weekbtn:hover { background: var(--accent-soft); color: var(--accent-text); }
/* one week of the month: a band of days on light rules, with jobs spanning their days */
.sch-mweek { flex: 1 0 auto; min-height: 96px; border-bottom: 1px solid var(--divider); }
.sch-mweek-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 6px; row-gap: 3px; padding-bottom: 8px; position: relative; }
.sch-mday { position: relative; min-width: 0; align-self: stretch; border-radius: 6px; }
/* day dividers, as on the week: a line between every two days */
.sch-mweek-grid > .sch-mday ~ .sch-mday::before, .sch-month-dow ~ .sch-month-dow::before {
  content: ""; position: absolute; left: -3.5px; top: 0; bottom: -8px; width: 1px; background: var(--border-strong); pointer-events: none;
}
.sch-month-dow { position: relative; }
.sch-month-dow ~ .sch-month-dow::before { top: 2px; bottom: -7px; }
.sch-mday-label { position: relative; z-index: 2; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; min-width: 0; padding: 6px 4px 2px; pointer-events: none; }
.sch-mday:hover { background: var(--hover); }
.sch-mday:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sch-mday.is-selected { background: var(--accent-soft); }
.sch-mday-num { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text); padding: 1px 6px; border-radius: 10px; }
.sch-mday-num b { font-weight: 700; color: var(--text-2); }
.sch-mday-label.is-other .sch-mday-num { color: var(--text-3); }
.sch-mday-label.is-today .sch-mday-num { background: var(--accent); color: #fff; }
.sch-mday-label.is-today .sch-mday-num b { color: #fff; }
.sch-mday-sum { font-size: 11px; color: var(--text-3); min-width: 0; }
/* a job across its days in the month: its name, then its tasks as stage-colored dots per day */
.sch-mbar {
  position: relative; z-index: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 4px 7px 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-1); text-align: left;
}
.sch-mbar:hover { border-color: var(--accent); }
/* schedulers drag a bar to move its job, and its right edge to set the deadline */
.sch-mbar.is-movable { cursor: grab; touch-action: manipulation; }
.sch-mbar.is-held { z-index: 4; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-3); }
.sch-month.is-dragging, .sch-month.is-dragging * { cursor: grabbing; user-select: none; }
.sch-mbar-edge {
  position: absolute; top: 0; bottom: 0; right: -5px; width: 10px; z-index: 2; cursor: ew-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.sch-mbar-edge::before { content: ""; width: 3px; height: 60%; max-height: 18px; border-radius: 2px; background: var(--border-strong); opacity: 0; transition: opacity 0.12s, background 0.12s; }
.sch-mbar:hover .sch-mbar-edge::before { opacity: 1; }
.sch-mbar-edge:hover::before, .sch-mbar.is-held .sch-mbar-edge::before { opacity: 1; background: var(--accent); }
@media (hover: none) { .sch-mbar-edge::before { opacity: 0.7; } .sch-mbar-edge { width: 16px; right: -8px; } }
.sch-month-tip { min-width: 0; max-width: calc(100vw - 32px); }
.sch-mbar.is-complete { border-color: color-mix(in srgb, var(--sch-done, var(--green)) 70%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--sch-done, var(--green)) 40%, transparent); }
.sch-mbar.is-late { border-color: color-mix(in srgb, var(--red) 70%, var(--border)); }
.sch-mbar.cont-left { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dashed; }
.sch-mbar.cont-right { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.sch-mbar-title { font-size: 12px; font-weight: 650; line-height: 1.25; color: var(--text); overflow-wrap: anywhere; }
.sch-mbar-days { display: grid; column-gap: 6px; }
.sch-mbar-day { display: flex; flex-wrap: wrap; gap: 3px; min-height: 7px; }
.sch-mbar-day i { width: 7px; height: 7px; border-radius: 50%; background: var(--st-soft); box-shadow: inset 0 0 0 1.5px var(--st); }
.sch-mbar-day i.is-doing { background: var(--st-soft); box-shadow: inset 0 0 0 2.5px var(--st); }
.sch-mbar-day i.is-done { background: var(--st); box-shadow: none; }

/* -- month: mini (beside the week) ----------------------------------------------------- */

.sch-mini { padding: 14px 14px 18px; }
.sch-mini-head { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.sch-mini-title { flex: 1; text-align: left; font-weight: 700; font-size: 14px; padding: 4px 6px; border-radius: var(--radius-sm); }
.sch-mini-title:hover { background: var(--hover); }
.sch-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.sch-mini-dow { font-size: 10.5px; font-weight: 650; color: var(--text-3); text-align: center; padding: 2px 0 4px; }
.sch-mini-week { display: contents; }
.sch-mini-day { position: relative; height: 40px; padding-bottom: 11px; border-radius: 8px; font-size: 12.5px; font-weight: 550; color: var(--text); font-variant-numeric: tabular-nums; }
.sch-mini-week.is-current .sch-mini-day { background: var(--accent-soft); border-radius: 0; }
.sch-mini-week.is-current .sch-mini-day:first-child { border-radius: 8px 0 0 8px; }
.sch-mini-week.is-current .sch-mini-day:last-child { border-radius: 0 8px 8px 0; }
.sch-mini-day:hover { background: var(--hover); }
.sch-mini-day.is-other { color: var(--text-3); }
.sch-mini-day.is-selected { font-weight: 800; color: var(--accent-text); }
.sch-mini-day.is-today { color: #fff; isolation: isolate; }
.sch-mini-day.is-today::before { content: ""; position: absolute; inset: 3px 5px 13px; border-radius: 7px; background: var(--accent); z-index: -1; }
.sch-mini-marks { position: absolute; left: 0; right: 0; bottom: 1px; display: flex; justify-content: center; gap: 2px; }
/* how many jobs start / ship that day: small outlined numbers */
.sch-mini-marks i, .sch-mini-legend i {
  display: inline-flex; align-items: center; justify-content: center; min-width: 11px; height: 11px; padding: 0 2px; border-radius: 6px;
  font-style: normal; font-size: 8.5px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums;
  border: 1px solid currentColor; background: var(--surface);
}
.sch-mini-marks i.is-start, .sch-mini-legend i.is-start { color: var(--st-print); }
.sch-mini-marks i.is-ship, .sch-mini-legend i.is-ship { color: var(--st-ship); }
.sch-mini-day.is-today .sch-mini-marks i { background: var(--surface); }
.sch-mini-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.sch-mini-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sch-mini-legend i { min-width: 13px; height: 13px; font-size: 9.5px; }
.sch-mini-summary { margin-top: 12px; font-size: 12.5px; color: var(--text-2); }

/* -- month: strip (beside the day and the job) ---------------------------------------- */

.sch-strip { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0; color: var(--text-2); }
.sch-strip:hover { background: var(--hover); color: var(--text); }
.sch-strip-text, .sch-strip-sub { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.sch-strip-text { font-size: 13px; font-weight: 700; color: var(--text); }
.sch-strip-sub { font-size: 11.5px; color: var(--text-3); }

/* -- week: one continuous timeline, scrolled sideways ------------------------------------ */

.sch-week { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px 0 0 16px; gap: 8px; }
.sch-week-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; color: var(--text-2); padding: 0 16px 0 2px; }
.sch-week-hint { margin-left: auto; color: var(--text-3); }
.sch-legend { display: inline-flex; align-items: center; gap: 6px; }
.sch-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--st-soft); box-shadow: inset 0 0 0 1px var(--st-line); }
.sch-legend.is-done-key i { background: var(--text-3); box-shadow: none; }
.sch-week-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior-x: contain; padding-right: 16px; scroll-snap-type: x proximity; }
/* grab the board: empty background and day headers drag it around */
.sch-week-scroll, .sch-days-scroll { cursor: grab; }
.sch-week-scroll .sch-bar, .sch-days-scroll .sch-card { cursor: auto; }
.sch-week-day { cursor: grab; }
.sch-week-scroll.is-panning, .sch-days-scroll.is-panning { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.sch-week-scroll.is-zooming, .sch-days-scroll.is-zooming { scroll-snap-type: none; }
.is-panning *, .is-panning .sch-week-day { cursor: grabbing !important; }
/* the timeline's left and right edges fade, so jobs running off-screen read as continuing */
.sch-week-viewport { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sch-week-viewport::before, .sch-week-viewport::after { content: ""; position: absolute; top: 0; bottom: 0; width: 14px; z-index: 6; pointer-events: none; }
.sch-week-viewport::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.sch-week-viewport::after { right: 0; width: 32px; background: linear-gradient(to left, var(--bg) 30%, transparent); }
.sch-week-track { position: relative; }
.sch-week-head {
  position: sticky; top: 0; z-index: 5; display: grid; column-gap: 6px; margin-bottom: 10px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
/* day headers are flat, fixed labels — nothing like the job shapes below them */
.sch-week-day {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 0;
  padding: 4px 4px 7px 10px; background: none; border: 0; border-radius: 0; text-align: left; scroll-snap-align: start;
}
/* day dividers: a line between every two days (header, board and inside each job), heavier where a week starts */
.sch-week-day + .sch-week-day::before { content: ""; position: absolute; left: -3.5px; top: 2px; bottom: 0; width: 1px; background: var(--border-strong); }
.sch-week-day.is-weekstart::before { width: 2px; left: -4px; background: var(--text-3); opacity: 0.55; }
.sch-week-day:hover .sch-week-dnum { color: var(--accent-text); }
.sch-week-day:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.sch-week-day.is-today::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.sch-week-dname { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.sch-week-dname b { color: var(--text-2); }
.sch-week-day.is-today .sch-week-dname, .sch-week-day.is-today .sch-week-dnum { color: var(--accent-text); }
.sch-week-dnum { font-size: 17px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; color: var(--text); }
.sch-week-dsum { font-size: 11px; color: var(--text-3); max-width: 100%; }
.sch-week-lanes { position: relative; display: grid; column-gap: 6px; row-gap: 8px; align-items: start; padding-bottom: 24px; min-height: 240px; }
.sch-week-lanes > .sch-bar { position: relative; z-index: 1; }
.sch-week-sep { position: absolute; top: -10px; bottom: 0; width: 1px; background: var(--border-strong); pointer-events: none; }
.sch-week-sep.is-week { width: 2px; margin-left: -0.5px; background: var(--text-3); opacity: 0.55; }
.sch-bar-cell + .sch-bar-cell::before {
  content: ""; position: absolute; left: -2.5px; top: -2px; bottom: -5px; width: 1px; pointer-events: none;
  background: color-mix(in srgb, var(--border-strong) 85%, transparent);
}
.sch-week-todayband { position: absolute; top: -4px; bottom: 0; background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: var(--radius); pointer-events: none; }
.sch-week-overlay { position: absolute; left: 0; right: 0; top: 140px; display: flex; justify-content: center; pointer-events: none; }
/* A job is an even box as tall as its busiest day; every task stacks inside it. */
.sch-bar {
  --skin: var(--surface);
  position: relative; display: flex; flex-direction: column; min-width: 0; align-self: start;
  background: var(--skin); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.sch-bar.is-focused { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-1); }
.sch-bar.cont-left { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dashed; }
.sch-bar.cont-right { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.sch-bar-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px 7px; min-width: 0; text-align: left; padding: 7px 9px 5px;
  background: var(--skin); border-radius: var(--radius) var(--radius) 0 0;
}
.sch-bar.cont-left .sch-bar-head { border-top-left-radius: 0; }
.sch-bar.cont-right .sch-bar-head { border-top-right-radius: 0; }
/* the job's name stays in view while its bar runs off the left of the timeline */
.sch-bar-id {
  position: sticky; left: 16px; z-index: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 7px; min-width: 0; flex: 1 1 auto;
  max-width: var(--vis, max-content); padding-right: 6px; background: var(--skin);
}
.sch-bar[style*="--vis"] .sch-bar-id { box-shadow: -18px 0 0 var(--skin); }
.sch-bar-head:hover .sch-bar-title { color: var(--accent-text); text-decoration: underline; }
.sch-bar-title { font-weight: 650; font-size: 13.5px; line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.sch-bar-sub { font-size: 12px; line-height: 1.3; color: var(--text-3); min-width: 0; overflow-wrap: anywhere; }
.sch-bar-ship { position: relative; z-index: 1; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; flex: none; margin-left: auto; padding-left: 8px; background: var(--surface); }
.sch-bar-ship.is-complete { color: var(--green-text); }
.sch-bar-runs { display: grid; gap: 3px; min-height: 26px; }
.sch-bar-days { display: grid; column-gap: 4px; align-items: start; flex: 1; padding: 0 6px 7px; }
/* moving a whole job: grab it by its title */
.sch-bar-head.is-movable { cursor: grab; touch-action: manipulation; }
.sch-bar.is-moving { z-index: 8; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 14px 32px rgba(16, 24, 40, 0.22); opacity: 0.97; transition: box-shadow 0.15s; will-change: transform; }
/* where a dragged job will land */
.sch-bar-ghost { align-self: start; border: 2px dashed color-mix(in srgb, var(--accent) 70%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none; transition: none; }
.sch-bar.is-moving, .sch-bar.is-moving * { cursor: grabbing; user-select: none; }
.sch-bar-move-tip {
  position: absolute; bottom: calc(100% + 6px); left: 8px; z-index: 7; white-space: nowrap; pointer-events: none;
  padding: 3px 8px; border-radius: 6px; background: var(--text); color: var(--surface); font-size: 12px; font-weight: 650; box-shadow: var(--shadow-2);
}
/* the deadline edge: drag it like the edge of a window */
.sch-bar-edge {
  position: absolute; top: -1px; bottom: -1px; right: -6px; width: 12px; z-index: 3; cursor: ew-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center; border-radius: 6px; outline: none;
}
.sch-bar-edge.is-inside { right: auto; margin-left: -6px; }
.sch-bar-edge::before { content: ""; width: 4px; height: 22px; border-radius: 2px; background: var(--border-strong); opacity: 0.55; transition: opacity 0.12s, background 0.12s; }
.sch-bar:hover .sch-bar-edge::before, .sch-bar-edge:focus-visible::before { opacity: 1; }
.sch-bar-edge:hover::before, .sch-bar.is-resizing .sch-bar-edge::before { opacity: 1; background: var(--accent); }
.sch-bar-edge:focus-visible { box-shadow: 0 0 0 2px var(--focus); }
.sch-bar.is-resizing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-2); }
.sch-bar.is-resizing, .sch-bar.is-resizing * { cursor: ew-resize; user-select: none; }
.sch-bar-edge-tip {
  position: absolute; bottom: calc(100% + 6px); right: 0; white-space: nowrap; pointer-events: none;
  padding: 3px 8px; border-radius: 6px; background: var(--text); color: var(--surface); font-size: 12px; font-weight: 650; box-shadow: var(--shadow-2);
}
/* work scheduled after the deadline */
.sch-bar-late {
  position: absolute; top: 0; bottom: 0; right: 0; z-index: 2; pointer-events: none; border-radius: 0 var(--radius) var(--radius) 0;
  border-left: 2px dashed var(--red); background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--red) 12%, transparent) 6px 12px);
}
.sch-bar-ship.is-late { color: var(--red-text); }

/* one slot per day; that day's tasks stack top to bottom */
/* one piece per day, only as tall as that day's stack: the job's outline follows it */
.sch-bar-cell { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 26px; padding: 0 2px; border-radius: 6px; transition: background 0.12s; }
.sch-bar-cell.is-drop { background: var(--accent-soft); outline: 1px dashed var(--accent); outline-offset: 1px; }
/* Text in a job never gets cut off: when a column is too narrow it wraps onto more lines and
   the job grows taller to hold it. */
.sch-task-text, .sch-pill-text { min-width: 0; overflow-wrap: anywhere; }
.sch-task > .icon, .sch-task > .sch-task-live { margin-top: 2px; flex: none; }
.sch-daylist-name, .sch-daylist-sub { overflow-wrap: anywhere; }
/* one task (attribute): click to move it along Not started → In progress → Complete; drag to another day */
.sch-task {
  display: flex; align-items: flex-start; gap: 4px; width: 100%; min-width: 0; min-height: 26px; padding: 5px 8px; border-radius: 5px;
  font-size: 11.5px; font-weight: 650; line-height: 1.3; text-align: left;
  background: var(--st-soft); color: var(--st); box-shadow: inset 0 0 0 1px var(--st-line);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s, translate 260ms cubic-bezier(0.22, 0.9, 0.24, 1);
}
.sch-task.is-draggable { cursor: grab; touch-action: manipulation; }
/* a task's size (stretched by its bottom edge): whole steps of one pill plus the stack gap */
.sch-task { position: relative; min-height: calc(var(--size, 1) * 26px + (var(--size, 1) - 1) * 3px); }
.sch-task-grow {
  position: absolute; left: 6px; right: 6px; bottom: 0; height: 7px; cursor: ns-resize; touch-action: none;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.12s;
}
.sch-task-grow::after { content: ''; width: 18px; height: 3px; border-radius: 2px; background: currentColor; opacity: 0.45; }
.sch-task:hover .sch-task-grow, .sch-task.is-growing .sch-task-grow { opacity: 1; }
@media (hover: none) { .sch-task-grow { opacity: 0.7; height: 12px; } }
.sch-week-lanes > .sch-bar.is-holding { z-index: 7; }
.sch-task.is-dragging { transition: none; pointer-events: none; }
.sch-task.is-growing { box-shadow: inset 0 0 0 2px var(--st), var(--shadow-2); cursor: ns-resize; z-index: 6; }
.sch-task.is-dragging { cursor: grabbing; transform: scale(1.04); box-shadow: inset 0 0 0 2px var(--st), var(--shadow-3); position: relative; z-index: 6; }
.sch-bar:has(.is-dragging), .sch-bar:has(.is-dragging) * { cursor: grabbing; user-select: none; }
button.sch-task:hover { box-shadow: inset 0 0 0 2px var(--st-line); filter: brightness(0.97); }
button.sch-task:active { transform: scale(0.95); }
button.sch-task:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sch-task.is-doing { box-shadow: inset 0 0 0 2px var(--st); }
.sch-task.is-done { background: var(--st); color: var(--surface); box-shadow: none; }
.sch-task.is-done .icon { flex: none; }
/* not started: an empty circle (in progress: a pulsing dot; complete: a check) */
.sch-task-todo { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; margin-top: 2px; opacity: 0.85; }
.sch-task-live { width: 7px; height: 7px; border-radius: 50%; background: var(--st); flex: none; animation: sch-pulse 1.6s ease-in-out infinite; }
@keyframes sch-pulse { 50% { opacity: 0.35; } }
.sch-task.is-ship-only { cursor: default; opacity: 0.85; }
@media (prefers-reduced-motion: reduce) { .sch-task-live { animation: none; } button.sch-task:active { transform: none; } }

/* -- week tiles (beside the day and the job) ------------------------------------------ */

.sch-tiles { display: flex; flex-direction: column; gap: 6px; padding: 12px 8px; }
.sch-tile {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 8px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.sch-tile:hover { border-color: var(--border-strong); }
.sch-tile.is-selected { border: 2px solid var(--accent); padding: 6px 0 7px; background: var(--accent-soft); }
.sch-tile-name { font-size: 10.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.sch-tile-num { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sch-tile.is-today .sch-tile-name, .sch-tile.is-today .sch-tile-num { color: var(--accent-text); }
.sch-tile-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--surface-3); font-size: 11px; font-weight: 700; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.sch-tile-count.is-zero { opacity: 0.5; }

/* -- day ----------------------------------------------------------------------------- */

.sch-day { padding: 18px 24px 32px; display: flex; flex-direction: column; gap: 14px; max-width: 1100px; width: 100%; }
/* the day level: one column per day, scrolled sideways like the week */
.sch-days { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sch-days-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior-x: contain; padding: 14px 16px 0; scroll-snap-type: x proximity; scroll-padding-left: 16px; }
.sch-days-track { position: relative; display: grid; column-gap: 6px; row-gap: 10px; align-items: start; padding-bottom: 32px; }
/* each day: a column behind the jobs, with its header on top (sticky) */
.sch-daycol { align-self: stretch; min-width: 0; border-radius: var(--radius-lg); position: relative; }
.sch-daycol.is-current { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.sch-daycol ~ .sch-daycol::before {
  content: ""; position: absolute; left: -3.5px; top: 0; bottom: 0; width: 1px; background: var(--border-strong); pointer-events: none;
}
.sch-daycol-head {
  position: sticky; top: -14px; z-index: 4; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 12px 10px;
  background: var(--bg); border-bottom: 1px solid var(--divider); scroll-snap-align: start;
}
.sch-daycol-head.is-current { box-shadow: inset 0 -2px 0 var(--accent); }
.sch-daycol-head .sch-day-title { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.sch-daycol-empty { color: var(--text-3); font-size: 13px; padding: 8px 12px; margin: 0; }
.sch-day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.sch-day-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.sch-day-sub { font-size: 13px; color: var(--text-2); flex: 1; }
.sch-day-list { display: flex; flex-direction: column; gap: 10px; }
.sch-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--radius-lg); text-align: left;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1); transition: border-color 0.12s, box-shadow 0.12s;
}
.sch-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
/* a job across its days on the day level: name, then a slot per day with that day's attributes */
.sch-span { position: relative; z-index: 1; gap: 8px; padding: 10px 0 8px; min-width: 0; }
.sch-span.is-focused { padding: 9px 0 7px; }
.sch-span-head {
  position: sticky; left: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; width: fit-content;
  max-width: min(100%, var(--col)); padding: 0 14px; background: none; border: 0; text-align: left; cursor: pointer;
}
.sch-span-head:hover .sch-card-title { color: var(--accent-text); }
.sch-span-head .sch-card-sub { margin-top: 0; overflow-wrap: anywhere; }
.sch-span-days { display: grid; column-gap: 6px; padding: 0 6px; }
.sch-span-day {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; min-height: 30px;
  padding: 4px 6px; border-radius: 8px; background: none; border: 0; text-align: left; cursor: pointer;
}
.sch-span-day:hover { background: var(--hover); }
.sch-span-day + .sch-span-day::before { content: ""; position: absolute; left: -3.5px; top: 2px; bottom: 2px; width: 1px; background: color-mix(in srgb, var(--border-strong) 85%, transparent); }
.sch-span-day .sch-pill { max-width: 100%; }
.sch-span-day .sch-pill b { font-weight: 650; }
.sch-span-marks { display: flex; gap: 4px; flex-wrap: wrap; }
.sch-span-loose { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 14px; position: sticky; left: 0; max-width: min(100%, var(--col)); }
.sch-span-loose-label { font-size: 11.5px; color: var(--text-3); }
.sch-card.is-focused { border: 2px solid var(--accent); padding: 13px 15px; }
.sch-card-top { display: flex; align-items: flex-start; gap: 12px; }
.sch-card-text { flex: 1; min-width: 0; }
.sch-card-title { font-size: 15px; font-weight: 650; }
.sch-card-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.sch-card-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sch-flag { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.sch-flag.is-start { background: var(--st-print-soft); color: var(--st-print); }
.sch-flag.is-ship { background: var(--st-ship-soft); color: var(--st-ship); }
.sch-flag.is-late { background: var(--red-soft); color: var(--red-text); }
.sch-flag.is-idle { background: var(--surface-3); color: var(--text-2); }
.sch-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sch-pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 4px 10px; border-radius: 14px; line-height: 1.3;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; color: var(--text); min-width: 0;
}
.sch-pill.is-today-attr { border: 2px solid var(--accent); padding: 0 9px; font-weight: 650; }
.sch-pill.is-key { height: 24px; font-size: 11.5px; color: var(--text-2); }
.sch-pill-time { color: var(--accent-text); font-variant-numeric: tabular-nums; font-weight: 700; flex: none; }
.sch-status-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; border: 1.5px solid var(--gray); flex: none; }
.sch-status-dot.is-doing { background: var(--accent); border-color: var(--accent); }
.sch-status-dot.is-done { background: var(--green); border-color: var(--green); }

/* -- day: compact list (beside the job) ----------------------------------------------- */

.sch-daylist { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; }
.sch-daylist-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px 6px; }
.sch-daylist-title { font-weight: 700; font-size: 14px; padding: 3px 6px; margin-left: -6px; border-radius: var(--radius-sm); }
.sch-daylist-title:hover { background: var(--hover); }
.sch-daylist-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--radius); border: 1px solid transparent; text-align: left; min-width: 0; }
.sch-daylist-item:hover { background: var(--hover); }
.sch-daylist-item.is-current { background: var(--surface); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-1); }
.sch-daylist-text { display: flex; flex-direction: column; min-width: 0; }
.sch-daylist-name { font-size: 13.5px; font-weight: 650; }
.sch-daylist-sub { font-size: 12px; color: var(--text-3); }

/* -- job ----------------------------------------------------------------------------- */

.sch-job { padding: 18px 24px 32px; display: flex; flex-direction: column; gap: 14px; max-width: 900px; width: 100%; }
.sch-job-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sch-order { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.sch-job-title { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin-top: 6px; }
.sch-job-line { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.sch-job-links { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sch-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.sch-attrs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 6px; }
.sch-attrs-head h3 { font-size: 15px; font-weight: 700; }
.sch-progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.sch-progress span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.sch-attrs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sch-attr { display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 0; border-radius: var(--radius); }

/* the job's timeline: dates down the left, a rail with a dot per day, that day's milestones
   and attributes beside it; the rail is solid through the past, dotted ahead */
.sch-tl { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.sch-tl-day, .sch-tl-gap { display: grid; grid-template-columns: 52px 22px minmax(0, 1fr); column-gap: 12px; }
.sch-tl-date { display: flex; flex-direction: column; align-items: flex-end; padding-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sch-tl-dow, .sch-tl-mon { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.sch-tl-num { font-size: 20px; font-weight: 700; color: var(--text); }
.sch-tl-day.is-today .sch-tl-num, .sch-tl-day.is-today .sch-tl-dow, .sch-tl-day.is-today .sch-tl-mon { color: var(--accent-text); }
.sch-tl-day.is-loose .sch-tl-dow { text-transform: none; letter-spacing: 0; font-size: 12px; text-align: right; }
.sch-tl-rail { position: relative; display: flex; justify-content: center; }
.sch-tl-rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--border-strong); }
.sch-tl-day:first-child .sch-tl-rail::before { top: 14px; }
.sch-tl-day:last-child .sch-tl-rail::before { bottom: calc(100% - 14px); }
.sch-tl-day:not(.is-past) .sch-tl-rail::before, .sch-tl-gap:not(.is-past) .sch-tl-rail::before {
  background: repeating-linear-gradient(to bottom, var(--border-strong) 0 4px, transparent 4px 8px);
}
.sch-tl-day.is-past .sch-tl-rail::before, .sch-tl-gap.is-past .sch-tl-rail::before { background: var(--text-3); opacity: 0.6; }
.sch-tl-dot {
  position: relative; z-index: 1; margin-top: 7px; width: 16px; height: 16px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: var(--bg); box-shadow: inset 0 0 0 2px var(--border-strong);
}
.sch-tl-day.is-todo .sch-tl-dot { box-shadow: inset 0 0 0 2px var(--text-3); }
.sch-tl-day.is-doing .sch-tl-dot { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft); background: radial-gradient(circle, var(--accent) 0 3px, var(--bg) 3.5px); }
.sch-tl-day.is-done .sch-tl-dot { background: var(--sch-done, var(--green)); box-shadow: none; }
.sch-tl-day.is-late .sch-tl-dot { box-shadow: inset 0 0 0 2px var(--red); }
.sch-tl-day.is-empty .sch-tl-dot { width: 10px; height: 10px; margin-top: 10px; background: var(--border-strong); box-shadow: none; }
.sch-tl-day.is-today .sch-tl-dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.sch-tl-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 4px 0 16px; }
.sch-tl-day.is-selected .sch-tl-body { background: linear-gradient(to right, var(--accent-soft), transparent 70%); border-radius: var(--radius); padding-left: 8px; margin-left: -8px; }
.sch-tl-marks { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.sch-tl-mark { padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.sch-tl-mark.is-start { background: var(--st-print-soft); color: var(--st-print); }
.sch-tl-mark.is-ship { background: var(--st-ship-soft); color: var(--st-ship); }
.sch-tl-mark.is-due { background: var(--yellow-soft); color: var(--yellow-text); }
.sch-tl-mark.is-today { background: var(--accent); color: #fff; }
.sch-tl-gap { min-height: 26px; }
.sch-tl-gaptext { align-self: center; font-size: 11.5px; color: var(--text-3); }
.sch-attr-seg { align-self: stretch; width: 6px; border-radius: 3px; background: var(--surface-3); flex: none; }
.sch-attr.is-doing .sch-attr-seg { background: var(--st-soft); box-shadow: inset 0 0 0 2px var(--st); }
.sch-attr.is-done .sch-attr-seg { background: var(--st); }
.sch-attr-text { flex: 1; min-width: 0; }
.sch-attr-value { font-size: 14px; font-weight: 600; }
.sch-attr-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sch-attr-stage { padding: 0 6px; border-radius: 4px; background: var(--st-soft); color: var(--st); font-weight: 700; font-size: 11px; }
.sch-attr-day { width: 136px; flex: none; }
.sch-status {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 12.5px; font-weight: 650;
  white-space: nowrap; flex: none; background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.sch-status:not(:disabled):hover { border-color: var(--border-strong); }
.sch-status.is-doing { background: var(--accent-soft); color: var(--accent-text); }
.sch-status.is-done { background: var(--green-soft); color: var(--green-text); }
.sch-status:disabled { cursor: default; opacity: 0.85; }
.sch-add { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--divider); }
.sch-add .select { width: auto; }
.sch-add .input { flex: 1 1 160px; }
.sch-add .sch-add-value { flex: 2 1 220px; }

/* progress ring */

/* -- complete: a green line runs once around the job and leaves the border green ---------- */

@property --sch-spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
:root { --sch-done: #2f9e44; --sch-done-hi: #8ce99a; --sch-done-soft: #e6f7ea; --sch-done-text: #1f6e2f; }
:root[data-theme="dark"], .theme-dark { --sch-done: #40c057; --sch-done-hi: #b2f2bb; --sch-done-soft: rgba(64, 192, 87, 0.14); --sch-done-text: #8ce99a; }

.sch-glow { --glow-r: var(--radius); position: relative; isolation: isolate; border-color: color-mix(in srgb, var(--sch-done) 45%, var(--border)); }
.sch-card.sch-glow { --glow-r: var(--radius-lg); }
.sch-job.sch-glow { --glow-r: var(--radius-xl); }
/* The sweep: green fills in behind a bright head as --sch-spin goes once around (to 400deg, so
   the head runs off past the start and the ring ends solid green). */
.sch-glow::before, .sch-glow::after {
  content: ""; position: absolute; pointer-events: none;
  background: conic-gradient(var(--sch-done) 0deg, var(--sch-done) calc(var(--sch-spin) - 30deg),
    var(--sch-done-hi) calc(var(--sch-spin) - 6deg), #fff var(--sch-spin), transparent var(--sch-spin));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: sch-sweep 1.4s cubic-bezier(0.45, 0, 0.3, 1) 0.15s both;
}
/* the line: the gradient cut down to a 2px ring on the box's edge */
.sch-glow::before { inset: -2px; padding: 2px; border-radius: calc(var(--glow-r) + 2px); z-index: 2; }
/* the halo: the same gradient blurred, then cut to a band outside the box so it never covers the content */
.sch-glow::after {
  inset: -14px; padding: 14px; border-radius: calc(var(--glow-r) + 14px); filter: blur(8px);
  animation: sch-sweep 1.4s cubic-bezier(0.45, 0, 0.3, 1) 0.15s both, sch-halo 1.8s ease-out 0.15s both;
}
@keyframes sch-sweep { from { --sch-spin: 0deg; } to { --sch-spin: 400deg; } }
@keyframes sch-halo { 0%, 70% { opacity: 0.7; } 100% { opacity: 0.3; } }

.sch-daylist-item.sch-glow { border-color: color-mix(in srgb, var(--sch-done) 35%, transparent); }
.sch-daylist-item.sch-glow::after { filter: blur(6px); }
.sch-bar.sch-glow .sch-bar-ship.is-complete { color: var(--sch-done-text); }

/* the job view: a green-rimmed card with a "Job complete" badge */
.sch-job.is-complete { margin: 14px; padding-top: 14px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid transparent; width: auto; }
.sch-job.is-complete .sch-progress span { background: var(--sch-done); }
.sch-tier {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-lg);
  background: var(--sch-done-soft); border: 1px solid color-mix(in srgb, var(--sch-done) 45%, transparent); color: var(--sch-done-text);
}
.sch-tier-badge {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, var(--sch-done-hi), var(--sch-done)); color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sch-done) 22%, transparent);
}
.sch-tier-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.sch-tier-title { font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.sch-tier-sub { font-size: 12.5px; color: var(--text-2); }
.sch-tier-count { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* the moment the last attribute is finished: the lap runs again and the badge pops in with a shine */
.sch-job.is-celebrating::before { animation-name: sch-sweep-again; }
.sch-job.is-celebrating::after { animation-name: sch-sweep-again, sch-halo-again; }
@keyframes sch-sweep-again { from { --sch-spin: 0deg; } to { --sch-spin: 400deg; } }
@keyframes sch-halo-again { 0%, 70% { opacity: 0.7; } 100% { opacity: 0.3; } }
.sch-tier::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-100%);
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
}
.sch-job.is-celebrating .sch-tier { animation: sch-tier-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.sch-job.is-celebrating .sch-tier::after { animation: sch-shine-once 0.9s ease-out 0.25s both; }
.sch-job.is-celebrating .sch-tier-badge { animation: sch-badge-spin 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes sch-tier-pop { 0% { transform: scale(0.85); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); } }
@keyframes sch-shine-once { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes sch-badge-spin { from { transform: rotate(-200deg) scale(0.4); } to { transform: rotate(0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .sch-glow::before, .sch-glow::after, .sch-job.is-celebrating::before, .sch-job.is-celebrating::after,
  .sch-job.is-celebrating .sch-tier, .sch-job.is-celebrating .sch-tier-badge, .sch-job.is-celebrating .sch-tier::after { animation: none; }
  .sch-glow::before { background: var(--sch-done); }
  .sch-glow::after { background: var(--sch-done); opacity: 0.25; }
}

/* -- settings: deadline times ---------------------------------------------------------- */

.sch-times { display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.sch-times-row { display: flex; align-items: center; gap: 10px; }
.sch-times-row .input { width: 140px; }
.sch-times-row .muted { flex: 1; }
.sch-times-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* -- phones: one level at a time ----------------------------------------------------- */

@media (max-width: 760px) {
  .sch-header .page-header-actions .btn { width: auto; padding: 0 10px; }
  .sch-header .page-header-actions .btn-label { display: inline; }
  .sch-crumb { font-size: 13px; padding: 0 4px; }
  .sch-header .page-header-icon { display: none; }
  .sch-month { padding: 8px; }
  .sch-month-head { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0 3px; top: -8px; }
  .sch-mweek { grid-template-columns: minmax(0, 1fr); min-height: 72px; }
  .sch-month-weekcol, .sch-month-weekbtn { display: none; }
  .sch-mweek-grid { column-gap: 3px; }
  .sch-mweek-grid > .sch-mday ~ .sch-mday::before, .sch-month-dow ~ .sch-month-dow::before { left: -2px; }
  .sch-mday-label { padding: 4px 0 2px; }
  .sch-mbar { padding: 3px 4px; gap: 2px; }
  .sch-mbar-title { font-size: 10.5px; line-height: 1.2; hyphens: auto; }
  .sch-week { padding: 8px 0 0 8px; }
  .sch-week-viewport::after { width: 20px; }
  .sch-week-scroll { padding-right: 8px; }
  .sch-week-hint { display: none; }
  .sch-day, .sch-job { padding: 14px 12px 28px; }
  .sch-days-scroll { padding: 10px 8px 0; }
  .sch-job.is-complete { margin: 10px 8px; padding-top: 12px; }
  .sch-card-top { flex-wrap: wrap; }
  .sch-tl-day, .sch-tl-gap { grid-template-columns: 40px 18px minmax(0, 1fr); column-gap: 8px; }
  .sch-attr { flex-wrap: wrap; row-gap: 8px; }
  .sch-attr-text { flex: 1 1 calc(100% - 24px); }
  .sch-attr-day { margin-left: 18px; }
}

/* ctrl + scroll past the end of a level: a meter that fills, then the next level opens */
.sch-zoomhint {
  position: fixed; left: 50%; bottom: 28px; z-index: 40; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; min-width: 220px; padding: 9px 14px 10px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-3);
  font-size: 12.5px; font-weight: 600; pointer-events: none; animation: sch-hint-in 0.12s ease-out;
}
.sch-zoomhint-bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.sch-zoomhint-bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.08s linear; }
@keyframes sch-hint-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* pinch zooms the Scheduler (see zoom.js), not the page; one finger still scrolls */
.sch-body, .sch-week-scroll, .sch-days-scroll { touch-action: pan-x pan-y; }

/* jobs stacked as tabs on one card (a job dropped onto another on the free board) */
.sch-tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px 8px 0; border-bottom: 1px solid var(--divider); position: sticky; left: 0; max-width: max(var(--vis, 100%), 120px); }
.sch-tab {
  position: relative; display: inline-flex; align-items: center; gap: 5px; max-width: 220px; min-width: 0; padding: 4px 10px 5px;
  border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0; margin-bottom: -1px;
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 650; line-height: 1.25; text-align: left;
}
.sch-tab:hover { color: var(--text); background: var(--hover); }
.sch-tab.is-active { background: var(--surface); color: var(--text); border-color: var(--divider); box-shadow: inset 0 2px 0 var(--accent); }
.sch-tab.is-complete::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sch-done, var(--green)); flex: none; }
.sch-tab.is-movable { cursor: grab; touch-action: manipulation; }
.sch-tab.is-carried { z-index: 9; cursor: grabbing; background: var(--surface); color: var(--text); border-color: var(--accent); border-bottom: 1px solid var(--accent); border-radius: 7px; box-shadow: var(--shadow-3); pointer-events: none; }
.sch-tab-text { min-width: 0; overflow-wrap: anywhere; }
.sch-bar.is-stack { box-shadow: var(--shadow-1), 3px 3px 0 -1px var(--surface), 3px 3px 0 0 var(--border); }
.sch-bar.is-tab-target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow-2); }
.sch-bar.is-tab-target::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none; }

/* The job page follows its own width, not the screen's: beside the Inbox's tool window on a
   wide screen it can be as narrow as on a phone. */
.sch-col-main.is-jobpane { container-type: inline-size; container-name: schjob; }
@container schjob (max-width: 720px) {
  .sch-job { padding: 14px 12px 28px; gap: 12px; }
  .sch-job-title { font-size: 19px; }
  .sch-tl-day, .sch-tl-gap { grid-template-columns: 40px 18px minmax(0, 1fr); column-gap: 8px; }
  .sch-tl-num { font-size: 17px; }
  .sch-attr { flex-wrap: wrap; row-gap: 8px; padding-right: 0; }
  .sch-attr-text { flex: 1 1 calc(100% - 24px); }
  .sch-attr-day { margin-left: 18px; width: 136px; }
  .sch-add { flex-wrap: wrap; }
  .sch-add > * { flex: 1 1 140px; min-width: 0; }
}
