/* ============================================================
   projects-views.css — Kanban, Calendar, Gantt styles
   Append to styles.css or link separately
   ============================================================ */

/* ── VIEW TAB PILLS ── */
.view-tab-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.view-tab-btn:hover  { background: var(--surface-2); color: var(--text); }
.view-tab-btn.active { background: var(--surface-2); color: var(--text); border-color: var(--border); }

/* ════════════════════════════════════════════════════════════
   KANBAN
════════════════════════════════════════════════════════════ */
.kanban-board-wrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  padding: 14px 16px;
  height: 100%;
  box-sizing: border-box;
}
.kanban-board {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding-bottom: 24px;
  min-height: 100%;
}

/* Column */
.kanban-col {
  width: 234px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  max-height: calc(100vh - 130px);
  transition: border-color 0.15s, background 0.15s;
}
.kanban-col-drag-over {
  border-color: var(--blue) !important;
  background: rgba(96,165,250,0.05);
}
.kanban-col-header {
  padding: 10px 12px 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  border-radius: calc(var(--radius) + 2px) calc(var(--radius) + 2px) 0 0;
}
.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
  min-width: 0;
}
.kanban-col-count {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 6px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.kanban-col-gate {
  font-size: 13px;
  cursor: help;
  color: var(--text-faint);
  flex-shrink: 0;
}
.kanban-col-cards {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}
.kanban-empty {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  padding: 24px 0;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  margin: 4px;
}

/* Card */
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 11px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  user-select: none;
}
.kanban-card:hover {
  border-color: rgba(96,165,250,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}
.kanban-card-alert { border-left: 3px solid var(--red)   !important; }
.kanban-card-warn  { border-left: 3px solid var(--amber) !important; }

.kanban-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
}
.kanban-card-client {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.kanban-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.kanban-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.kanban-progress-pct {
  font-size: 10px;
  color: var(--text-faint);
  min-width: 26px;
  text-align: right;
}
.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.kanban-card-meta   { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.kanban-wo-chip {
  font-size: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 6px;
  color: var(--text-dim);
}
.kanban-due-chip {
  font-size: 10px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 10px;
  padding: 1px 6px;
  color: var(--amber);
}
.kanban-due-chip.overdue {
  background: rgba(248,113,113,0.1);
  border-color: rgba(248,113,113,0.3);
  color: var(--red);
}
.kanban-card-status-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s;
}
.kanban-card-status-btn:hover { color: var(--text); background: var(--surface-2); }

/* ════════════════════════════════════════════════════════════
   CALENDAR
════════════════════════════════════════════════════════════ */
.cal-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  gap: 10px;
}
.cal-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
}
.cal-legend-item { display: flex; align-items: center; gap: 5px; }

