/* PLANBOARD SURFACE & TOOLBAR
 *
 * The planboard is deliberately flush — no .card/.card-body wrappers (see
 * allocations/index.html.erb). These rules give back the *structure* the card
 * used to provide (figure-ground separation, an anchor for the page title)
 * without giving back its padding. All colours come from theme_foundation
 * tokens so dark_theme.css only has to re-declare the variables.
 */

/* Grid surface — the scroll container becomes the page's primary surface. */
.planboard-surface {
  background-color: var(--cp-surface-bg);
  border-radius: var(--cp-surface-radius);
  box-shadow: 0 0 0 1px var(--cp-surface-border), var(--cp-surface-shadow);
  overflow: hidden;
  overflow-x: auto;
}

/* Bootstrap gives tables a 1rem bottom margin — inside a surface that reads as
   a dead strip below the last row. */
.planboard-surface > .table,
.planboard-surface > table {
  margin-bottom: 0;
}

/* Header band — a contained band, not a card. The shared gradient-wash +
   left-accent-bar + icon + bold-title treatment itself now lives in
   theme_foundation/layout.css as `.cp-header-banner` (promoted app-wide —
   see the Header Banner rollout). The allocations index / yearly planner
   views wear that class directly (`cp-header-banner planboard-controls`).
   The white-bg/colored-icon/hover-fills-whole-button `.btn-outline-secondary`
   treatment that originated here has since been generalized to
   `.cp-header-banner .btn-outline-secondary` in layout.css (per-module
   accent aware) — Planboard picks it up through that shared rule and no
   longer needs its own copy. What stays here is ONLY the in-grid month/year
   navigation buttons (`#calendar` — outside `.cp-header-banner`, so they
   can't inherit its accent override) and the planboard-specific
   form-control/input-group theming, both scoped so they don't leak onto
   the other 14+ pages that also use `.cp-header-banner`. */

/* In-grid month/year navigation — sits in the calendar body, not the header
   band, so it can't reach the `.cp-header-banner`-scoped --cp-header-accent
   override; falls back to the root --cp-header-accent (still blue), keeping
   Planboard's control language identical inside and outside the header. */
#calendar .btn-outline-secondary {
  --bs-btn-color: var(--cp-control-color);
  --bs-btn-bg: var(--cp-control-bg);
  --bs-btn-border-color: var(--cp-control-border);
  --bs-btn-hover-color: var(--cp-control-hover-color);
  --bs-btn-hover-bg: var(--cp-control-hover-bg);
  --bs-btn-hover-border-color: var(--cp-control-hover-border);
  --bs-btn-active-color: var(--cp-control-hover-color);
  --bs-btn-active-bg: var(--cp-control-hover-bg);
  --bs-btn-active-border-color: var(--cp-control-hover-border);
  --bs-btn-disabled-color: var(--cp-control-muted-color);
  --bs-btn-disabled-border-color: var(--cp-control-border);
  font-weight: 500;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#calendar .btn-outline-secondary > i,
#calendar .btn-outline-secondary > .bi {
  color: var(--cp-control-icon);
}

#calendar .btn-outline-secondary:hover > i,
#calendar .btn-outline-secondary:hover > .bi,
#calendar .btn-outline-secondary:focus-visible > i,
#calendar .btn-outline-secondary:focus-visible > .bi {
  color: inherit;
}

.planboard-controls .input-group-text {
  background-color: var(--cp-control-bg);
  border-color: var(--cp-control-border);
  color: var(--cp-control-icon);
}

.planboard-controls .form-control {
  border-color: var(--cp-control-border);
  color: var(--cp-control-color);
}

.planboard-controls .form-control::placeholder {
  color: var(--cp-control-muted-color);
  opacity: 1;
}

.planboard-controls .form-control:focus {
  border-color: var(--cp-control-icon);
  box-shadow: 0 0 0 0.2rem var(--cp-control-focus-ring);
}

.planboard-controls .input-group:focus-within .input-group-text {
  border-color: var(--cp-control-icon);
}

/* Keep a visible keyboard affordance — never rely on the hover wash alone. */
.planboard-controls .btn:focus-visible,
#calendar .btn:focus-visible {
  border-color: var(--cp-control-icon);
  box-shadow: 0 0 0 0.2rem var(--cp-control-focus-ring);
  outline: none;
}

