/* Planning a week and the Team page: rules, your changes, and people's details. */

.chip-toggles { display: flex; flex-wrap: wrap; gap: 6px; }

/* The location's rules. */
details.plan-rules > summary { cursor: pointer; list-style: none; }
details.plan-rules > summary::-webkit-details-marker { display: none; }
.rule-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--border); }
.rule-row:first-child { border-top: 0; }
.rule-row > label { flex-wrap: nowrap; align-items: flex-start; }
.rule-row > label > input { margin-top: 3px; flex-shrink: 0; }
.rule-row.off { color: var(--text-secondary); }
.rule-row.off span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.rule-editor { padding: 12px 14px 14px; border-top: 1px dashed var(--border); background: var(--page); gap: 10px; }
.rule-field { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: start; }
.rule-field > .small.bold { padding-top: 6px; }

/* Your changes, kept through redrafts. */
.change-row { display: grid; grid-template-columns: 92px 170px minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 12px; align-items: center;
    padding: 8px 14px; border-top: 1px solid var(--border); }
.change-row:first-child { border-top: 0; }
.change-row .chip { min-width: 0; }
.add-shift { gap: 8px; flex-wrap: wrap; align-items: center; }
.add-shift select, .add-shift input { width: auto; }
.shift-edit { gap: 6px; flex-wrap: wrap; align-items: center; }
.shift-edit input, .shift-edit select { width: auto; }
.notice.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok-ink) 30%, transparent); color: var(--ok-ink); }

/* A drafted shift set by hand: kept on every redraft. */
.wg-chip.locked .wg-time::before { content: "📌 "; font-size: .85em; }

/* The Team page. */
.people-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.person-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; width: 100%; text-align: left; padding: 10px 14px;
    border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; color: var(--text); cursor: pointer; }
.person-row:first-of-type { border-top: 0; }
.person-row:hover { background: var(--fill-muted); }
.person-row.on { background: var(--brand-soft); }
.person-row .person-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.tag-pill { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--fill-muted); color: var(--text-secondary); white-space: nowrap; }
.tag-pill.star { background: #FBE7A1; color: #6B4E00; }
.tag-pill.age21 { background: var(--ok-soft); color: var(--ok-ink); }
.tag-pill.warn { background: var(--danger-soft); color: var(--danger-ink); }
.person-field { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); }
.person-field:first-of-type { border-top: 0; }
.person-field > .label { font-weight: 600; font-size: 13px; padding-top: 6px; }
.day-prefs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-pref { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--page); color: var(--text); cursor: pointer; font-size: 12px; }
.day-pref.like { background: var(--ok-soft); border-color: var(--ok-ink); color: var(--ok-ink); }
.day-pref.avoid { background: var(--danger-soft); border-color: var(--red); color: var(--danger-ink); }
.unavail-list { display: flex; flex-direction: column; gap: 4px; }
.unavail-list .row { gap: 10px; }
@media (max-width: 900px) {
    .people-layout { grid-template-columns: 1fr; }
    .person-field { grid-template-columns: 1fr; gap: 4px; }
    .change-row { grid-template-columns: auto minmax(0, 1fr) auto; }
    .change-row > :nth-child(3), .change-row > :nth-child(4) { grid-column: 1 / -1; }
}

/* A person's name, linking to their page: underlined so it reads as a link, above a card's own link. */
a.person-link { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); position: relative; z-index: 1; }
a.person-link:hover { text-decoration-color: currentColor; }
a.person-row { text-decoration: none; }
.people-back { display: none; }
@media (max-width: 900px) {
    /* On a phone, someone's page takes the screen; the list is a tap back. */
    .people-layout.has-person > :first-child { display: none; }
    .people-back { display: inline; }
}

/* A message's place in Sling, opened in a new tab; above a card's own link. */
a.sling-link { margin-left: 6px; white-space: nowrap; color: var(--text-secondary); position: relative; z-index: 1; }
a.sling-link:hover { color: var(--brand-ink); }

