/* ===== MOBILE STYLES ===== */
/* Breakpoint: 1024px (tablets and phones) */

/* Mobile app container - hidden on desktop */
.m-app {
  display: none;
}

@media (max-width: 1023px) {
  /* Hide desktop elements */
  .header,
  .footer,
  main,
  .snake-container,
  .name-modal:not(.m-modal),
  .pill-tooltip {
    display: none !important;
  }

  /* Show mobile app */
  .m-app {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    background: var(--bg);
  }

  body {
    padding: 0;
    overflow: hidden;
  }

  /* Mobile CSS variables */
  :root {
    --m-header-height: 56px;
    --m-tabs-height: 56px;
    --m-spacing-xs: 4px;
    --m-spacing-sm: 8px;
    --m-spacing-md: 16px;
    --m-spacing-lg: 24px;
    --m-touch-target: 44px;
    --m-card-radius: 12px;
    --m-safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --m-font: 'Inter', system-ui, sans-serif;
    --m-text-base: 1rem;
  }

  /* ===== MOBILE HEADER ===== */
  .m-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--m-header-height);
    background: white;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--m-spacing-md);
    z-index: 100;
  }

  .m-header__left {
    display: flex;
    align-items: center;
    gap: var(--m-spacing-sm);
  }

  .m-header__role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: white;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
  }

  .m-header__role:active {
    opacity: 0.8;
    transform: scale(0.95);
  }

  .m-header__role--developer {
    background: var(--phase-1);
  }

  .m-header__role--client {
    background: var(--phase-2);
  }

  .m-header__role i {
    font-size: 12px;
  }

  .m-header__title {
    font-size: var(--text-base);
    font-weight: 700;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  .m-header__actions {
    display: flex;
    align-items: center;
    gap: var(--m-spacing-xs);
  }

  .m-header__btn {
    width: var(--m-touch-target);
    height: var(--m-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: #4B5563;
    cursor: pointer;
  }

  .m-header__btn:active {
    background: #F3F4F6;
  }

  .m-header__btn:disabled {
    opacity: 0.3;
    pointer-events: none;
  }

  .m-header__btn--signed-in {
    color: #44403C;
  }

  /* ===== MOBILE SYNC STATUS (PartyKit prep) ===== */
  .m-sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: var(--text-xs);
    font-weight: 500;
    background: #F3F4F6;
    color: #6B7280;
    margin-right: 4px;
  }

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

  .m-sync-status--connected {
    background: #E8EDDF;
    color: #3D4F37;
  }

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

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

  .m-sync-status--syncing .m-sync-status__dot {
    background: #44403C;
    animation: syncPulse 1s ease-in-out infinite;
  }

  .m-sync-status--offline {
    background: #FEE2E2;
    color: #991B1B;
  }

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

  @keyframes syncPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
  }

  /* ===== DEMO BANNER (mobile two-row) ===== */
  .demo-banner {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px 10px;
    font-size: var(--text-xs);
  }

  .demo-banner__role {
    font-size: var(--text-xs);
  }

  .demo-banner__divider {
    display: none;
  }

  .demo-banner__text {
    order: 10;
    width: 100%;
    text-align: center;
    font-size: var(--text-xs);
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .demo-banner__btn {
    padding: 6px 12px;
    font-size: var(--text-xs);
  }

  .demo-banner__btn--primary {
    order: 11;
    margin-left: auto;
  }

  /* When demo banner is visible, push mobile header + content down */
  body[style*="padding-top"] .m-header {
    top: 60px;
  }

  body[style*="padding-top"] .m-content {
    margin-top: calc(var(--m-header-height) + 60px);
  }

  /* ===== MOBILE CONTENT AREA ===== */
  .m-content {
    flex: 1;
    margin-top: var(--m-header-height);
    margin-bottom: calc(var(--m-tabs-height) + var(--m-safe-area-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Pull-to-refresh indicator */
  .m-pull-refresh {
    position: absolute;
    top: calc(var(--m-header-height) - 50px);
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, top 0.2s;
    z-index: 50;
    pointer-events: none;
  }

  .m-pull-refresh--visible {
    opacity: 1;
    top: calc(var(--m-header-height) + 10px);
  }

  .m-pull-refresh--refreshing {
    opacity: 1;
    top: calc(var(--m-header-height) + 10px);
  }

  .m-pull-refresh__icon {
    font-size: 18px;
    color: var(--phase-1);
    transition: transform 0.2s;
  }

  .m-pull-refresh--triggered .m-pull-refresh__icon {
    transform: rotate(180deg);
  }

  .m-pull-refresh--refreshing .m-pull-refresh__icon {
    animation: refreshSpin 1s linear infinite;
  }

  @keyframes refreshSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  /* ===== MOBILE BOTTOM TABS ===== */
  .m-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--m-tabs-height) + var(--m-safe-area-bottom));
    padding-bottom: var(--m-safe-area-bottom);
    background: white;
    border-top: 1px solid #E5E7EB;
    display: flex;
    z-index: 100;
  }

  .m-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: #6B7280;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    min-height: var(--m-touch-target);
  }

  .m-tab i {
    font-size: 20px;
  }

  .m-tab--active {
    color: var(--phase-1);
  }

  .m-tab--active i {
    color: var(--phase-1);
  }

  /* ===== MOBILE VIEWS ===== */
  .m-view {
    display: none;
    padding: var(--m-spacing-md);
  }

  .m-view--active {
    display: block;
  }

  /* ===== ROLE SELECTION SCREEN ===== */
  .m-role-select {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--m-spacing-lg);
    z-index: 200;
  }

  .m-role-select__title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: #1F2937;
    margin-bottom: var(--m-spacing-sm);
    text-align: center;
  }

  .m-role-select__subtitle {
    font-size: var(--text-base);
    color: #6B7280;
    margin-bottom: var(--m-spacing-lg);
    text-align: center;
  }

  .m-role-select__buttons {
    display: flex;
    flex-direction: column;
    gap: var(--m-spacing-md);
    width: 100%;
    max-width: 300px;
  }

  .m-role-select__btn {
    display: flex;
    align-items: center;
    gap: var(--m-spacing-md);
    padding: var(--m-spacing-md) var(--m-spacing-lg);
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: var(--m-card-radius);
    cursor: pointer;
    transition: all 0.15s;
    min-height: 72px;
  }

  .m-role-select__btn:active {
    transform: scale(0.98);
  }

  .m-role-select__btn--developer:hover,
  .m-role-select__btn--developer:focus {
    border-color: var(--phase-1);
    background: #F5F5F4;
  }

  .m-role-select__btn--client:hover,
  .m-role-select__btn--client:focus {
    border-color: var(--phase-2);
    background: #F5F3FF;
  }

  .m-role-select__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
  }

  .m-role-select__btn--developer .m-role-select__icon {
    background: var(--phase-1);
  }

  .m-role-select__btn--client .m-role-select__icon {
    background: var(--phase-2);
  }

  .m-role-select__label {
    flex: 1;
    text-align: left;
  }

  .m-role-select__role {
    font-size: var(--text-xs);
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .m-role-select__name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: #1F2937;
  }

  .m-role-select__skip {
    margin-top: var(--m-spacing-lg);
    background: none;
    border: none;
    color: #9CA3AF;
    font-family: var(--m-font);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .m-role-select__skip:hover,
  .m-role-select__skip:active {
    color: #6B7280;
    background: #F3F4F6;
  }

  /* Switch indicator on header role pill */
  .m-header__role-switch {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 2px;
  }

  /* ===== MOBILE TASK LIST ===== */
  .m-task-list {
    display: flex;
    flex-direction: column;
    gap: var(--m-spacing-md);
    width: 100%;
  }

  .m-phase-section {
    background: white;
    border-radius: var(--m-card-radius);
    border: 1px solid #E5E7EB;
    overflow: hidden;
  }

  .m-phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--m-spacing-md);
    cursor: pointer;
    min-height: var(--m-touch-target);
  }

  .m-phase-header__left {
    display: flex;
    align-items: center;
    gap: var(--m-spacing-sm);
  }

  .m-phase-header__color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
  }

  .m-phase-header__name {
    font-size: var(--text-base);
    font-weight: 600;
    color: #1F2937;
  }

  .m-phase-header__count {
    font-size: var(--text-sm);
    color: #6B7280;
  }

  .m-phase-header__chevron {
    color: #6B7280;
    transition: transform 0.2s;
  }

  .m-phase-section--expanded .m-phase-header__chevron {
    transform: rotate(180deg);
  }

  .m-phase-content {
    display: none;
    border-top: 1px solid #F3F4F6;
  }

  .m-phase-section--expanded .m-phase-content {
    display: block;
  }

  /* ===== MOBILE CARD ITEM ===== */
  .m-card {
    display: flex;
    align-items: flex-start;
    gap: var(--m-spacing-sm);
    padding: var(--m-spacing-md);
    border-bottom: 1px solid #F3F4F6;
    min-height: var(--m-touch-target);
  }

  .m-card:last-child {
    border-bottom: none;
  }

  .m-card--done {
    opacity: 0.5;
  }

  .m-card--clickable {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .m-card--clickable:active {
    background: #F3F4F6;
  }

  .m-card--done .m-card__text {
    text-decoration: line-through;
  }

  .m-card__checkbox {
    flex-shrink: 0;
    width: var(--m-touch-target);
    height: var(--m-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    margin: -8px;
    margin-right: 0;
    position: relative;
  }

  .m-card__checkbox::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #D1D5DB;
    border-radius: 6px;
    background: white;
    transition: all 0.15s;
  }

  .m-card__checkbox--checked::before {
    background: var(--phase-5);
    border-color: var(--phase-5);
  }

  .m-card__checkbox--checked::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    margin-top: -2px;
  }

  .m-card__content {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
  }

  .m-card__text {
    font-size: var(--text-base);
    color: #1F2937;
    line-height: 1.4;
    word-break: break-word;
  }

  .m-card__meta {
    font-size: var(--text-xs);
    color: #6B7280;
    margin-top: 2px;
  }

  /* ===== MOBILE CARD ICONS ===== */
  .m-card__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 16px;
  }

  .m-card__icon--approval {
    background: #FEF3C7;
    color: #92400E;
  }

  .m-card__icon--pingpong {
    background: #E7E5E4;
    color: #292524;
  }

  .m-card__icon--call {
    background: #E8EDDF;
    color: #3D4F37;
  }

  .m-card__icon--meeting {
    background: #EDE9FE;
    color: #6D28D9;
  }

  /* ===== MOBILE CARD BADGES ===== */
  .m-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    margin-top: 4px;
  }

  .m-card__badge--success {
    background: #E8EDDF;
    color: #3D4F37;
  }

  .m-card__badge--warning {
    background: #FEF3C7;
    color: #92400E;
  }

  .m-card__badge--error {
    background: #FEE2E2;
    color: #991B1B;
  }

  /* ===== MOBILE CARD ACTIONS ===== */
  .m-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }

  .m-card__action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    font-family: var(--font);
    font-size: var(--text-sm);
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #F3F4F6;
    color: #374151;
    min-height: var(--m-touch-target);
  }

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

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

  .m-card__action-btn--success {
    background: #6B8F5E;
    color: white;
  }

  .m-card__action-btn--danger {
    background: #EF4444;
    color: white;
  }

  /* ===== MOBILE CARD DATETIME ===== */
  .m-card__datetime {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #F3F4F6;
    border-radius: 4px;
    font-size: var(--text-xs);
    color: #4B5563;
    margin-top: 4px;
  }

  .m-card__datetime--today {
    background: #FEF3C7;
    color: #92400E;
    font-weight: 600;
  }

  /* ===== MOBILE CARD META ===== */
  .m-card__meta a {
    color: var(--phase-1);
    text-decoration: none;
  }

  .m-card__meta a:active {
    text-decoration: underline;
  }

  .m-card__meta--error {
    color: #991B1B;
  }

  /* ===== MOBILE PING-PONG COLLAB CARD ===== */
  .m-card__workspace {
    max-height: 150px;
    overflow-y: auto;
    padding: 14px;
    background: #FAFBFC;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
  }

  .m-card__message {
    font-size: var(--m-text-base);
    line-height: 1.6;
    color: #374151;
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
  }

  .m-card__message:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .m-card__message:first-child {
    padding-top: 0;
  }

  .m-card__message strong {
    color: #1F2937;
  }

  .m-card__input-row {
    margin-top: 12px;
  }

  .m-card__input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #D1D5DB;
    border-radius: 10px;
    font-family: var(--m-font);
    font-size: var(--m-text-base);
    line-height: 1.5;
    background: white;
    color: #1F2937;
    resize: none;
    min-height: 60px;
  }

  .m-card__input:focus {
    outline: none;
    border-color: var(--phase-1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  }

  .m-card__input::placeholder {
    color: #9CA3AF;
  }

  /* ===== MOBILE CARD WAITING STATE ===== */
  .m-card--waiting {
    opacity: 0.6;
  }

  /* ===== MOBILE CARD NEW HIGHLIGHT ===== */
  @keyframes mobileCardAdded {
    0% {
      background: #FEF3C7;
      box-shadow: 0 0 0 2px #F59E0B;
    }
    100% {
      background: white;
      box-shadow: none;
    }
  }

  .m-card--just-added {
    animation: mobileCardAdded 0.8s ease-out forwards;
  }

  /* ===== MOBILE CARD DELETE ===== */
  .m-card__delete {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 6px;
    color: #6B7280;
    cursor: pointer;
    margin-left: auto;
    align-self: flex-start;
    margin-top: 4px;
  }

  .m-card__delete:active {
    background: #FEE2E2;
    color: #DC2626;
  }

  /* ===== MOBILE SWIPE GESTURES ===== */
  .m-card {
    position: relative;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
  }

  .m-card__swipe-layer {
    display: flex;
    align-items: flex-start;
    gap: var(--m-spacing-sm);
    width: 100%;
    transition: transform 0.2s ease-out;
    will-change: transform;
  }

  .m-card--swiping .m-card__swipe-layer {
    transition: none;
  }

  .m-card__swipe-hint {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.15s;
  }

  .m-card__swipe-hint--complete {
    left: 0;
    background: linear-gradient(90deg, #6B8F5E 0%, #6B8F5E00 100%);
    color: white;
  }

  .m-card__swipe-hint--actions {
    right: 0;
    background: linear-gradient(270deg, #6B7280 0%, #6B728000 100%);
    color: white;
  }

  .m-card--swiping-right .m-card__swipe-hint--complete,
  .m-card--swiping-left .m-card__swipe-hint--actions {
    opacity: 1;
  }

  .m-card--swipe-complete {
    animation: swipeComplete 0.3s ease-out forwards;
  }

  @keyframes swipeComplete {
    0% { background: transparent; }
    50% { background: #E8EDDF; }
    100% { background: transparent; }
  }

  /* ===== iOS DYNAMIC TYPE SUPPORT ===== */
  @supports (-webkit-touch-callout: none) {
    /* iOS-specific styles */
    :root {
      /* Use iOS system font with Dynamic Type support */
      --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    }

    /* Scale text with iOS Accessibility settings */
    .m-card__text,
    .m-card__meta,
    .m-card__badge,
    .m-card__action-btn,
    .m-tab__label,
    .m-phase__title,
    .m-modal__title {
      /* Allow iOS to scale text based on user's Dynamic Type preference */
      -webkit-text-size-adjust: 100%;
    }
  }

  /* Ensure touch targets remain adequate at larger text sizes */
  @media (min-resolution: 2dppx) {
    .m-card__checkbox,
    .m-card__delete,
    .m-card__action-btn {
      min-width: var(--m-touch-target);
      min-height: var(--m-touch-target);
    }
  }

  /* ===== MOBILE NOTES VIEW ===== */
  .m-notes {
    display: flex;
    flex-direction: column;
    gap: var(--m-spacing-md);
  }

  .m-notes__section {
    background: white;
    border-radius: var(--m-card-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
  }

  .m-notes__header {
    display: flex;
    align-items: center;
    gap: var(--m-spacing-sm);
    padding: var(--m-spacing-md);
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
    font-size: var(--text-sm);
    font-weight: 600;
    color: #374151;
  }

  .m-notes__header i {
    color: #6B7280;
  }

  .m-notes__textarea {
    width: 100%;
    min-height: 150px;
    padding: var(--m-spacing-md);
    font-family: var(--font);
    font-size: var(--text-base);
    border: none;
    resize: vertical;
    background: white;
    color: #1F2937;
    line-height: 1.5;
  }

  .m-notes__textarea:focus {
    outline: none;
  }

  .m-notes__textarea::placeholder {
    color: #6B7280;
  }

  /* ===== MOBILE EMPTY STATE ===== */
  .m-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--m-spacing-lg) var(--m-spacing-md);
    text-align: center;
    color: #6B7280;
  }

  .m-empty__icon {
    font-size: 48px;
    margin-bottom: var(--m-spacing-md);
    opacity: 0.5;
  }

  .m-empty__text {
    font-size: var(--text-base);
  }

  /* ===== MOBILE FAB (Add button) ===== */
  .m-fab {
    position: fixed;
    bottom: calc(var(--m-tabs-height) + var(--m-safe-area-bottom) + var(--m-spacing-md));
    right: var(--m-spacing-md);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--phase-1);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 50;
    transition: transform 0.15s, box-shadow 0.15s;
  }

  .m-fab:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  /* ===== MOBILE MODAL ===== */
  .m-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
  }

  .m-modal--open {
    display: block;
  }

  .m-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .m-modal__sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
    padding-bottom: var(--m-safe-area-bottom);
  }

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

  .m-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--m-spacing-md);
    border-bottom: 1px solid #E5E7EB;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
  }

  .m-modal__title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: #1F2937;
  }

  .m-modal__close {
    width: var(--m-touch-target);
    height: var(--m-touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #6B7280;
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
  }

  .m-modal__close:active {
    background: #F3F4F6;
  }

  .m-modal__content {
    padding: var(--m-spacing-md);
  }

  .m-modal__footer {
    display: flex;
    gap: var(--m-spacing-sm);
    padding: var(--m-spacing-md);
    border-top: 1px solid #E5E7EB;
  }

  /* ===== MOBILE FORM ELEMENTS ===== */
  .m-form-group {
    margin-bottom: var(--m-spacing-md);
  }

  .m-form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: #374151;
    margin-bottom: var(--m-spacing-xs);
  }

  .m-form-input,
  .m-form-select {
    width: 100%;
    padding: 12px;
    font-family: var(--font);
    font-size: var(--text-base);
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: white;
    color: #1F2937;
    min-height: var(--m-touch-target);
  }

  .m-form-input:focus,
  .m-form-select:focus {
    outline: none;
    border-color: var(--phase-1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  }

  .m-form-input::placeholder {
    color: #6B7280;
  }

  .m-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
  }

  /* ===== MOBILE TYPE BUTTONS ===== */
  .m-type-buttons {
    display: flex;
    gap: var(--m-spacing-sm);
  }

  .m-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: #F3F4F6;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 60px;
  }

  .m-type-btn i {
    font-size: 18px;
    color: #6B7280;
  }

  .m-type-btn span {
    font-size: var(--text-xs);
    font-weight: 500;
    color: #6B7280;
  }

  .m-type-btn--active {
    background: #F5F5F4;
    border-color: var(--phase-1);
  }

  .m-type-btn--active i,
  .m-type-btn--active span {
    color: var(--phase-1);
  }

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

  /* ===== MOBILE BUTTONS ===== */
  .m-btn {
    flex: 1;
    padding: 12px 16px;
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: var(--m-touch-target);
    transition: all 0.15s;
  }

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

  .m-btn--primary:active {
    background: #1C1917;
  }

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

  .m-btn--secondary:active {
    background: #E5E7EB;
  }

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

  .m-btn--danger:active {
    background: #B91C1C;
  }

  /* ===== MOBILE SETTINGS ===== */
  .m-settings-section {
    padding: var(--m-spacing-md) 0;
    border-bottom: 1px solid #E5E7EB;
  }

  .m-settings-section:last-child {
    border-bottom: none;
  }

  .m-settings-section--link {
    padding-top: var(--m-spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--m-spacing-sm);
  }

  .m-settings-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--m-spacing-sm);
  }

  .m-settings-value {
    font-size: var(--text-lg);
    font-weight: 600;
    color: #1F2937;
  }

  .m-settings-role {
    display: flex;
    gap: var(--m-spacing-sm);
  }

  .m-role-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--m-spacing-sm);
    padding: 14px;
    background: #F3F4F6;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: var(--m-touch-target);
  }

  .m-role-toggle i {
    font-size: 16px;
    color: #6B7280;
  }

  .m-role-toggle span {
    font-size: var(--text-sm);
    font-weight: 600;
    color: #374151;
  }

  .m-role-toggle--active {
    background: #F5F5F4;
    border-color: var(--phase-1);
  }

  .m-role-toggle--active i {
    color: var(--phase-1);
  }

  .m-role-toggle--active span {
    color: var(--phase-1);
  }

  .m-role-toggle:active {
    transform: scale(0.98);
  }

  .m-settings-toggle {
    display: flex;
    gap: 0;
    background: #F3F4F6;
    border-radius: 8px;
    padding: 4px;
  }

  .m-lang-btn {
    flex: 1;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 36px;
  }

  .m-lang-btn--active {
    background: white;
    color: #1F2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

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

  .m-settings-desktop-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--m-spacing-sm);
    width: 100%;
    padding: 14px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    min-height: var(--m-touch-target);
  }

  .m-settings-desktop-link i:first-child {
    font-size: 18px;
  }

  .m-settings-desktop-link i:last-child {
    font-size: 12px;
    opacity: 0.6;
  }

  .m-settings-desktop-link span {
    flex: 1;
    text-align: left;
  }

  .m-settings-desktop-link:active {
    background: #E5E7EB;
  }

  /* ===== MOBILE PHASE MANAGER ===== */
  .m-phase-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto;
  }

  .m-phase-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #F9FAFB;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
  }

  .m-phase-item__color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .m-phase-item__name {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: 500;
    color: #1F2937;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .m-phase-item__actions {
    display: flex;
    gap: 4px;
  }

  .m-phase-item__btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 6px;
    color: #6B7280;
    cursor: pointer;
  }

  .m-phase-item__btn:active {
    background: #E5E7EB;
  }

  .m-phase-item__btn--danger:active {
    background: #FEE2E2;
    color: #DC2626;
  }

  .m-phase-add {
    display: flex;
    gap: 8px;
  }

  .m-phase-add__input {
    flex: 1;
    padding: 12px 14px;
    font-size: var(--text-sm);
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    background: white;
    outline: none;
  }

  .m-phase-add__input:focus {
    border-color: #44403C;
  }

  .m-phase-add__btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #44403C;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
  }

  .m-phase-add__btn:active {
    background: #1C1917;
  }

  .m-phase-empty {
    text-align: center;
    padding: 24px;
    color: #9CA3AF;
    font-size: var(--text-sm);
  }

  /* ===== MOBILE PROGRESS VIEW ===== */
  .m-progress {
    display: flex;
    flex-direction: column;
    gap: var(--m-spacing-md);
  }

  .m-progress__header {
    text-align: center;
    padding: var(--m-spacing-lg) 0;
  }

  .m-progress__percentage {
    font-size: 48px;
    font-weight: 700;
    color: #1F2937;
    line-height: 1;
  }

  .m-progress__label {
    font-size: var(--text-sm);
    color: #6B7280;
    margin-top: var(--m-spacing-xs);
  }

  .m-progress__bar {
    height: 12px;
    background: #E5E7EB;
    border-radius: 6px;
    overflow: hidden;
    margin: var(--m-spacing-md) 0;
  }

  .m-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--phase-1), var(--phase-3), var(--phase-5));
    border-radius: 6px;
    transition: width 0.5s ease-out;
  }

  .m-progress__phases {
    display: flex;
    flex-direction: column;
    gap: var(--m-spacing-sm);
  }

  .m-progress__phase {
    background: white;
    border-radius: var(--m-card-radius);
    border: 1px solid #E5E7EB;
    padding: var(--m-spacing-md);
  }

  .m-progress__phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--m-spacing-sm);
  }

  .m-progress__phase-name {
    display: flex;
    align-items: center;
    gap: var(--m-spacing-sm);
    font-weight: 600;
    color: #1F2937;
  }

  .m-progress__phase-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
  }

  .m-progress__phase-count {
    font-size: var(--text-sm);
    color: #6B7280;
  }

  .m-progress__phase-bar {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
  }

  .m-progress__phase-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease-out;
  }

  .m-progress__phase--complete {
    border-color: var(--phase-5);
    background: #F4F6F0;
  }

  .m-progress__phase--complete .m-progress__phase-count {
    color: var(--phase-5);
    font-weight: 600;
  }

  /* ===== MOBILE ACTIVITY VIEW ===== */
  .m-activity {
    display: flex;
    flex-direction: column;
    gap: var(--m-spacing-sm);
  }

  .m-activity__item {
    display: flex;
    gap: var(--m-spacing-sm);
    padding: var(--m-spacing-md);
    background: white;
    border-radius: var(--m-card-radius);
    border: 1px solid #E5E7EB;
  }

  .m-activity__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .m-activity__icon--task {
    background: #E8EDDF;
    color: var(--phase-5);
  }

  .m-activity__icon--approval {
    background: #FEF3C7;
    color: #92400E;
  }

  .m-activity__icon--transfer {
    background: #E7E5E4;
    color: var(--phase-1);
  }

  .m-activity__icon--phase {
    background: #F5F5F4;
    color: #44403C;
  }

  .m-activity__icon--delete {
    background: #FEE2E2;
    color: #DC2626;
  }

  .m-activity__content {
    flex: 1;
    min-width: 0;
  }

  .m-activity__text {
    font-size: var(--text-sm);
    color: #1F2937;
    line-height: 1.4;
  }

  .m-activity__text strong {
    font-weight: 600;
  }

  .m-activity__time {
    font-size: var(--text-xs);
    color: #6B7280;
    margin-top: 2px;
  }

  .m-activity__empty {
    text-align: center;
    padding: var(--m-spacing-lg);
    color: #6B7280;
  }

  /* Reduced motion */
  @media (prefers-reduced-motion: reduce) {
    .m-fab,
    .m-role-select__btn,
    .m-phase-header__chevron,
    .m-modal__backdrop,
    .m-modal__sheet,
    .m-type-btn,
    .m-btn {
      transition: none;
      animation: none;
    }
  }
}

