/* Area B – planning: shift calendar, shift list/detail, absences & replacements. Owned by the area (docs/AREAS.md) – classes prefixed "pl-",
   colours only from theme.css tokens (status --st-*). Look follows docs/mockups (employee rows, soft shift pills, assistant strip). */

/* ---------- shared bits ---------- */
.pl-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.pl-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.pl-chip:disabled { opacity: .6; cursor: default; }
.pl-flag { display: inline-flex; align-items: center; } .pl-flag.warn { color: var(--warning); }
.pl-st { gap: 6px; flex-wrap: wrap; }
.pl-av { width: 30px; height: 30px; font-size: 11px; flex: none; }
.pl-av-un { background: var(--surface-3); color: var(--text-3); }
.pl-sep { height: 1px; background: var(--border); margin: 18px 0; }
.pl-filters { gap: 8px; } .pl-filters .input.sm { width: auto; max-width: 220px; }
.pl-ok { color: var(--success); display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.pl-records { margin-top: var(--gap); }
.pl-actions { margin: 0; }
.pl-num { width: 80px; }

/* conflicts */
.pl-conflicts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pl-cf { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--info-bg); }
.pl-cf .icon { margin-top: 2px; flex: none; }
.pl-cf.err { background: var(--danger-bg); } .pl-cf.err .icon { color: var(--danger); }
.pl-cf.warn { background: var(--warning-bg); } .pl-cf.warn .icon { color: var(--warning); }
.pl-cf.info .icon { color: var(--info); }
.pl-cf-box { margin-top: 14px; }

/* ---------- shift detail ---------- */
.pl-times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pl-steps { margin-bottom: 14px; }
.pl-status-acts { gap: 8px; }
.pl-series-info { gap: 10px; align-items: center; margin-top: 4px; }
.pl-series-info > .icon { color: var(--primary); }
.pl-rec-edit { margin-top: 12px; } .pl-rec-edit summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--primary); margin-bottom: 12px; }
.pl-check:empty { display: none; }
.pl-contacts { display: flex; flex-direction: column; gap: 14px; }
.pl-contacts li { display: flex; flex-direction: column; gap: 6px; }
.pl-c-main { min-width: 0; } .pl-c-links { display: flex; flex-wrap: wrap; gap: 2px; margin-left: 30px; } .pl-c-links .btn { max-width: 100%; }
.pl-contacts li > .xs { margin-left: 38px; }
.pl-addr { margin: 8px 0 10px; }
.pl-access { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pl-codes { width: 100%; } .pl-code { font-variant-numeric: tabular-nums; letter-spacing: .06em; font-size: var(--fs-md); }
.pl-time { margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.pl-meta { line-height: 1.7; }
.pl-cl { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pl-cl-area { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface-2); }
.pl-cl-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pl-count { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--st-done-bg); color: var(--st-done); }
.pl-cl-area li { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); padding: 3px 0; }
.pl-cl-area li .icon { flex: none; margin-top: 2px; color: var(--text-3); } .pl-cl-area li.done .icon { color: var(--success); }
.pl-tag { color: var(--btn-pdf); display: inline-flex; }
.pl-rlist li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); } .pl-rlist li:last-child { border-bottom: 0; }

/* ---------- calendar ---------- */
.pl-cal { overflow: hidden; }
.pl-bar { display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--border); }
.pl-nav { gap: 6px; } .pl-date { width: 150px; }
.pl-title { font-size: var(--fs-md); margin-left: auto; }
.pl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; color: var(--text-2); }
.pl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pl-sw { width: 22px; height: 12px; border-radius: 4px; display: inline-block; }
.pl-cal-body { position: relative; }
.pl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pl-empty-note { border-top: 1px solid var(--border); }

