/* ================================= */
/* MOBILE HEADER PADDING FIX         */
/* ================================= */

@media (max-width: 900px) {
  .toolbar {
    padding: 14px 16px !important;
    margin-bottom: 8px !important;
  }
  .unified-sticky-header {
    padding: 14px 16px !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .toolbar, .unified-sticky-header {
    padding: 14px 12px !important;
    gap: 8px !important;
  }
}

@media (max-width: 420px) {
  .toolbar, .unified-sticky-header {
    /* Increases top and bottom padding significantly for small phones */
    padding: 16px 8px !important; 
  }
  
  /* Give the Undo/Redo buttons a bit more height so they are easier to tap */
  .toolbar-btn {
    padding: 8px 12px !important;
  }
}
/* Blocked Drop Target Indicator */
.drop-target-blocked {
  background: rgba(220, 38, 38, 0.12) !important; /* Subtle red */
  transition: background 0.2s;
}
:root {
  --bg-main: #f8fafc;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --border-color: rgba(226, 232, 240, 0.8);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  /* Solid Spreadsheet-Style Colors */
  --cat-1-bg: #74a141; /* Solid Green */
  --cat-1-border: #5a8232;
  --cat-1-text: #ffffff;
  
  --cat-2-bg: #2e75b6; /* Solid Blue */
  --cat-2-border: #1f4e79;
  --cat-2-text: #ffffff;
  
  --cat-3-bg: #843c0c; /* Deep Brown/Red */
  --cat-3-border: #5b2a08;
  --cat-3-text: #ffffff;
  
  --cat-5-bg: #ed7d31; /* Solid Orange */
  --cat-5-border: #c65911;
  --cat-5-text: #ffffff;
  
  --cat-6-bg: #5b9bd5; /* Bright Blue */
  --cat-6-border: #2e75b6;
  --cat-6-text: #ffffff;
  
  --cat-7-bg: #7030a0; /* Purple */
  --cat-7-border: #4d216d;
  --cat-7-text: #ffffff;

  --cat-0-bg: #f8fafc;
  --cat-0-border: #e2e8f0;
  --cat-0-text: #334155;

  --category-row-height: 80px;
}

/* SOLID COLOR PILLS */
.cat-1 { background-color: var(--cat-1-bg); border-color: var(--cat-1-border); color: var(--cat-1-text); }
.cat-2 { background-color: var(--cat-2-bg); border-color: var(--cat-2-border); color: var(--cat-2-text); }
.cat-3 { background-color: var(--cat-3-bg); border-color: var(--cat-3-border); color: var(--cat-3-text); }
.cat-4 { background-color: var(--cat-1-bg); border-color: var(--cat-1-border); color: var(--cat-1-text); }
.cat-5 { background-color: var(--cat-5-bg); border-color: var(--cat-5-border); color: var(--cat-5-text); }
.cat-6 { background-color: var(--cat-6-bg); border-color: var(--cat-6-border); color: var(--cat-6-text); }
.cat-7 { background-color: var(--cat-7-bg); border-color: var(--cat-7-border); color: var(--cat-7-text); }
.cat-0 { background-color: var(--cat-0-bg); border-color: var(--cat-0-border); color: var(--cat-0-text); }


body, html {
  margin: 0;
  height: 100vh;
  height: 100dvh;   /* iPhone: the part not under Safari's address bar */
  width: 100vw;
  overflow: hidden;
  background: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,0.03) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,0.03) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,0.03) 0, transparent 50%);
  font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  /* overscroll-behavior: none; - Removed to allow native pull-to-refresh */
}

* { box-sizing: border-box; }

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.app-shell {
  padding: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 24px rgba(0,0,0,0.02);
}

.toolbar-left, .toolbar-center, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: white;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  white-space: nowrap;
}

.toolbar-btn:hover { background: #f1f5f9; transform: translateY(-1px); }

/* View / Edit mode toggle */
.toolbar-btn.mode-view {
  background: var(--bg-main);
  color: var(--text-muted);
}
.toolbar-btn.mode-edit {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #a5d6a7;
}
.toolbar-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.range-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}

.content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* Important for inner flex scrolling */
  width: 100%;
}

.sidebar { 
  display: none; /* Hidden requested sidebar cleanup */
  flex-direction: column; 
  gap: 16px; 
  flex: 0 0 250px;
}

.calendar-container {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.loading-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-muted, #888);
  letter-spacing: 0.04em;
}

.calendar-root {
  background: var(--bg-surface);
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: hidden;   /* rows fill the viewport — no vertical scroll */
  min-height: 0;
}

/* ================================= */
/* FLEX TIMELINE                     */
/* ================================= */
.timeline-matrix {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: white;
  min-width: 900px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 24px rgba(0,0,0,0.02);
  overflow: hidden;
}

.timeline-row {
  display: flex;
  position: relative;
  border-bottom: 1px solid var(--border-color);
}

.timeline-row:last-child {
  border-bottom: none;
}

.timeline-cell {
  flex: 0 0 auto;
  border-right: 1px solid var(--border-color);
  min-height: 0; /* let 1fr grid rows fill the viewport without a floor */
}

