:root {
  --bg: #FAFBFC;
  --road: #D1D5DB;
  --road-edge: #E5E7EB;
  --road-line: #9CA3AF;

  /* Phase colors - cycle through these (WCAG AA: 4.5:1+ contrast on white) */
  --phase-1: #292524;  /* Stone 800: 15.3:1 */
  --phase-2: #44403C;  /* Stone 700: 9.3:1 */
  --phase-3: #57534E;  /* Stone 600: 6.3:1 */
  --phase-4: #78716C;  /* Stone 500: 4.8:1 */
  --phase-5: #4B6043;  /* Sage 700: 5.4:1 */

  --font: 'Inter', system-ui, sans-serif;

  /* Semantic colors */
  --text-primary: #1F2937;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --primary: #44403C;
  --primary-hover: #1C1917;
  --danger: #DC2626;
  --danger-light: #EF4444;
  --tooltip-bg: #1F2937;

  /* Type Scale (1.25 ratio, rem for user scaling) */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.25rem;    /* 20px */
  --text-xl: 1.5rem;     /* 24px */
  --text-2xl: 2rem;      /* 32px */
  --text-display: 4rem;  /* 64px */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 70px 2rem 50px;  /* Account for header and footer */
}

main {
  width: 100%;
}

.snake-container {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* Tooltip for first + button */
.add-tooltip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 50;
}

.add-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: var(--tooltip-bg);
  border-bottom: none;
}

.add-tooltip.show {
  opacity: 1;
}

/* Demo first-action tooltip */
.demo-tooltip {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: #F59E0B;
  color: #1F2937;
  padding: 16px 20px;
  border-radius: 6px;
  font-size: var(--text-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: demoTooltipBounce 2s ease-in-out infinite;
}

@keyframes demoTooltipBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

.demo-tooltip--visible {
  display: flex;
}

.demo-tooltip__content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-tooltip__icon {
  font-size: 18px;
  animation: demoTooltipPoint 1.5s ease-in-out infinite;
}

@keyframes demoTooltipPoint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-15deg); }
}

.demo-tooltip__text {
  font-weight: 500;
}

.demo-tooltip__dismiss {
  background: rgba(31, 41, 55, 0.15);
  border: 1px solid rgba(31, 41, 55, 0.3);
  color: #1F2937;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.demo-tooltip__dismiss:hover {
  background: rgba(133, 77, 14, 0.25);
}