/* Dot colors */
.cal-dot, .cal-dot-sm { display: inline-block; border-radius: 50%; flex-shrink: 0; }
.cal-dot    { width: 10px; height: 10px; }
.cal-dot-sm { width:  6px; height:  6px; }
.cal-dot-prod-due { background: #f87171; }
.cal-dot-prod-run { background: #60a5fa; }
.cal-dot-mats     { background: #fbbf24; }
.cal-dot-delivery { background: #4ade80; }
.cal-dot-wo       { background: #a78bfa; }

/* Nav row */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.cal-month-title {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  text-align: center;
  color: var(--text);
}

/* Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  text-align: center;
  padding: 5px 0;
}
.cal-cell {
  min-height: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 6px;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.1s;
  box-sizing: border-box;
}
.cal-cell:hover     { background: var(--surface-2); }
.cal-cell-empty     { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.cal-cell-today     { border-color: var(--blue); background: rgba(96,165,250,0.05); }
.cal-cell-past      { opacity: 0.6; }
.cal-cell-alert     { border-color: rgba(248,113,113,0.6) !important; }
.cal-cell-past.cal-cell-alert { opacity: 1; /* keep alert prominent even on past days */ }

.cal-cell-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 3px;
  line-height: 1;
}
.cal-cell-num-today { color: var(--blue); }

.cal-cell-dots {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-bottom: 3px;
  min-height: 8px;
}
.cal-cell-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-event-chip {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.4;
  transition: opacity 0.1s;
}
.cal-event-chip:hover { opacity: 0.75; }
.cal-event-chip.range-day { border-radius: 0; }
.cal-event-prod-due  { background: rgba(248,113,113,0.18); color: #f87171; }
.cal-event-prod-run  { background: rgba(96,165,250,0.18);  color: #60a5fa; }
.cal-event-mats      { background: rgba(251,191,36,0.18);  color: #d97706; }
.cal-event-delivery  { background: rgba(74,222,128,0.18);  color: #22c55e; }
.cal-event-wo        { background: rgba(167,139,250,0.18); color: #a78bfa; }
.cal-more {
  font-size: 9px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 1px 2px;
}
.cal-more:hover { color: var(--text); }

/* ════════════════════════════════════════════════════════════
   GANTT — Split layout: sticky labels | scrollable chart
════════════════════════════════════════════════════════════ */
.gantt-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  height: 100%;
}
.gantt-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* The outer row: labels on left (fixed), chart on right (scrollable) */
.gantt-outer {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Labels column — fixed width, scrolls vertically with chart */
.gantt-labels-col {
  width: 240px;
  flex-shrink: 0;
  overflow: hidden; /* vertical scroll driven by JS sync */
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.gantt-labels-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

/* Chart scroll area — a visible, grabbable horizontal scrollbar (not the
   near-invisible global 5px/transparent-track one) since Day/Week/Full Span
   all rely on scrolling now with no page-flip buttons for the first two.
   Victoria: "there is no scroll wheel on the bottom." */
.gantt-chart-scroll {
  flex: 1;
  overflow: auto;
  scrollbar-color: var(--accent) var(--surface-2);
  scrollbar-width: auto;
}
.gantt-chart-scroll::-webkit-scrollbar { height: 14px; }
.gantt-chart-scroll::-webkit-scrollbar-track { background: var(--surface-2); }
.gantt-chart-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 7px; }
.gantt-chart-inner {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header bar row */
.gantt-bars-header {
  height: 48px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  flex-shrink: 0;
}

/* Label rows */
.gantt-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  transition: background 0.1s;
}
.gantt-label-row:hover          { background: var(--surface-2); }
.gantt-sub-label-row            { background: rgba(0,0,0,0.03); padding-left: 20px; }
.gantt-sub-label-row:hover      { background: var(--surface-2); }

.gantt-expand-icon { font-size: 10px; color: var(--text-faint); flex-shrink: 0; }
.gantt-label-text  { min-width: 0; flex: 1; overflow: hidden; }
.gantt-label-client {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-label-formula {
  font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-sub-name {
  font-size: 10px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Bar rows */
.gantt-bar-row {
  position: relative;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  overflow: visible;
  transition: background 0.1s;
}
.gantt-bar-row:hover      { background: rgba(96,165,250,0.04); }
.gantt-sub-bar-row        { background: rgba(0,0,0,0.02); cursor: default; }
.gantt-sub-bar-row:hover  { background: rgba(0,0,0,0.04); }

/* Header ticks */
.gantt-tick {
  position: absolute;
  top: 0; bottom: 0;
  border-left: 1px solid var(--border);
  pointer-events: none;
}
.gantt-tick-month { border-color: var(--text-faint); }
.gantt-tick-week  { border-color: var(--border); }
.gantt-tick-month-label {
  position: absolute; top: 6px; left: 5px;
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  white-space: nowrap;
}
.gantt-tick-week-label {
  position: absolute; top: 22px; left: 4px;
  font-size: 9px; color: var(--text-faint);
}

/* Today line */
.gantt-today-line {
  position: absolute;
  top: 0; bottom: 0; width: 2px;
  background: var(--red);
  opacity: 0.55;
  z-index: 5;
  pointer-events: none;
}
.gantt-today-line::after {
  content: 'Today';
  position: absolute;
  top: 2px; left: -40px; text-align: right;
  font-size: 9px; font-weight: 700;
  color: var(--red); white-space: nowrap;
}

/* Bars */
.gantt-bar {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  height: 24px;
  border-radius: 5px;
  border: 1.5px solid #60a5fa;
  background: rgba(96,165,250,0.2);
  overflow: hidden;
  display: flex;
  align-items: center;
  transition: height 0.1s, box-shadow 0.1s;
  cursor: pointer;
  min-width: 8px;
}
.gantt-bar:hover { height: 28px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); z-index: 4; }
.gantt-bar-wo    { height: 18px; border-radius: 3px; }
.gantt-bar-wo:hover { height: 20px; }
.gantt-bar-past  { opacity: 0.45; }

.gantt-bar-done-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(96,165,250,0.35);
  transition: width 0.3s;
  border-radius: inherit;
}
.gantt-bar-label {
  position: relative; z-index: 1;
  font-size: 10px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 6px;
}

/* Milestone diamond */
.gantt-milestone {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 11px; color: #60a5fa;
  z-index: 6; pointer-events: none;
  line-height: 1;
}
.gantt-milestone-sm { font-size: 8px; }

/* Empty states */
.gantt-no-date {
  position: absolute; top: 50%; transform: translateY(-50%);
  left: 8px; font-size: 10px; color: var(--text-faint);
  font-style: italic; pointer-events: none;
}
.gantt-empty-labels, .gantt-empty-bars {
  padding: 48px 16px;
  font-size: 13px; color: var(--text-faint);
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   SCHEDULE — shared wrap + toolbar. Day/Week/Full Span all render
   into the SAME .gantt-outer continuous-scroll container (see
   .gantt-outer etc. above) — no separate week-grid layout anymore.
════════════════════════════════════════════════════════════ */
.sched-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  height: 100%;
}
.sched-so-items { margin: 2px 0; }
.sched-so-item-line {
  font-size: 9px; line-height: 1.35; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sched-link-wo-btn {
  margin-left: 4px; font-size: 10px; line-height: 1; padding: 2px 4px;
  border: none; background: transparent; color: var(--text-faint); cursor: pointer;
  border-radius: 3px; flex: none;
}
.sched-link-wo-btn:hover { color: var(--text); background: var(--surface-2); }

/* Day/Week tick header — one per business day (day name + date), denser
   than Full Span's sparse weekly ticks since Day/Week are zoomed in close. */
.sched-daytick {
  position: absolute;
  top: 0; bottom: 0;
  border-left: 1px solid var(--border);
  text-align: center;
  padding-top: 6px;
  pointer-events: none;
}
.sched-daytick-today {
  background: rgba(96, 165, 250, 0.08);
  border-left-color: var(--text-faint);
}
.sched-daytick-name {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-faint);
}
.sched-daytick-date {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-top: 1px;
}

/* Task markers — most stages are a point-in-time task, not a span, rendered
   as a pill (colored border + tinted fill, matching the stage/WO type color)
   with a glowing status dot leading the label — not started = hollow ring,
   in progress = solid dot with a soft glow, done = solid dot, dimmer glow.
   WO production stages are the one exception (real multi-day durations —
   see .sched-task-span below): those get an explicit width and stretch
   across the days they actually run, like a real calendar multi-day event. */
.sched-task {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  z-index: 1;
  padding: 2px 10px 2px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--task-color, #8a95a3);
  transition: filter 0.1s;
}
.sched-task:hover { filter: brightness(1.2); }
.sched-task-span {
  border-radius: 6px;
  justify-content: flex-start;
}
.sched-task-span .sched-task-label {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sched-task-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-sizing: border-box;
}
.sched-task-dot.status-not_started {
  background: transparent;
  border: 2px solid var(--status-color, #94a3b8);
}
.sched-task-dot.status-complete {
  background: var(--status-color, #4ade80);
  box-shadow: 0 0 4px 1px var(--status-color, #4ade80);
}
/* Any other status (in_progress, not_started_seen, pending_external, or any
   future custom stage from pm_task_stages) gets the same "active" filled +
   glow treatment, driven entirely by --status-color — so this never needs a
   new rule added just because the Tasks list's stage set changes. */
.sched-task-dot:not(.status-not_started):not(.status-complete) {
  background: var(--status-color, #60a5fa);
  box-shadow: 0 0 7px 2px var(--status-color, #60a5fa);
}
.sched-task-label {
  font-size: 10.5px; font-weight: 600;
}
.sched-so-progress-wrap {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.sched-so-progress-track {
  flex: 1; height: 6px; border-radius: 3px; background: var(--border);
  overflow: hidden;
}
.sched-so-progress-fill {
  height: 100%; border-radius: 3px; background: var(--green); transition: width 0.3s;
}
.sched-so-progress-pct {
  font-size: 9px; font-weight: 700; color: var(--text-faint);
  white-space: nowrap; flex: none;
}

/* Print-only header — schedulePrint() (schedule.js) fills this in with the
   current view's date range right before printing; hidden on screen. */
#sched-print-header { display: none; }

/* schedulePrint() (schedule.js) also toggles body.light-mode for the
   duration of the print so the page prints on a white background instead of
   the app's dark theme — this block only handles layout/visibility, not
   colors. Scoped under .sched-wrap so printing the Schedule tab never
   affects the (separate) Projects Gantt view's own .gantt-controls toolbar. */
@media print {
  .sidebar, .topbar { display: none !important; }
  .sched-wrap .gantt-controls { display: none !important; }
  #sched-print-header { display: block !important; }
  .main, .content, .sched-wrap, .gantt-outer, .gantt-chart-scroll {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .gantt-label-row, .gantt-bar-row { break-inside: avoid; }
  .gantt-empty-labels, .gantt-empty-bars { display: none; }
}