/* BASE TABLE STRUCTURE */

#calendar table {
  table-layout: fixed;
  width: 100%;
}

/* Column header rail — separates the date header from the data grid. */
#calendar thead th {
  background-color: var(--cp-planboard-head-bg);
  color: var(--cp-planboard-head-color);
}

#calendar .table-bordered > thead > tr > th {
  border-bottom: 2px solid var(--cp-planboard-head-border) !important;
}

#calendar thead th.weekend-day {
  background-color: var(--cp-planboard-head-weekend-bg) !important;
}

/* "Today" must out-rank the weekend/head banding above — including when today
   falls on a weekend, and including the 2px header rule. */
#calendar .table-bordered > thead > tr > th.today-header {
  background-color: var(--cp-planboard-today-bg) !important;
  border-bottom: 2px solid var(--cp-planboard-today-border) !important;
}

/* Name column rail — reads as a row header, not as an empty data cell.
   background-color only: _allocation.html.erb paints the utilization
   progress bar on background-image, which layers on top of this. */
#calendar .first-column {
  background-color: var(--cp-planboard-namecol-bg);
}

#calendar .table-bordered > * > tr > .first-column {
  border-right: 2px solid var(--cp-planboard-namecol-border) !important;
}

/* Override Bootstrap's table-bordered to ensure all borders are visible */
#calendar .table-bordered > :not(caption) > * {
  border-width: 1px !important;
}

#calendar .table-bordered > :not(caption) > * > * {
  border-width: 1px !important;
}

.first-column {
  width: 18em;
  min-width: 20em;
  font-weight: bold;
}

.allocation-row,
.project-row {
  border-bottom: 1px solid var(--cp-planboard-grid-line);
}

#calendar tbody tr {
  height: 4.5em !important;
  max-height: 4.5em !important;
}

#calendar tbody td {
  padding: 0 !important;
  vertical-align: middle !important;
}

#calendar tbody td.first-column {
  padding-left: 0.75rem !important;
}