/* Post-creation guidance checklist */
.guidance-panel {
  position: fixed;
  bottom: 60px;
  right: 20px;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px 20px;
  width: 280px;
  z-index: 900;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: none;
  animation: guidanceSlideIn 0.3s ease-out;
}
@keyframes guidanceSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.guidance-panel--visible {
  display: block;
}
.guidance-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.guidance-panel__title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
}
.guidance-panel__close {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 14px;
  border-radius: 4px;
}
.guidance-panel__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.guidance-item {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: #ccc;
  cursor: pointer;
  transition: opacity 0.2s;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.guidance-item:hover {
  color: #fff;
}
.guidance-item--done {
  opacity: 0.5;
  text-decoration: line-through;
}
.guidance-item__check {
  width: 18px;
  height: 18px;
  border: 2px solid #555;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  color: transparent;
  transition: all 0.2s;
}
.guidance-item--done .guidance-item__check {
  border-color: #4ade80;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}
.guidance-item__hint {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: -2px;
  font-style: italic;
}
.guidance-item--done .guidance-item__hint {
  display: none;
}
@media (max-width: 1023px) {
  .guidance-panel {
    bottom: 80px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* Deadline tooltip below GO */
.deadline-tooltip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.deadline-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-bottom-color: var(--tooltip-bg);
  border-top: none;
}

.deadline-tooltip.show {
  opacity: 1;
}

.deadline-tooltip:hover {
  background: #374151;
}

.deadline-tooltip:hover::before {
  border-bottom-color: #374151;
}

.deadline-tooltip:hover::before {
  border-bottom-color: #374151;
}

.deadline-tooltip__text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deadline-tooltip__days {
  font-size: var(--text-xs);
  opacity: 0.8;
}

.deadline-tooltip--overdue {
  background: #DC2626;
}

.deadline-tooltip--overdue:hover {
  background: #B91C1C;
}

.deadline-tooltip--today {
  background: #F59E0B;
}

.deadline-tooltip--today:hover {
  background: #D97706;
}

/* Pill tooltip for truncated phase names */
.pill-tooltip {
  position: fixed;
  background: var(--tooltip-bg);
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
}

.pill-tooltip.show {
  opacity: 1;
}

.snake-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Road layers */
.road-edge {
  fill: none;
  stroke: var(--road-edge);
  stroke-width: 56;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.road-fill {
  fill: none;
  stroke: var(--road);
  stroke-width: 48;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.road-line {
  fill: none;
  stroke: var(--road-line);
  stroke-width: 2;
  stroke-dasharray: 12 16;
  stroke-linecap: round;
}

/* Milestone circles */
.milestone {
  cursor: pointer;
}

/* Hover effect on the fill circle only, not the group */
.milestone--add .milestone__fill {
  transition: transform 0.2s ease, fill 0.2s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.milestone--add:hover .milestone__fill {
  fill: #4B5563;
  transform: scale(1.08);
}

.milestone__bg {
  fill: white;
  stroke: var(--road-edge);
  stroke-width: 4;
}

.milestone__fill {
  stroke: none;
  transition: fill 0.2s ease;
}

.milestone--add .milestone__fill {
  fill: #D1D5DB;
}

.milestone--launch .milestone__fill {
  fill: var(--phase-5);
}

/* GO milestone hover switcheroo - shows + to add more phases */
.milestone--launch {
  cursor: pointer;
}

.milestone--launch .milestone__add-icon {
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.milestone__add-icon i {
  color: #374151;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.milestone--launch:hover .milestone__fill {
  fill: #D1D5DB;
}

.milestone--launch:hover .milestone__launch-text {
  opacity: 0;
}

.milestone--launch:hover .milestone__add-icon {
  opacity: 1;
  pointer-events: auto;
}

/* Celebrate button - wraps around bottom of goal circle */
.celebrate-btn {
  cursor: pointer;
}

.celebrate-btn__arc {
  fill: none;
  stroke: var(--road);
  stroke-width: 32;
  stroke-linecap: round;
  transition: stroke 0.2s;
}

.celebrate-btn:hover .celebrate-btn__arc {
  stroke: var(--phase-5);
}

.celebrate-btn__text {
  fill: var(--road-line);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: fill 0.2s;
}

.celebrate-btn:hover .celebrate-btn__text {
  fill: white;
}

/* Hide celebrate button until all phases complete */
.celebrate-btn--hidden {
  display: none;
}

.milestone__number {
  fill: white;
  font-family: var(--font);
  font-size: var(--text-xl);
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  transition: opacity 0.1s;
}

/* Delete X icon (hidden by default) - foreignObject + FA */
.milestone__delete {
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

.milestone__delete i {
  color: white;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Milestone delete hover state */
.milestone--deletable:hover .milestone__bg {
  stroke: #DC2626;
  stroke-width: 4;
}

.milestone--deletable:hover .milestone__fill {
  fill: #DC2626 !important;
}

.milestone--deletable:hover .milestone__number {
  opacity: 0;
  visibility: hidden;
}

.milestone--deletable:hover .milestone__delete {
  opacity: 1;
}

/* Checkmark icon (shown when complete) - foreignObject + FA */
.milestone__checkmark {
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.milestone__checkmark i {
  color: white;
  font-size: var(--text-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Phase complete state */
.milestone--complete .milestone__fill {
  fill: var(--phase-5) !important;
}

.milestone--complete .milestone__number {
  opacity: 0;
  visibility: hidden;
}

.milestone--complete .milestone__checkmark {
  opacity: 1;
}

.milestone--complete .milestone__delete {
  display: none;
}

/* Disable delete hover when complete */
.milestone--complete.milestone--deletable:hover .milestone__bg {
  stroke: var(--road-edge);
}

.milestone--complete.milestone--deletable:hover .milestone__fill {
  fill: var(--phase-5) !important;
}

/* ===== COLLABORATOR ROLE: Hide/disable owner-only UI ===== */

/* Hide + button and tooltip for non-owners */
body.role-collaborator #add-milestone,
body.role-collaborator .add-tooltip {
  display: none !important;
}

/* Phase milestones: non-interactive for non-owners */
body.role-collaborator .milestone--deletable {
  cursor: default;
  pointer-events: none;
}

/* Phase label pills: non-interactive for non-owners */
body.role-collaborator .label__pill {
  cursor: default;
  pointer-events: none;
}

/* SVG header name pills: non-interactive for non-owners */
body.role-collaborator #header > .header-group:not(.header-group--notes) {
  pointer-events: none;
  cursor: default;
}

/* HTML header deadline: non-interactive for non-owners */
body.role-collaborator .header-group--deadline {
  pointer-events: none;
  cursor: default;
}

/* Launch milestone: non-interactive for non-owners */
body.role-collaborator .milestone--launch {
  cursor: default;
  pointer-events: none;
}

/* Celebration pulse animation */
@keyframes celebratePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.milestone--celebrating .milestone__fill {
  animation: celebratePulse 0.4s ease-out;
  transform-origin: center;
  transform-box: fill-box;
}

/* Glow ring animation */
@keyframes glowRing {
  0% { r: 40; opacity: 0.8; stroke-width: 8; }
  100% { r: 80; opacity: 0; stroke-width: 2; }
}

.milestone__glow {
  fill: none;
  stroke: #4B6043;
  opacity: 0;
  pointer-events: none;
}

.milestone--celebrating .milestone__glow {
  animation: glowRing 0.6s ease-out forwards;
}

/* Confetti container */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(400px) translateX(var(--tx, 0)) rotate(720deg);
  }
}

/* Big launch celebration animations */
@keyframes confettiRain {
  0% {
    opacity: 1;
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) translateX(var(--drift, 0)) rotate(var(--spin, 720deg));
  }
}

@keyframes confettiBurst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx, 0), var(--ty, 0)) scale(0.5) rotate(720deg);
  }
}

/* Celebration backdrop */
.celebration-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  pointer-events: none;
  animation: backdropIn 1s ease-out forwards, backdropOut 1s ease-in 4.5s forwards;
}

@keyframes backdropIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes backdropOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Celebration text overlay */
.celebration-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1001;
  pointer-events: none;
}

.celebration-text__line {
  font-family: var(--font);
  font-weight: 800;
  color: var(--text-primary);
  opacity: 0;
  transform: scale(0.5) translateY(20px);
}

.celebration-text__line--1 {
  font-size: clamp(2.5rem, 10vw, 5rem);
  animation: celebrationTextIn 1.2s ease-out 0.8s forwards, celebrationTextOut 1s ease-in 4s forwards;
}

.celebration-text__line--2 {
  font-size: clamp(1.5rem, 6vw, 3rem);
  color: #4B6043;
  animation: celebrationTextIn 1.2s ease-out 1.5s forwards, celebrationTextOut 1s ease-in 4.5s forwards;
}

@keyframes celebrationTextIn {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes celebrationTextOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.1) translateY(-20px);
  }
}