.name-modal__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #4B5563;
  font-size: var(--text-sm);
  margin: 4px 0;
}

.name-modal__divider::before,
.name-modal__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--road-edge);
}

.name-modal__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.name-modal__link {
  background: none;
  border: none;
  color: #6B7280;
  font-size: var(--text-sm);
  font-family: var(--font);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.name-modal__link:hover {
  background: #F3F4F6;
  color: #374151;
}

.name-modal__link--danger {
  color: #9CA3AF;
}

.name-modal__link--danger:hover {
  background: #FEF2F2;
  color: #DC2626;
}

/* Calendar preference modal */
.calendar-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.calendar-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: #F9FAFB;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.calendar-option:hover {
  background: #F3F4F6;
  border-color: #D1D5DB;
}

.calendar-option i {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

/* ===== ANIMATIONS ===== */

/* Plus icon gentle pulse - invites interaction */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.milestone--add .plus-icon {
  animation: pulse 2s ease-in-out infinite;
}

/* Milestone pop when activated */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.milestone--activated {
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
  transform-box: fill-box;
}

/* Number fade-in */
@keyframes numberIn {
  0% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}

.milestone__number--animated {
  animation: numberIn 0.3s ease-out forwards;
  transform-origin: center;
  transform-box: fill-box;
}

/* Fade in (no sideways movement) */
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}