.header-cell {
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

/* CELL STYLES */

.timesheet-cell {
  padding: 0 !important;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  background-color: var(--cp-planboard-cell-bg);
  border: 1px solid var(--cp-planboard-grid-line);
  vertical-align: middle;
  line-height: 1;
}

.cell-filled {
  background-color: #e0f0ff !important;
  color: #000 !important;
  font-weight: bold;
}

/* DUTY TINTS - subtle background for standby/SPOC duty days */

.duty-standby-bg {
  background-image: linear-gradient(
    rgba(var(--standby-duty-color-rgb, 251, 255, 0), var(--standby-duty-opacity, 0.03)),
    rgba(var(--standby-duty-color-rgb, 251, 255, 0), var(--standby-duty-opacity, 0.03))
  ) !important;
}

.duty-standby-bg.cell-filled {
  background-image: linear-gradient(
    rgba(var(--standby-duty-color-rgb, 251, 255, 0), var(--standby-duty-opacity-filled, 0.06)),
    rgba(var(--standby-duty-color-rgb, 251, 255, 0), var(--standby-duty-opacity-filled, 0.06))
  ),
  linear-gradient(#e0f0ff, #e0f0ff) !important;
}

body.hide-standby .duty-standby-bg {
  background-image: none !important;
}

body.hide-standby .duty-standby-bg.cell-filled {
  background-image: none !important;
  background-color: #e0f0ff !important;
}

.duty-spoc-bg {
  background-image: linear-gradient(
    rgba(var(--spoc-duty-color-rgb, 200, 133, 255), var(--spoc-duty-opacity, 0.03)),
    rgba(var(--spoc-duty-color-rgb, 200, 133, 255), var(--spoc-duty-opacity, 0.03))
  ) !important;
}

.duty-spoc-bg.cell-filled {
  background-image: linear-gradient(
    rgba(var(--spoc-duty-color-rgb, 200, 133, 255), var(--spoc-duty-opacity-filled, 0.06)),
    rgba(var(--spoc-duty-color-rgb, 200, 133, 255), var(--spoc-duty-opacity-filled, 0.06))
  ),
  linear-gradient(#e0f0ff, #e0f0ff) !important;
}

body.hide-spoc .duty-spoc-bg {
  background-image: none !important;
}

body.hide-spoc .duty-spoc-bg.cell-filled {
  background-image: none !important;
  background-color: #e0f0ff !important;
}

.duty-both-bg {
  background-image: linear-gradient(
    rgba(var(--both-duty-color-rgb, 255, 102, 0), var(--both-duty-opacity, 0.03)),
    rgba(var(--both-duty-color-rgb, 255, 102, 0), var(--both-duty-opacity, 0.03))
  ) !important;
}

.duty-both-bg.cell-filled {
  background-image: linear-gradient(
    rgba(var(--both-duty-color-rgb, 255, 102, 0), var(--both-duty-opacity-filled, 0.06)),
    rgba(var(--both-duty-color-rgb, 255, 102, 0), var(--both-duty-opacity-filled, 0.06))
  ),
  linear-gradient(#e0f0ff, #e0f0ff) !important;
}

body.hide-both .duty-both-bg {
  background-image: none !important;
}

body.hide-both .duty-both-bg.cell-filled {
  background-image: none !important;
  background-color: #e0f0ff !important;
}

#calendar .bg-light.text-muted {
  background-color: #f8f9fa !important;
  color: #adb5bd !important;
}

/* SPECIAL DAY STATES */

/* Weekend and Non-Working Days
 * Weekend banding is a *secondary* cue only — the weekday name is always
 * rendered in the column header, so colour is never the sole carrier. */
.weekend-day,
.weekend-trace-marker,
.before-project,
.after-project {
  background-color: var(--cp-planboard-weekend-bg) !important;
  color: var(--cp-planboard-weekend-color) !important;
  cursor: not-allowed;
}

#calendar .weekend-day.weekend-row,
#calendar .national-holiday {
  cursor: not-allowed;
}

.national-holiday {
  background-color: var(--cp-planboard-weekend-bg) !important;
  color: var(--cp-planboard-weekend-color) !important;
  cursor: not-allowed;
}

/* Weekend-band hairline — border-color ONLY, no width/style/background change.
   --cp-planboard-grid-line is calibrated against a WHITE weekday cell; on the
   weekend band it sits ~1% from the fill, so Sat|Sun and the row splits inside a
   weekend column vanish. Re-colouring only the cells that carry the weekend fill
   restores the division without adding weight to the weekday grid.

   Specificity: the #calendar group is (1,1,0) — it must clear Bootstrap's
   `.table-bordered > :not(caption) > * > *` (0,1,1), which otherwise wins over
   .timesheet-cell — and it stays BELOW
   `#calendar .table-bordered > thead > tr > th.today-header` (1,2,3), the 2px
   header rule (1,2,3) and the name-column rail (1,2,1), so the today, header and
   name-column treatments are not out-ranked. The .calendar-day group covers the
   yearly overview's mini-calendars at (0,2,0), which keeps it under
   `.calendar-day.national-holiday` / `.calendar-day.allocation-*` (both
   !important); those cells currently draw no border, so it is inert there. */
#calendar .weekend-day,
#calendar .weekend-trace-marker,
#calendar .before-project,
#calendar .after-project,
#calendar .national-holiday,
.calendar-day.weekend-day {
  border-color: var(--cp-planboard-weekend-border);
}

/* ONE 1px line on every grid edge, in the board's body and header. Under border-collapse the browser paints a single
   border per shared edge, and for borders of equal width it is the LEFT cell's (vertical edge) or the UPPER cell's
   (horizontal edge) that wins, whatever CSS specificity says. A grey cell (weekend, firm holiday, outside the
   project's range) next to a white one therefore drew the white cell's very light grid line, which vanishes against
   the grey. So the winning border itself is coloured: the white cell before a grey one gets its right border in the
   grey cell's border colour (below), and the white cell above a grey one gets its bottom border so
   (.grey-below, set by the views where the cell below is grey). No shadow is stacked on top of a border: that
   drew two lines. A grey cell on the left or above already wins with its own border colour (see the group above). */
#calendar .timesheet-cell:has(+ :is(.weekend-day, .national-holiday, .before-project, .after-project)),
#calendar .header-cell:has(+ .header-cell.weekend-day) {
  border-right-color: var(--cp-planboard-weekend-border);
}

#calendar .grey-below {
  border-bottom-color: var(--cp-planboard-weekend-border);
}

