/* All controls are scoped to this feature; appearance modes use local tokens. */
.crew-muster-delegation {
  --delegation-bg:var(--d26-surface,#fff);
  --delegation-soft:var(--d26-surface-soft,#f3f7fb);
  --delegation-ink:var(--d26-ink,#19334a);
  --delegation-muted:var(--d26-muted,#526b80);
  --delegation-line:var(--d26-border,#c6d6e2);
  --delegation-accent:var(--d26-navy-800,#214f75);
  --delegation-active:#e6f0f8;
  --delegation-error:#9e293b;
  --delegation-warning:#79500c;
  width:100%;min-width:0;margin:0 0 24px;padding:24px;
  border:1px solid var(--delegation-line);border-radius:16px;
  background:var(--delegation-bg);color:var(--delegation-ink);line-height:1.6;
}
.crew-muster-delegation,.crew-muster-delegation * {box-sizing:border-box;min-width:0;}
.crew-muster-delegation-heading {display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:20px;}
.crew-muster-delegation-heading h2 {margin:0 0 8px;color:var(--delegation-ink);font-size:22px;line-height:1.4;}
.crew-muster-delegation-heading p,.crew-muster-delegation-detail {margin:0;color:var(--delegation-muted);font-size:14px;line-height:1.6;overflow-wrap:break-word;}
.crew-muster-delegation-button {
  appearance:none;display:inline-flex;align-items:center;justify-content:center;
  max-width:100%;min-width:44px;min-height:44px;padding:10px 16px;
  border:1px solid var(--delegation-line);border-radius:9px;box-shadow:none;
  background:var(--delegation-bg);color:var(--delegation-ink);font:inherit;
  font-size:14px;font-weight:650;line-height:1.5;text-align:center;white-space:normal;
  cursor:pointer;flex-shrink:0;
}
.crew-muster-delegation-button:hover:not(:disabled) {background:var(--delegation-active);border-color:var(--delegation-accent);}
.crew-muster-delegation-button.is-primary {background:var(--delegation-accent);border-color:var(--delegation-accent);color:#fff;}
.crew-muster-delegation-button.is-primary:hover:not(:disabled) {filter:brightness(.92);}
.crew-muster-delegation-button:disabled {opacity:.55;cursor:default;}
.crew-muster-delegation-button:focus-visible,.crew-muster-delegation-field input:focus-visible,.crew-muster-delegation-candidate:has(input:focus-visible) {outline:3px solid var(--delegation-accent);outline-offset:3px;}
.crew-muster-delegation-message {padding:16px;border:1px solid var(--delegation-line);border-radius:9px;background:var(--delegation-soft);color:var(--delegation-muted);font-size:14px;overflow-wrap:break-word;margin:0 0 16px;}
.crew-muster-delegation-message:last-child {margin-bottom:0;}
.crew-muster-delegation-message p {margin:0;}
.crew-muster-delegation-message p+p {margin-top:8px;}
.crew-muster-delegation-message.is-error {border-color:var(--delegation-error);color:var(--delegation-error);}
.crew-muster-delegation-grants {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;}
.crew-muster-delegation-grants>.crew-muster-delegation-message {grid-column:1/-1;}
.crew-muster-delegation-grant {padding:20px;border:1px solid var(--delegation-line);border-radius:12px;background:var(--delegation-soft);}
.crew-muster-delegation-grant-heading {display:flex;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;margin-bottom:8px;}
.crew-muster-delegation-grant h3 {margin:0;color:var(--delegation-ink);font-size:18px;line-height:1.5;overflow-wrap:break-word;}
.crew-muster-delegation-floor {font-size:13px;font-weight:650;white-space:nowrap;}
.crew-muster-delegation-nights {list-style:none;padding:0;margin:12px 0;display:grid;gap:8px;}
.crew-muster-delegation-nights li {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;font-size:14px;}
.crew-muster-delegation-nights time {font-weight:650;white-space:nowrap;}
.crew-muster-delegation-confirm {border-top:1px solid var(--delegation-line);padding-top:16px;margin-top:16px;}
.crew-muster-delegation-confirm p {margin:0 0 8px;font-size:14px;overflow-wrap:break-word;}
.crew-muster-delegation-actions {display:flex;flex-wrap:wrap;gap:12px;margin-top:16px;}
.crew-muster-delegation-toolbar {display:flex;flex-wrap:wrap;gap:12px;margin-top:20px;}
.crew-muster-delegation-form {border-top:1px solid var(--delegation-line);padding-top:24px;margin-top:24px;}
.crew-muster-delegation-form>h3 {margin:0 0 8px;font-size:18px;line-height:1.5;}
.crew-muster-delegation-form>.crew-muster-delegation-detail {margin-bottom:20px;}
.crew-muster-delegation-field {display:grid;gap:8px;align-content:start;}
.crew-muster-delegation-field>span {font-size:14px;font-weight:650;}
.crew-muster-delegation-field input {display:block;width:100%;max-width:100%;min-width:0;min-height:48px;padding:12px;border:1px solid var(--delegation-line);border-radius:8px;background:var(--delegation-bg);color:var(--delegation-ink);font:inherit;font-size:16px;line-height:1.5;}
.crew-muster-delegation-field input::placeholder {color:var(--delegation-muted);opacity:1;}
.crew-muster-delegation-field input:disabled {opacity:.6;}
.crew-muster-delegation-candidates {border:0;padding:0;margin:20px 0;min-inline-size:0;}
.crew-muster-delegation-candidates legend {padding:0;margin-bottom:12px;font-size:14px;font-weight:650;}
/* Auto rows retain their natural height inside the scrolling area. */
.crew-muster-delegation-candidate-list {display:grid;grid-auto-rows:max-content;align-content:start;gap:10px;max-height:360px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;padding:4px;}
.crew-muster-delegation-candidate {display:flex;align-items:flex-start;gap:12px;min-height:64px;padding:16px;border:1px solid var(--delegation-line);border-radius:9px;background:var(--delegation-bg);cursor:pointer;flex-shrink:0;}
.crew-muster-delegation-candidate.is-selected {border-color:var(--delegation-accent);background:var(--delegation-active);}
.crew-muster-delegation-candidate.is-unavailable {cursor:default;}
.crew-muster-delegation-candidate input[type=radio] {appearance:auto;-webkit-appearance:radio;position:static;transform:none;flex:0 0 22px;width:22px;height:22px;min-width:22px;min-height:22px;max-width:22px;max-height:22px;padding:0;margin:2px 0 0;border:0;border-radius:50%;accent-color:var(--delegation-accent);}
.crew-muster-delegation-candidate>span {display:grid;gap:4px;}
.crew-muster-delegation-candidate strong {font-size:15px;line-height:1.5;overflow-wrap:break-word;}
.crew-muster-delegation-candidate small {font-size:13px;line-height:1.5;color:var(--delegation-muted);overflow-wrap:break-word;}
.crew-muster-delegation-candidate .crew-muster-delegation-unavailable {color:var(--delegation-error);}
.crew-muster-delegation-candidate .crew-muster-delegation-warning {color:var(--delegation-warning);}
.crew-muster-delegation-dates {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin:20px 0 12px;}
.crew-muster-delegation-submit {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px;border-top:1px solid var(--delegation-line);padding-top:20px;margin-top:20px;}
.crew-muster-delegation-submit p {margin:0;color:var(--delegation-muted);font-size:14px;overflow-wrap:break-word;}
html[data-crew-mode=dark] .crew-muster-delegation {--delegation-bg:var(--d26-surface,#1a2937);--delegation-soft:var(--d26-surface-soft,#243747);--delegation-ink:var(--d26-ink,#e5edf5);--delegation-muted:#b8cbda;--delegation-line:#526d81;--delegation-accent:#315e80;--delegation-active:#29485f;--delegation-error:#ffbbc5;--delegation-warning:#ffdf95;color-scheme:dark;}
html[data-crew-mode=dark] .crew-muster-delegation-button:focus-visible,html[data-crew-mode=dark] .crew-muster-delegation-field input:focus-visible,html[data-crew-mode=dark] .crew-muster-delegation-candidate:has(input:focus-visible) {outline-color:#a8d0ef;}
html[data-crew-mode=accessible] .crew-muster-delegation {--delegation-bg:#fff;--delegation-soft:#fff;--delegation-ink:#000;--delegation-muted:#000;--delegation-line:#000;--delegation-accent:#000;--delegation-active:#fff;--delegation-error:#000;--delegation-warning:#000;font-size:18px;line-height:1.7;border-width:2px;color-scheme:light;}
html[data-crew-mode=accessible] .crew-muster-delegation :is(p,small,legend,li,time,.crew-muster-delegation-floor,.crew-muster-delegation-field>span) {font-size:18px;line-height:1.7;}
html[data-crew-mode=accessible] .crew-muster-delegation :is(h2,h3,strong,button,input) {font-size:20px;line-height:1.6;}
html[data-crew-mode=accessible] .crew-muster-delegation :is(button,.crew-muster-delegation-grant,.crew-muster-delegation-message,.crew-muster-delegation-field input,.crew-muster-delegation-candidate) {border-width:2px;}
html[data-crew-mode=accessible] .crew-muster-delegation-candidate.is-selected {outline:2px solid #000;outline-offset:-5px;}
html[data-crew-mode=accessible] .crew-muster-delegation-grants {grid-template-columns:minmax(0,1fr);}
.muster-delegation-home.section-card {min-width:0;margin-bottom:24px;}
.muster-delegation-home.section-card h2 {margin-bottom:12px;}
.muster-delegation-home.section-card :is(p,small) {line-height:1.6;overflow-wrap:break-word;}
.muster-delegation-home.section-card small {display:block;margin:12px 0;}
.muster-delegation-home.section-card button {min-height:44px;max-width:100%;white-space:normal;}
.muster-delegate-toolbar :is(select,button) {min-height:44px;min-width:44px;}
/* One neutral absence color for temporary conductors, regardless of reason. */
html .roster.roster-muster-delegate tbody tr.color-excused:nth-child(n) {--row-bg:#e5e7eb;--row-pattern:none;}
html[data-crew-mode=dark] .roster.roster-muster-delegate tbody tr.color-excused:nth-child(n) {--row-bg:#374151;}
html[data-crew-mode=accessible] .roster.roster-muster-delegate tbody tr.color-excused:nth-child(n) {--row-bg:#fff;}
.muster-delegate-legend .legend-excused {background:#9ca3af;flex-shrink:0;}
html[data-crew-mode=dark] .muster-delegate-legend .legend-excused {background:#9ca3af;}
html[data-crew-mode=accessible] .muster-delegate-legend .legend-excused {background:#fff;border:2px solid #000;}
html[data-crew-mode=dark] .muster-delegation-home.section-card {background:var(--d26-surface,#1a2937);color:var(--d26-ink,#e5edf5);border-color:#526d81;}
html[data-crew-mode=accessible] .muster-delegation-home.section-card {background:#fff;color:#000;border:2px solid #000;}
html[data-crew-mode=accessible] .muster-delegation-home.section-card :is(p,small,button) {font-size:18px;line-height:1.7;}
html[data-crew-mode=accessible] .muster-delegation-home.section-card button {border:2px solid #000;}
@media (max-width:700px) {
  .crew-muster-delegation {padding:20px 16px;}
  .crew-muster-delegation-heading {flex-wrap:wrap;gap:16px;}
  .crew-muster-delegation-grants,.crew-muster-delegation-dates {grid-template-columns:minmax(0,1fr);}
  .crew-muster-delegation-grant {padding:16px;}
  .crew-muster-delegation-submit {align-items:stretch;flex-direction:column;}
  .crew-muster-delegation-actions {display:grid;grid-template-columns:minmax(0,1fr);}
}
@media (max-width:390px) {
  .crew-muster-delegation {padding:16px 12px;}
  .crew-muster-delegation-candidate {padding:12px;gap:10px;}
}