/* Modal animations */
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.name-modal--open {
  animation: modalFadeIn 0.2s ease-out;
}

.name-modal--open .name-modal__content {
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Connector line draw */
@keyframes drawLine {
  from { stroke-dashoffset: 200; }
  to { stroke-dashoffset: 0; }
}

.connector-animated {
  stroke-dasharray: 200;
  animation: drawLine 0.3s ease-out forwards;
}

/* 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;
  }
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid #E5E7EB;
  z-index: 50;
}

.header__left,
.header__right {
  flex: 1;
  display: flex;
  align-items: center;
}

.header__left {
  justify-content: flex-start;
}

.header__right {
  justify-content: flex-end;
  gap: 4px;
}

.header__center {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.header__logo img {
  width: 22px;
  height: 22px;
}

.header__title {
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 700;
  color: #1F2937;
}

.header__divider {
  width: 1px;
  height: 20px;
  background: #E5E7EB;
  margin: 0 8px;
}

.header__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #4B5563;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.header__btn:hover:not(:disabled) {
  background: #F3F4F6;
  color: #1F2937;
}

.header__btn:disabled {
  color: #6B7280;
  cursor: not-allowed;
}

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

.header__btn--primary {
  width: auto;
  padding: 0 12px;
  gap: 6px;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  color: white;
  background: var(--phase-1);
}

.header__btn--primary:hover:not(:disabled) {
  background: #1C1917;
  color: white;
}

.header__btn--primary.copied {
  background: var(--phase-5);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: white;
  border-top: 1px solid #E5E7EB;
  font-family: var(--font);
  font-size: var(--text-xs);
  color: #4B5563;
  z-index: 50;
}

.footer__left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer__copyright {
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer__legal {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer__legal a {
  color: #6B7280;
  text-decoration: none;
  transition: color 0.15s;
}

.footer__legal a:hover {
  color: #111827;
  text-decoration: underline;
}

.footer__status {
  flex: 1;
  text-align: right;
  color: transparent;
  transition: color 0.2s;
}

.footer__status.saved {
  color: var(--phase-5);
}

.footer__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.footer__group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer__divider {
  width: 1px;
  height: 20px;
  background: #E5E7EB;
  margin: 0 6px;
}

.footer__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  color: #6B7280;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.footer__btn-label {
  font-size: 0.6875rem;
  font-weight: 600;
}

.footer__btn:hover {
  background: #F3F4F6;
  color: #6B7280;
}

.footer__btn--lang {
  width: auto;
  padding: 0 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.footer__btn--lang i {
  font-size: 0.75rem;
}

.footer__btn--danger {
  color: #9CA3AF;
}

.footer__btn--danger:hover {
  background: #FEE2E2;
  color: #DC2626;
}

.footer__btn:focus-visible {
  outline: 2px solid #44403C;
  outline-offset: 2px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px 12px 20px;
  background: #1F2937;
  color: white;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 200;
  animation: toastIn 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
}

.toast__message {
  flex: 1;
}

.toast__dismiss {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 4px;
  margin: -4px;
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s;
}

.toast__dismiss:hover {
  color: white;
}

.toast--fade {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Heart burst celebration */
.heart-particle {
  position: fixed;
  font-size: 16px;
  color: #E11D48;
  pointer-events: none;
  z-index: 300;
  animation: heartBurst 0.8s ease-out forwards;
}

@keyframes heartBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(0.5); }
  60% { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(1.1); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 20px)) scale(0.8); }
}