/* Demo side-switch interstitial */
.demo-switch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  animation: backdropIn 0.4s ease-out forwards;
}

.demo-switch-overlay--out {
  animation: backdropOut 0.4s ease-in forwards;
}

.demo-switch-overlay__check {
  font-size: 3rem;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: #6B8F5E;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: celebrationTextIn 0.5s ease-out forwards;
}

.demo-switch-overlay__title {
  font-family: var(--font);
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--text-primary);
  opacity: 0;
  animation: celebrationTextIn 0.5s ease-out 0.2s forwards;
}

.demo-switch-overlay__subtitle {
  font-family: var(--font);
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: #6B7280;
  opacity: 0;
  animation: celebrationTextIn 0.5s ease-out 0.4s forwards;
}

.demo-switch-overlay__btn {
  margin-top: 0.5rem;
  padding: 0.75rem 2rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  opacity: 0;
  animation: celebrationTextIn 0.5s ease-out 0.6s forwards;
}

.demo-switch-overlay__btn:hover {
  background: var(--primary-hover);
}

/* Card group complete state */
/* Safari foreignObject fix: opacity removed - creates compositing layer that breaks positioning */
.card-group--complete {
  /* Use muted colors instead of opacity for Safari compatibility */
}

.card-group--complete .card-group__header {
  background: #F4F6F0;
  color: #6B7280;
}