/* Adjacent-month preview columns — the plain monthly grid's leading/trailing boundary days
   (week-complete padding: 0–4 leading days back to the month's first-day-week Monday, 0–6
   trailing days forward to the last-day-week Sunday — see AllocationsController#fetch_consultants).
   Real allocation/blocked content renders in these cells exactly as it would in the adjacent
   month, and they are fully interactive: the <td>s carry the same data-date/data-resource-id,
   modal triggers and click-to-add affordance as in-month cells (see _allocation.html.erb), and
   the controller fetches boundary-day allocations/blocked dates/duty tints additively, so
   creating and editing allocations works on them exactly as on any other day. The muted opacity
   is purely a visual cue that the day belongs to the neighbouring month. */
.other-month-day {
  opacity: 0.45;
}

#calendar th.other-month-day {
  color: var(--cp-planboard-weekend-color) !important;
}

/* Display-dropdown toggle ("Hide/Show Adjacent Month Days") — client-side only, mirrors
   hide-weekends/hide-reserved. Purely a visibility switch: the boundary columns are always
   fetched/rendered server-side (see .other-month-day above); this just hides them. Enabled
   (visible) by default — the body class is only ever added by an explicit user toggle
   (planner_controls_controller.js), never present on first load. A single body-scoped rule,
   rather than per-element inline styles, is deliberate: it keeps working correctly across
   Turbo Stream re-renders of the #planboard frame (create/update/destroy/block_occurrence)
   without needing a re-apply hook after every swap, since #calendar's body ancestor is never
   itself replaced by those streams. */
body.hide-boundary-days .other-month-day {
  display: none !important;
}

#calendar th.other-month-day div {
  color: inherit !important;
}

/* Blocked Days */
.blocked-day {
  background-color: #ffcccc !important;
  opacity: 0.7;
}

.blocked-tag {
  color: #d9534f;
  font-weight: bold;
  font-size: 0.85em;
}

/* Today Highlighting */
.today-header {
  background-color: var(--cp-planboard-today-bg) !important;
  border-bottom: 2px solid var(--cp-planboard-today-border) !important;
}

/* LAYOUT UTILITIES */

.col-lg-2-5 {
  flex: 0 0 auto;
  width: 13.5%;
}

.col-lg-10-5 {
  flex: 0 0 auto;
  width: 86.5%;
}

/* BUTTON & DROPDOWN STYLES */

/* Button Groups */
.btn-group .dropdown-toggle {
  border-radius: 0.375rem !important;
}