/* ===== COLLABORATION SIDE BADGE ===== */
.side-badge {
  display: none;  /* Hidden by default, shown in collab mode */
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 6px 12px;
  background: #F4F6F0;
  border: 1px solid #C2CEAC;
  color: #4B6043;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: 6px;
  animation: badgeFadeIn 0.3s ease-out;
  white-space: nowrap;
}

.side-badge--visible {
  display: flex;
}

.side-badge__dot {
  display: none;
}

.side-badge__side {
  font-weight: 700;
}

@keyframes badgeFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dev Panel (Admin only) */
.dev-panel {
  display: none;
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #1F2937;
  color: white;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  max-width: 280px;
}
.dev-panel--visible { display: block; }
.dev-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #374151;
}
.dev-panel__title {
  font-weight: 600;
  color: #F59E0B;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dev-panel__close {
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 2px;
}
.dev-panel__close:hover { color: white; }
.dev-panel__section { margin-bottom: 10px; }
.dev-panel__label {
  color: #9CA3AF;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.dev-panel__value {
  color: #E5E7EB;
  font-family: monospace;
  font-size: 11px;
}
.dev-panel__buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.dev-panel__btn {
  background: #374151;
  border: none;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.dev-panel__btn:hover { background: #4B5563; }
.dev-panel__btn--danger { background: #7F1D1D; }
.dev-panel__btn--danger:hover { background: #991B1B; }
.dev-panel__btn i { width: 14px; text-align: center; }

/* Palette dropdown */
.palette-wrapper {
  position: relative;
}

/* Version dropdown */
.version-wrapper {
  position: relative;
}

.version-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  padding: 12px;
  min-width: 280px;
  display: none;
  z-index: 200;
}

.version-dropdown.open {
  display: block;
  animation: modalSlideUp 0.2s ease-out;
}

.version-dropdown__title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: #4B5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.version-dropdown__save {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #E5E7EB;
}

.version-dropdown__input {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: var(--text-sm);
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  outline: none;
}

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

.version-dropdown__save-btn {
  padding: 8px 12px;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  color: white;
  background: var(--phase-1);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.version-dropdown__save-btn:hover {
  background: #1C1917;
}

.version-dropdown__save-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

.version-list {
  max-height: 250px;
  overflow-y: auto;
}

.version-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.version-item:hover {
  background: #F3F4F6;
}

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

.version-item__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F6;
  border-radius: 6px;
  color: #4B5563;
}

.version-item__icon i {
  font-size: var(--text-sm);
}

.version-item__info {
  flex: 1;
  min-width: 0;
}

.version-item__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #1F2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-item__date {
  font-size: var(--text-xs);
  color: #4B5563;
}

.version-item__delete {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #4B5563;
}

.version-item:hover .version-item__delete {
  display: flex;
  align-items: center;
  justify-content: center;
}

.version-item__delete:hover {
  color: #DC2626;
  background: #FEE2E2;
}

.version-item__delete:focus-visible {
  display: flex;
  outline: 2px solid #DC2626;
  outline-offset: 2px;
}

.version-item__delete svg {
  width: 14px;
  height: 14px;
}

.version-empty {
  padding: 20px;
  text-align: center;
  color: #4B5563;
  font-size: var(--text-sm);
}

/* Activity dropdown */
.activity-wrapper {
  position: relative;
}

.activity-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  padding: 12px;
  min-width: 320px;
  max-width: 400px;
  display: none;
  z-index: 200;
}