.card-group--complete .card-item {
  color: #9CA3AF;
}

/* Plus icon */
.plus-icon {
  pointer-events: none;
}

.plus-icon i {
  color: white;
  font-size: var(--text-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Launch text */
.milestone__launch-text {
  fill: white;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  letter-spacing: 0.5px;
  opacity: 1;
  transition: opacity 0.15s;
}

/* Header pills */
/* Header pills */
.header-group {
  cursor: pointer;
}

.header-group:hover .header-pill {
  filter: brightness(1.1);
}

.header-pill {
  rx: 18;
  ry: 18;
  transition: filter 0.2s ease;
}

.header-pill--project {
  fill: var(--text-primary);
}

.header-pill--developer {
  fill: var(--phase-1);
}

.header-pill--client {
  fill: var(--phase-2);
}

.header-text {
  fill: white;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.header-text--project {
  font-size: var(--text-sm);
  font-weight: 700;
}

.header-label {
  fill: #4B5563;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 600;
  text-anchor: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* Deadline header pill */
.header-group--deadline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #E5E7EB;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.header-group--deadline:hover {
  background: #6B7280;
}

.header-group--deadline:hover .header-text--deadline {
  color: white;
}

.header-pill--deadline {
  display: none;
}

.header-text--deadline {
  color: #6B7280;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.header-group--deadline.has-deadline {
  background: #E7E5E4;
}

.header-group--deadline.has-deadline:hover {
  background: var(--primary-hover);
}

.header-group--deadline.has-deadline:hover .header-text--deadline {
  color: white;
}

.header-group--deadline.has-deadline .header-text--deadline {
  color: #292524;
}

.header-group--deadline.deadline-soon {
  background: #FEF3C7;
}

.header-group--deadline.deadline-soon:hover {
  background: #D97706;
}

.header-group--deadline.deadline-soon:hover .header-text--deadline {
  color: white;
}

.header-group--deadline.deadline-soon .header-text--deadline {
  color: #B45309;
}

.header-group--deadline.deadline-overdue {
  background: #FEE2E2;
}

.header-group--deadline.deadline-overdue:hover {
  background: #DC2626;
}

.header-group--deadline.deadline-overdue:hover .header-text--deadline {
  color: white;
}

.header-group--deadline.deadline-overdue .header-text--deadline {
  color: var(--danger);
}

/* Labels */
.label__connector {
  stroke-width: 2;
  stroke-linecap: round;
}

.label__pill {
  rx: 22;
  ry: 22;
  cursor: pointer;
}

.label__pill:hover {
  filter: brightness(1.1);
}

.label__text {
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 700;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

/* Name input modal */
.name-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.name-modal--open {
  display: flex;
}

/* Confirm/input modals stack above regular modals */
#confirm-modal.name-modal--open,
#input-modal.name-modal--open {
  z-index: 1100;
}

/* Auth modal above everything except create */
#auth-modal.name-modal--open {
  z-index: 1200;
}

/* Desktop styles for mobile modal components (used by confirm/input modals) */
.name-modal .m-modal__backdrop {
  position: absolute;
  inset: 0;
  background: transparent; /* backdrop already has bg color on .name-modal */
}

.name-modal .m-modal__sheet {
  background: white;
  border-radius: 12px;
  width: 320px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.name-modal .m-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #E5E7EB;
}

.name-modal .m-modal__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.name-modal .m-modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #6B7280;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
}

.name-modal .m-modal__close:hover {
  background: #F3F4F6;
}

.name-modal .m-modal__content {
  padding: 16px 20px;
}

.name-modal .m-modal__footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #E5E7EB;
  justify-content: flex-end;
}

/* ===== AUTH MODAL STYLES (Slack/Notion-style) ===== */

.auth-modal__sheet {
  width: 380px;
}

.auth-modal__content {
  padding: 24px 28px;
}

/* Auth states (for multi-step flow) */
.auth-state--hidden {
  display: none;
}

/* Auth buttons */
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.auth-btn--google {
  background: white;
  color: #374151;
  border: 1px solid #D1D5DB;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-btn--google:hover {
  background: #F9FAFB;
  border-color: #9CA3AF;
}

