/* ── Board page layout ───────────────────────────────────────────────────── */

.board-page {
  overflow: hidden;
  height: 100vh;
}

.board-page .main-footer {
  display: none;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.board-toolbar {
  position: fixed;
  top: 80px; /* below main-header */
  left: 0;
  right: 0;
  height: 46px;
  background: #fff;
  border-bottom: 1px solid #e5ded5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 490;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.toolbar-right {
  justify-content: flex-end;
}

.toolbar-center {
  flex: 1;
  text-align: center;
}

.board-title {
  font-size: 15px;
  font-weight: 600;
  color: #7a6855;
  letter-spacing: 0.5px;
}

.tool-btn {
  background: #f5f2ed;
  border: 1px solid #e5ded5;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #5d4c3c;
  transition: all 0.15s;
  white-space: nowrap;
}

.tool-btn:hover {
  background: #ece7e0;
  border-color: #c8b8a8;
}

.tool-btn.create-btn {
  background: #7a6855;
  color: white;
  border-color: #7a6855;
  font-weight: 600;
}

.tool-btn.create-btn:hover {
  background: #5d4c3c;
  border-color: #5d4c3c;
}



.zoom-display {
  font-size: 12px;
  color: #999;
  min-width: 40px;
  text-align: center;
}

/* ── Main wrapper (sidebar + canvas) ─────────────────────────────────────── */

.board-wrapper {
  position: fixed;
  top: 116px; /* header + toolbar */
  left: 0;
  right: 0;
  bottom: 60px; /* above bottom nav */
  display: flex;
  overflow: hidden;
}

/* ── Ticket sidebar ──────────────────────────────────────────────────────── */

.ticket-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #faf8f5;
  border-right: 1px solid #e5ded5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease, opacity 0.25s ease;
  -webkit-overflow-scrolling: touch;
}

.ticket-sidebar.drop-target {
  background: rgba(196,169,119,0.10);
  border-right: 2px dashed #7a6855;
  box-shadow: inset -4px 0 12px rgba(122,104,85,0.12);
  transition: background 0.15s, box-shadow 0.15s;
}

.ticket-sidebar.drop-target .sidebar-hint {
  color: #7a6855;
  font-weight: 600;
}

.ticket-sidebar.collapsed {
  width: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid #e5ded5;
  font-size: 12px;
  font-weight: 600;
  color: #7a6855;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-search {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid #e0d8cf;
  border-radius: 5px;
  background: #fff;
  color: #333;
  outline: none;
  box-sizing: border-box;
}

.sidebar-search:focus {
  border-color: #7a6855;
}

.sidebar-ticket-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  touch-action: pan-y;
}

.sidebar-loading {
  font-size: 12px;
  color: #aaa;
  text-align: center;
  padding: 20px 0;
}

.sidebar-hint {
  padding: 8px 12px;
  font-size: 11px;
  color: #bbb;
  text-align: center;
  border-top: 1px solid #ede8e3;
}

/* Sidebar ticket chip */
.sidebar-ticket {
  background: #fff;
  border: 1px solid #e5ded5;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
  transition: box-shadow 0.15s, transform 0.15s;
  position: relative;
  touch-action: none; /* allow JS to handle touch, don't block parent scroll */
}

.sidebar-ticket:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.sidebar-ticket:active {
  cursor: grabbing;
}