.activity-dropdown.open {
  display: block;
  animation: modalSlideUp 0.2s ease-out;
}

.activity-dropdown__title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: #4B5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.activity-list {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  border-bottom: 1px solid #F3F4F6;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item__icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F6;
  border-radius: 6px;
  color: #4B5563;
  flex-shrink: 0;
}

.activity-item__icon--transfer {
  background: #E7E5E4;
  color: var(--phase-1);
}

.activity-item__icon--complete {
  background: #E8EDDF;
  color: var(--phase-5);
}

.activity-item__icon--phase {
  background: #EDE9FE;
  color: var(--phase-2);
}

.activity-item__icon--version {
  background: #FEF3C7;
  color: #D97706;
}

.activity-item__content {
  flex: 1;
  min-width: 0;
}

.activity-item__text {
  font-size: var(--text-sm);
  color: #1F2937;
  line-height: 1.4;
}

.activity-item__text strong {
  font-weight: 600;
}

.activity-item__detail {
  font-size: var(--text-xs);
  color: #6B7280;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-item__time {
  font-size: var(--text-xs);
  color: #6B7280;
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-empty {
  padding: 20px;
  text-align: center;
  color: #4B5563;
  font-size: var(--text-sm);
}

.activity-item__icon--delete {
  background: #FEE2E2;
  color: #DC2626;
}

.activity-export-btn {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: #F3F4F6;
  border: none;
  border-radius: 8px;
  color: #4B5563;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.activity-export-btn:hover {
  background: #E5E7EB;
}

.palette-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  padding: 8px;
  min-width: 200px;
  display: none;
  z-index: 100;
}

.palette-dropdown.open {
  display: block;
  animation: modalSlideUp 0.2s ease-out;
}

.palette-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

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

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

.palette-option.active {
  background: #F5F5F4;
}

.palette-option--locked {
  opacity: 0.55;
}

.palette-option--locked:hover {
  opacity: 0.75;
}

.palette-swatches {
  display: flex;
  gap: 3px;
}

.palette-swatch {
  width: 16px;
  height: 16px;
  border-radius: 6px;
}

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

.palette-divider {
  height: 1px;
  background: #E5E7EB;
  margin: 8px 0;
}

/* Custom color pickers */
.custom-colors {
  padding: 8px 12px;
}

.custom-colors-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: #4B5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.custom-colors-row {
  display: flex;
  gap: 6px;
}

.color-picker-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
}

.color-picker-wrapper input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  -webkit-appearance: none;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 6px;
}

/* Contrast ratio indicator under each color picker */
.color-contrast {
  display: block;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1;
}

.color-contrast--pass {
  color: #4B6043;
}

.color-contrast--fail {
  color: #DC2626;
}

/* ===== CARD OVERLAY SYSTEM ===== */
/* HTML overlay approach - bypasses Safari foreignObject bugs entirely */

#card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;  /* Allow clicks through to SVG */
  overflow: visible;
}

#card-overlay > div {
  position: absolute;
  pointer-events: auto;  /* Re-enable clicks on card containers */
}

/* ===== CARD GROUP SYSTEM ===== */

.card-group {
  position: relative;  /* Inside positioned wrapper */
  background: white;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  font-family: var(--font);
  width: 100%;  /* Fill wrapper container (scaled width) */
}

/* Card group header - always visible */
.card-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  /* Safari foreignObject: transitions trigger positioning bug */
}

.card-group__header:hover {
  background: #F9FAFB;
}

.card-group__title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: #1F2937;
}

.card-group__count {
  font-size: var(--text-xs);
  font-weight: 500;
  color: #4B5563;
  margin-left: 8px;
}

.card-group__count--has-items {
  color: #4B5563;
}

/* Chevron icon - plain unicode, no Font Awesome */
/* Safari foreignObject fix: Font Awesome removed - may use transforms internally */
.card-group__chevron {
  font-size: var(--text-xs);
  color: #6B7280;
  line-height: 1;
}

/* Card group content - collapsible */
.card-group__content {
  display: none;
  border-top: 1px solid #F3F4F6;
}

.card-group--expanded .card-group__content {
  display: block;
}

.card-group--expanded .card-group__empty {
  display: none;
}

/* Empty phase hint */
.card-group__empty {
  padding: 12px 14px;
  border-top: 1px solid #F3F4F6;
  cursor: pointer;
}

.card-group__empty:hover .card-group__empty-text {
  color: #6B7280;
}

.card-group__empty-text {
  font-size: var(--text-sm);
  color: #9CA3AF;
  font-style: italic;
}

/* Demo mode: locked side overlay */
.card-group--demo-locked {
  position: relative;
}

.card-group--demo-locked::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(107, 114, 128, 0.15);
  border-radius: 12px;
  pointer-events: none;
  z-index: 10;
}

.card-group--demo-locked .card-group__header,
.card-group--demo-locked .card-group__content,
.card-group--demo-locked .card-group__preview {
  pointer-events: none;
  cursor: not-allowed;
}

.card-group__locked-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: #F3F4F6;
  border-top: 1px solid #E5E7EB;
  font-size: var(--text-xs);
  font-weight: 500;
  color: #6B7280;
}

.card-group__locked-badge i {
  font-size: 12px;
  color: #9CA3AF;
}

/* Card list */
.card-group__list {
  max-height: 300px;
  overflow-y: auto;
}

/* ===== INDIVIDUAL CARD ITEMS ===== */

.card-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: #374151;
  transition: background 0.1s;
  border-bottom: 1px solid #F3F4F6;
}

.card-item:last-child {
  border-bottom: none;
}

.card-item--clickable {
  cursor: pointer;
  user-select: none;
}

.card-item--clickable:hover {
  background: #F3F4F6;
}

.card-item--clickable:active {
  background: #E5E7EB;
}

.card-item:hover {
  background: #F9FAFB;
}

/* Safari foreignObject fix: opacity removed - creates compositing layer that breaks positioning */
.card-item--done {
  color: #9CA3AF;
}

.card-item--done .card-item__text {
  text-decoration: line-through;
  color: #9CA3AF;
}

.card-item--done .card-item__checkbox::before {
  border-color: #D1D5DB;
}

.card-item__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.card-item__text {
  word-break: break-word;
  text-align: left;
}

/* Task checkbox - 28px target, 20px visual */
/* Safari foreignObject bug: position:relative breaks positioning.
   Checkbox uses background-image for checkmark instead of ::after */
.card-item__checkbox {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-item__checkbox::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #D1D5DB;
  border-radius: 4px;
  background: white;
  /* Safari foreignObject fix: explicit properties instead of 'all' to avoid compositing */
  transition: border-color 0.15s, background 0.15s;
}

.card-item__checkbox:hover::before {
  border-color: #4B5563;
}

.card-item__checkbox:focus-visible {
  outline: 2px solid var(--phase-1);
  outline-offset: 2px;
  border-radius: 6px;
}

.card-item__checkbox--checked::before {
  background: var(--phase-5) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") center/14px no-repeat;
  border-color: var(--phase-5);
}

/* Disabled state for cards user can't interact with */
.card-item__checkbox--disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.card-item__checkbox--disabled::before {
  border-color: #E5E7EB;
  background: #F9FAFB;
}

.card-item__checkbox--disabled:hover::before {
  border-color: #E5E7EB;
}

.card-item--disabled {
  opacity: 0.6;
}