.btn-group .dropdown-menu {
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-group .dropdown-item {
  transition: all 0.2s ease;
  border-radius: 0.25rem;
  padding: 0.5rem 0.75rem;
}

.btn-group + .btn-group {
  margin-left: 0.5rem;
}

.btn-group .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Dropdown Menus */
.dropdown-menu {
  min-width: 200px;
  padding: 0.5rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  margin-right: 0.5rem;
}

.dropdown-item:hover,
.btn-group .dropdown-item:hover {
  background-color: #f8f9fa;
  color: #212529;
}

.dropdown-item.active,
.btn-group .dropdown-item.active {
  background-color: #0d6efd;
  color: white;
}

/* Accessibility - Focus States */
.dropdown-item:focus {
  outline: 2px solid #0d6efd;
  outline-offset: -2px;
  background-color: #e9ecef;
}

.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* YEARLY OVERVIEW */

.yearly-overview-card {
  transition: all 0.3s ease;
  cursor: default;
  border-radius: 8px;
  opacity: 1;
}

.monthly-grid {
  min-height: 140px;
}

.mini-calendar {
  font-size: 0.8em;
}

.weekday-header {
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Allocation Level Indicators - High specificity to override weekend/holiday styles */
.yearly-overview-card .calendar-day.allocation-critical,
.calendar-day.allocation-critical {
  background-color: rgba(220, 53, 69, 0.8) !important; /* Red - 0-25% */
  border: 1px solid rgba(220, 53, 69, 0.9) !important;
  color: white !important;
  cursor: pointer !important;
}

.yearly-overview-card .calendar-day.allocation-low,
.calendar-day.allocation-low {
  background-color: rgba(255, 133, 27, 0.7) !important; /* Orange - 25-50% */
  border: 1px solid rgba(255, 133, 27, 0.8) !important;
  color: white !important;
  cursor: pointer !important;
}

.yearly-overview-card .calendar-day.allocation-medium,
.calendar-day.allocation-medium {
  background-color: rgba(255, 193, 7, 0.7) !important; /* Yellow - 50-75% */
  border: 1px solid rgba(255, 193, 7, 0.8) !important;
  color: #000 !important;
  cursor: pointer !important;
}

.yearly-overview-card .calendar-day.allocation-high,
.calendar-day.allocation-high {
  background-color: rgba(25, 135, 84, 0.8) !important; /* Green - 75-100% */
  border: 1px solid rgba(25, 135, 84, 0.9) !important;
  color: white !important;
  cursor: pointer !important;
}

/* National Holidays in Mini-Calendar */
.calendar-day.national-holiday {
  background-color: rgba(108, 117, 125, 0.3) !important;
  border: 1px solid rgba(108, 117, 125, 0.6) !important;
  color: #495057 !important;
  font-weight: 500 !important;
  position: relative;
}

/* Today Highlighting with Allocation */
.calendar-day.bg-primary.allocation-high,
.calendar-day.bg-primary.allocation-medium,
.calendar-day.bg-primary.allocation-low,
.calendar-day.bg-primary.allocation-critical {
  border: 2px solid #fff !important;
  box-shadow: 0 0 0 2px #0d6efd !important;
}

.yearly-overview-card .bg-primary {
  animation: pulse 2s infinite;
}

/* Monthly Statistics Styling */
.stat-item {
  padding: 2px;
  cursor: help;
  transition: transform 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-1px);
}

.stat-number {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Animation for Card Loading */
.col-lg-3:nth-child(1) .yearly-overview-card { animation-delay: 0.1s; }
.col-lg-3:nth-child(2) .yearly-overview-card { animation-delay: 0.2s; }
.col-lg-3:nth-child(3) .yearly-overview-card { animation-delay: 0.3s; }
.col-lg-3:nth-child(4) .yearly-overview-card { animation-delay: 0.4s; }
.col-lg-3:nth-child(5) .yearly-overview-card { animation-delay: 0.5s; }
.col-lg-3:nth-child(6) .yearly-overview-card { animation-delay: 0.6s; }
.col-lg-3:nth-child(7) .yearly-overview-card { animation-delay: 0.7s; }
.col-lg-3:nth-child(8) .yearly-overview-card { animation-delay: 0.8s; }
.col-lg-3:nth-child(9) .yearly-overview-card { animation-delay: 0.9s; }
.col-lg-3:nth-child(10) .yearly-overview-card { animation-delay: 1.0s; }
.col-lg-3:nth-child(11) .yearly-overview-card { animation-delay: 1.1s; }
.col-lg-3:nth-child(12) .yearly-overview-card { animation-delay: 1.2s; }

/* ANIMATIONS */

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
  }
  70% {
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
  }
}

/* RESPONSIVE DESIGN */

/* Large Screens */
@media (max-width: 991.98px) {
  #allocationControls {
    margin-top: 1rem;
  }
  
  #allocationControls .btn-group {
    margin-bottom: 0.5rem;
  }
}

/* Tablets */
@media (max-width: 768px) {
  .monthly-grid {
    min-height: 120px;
  }
  
  .mini-calendar {
    font-size: 0.7em;
  }
  
  .calendar-day {
    min-height: 18px;
  }
  
  .project-indicator {
    width: 3px;
    height: 3px;
  }
  
  .yearly-overview-card {
    margin-bottom: 15px;
  }
}

/* Mobile */
@media (max-width: 576px) {
  .yearly-overview-card {
    margin-bottom: 20px;
  }
  
  .stat-number {
    font-size: 0.8em !important;
  }
  
  .stat-label {
    font-size: 0.6em !important;
  }
}

/* RESERVED ALLOCATIONS STYLING */

/* Reserved Allocation Visual Styling - Striped Background Pattern */
/* Apply pattern to the cell containing reserved allocations, not the icon */
.timesheet-cell:has(.allocation[data-status="reserved"]),
.timesheet-cell:has(.allocation-block[data-status="reserved"]) {
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(127, 134, 140, 0.2) 4px,
    rgba(116, 123, 128, 0.2) 8px
  ) !important;
}

/* Keep allocation icon transparent so pattern shows through */
.allocation[data-status="reserved"],
.allocation-block[data-status="reserved"],
a.allocation[data-status="reserved"],
a.allocation-block[data-status="reserved"],
.allocation.allocation-block[data-status="reserved"] {
  background-color: transparent;
  background-image: none;
}