.auth-btn--primary {
  background: var(--primary);
  color: white;
}

.auth-btn--primary:hover {
  background: var(--primary-hover);
}

.auth-btn--loading {
  pointer-events: none;
  opacity: 0.7;
}

.auth-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

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

/* Auth divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: #9CA3AF;
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #E5E7EB;
}

.auth-divider span {
  padding: 0 14px;
}

/* Auth form */
.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--font);
  font-size: 15px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Auth links */
.auth-link {
  background: none;
  border: none;
  color: var(--primary);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-link--subtle {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
  color: #6B7280;
}

.auth-link--subtle:hover {
  color: var(--primary);
}

/* Password fields (hidden by default) */
.auth-password-fields {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #E5E7EB;
}

.auth-password-fields--visible {
  display: block;
}

.auth-password-fields .auth-link {
  display: block;
  text-align: center;
  margin-top: 12px;
}

/* "Check your inbox" state */
.auth-sent {
  text-align: center;
  padding: 16px 0;
}

.auth-sent__icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 16px;
}

.auth-sent__title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
}

.auth-sent__email {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}

.auth-sent__desc {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-sent .auth-btn {
  margin-bottom: 16px;
}

/* Auth error */
.auth-error {
  display: none;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 12px;
}

.auth-error--visible {
  display: block;
}

.auth-error--info {
  background: #F5F5F4;
  border-color: #D6D3D1;
  color: #292524;
}

/* Share button in header */
.share-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--primary);
  border: 1px solid var(--primary-hover);
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.15s;
}

.share-btn:hover {
  background: var(--primary-hover);
}

.share-btn:active {
  transform: scale(0.98);
}

.share-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Presence indicators - show who's online */
.presence-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  font-size: 12px;
  color: #6B7280;
}

.presence-indicator__avatars {
  display: flex;
  align-items: center;
}

.presence-indicator__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #E5E7EB;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #374151;
  margin-left: -8px;
  position: relative;
}

.presence-indicator__avatar:first-child {
  margin-left: 0;
}

.presence-indicator__avatar--developer {
  background: #E7E5E4;
  color: #292524;
}

.presence-indicator__avatar--client {
  background: #F3E8FF;
  color: #7C3AED;
}

.presence-indicator__avatar--online::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  background: #6B8F5E;
  border: 2px solid white;
  border-radius: 50%;
}

.presence-indicator__count {
  font-weight: 500;
  color: #374151;
  padding-left: 4px;
}

.presence-indicator__label {
  color: #9CA3AF;
}

.presence-indicator--empty {
  display: none;
}

/* Presence tooltip on hover */
.presence-indicator__tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 8px 0;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 100;
}

.presence-indicator:hover .presence-indicator__tooltip {
  opacity: 1;
  visibility: visible;
}

.presence-indicator__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.presence-indicator__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.presence-indicator__user-avatar--developer {
  background: #E7E5E4;
  color: #292524;
}

.presence-indicator__user-avatar--client {
  background: #F3E8FF;
  color: #7C3AED;
}

.presence-indicator__user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.presence-indicator__user-name {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.presence-indicator__user-side {
  font-size: 11px;
  color: #9CA3AF;
}

.presence-indicator__user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6B8F5E;
  margin-left: auto;
  flex-shrink: 0;
}

/* User badges */
.user-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 9999px;
  white-space: nowrap;
  line-height: 1.6;
}

.user-badge i {
  font-size: 9px;
}

.auth-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  font-size: var(--text-sm);
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-user-btn:hover {
  background: #E5E7EB;
}

/* Desktop sync status indicator */
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 500;
  background: #F3F4F6;
  color: #6B7280;
  transition: background 0.2s, color 0.2s;
}

.sync-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9CA3AF;
  flex-shrink: 0;
}

.sync-status--connected {
  background: #F4F6F0;
  color: #4B6043;
}

.sync-status--connected .sync-status__dot {
  background: #6B8F5E;
}

.sync-status--syncing {
  background: #F5F5F4;
  color: #292524;
}

.sync-status--syncing .sync-status__dot {
  background: var(--primary);
  animation: pulse 1s infinite;
}