.card-item--disabled .card-item__content {
  cursor: not-allowed;
}

.card-item--disabled .card-item__actions {
  display: none;
}

/* ===== APPROVAL CARD TYPE ===== */

.card-item--approval {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.card-item__approval-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.card-item__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card-item__status--pending {
  background: #FEF3C7;
  color: #92400E;
}

.card-item__status--approved {
  background: #E8EDDF;
  color: #3D4F37;
}

.card-item__status--rejected {
  background: #FEE2E2;
  color: #991B1B;
}

.card-item__approval-btns {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.card-item__approval-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Safari foreignObject fix: explicit properties instead of 'all' to avoid compositing */
  transition: background 0.15s;
}

.card-item__approval-btn svg {
  width: 16px;
  height: 16px;
}

.card-item__approval-btn i {
  font-size: var(--text-sm);
}

.card-item__approval-btn--approve {
  background: #E8EDDF;
  color: #3D4F37;
}

.card-item__approval-btn--approve:hover {
  background: #C2CEAC;
}

.card-item__approval-btn--reject {
  background: #FEE2E2;
  color: #991B1B;
}

.card-item__approval-btn--reject:hover {
  background: #FECACA;
}

.card-item__approval-btn:focus-visible {
  outline: 2px solid #374151;
  outline-offset: 2px;
}

/* Approval state classes */
/* Safari foreignObject fix: opacity removed - use muted colors instead */
.card-item--approval-waiting {
  color: #9CA3AF;
}

.card-item--approval-done {
  color: #6B7280;
}

.card-item__status--waiting {
  background: #F3F4F6;
  color: #4B5563;
}

/* Rejection reason display */
.card-item__rejection-reason {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 10px;
  background: #FEF2F2;
  border-radius: 6px;
  font-size: var(--text-xs);
  color: #991B1B;
  line-height: 1.4;
}

.card-item__rejection-reason i {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Resubmit note (what changed) */
.card-item__resubmit-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 10px;
  background: #F5F5F4;
  border-radius: 6px;
  font-size: var(--text-xs);
  color: #1C1917;
  line-height: 1.4;
}

.card-item__resubmit-note i {
  flex-shrink: 0;
  margin-top: 1px;
}

/* From label (who asked) */
.card-item__from {
  display: block;
  font-size: var(--text-xs);
  color: #6B7280;
  margin-top: 2px;
}

/* ===== LINK CARD TYPE ===== */

.card-item--link {
  cursor: pointer;
}

.card-item__url {
  font-size: var(--text-xs);
  color: #4B5563;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-item__url a {
  color: var(--phase-1);
  text-decoration: none;
}

.card-item__url a:hover {
  text-decoration: underline;
}

/* URL Attachment (shows on any card type with url) */
.card-item__url-attachment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--phase-1);
  text-decoration: none;
  margin-top: 4px;
  padding: 2px 6px;
  background: rgba(41, 37, 36, 0.08);
  border-radius: 4px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-item__url-attachment i {
  font-size: 10px;
  flex-shrink: 0;
}

.card-item__url-attachment:hover {
  background: rgba(41, 37, 36, 0.15);
  text-decoration: underline;
}

/* Safari foreignObject fix: opacity removed - use muted colors instead */
.card-item--done .card-item__url-attachment {
  color: #9CA3AF;
}

/* ===== PING-PONG COLLABORATIVE TASK ===== */

.card-item--pingpong {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  /* Removed max-height: 180px and overflow: hidden - was clipping card content */
}

/* Safari foreignObject fix: opacity removed - use muted colors instead */
.card-item--pingpong.card-item--pingpong-waiting {
  color: #9CA3AF;
}

.card-item--pingpong.card-item--pingpong-done {
  color: #9CA3AF;
}

.card-item__pingpong-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
}

.card-item__pingpong-header .card-item__text {
  flex: 1;
  padding-top: 2px;
}

.card-item__pingpong-bounces {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: #4B5563;
  background: #F3F4F6;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: auto;
}

.card-item__pingpong-status {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  align-self: flex-start;
}

.card-item__pingpong-status--waiting {
  color: #4B5563;
  background: #F3F4F6;
}

.card-item__pingpong-status--done {
  color: var(--phase-5);
  background: #E8EDDF;
}

.card-item__pingpong-text {
  flex: 1;
  min-height: 36px;
  max-height: 54px;
  padding: 6px 8px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
  background: #FAFBFC;
  color: #1F2937;
}

.card-item__pingpong-text:focus {
  outline: none;
  border-color: var(--phase-1);
  background: white;
}

.card-item__pingpong-text::placeholder {
  color: #6B7280;
}

.card-item__pingpong-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
  margin-top: 4px;
}

.card-item__pingpong-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 6px;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  /* Safari foreignObject fix: explicit properties instead of 'all' to avoid compositing */
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-item__pingpong-btn svg {
  width: 14px;
  height: 14px;
}

.card-item__pingpong-btn i {
  font-size: var(--text-xs);
}

.card-item__pingpong-btn--transfer {
  color: white;
  background: var(--phase-3);
}

.card-item__pingpong-btn--transfer:hover {
  background: #EA580C;
}

.card-item__pingpong-btn--done {
  color: white;
  background: var(--phase-5);
}

.card-item__pingpong-btn--done:hover {
  background: #5A7A4E;
  color: white;
}

.card-item__pingpong-btn--link {
  color: #6B7280;
  background: #F3F4F6;
}

.card-item__pingpong-btn--link:hover {
  background: #E5E7EB;
}

.card-item__pingpong-btn--link.card-item__pingpong-btn--has-url {
  color: var(--phase-1);
}

.card-item__pingpong-btn--delete {
  color: #6B7280;
  background: #F3F4F6;
}

.card-item__pingpong-btn--delete:hover {
  color: #DC2626;
  background: #FEE2E2;
}

/* Ping-pong collab card styles */
.card-item__pingpong-toprow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-item__pingpong-spacer {
  flex: 1;
}

.card-item__pingpong-workspace {
  max-height: 100px;
  overflow-y: auto;
  padding: 10px 12px;
  background: #F9FAFB;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
}

.card-item__pingpong-message {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: #374151;
  margin-bottom: 6px;
}

.card-item__pingpong-message:last-child {
  margin-bottom: 0;
}

.card-item__pingpong-message strong {
  color: #1F2937;
}

.card-item__pingpong-input-row {
  margin: 4px 0;
}

.card-item__pingpong-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: 1.5;
  background: white;
  color: #1F2937;
  resize: none;
  min-height: 50px;
}

.card-item__pingpong-input:focus {
  outline: none;
  border-color: var(--phase-1);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.card-item__pingpong-input::placeholder {
  color: #9CA3AF;
}

/* Woosh animation for ping-pong transfer */
/* Safari foreignObject fix: transform/opacity animations removed - break positioning */
/* Woosh animations disabled for Safari compatibility */
.card-item--woosh-out {
  /* Animation removed - instant removal instead */
  display: none;
}

/* New card highlight animation */
@keyframes cardAdded {
  0% {
    background: #FEF3C7;
    box-shadow: 0 0 0 2px #F59E0B;
  }
  100% {
    background: white;
    box-shadow: none;
  }
}

.card-item--just-added {
  animation: cardAdded 0.8s ease-out forwards;
}

/* ===== CALL CARD TYPE ===== */

.card-item--call {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px;
}

/* Safari foreignObject fix: opacity removed - use muted colors instead */
.card-item--call.card-item--call-waiting {
  color: #9CA3AF;
}

.card-item--call.card-item--call-done {
  color: #9CA3AF;
}

.card-item__call-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.card-item__call-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.card-item__call-status--waiting {
  background: #FEF3C7;
  color: #92400E;
}

.card-item__call-status--done {
  background: #E8EDDF;
  color: #3D4F37;
}

.card-item__call-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 10px;
  background: #F4F6F0;
  color: #4B6043;
  border-radius: 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.card-item__call-phone:hover {
  background: #E8EDDF;
}

.card-item__call-phone i {
  font-size: 10px;
}

.card-item__call-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  margin-left: 6px;
  padding: 4px 10px;
  background: #F3F4F6;
  color: #4B5563;
  border-radius: 6px;
  font-size: var(--text-xs);
}

.card-item__call-note i {
  font-size: 10px;
}

/* ===== MEETING CARD TYPE ===== */

.card-item--meeting {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px;
}

/* Safari foreignObject fix: opacity removed - use muted colors instead */
.card-item--meeting.card-item--meeting-waiting {
  color: #9CA3AF;
}

