/* Deliverable detail: all existing controls stay visible, grouped by workflow. */
.planner-deliverable-card { width: min(1120px, 100%); }
.planner-deliverable-header { gap: 20px; }
.planner-deliverable-header-side { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.planner-deliverable-comment { display:flex; flex-direction:column; gap:4px; min-width:220px; max-width:320px; flex-basis:100%; order:1; }
.planner-deliverable-comment > span { font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--color-text-muted); }
.planner-deliverable-comment-text { margin:0; font-size:12px; line-height:1.4; color:var(--color-text-primary); white-space:pre-wrap; word-break:break-word; max-height:64px; overflow:auto; }
.planner-deliverable-comment-text.is-unset { color:var(--color-text-muted); font-style:italic; }
.planner-deliverable-comment-input { width:100%; resize:vertical; min-height:44px; max-height:140px; padding:6px 8px; border:1px solid var(--color-border); border-radius:6px; background:var(--color-bg-tertiary); color:var(--color-text-primary); font:inherit; font-size:12px; line-height:1.4; }
.planner-deliverable-comment-input:focus { outline:none; border-color:var(--color-primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent); }
.planner-deliverable-comment-meta { font-size:10px; color:var(--color-text-muted); }
.planner-stage-chips { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.planner-stage-chip { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-height: 46px; padding: 7px 4px; border-radius: 7px; white-space: normal; text-align: center; }
.planner-stage-chip .planner-stage-name { font: inherit; line-height: 1.2; }
.planner-deliverable-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 24px; }
.planner-deliverable-main, .planner-deliverable-sidebar { min-width: 0; max-width: none; width: auto; }
.planner-deliverable-sidebar { position: static; display: flex; flex-direction: column; gap: 24px; padding-left: 24px; border-left: 1px solid #e2e8f0; }
.planner-action-heading { display: flex; align-items: center; gap: 9px; }
.planner-action-heading .planner-counter { padding: 3px 7px; border-radius: 5px; background: #eef3f9; }
.planner-section-row .planner-action-total { display: flex; align-items: center; gap: 9px; margin: 0; padding: 0; border: 0; }
.planner-action-progress { margin-top: 10px; }
.planner-action-list { margin-top: 8px; }
.planner-action-add { margin-top: 16px; padding: 14px; border-style: solid; border-color: #dce5f0; border-radius: 9px; background: #f7f9fc; }
.planner-action-add-row:not(.planner-action-form-actions) { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.25fr); gap: 12px; }
.planner-action-add-row .planner-action-field { min-width: 0; }
.planner-action-field input, .planner-action-field select { box-sizing: border-box; width: 100%; min-width: 0; }
.planner-action-add-row .planner-action-priority-toggle { justify-content: center; min-width: 0; margin: 0; }
.planner-action-add-footer { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-top: 12px; }
.planner-action-add-footer > .planner-action-repeat { flex: 1; min-width: 220px; margin-top: 0; }
.planner-action-add-footer .planner-action-form-actions { margin: 0 0 0 auto; }
.planner-notes-section { padding: 0; }
.planner-note-compose { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 10px; }
.planner-note-compose textarea { box-sizing: border-box; width: 100%; min-height: 130px; background: #fff; line-height: 1.55; padding: 11px 12px; resize: vertical; }
.planner-note-side { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(130px, 1.15fr); align-items: end; width: 100%; gap: 12px; }
.planner-note-side > button { min-height: 36px; }
.planner-note-hours { min-width: 0; }
.planner-note-hours-col { min-width: 0; }
.planner-note-hours input { box-sizing: border-box; width: 100%; min-width: 0; }
.planner-note-list { margin-top: 16px; }
.planner-history-section { padding-top: 20px; border-top: 1px solid #e2e8f0; }
.planner-history-copy, .planner-note-copy { min-width: 0; }
.planner-history-copy > .planner-history-note { display: block; }
.planner-history-note, .planner-note-text, .drawing-history-note { overflow-wrap: anywhere; }
.planner-history-note { line-height: 1.5; }
.planner-deliverable-card button:focus-visible, .planner-deliverable-card input:focus-visible, .planner-deliverable-card textarea:focus-visible, .planner-deliverable-card select:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.planner-action-priority-toggle:has(input:focus-visible) { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Stored notes remain plain text; these styles are shared with full history. */
.deliverable-note-record { font-size: 12px; line-height: 1.55; color: #334155; overflow-wrap: anywhere; text-align: left; }
.deliverable-note-record .deliverable-note-heading { margin: 13px 0 5px; color: #64748b; font: 700 10px/1.4 'Barlow', sans-serif; letter-spacing: .065em; text-transform: uppercase; }
.deliverable-note-record .deliverable-note-heading:first-child { margin-top: 0; }
.deliverable-note-record .deliverable-note-heading.is-overrun { color: #b45309; border-top: 1px solid #fde6c0; padding-top: 10px; }
.deliverable-note-title { font-weight: 600; color: #172b46; margin-bottom: 6px; }
.deliverable-note-fact { display: block; margin: 2px 0; }
.deliverable-note-fact > span { color: #64748b; }
.deliverable-note-prose { margin: 0; white-space: normal; }

.planner-completion-dialog { box-sizing: border-box; width: min(530px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 24px; border: 1px solid #dbe4f0; border-radius: 12px; background: #fff; color: #263952; box-shadow: 0 24px 80px #10244540; font: 14px/1.5 'Barlow', sans-serif; overflow-y: auto; }
.planner-completion-dialog::backdrop { background: #14253e80; }
.planner-completion-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.planner-completion-head h4 { margin: 0; color: #172b46; font-size: 21px; }
.planner-completion-head button { border: 1px solid #dbe4f0; background: #fff; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 20px; color: #64748b; }
.planner-completion-task { font-weight: 600; overflow-wrap: anywhere; }
.planner-completion-facts { padding: 14px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f7f9fc; margin-bottom: 18px; }
.planner-completion-facts > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 5px 12px; margin: 3px 0; font-size: 12px; }
.planner-completion-facts dt { color: #64748b; }
.planner-completion-facts dd { margin: 0; overflow-wrap: anywhere; }
.planner-completion-dialog label { display: block; font-weight: 600; margin-bottom: 6px; }
.planner-completion-dialog label span { color: #b91c1c; }
.planner-completion-dialog textarea { box-sizing: border-box; width: 100%; min-height: 116px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 7px; font: inherit; resize: vertical; }
.planner-completion-dialog textarea:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.planner-completion-dialog textarea[aria-invalid=true] { border-color: #dc2626; }
#plannerCompletionHelp { margin: 5px 0 0; color: #64748b; font-size: 12px; }
.planner-completion-error { color: #b91c1c; font-size: 13px; margin: 8px 0 0; }
.planner-completion-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.planner-completion-actions button { padding: 9px 15px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; color: #334155; font: 600 13px 'Barlow', sans-serif; cursor: pointer; }
.planner-completion-actions button[type=submit] { background: #2563eb; border-color: #2563eb; color: #fff; }
.planner-completion-actions button:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.planner-completion-actions button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 920px) {
    .planner-stage-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .planner-deliverable-body { gap: 18px; }
    .planner-deliverable-sidebar { padding-left: 18px; }
}
@media (max-width: 760px) {
    .planner-deliverable-modal-overlay { padding: 12px 8px; }
    .planner-deliverable-card { max-height: calc(100dvh - 24px); }
    .planner-deliverable-body { grid-template-columns: minmax(0, 1fr); padding: 18px 16px; gap: 24px; }
    .planner-deliverable-sidebar { padding-left: 0; padding-top: 20px; border-left: 0; border-top: 1px solid #e2e8f0; }
    .planner-deliverable-header { padding: 16px; gap: 12px; }
    .planner-deliverable-title-row { flex-wrap: wrap; }
    .planner-deliverable-drawing-type { max-width: 110px; }
    .planner-note-side { width: 100%; }
}
@media (max-width: 410px) {
    .planner-stage-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .planner-deliverable-header { flex-wrap: wrap; }
    .planner-action-add-row:not(.planner-action-form-actions) { grid-template-columns: minmax(0, 1fr); }
    .planner-action-add-footer > .planner-action-repeat { min-width: 0; flex-basis: 100%; }
    .planner-note-side { grid-template-columns: minmax(0, 1fr); }
    .planner-completion-dialog { padding: 18px; }
}

/* Tags, top-right of the deliverable window (Junaid, 2026-09-24). */
.planner-deliverable-header-tags { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 320px; text-align: right; }
.planner-deliverable-header-tags > span { color: #94a3b8; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.planner-deliverable-header-tags strong.is-unset { color: #94a3b8; font-size: 13px; font-weight: 500; font-style: italic; }
.planner-header-tag-list { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px; }
.planner-header-tag { padding: 0; gap: 0; overflow: hidden; }
.planner-header-tag button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.planner-header-tag-name { padding: 2px 5px 2px 8px; }
.planner-header-tag-name:hover, .planner-header-tag-name:focus-visible { text-decoration: underline; }
.planner-header-tag-x { padding: 2px 7px 2px 1px; opacity: 0.6; font-size: 12px; line-height: 1; }
.planner-header-tag-x:hover, .planner-header-tag-x:focus-visible { opacity: 1; }
.planner-header-tag-add { min-height: 20px; padding: 2px 8px; border: 1px dashed #cbd5e1; border-radius: 999px; background: #fff; color: #475569; font-size: 10px; font-weight: 600; cursor: pointer; }
.planner-header-tag-add:hover, .planner-header-tag-add:focus-visible { border-color: #2563eb; color: #2563eb; }
.planner-tag-picker { position: fixed; z-index: 11050; width: 240px; padding: 8px; border: 1px solid #e2e8f0; border-radius: 9px; background: #fff; box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18); }
.planner-tag-picker-input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 12px; background: #fff; color: #0f172a; caret-color: #0f172a; -webkit-text-fill-color: #0f172a; }
/* The picker is always white, so its box must not inherit the dark theme's light input text. */
.planner-tag-picker-input::placeholder { color: #64748b; -webkit-text-fill-color: #64748b; opacity: 1; }
.planner-tag-picker-input:focus { outline: 2px solid rgba(37, 99, 235, 0.35); border-color: #2563eb; }
.planner-tag-picker-list { max-height: 220px; margin-top: 6px; overflow-y: auto; }
.planner-tag-picker-option { display: flex; align-items: center; gap: 7px; width: 100%; padding: 5px 6px; border: 0; border-radius: 5px; background: none; color: #162033; font-size: 12px; text-align: left; cursor: pointer; }
.planner-tag-picker-option:hover, .planner-tag-picker-option:focus-visible { background: #f1f5f9; }
.planner-tag-picker-option i { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 3px; }
.planner-tag-picker-create { color: #2563eb; font-weight: 600; }
.planner-tag-picker-note { padding: 6px; color: #64748b; font-size: 11px; line-height: 1.4; }

/* Completing asks for the hours spent beside the expected (Junaid, 2026-09-24). */
.planner-completion-effort { display: grid; grid-template-columns: auto minmax(0, 160px); align-items: end; gap: 6px 18px; margin-top: 16px; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f7f9fc; }
.planner-completion-expected span { display: block; margin-bottom: 6px; color: #64748b; font-size: 12px; font-weight: 600; }
.planner-completion-expected strong { display: block; color: #172b46; font-size: 20px; line-height: 38px; }
.planner-completion-spent label { font-size: 12px; margin-bottom: 6px; }
.planner-completion-spent input { box-sizing: border-box; width: 100%; height: 38px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; font: 600 16px 'Barlow', sans-serif; }
.planner-completion-spent input:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.planner-completion-spent input[aria-invalid=true] { border-color: #dc2626; }
.planner-completion-compare { grid-column: 1 / -1; margin: 2px 0 0; color: #64748b; font-size: 12px; }
.planner-completion-compare.is-under { color: #15803d; }
.planner-completion-compare.is-over { color: #b45309; font-weight: 600; }

/* A completed action waits in the draft until posted: the Post to Timesheet
   button keeps flashing (Junaid, 2026-09-24). */
@keyframes plannerPostPending {
    0%, 100% { background: #eff6ff; box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55); }
    50% { background: #dbeafe; box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
}
.planner-note-side button.is-pending { border-color: #2563eb; color: #1d4ed8; font-weight: 700; animation: plannerPostPending 1.3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .planner-note-side button.is-pending { animation: none; background: #dbeafe; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35); }
}

/* More than 15% over: the reason is asked for here, not when posting (Junaid, 2026-09-24). */
.planner-completion-reason { margin-top: 14px; }
.planner-completion-reason textarea { min-height: 72px; }
.planner-completion-reason textarea[aria-invalid=true] { border-color: #dc2626; }

/* Owners and observers, on the title row after the stage badge (Junaid, 2026-09-29). */
/* Wraps instead of squeezing: with a long drawing code and two owners, a
   nowrap row shrank every child until the Observers label sat on top of the
   + Owner button and swallowed its clicks (e2e, 2026-09-29). */
.planner-deliverable-title-row { flex-wrap: wrap; row-gap: 6px; min-width: 0; }
.planner-deliverable-title-row h3 { flex: 0 1 auto; min-width: 120px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planner-deliverable-title-row .planner-stage-badge { flex: 0 0 auto; white-space: nowrap; }
.planner-people { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; flex: 0 1 auto; }
.planner-people-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.planner-people-label { flex: 0 0 auto; color: #94a3b8; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.planner-people-empty { color: #94a3b8; font-size: 13px; }
.planner-person { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; height: 22px; max-width: 180px; padding: 0 4px 0 2px; border-radius: 999px; font-size: 11px; line-height: 1; white-space: nowrap; }
.planner-person.is-owner { background: color-mix(in srgb, var(--color-primary, #2563eb) 14%, #fff); color: var(--color-primary, #1d4ed8); }
.planner-person.is-observer { background: #f1f5f9; color: #475569; }
.planner-person b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.planner-person-initials { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 9px; font-weight: 700; letter-spacing: 0; }
.planner-person.is-owner .planner-person-initials { background: var(--color-primary, #2563eb); color: #fff; }
.planner-person.is-observer .planner-person-initials { background: #cbd5e1; color: #334155; }
.planner-person-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; opacity: .65; }
.planner-person-x:hover, .planner-person-x:focus-visible { opacity: 1; }
.planner-people-add { flex: 0 0 auto; white-space: nowrap; min-height: 20px; padding: 2px 8px; border: 1px dashed #cbd5e1; border-radius: 999px; background: #fff; color: #475569; font-size: 10px; font-weight: 600; cursor: pointer; }
.planner-people-add:hover, .planner-people-add:focus-visible { border-color: #2563eb; color: #2563eb; }
/* Same face as the Assign-to select: font, row height, border, radius. */
.planner-people-picker { width: 260px; padding: 0; border: 1px solid rgba(37, 99, 235, 0.26); border-radius: 8px; overflow: hidden; font-size: 12.5px; color: #162033; }
.planner-people-picker .planner-tag-picker-input { min-height: 36px; padding: 6px 10px; border: 0; border-bottom: 1px solid rgba(37, 99, 235, 0.26); border-radius: 0; font-size: 12.5px; }
.planner-people-picker .planner-tag-picker-list { margin-top: 0; }
.planner-people-option { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 0; padding: 6px 10px; border-bottom: 1px solid rgba(37, 99, 235, 0.14); font-size: 12.5px; line-height: 1.3; cursor: pointer; }
.planner-people-option input { flex: 0 0 auto; margin: 0; }
.planner-people-option:has(input:disabled) { opacity: 0.55; }
.planner-people-other { margin-left: auto; color: #94a3b8; font-style: normal; font-size: 10px; font-weight: 600; letter-spacing: .03em; }
.planner-people-done { display: block; width: 100%; min-height: 36px; border: 0; border-top: 1px solid rgba(37, 99, 235, 0.26); background: #fff; color: #2563eb; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.planner-people-done:hover, .planner-people-done:focus-visible { background: #f6f8fb; }
.planner-people-picker-heading { padding: 6px 6px 2px; color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
@media (max-width: 1119px) {
    .planner-deliverable-title-row { flex-wrap: wrap; }
    .planner-people { flex-basis: 100%; }
}
[data-theme-mode="dark"] .planner-person.is-owner { background: color-mix(in srgb, var(--color-primary, #60a5fa) 22%, transparent); color: #bfdbfe; }
[data-theme-mode="dark"] .planner-person.is-observer { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
[data-theme-mode="dark"] .planner-person.is-observer .planner-person-initials { background: #475569; color: #e2e8f0; }
[data-theme-mode="dark"] .planner-people-label,
[data-theme-mode="dark"] .planner-people-empty { color: #94a3b8; }
[data-theme-mode="dark"] .planner-people-add { background: transparent; border-color: #475569; color: #cbd5e1; }
[data-theme-mode="dark"] .planner-people-add:hover,
[data-theme-mode="dark"] .planner-people-add:focus-visible { border-color: #60a5fa; color: #bfdbfe; }
[data-theme-mode="dark"] .planner-people-picker { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme-mode="dark"] .planner-people-picker .planner-tag-picker-input { background: #1e293b; border-color: #334155; color: #e2e8f0; -webkit-text-fill-color: #e2e8f0; caret-color: #e2e8f0; }
[data-theme-mode="dark"] .planner-people-picker .planner-tag-picker-option { color: #e2e8f0; }
[data-theme-mode="dark"] .planner-people-picker .planner-tag-picker-option:hover,
[data-theme-mode="dark"] .planner-people-picker .planner-tag-picker-option:focus-visible { background: #1e293b; }
[data-theme-mode="dark"] .planner-people-picker .planner-tag-picker-list,
[data-theme-mode="dark"] .planner-people-option { color: #e2e8f0; }
[data-theme-mode="dark"] .planner-people-other { color: #94a3b8; }
[data-theme-mode="dark"] .planner-people-done { background: #0f172a; color: #93c5fd; border-top-color: #334155; }
[data-theme-mode="dark"] .planner-people-done:hover,
[data-theme-mode="dark"] .planner-people-done:focus-visible { background: #1e293b; }
[data-theme-mode="dark"] .planner-people-picker-heading { color: #94a3b8; }

/* Which package this drawing's new hours book to (Junaid, 2026-09-29). */
.planner-subproject-label { border: 0; background: none; padding: 0; color: #94a3b8; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.planner-subproject-label:hover, .planner-subproject-label:focus-visible { color: #2563eb; }
.planner-subproject-booked { width: 7px; height: 7px; border-radius: 50%; background: currentColor; align-self: center; flex: 0 0 7px; }
.planner-effort-values b.is-active { font-weight: 800; }
.planner-subproject-auto { margin-left: 4px; color: #64748b; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.planner-subproject-hint { display: block; margin-top: 4px; color: #b45309; font-size: 11px; font-weight: 600; }
.planner-subproject-hint b { color: inherit; font-weight: 700; }
.planner-subproject-picker { width: 320px; }
.planner-subproject-picker .planner-tag-picker-option input { flex: 0 0 auto; margin: 0; }
.planner-subproject-picker .planner-tag-picker-option span { min-width: 0; }
.planner-subproject-picker .planner-tag-picker-option em { color: #64748b; font-style: normal; }
[data-theme-mode="dark"] .planner-subproject-label { color: #94a3b8; }
[data-theme-mode="dark"] .planner-subproject-label:hover,
[data-theme-mode="dark"] .planner-subproject-label:focus-visible { color: #93c5fd; }
[data-theme-mode="dark"] .planner-subproject-hint { color: #fbbf24; }
[data-theme-mode="dark"] .planner-subproject-auto { color: #94a3b8; }
[data-theme-mode="dark"] .planner-effort-values b.is-active { color: #f8fafc; }
[data-theme-mode="dark"] .planner-effort-values b.is-over { color: #fca5a5; }
[data-theme-mode="dark"] .planner-subproject-picker { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme-mode="dark"] .planner-subproject-picker .planner-tag-picker-option { color: #e2e8f0; }
[data-theme-mode="dark"] .planner-subproject-picker .planner-tag-picker-option:hover,
[data-theme-mode="dark"] .planner-subproject-picker .planner-tag-picker-option:focus-visible { background: #1e293b; }
[data-theme-mode="dark"] .planner-subproject-picker .planner-tag-picker-note { color: #94a3b8; }