/* DISPLACED ALLOCATIONS (#308): a day pushed off by billed timesheet hours, kept only
   for replanning. The icon is greyed out and carries an amber hourglass corner badge
   (a dashed/hatched border pixelates on these 24px round chips). */
.allocation[data-displaced="true"],
.allocation-block[data-displaced="true"] {
  position: relative;
  overflow: visible;
}

.allocation[data-displaced="true"] > :not(.displaced-marker) {
  filter: grayscale(100%);
  opacity: 0.45;
}

.allocation[data-displaced="true"]:hover > :not(.displaced-marker) {
  opacity: 0.8;
}

.displaced-marker {
  position: absolute;
  top: -4px;
  left: -4px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bs-warning);
  color: #212529;
  font-size: 9px;
  line-height: 1;
  box-shadow: 0 0 0 1.5px var(--bs-body-bg);
  pointer-events: none;
}

/* Prevent table hover from overriding reserved allocation background */
.table-hover tbody tr:hover {
  background-color: transparent !important;
}

.table > :not(caption) > * > * {
  box-shadow: none !important;
}

/* RESERVED ALLOCATIONS FILTER */

/* Hide Reserved Allocations */
body.hide-reserved-allocations .allocation[data-status="reserved"],
body.hide-reserved-allocations .allocation-block[data-status="reserved"],
body.hide-reserved-allocations a.allocation[data-status="reserved"],
body.hide-reserved-allocations a.allocation-block[data-status="reserved"],
body.hide-reserved-allocations .allocation.allocation-block[data-status="reserved"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Update Hour Display */
body.hide-reserved-allocations .allocation-hours-display .total-hours-normal {
  display: none !important;
}

body.hide-reserved-allocations .allocation-hours-display .total-hours-filtered {
  display: inline !important;
}

/* Remove Styling from Reserved Days in Yearly View */
body.hide-reserved-allocations .calendar-day[data-purely-reserved="true"].allocation-high,
body.hide-reserved-allocations .calendar-day[data-purely-reserved="true"].allocation-medium,
body.hide-reserved-allocations .calendar-day[data-purely-reserved="true"].allocation-low,
body.hide-reserved-allocations .calendar-day[data-purely-reserved="true"].allocation-critical {
  background-color: transparent !important;
  border: none !important;
  color: inherit !important;
}

/* Note: Overbooked warnings are handled in allocation_overbooked.css */

/* ── Planboard favicon icons ─────────────────────────────────────────────── */
/* Circular crop, no padding, no background — matches the planboard's compact */
/* row style where icons sit inline next to project names.                    */
.favicon-icon-planboard {
  border-radius: 50%;
  padding: 0;
  object-fit: cover;
  vertical-align: middle;
}
/* ---------------------------------------------------------------------------------------------
   Drag to replan (planner--drag, issue #433 phase 4)
   --------------------------------------------------------------------------------------------- */

/* A chip that can be dragged with a mouse or pen. Touch is left alone: the board keeps scrolling. */
a.allocation[data-drag="true"][data-can-update="true"] {
  cursor: grab;
  -webkit-user-drag: none;
}

body.planboard-dragging,
body.planboard-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

body.planboard-dragging.planboard-drop-invalid,
body.planboard-dragging.planboard-drop-invalid * {
  cursor: not-allowed !important;
}

.planboard-chip-dragging {
  opacity: 0.35;
}

/* Dragging a series: every chip of it is outlined, so the scope is plain before the drop. */
.planboard-series-peer {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}

/* Where the chip may land, and the cell under the pointer. */
/* The grid of landing cells stays faint so the board remains readable; the hovered cell stands out. */
.planboard-drag-active .planboard-drop-candidate {
  outline: 1px dashed rgba(var(--bs-primary-rgb), 0.2);
  outline-offset: -1px;
}
body.dark-theme .planboard-drag-active .planboard-drop-candidate { outline-color: rgba(var(--bs-primary-rgb), 0.35); }

.planboard-drag-active .planboard-drop-valid {
  outline: 2px solid rgba(var(--bs-success-rgb), 0.75);
  outline-offset: -2px;
  background-color: rgba(var(--bs-success-rgb), 0.12) !important;
}

.planboard-drag-active .planboard-drop-invalid {
  outline: 2px solid rgba(var(--bs-danger-rgb), 0.75);
  outline-offset: -2px;
  background-color: rgba(var(--bs-danger-rgb), 0.1) !important;
}

/* The Move items arm what moves when dragged: the one day, or every day of the series. */
a.allocation[data-drag-armed="true"] {
  outline: 3px dashed var(--bs-warning);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(var(--bs-warning-rgb), 0.35);
}

/* The same for a blocked day (planner--blocked-drag): every cell of the armed block, or the one day. The ring sits
   inside the cell, so neighbouring cells of the block read as one orange band. */
td.timesheet-cell[data-drag-armed="true"] {
  outline: 3px dashed var(--bs-warning);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 5px rgba(var(--bs-warning-rgb), 0.35);
}

/* The block being dragged: its cells fade, as a dragged chip does. */
td.timesheet-cell.planboard-blocked-dragging { opacity: 0.35; }

.planboard-drag-ghost {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.5rem;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.2;
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.3);
  max-width: 18rem;
}