.card-item--meeting.card-item--meeting-done {
  color: #9CA3AF;
}

.card-item__meeting-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.card-item__meeting-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.card-item__meeting-status--waiting {
  background: #FEF3C7;
  color: #92400E;
}

.card-item__meeting-status--done {
  background: #E8EDDF;
  color: #3D4F37;
}

/* Meeting today highlight - override waiting opacity */
.card-item--meeting.card-item--meeting-today {
  opacity: 1 !important;
  border: 2px solid #F97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
  background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
}

.card-item__meeting-today-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #F97316;
  color: white;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  /* Safari foreignObject fix: animation removed - causes badge to jump to SVG origin */
}

/* Call today highlight */
.card-item--call.card-item--call-today {
  opacity: 1 !important;
  border: 2px solid #F97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
  background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
}

.card-item__call-today-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #F97316;
  color: white;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  /* Safari foreignObject fix: animation removed - causes badge to jump to SVG origin */
}

.card-item__meeting-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 10px;
  background: #F5F5F4;
  color: #292524;
  border-radius: 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.card-item__meeting-link:hover {
  background: #E7E5E4;
}

.card-item__meeting-link i {
  font-size: 10px;
}

.card-item__calendar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 5px 10px;
  background: #F4F6F0;
  border: 1px solid #C2CEAC;
  border-radius: 6px;
  color: #4B6043;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.card-item__calendar-btn:hover {
  background: #E8EDDF;
  border-color: #94AE82;
}

.card-item__calendar-btn i {
  font-size: 12px;
}

.card-item__meeting-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  margin-left: 6px;
  padding: 4px 10px;
  background: #F3F4F6;
  color: #4B5563;
  border-radius: 6px;
  font-size: var(--text-xs);
}

.card-item__meeting-date i {
  font-size: 10px;
}

/* Meeting scheduling status badges */
.card-item__scheduling-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.card-item__scheduling-status--proposed {
  background: #FEF3C7;
  color: #92400E;
}

.card-item__scheduling-status--confirmed {
  background: #E8EDDF;
  color: #3D4F37;
}

.card-item__scheduling-status--declined {
  background: #FEE2E2;
  color: #991B1B;
}

.card-item__scheduling-status--cancelled {
  background: #F3F4F6;
  color: #4B5563;
}

.card-item__scheduling-status--completed {
  background: #E8EDDF;
  color: #3D4F37;
}

/* Three-button scheduling actions */
.card-item__scheduling-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.card-item__scheduling-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  /* Safari foreignObject fix: explicit properties instead of 'all' to avoid compositing */
  transition: background 0.15s;
  white-space: nowrap;
}

.card-item__scheduling-btn i {
  font-size: 10px;
}

.card-item__scheduling-btn--confirm {
  background: #6B8F5E;
  color: white;
}

.card-item__scheduling-btn--confirm:hover {
  background: #5A7A4E;
}

.card-item__scheduling-btn--suggest {
  background: #F59E0B;
  color: white;
}

.card-item__scheduling-btn--suggest:hover {
  background: #D97706;
}

.card-item__scheduling-btn--decline {
  background: #EF4444;
  color: white;
}

.card-item__scheduling-btn--decline:hover {
  background: #DC2626;
}

.card-item__scheduling-btn--cancel {
  background: #6B7280;
  color: white;
}

.card-item__scheduling-btn--cancel:hover {
  background: #4B5563;
}

.card-item__scheduling-btn--complete {
  background: #8B5CF6;
  color: white;
}

.card-item__scheduling-btn--complete:hover {
  background: #7C3AED;
}

/* Datetime display prominent */
.card-item__datetime {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #F4F6F0;
  border: 1px solid #C2CEAC;
  border-radius: 6px;
  margin-top: 8px;
}

.card-item__datetime i {
  color: #5A7A4E;
  font-size: 14px;
}

.card-item__datetime-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: #166534;
}

/* ===== STICKY NOTE COLUMNS ===== */

/* Safari foreignObject fix: transforms removed - create stacking context that breaks positioning */
.note-group {
  background: #FEF9C3;
  border-radius: 2px;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  -webkit-mask-image: -webkit-radial-gradient(white, black); /* Safari border-radius fix */
}

.note-group:nth-child(even) {
  /* transform removed for Safari */
}

/* Safari foreignObject fix: NO position:absolute inside foreignObject!
   Use flexbox for delete button positioning instead */
.note-item {
  padding: 8px 10px;
  background: #FFFBEB;
  border-radius: 2px;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: #713F12;
  word-wrap: break-word;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
}

.note-item__text {
  flex: 1;
}

/* Safari foreignObject fix: opacity removed - use transparent colors instead */
.note-item__delete {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}

.note-item__delete svg {
  stroke: transparent;
  transition: stroke 0.15s;
}

.note-item:hover .note-item__delete svg {
  stroke: rgba(146, 64, 14, 0.5);
}

.note-item__delete:hover {
  background: #FEF9C3;
}

.note-item__delete:hover svg {
  stroke: #92400E;
}

.note-item__delete svg.note-svg {
  width: 12px;
  height: 12px;
  /* stroke color controlled by parent hover states above */
}

/* Note column header */
.header-pill--notes {
  fill: #EAB308;
}

.header-text--notes {
  fill: #713F12;
}

/* Clickable notes header */
.header-group--notes {
  cursor: pointer;
}

.header-group--notes:hover .header-pill--notes {
  fill: #CA8A04;
}

.header-group--notes:focus-visible {
  outline: none;
}

.header-group--notes:focus-visible .header-pill--notes {
  stroke: #713F12;
  stroke-width: 3;
}

/* Hidden notes toggle - hover and focus states */
.header-group--hidden.header-group--notes:hover .header-pill--notes {
  fill: #6B7280;
}

.header-group--hidden.header-group--notes:focus-visible .header-pill--notes {
  stroke: #374151;
  stroke-width: 3;
}

/* Notes eye icon - Font Awesome */
.notes-eye-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.notes-eye-wrapper i {
  color: #713F12;
  font-size: var(--text-sm);
  line-height: 1;
}

.notes-eye-wrapper .eye-closed {
  display: none;
}

/* Hidden state - show closed eye, change color */
.header-group--hidden .notes-eye-wrapper i {
  color: #4B5563;
}

.header-group--hidden .notes-eye-wrapper .eye-open {
  display: none;
}

.header-group--hidden .notes-eye-wrapper .eye-closed {
  display: flex;
}

.notes-wrapper {
  width: 100%;
}

/* Notes pad - uses HTML overlay like cards for proper alignment */
.notes-pad {
  background: #FEF9C3;
  border-radius: 6px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  width: 100%;  /* Fill wrapper container (480px) */
  -webkit-mask-image: -webkit-radial-gradient(white, black); /* Safari border-radius fix */
}

.notes-pad__header {
  background: #F59E0B;
  padding: 8px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: #1F2937;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notes-textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: #713F12;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
}

.notes-textarea::placeholder {
  color: #A16207;
  font-style: italic;
}

.notes-textarea:focus {
  box-shadow: inset 0 0 0 2px #D97706;
}

.notes-pad--locked {
  opacity: 0.5;
}

.notes-pad--locked .notes-textarea {
  cursor: not-allowed;
}

/* Hidden notes column state */
.header-group--hidden .header-pill--notes {
  fill: #D1D5DB;
}

.header-group--hidden .header-text--notes {
  fill: #4B5563;
}

.notes-column--hidden {
  display: none;
}

/* Delete button - Safari foreignObject fix: use color transparency instead of opacity */
.card-item__delete {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  transition: color 0.15s;
}

.card-item__delete svg {
  width: 14px;
  height: 14px;
  stroke: transparent;
  transition: stroke 0.15s;
}

.card-item__delete i {
  color: transparent;
  transition: color 0.15s;
}

.card-item:hover .card-item__delete svg {
  stroke: rgba(220, 38, 38, 0.4);
}

.card-item:hover .card-item__delete i {
  color: rgba(220, 38, 38, 0.4);
}

.card-item__delete:hover svg {
  stroke: #DC2626;
}

.card-item__delete:hover i {
  color: #DC2626;
}

.card-item__delete:focus-visible {
  outline: 2px solid #DC2626;
  outline-offset: 2px;
}

.card-item__delete:focus-visible svg {
  stroke: #DC2626;
}

.card-item__delete:focus-visible i {
  font-size: var(--text-sm);
  color: #DC2626;
}

