/* Technician planner screen. */
.planner { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--gutter); }

.pl-toolbar { position: relative; flex: none; height: 41px; display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--toolbar); }
.pl-toolbar input[type="date"] { width: 118px; height: 26px; padding: 0 5px; border: 1px solid #c9c8ce; border-radius: 4px; background: #fff; }
.pl-toolbar input[type="date"]:focus { outline: 2px solid #111; outline-offset: -1px; border-radius: 4px; }
.pl-go { width: 26px; height: 26px; border: 0; border-radius: 4px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pl-go:hover { background: var(--brand-600); }
.pl-check { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); cursor: pointer; margin-left: 6px; padding-right: 12px; border-right: 1px solid #d6d5da; height: 26px; }
.check { appearance: none; width: 15px; height: 15px; margin: 0; flex: none; border: 1px solid #b9b8c0; border-radius: 3px; background: #fff; cursor: pointer; position: relative; }
.check:checked { background: var(--brand); border-color: var(--brand); }
.check:checked::after { content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pl-scale { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); margin-left: 6px; }
.pl-scale input { appearance: none; width: 145px; height: 8px; border-radius: 4px; background: #c9c8ce; cursor: pointer; }
.pl-scale input::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--brand); }
.pl-scale input::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 4px solid var(--brand); }
.pl-progress { position: absolute; left: 0; bottom: 0; height: 1px; width: 100%; background: var(--green); transform-origin: left; }
.pl-progress.run { animation: pl-load .7s ease-out; }
@keyframes pl-load { from { transform: scaleX(0); } }

.pl-body { flex: 1 1 auto; min-height: 0; display: flex; gap: 6px; padding: 6px 6px 6px 8px; }
.pl-panel { width: 200px; flex: none; background: #fff; border-radius: 9px; overflow-y: auto; }
.pl-h { display: flex; justify-content: space-between; padding: 7px 8px; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 12.5px; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.pl-section { padding-bottom: 12px; }
.pl-f { display: grid; grid-template-columns: 15px 1fr auto; gap: 10px; align-items: center; padding: 5px 8px; color: var(--ink-2); font-size: 12px; line-height: 14px; cursor: pointer; }
.pl-f b { font-weight: 600; }
.pl-search { display: block; width: calc(100% - 16px); height: 24px; margin: 6px 8px 2px; padding: 0 6px; border: 1px solid #c9c8ce; border-radius: 3px; font-size: 12px; }
.pl-day { display: flex; align-items: center; gap: 8px; width: 100%; padding: 2px 8px; border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: 12px; font-variant-numeric: tabular-nums; }
.pl-day:hover { background: var(--brand-50); }
.pl-day svg { color: var(--brand); width: 13px; height: 13px; transition: transform .12s; }
.pl-day[aria-expanded="true"] svg { transform: rotate(90deg); }
.pl-day b { margin-left: auto; font-weight: 600; }
.pl-job { margin: 2px 8px 4px 20px; padding: 5px 7px; border: 1px solid #c9c8ce; border-bottom-width: 3px; border-radius: 4px; font-size: 11.5px; line-height: 15px; color: var(--ink-2); }
.pl-job b { display: block; font-weight: 600; color: var(--ink); }
.pl-chip { padding: 0 5px; min-width: 18px; text-align: center; border-radius: 3px; background: #c9c8ce; color: var(--ink); font-weight: 700; }

.pl-grid { flex: 1 1 auto; min-width: 0; background: #fff; border-radius: 9px; overflow: auto; position: relative; }
.pl-inner { position: relative; min-width: max-content; }
.pl-head { position: sticky; top: 0; z-index: 6; display: flex; background: #fff; }
.pl-corner { position: sticky; left: 0; z-index: 7; width: var(--res); flex: none; background: linear-gradient(#fff 0 31px, #f5f5f6 31px); border-right: 1px solid #cfcfd4; border-bottom: 1px solid #dcdce0; }
.pl-dayh { flex: none; width: calc(var(--h) * 12); border-right: 1px solid #8d8d93; }
.pl-dayt { height: 31px; display: flex; align-items: center; justify-content: center; font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; color: var(--ink); }
.pl-hours { display: flex; height: 19px; background: #f5f5f6; border-bottom: 1px solid #dcdce0; border-top: 1px solid #dcdce0; }
.pl-hours span { flex: 1 1 0; min-width: 0; padding-left: 5px; font-size: 11.5px; line-height: 17px; color: var(--ink-2); border-left: 1px solid #dcdce0; overflow: hidden; }
.pl-hours span:first-child { border-left: 0; }
.pl-row { display: flex; height: 48px; }
.pl-res { position: sticky; left: 0; z-index: 5; width: var(--res); flex: none; display: flex; align-items: flex-start; gap: 4px; padding: 11px 6px 0 8px; background: #fff; border-right: 1px solid #cfcfd4; border-bottom: 1px solid #e6e6e9; color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; }
.pl-res span { overflow: hidden; text-overflow: ellipsis; }
.pl-res svg { color: var(--warn); width: 14px; height: 14px; }
.pl-track { position: relative; flex: none; width: var(--w); border-bottom: 1px solid #e6e6e9; }
.pl-track::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image:
    linear-gradient(to right, #8d8d93 1px, transparent 1px),
    linear-gradient(to right, #d9d9dd 1px, transparent 1px),
    linear-gradient(to right, #f0f0f2 1px, transparent 1px);
  background-size: calc(var(--h) * 12) 100%, var(--h) 100%, calc(var(--h) / 4) 100%;
}
.pl-off { position: absolute; top: 0; bottom: 0; background: #e5e5e5; }
.pl-abs { position: absolute; top: 0; bottom: 0; z-index: 2; background: rgba(226, 134, 134, .42); color: var(--ink-2); padding: 14px 4px 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-card { position: absolute; top: 1px; bottom: 1px; z-index: 3; padding: 5px 4px 0; background: #fff; border: 1px solid #8d8d93; border-bottom: 4px solid #9b9ba1; border-radius: 4px; font-size: 12px; line-height: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.1); cursor: default; }
.pl-card div { overflow: hidden; text-overflow: ellipsis; }
.pl-card small { font-size: 11px; }
.pl-card.ghost { opacity: .34; background: #f7e3e3; }
.pl-card.dim { opacity: .3; }
.pl-now { position: absolute; top: 31px; bottom: 0; width: 1px; background: #484463; z-index: 5; pointer-events: none; }
.pl-now::before { content: ''; position: absolute; left: -4px; top: 13px; border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; border-top: 6px solid #484463; }

@media (max-width: 1180px) { .pl-panel { display: none; } }
@media (max-width: 760px) { .pl-scale { display: none; } }

/* Technicians / Workbays switch, preview banner and AI-made cards */
.pl-seg { display: inline-flex; margin-left: 6px; border: 1px solid #c9c8ce; border-radius: 5px; overflow: hidden; background: #fff; }
.pl-seg button { height: 24px; padding: 0 9px; border: 0; background: none; color: var(--ink-2); font-size: 12px; cursor: pointer; }
.pl-seg button[aria-pressed="true"] { background: var(--brand); color: #fff; font-weight: 600; }
.pl-banner { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--brand-50); border-bottom: 1px solid var(--brand-100); color: var(--ink); }
.pl-banner b { font-weight: 700; }
.pl-banner svg { color: var(--brand); }
/* AI suggestions: gradient outline, number badge, and everything else stepped back */
.pl-n { display: inline-flex; align-items: center; justify-content: center; min-width: 15px; height: 15px; margin-right: 4px; padding: 0 3px; vertical-align: -3px; font-style: normal; font-size: 10px; font-weight: 700; line-height: 15px; color: #fff; background: linear-gradient(135deg, #2f9f92, #7b3fc4 60%, #c2409a); border-radius: 8px; }
.pl-n svg.i { width: 10px; height: 10px; stroke-width: 2.4; }
.pl-card.prop, .pl-card.ai { border: 2px solid transparent; border-bottom-width: 4px; background: linear-gradient(#fff, #fff) padding-box, var(--ai-gradient) border-box; color: var(--ink); opacity: 1; }
.pl-card.prop { z-index: 4; background: linear-gradient(#fbf8ff, #fbf8ff) padding-box, var(--ai-gradient) border-box; box-shadow: 0 0 0 3px rgba(178, 75, 200, .14), 0 4px 14px -4px rgba(123, 63, 196, .55); animation: pl-glow 2.4s ease-in-out infinite; }
@keyframes pl-glow { 50% { box-shadow: 0 0 0 5px rgba(99, 214, 200, .18), 0 4px 16px -4px rgba(123, 63, 196, .6); } }
.pl-card.ai { box-shadow: 0 0 0 2px rgba(178, 75, 200, .14); animation: pl-pop .35s ease-out backwards; }
@keyframes pl-pop { from { opacity: 0; transform: scale(.96); } }
.ai-preview .pl-card:not(.prop):not(.moving) { opacity: .38; filter: grayscale(.6); }
.ai-preview .pl-abs { opacity: .55; }
.pl-row.has-ai .pl-res { box-shadow: inset 3px 0 0 #b24bc8; background: linear-gradient(90deg, #f7effc, #fff 70%); color: var(--ink); font-weight: 600; }
.pl-was { position: absolute; top: 4px; bottom: 4px; z-index: 2; display: flex; align-items: center; padding: 0 5px; font-size: 11px; color: #7b3fc4; white-space: nowrap; overflow: hidden; background: repeating-linear-gradient(135deg, rgba(178, 75, 200, .07) 0 5px, transparent 5px 10px); border: 1.5px dashed #c9a5e3; border-radius: 4px; }
.pl-was span { overflow: hidden; text-overflow: ellipsis; }
.pl-was.drafting { color: var(--muted); background: repeating-linear-gradient(135deg, rgba(35, 28, 62, .05) 0 5px, transparent 5px 10px); border-color: #b4b2bf; }
.flash { animation: pl-flash 1.1s ease-out !important; }
@keyframes pl-flash { 0%, 40% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(178, 75, 200, .35); } }

.pl-banner.ai { flex-direction: column; align-items: stretch; gap: 6px; padding: 7px 12px; border: 0; border-bottom: 2px solid transparent; background: linear-gradient(90deg, #eefaf8, #f6effc 60%, #fdf0f7) padding-box, var(--ai-gradient) border-box; }
.pl-banner-r { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pl-banner-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-ai-badge { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 2px 9px 2px 7px; font-size: 11.5px; font-weight: 700; color: #fff; background: linear-gradient(110deg, #2f9f92, #7b3fc4 55%, #c2409a); border-radius: 12px; }
.pl-banner .pl-ai-badge svg { color: #fff; width: 13px; height: 13px; }
.pl-ai-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.pl-ai-chip { display: inline-flex; align-items: center; flex: none; padding: 2px 9px 2px 3px; font-size: 11.5px; color: var(--ink); background: #fff; border: 1px solid #dcc8ee; border-radius: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pl-ai-chip:hover { border-color: #b24bc8; box-shadow: 0 2px 8px -3px rgba(123, 63, 196, .5); }
.pl-ai-chip .pl-n { margin-right: 5px; vertical-align: 0; }

/* Moving a job by hand: the draft, what it pushes, and what it breaks */
.pl-card[data-drag] { cursor: grab; }
.pl-job[data-job] { cursor: grab; transition: border-color .15s, box-shadow .15s; }
.pl-job[data-job]:hover { border-color: var(--ink-2); box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .25); }
body.pl-dragging, body.pl-dragging * { cursor: grabbing !important; user-select: none !important; }
.drafting .pl-card:not(.draft):not(.knock):not(.bad) { opacity: .7; }
.pl-card.draft { z-index: 4; color: var(--ink); border: 2px solid var(--ink); border-bottom-width: 4px; background: #fff; box-shadow: 0 8px 20px -6px rgba(35, 28, 62, .45); transform: translateY(-1px); }
.pl-card.knock { z-index: 4; color: var(--ink); border: 1.5px solid var(--amber); border-bottom: 4px solid #e0a040; background: var(--amber-bg); opacity: 1; }
.pl-card.bad { z-index: 4; color: var(--red); border: 1.5px solid var(--red); border-bottom: 4px solid var(--red); background: repeating-linear-gradient(135deg, var(--red-bg) 0 6px, #fff 6px 12px); opacity: 1; }
.pl-card.draft.blocked { color: var(--red); border-color: var(--red); border-style: dashed; background: var(--red-bg); box-shadow: none; }
.pl-tag { display: inline-block; margin-right: 4px; padding: 0 4px; font-size: 10px; line-height: 13px; color: #fff; background: #c27510; border-radius: 3px; }
.pl-row.drop-ok .pl-res, .pl-row.drop-info .pl-res { box-shadow: inset 3px 0 0 var(--ink); color: var(--ink); font-weight: 600; }
.pl-row.drop-warn .pl-res { box-shadow: inset 3px 0 0 var(--amber); color: var(--ink); font-weight: 600; }
.pl-row.drop-bad .pl-res { box-shadow: inset 3px 0 0 var(--red); color: var(--red); font-weight: 600; }
.pl-card.edited { border-color: var(--ink); animation: pl-pop .35s ease-out backwards; }

.pl-impact { position: fixed; z-index: 40; width: 320px; padding: 10px 12px; font-size: 12.5px; line-height: 17px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--ok); border-radius: 10px; box-shadow: 0 12px 32px -8px rgba(35, 28, 62, .35); pointer-events: none; }
.pl-impact.warn { border-top-color: #e0a040; }
.pl-impact.bad { border-top-color: var(--red); }
.pl-impact.pinned { pointer-events: auto; animation: pl-pop .2s ease-out; }
.pi-h { display: flex; align-items: flex-start; gap: 7px; }
.pi-h b { font-weight: 650; }
.pi-dot { width: 8px; height: 8px; flex: none; margin-top: 5px; border-radius: 50%; background: var(--ok); }
.warn .pi-dot { background: #e0a040; }
.bad .pi-dot { background: var(--red); }
.pl-impact ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.pl-impact li { display: flex; gap: 7px; color: var(--ink-2); }
.pl-impact li svg { margin-top: 2px; }
.pl-impact li.ok svg { color: var(--ok); }
.pl-impact li.info svg { color: var(--muted); }
.pl-impact li.warn { color: var(--ink); }
.pl-impact li.warn svg { color: var(--amber); }
.pl-impact li.bad { color: var(--red); font-weight: 550; }
.pl-impact li.bad svg { color: var(--red); }
.pi-go { padding: 0; font: inherit; color: inherit; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; background: none; border: 0; cursor: pointer; }
.pi-go:hover { text-decoration-style: solid; }
.pl-impact .pi-more { padding-left: 21px; color: var(--muted); font-size: 11.5px; }
.pi-block { margin: 6px 0 0; color: var(--red); }
.pi-acts { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.pi-key { margin-left: auto; font-size: 11px; color: var(--muted); }
.pl-edit { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 3px 4px 3px 10px; font-size: 12px; color: #fff; background: var(--ink); border-radius: 14px; animation: pl-pop .25s ease-out; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.pl-edit button { padding: 2px 9px; font-size: 12px; font-weight: 600; color: var(--ink); background: #fff; border: 0; border-radius: 10px; cursor: pointer; }
.pl-card.moving { z-index: 4; border: 1.5px dashed var(--amber); border-bottom: 4px solid var(--amber); background: repeating-linear-gradient(135deg, #fff8e8 0 6px, #fff 6px 12px); opacity: 1; }
.pl-moving { display: inline-block; margin-right: 3px; padding: 0 4px; font-size: 10px; line-height: 13px; color: #fff; background: var(--amber); border-radius: 3px; }
.pl-offer { display: inline-block; margin-right: 3px; padding: 0 4px; font-size: 10px; line-height: 13px; color: #fff; background: var(--brand); border-radius: 3px; }

/* Editing a job, or adding one, from a pop-over */
.pl-card[data-drag]:hover { border-color: var(--ink-2); }
.pl-row[data-res] .pl-track { cursor: cell; }
.pl-impact.editor { width: 344px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 0; border-top-width: 3px; }
.pl-impact.editor:not(.ok):not(.warn):not(.bad):not(.info) { border-top-color: var(--ink); }
.pl-impact.editor.info { border-top-color: var(--ok); }
.pe-h { display: flex; align-items: flex-start; gap: 8px; padding: 11px 12px 9px; border-bottom: 1px solid var(--line-2); }
.pe-h > div { flex: 1; min-width: 0; }
.pe-h b { display: block; font-family: 'Outfit', sans-serif; font-size: 15px; line-height: 20px; font-weight: 600; }
.pe-h small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.pe-x { width: 26px; height: 26px; flex: none; font-size: 18px; line-height: 1; color: var(--ink-2); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.pe-x:hover { background: var(--brand-50); color: var(--brand); }
.pe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px 4px; }
.pe-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pe-f.wide { grid-column: 1 / -1; }
.pe-f > span, .pe-l { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.pe-f input, .pe-f select, .pe-work select { width: 100%; min-width: 0; height: 30px; padding: 0 8px; font-size: 12.5px; color: var(--ink); background: #fff; border: 1px solid #d6d4df; border-radius: 7px; outline: 0; }
.pe-f input:focus, .pe-f select:focus, .pe-work select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.pe-step { display: flex; align-items: center; height: 30px; border: 1px solid #d6d4df; border-radius: 7px; overflow: hidden; }
.pe-step button { width: 30px; height: 100%; flex: none; font-size: 16px; color: var(--ink-2); background: #f6f5f9; border: 0; cursor: pointer; }
.pe-step button:hover { color: var(--brand); background: var(--brand-50); }
.pe-step b { flex: 1; text-align: center; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pe-work { display: flex; flex-direction: column; gap: 5px; padding: 8px 12px 10px; }
.pe-items { display: flex; flex-wrap: wrap; gap: 5px; }
.pe-item { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 9px; font-size: 12px; line-height: 18px; color: var(--ink); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 12px; animation: pl-pop .2s ease-out; }
.pe-item.base { padding-right: 9px; color: var(--ink-2); background: #f3f2f6; border-color: var(--line); }
.pe-item small { font-size: 11px; color: var(--muted); }
.pe-item button { width: 18px; height: 18px; font-size: 14px; line-height: 1; color: var(--ink-2); background: none; border: 0; border-radius: 50%; cursor: pointer; }
.pe-item button:hover { color: #fff; background: var(--red); }
.pe-empty { font-size: 12px; color: var(--muted); }
.pe-work select { color: var(--brand); font-weight: 600; }
.pe-impact { padding: 10px 12px; background: #faf9fc; border-top: 1px solid var(--line-2); }
.pe-impact ul { margin-top: 6px; }
.pe-none { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.pl-impact.editor .pi-acts { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line-2); }
.pl-impact.editor .pi-block { margin-top: 6px; }