/* An unavailability request on a week: hatched where they can't work, their shifts over it, clashes outlined. */
.avail-week { flex-basis: 100%; display: flex; flex-direction: column; gap: 8px; padding: 10px 0 4px; }
.aw-key { display: flex; gap: 12px; flex-wrap: wrap; }
.aw-key i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.aw-grid { display: grid; grid-template-columns: 34px repeat(7, minmax(0, 1fr)); gap: 4px; }
.aw-axis { position: relative; margin-top: 34px; height: 300px; }
.aw-axis span { position: absolute; right: 2px; transform: translateY(-50%); font-size: 10px; color: var(--text-secondary); }
.aw-day { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.aw-head { height: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; border-radius: 6px; }
.aw-day.today .aw-head { background: var(--brand-soft); }
.aw-col { position: relative; height: 300px; border-radius: 6px; background: var(--fill-muted); overflow: hidden; }
.aw-line { position: absolute; left: 0; right: 0; height: 1px; background: color-mix(in srgb, var(--text) 7%, transparent); }
.aw-block { position: absolute; left: 3px; right: 3px; border-radius: 4px; overflow: hidden; }
.aw-off, .aw-key i.aw-off { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--red) 55%, transparent) 0 5px, color-mix(in srgb, var(--red) 22%, transparent) 5px 10px); }
.aw-block.aw-off { left: 0; right: 0; border-radius: 0; }
.aw-shift { left: 18%; right: 3px; color: #fff; font-size: 10px; font-weight: 600; padding: 2px 4px; line-height: 1.2; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.aw-key i.aw-shift { background: #2466BC; }
.aw-shift.clash, .aw-key i.aw-clash { outline: 2px solid var(--red); outline-offset: 1px; }
.aw-key i.aw-clash { background: #2466BC; }
.aw-shift span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
    .aw-grid { grid-template-columns: 26px repeat(7, minmax(0, 1fr)); gap: 2px; }
    .aw-col, .aw-axis { height: 240px; }
    .aw-shift span { display: none; }
}

/* Someone's month: hatched days they can't work, the hours of part days, their shifts. */
.person-cal { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pc-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pc-dow { text-align: center; color: var(--text-secondary); font-weight: 600; }
.pc-day { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-height: 76px; min-width: 0; padding: 4px; border-radius: 6px;
    border: 1px solid var(--border); background: var(--page); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.pc-day:hover { border-color: var(--text-secondary); }
.pc-day.other { opacity: .45; }
.pc-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.pc-date { font-size: 12px; font-weight: 700; }
.pc-tag, .pc-shift { font-size: 10px; font-weight: 600; line-height: 1.3; padding: 1px 4px; border-radius: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A day they can't work at all: red, hatched, so it reads from across the month. */
.pc-day.aw-off { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--red) 45%, transparent) 0 6px, color-mix(in srgb, var(--red) 22%, transparent) 6px 12px);
    border-color: color-mix(in srgb, var(--red) 70%, transparent); }
.pc-day.aw-off .pc-tag { background: var(--red); color: #fff; align-self: flex-start; }
/* Part of a day: the hours on solid red, the rest of the pill hatched. */
.pc-part { display: flex; border-radius: 3px; overflow: hidden; min-width: 0;
    background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--red) 55%, transparent) 0 4px, color-mix(in srgb, var(--red) 18%, transparent) 4px 8px); }
.pc-part > span { flex: none; max-width: 100%; padding: 1px 5px; font-size: 10px; font-weight: 600; line-height: 1.3; color: #fff; background: var(--red);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-shift { color: #fff; }
.pc-shift.clash { outline: 2px solid var(--red); outline-offset: 0; }
@media (max-width: 700px) {
    .pc-day { min-height: 52px; padding: 2px; }
    .pc-tag, .pc-shift, .pc-part > span { font-size: 9px; padding: 0 2px; }
}

/* Someone's unavailability as set in Sling, changed from their page. */
.unavail-sets { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; }
.unavail-set { gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.unavail-set:first-child { border-top: 0; }
.unavail-form { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--page); }
.aw-col.clickable { cursor: pointer; }
.aw-col.clickable:hover { box-shadow: inset 0 0 0 2px var(--text-secondary); }
.pc-day.picked { box-shadow: inset 0 0 0 2px var(--text); }
.unavail-preview { padding: 10px 12px; border: 1px solid var(--ok-ink); border-radius: 8px; background: var(--ok-soft); }
.unavail-preview textarea { width: 100%; resize: vertical; }

/* Editing a week of unavailability: blocks with grab edges, a ✕, and a ghost while drawing. */
.ae-week .ae-col { cursor: crosshair; touch-action: none; user-select: none; }
.ae-week .ae-shift { pointer-events: none; opacity: .9; z-index: 1; }
.ae-week .ae-block { left: 0; right: 0; border-radius: 3px; z-index: 2; cursor: default; display: flex; flex-direction: column; justify-content: space-between; }
.ae-week .ae-block:hover { outline: 2px solid var(--red); outline-offset: -2px; }
.ae-handle { display: block; height: 8px; flex: none; cursor: ns-resize; }
.ae-handle:hover, .ae-block:hover .ae-handle { background: color-mix(in srgb, var(--red) 70%, transparent); }
.ae-label { font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / .5); padding: 0 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; }
.ae-x { position: absolute; top: 6px; right: 3px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; font-size: 10px; line-height: 18px;
    background: rgb(0 0 0 / .45); color: #fff; cursor: pointer; display: none; }
.ae-block:hover .ae-x { display: block; }
.ae-ghost { position: absolute; left: 0; right: 0; border-radius: 3px; z-index: 3; pointer-events: none;
    background: color-mix(in srgb, var(--red) 35%, transparent); outline: 2px dashed var(--red); outline-offset: -2px; }
.aw-day.changed .aw-head { background: color-mix(in srgb, var(--red) 15%, transparent); }
.aw-day.changed .aw-head::after { content: "changed"; font-size: 9px; font-weight: 700; color: var(--red); }

/* A picture of someone's week to send them. */
.card-panel { gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--page); }
.card-picture { width: 100%; max-width: 640px; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.card-panel textarea { width: 100%; }

/* Who can't take a shift, by why. */
.cant-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 8px; }
.cant-group { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--page); }
.cant-kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); margin-bottom: 2px; }
.cant-row { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: 8px; align-items: baseline; }
.cant-row .small { color: var(--text-secondary); }