/* Link button - add/edit URL */
/* Safari foreignObject fix: use color transparency instead of opacity */
.card-item__link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}

.card-item__link-btn i {
  font-size: 12px;
  color: transparent;
  transition: color 0.15s;
}

.card-item:hover .card-item__link-btn i {
  color: rgba(107, 114, 128, 0.4);
}

.card-item__link-btn:hover {
  background: #F3F4F6;
}

.card-item__link-btn:hover i {
  color: #6B7280;
}

.card-item__link-btn:focus-visible {
  outline: 2px solid #292524;
  outline-offset: 2px;
}

.card-item__link-btn:focus-visible i {
  color: #292524;
}

/* When card has URL, show link button as active */
.card-item__link-btn--has-url i {
  color: rgba(41, 37, 36, 0.6);
}

.card-item:hover .card-item__link-btn--has-url i {
  color: #292524;
}

/* Actions row for task cards */
.card-item__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

/* ===== QUICK ADD SECTION ===== */

.card-group__add {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #F3F4F6;
  background: #FAFBFC;
}

.card-group__add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-group__input {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: var(--text-sm);
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
}

.card-group__input:focus {
  border-color: #4B5563;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.2);
}

.card-group__input::placeholder {
  color: #4B5563;
}

/* Character counter near limit */
/* Safari foreignObject fix: NO position:absolute inside foreignObject!
   Uses flex ordering and margin instead */
.char-counter {
  display: none;
  width: 100%;
  text-align: right;
  font-size: 11px;
  color: #9CA3AF;
  padding-right: 4px;
  margin-top: -4px;
}
.char-counter.visible {
  display: block;
}
.char-counter.warning {
  color: #F59E0B;
}
.char-counter.danger {
  color: #EF4444;
}

/* Extra fields for call/meeting */
.card-group__extra-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed #E5E7EB;
  margin-top: 2px;
}

.card-group__extra-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-group__extra-row label {
  font-size: var(--text-xs);
  color: #6B7280;
  min-width: 50px;
}

.card-group__extra-row input {
  flex: 1;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: var(--text-xs);
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  outline: none;
}

.card-group__extra-row input:focus {
  border-color: #4B5563;
  box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.15);
}

.card-group__extra-row input[type="datetime-local"] {
  min-width: 180px;
}

.card-group__extra-row input[type="tel"] {
  min-width: 120px;
}

.card-group__extra-row input[type="url"] {
  min-width: 200px;
}

.card-group__send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: 600;
  color: white;
  background: var(--phase-3);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-group__send-btn:hover {
  background: #EA580C;
}

.card-group__send-btn i {
  font-size: var(--text-xs);
}

/* Flash animation for validation error */
@keyframes flashError {
  0%, 100% { border-color: #E5E7EB; }
  50% { border-color: #EF4444; box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2); }
}

.flash-error {
  animation: flashError 0.25s ease 2;
}

/* Type toggle buttons - larger and clearer with labels */
.card-group__type-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.card-group__type-btn {
  height: 28px;
  padding: 0 8px;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: #6B7280;
  white-space: nowrap;
  /* Safari foreignObject: transitions trigger positioning bug */
}

.card-group__type-btn:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
  color: #374151;
}

.card-group__type-btn--active {
  background: #F5F5F4;
  border-color: var(--phase-1);
  color: var(--phase-1);
}

.card-group__type-btn:focus-visible {
  outline: 2px solid var(--phase-1);
  outline-offset: 2px;
}

.card-group__type-btn i {
  font-size: 12px;
}

.card-group__type-btn--active i {
  color: var(--phase-1);
}

/* Show full label - make type buttons more discoverable */
.card-group__type-btn-label {
  display: inline;
}

/* Preview section (always visible, shows 3 pending items) */
.card-group__preview {
  border-top: 1px solid #F3F4F6;
}

/* "Show more" link */
.card-group__more {
  padding: 8px 14px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--phase-1);
  cursor: pointer;
  text-align: center;
  /* Safari foreignObject: transitions trigger positioning bug */
}

.card-group__more:hover {
  background: #F5F5F4;
}

/* Visually hidden but accessible to screen readers */
.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;
}

/* Skip link - visible only on focus */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--phase-1);
  outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
  /* Hide UI chrome - keep only the roadmap content */
  .header__actions,
  .version-dropdown,
  .activity-dropdown,
  .footer,
  .toast,
  .skip-link,
  .modal,
  .confetti-container,
  .celebration-backdrop,
  #mobileView,
  #testRunner,
  [data-testid] {
    display: none !important;
  }

  /* Hide interactive elements inside SVG foreignObject */
  .card-input,
  .card-item__delete,
  .milestone--add {
    display: none !important;
  }

  /* Page setup */
  @page {
    size: landscape;
    margin: 0.5in;
  }

  body {
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* SVG roadmap: fit to page width */
  .snake-container {
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .snake-svg {
    width: 100%;
    height: auto;
  }
}

/* Legal Modal - larger, scrollable for long documents */
.legal-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: 300;
  padding: 20px;
}

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

.legal-modal__content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

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

.legal-modal__title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: #1F2937;
  margin: 0;
}

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

.legal-modal__close:hover {
  background: #F3F4F6;
  color: #1F2937;
}

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

.legal-modal__body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.7;
  color: #374151;
}

.legal-modal__body h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 16px 0;
}

.legal-modal__body h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: #1F2937;
  margin: 24px 0 12px 0;
  padding-top: 16px;
  border-top: 1px solid #E5E7EB;
}

.legal-modal__body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.legal-modal__body h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: #1F2937;
  margin: 20px 0 8px 0;
}

.legal-modal__body p {
  margin: 0 0 12px 0;
}

.legal-modal__body ul, .legal-modal__body ol {
  margin: 0 0 12px 0;
  padding-left: 24px;
}

.legal-modal__body li {
  margin-bottom: 4px;
}

.legal-modal__body pre {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 12px 0;
  font-family: ui-monospace, monospace;
  font-size: var(--text-sm);
  white-space: pre-wrap;
  color: #1F2937;
}

.legal-modal__body a {
  color: var(--phase-1);
  text-decoration: none;
}

.legal-modal__body a:hover {
  text-decoration: underline;
}

.legal-modal__body strong {
  font-weight: 600;
  color: #1F2937;
}

.legal-modal__body hr {
  border: none;
  border-top: 1px solid #E5E7EB;
  margin: 24px 0;
}

.legal-modal__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: var(--text-sm);
}

.legal-modal__body th, .legal-modal__body td {
  border: 1px solid #E5E7EB;
  padding: 8px 12px;
  text-align: left;
}

.legal-modal__body th {
  background: #F9FAFB;
  font-weight: 600;
  color: #1F2937;
}

.legal-modal__body em {
  font-style: italic;
  color: #6B7280;
}

.legal-modal__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #6B7280;
}

@media (max-width: 600px) {
  .legal-modal {
    padding: 10px;
  }

  .legal-modal__content {
    max-height: 90vh;
  }

  .legal-modal__header {
    padding: 16px;
  }

  .legal-modal__body {
    padding: 16px;
  }

  .legal-modal__body table {
    font-size: 12px;
  }

  .legal-modal__body th, .legal-modal__body td {
    padding: 6px 8px;
  }
}

/* Keyboard Shortcuts Modal */
.shortcuts-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: 300;
  padding: 20px;
}

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

.shortcuts-modal__content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.shortcuts-modal__title {
  font-size: 16px;
  font-weight: 600;
  color: #1F2937;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shortcuts-modal__title i {
  color: #6B7280;
}

.shortcuts-modal__close {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  padding: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.shortcuts-modal__close:hover {
  background: #F3F4F6;
  color: #1F2937;
}

.shortcuts-modal__body {
  padding: 16px 20px;
}

.shortcuts-modal__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shortcuts-modal__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shortcuts-modal__action {
  font-size: 14px;
  color: #374151;
}

.shortcuts-modal__keys {
  display: flex;
  gap: 4px;
}

.shortcuts-modal__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: #F3F4F6;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  font-family: ui-monospace, monospace;
}

.shortcuts-modal__section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #E5E7EB;
}

.shortcuts-modal__section-title {
  font-size: 12px;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.shortcuts-modal__footer {
  padding: 12px 20px;
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
  border-radius: 0 0 12px 12px;
  font-size: 12px;
  color: #6B7280;
  text-align: center;
}

.shortcuts-modal__footer kbd {
  background: #E5E7EB;
  border-radius: 3px;
  padding: 2px 5px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}