.planboard-drag-ghost-series { background: var(--bs-primary); }
.planboard-drag-ghost-single { background: var(--bs-secondary); }

.planboard-drag-hint {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1085;
  max-width: 40rem;
  pointer-events: none; /* a status line: it must not block a drag of the chips under it */
}

/* The day the keyboard move is on. */
.planboard-kb-target {
  outline: 3px solid var(--bs-primary);
  outline-offset: -3px;
  background-color: rgba(var(--bs-primary-rgb), 0.2) !important;
}

/* The planboard's right-click menu (planner--context-menu), on chips and on day cells: a header
   that says what was clicked, icon + label rows, divided groups, danger last. The app's dark
   theme is body.dark-theme (dark_theme.css), so the colours are tokens re-declared there. */
.cp-context-menu {
  --cp-menu-bg: #ffffff;
  --cp-menu-color: #1f2933;
  --cp-menu-muted: #6b7782;
  --cp-menu-border: rgba(15, 23, 42, 0.12);
  --cp-menu-divider: rgba(15, 23, 42, 0.09);
  --cp-menu-hover-bg: #eef3fa;
  --cp-menu-accent: #1890ff;
  --cp-menu-danger: #c92a3a;
  --cp-menu-danger-bg: rgba(220, 53, 69, 0.1);
  z-index: 1080;
  min-width: 16rem;
  max-width: 24rem;
  padding: 0.375rem;
  border: 1px solid var(--cp-menu-border);
  border-radius: 0.75rem;
  background: var(--cp-menu-bg);
  color: var(--cp-menu-color);
  box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.18), 0 0.125rem 0.5rem rgba(15, 23, 42, 0.08);
  font-size: 1rem;
  line-height: 1.35;
}

body.dark-theme .cp-context-menu {
  --cp-menu-bg: #23272b;
  --cp-menu-color: #e3e7ea;
  --cp-menu-muted: #98a1a9;
  --cp-menu-border: #3a4046;
  --cp-menu-divider: #343a40;
  --cp-menu-hover-bg: #2f3a46;
  --cp-menu-accent: #6bb6ff;
  --cp-menu-danger: #ff7b86;
  --cp-menu-danger-bg: rgba(255, 123, 134, 0.14);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55), 0 0.125rem 0.5rem rgba(0, 0, 0, 0.35);
}

.cp-context-menu:focus { outline: none; }

.cp-context-menu__header { padding: 0.5rem 0.75rem 0.4rem; }

.cp-context-menu__title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cp-context-menu__subtitle {
  color: var(--cp-menu-muted);
  font-size: 0.85rem;
}

.cp-context-menu__divider {
  height: 1px;
  margin: 0.3rem 0.25rem;
  background: var(--cp-menu-divider);
}