/* status colours of shift pills (spec 8.1.5) */
.pl-s-planned { background: var(--st-planned-bg); color: var(--st-planned); }
.pl-s-progress { background: var(--st-progress-bg); color: var(--st-progress); }
.pl-s-done { background: var(--st-done-bg); color: var(--st-done); }
.pl-s-cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled); text-decoration: line-through; }
.pl-s-unassigned { background: var(--st-neutral-bg); color: var(--st-neutral); }
.pl-s-replace { background: var(--st-cancelled-bg); color: var(--st-cancelled); }

.pl-pill { display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 8px; border-radius: 8px; font-size: 12px; line-height: 1.25; text-decoration: none !important;
  border: 1px solid transparent; cursor: pointer; overflow: hidden; user-select: none; transition: box-shadow .12s, transform .12s; }
.pl-pill:hover { box-shadow: var(--shadow-sm); border-color: currentColor; }
.pl-pill:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.pl-pill[data-drag] { cursor: grab; }
.pl-pill.has-cf { border-color: var(--warning); border-style: dashed; }
.pl-pill-t { white-space: nowrap; } .pl-pill-end { opacity: .8; }
.pl-pill-p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; font-weight: 550; }
.pl-pill-i { display: inline-flex; flex: none; } .pl-pill-i .icon { width: 13px; height: 13px; }
.pl-pill.dragging { opacity: .35; }
.pl-ghost { position: fixed; z-index: 1000; pointer-events: none; box-shadow: var(--shadow-lg); transform: rotate(-1.5deg); }
body.pl-dragging, body.pl-dragging * { cursor: grabbing !important; user-select: none; }
.pl-drop { outline: 2px dashed var(--primary); outline-offset: -3px; background: var(--primary-soft) !important; }

/* resource view (one row per employee) */
.pl-res { width: 100%; min-width: 860px; border-collapse: collapse; table-layout: fixed; }
.pl-res th, .pl-res td { border-bottom: 1px solid var(--border); padding: 8px; vertical-align: top; text-align: left; }
.pl-res thead th { background: var(--surface-2); font-size: var(--fs-sm); font-weight: 650; color: var(--text-2); }
.pl-res thead th.today { color: var(--primary); }
.pl-res th.pl-emp { width: 190px; }
.pl-res tbody th.pl-emp { font-weight: 400; }
.pl-emp-in { display: flex; gap: 10px; align-items: flex-start; }
.pl-emp-n { display: flex; flex-direction: column; min-width: 0; } .pl-emp-n b { font-size: var(--fs-sm); }
.pl-over { color: var(--danger); font-weight: 650; }
.pl-cell { position: relative; min-height: 46px; height: 1px; }
.pl-cell.today { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.pl-cell-list { display: flex; flex-direction: column; gap: 4px; }
.pl-absent { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--surface-3) 8px 10px); }
.pl-abs-tag { display: inline-block; font-size: 11px; font-weight: 650; color: var(--st-cancelled); margin-bottom: 4px; }
.pl-un th .pl-emp-n b { color: var(--text-2); }
.pl-add { position: absolute; right: 4px; bottom: 4px; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--text-3); opacity: 0; transition: opacity .12s; }
.pl-add .icon { width: 14px; height: 14px; }
.pl-cell:hover .pl-add, .pl-add:focus-visible { opacity: 1; background: var(--surface-3); }
@media (hover: none) { .pl-add { opacity: .6; } }
.pl-cell { padding-bottom: 30px !important; }

/* time grid (week / day) */
.pl-tg { min-width: 760px; } .pl-tg.one { min-width: 0; }
.pl-tg-head, .pl-tg-body { display: grid; grid-template-columns: 54px repeat(var(--cols), minmax(0, 1fr)); }
.pl-tg-head > div { padding: 8px; font-size: var(--fs-sm); font-weight: 650; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.pl-tg-head .today .pl-daylink { color: var(--primary); }
.pl-daylink { background: none; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--text-2); cursor: pointer; }
.pl-daylink:hover { color: var(--primary); text-decoration: underline; }
.pl-hours { position: relative; } .pl-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--text-3); }
.pl-hours span:first-child { transform: none; }
.pl-tcol { position: relative; border-left: 1px solid var(--border); }
.pl-tcol.today { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.pl-hline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.pl-pos { position: absolute; flex-direction: column; align-items: flex-start; gap: 1px; padding: 4px 6px; }
.pl-pos .pl-pill-p { white-space: normal; flex: none; }
.pl-col-abs { position: absolute; left: 4px; right: 4px; bottom: 4px; display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--st-cancelled); }