/* ================================= */
/* WEEKEND VISUAL CUES               */
/* ================================= */
.weekend {
  background-color: #f1f5f9 !important; /* Subtle Slate 100 grey */
}

/* Specific overrides to ensure it's visible in both views */
.timeline-cell.weekend, 
.vertical-day-label.weekend, 
.vertical-lane-cell.weekend,
.timeline-col-header.weekend {
  background-color: #f1f5f9 !important;
}

/* ================================= */
/* TODAY VISUAL CUES                */
/* ================================= */
.today-header {
  background-color: rgba(59, 130, 246, 0.08) !important; /* Extremely subtle blue */
  position: relative;
}

.today-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

.today-text {
  color: var(--accent) !important;
  font-weight: 800 !important;
}

/* ================================= */
/* COMPACT INTEGRATED NAV            */
/* ================================= */
.compact-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compact-nav .toolbar-btn {
  padding: 4px 8px;
  font-size: 13px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.compact-nav .toolbar-btn:hover {
  background: #f1f5f9;
}

.compact-nav .toolbar-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.view-switcher-container {
  position: absolute;
  top: 8px;
  right: 16px;
  z-index: 60;
  display: flex;
  gap: 4px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 100px auto;
  border-bottom: 1px solid var(--border-color);
  min-width: max-content;
}

.timeline-row-header {
  grid-column: 1;
  background: white;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  position: sticky;
  left: 0;
  z-index: 20;
  align-self: stretch; /* Fills the height of the 3 tracks */
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-col-header {
  background: #f8fafc;
  padding: 4px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ================================= */
/* PROJECT PILL COMPONENTS           */
/* ================================= */
.project-pill {
  font-size: 14px;
  font-weight: 600;
  color: white;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: grab;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.1s;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0,0,0,0.1);
  border-style: solid;
  border-width: 1px;
  border-bottom-width: 5px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  line-height: 1.2;
  -webkit-user-select: none;
  touch-action: none;
  pointer-events: auto !important; /* Ensure pills are always clickable */
}

/* Horizontal View Specifics (Global) */
.project-pill-horizontal {
    /* Stretch to fill the lane row — height driven entirely by the 1fr grid row */
    height: auto;
    min-height: 0;
    padding: 6px 10px;
    z-index: 10;
}

.project-pill-horizontal .title {
    font-size: clamp(13px, 1.8vh, 22px);
    font-weight: 600;
    overflow: hidden;
    /* We still use line-clamp but allow it to be more generous or removed if you want infinite expansion */
    display: -webkit-box;
    -webkit-line-clamp: 6; 
    -webkit-box-orient: vertical;
}

/* Timeline Matrix Grid Structure */
.timeline-track-container {
    display: grid;
    position: relative;
    pointer-events: none; /* Let clicks pass through empty grid space to background cells */
}

.timeline-cell-background-wrapper {
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    display: flex;
    pointer-events: none;
    z-index: 1;
}

.timeline-cell {
    pointer-events: auto;
    border-right: 1px solid var(--border-color);
}

.project-pill.is-editing {
  box-shadow: 0 0 0 3px var(--accent);
  z-index: 1000 !important;
  transform: scale(1.02);
  cursor: text;
}

.project-pill .title[contenteditable="true"] {
  outline: none;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 2px 4px;
}

/* Handles */
.resize-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 12px;
  cursor: ew-resize;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-pill.is-active {
  outline: 2px solid #1e40af;
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35), 0 4px 12px rgba(0,0,0,0.12) !important;
  z-index: 10;
}

.project-pill:hover .resize-handle,
.project-pill.is-active .resize-handle {
  opacity: 0.6;
}

.resize-handle:hover {
  opacity: 1 !important;
  background: rgba(255,255,255,0.2);
}

.resize-handle::after {
  content: "";
  width: 2px;
  height: 20px;
  background: white;
  border-radius: 2px;
}

.resize-left { left: 0; }
.resize-right { right: 0; }

/* Vertical Resize Handles (Top/Bottom) */
.resize-top, .resize-bottom {
    left: 0; 
    right: 0;
    width: 100%;
    height: 12px;
    cursor: ns-resize;
    top: auto;
    bottom: auto;
}

.resize-top { top: 0; }
.resize-bottom { bottom: 0; }

.resize-top::after, .resize-bottom::after {
    width: 24px;
    height: 2px;
}

/* Dragging States */
.project-pill.is-dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.dragging-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  transform: scale(1.05);
  opacity: 0.9;
}

.drop-target-hover {
  background: rgba(59, 130, 246, 0.2) !important;
  outline: 2px dashed var(--accent);
}

.landing-ghost {
  opacity: 0.5 !important;
  pointer-events: none !important;
  border: 3px dashed var(--accent) !important;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4) !important;
  z-index: 100 !important; /* Always on top of existing pills */
  filter: brightness(1.2);
  transform: scale(1.02);
  transition: all 0.1s ease;
  grid-row: auto; 
  grid-column: auto;
  animation: landingPulse 1.5s infinite ease-in-out;
}