.sync-status--disconnected {
  background: #FEF2F2;
  color: var(--danger);
  font-weight: 600;
}

.sync-status--disconnected .sync-status__dot {
  background: #EF4444;
  animation: disconnectedPulse 2s ease-in-out infinite;
}

@keyframes disconnectedPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.sync-status--error {
  background: #FEF2F2;
  color: var(--danger);
}

.sync-status--error .sync-status__dot {
  background: #EF4444;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Offline banner - prominent notification when disconnected */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  border-bottom: 2px solid #FECACA;
  padding: 12px 24px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: var(--font);
  animation: slideDown 0.3s ease-out;
}

.offline-banner--visible {
  display: flex;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.offline-banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #FEE2E2;
  border-radius: 50%;
  color: var(--danger);
  font-size: 14px;
}

.offline-banner__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.offline-banner__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #991B1B;
}

.offline-banner__subtitle {
  font-size: var(--text-xs);
  color: #B91C1C;
}

.offline-banner__actions {
  display: flex;
  gap: 8px;
  margin-left: 8px;
}

.offline-banner__btn {
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.offline-banner__btn--retry {
  background: #DC2626;
  color: white;
  border: none;
}

.offline-banner__btn--retry:hover {
  background: #B91C1C;
}

.offline-banner__btn--retry:disabled {
  background: #F87171;
  cursor: not-allowed;
}

.offline-banner__btn--dismiss {
  background: transparent;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.offline-banner__btn--dismiss:hover {
  background: #FEE2E2;
}

/* Reconnecting state */
.offline-banner--reconnecting {
  background: linear-gradient(135deg, #F5F5F4 0%, #E7E5E4 100%);
  border-bottom-color: #D6D3D1;
}

.offline-banner--reconnecting .offline-banner__icon {
  background: #E7E5E4;
  color: #292524;
  animation: pulse 1s infinite;
}

.offline-banner--reconnecting .offline-banner__title {
  color: #1C1917;
}

.offline-banner--reconnecting .offline-banner__subtitle {
  color: #292524;
}

/* Adjust body padding when banner is visible */
body.has-offline-banner {
  padding-top: 126px; /* 70px header + 56px banner */
}

/* Mobile offline banner */
@media (max-width: 1023px) {
  .offline-banner {
    padding: 10px 16px;
    gap: 12px;
  }

  .offline-banner__icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .offline-banner__title {
    font-size: var(--text-xs);
  }

  .offline-banner__subtitle {
    font-size: 10px;
  }

  .offline-banner__btn {
    padding: 5px 10px;
    font-size: 10px;
  }
}

.name-modal .m-form-group {
  margin-bottom: 16px;
}

.name-modal .m-form-group:last-child {
  margin-bottom: 0;
}

.name-modal .m-form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: #4B5563;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.name-modal .m-form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--text-base);
  font-family: var(--font);
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.name-modal .m-form-input:focus {
  border-color: var(--phase-1);
}

.name-modal .m-btn {
  padding: 10px 20px;
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.name-modal .m-btn--primary {
  background: var(--phase-1);
  color: white;
}

.name-modal .m-btn--primary:hover {
  background: var(--primary-hover);
}

.name-modal .m-btn--secondary {
  background: #F3F4F6;
  color: #374151;
}

.name-modal .m-btn--secondary:hover {
  background: #E5E7EB;
}

.name-modal .m-btn--google {
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: #374151;
  border: 1px solid #E5E7EB;
}

.name-modal .m-btn--google:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
}

.name-modal .m-btn--danger {
  background: #DC2626;
  color: white;
}

.name-modal .m-btn--danger:hover {
  background: #B91C1C;
}

.name-modal .m-modal-message {
  color: #374151;
  line-height: 1.5;
  margin: 0;
}

.name-modal__content {
  position: relative;
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 320px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Share modal specific styles */
.share-modal__content {
  width: 340px;
  max-width: 90vw;
}

.share-modal__content .name-modal__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: normal;
}

.share-modal__content .name-modal__title i {
  color: var(--primary);
}

.share-modal__description {
  color: #6B7280;
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: 0 0 20px 0;
  text-align: center;
}

/* Two-state system */
.share-state {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.share-state--hidden {
  display: none;
}

/* Primary action button */
.share-modal__primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.share-modal__primary-btn:hover {
  background: var(--primary-hover);
}

.share-modal__primary-btn:active {
  transform: scale(0.98);
}

/* Cancel link */
.share-modal__cancel-link {
  margin-top: 16px;
  padding: 8px;
  background: none;
  border: none;
  color: #6B7280;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: color 0.15s;
}

.share-modal__cancel-link:hover {
  color: #374151;
}

/* Success state */
.share-modal__success-icon {
  width: 48px;
  height: 48px;
  background: #E8EDDF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.share-modal__success-icon i {
  color: #5A7A4E;
  font-size: 20px;
}

.share-modal__success-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.share-modal__success-desc {
  color: #6B7280;
  font-size: var(--text-sm);
  margin-bottom: 20px;
}

.share-modal__success-desc strong {
  color: #374151;
}

/* Link container */
.share-modal__link-container {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 20px;
}

.share-modal__link-input {
  flex: 1;
  padding: 12px 14px;
  font-size: var(--text-xs);
  font-family: var(--font);
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  background: #F9FAFB;
  color: #374151;
  outline: none;
  min-width: 0;
}

.share-modal__link-input:focus {
  border-color: var(--primary);
  background: white;
}

.share-modal__copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  background: #F3F4F6;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.share-modal__copy-btn:hover {
  background: #E5E7EB;
}

.share-modal__copy-btn:active {
  transform: scale(0.98);
}

.share-modal__copy-btn--copied {
  background: #E8EDDF;
  border-color: #5A7A4E;
  color: #5A7A4E;
}

/* Done button */
.share-modal__done-btn {
  width: 100%;
  padding: 14px 20px;
  background: #F3F4F6;
  border: none;
  border-radius: 10px;
  color: #374151;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.share-modal__done-btn:hover {
  background: #E5E7EB;
}

.share-modal__revoke-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  color: #9CA3AF;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.share-modal__revoke-btn:hover {
  color: var(--danger-light);
  border-color: #FCA5A5;
  background: #FEF2F2;
}

/* Collaborator list in share modal */
.share-modal__collaborators {
  margin-top: 16px;
}

.share-modal__collab-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.share-modal__collab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  margin-bottom: 6px;
}

.share-modal__collab-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-modal__collab-side {
  font-size: var(--text-sm);
  font-weight: 500;
  color: #374151;
}

.share-modal__collab-side--developer {
  color: #292524;
}

.share-modal__collab-side--client {
  color: #4B6043;
}

.share-modal__collab-joined {
  font-size: var(--text-xs);
  color: #9CA3AF;
}

.share-modal__collab-remove {
  background: none;
  border: none;
  color: #D1D5DB;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  font-size: var(--text-sm);
}

.share-modal__collab-remove:hover {
  color: var(--danger-light);
  background: #FEF2F2;
}

.name-modal__title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.input-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: #4B5563;
  margin-bottom: 4px;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-label:first-of-type {
  margin-top: 0;
}

.name-modal__input {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--text-base);
  font-family: var(--font);
  border: 2px solid var(--road-edge);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.name-modal__input:focus {
  border-color: var(--phase-1);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.name-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.name-modal__button {
  width: 100%;
  padding: 12px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font);
  color: white;
  background: var(--phase-1);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.2s;
}

.name-modal__button:hover {
  filter: brightness(1.1);
}

.name-modal__button:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.name-modal__button--finish {
  background: var(--phase-5);
}

.name-modal__button--secondary {
  width: 100%;
  background: #F3F4F6;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.name-modal__button--secondary:hover {
  background: #E5E7EB;
}

/* Phase reorder buttons */
.phase-reorder {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #E5E7EB;
}

.phase-reorder__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.phase-reorder__btn:hover:not(:disabled) {
  background: #F3F4F6;
  border-color: #D1D5DB;
}

.phase-reorder__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.phase-reorder__btn i {
  font-size: 12px;
}

/* Generic modal overlay (datetime picker, etc.) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #E5E7EB;
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  padding: 4px;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__close:hover {
  color: var(--text-primary);
}

.modal__body {
  padding: 20px;
}

.modal__datetime-input {
  width: 100%;
  padding: 10px;
  font-size: var(--text-sm);
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  font-family: var(--font);
}

.modal__datetime-input:focus {
  outline: none;
  border-color: var(--phase-1);
  box-shadow: 0 0 0 3px rgba(41, 37, 36, 0.15);
}

.modal__footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #E5E7EB;
  justify-content: flex-end;
}

.modal__btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: background 0.2s;
}

.modal__btn--secondary {
  background: #E5E7EB;
  color: #374151;
}

.modal__btn--secondary:hover {
  background: #D1D5DB;
}

.modal__btn--primary {
  background: var(--phase-1);
  color: white;
}

.modal__btn--primary:hover {
  background: #1C1917;
}

/* Reset confirmation modal - scary styling */
.reset-title {
  color: var(--danger);
}

.reset-warning {
  font-size: var(--text-sm);
  color: #4B5563;
  line-height: 1.5;
  margin-bottom: 8px;
}

.reset-scary {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 16px;
}

.reset-actions {
  flex-direction: row;
  gap: 12px;
}

.reset-cancel {
  background: #E5E7EB;
  color: #374151;
  flex: 1;
}

.reset-cancel:hover {
  background: #D1D5DB;
}

.reset-cancel:focus-visible {
  outline: 2px solid #374151;
  outline-offset: 2px;
}

.reset-confirm {
  background: #DC2626;
  flex: 1;
}

.reset-confirm:hover {
  background: #B91C1C;
}

/* Demo Banner */
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--tooltip-bg);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
  font-size: var(--text-sm);
}