.sidebar-ticket.color-1 { background-color: #b9c5c5; border-color: #a8b5b5; }
.sidebar-ticket.color-2 { background-color: #dcb6af; border-color: #cca09a; }
.sidebar-ticket.color-3 { background-color: #f9efe0; border-color: #e8d8c0; }
.sidebar-ticket.color-4 { background-color: #8e8e8e; border-color: #7a7a7a; color: #fff; }
.sidebar-ticket.color-5 { background-color: #8fac8f; border-color: #7a9a7a; }

.sidebar-ticket-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-ticket.color-4 .sidebar-ticket-title { color: #fff; }

.sidebar-ticket-serial {
  font-size: 11px;
  font-weight: 700;
  color: #555;
}

.sidebar-ticket.color-4 .sidebar-ticket-serial { color: #ddd; }

.sidebar-ticket.on-board {
  opacity: 0.45;
}

.sidebar-ticket.on-board::after {
  content: '✓ on board';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #7a6855;
  font-weight: 600;
}

/* ── Canvas ──────────────────────────────────────────────────────────────── */

.canvas-container {
  overflow: hidden;
  position: relative;
  background-color: #f0ece6;
  background-image:
    radial-gradient(circle, #c8b8a840 1px, transparent 1px);
  background-size: 28px 28px;
  cursor: default;
  flex: 1; /* default: full width without calendar */
}

.canvas-container.panning {
  cursor: grabbing;
}

.canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  /* transform set by JS */
}

/* ── Board ticket cards ───────────────────────────────────────────────────── */

.board-card {
  position: absolute;
  width: 220px;
  background: #fff;
  border: 1px solid #e5ded5;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s, transform 0.1s;
  overflow: hidden;
  z-index: 1;
}

.board-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.board-card.dragging-card {
  cursor: grabbing;
  box-shadow: 0 12px 36px rgba(0,0,0,0.20);
  transform: scale(1.03) translateY(-4px);
  z-index: 1000;
}

/* Color variants */
.board-card.color-1 { background-color: #b9c5c5; border-color: #a8b5b5; }
.board-card.color-2 { background-color: #dcb6af; border-color: #cca09a; }
.board-card.color-3 { background-color: #f9efe0; border-color: #e8d8c0; }
.board-card.color-4 { background-color: #8e8e8e; border-color: #7a7a7a; }
.board-card.color-5 { background-color: #8fac8f; border-color: #7a9a7a; }

/* Card header */
.board-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 10px 6px;
  gap: 6px;
}

.board-card-info {
  flex: 1;
  min-width: 0;
}

.board-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  line-height: 1.25;
  margin: 0 0 2px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.board-card.color-4 .board-card-title { color: #fff; }

.board-card-date {
  font-size: 10px;
  color: #777;
  line-height: 1.2;
}

.board-card.color-4 .board-card-date { color: #ddd; }

.board-card-serial {
  background: rgba(0,0,0,0.15);
  color: #222;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* Notes area */
.board-card-notes-wrap {
  margin: 0 10px 6px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  background: rgba(255,255,255,0.55);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.board-card-notes-label {
  font-size: 10px;
  font-weight: 500;
  color: #888;
  padding: 3px 8px;
  background: rgba(255,255,255,0.4);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.board-card-notes {
  font-size: 12px;
  line-height: 1.45;
  color: #444;
  padding: 6px 8px;
  overflow-y: auto;
  max-height: 100px;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  cursor: text;
  outline: none;
}

.board-card-notes:empty::before {
  content: 'Click to add notes…';
  color: #bbb;
  font-style: italic;
}

.board-card-notes.editing {
  outline: 2px solid #7a6855;
  background: rgba(255,255,255,0.85);
}

.board-card.color-4 .board-card-notes { color: #eee; }
.board-card.color-4 .board-card-notes-label { color: #ccc; }

/* Card footer */
.board-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px 8px;
  gap: 4px;
}

.board-card-open-btn,
.board-card-color-btn,
.board-card-arc-btn,
.board-card-remove-btn {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.6);
  cursor: pointer;
  color: #555;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.board-card-open-btn:hover {
  background: rgba(255,255,255,0.9);
}

.board-card-color-btn:hover {
  background: rgba(255,255,255,0.9);
  border-color: #7a6855;
  color: #7a6855;
}

.board-card-arc-btn:hover {
  background: rgba(255,200,100,0.25);
  border-color: #c8860a;
  color: #8a5a00;
}

.board-card-remove-btn {
  color: #aaa;
  padding: 3px 6px;
}

.board-card-remove-btn:hover {
  background: rgba(220,50,50,0.12);
  color: #c0392b;
  border-color: rgba(220,50,50,0.3);
}

/* ── Drop zone overlay (appears when dragging from sidebar) ──────────────── */

.canvas-container.drag-over {
  outline: 3px dashed #7a6855;
  outline-offset: -3px;
}

/* ── Empty board state ───────────────────────────────────────────────────── */

.board-empty-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #c0b5a8;
  pointer-events: none;
  user-select: none;
}

.board-empty-hint .hint-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.board-empty-hint p {
  font-size: 15px;
  margin: 0;
  opacity: 0.6;
}

/* ── Ticket edit modal on board ──────────────────────────────────────────── */

#boardTicketModal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
}

#boardTicketModal .modal-inner {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  overflow: hidden;
}

#boardTicketModal .modal-header {
  padding: 18px 22px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#boardTicketModal .modal-header h2 {
  margin: 0;
  font-size: 17px;
  color: #3d3d3d;
}

#boardTicketModal .modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
  padding: 0;
}

#boardTicketModal .modal-body {
  padding: 14px 22px;
  flex: 1;
  overflow-y: auto;
}

#boardTicketModal .modal-label {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
}

#boardTicketModal .modal-notes {
  font-size: 14px;
  line-height: 1.6;
  color: #444;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fafafa;
  min-height: 100px;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  cursor: text;
}

#boardTicketModal .modal-notes:focus {
  border-color: #7a6855;
  outline: 2px solid #7a685540;
}

#boardTicketModal .modal-footer {
  padding: 12px 22px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Collaborator cursors ────────────────────────────────────────────────── */

.collab-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 900;
  transition: left 0.1s linear, top 0.1s linear;
}

.collab-cursor-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.collab-cursor-label {
  font-size: 11px;
  font-weight: 600;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
  white-space: nowrap;
}

/* ── Auth check (reuse from other pages) ─────────────────────────────────── */

.board-page .auth-check {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f2ed;
  z-index: 100;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) and (orientation: landscape) {
  /* Landscape phone — tighter sidebar, more canvas room */
  .ticket-sidebar {
    width: 160px;
    min-width: 120px;
  }
  .board-card {
    width: 160px;
  }
  .sidebar-ticket-title {
    font-size: 11px;
  }
  .board-wrapper {
    top: 64px; /* collapse header height on landscape */
  }
}

@media (max-width: 768px) {
  .ticket-sidebar {
    width: 180px;
  }
  .board-card {
    width: 180px;
  }
  /* Make sidebar chips easier to grab on touch */
  .sidebar-ticket {
    padding: 10px 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* ── Calendar panel ──────────────────────────────────────────────────────── */

.calendar-panel {
  flex: 4 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f5f2ed;
  border-left: 2px solid #e5ded5;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
}

.cal-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #f5f2ed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.25s ease;
}

.cal-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.cal-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e5ded5;
  border-top-color: #7a6855;
  border-radius: 50%;
  animation: cal-spin 0.7s linear infinite;
}

@keyframes cal-spin {
  to { transform: rotate(360deg); }
}

.cal-loading-text {
  font-size: 13px;
  font-weight: 600;
  color: #7a6855;
  letter-spacing: 0.3px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #fff;
  border-bottom: 1px solid #e5ded5;
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: nowrap;
  position: relative;
}

.calendar-header-title {
  font-size: 13px;
  font-weight: 700;
  color: #5d4c3c;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Create buttons + nav group — flush left */
.cal-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Smaller action buttons in calendar header */
.cal-header-actions .tool-btn {
  padding: 4px 9px;
  font-size: 12px;
}

.calendar-nav-btn {
  background: #f5f2ed;
  border: 1px solid #e5ded5;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 13px;
  cursor: pointer;
  color: #7a6855;
  transition: background 0.15s;
  flex-shrink: 0;
  line-height: 1.4;
}

.calendar-nav-btn:hover {
  background: #ece7e0;
}

.calendar-nav-btn.today-btn {
  font-weight: 600;
  color: #5d4c3c;
  font-size: 12px;
}

.calendar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 6px 24px;
  box-sizing: border-box;
}

#calendarGrid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  box-sizing: border-box;
  padding-top: 4px;
}

/* Week label row — sits between header and scroll area, never scrolls */
.calendar-week-label {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  flex-shrink: 0;
  background: #f5f2ed;
  z-index: 10;
  padding: 5px 6px 5px;
  border-bottom: 2px solid #e5ded5;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

.calendar-dow {
  font-size: 10px;
  font-weight: 700;
  color: #999;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 0;
}



.calendar-day {
  background: #fff;
  border: 1.5px solid #e5ded5;
  border-radius: 8px;
  min-height: 160px;
  padding: 4px 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.calendar-day:hover {
  border-color: #c8b8a8;
}

.calendar-day.drag-over-day {
  border-color: #7a6855;
  background: #f9f5f0;
  box-shadow: 0 0 0 2px #7a685530;
}

.calendar-day.is-today {
  border-color: #7a6855;
  background: #fdf8f3;
}

.calendar-day.is-today .cal-day-number {
  background: #7a6855;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day.past-day {
  background: #fafafa;
  opacity: 0.75;
}

.calendar-day.other-month {
  background: #f8f6f3;
  opacity: 0.5;
}

.cal-day-number {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  line-height: 1;
  margin-bottom: 2px;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.cal-day-tickets {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

/* Ticket chip inside calendar day */
.cal-ticket-chip {
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #333;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  transition: box-shadow 0.12s, transform 0.12s;
  min-width: 0;
}

.cal-ticket-chip:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.cal-ticket-chip:active {
  cursor: grabbing;
}

.cal-ticket-chip.color-1 { background: #b9c5c5; border-color: #a8b5b5; }
.cal-ticket-chip.color-2 { background: #dcb6af; border-color: #cca09a; }
.cal-ticket-chip.color-3 { background: #f9efe0; border-color: #e8d8c0; }
.cal-ticket-chip.color-4 { background: #8e8e8e; border-color: #7a7a7a; color: #fff; }
.cal-ticket-chip.color-5 { background: #8fac8f; border-color: #7a9a7a; }

.cal-chip-serial {
  font-size: 10px;
  font-weight: 800;
  opacity: 0.7;
  flex-shrink: 0;
}

.cal-chip-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-chip-remove {
  font-size: 11px;
  color: #aaa;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 1px;
  line-height: 1;
  transition: color 0.12s;
}

.cal-chip-remove:hover {
  color: #e53e3e;
}

/* Over-scheduled warning */
.cal-overflow-badge {
  font-size: 10px;
  font-weight: 700;
  color: #c0392b;
  text-align: center;
  padding: 2px 0;
}

/* Freeform canvas shrinks to 20% */
.canvas-container {
  flex: 1; /* overridden below when calendar is present */
}

.board-wrapper.with-calendar .canvas-container {
  flex: 1 1 0;
  min-width: 0;
  max-width: 20%;
}

.board-wrapper.with-calendar .calendar-panel {
  display: flex;
}

/* Month separator — spans full 7-col grid */
.calendar-month-separator {
  font-size: 13px;
  font-weight: 700;
  color: #7a6855;
  padding: 14px 2px 6px;
  letter-spacing: 0.3px;
  border-top: 1px solid #e5ded5;
  margin-top: 4px;
  width: 100%;
}

/* Week row — real flex row so browser has stable anchor elements for scroll */
.calendar-week-row {
  display: flex;
  flex-direction: row;
  gap: 3px;
  width: 100%;
  flex-shrink: 0;
}

.calendar-week-row .calendar-day {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 900px) {
  .board-wrapper.with-calendar .canvas-container {
    display: none;
  }
  .calendar-panel {
    width: 100% !important;
  }
}

/* ── Sidebar archived search results ─────────────────────────────────────── */

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 4px 4px;
  border-top: 1px solid #e5ded5;
  margin-top: 4px;
}

.sidebar-ticket.archived-chip {
  opacity: 0.7;
  border-style: dashed;
}

.sidebar-ticket.archived-chip .sidebar-ticket-title {
  text-decoration: line-through;
  text-decoration-color: #aaa;
}

/* Archived chips on calendar */
.cal-ticket-chip.archived-chip {
  opacity: 0.72;
  border-style: dashed;
}

.cal-ticket-chip.archived-chip .cal-chip-title {
  text-decoration: line-through;
  text-decoration-color: #aaa;
}

/* Calendar highlight when a board card is dragged over it */
.calendar-panel.drag-over-calendar {
  outline: 3px dashed #7a6855;
  outline-offset: -3px;
}

/* ── Sticky notes ────────────────────────────────────────────────────────── */

.tool-btn.sticky-btn {
  background: #f9efe0;
  border-color: #e8d8c0;
  color: #7a6855;
  font-weight: 600;
}

.tool-btn.sticky-btn:hover {
  background: #f0e4cc;
  border-color: #c8a870;
}

.board-sticky {
  position: absolute;
  width: 200px;
  min-height: 160px;
  border-radius: 3px;
  padding: 0;
  display: flex;
  flex-direction: column;
  cursor: grab;
  user-select: none;
  box-shadow: 3px 3px 10px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1);
  transition: box-shadow 0.15s;
  z-index: 1;
}

.board-sticky:hover {
  box-shadow: 5px 5px 18px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
}

.board-sticky.dragging-card {
  cursor: grabbing;
  box-shadow: 8px 8px 24px rgba(0,0,0,0.25);
  transform: rotate(1deg) scale(1.02);
}

/* Color variants */
.board-sticky.sticky-yellow { background: #fff9c4; }
.board-sticky.sticky-pink   { background: #ffd6e0; }
.board-sticky.sticky-blue   { background: #d0e8ff; }
.board-sticky.sticky-green  { background: #d4f0d4; }
.board-sticky.sticky-purple { background: #e1d5e7; }

/* Fold effect bottom-right corner */
.board-sticky::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: linear-gradient(225deg, rgba(0,0,0,0.12) 50%, transparent 50%);
  border-radius: 0 0 3px 0;
}

.sticky-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 5px;
  gap: 6px;
  flex-shrink: 0;
}

.sticky-author {
  font-size: 10px;
  font-weight: 700;
  color: rgba(0,0,0,0.4);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-color-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.2);
  cursor: pointer;
  flex-shrink: 0;
  background: rgba(0,0,0,0.1);
  transition: transform 0.12s;
}

.sticky-color-btn:hover {
  transform: scale(1.3);
}

.sticky-delete-btn {
  font-size: 14px;
  color: rgba(0,0,0,0.3);
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  padding: 0 2px;
  transition: color 0.12s;
}

.sticky-delete-btn:hover {
  color: rgba(200,0,0,0.6);
}

.sticky-body {
  flex: 1;
  padding: 2px 10px 18px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(0,0,0,0.75);
  outline: none;
  cursor: text;
  word-break: break-word;
  white-space: pre-wrap;
  min-height: 120px;
}

.sticky-body:empty::before {
  content: 'Type a note…';
  color: rgba(0,0,0,0.25);
  font-style: italic;
  pointer-events: none;
}

.sticky-body.editing {
  cursor: text;
}

/* ── Calendar sticky chips ───────────────────────────────────────────────── */

.cal-sticky-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  margin-bottom: 2px;
  position: relative;
  border: 1.5px solid rgba(0,0,0,0.1);
  transition: opacity 0.15s, box-shadow 0.15s;
  user-select: none;
}

.cal-sticky-chip:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  opacity: 0.9;
}

.cal-sticky-chip.sticky-yellow { background: #fff9c4; }
.cal-sticky-chip.sticky-pink   { background: #ffd6e0; }
.cal-sticky-chip.sticky-blue   { background: #d0e8ff; }
.cal-sticky-chip.sticky-green  { background: #d4f0d4; }
.cal-sticky-chip.sticky-purple { background: #e1d5e7; }

.cal-sticky-icon {
  flex-shrink: 0;
  font-size: 10px;
}

.cal-sticky-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(0,0,0,0.7);
  font-style: italic;
}

/* ── Sticky popover ──────────────────────────────────────────────────────── */

.cal-sticky-popover {
  position: fixed;
  width: 260px;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
  z-index: 8000;
  display: flex;
  flex-direction: column;
  overflow: visible;
  border: 1.5px solid rgba(0,0,0,0.1);
}

.cal-sticky-popover.sticky-yellow { background: #fff9c4; }
.cal-sticky-popover.sticky-pink   { background: #ffd6e0; }
.cal-sticky-popover.sticky-blue   { background: #d0e8ff; }
.cal-sticky-popover.sticky-green  { background: #d4f0d4; }
.cal-sticky-popover.sticky-purple { background: #e1d5e7; }

.cal-sticky-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 4px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.cal-sticky-popover-author {
  font-size: 10px;
  font-weight: 700;
  color: rgba(0,0,0,0.4);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cal-sticky-popover-close {
  font-size: 16px;
  color: rgba(0,0,0,0.35);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}

.cal-sticky-popover-close:hover {
  color: rgba(200,0,0,0.6);
}

.cal-sticky-popover-body {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(0,0,0,0.75);
  resize: none;
  min-height: 80px;
  font-family: inherit;
}

.cal-sticky-popover-footer {
  padding: 4px 8px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.cal-sticky-popover-colors {
  display: flex;
  gap: 5px;
  margin-right: auto;
}

.cal-sticky-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(0,0,0,0.15);
  transition: transform 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.cal-sticky-color-dot.sticky-yellow { background: #fff9c4; }
.cal-sticky-color-dot.sticky-pink   { background: #ffd6e0; }
.cal-sticky-color-dot.sticky-blue   { background: #d0e8ff; }
.cal-sticky-color-dot.sticky-green  { background: #d4f0d4; }
.cal-sticky-color-dot.sticky-purple { background: #e1d5e7; }
.cal-sticky-color-dot:hover         { transform: scale(1.25); }
.cal-sticky-color-dot.dot-active    { border-color: rgba(0,0,0,0.5); transform: scale(1.2); }

.cal-sticky-save-btn {
  background: rgba(0,0,0,0.12);
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(0,0,0,0.6);
  cursor: pointer;
  transition: background 0.12s;
}

.cal-sticky-save-btn:hover {
  background: rgba(0,0,0,0.2);
}

/* Sticky ghost chip that follows cursor over the calendar during drag */
.sticky-drag-ghost {
  pointer-events: none !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  min-width: 100px;
  max-width: 180px;
}

/* ── Floating reset view button on canvas ───────────────────────────────── */
.floating-reset-btn {
  position: absolute;
  bottom: 14px;
  left: 12px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #e5ded5;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 15px;
  cursor: pointer;
  color: #7a6855;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background 0.15s, box-shadow 0.15s;
  z-index: 50;
  backdrop-filter: blur(4px);
  pointer-events: all;
}

.floating-reset-btn:hover {
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  color: #5d4c3c;
}

/* ── Set Home button ─────────────────────────────────────────────────────── */
.floating-set-home-btn {
  position: absolute;
  bottom: 14px;
  right: 12px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #e5ded5;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #7a6855;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background 0.15s, box-shadow 0.15s, color 0.15s;
  z-index: 50;
  backdrop-filter: blur(4px);
  pointer-events: all;
  white-space: nowrap;
}

.floating-set-home-btn:hover {
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  color: #5d4c3c;
}

/* ── Color swatch bar ────────────────────────────────────────────────────── */
.color-swatch-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s, box-shadow 0.12s;
  box-sizing: border-box;
}

.color-swatch:hover {
  transform: scale(1.2);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.color-swatch.swatch-active {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px #5d4c3c;
}

/* ALL swatch is a pill not a circle */
.color-swatch:first-child {
  border-radius: 10px;
  width: auto;
  padding: 0 6px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #7a6855;
  background: #f5f2ed;
  border: 1.5px solid #c8b8a8;
}

/* ── Broadcast purple edge ───────────────────────────────────────────────── */

/* Sidebar panel */
.sidebar-ticket.broadcast-ticket-sidebar {
  border-left: 6px solid #9b59b6;
  padding-left: 8px;
}

/* Canvas board card */
.board-card.broadcast-card {
  border-left: 6px solid #9b59b6;
}

/* Calendar chip */
.cal-ticket-chip.broadcast-chip {
  border-left: 4px solid #9b59b6;
  padding-left: 5px;
}

/* ── Calendar day → create sticky modal ─────────────────────────────────── */
.cal-sticky-create-box {
  border-radius: 10px;
  width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid rgba(0,0,0,0.1);
}

.cal-sticky-create-box.sticky-yellow { background: #fff9c4; }
.cal-sticky-create-box.sticky-pink   { background: #ffd6e0; }
.cal-sticky-create-box.sticky-blue   { background: #d0e8ff; }
.cal-sticky-create-box.sticky-green  { background: #d4f0d4; }
.cal-sticky-create-box.sticky-purple { background: #e1d5e7; }

.cal-sticky-create-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 6px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.cal-sticky-create-date {
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,0.5);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cal-sticky-create-close {
  font-size: 20px;
  color: rgba(0,0,0,0.3);
  cursor: pointer;
  line-height: 1;
}

.cal-sticky-create-close:hover { color: rgba(200,0,0,0.5); }

.cal-sticky-create-body {
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 14px;
  font-size: 16px; /* 16px minimum prevents iOS Safari auto-zoom on focus */
  line-height: 1.5;
  color: rgba(0,0,0,0.75);
  resize: none;
  min-height: 100px;
  font-family: inherit;
}

.cal-sticky-create-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 12px;
  gap: 10px;
}

.cal-sticky-color-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cal-sticky-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(0,0,0,0.15);
  transition: transform 0.12s, box-shadow 0.12s;
}

.cal-sticky-color-dot.sticky-yellow { background: #fff9c4; }
.cal-sticky-color-dot.sticky-pink   { background: #ffd6e0; }
.cal-sticky-color-dot.sticky-blue   { background: #d0e8ff; }
.cal-sticky-color-dot.sticky-green  { background: #d4f0d4; }
.cal-sticky-color-dot.sticky-purple { background: #e1d5e7; }

.cal-sticky-color-dot:hover { transform: scale(1.2); }
.cal-sticky-color-dot.dot-active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px #5d4c3c;
}

.cal-sticky-create-save {
  background: rgba(0,0,0,0.15);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(0,0,0,0.65);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.cal-sticky-create-save:hover { background: rgba(0,0,0,0.25); }

/* ── Calendar date picker dropdown ──────────────────────────────────────── */
.cal-datepicker-wrap {
  position: relative;
}

.cal-datepicker-btn {
  font-size: 15px;
  padding: 3px 7px;
}

.cal-datepicker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #e5ded5;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.16);
  padding: 12px;
  width: 240px;
  z-index: 3000;
}

.cal-datepicker-dropdown.hidden { display: none; }

.cal-dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 2px;
}

.cal-dp-label {
  font-size: 13px;
  font-weight: 700;
  color: #5d4c3c;
  flex: 1;
  text-align: center;
}

.cal-dp-nav {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #7a6855;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
}

.cal-dp-nav:hover {
  background: #f0ebe4;
}

.cal-dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dp-dow {
  font-size: 10px;
  font-weight: 700;
  color: #bbb;
  text-align: center;
  padding: 2px 0 4px;
  text-transform: uppercase;
}

.cal-dp-cell {
  font-size: 12px;
  text-align: center;
  padding: 5px 2px;
  border-radius: 5px;
  cursor: pointer;
  color: #5d4c3c;
  transition: background 0.1s;
}

.cal-dp-cell:hover {
  background: #f0ebe4;
}

.cal-dp-blank {
  cursor: default;
}

.cal-dp-blank:hover {
  background: none;
}

.cal-dp-today {
  background: #7a6855;
  color: #fff;
  font-weight: 700;
}

.cal-dp-today:hover {
  background: #5d4c3c;
}

.cal-dp-has-items {
  font-weight: 600;
  position: relative;
}

.cal-dp-has-items::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #7a6855;
  margin: 1px auto 0;
}

.cal-dp-today.cal-dp-has-items::after {
  background: rgba(255,255,255,0.7);
}

.cal-dp-selected {
  background: #b9c5c5;
  color: #fff;
  font-weight: 700;
}
.cal-dp-selected:hover { background: #a8b5b5; }

/* ── Duplicate modal ─────────────────────────────────────────────────────── */

.dup-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dup-modal {
  background: #fff;
  border-radius: 12px;
  width: 300px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dup-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e5ded5;
}
.dup-modal-title { font-size: 14px; font-weight: 700; color: #5d4c3c; }
.dup-modal-close { background: none; border: none; font-size: 20px; color: #aaa; cursor: pointer; line-height: 1; padding: 0 2px; }
.dup-modal-close:hover { color: #5d4c3c; }
.dup-modal-section { padding: 12px 16px 0; }
.dup-modal-label { font-size: 11px; font-weight: 700; color: #aaa; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.dup-modal-ticketname { font-size: 13px; font-weight: 600; color: #5d4c3c; margin-bottom: 3px; }
.dup-modal-subtext { font-size: 11px; color: #aaa; font-style: italic; margin-bottom: 4px; }
.dup-modal-textarea { width: 100%; min-height: 70px; border: 1.5px solid #e5ded5; border-radius: 7px; padding: 8px 10px; font-size: 16px; color: #5d4c3c; resize: vertical; box-sizing: border-box; font-family: inherit; outline: none; }
.dup-modal-textarea:focus { border-color: #7a6855; }
.dup-dp-wrap { background: #faf8f5; border: 1px solid #e5ded5; border-radius: 8px; padding: 10px; }
.dup-dp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 2px; }
.dup-selected-date { font-size: 11px; color: #7a6855; font-weight: 600; text-align: center; margin-top: 8px; min-height: 16px; }
.dup-modal-footer { display: flex; gap: 8px; padding: 14px 16px; justify-content: flex-end; }
.dup-btn { background: #f5f2ed; border-color: #e5ded5; color: #7a6855; }
.cal-sticky-dup-btn { background: rgba(0,0,0,0.08); border: none; border-radius: 4px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: rgba(0,0,0,0.55); cursor: pointer; transition: background 0.12s; }
.cal-sticky-dup-btn:hover { background: rgba(0,0,0,0.16); }

/* ── Landscape mobile compact mode ───────────────────────────────────────── */

@media (max-height: 500px) and (orientation: landscape) {

  /* Shrink main header */
  .board-page .main-header {
    padding: 4px 12px;
    min-height: 0;
  }

  .board-page .logo-container img {
    max-height: 28px;
  }

  .board-page .main-nav a {
    padding: 4px 8px;
    font-size: 13px;
  }

  .board-page .user-profile {
    transform: scale(0.85);
    transform-origin: right center;
  }

  /* Shrink toolbar */
  .board-toolbar {
    top: 40px;
    height: 34px;
    padding: 0 10px;
  }

  .tool-btn {
    padding: 3px 8px;
    font-size: 12px;
  }

  .board-title {
    font-size: 13px;
  }

  /* Color filter dots — hide labels, keep dots small */
  .color-filter-btn span {
    display: none;
  }

  .zoom-display {
    font-size: 11px;
  }

  /* Board wrapper — reclaim the space */
  .board-wrapper {
    top: 74px !important; /* 40px header + 34px toolbar */
    bottom: 0 !important; /* no bottom nav in landscape */
  }

  /* Sidebar narrower */
  .ticket-sidebar {
    width: 150px;
  }

  .sidebar-ticket-title {
    font-size: 11px;
    line-height: 1.3;
  }

  .sidebar-ticket-serial {
    font-size: 10px;
  }

  .sidebar-header {
    padding: 6px 10px;
  }
}

/* ══════════════════════════════════════════════════════════
   MOBILE BOARD — split-panel layout (≤768px)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Hide canvas + canvas-only toolbar items */
  #canvasContainer,
  .zoom-display,
  #colorSwatchBar,
  .toolbar-center,
  #setHomeBtn,
  #resetViewBtn,
  .sidebar-hint,
  .calendar-week-label { display: none !important; }

  #boardToolbar { padding: 6px 8px; min-height: unset; }

  /* Two-column wrapper */
  #boardWrapper.with-calendar {
    display: flex !important;
    flex-direction: row !important;
    height: calc(100dvh - 170px);
    overflow: hidden;
    border-top: 1px solid #e5ded5;
  }

  /* ── Left: ticket sidebar (35%) ──────────────────────── */
  #ticketSidebar {
    width: 35%;
    min-width: 35%;
    max-width: 35%;
    flex-shrink: 0;
    height: 100%;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    border-right: 2px solid #e5ded5;
    background: #faf7f4;
    transition: background 0.2s, border-color 0.2s;
  }

  #ticketSidebar.drop-target-mobile {
    background: #efe8df !important;
    border-right: 3px solid #7a6855 !important;
  }

  .sidebar-header {
    padding: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #faf7f4;
    border-bottom: 1px solid #e5ded5;
  }

  .sidebar-header span { font-size: 11px; display: block; margin-bottom: 4px; }

  .sidebar-search {
    font-size: 12px;
    padding: 4px 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .sidebar-ticket {
    padding: 6px 8px;
    font-size: 11px;
    margin: 2px 4px;
    border-radius: 5px;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.12s, box-shadow 0.12s;
  }

  .sidebar-ticket.long-press-active {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  }

  .sidebar-ticket-title { font-size: 11px; line-height: 1.3; }
  .sidebar-ticket-serial { font-size: 10px; }

  /* ── Right: calendar panel (65%) ─────────────────────── */
  #calendarPanel {
    flex: 1;
    width: 65%;
    height: 100%;
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
  }

  .calendar-header { padding: 6px 8px; flex-shrink: 0; }
  .cal-header-actions { flex-wrap: wrap; gap: 4px; }
  .tool-btn, .calendar-nav-btn { font-size: 11px; padding: 4px 8px; }

  .calendar-scroll {
    flex: 1;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Vertical single-day list ─────────────────────────── */
  #calendarGrid {
    display: flex !important;
    flex-direction: column;
  }

  .calendar-week-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0;
  }

  .calendar-day {
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    border-right: none !important;
    border-bottom: 1px solid #ede8e2;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column;
    padding: 5px 8px 6px;
    box-sizing: border-box;
  }

  .calendar-week-row .calendar-day {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .cal-day-number {
    font-size: 11px;
    font-weight: 700;
    color: #7a6855;
    margin-bottom: 2px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  /* Day-of-week abbreviation prepended via data attribute */
  .cal-day-number::before {
    content: attr(data-day-name);
    font-weight: 400;
    color: #aaa;
    font-size: 10px;
    width: 22px;
  }

  .calendar-day.is-today .cal-day-number {
    color: #fff;
    background: #7a6855;
    border-radius: 4px;
    padding: 2px 6px;
  }

  .calendar-day.is-today .cal-day-number::before { color: #f5f0e0; }

  .cal-day-tickets {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .cal-ticket-chip {
    font-size: 11px;
    padding: 3px 6px;
    white-space: normal;
  }

  .calendar-month-separator {
    font-size: 12px;
    padding: 8px 8px 3px;
    font-weight: 700;
    color: #7a6855;
    background: #f5f0ea;
    border-bottom: 1px solid #e5ded5;
    width: 100%;
    box-sizing: border-box;
  }

  .drag-over-day {
    background: #e8f0e8 !important;
    outline: 2px dashed #7a6855 !important;
  }

}

/* ── Sidebar restored flash — cal chip dropped back into panel ─────────────── */
@keyframes sidebarRestoreFlash {
  0%   { background: rgba(196,169,119,0.45); box-shadow: 0 0 0 2px #c4a977; }
  70%  { background: rgba(196,169,119,0.20); box-shadow: 0 0 0 1px #c4a977; }
  100% { background: ''; box-shadow: none; }
}

.sidebar-ticket.sidebar-restored-flash {
  animation: sidebarRestoreFlash 1.1s ease forwards;
  border-radius: 6px;
}

/* ══════════════════════════════════════════════════════════════════════════
   CALENDAR EVENT IMAGE ATTACHMENTS  (cal-images.js)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Thumbnail strip (used in both create modal and popover) ── */
.cal-img-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 2px;
}
.cal-img-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}
.cal-img-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  display: block;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cal-img-thumb:hover { opacity: 0.85; }
.cal-img-del-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(180,40,30,0.88);
  color: #fff;
  border: none;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.12s;
}
.cal-img-del-btn:hover { background: #c0392b; }

/* ── Upload area inside create modal ── */
.cal-img-upload-wrap {
  padding: 6px 0 4px;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-top: 6px;
}
.cal-img-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(0,0,0,0.06);
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  color: #555;
  transition: background 0.12s;
  margin-bottom: 6px;
}
.cal-img-upload-btn:hover { background: rgba(0,0,0,0.12); }
.cal-img-create-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* ── Popover strip container ── */
.cal-img-popover-strip {
  padding: 6px 8px 4px;
  max-height: 150px;
  overflow-y: auto;
  border-top: 1px solid rgba(0,0,0,0.1);
  background: inherit;
}

/* ── Upload button inside popover footer ── */
.cal-img-popover-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: rgba(0,0,0,0.07);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.12s;
  flex-shrink: 0;
}
.cal-img-popover-upload-btn:hover { background: rgba(0,0,0,0.14); }

/* ── Fullscreen lightbox ── */
.cal-img-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cal-img-lightbox.cal-img-lightbox-visible { opacity: 1; }
.cal-img-lightbox-img {
  max-width: 96vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  display: block;
}
.cal-img-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.cal-img-lightbox-close:hover { background: rgba(255,255,255,0.28); }