@keyframes landingPulse {
  0% { opacity: 0.4; transform: scale(1.01); }
  50% { opacity: 0.7; transform: scale(1.03); }
  100% { opacity: 0.4; transform: scale(1.01); }
}

/* Ensure vertical ghosts don't expand weirdly */
.vertical-phase-col .landing-ghost {
    width: 100% !important;
    margin: 5px 0 !important;
}

/* Fix target detection during dragging */
body.is-dragging-active .project-pill {
    pointer-events: none !important;
}

.project-pill {
  touch-action: none !important;
  pointer-events: auto !important;
  -webkit-user-select: none;
  user-select: none;
}

/* Force container to allow our custom drag logic to take priority */
.timeline-matrix, .calendar-root, .mobile-timeline-container {
  touch-action: pan-y pinch-zoom; /* Allow vertical scroll/zoom, block horizontal swipe-to-scroll */
}

body.is-dragging-active, 
body.is-dragging-active * {
  touch-action: none !important;
  overscroll-behavior: none !important;
}

/* Removed duplicate absolute positioning rules for horizontal pills */

.project-pill-vertical {
  height: calc(100% - 8px);
  margin: 4px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 14px; /* overridden by fitPillText.js at runtime */
  overflow: hidden;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-align: center;
  /* Allow wrapping on whole words only — never break a word mid-character */
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

.project-pill strong, .project-pill .title {
  font-weight: 500;
  display: block;
}

/* SECTION DIVIDER */
.timeline-divider {
  height: 4px;
  background: #94a3b8;
  margin-top: -1px;
  position: relative;
  z-index: 5;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;  
  overflow: hidden;
}

.project-pill-monthly {
    min-height: 24px !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* ================================= */
/* RESPONSIVE PIVOT                  */
/* ================================= */
@media (max-width: 900px) {
  .toolbar {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    height: auto;
  }
  
  .toolbar-left, .toolbar-right {
    justify-content: center;
    width: 100%;
  }

  .toolbar-center {
    order: -1;
    margin-bottom: 8px;
    text-align: center;
    width: 100%;
  }

  .calendar-root {
    padding: 8px;
  }

  .timeline-matrix {
    min-width: 0;
    border: none;
    box-shadow: none;
  }
  
  .timeline-row-header {
    flex: 0 0 100px;
    font-size: 13px;
  }
}

/* Additional responsive scaling for smaller phones/tablets */
@media (max-width: 600px) {
  .toolbar { padding: 8px 10px; }

  .toolbar-btn { padding: 6px 10px; font-size: 12px; }

  .header-month, .range-label { font-size: 15px; }

  .timeline-row-header { flex: 0 0 90px; font-size: 13px; padding: 6px 8px; }

  .project-pill-horizontal { height: 80px; padding: 8px 12px; font-size: 17px; }
  .project-pill-vertical { font-size: 15px; padding: 6px 8px; }

  .view-switcher-container { top: 6px; right: 8px; }

  /* ensure the timeline doesn't force horizontal overflow on smaller widths */
  .timeline-matrix { overflow-x: hidden; }
}

@media (max-width: 380px) {
  .toolbar { padding: 6px 8px; }
  .toolbar-btn { padding: 6px 8px; font-size: 11px; }
  .header-month, .range-label { font-size: 14px; }
  .timeline-row-header { flex: 0 0 76px; font-size: 12px; }
  .project-pill-horizontal { height: 72px; font-size: 13px; }
  .project-pill-vertical { font-size: 14px; }
  .timeline-matrix { font-size: 12px; }
  .view-switcher-container { right: 6px; top: 6px; }
}

/* Strong override to ensure header scales on devices/emulation where other styles interfere */
@media (max-width: 600px) {
  .unified-sticky-header .header-month { font-size: 15px !important; }
  .unified-sticky-header .toolbar-btn { font-size: 12px !important; }
}

@media (max-width: 380px) {
  .unified-sticky-header .header-month { font-size: 14px !important; }
  .unified-sticky-header .toolbar-btn { font-size: 11px !important; }
}

.timeline-matrix {
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  cursor: grab;
  touch-action: pan-y; /* Let browser handle vertical scroll, we handle horizontal drag/wheel */
  -webkit-user-drag: none;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

.timeline-matrix::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.timeline-matrix.grabbing {
    cursor: grabbing;
}

/* SEMANTIC GRID CLASSES (PHASE 11) */
.timeline-grid-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Horizontal view: tab strip sits to the left of the scrollable matrix */
.horizontal-wrapper {
    flex-direction: row;
}

.h-matrix-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Activity-bar tab strip (VS Code style) ─────────────────────────────── */
.h-tab-strip {
    width: 36px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    border-right: 1px solid var(--border-color);
    z-index: 50;
}

.h-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 14px;
    gap: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    color: #94a3b8;
    transition: background 0.15s, color 0.15s;
    border-bottom: 1px solid var(--border-color);
    min-height: 0;
}

.h-tab-btn:last-child {
    border-bottom: none;
}

.h-tab-btn:hover:not(.active) {
    background: #e2e8f0;
    color: #475569;
}

/* Active tab: white background + 3 px accent left border */
.h-tab-btn.active {
    background: #ffffff;
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

.h-tab-icon {
    font-size: 16px;
    line-height: 1;
}

/* Rotated label — readable at a glance */
.h-tab-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    white-space: nowrap;
    opacity: 0.65;
    transition: opacity 0.15s;
}

.h-tab-btn.active .h-tab-label {
    opacity: 1;
}

/* Inactive tab: tiny arrow hint that it's clickable */
.h-tab-btn:not(.active)::after {
    content: '›';
    position: absolute;
    right: 3px;
    top: 6px;
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1;
    pointer-events: none;
}

.timeline-row.header-row {
    flex: 0 0 auto;
    min-width: max-content;
}

.timeline-header-container {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.timeline-track-container {
    display: grid;
    padding: 6px 0;
    pointer-events: none;
    overflow: hidden; /* clip pills so they can't bleed into adjacent sections */
    /* Default 3-lane; JS overrides via inline grid-template-rows for other counts */
    grid-template-rows: repeat(3, 1fr);
    /* Prevent pills with out-of-range gridRow from creating implicit rows */
    grid-auto-rows: 0px;
    /* Must have explicit height so 1fr lanes can share it */
    height: 100%;
    box-sizing: border-box;
}

.timeline-cell-background-wrapper {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    pointer-events: none;
}

.timeline-cell.pill-target {
    pointer-events: auto;
    box-sizing: border-box;
}

/* Read-only section cells — no hover cursor, no click affordance */
.readonly-cell {
    cursor: default !important;
    pointer-events: none;
}

/* Read-only pills — show as display-only, no drag cursor */
.project-pill[data-readonly="true"] {
    cursor: default !important;
    pointer-events: none;
    opacity: 0.85;
}

.timeline-row-header.sticky-col {
  flex: 0 0 100px;
  min-width: 100px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  font-size: 16px;
  background: white;
  z-index: 40;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 40;
  background: white;
  box-shadow: 4px 0 8px rgba(0,0,0,0.05);
}

/* Small phones adjustments */
@media (max-width: 420px) {
  :root {
    --pill-vertical-height: 40px;
    --pill-vertical-gap: 6px;
    --pill-vertical-padding: 16px;
  }

  .unified-sticky-header, .toolbar {
    padding: 6px 8px;
  }

  .header-month, .range-label {
    font-size: 14px;
  }

  .toolbar-btn {
    padding: 6px 8px;
    font-size: 12px;
  }

  .view-switcher-container {
    top: 6px;
    right: 8px;
  }

  .timeline-row-header {
    flex: 0 0 80px;
    padding: 6px 8px;
    font-size: 13px;
  }

  .timeline-cell {
    min-height: 44px;
  }

  .project-pill-vertical {
    min-height: var(--pill-vertical-height);
    padding: 6px 8px;
    font-size: 16px;
  }

  .project-pill-horizontal {
    height: 76px;
    padding: 8px 12px;
    font-size: 16px;
  }

  /* Force the mobile timeline to use vertical scrolling only and hide horizontal scrollbar */ 
  .mobile-timeline-container.timeline-matrix, #mobileTimeline {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Ensure no horizontal overflow on timeline matrix for small screens */ 
  .timeline-matrix {
    overflow-x: hidden;
    font-size: 13px;
  }

  .date-day { font-size: 11px; }
  .date-num { font-size: 16px; }
}

.timeline-row-header.sticky-col {
  flex: 0 0 100px;
  min-width: 100px;
}

.timeline-matrix * {
    -webkit-user-drag: none;
}

@media (max-width: 600px) {
    .toolbar-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .view-switcher {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }
}

.timeline-event-bar:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  z-index: 15;
}

/* ================================= */
/* UNIFIED VERTICAL GRID             */
/* ================================= */
.unified-vertical-grid {
    display: grid;
    grid-template-rows: repeat(var(--days-count, 7), minmax(120px, 1fr));
    position: relative;
    background: white;
    min-width: 100%;
    height: 100%; 
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.vertical-grid-header {
    display: grid;
    grid-template-columns: 80px repeat(var(--lanes-count, 3), 1fr);
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
}

.vertical-header-cell {
    padding: 12px 8px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    text-align: center;
    border-right: 1px solid var(--border-color);
    color: var(--text-muted);
}

.vertical-day-row {
    display: grid;
    grid-template-columns: 80px auto;
    border-bottom: 1px solid var(--border-color);
    min-height: 120px;
    height: 100%;
}

.vertical-day-label {
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 2px solid var(--border-color);
    background: #f8fafc;
    width: 80px;
    box-sizing: border-box;
}

.vertical-day-label .day-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.vertical-day-label .day-number { font-size: 20px; font-weight: 800; }

.vertical-pills-container {
    position: absolute;
    top: 0;
    left: 80px;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(var(--lanes-count, 3), 1fr);
    grid-template-rows: repeat(var(--days-count, 7), minmax(120px, 1fr));
    /* Prevent out-of-range pills from creating implicit rows/columns */
    grid-auto-rows: 0px;
    grid-auto-columns: 0px;
    pointer-events: none;
}

.vertical-lanes-bg {
    display: grid;
    grid-template-columns: repeat(var(--lanes-count, 3), 1fr);
    width: 100%;
}

.vertical-lane-cell {
    border-right: 1px solid var(--border-color);
    min-height: 100%;
}

.vertical-lane-cell:last-child { border-right: none; }

/* ================================= */
/* BROWSER TAB STYLES                */
/* ================================= */
.tab-bar {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    margin-bottom: -1px;   /* bottom row overlaps the grid top border */
    z-index: 10;
    position: relative;
    margin-top: 8px;
}

/* Both rows indent to align with the 80px day-label sticky column */
.tab-row {
    display: flex;
    padding-left: 80px;
    gap: 0;
}

/* ── TOP row: the inactive group — sits above, acts as a nav header ───────── */
.tab-row-top .tab-btn {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    padding: 7px 8px;
    background: #e2e8f0;          /* slightly muted — visually secondary */
    color: var(--text-muted);
    font-weight: 500;
}
.tab-row-top .tab-btn:hover {
    background: #cbd5e1;
}
/* No active state needed on top row — active tab is always on the bottom row */

/* ── BOTTOM row: the active group — sits directly above the grid ──────────── */
.tab-row-bottom .tab-btn {
    border-radius: 0;             /* square: sits between top row and grid */
    border-top: none;             /* suppress double border with top row */
    font-size: 13px;
    padding: 9px 8px;
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
}
.tab-row-bottom .tab-btn:hover {
    background: #e2e8f0;
}
.tab-row-bottom .tab-btn.active {
    background: white;
    color: var(--text-main);
    border-bottom: 1px solid white;  /* "overlap" trick — active tab merges with grid */
    font-weight: 700;
}

/* ── Single-row fallback (all sections fit in one group) ─────────────────── */
.tab-row:only-child .tab-btn {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    padding: 10px 8px;
}
.tab-row:only-child .tab-btn.active {
    background: white;
    color: var(--text-main);
    border-bottom: 1px solid white;
}

.tab-btn {
    flex: 1; /* overridden per-tab by inline style for variable-width tabs */
    min-width: 0; /* allow tabs to shrink below their content width */
    padding: 10px 8px;
    text-align: center;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.tab-btn:hover {
    background: #e2e8f0;
}

.tab-btn.active {
    background: white;
    color: var(--text-main);
    border-bottom: 1px solid white; /* The "overlap" trick */
    font-weight: 700;
}

.edit-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.edit-modal-content {
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #333);
  padding: 24px;
  border-radius: 12px;
  width: 90%; max-width: 450px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.edit-modal-content h3 { margin-top: 0; font-size: 1.2rem; }
#editInput {
  width: 100%; padding: 12px; border-radius: 8px;
  border: 1px solid var(--border-color, #ddd);
  background: var(--bg-input, #fff);
  color: var(--text-main, #333);
  font-size: 1rem; margin: 16px 0;
  resize: vertical;
}
.edit-modal-actions { display: flex; gap: 12px; justify-content: flex-end; }
.btn-primary, .btn-secondary {
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600;
}
.btn-primary { background: var(--accent, #3b82f6); color: white; }
.btn-secondary { background: var(--bg-muted, #f3f4f6); color: var(--text-main, #333); }

@media (prefers-color-scheme: dark) {
  .edit-modal-content { background: #1e1e1e; border: 1px solid #333; }
  #editInput { background: #2d2d2d; border-color: #444; color: #eee; }
  .btn-secondary { background: #333; color: #eee; }
}


/* ================================= */
/* SYNC BADGE (data freshness glyph) */
/* ================================= */
.sync-badge {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: 10px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-muted);
  font: 600 12px/1.2 inherit;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  cursor: default;
}
.sync-badge[hidden] { display: none; }
.sync-badge[data-state="stale"] {
  color: #b45309;
  border-color: #fcd34d;
  background: #fffbeb;
  cursor: pointer;
}
.sync-glyph { font-size: 14px; line-height: 1; }
.sync-glyph.spin { display: inline-block; animation: sync-spin 1s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sync-glyph.spin { animation: none; } }

/* ================================= */
/* DESKTOP SHEET VIEW (days as rows) */
/* ================================= */
.sheet-wrapper { flex: 1; min-height: 0; }

.timeline-matrix.sheet-matrix {
    flex: 1;
    min-height: 0;
    overflow: auto;                 /* down for days, sideways if the columns don't fit */
    background: white;
    cursor: default;
}

.sheet-grid {
    display: grid;
    position: relative;
    width: max-content;   /* fixed column widths; wider than the window → sideways scroll */
}

/* Header: two sticky rows (section names, then lane numbers) */
.sg-corner, .sg-group, .sg-lane-head {
    position: sticky;
    background: #f8fafc;
    z-index: 30;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.sg-corner  { top: 0; left: 0; z-index: 40; border-right: 2px solid #cbd5e1; border-bottom: 2px solid #cbd5e1; }
.sg-group   { top: 0; height: 34px; border-left: 2px solid #cbd5e1; border-bottom: 1px solid var(--border-color); gap: 4px; }
.sg-group[style*="1 / 3"] { height: auto; border-bottom: 2px solid #cbd5e1; }
.sg-lane-head { top: 34px; height: 22px; border-left: 1px solid #e2e8f0; border-bottom: 2px solid #cbd5e1; font-size: 10px; }
.sg-icon { font-size: 13px; }

/* Date column, sticky on the left */
.sg-day {
    position: sticky;
    left: 0;
    z-index: 20;
    background: #f8fafc;
    border-right: 2px solid #cbd5e1;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    box-sizing: border-box;
    font-size: 12px;
}
.sg-day .sg-dn   { font-weight: 600; color: var(--text-muted); font-size: 11px; width: 26px; }
.sg-day .sg-dd   { font-weight: 800; font-size: 16px; color: var(--text-main); }
.sg-day .sg-month { font-size: 10px; font-weight: 700; color: #2563eb; text-transform: uppercase; }
.sg-day.weekend  { font-size: 10px; color: #94a3b8; padding-top: 0; padding-bottom: 0; }
.sg-day.weekend .sg-dn { font-size: 10px; width: auto; }
.sg-day.today    { background: #dbeafe; }

/* Background cells */
.sg-cell {
    border-left: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    box-sizing: border-box;
}
.sg-cell.grp-start { border-left: 2px solid #cbd5e1; }
.sg-cell.today     { background: rgba(59, 130, 246, 0.06); }
/* .no-col: the sheet has no such column that day (or the day is outside its year): looks empty, never a drop target */
.sg-cell.clickable-cell:hover { background: rgba(59, 130, 246, 0.08); }
.sg-day.wk-start, .sg-cell.wk-start { border-top: 2px solid #94a3b8; }

/* Holiday / whole-row band */
.sg-holiday {
    background: rgba(148, 163, 184, 0.18);
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    white-space: nowrap;
}

/* Bookings */
.sheet-grid .project-pill {
    z-index: 5;
    height: auto !important;
    min-height: 0 !important;
    margin: 2px 3px !important;
    padding: 3px 6px !important;
    font-size: 12px !important;
    line-height: 1.2;
    border-radius: 6px;
    border-bottom-width: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    justify-content: flex-start !important;
    align-items: flex-start !important;
    text-align: left !important;
}
.sheet-grid .project-pill .title {
    font-size: 12px !important;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;
}

/* Zoom switch (desktop): 3 jours / Semaine / Mois */
.zoom-switch { display: flex; gap: 0; }
.zoom-switch .toolbar-btn { border-radius: 0; margin: 0; }
.zoom-switch .toolbar-btn:first-child { border-radius: 8px 0 0 8px; }
.zoom-switch .toolbar-btn:last-child  { border-radius: 0 8px 8px 0; }
.zoom-switch .toolbar-btn.active { background: #1e293b; color: white; border-color: #1e293b; }

/* Zoom levels */
.sheet-grid.zoom-3d .project-pill .title     { font-size: 14px !important; font-weight: 700; }
.sheet-grid .project-pill .detail {
    font-size: 12px; font-weight: 400; white-space: pre-line; opacity: 0.85; margin-top: 4px;
    overflow: hidden;
}
.sheet-grid.zoom-month .project-pill          { margin: 1px 3px !important; padding: 1px 5px 0 !important; border-bottom-width: 2px; }
.sheet-grid.zoom-month .project-pill .title   { font-size: 9px !important; line-height: 1.1; -webkit-line-clamp: 2; }
.sheet-grid.zoom-month .sg-day .sg-dd         { font-size: 13px; }

/* Toolbar on one row at every width (wide screens had no rule, so the three
   groups stacked vertically and clipped the ‹ button). Phone rules above win. */
.unified-sticky-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 12px;
}
.unified-sticky-header .header-left,
.unified-sticky-header .header-right { flex: 1 1 0; display: flex; }
.unified-sticky-header .header-right { justify-content: flex-end; }

/* Block titles stay at the top of the screen while the rest of the block is
   visible, so a booking that started above the screen still shows its name.
   overflow: clip (not hidden) keeps the matrix as the sticky container. */
.sheet-grid .project-pill { overflow: clip; }
.sheet-grid .project-pill .title {
    position: sticky;
    top: 56px;            /* below the sticky column headers */
}

/* 2 semaines: titles up to 3 lines */
.sheet-grid.zoom-2w .project-pill .title { -webkit-line-clamp: 3; }

/* 3 semaines: titles up to 2 lines */
.sheet-grid.zoom-3w .project-pill .title { font-size: 10.5px !important; -webkit-line-clamp: 2; }
.sheet-grid.zoom-month .sg-day.weekend   { font-size: 0; }
.sheet-grid.zoom-month .sg-day.weekend > * { display: none; }

/* ================================= */
/* YEAR SCRUBBER (desktop)           */
/* ================================= */
.year-scrubber {
    position: absolute;
    top: 110px;            /* below the toolbar and the column headers */
    bottom: 14px;
    right: 14px;
    width: 64px;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    cursor: pointer;
    user-select: none;
}
.year-scrubber.visible { opacity: 1; pointer-events: auto; }
.ys-track {
    position: absolute; top: 0; bottom: 0; right: 0; width: 12px;
    border-radius: 6px; background: rgba(241, 245, 249, 0.95);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35); overflow: hidden;
}
.ys-weeks { position: absolute; inset: 0; display: flex; flex-direction: column; }
.ys-band  { position: absolute; left: 0; right: 0; background: rgba(15, 23, 42, 0.35); border-radius: 3px; }
.ys-today { position: absolute; left: -2px; right: -2px; height: 2px; background: #ef4444; }
.ys-labels { position: absolute; top: 0; bottom: 0; right: 18px; left: 0; }
.ys-month {
    position: absolute; right: 0; transform: translateY(-1px);
    font-size: 10px; font-weight: 700; color: #475569; text-transform: uppercase;
    background: rgba(255, 255, 255, 0.85); padding: 0 3px; border-radius: 3px;
}
.ys-bubble {
    display: none; position: absolute; right: 22px; transform: translateY(-50%);
    background: #0f172a; color: white; font-size: 12px; font-weight: 600;
    padding: 5px 10px; border-radius: 14px; white-space: nowrap; pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Year bar lives in its own lane: the calendar stops 24 px short of the right
   edge, so the bar never covers a column. Month names show only on hover. */
.sheet-wrapper:not(.compact) { padding-right: 24px; box-sizing: border-box; }   /* desktop only */
.year-scrubber { right: 6px; }
.year-scrubber .ys-labels { opacity: 0; transition: opacity 0.15s ease; }
.year-scrubber:hover .ys-labels { opacity: 1; }

/* ================================= */
/* SHEET VIEW ON THE PHONE           */
/* ================================= */
/* Browser's own scrolling both ways (momentum included); sideways it settles
   on a group start (.sg-snap), just right of the pinned date column.
   pan-x pan-y: no browser pinch-zoom — two fingers drive the app's zoom. */
.timeline-matrix.sheet-matrix {
    scroll-snap-type: x mandatory;
    scroll-padding-left: 96px;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.sheet-wrapper.compact .timeline-matrix.sheet-matrix { scroll-padding-left: 52px; }
.sg-snap { scroll-snap-align: start; width: 1px; justify-self: start; pointer-events: none; }
/* A finger on a booking may still scroll; a 300 ms hold (no movement) starts a
   drag, and the drag engine then blocks scrolling itself. (!important: beats the
   old `.project-pill { touch-action: none !important }`.) */
.sheet-grid .project-pill { touch-action: pan-x pan-y !important; }
body.is-dragging-active .sheet-grid .project-pill { touch-action: none !important; }

/* Compact date column */
.sheet-grid.compact .sg-day { flex-direction: column; justify-content: center; align-items: center; gap: 0; padding: 0 2px; }
.sheet-grid.compact .sg-day .sg-dn { width: auto; font-size: 9px; }
.sheet-grid.compact .sg-day .sg-dd { font-size: 15px; }
.sheet-grid.compact .sg-day .sg-month { font-size: 8px; }
.sheet-grid.compact .sg-day.weekend { flex-direction: row; gap: 3px; font-size: 8px; }
.sheet-grid.compact .sg-group { font-size: 10px; }

/* Today: a frame around the whole row */
.sg-today-frame {
    border: 2px solid #2563eb;
    border-radius: 4px;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    pointer-events: none;
    z-index: 25;           /* above bookings and the pinned date column */
    position: relative;
}

/* ================================= */
/* ONE BLOCK PER MONTH               */
/* ================================= */
/* Each month is its own grid with its own header (the sheet's columns and
   titles for that month). The header is sticky inside its month, so the next
   month's header pushes it away. */
/* Each month is framed on its own: a line down its right edge and along its
   bottom, each as wide/tall as that month (months can have different widths). */
.sheet-grid { border-right: 2px solid #94a3b8; border-bottom: 3px solid #94a3b8; }
.sg-group { text-transform: none; font-size: 11.5px; padding: 0 6px; line-height: 1.15; text-align: center; }
.sg-group .sg-title {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden; overflow-wrap: normal; word-break: normal;
}
/* Single columns (often narrow): icon on its own line, title on 2 lines under it */
.sg-group[style*="1 / 3"] { flex-direction: column; gap: 1px; font-size: 10.5px; padding: 2px 4px; }
.sg-group[style*="1 / 3"] .sg-icon { font-size: 11px; line-height: 1; }
.sg-corner { color: #2563eb; font-size: 11px; text-align: center; padding: 0 4px; line-height: 1.2; }
.sheet-grid.compact .sg-corner { font-size: 10px; }
.sheet-grid.compact .sg-group { font-size: 10px; padding: 0 3px; }
.sg-missing { color: #94a3b8; font-weight: 600; justify-content: flex-start; padding-left: 16px; }

/* Month name written vertically down the left edge of the date column.
   The band runs the whole month; the name sticks below the header. */
.sg-month-strip {
    position: sticky; left: 0; z-index: 22;
    width: 18px; justify-self: start;
    background: #eff6ff; border-right: 1px solid #bfdbfe;
    pointer-events: none;
    overflow: clip;     /* a month with only a sliver on screen keeps its name to itself (clip, not hidden: hidden would stop the name from sticking) */
}
.sg-month-strip span {
    position: sticky; top: 64px; display: block;
    writing-mode: vertical-rl; transform: rotate(180deg);
    padding: 10px 0;
    font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: #2563eb; white-space: nowrap;
}
.sg-day { padding-left: 26px; }
.sheet-grid.compact .sg-month-strip { width: 14px; }
.sheet-grid.compact .sg-month-strip span { font-size: 9px; letter-spacing: 0.05em; }
.sheet-grid.compact .sg-day { padding-left: 15px; padding-right: 1px; }

/* ── Floating "today" button (phone and desktop): tap = today, hold = move it ── */
@media all {
  #todayFab {
    display: flex; flex-direction: column; align-items: stretch;
    position: fixed; z-index: 900; width: 46px; height: 46px; padding: 0;
    border: none; border-radius: 12px; overflow: hidden; background: #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.08);
    touch-action: none; user-select: none; -webkit-user-select: none;
    -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
    opacity: 0.92; transition: transform 0.15s, box-shadow 0.15s;
  }
  #todayFab .tf-top { height: 12px; background: #2563eb; flex: none; }
  #todayFab .tf-day {
    flex: 1; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; color: #1e3a8a; line-height: 1;
  }
  #todayFab.is-pressed { transform: scale(0.88); }
  @media (hover: hover) { #todayFab { cursor: pointer; } #todayFab:hover { opacity: 1; } }
  #todayFab.is-moving { cursor: grabbing; }
  #todayFab.is-moving {
    transform: scale(1.22); opacity: 1;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.38), 0 0 0 2px #2563eb;
  }
  /* Out of the way while a booking is being moved or typed into. */
  body.is-dragging-active #todayFab,
  body:has(.project-pill.is-editing) #todayFab { opacity: 0; pointer-events: none; }
}

/* Day lines inside a multi-day booking (sheetView): thin, see-through, at
   the top of each day after the first. Above the block, never clickable. */
.sg-pill-day {
  position: relative; align-self: stretch; min-height: 0; overflow: hidden;
  margin: 0 3px; padding: 4px 6px 0;
  z-index: 6; pointer-events: none;
  font-size: 12px; font-weight: 400; line-height: 1.2;
  color: rgba(255, 255, 255, 0.7);
}
/* the day boundary line */
.sg-pill-day::before {
  content: ''; position: absolute; top: -0.5px; left: 2px; right: 2px; height: 1px;
  background: rgba(255, 255, 255, 0.45);
}
.sg-pill-day.on-pale::before  { background: rgba(15, 23, 42, 0.13); }
.sg-pill-day.on-light::before { background: rgba(15, 23, 42, 0.18); }
.sg-pill-day.on-pale, .sg-pill-day.on-light { color: rgba(26, 26, 26, 0.6); }
/* the day's text: the block's name, faded (colour-only day), or the day's
   own cell as typed (.own: full strength, extra lines included) */
.sg-pill-day .nm {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: break-word; white-space: pre-line;
}
.sg-pill-day .nm b { font-weight: 600; }
.sg-pill-day .nm.own { color: #fff; }
.sg-pill-day.on-pale .nm.own, .sg-pill-day.on-light .nm.own { color: #1a1a1a; }
.sheet-grid.zoom-3d .sg-pill-day      { font-size: 14px; }
.sheet-grid.zoom-3d .sg-pill-day .nm b { font-weight: 700; }
.sheet-grid.zoom-3w .sg-pill-day    { font-size: 10.5px; }
.sheet-grid.zoom-month .sg-pill-day { font-size: 9px; line-height: 1.1; padding: 2px 5px 0; }
/* While a booking is edited or dragged its repeated names would sit on top. */
.sheet-grid:has(.project-pill.is-editing) .sg-pill-day .nm,
body.is-dragging-active .sg-pill-day .nm { visibility: hidden; }
/* Every day carries the name now: a block's title no longer needs to follow
   the screen down the block (it would cover the later days' names). */
.sheet-grid .project-pill:not([data-span="1"]) .title { position: static; }

/* Section backgrounds: Production warm, Livraison blue, so the two read as
   two zones at a glance. Empty cells and the section header only — weekends
   stay grey, today stays blue, bookings keep their own colours. */
.sg-cell[data-category-group="production"]:not(.weekend):not(.today) { background: #fdf6e9; }
.sg-cell[data-category-group="livraison"]:not(.weekend):not(.today)  { background: #e9f2fd; }
.sg-group.sec-production { background: #fbecd0; }
.sg-group.sec-livraison  { background: #d9e9fb; }
.sg-cell[data-category-group].clickable-cell:hover { background: rgba(59, 130, 246, 0.12); }