.demo-banner__text {
  opacity: 0.9;
}

.demo-banner__btn {
  padding: 8px 16px;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.demo-banner__btn--primary {
  background: #F59E0B;
  color: #1F2937;
  font-weight: 700;
}

.demo-banner__btn--primary:hover {
  background: #D97706;
}

.demo-banner__btn--switch {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.demo-banner__btn--switch:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.demo-banner__role {
  font-weight: 600;
  color: #D6D3D1;
}

.demo-banner__divider {
  opacity: 0.3;
}

/* Create Modal */
.create-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.create-modal--open {
  opacity: 1;
  visibility: visible;
}

.create-modal__content {
  background: white;
  padding: 32px;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  position: relative;
}

.create-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #6B7280;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
}

.create-modal__close:hover {
  background: #F3F4F6;
}

.create-modal__title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

.create-modal__row {
  display: flex;
  gap: 16px;
}

.create-modal__row > div {
  flex: 1;
}

.create-modal__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.create-modal__input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: var(--text-base);
  border: 2px solid #E5E7EB;
  border-radius: 10px;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}

.create-modal__input:focus {
  outline: none;
  border-color: var(--primary);
}

.create-modal__submit {
  width: 100%;
  padding: 14px 24px;
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

.create-modal__submit:hover {
  background: var(--primary-hover);
}

/* Onboarding wizard */
.onboarding-content {
  max-width: 380px;
}

.onboarding-content .name-modal__title {
  text-align: center;
}

.onboarding-subtitle {
  font-size: var(--text-sm);
  color: #4B5563;
  margin-bottom: 20px;
  text-align: center;
}

.onboarding-page {
  display: none;
}

.onboarding-page--active {
  display: block;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.onboarding-lang {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.onboarding-lang__btn {
  flex: 1;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  color: #4B5563;
  background: #F3F4F6;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.onboarding-lang__btn:hover {
  background: #E5E7EB;
}

.onboarding-lang__btn--active {
  color: var(--phase-1);
  background: #F5F5F4;
  border-color: var(--phase-1);
}

.onboarding-palettes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.onboarding-palette {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #F9FAFB;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.onboarding-palette:hover {
  background: #F3F4F6;
}

.onboarding-palette:focus-visible {
  outline: 2px solid var(--phase-1);
  outline-offset: 2px;
}

.onboarding-palette--active {
  background: #F5F5F4;
  border-color: var(--phase-1);
}

.onboarding-palette__swatches {
  display: flex;
  gap: 4px;
}

.onboarding-palette__swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.onboarding-palette__name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: #374151;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.onboarding-actions .name-modal__button {
  width: 100%;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