/* month */
.pl-month { min-width: 760px; }
.pl-m-head, .pl-m-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pl-m-head div { padding: 8px; font-size: var(--fs-sm); font-weight: 650; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.pl-m-cell { min-height: 118px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.pl-m-cell:nth-child(7n) { border-right: 0; }
.pl-m-cell.other { background: var(--surface-2); } .pl-m-cell.other .pl-m-day { color: var(--text-3); }
.pl-m-cell.today .pl-m-day { background: var(--primary); color: var(--on-primary); }
.pl-m-day { align-self: flex-start; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; }
.pl-m-cell .pl-pill { min-height: 22px; padding: 2px 6px; font-size: 11.5px; }
.pl-more { background: none; border: 0; padding: 0; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; }

/* assistant strip + conflict panel */
.pl-assist { margin-top: var(--gap); }
.pl-assist .card-body { gap: 14px; }
.pl-assist-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.pl-assist-txt { flex: 1; min-width: 220px; font-size: var(--fs-sm); }
.pl-cf-panel { margin-top: var(--gap); }
.pl-cf-rows > li { padding: 8px 0; border-bottom: 1px solid var(--border); } .pl-cf-rows > li:last-child { border-bottom: 0; }
.pl-move { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0; }
.pl-move > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); min-width: 200px; flex: 1; }

/* ---------- absences & replacement assistant ---------- */
.pl-tabs { margin-top: -4px; }
.pl-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.pl-cand-bar { border-bottom: 1px solid var(--border); gap: 10px; }
.pl-cands > li { display: grid; grid-template-columns: auto auto minmax(0, 1fr) 130px auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.pl-cands > li:last-child { border-bottom: 0; }
.pl-cand.weak { background: var(--surface-2); }
.pl-cand-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pl-reasons { display: flex; flex-wrap: wrap; gap: 4px; }
.pl-score { display: flex; align-items: center; gap: 8px; }
.pl-score-n { font-weight: 700; font-variant-numeric: tabular-nums; width: 28px; text-align: right; }
.pl-meter { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.pl-meter span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.pl-offers li { display: flex; align-items: center; gap: 10px; padding: 6px 0; } .pl-offers li > div { flex: 1; min-width: 0; }
.pl-hist { position: relative; display: flex; flex-direction: column; gap: 12px; }
.pl-hist li { display: flex; gap: 10px; font-size: var(--fs-sm); }
.pl-hist-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.pl-rdl { grid-template-columns: minmax(110px, 30%) 1fr; }

@media (max-width: 760px) {
  .pl-title { margin-left: 0; width: 100%; }
  .pl-filters .input.sm { max-width: 100%; flex: 1 1 140px; }
  .pl-cands > li { grid-template-columns: auto auto minmax(0, 1fr); }
  .pl-cands > li .pl-score { grid-column: 3; } .pl-cands > li [data-assign] { grid-column: 3; justify-self: start; }
  .pl-times { grid-template-columns: 1fr 1fr; }
  .pl-move > div { min-width: 0; }
}

/* compact pills (resource + month): time on the first line, property wraps to at most two lines */
.pl-compact { flex-wrap: wrap; row-gap: 0; position: relative; padding-right: 22px; }
.pl-compact .pl-pill-p { flex-basis: 100%; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 500; }
.pl-compact .pl-pill-i { position: absolute; top: 4px; right: 5px; }