.cp-context-menu__group {
  padding: 0.3rem 0.75rem 0.15rem;
  color: var(--cp-menu-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cp-context-menu__note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem 0.5rem;
  color: var(--cp-menu-muted);
}

.cp-context-menu__item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cp-context-menu__icon {
  flex: 0 0 1.1rem;
  width: 1.1rem;
  margin-top: 0.1rem;
  color: var(--cp-menu-muted);
  text-align: center;
}

.cp-context-menu__text { flex: 1 1 auto; min-width: 0; }
.cp-context-menu__label { display: block; }

.cp-context-menu__hint {
  display: block;
  color: var(--cp-menu-muted);
  font-size: 0.8rem;
}

.cp-context-menu__item:hover:not(.is-disabled),
.cp-context-menu__item:focus-visible:not(.is-disabled) {
  background: var(--cp-menu-hover-bg);
  outline: none;
}

.cp-context-menu__item:focus-visible { box-shadow: inset 0 0 0 2px var(--cp-menu-accent); }
.cp-context-menu__item:hover:not(.is-disabled) .cp-context-menu__icon,
.cp-context-menu__item:focus-visible:not(.is-disabled) .cp-context-menu__icon,
.cp-context-menu__item[aria-checked="true"] .cp-context-menu__icon { color: var(--cp-menu-accent); }

/* A fold-out parent (aria-haspopup="menu"): the chevron sits at the end, and the parent stays lit while its submenu is open. */
.cp-context-menu__item[aria-haspopup="menu"] > .cp-context-menu__icon:last-child { margin-left: auto; flex: 0 0 auto; }
.cp-context-menu__item[aria-expanded="true"]:not(.is-disabled) { background: var(--cp-menu-hover-bg); }
.cp-context-menu__item[aria-expanded="true"]:not(.is-disabled) .cp-context-menu__icon { color: var(--cp-menu-accent); }
.cp-context-submenu { z-index: 1081; min-width: 15rem; }

.cp-context-menu__item[aria-checked="true"] { font-weight: 600; }
.cp-context-menu__item[aria-checked="true"] > .cp-context-menu__icon:last-child { margin-left: auto; flex: 0 0 auto; }

.cp-context-menu__item.is-danger,
.cp-context-menu__item.is-danger .cp-context-menu__icon { color: var(--cp-menu-danger); }

.cp-context-menu__item.is-danger:hover:not(.is-disabled),
.cp-context-menu__item.is-danger:focus-visible:not(.is-disabled) { background: var(--cp-menu-danger-bg); }

.cp-context-menu__item.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------------------------------
   Range selection (planner--selection, issue #433): the selected day cells of one row, and the
   floating summary. A subtle overlay (the cell keeps its own colours) plus an inset outline.
   --------------------------------------------------------------------------------------------- */
td.timesheet-cell.planboard-selected {
  position: relative;
}

td.timesheet-cell.planboard-selected::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(var(--bs-primary-rgb), 0.14);
  box-shadow: inset 0 0 0 2px rgba(var(--bs-primary-rgb), 0.6);
  z-index: 1;
}

body.dark-theme td.timesheet-cell.planboard-selected::after {
  background: rgba(107, 182, 255, 0.2);
  box-shadow: inset 0 0 0 2px rgba(107, 182, 255, 0.75);
}

body.planboard-selecting,
body.planboard-selecting * {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: col-resize !important;
}

.planboard-selection-summary {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1060;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  border: 1px solid rgba(var(--bs-primary-rgb), 0.45);
  border-radius: 2rem;
  background: #ffffff;
  color: #1f2933;
  box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.2);
  font-size: 0.875rem;
  white-space: nowrap;
}

.planboard-selection-summary__text { font-weight: 600; }
.planboard-selection-summary__hint { color: #6b7782; font-size: 0.75rem; }

body.dark-theme .planboard-selection-summary {
  background: #23272b;
  color: #e3e7ea;
  border-color: rgba(107, 182, 255, 0.55);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.55);
}
body.dark-theme .planboard-selection-summary__hint { color: #98a1a9; }
body.dark-theme .planboard-selection-summary .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* The "this occurrence or all occurrences?" delete choice (#deleteModal): wide enough for a long date and
   "Delete all occurrences" side by side, each on one line. */
.cp-delete-choice-dialog { --bs-modal-width: 620px; }

/* "Add <consultant> as [profile] to <project>" in the planning form reads as one line of text.
   The theme's .form-select and .btn paddings override Bootstrap's -sm sizes, so they are set here. */
.planner-add-row {
  row-gap: 0.25rem;
}

.planner-add-row .form-select {
  padding: 0.1875rem 1.75rem 0.1875rem 0.5rem;
  background-position: right 0.5rem center;
  font-size: inherit;
}

.planner-add-row .btn {
  --bs-btn-padding-x: 0.625rem;
  --bs-btn-padding-y: 0.1875rem;
  font-size: inherit;
}
