  /* ── Reset & Base ─────────────────────────── */
  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
  * { touch-action: manipulation; }

  /* ── Reduced Motion Support ──────────────────── */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
  
  :root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.08);
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #6a6a8a;
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.12);
    --red: #ff4466;
    --red-bg: rgba(255,68,102,0.1);
    --amber: #ffaa33;
    --amber-bg: rgba(255,170,51,0.1);
    --green: #33cc77;
    --green-bg: rgba(51,204,119,0.1);
    --blue: #4488ff;
    --blue-bg: rgba(68,136,255,0.1);
    --blue-15: rgba(68,136,255,0.15);
    --blue-20: rgba(68,136,255,0.20);
    --blue-06: rgba(68,136,255,0.06);
    --blue-08: rgba(68,136,255,0.08);
    --blue-12: rgba(68,136,255,0.12);
    --blue-14: rgba(68,136,255,0.14);
    --blue-30: rgba(68,136,255,0.3);
    --blue-40: rgba(68,136,255,0.4);
    --blue-shadow: rgba(68,136,255,0.12);
    --purple: #aa66ff;
    --purple-bg: rgba(170,102,255,0.1);
    --purple-15: rgba(170,102,255,0.15);
    --purple-25: rgba(170,102,255,0.25);
    --purple-08: rgba(170,102,255,0.08);
    --purple-14: rgba(170,102,255,0.14);
    --purple-18: rgba(170,102,255,0.18);
    --purple-30: rgba(170,102,255,0.3);
    --purple-10: rgba(170,102,255,0.10);
    --purple-03: rgba(170,102,255,0.03);
    /* Light purple variant (RGB 168, 130, 255) for drill buttons */
    --purple-light: #a882ff;
    --purple-light-25: rgba(168, 130, 255, 0.25);
    --purple-light-70: rgba(168, 130, 255, 0.7);
    --purple-light-12: rgba(168, 130, 255, 0.12);
    --purple-light-60: rgba(168, 130, 255, 0.6);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Transition timing */
    --transition-fast: 0.15s;
    --transition-normal: 0.3s;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* ── Skip Link (Accessibility) ───────────────── */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--blue);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10000;
    font-weight: 600;
    font-size: 14px;
  }
  .skip-link:focus {
    top: 0;
  }

  /* ── Enhanced Focus Indicators ───────────────── */
  :focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
  }
  button:focus-visible,
  a:focus-visible,
  [role="button"]:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
  }

  /* ── Background ──────────────────────────── */
  body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
      radial-gradient(ellipse at 20% 20%, var(--blue-08) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 80%, var(--purple-08) 0%, transparent 50%),
      radial-gradient(ellipse at 50% 50%, rgba(51,204,119,0.04) 0%, transparent 60%);
    z-index: 0;
    pointer-events: none;
  }

  /* ── Header ──────────────────────────────── */
  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10,10,26,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .header-left > * + * {
    margin-left: 0;
  }

  .header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
  }

  .header h1 .date {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 16px;
    margin-left: 8px;
  }

  .stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
  }

  @media (max-width: 768px) {
    .stats-bar {
      gap: 8px;
    }
  }

  .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    /* Prevent flex overflow */
    min-width: 0;
    flex-shrink: 1;
  }
  .stat-item span:first-child {
    /* Text overflow protection for stat labels */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stat-value {
    font-weight: 700;
    font-size: 16px;
  }

  .progress-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .progress-bar-bg {
    width: 120px;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
  }

  .progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--green), #33ddaa);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
  }

  .progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 36px;
  }

  /* ── Connection Status ────────────────────── */
  .conn-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
  }

  .refresh-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, border-color;
  }
  .refresh-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--blue);
    transform: scale(1.05);
  }
  .refresh-btn:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
  }
  .refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  .refresh-btn.spinning {
    animation: spin 0.8s linear infinite;
  }
  @keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  /* ── View Mode Toggle ───────────────────── */
  .view-mode-btn {
    background: var(--purple);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: 0.5px;
    will-change: transform, filter;
  }
  .view-mode-btn:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
  }
  .view-mode-btn:focus-visible {
    outline: 3px solid white;
    outline-offset: 2px;
  }
  .view-mode-btn:active {
    transform: scale(0.95);
  }

  .version-tag {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
  }

  .conn-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
    will-change: background, box-shadow;
  }

  .conn-dot.connected {
    background: var(--green);
    box-shadow: 0 0 8px rgba(51,204,119,0.5);
  }

  .conn-dot.connecting {
    background: var(--amber);
    animation: pulse 1.5s infinite;
  }

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

  /* ── Board ───────────────────────────────── */
  .board {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    padding: 24px 32px;
    min-height: calc(100vh - 80px);
  }

  /* ── Column ──────────────────────────────── */
  .column {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
  }

  .column:hover {
    border-color: var(--border-light);
  }

  .col-header {
    width: 100%;
    padding: 16px 18px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    background: transparent;
    border: none;
    font: inherit;
    color: inherit;
    text-align: left;
  }

  .col-header:hover {
    background: rgba(255,255,255,0.02);
  }
  .col-header:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: -2px;
  }

  .col-toggle {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform var(--transition-normal) ease;
    margin-right: 4px;
    will-change: transform;
  }

  .column.collapsed .col-toggle {
    transform: rotate(-90deg);
  }

  .column.collapsed .col-body {
    display: none;
  }

  .column.collapsed .col-header {
    border-bottom: none;
    padding-bottom: 16px;
  }

  .col-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .col-icon { font-size: 18px; }

  .col-count {
    background: rgba(255,255,255,0.08);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
  }

  .col-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .col-body::-webkit-scrollbar { width: 4px; }
  .col-body::-webkit-scrollbar-track { background: transparent; }
  .col-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

  /* Column color accents */
  .col-doing .col-header { border-top: 3px solid var(--amber); }
  .col-next .col-header { border-top: 3px solid var(--blue); }
  .col-todo .col-header { border-top: 3px solid var(--purple); }
  .col-done .col-header { border-top: 3px solid var(--green); }
  .col-hold .col-header { border-top: 3px solid var(--text-muted); }

  /* ── Card ────────────────────────────────── */
  .card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: default;
    transition: var(--transition);
    animation: cardIn 0.4s ease-out;
    position: relative;
    overflow: hidden;
    will-change: transform;
  }

  .card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    will-change: transform, box-shadow;
  }

  /* Priority left accent */
  .card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
  }

  .card.priority-urgent::before { background: var(--red); }
  .card.priority-important::before { background: var(--amber); }
  .card.priority-normal::before { background: var(--green); }

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

  .card-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
    padding-left: 6px;
    /* Text overflow protection */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* ── Tree Node Collapse Toggle ── */
  .collapse-toggle {
    background: none;
    border: 1px solid var(--blue-20);
    color: var(--blue-40);
    font-size: 10px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    will-change: transform, border-color, color;
    /* Ensure minimum touch target size */
    min-width: 44px;
    min-height: 44px;
  }
  .collapse-toggle:hover {
    background: var(--blue-10);
    color: var(--text-primary);
    border-color: var(--blue-40);
  }
  .collapse-toggle:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 1px;
  }

  .drill-btn {
    background: none;
    border: 1px solid var(--purple-light-25);
    color: var(--purple-light-70);
    font-size: 12px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    will-change: transform, border-color, color;
    /* Ensure minimum touch target size */
    min-width: 44px;
    min-height: 44px;
  }
  .drill-btn:hover {
    background: var(--purple-light-12);
    color: #fff;
    border-color: var(--purple-light-60);
    transform: translateY(1px);
  }
  .drill-btn:focus-visible {
    outline: 3px solid var(--purple);
    outline-offset: 1px;
  }

  .card-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-15);
    color: #88bbff;
    font-size: 12px;
    font-weight: 800;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 0px 5px;
    border-radius: 4px;
    margin-right: 6px;
    letter-spacing: 0.5px;
    vertical-align: middle;
    min-width: 18px;
    text-align: center;
  }

  .recurring-badge {
    font-size: 11px;
    margin-right: 3px;
    vertical-align: middle;
    opacity: 0.7;
  }
  .card.recurring {
    border-left: 3px solid rgba(168, 85, 247, 0.5);
  }

  .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  @media (min-width: 769px) {
    .card-meta {
      gap: 8px;
    }
  }

  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
  }

  .badge-priority-urgent { background: var(--red-bg); color: var(--red); }
  .badge-priority-important { background: var(--amber-bg); color: var(--amber); }
  .badge-priority-normal { background: var(--green-bg); color: var(--green); }
  .badge-category { background: var(--purple-bg); color: var(--purple); }
  .badge-time { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
  .badge-spent { background: var(--blue-15); color: #88bbff; }
  .badge-spent.over-budget { background: rgba(255,68,102,0.15); color: var(--red); }
  .badge-pomodoro { background: rgba(255,100,50,0.12); color: #ffaa66; font-size: 12px; letter-spacing: 1px; }
  .badge-pomodoro.over-budget { background: rgba(255,68,102,0.15); color: var(--red); }
  .pom-frac { font-size: 10px; opacity: 0.7; vertical-align: middle; }

  .card-notes {
    margin-top: 8px;
    padding-left: 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    border-left: 2px solid var(--border);
    white-space: pre-line;
    max-height: 4.5em;
    overflow: hidden;
    position: relative;
    transition: max-height 0.25s ease;
  }
  .card-notes.expanded {
    max-height: 800px;
  }
  .card-notes.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 28px;
    background: linear-gradient(transparent, var(--card-bg));
    pointer-events: none;
  }
  .card-notes-toggle {
    display: block;
    font-size: 11px;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0 0 6px;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
  }
  .card-notes-toggle:hover { opacity: 1; }

  /* ── Loading ─────────────────────────────── */
  .loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 1000;
    transition: opacity 0.5s;
  }

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

  .spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    will-change: transform;
  }

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

  .loading-text {
    font-size: 14px;
    color: var(--text-secondary);
  }

  /* ── Refresh Indicator ───────────────────── */
  .refresh-flash {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(51,204,119,0.15);
    border: 1px solid rgba(51,204,119,0.3);
    color: var(--green);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    z-index: 200;
    animation: fadeInOut 2s ease-in-out;
    pointer-events: none;
  }

  @keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    15% { opacity: 1; transform: translateY(0); }
    70% { opacity: 1; }
    100% { opacity: 0; }
  }

  /* ── Update Banner (top center) ────────── */
  .update-banner {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(135deg, var(--blue-20), var(--blue-08));
    border: 1px solid var(--blue-30);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 10px 28px 12px;
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(12px);
    animation: bannerSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  }

  .update-banner.leaving {
    animation: bannerSlideOut var(--transition-normal) ease-in forwards;
  }

  .update-banner .banner-icon {
    font-size: 18px;
    animation: bannerSpin 1s ease-in-out;
  }

  .update-banner .banner-text {
    color: #aaccff;
    font-size: 13px;
    font-weight: 500;
  }

  .update-banner .banner-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: #4488ff;
    border-radius: 0 0 12px 12px;
    animation: bannerProgress 3s linear forwards;
  }

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

  @keyframes bannerSlideOut {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to   { transform: translateX(-50%) translateY(-100%); opacity: 0; }
  }

  @keyframes bannerProgress {
    from { width: 100%; }
    to   { width: 0%; }
  }

  @keyframes bannerSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  /* ── Card Update Animations ─────────────── */
  .card.fade-out {
    animation: cardFadeOut 0.25s ease-in forwards;
  }

  .card.fade-in {
    animation: cardFadeIn 0.35s ease-out forwards;
  }

  @keyframes cardFadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.95); }
  }

  @keyframes cardFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
  }

  .card.highlight {
    animation: cardHighlight 0.6s ease-out;
  }

  /* ── Smart Render animations ── */
  .card.card-slide-in {
    animation: cardSlideIn 0.35s ease-out;
  }

  .card.card-highlight {
    animation: cardSmartHighlight 0.6s ease-out;
  }

  @keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes cardSmartHighlight {
    0%   { box-shadow: 0 0 0 2px var(--blue-40); }
    50%  { box-shadow: 0 0 16px 4px var(--blue-20); }
    100% { box-shadow: none; }
  }

  @keyframes cardHighlight {
    0%   { box-shadow: 0 0 0 0 var(--blue-40); }
    50%  { box-shadow: 0 0 12px 4px var(--blue-20); }
    100% { box-shadow: none; }
  }

  .highlight-pulse {
    animation: highlightPulse 2s ease-out;
  }
  @keyframes highlightPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 200, 60, 0.8); transform: scale(1); }
    30%  { box-shadow: 0 0 20px 6px rgba(255, 200, 60, 0.4); transform: scale(1.02); }
    100% { box-shadow: none; transform: scale(1); }
  }

  /* ── Column Ripple on Update ────────────── */
  .column.ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--blue-06) 0%, transparent 70%);
    animation: colRipple 0.8s ease-out;
    pointer-events: none;
    z-index: 5;
  }

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

  /* ── Responsive ──────────────────────────── */
  @media (max-width: 1200px) {
    .board { grid-template-columns: repeat(3, 1fr); padding: 16px; }
    .header { padding: 12px 16px; flex-wrap: wrap; }
  }

  @media (max-width: 900px) {
    .board { grid-template-columns: repeat(2, 1fr); }
    .header h1 { font-size: 18px; }
    .stats-bar { flex-wrap: wrap; gap: 8px; }
  }

  @media (max-width: 600px) {
    .board { grid-template-columns: 1fr; }
    .header h1 { font-size: 16px; }
    .progress-bar-bg { width: 80px; }
  }

  /* ── Error State ─────────────────────────── */
  .error-banner {
    background: var(--red-bg);
    border: 1px solid rgba(255,68,102,0.2);
    color: var(--red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 16px 32px;
    font-size: 14px;
    display: none;
    /* Text overflow protection for error messages */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  .error-banner.show {
    display: block;
    animation: errorSlideIn var(--transition-normal) ease-out;
  }
  @keyframes errorSlideIn {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* ── Calendar Widget ───────────────────────── */
  .date-picker-wrapper {
    position: relative;
    display: inline-block;
  }

  .date-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    font: inherit;
    color: inherit;
    text-align: left;
  }
  .date-label:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
  }

  .date-label:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
  }

  .date-label .calendar-icon {
    font-size: 16px;
  }

  .date-label .date-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
  }

  .date-label .history-badge {
    font-size: 10px;
    background: rgba(255,170,51,0.15);
    color: var(--amber);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
  }

  .calendar-widget {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-width: 280px;
    box-shadow: var(--shadow);
    z-index: 200;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
  }

  .calendar-widget.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
  }

  .calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  .calendar-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
  }

  .calendar-nav-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
  }

  .calendar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }

  .calendar-day-name {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 4px 0;
    text-transform: uppercase;
  }

  .calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
    position: relative;
    will-change: background, color, transform;
  }

  .calendar-day:hover {
    background: var(--bg-card);
  }

  .calendar-day.empty {
    cursor: default;
  }

  .calendar-day.empty:hover {
    background: transparent;
  }

  .calendar-day.today {
    background: var(--blue-15);
    color: var(--blue);
    font-weight: 700;
  }

  .calendar-day.selected {
    background: var(--blue);
    color: white;
    font-weight: 700;
  }

  .calendar-day.has-tasks::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--green);
  }

  .calendar-day.today.has-tasks::after {
    background: var(--blue);
  }

  .calendar-day.selected.has-tasks::after {
    background: white;
  }

  .calendar-footer {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
  }

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

  .calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .calendar-legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }

  .calendar-legend-dot.today {
    background: var(--blue);
  }

  .calendar-legend-dot.has-tasks {
    background: var(--green);
  }

  /* ── Breadcrumb Navigation ────────────────── */
  .breadcrumb-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
  }

  .breadcrumb-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    border: none;
    font: inherit;
    text-align: left;
  }

  .breadcrumb-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    will-change: transform, box-shadow;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  .breadcrumb-item:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
  }

  .breadcrumb-item.root {
    background: var(--blue-bg);
    color: var(--blue);
  }

  .breadcrumb-item.project {
    background: var(--purple-bg);
    color: var(--purple);
  }

  .breadcrumb-item.package {
    background: var(--blue-bg);
    color: var(--blue);
  }

  .breadcrumb-icon {
    font-size: 14px;
  }

  .breadcrumb-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    /* Enhanced text overflow protection */
    min-width: 0;
    flex-shrink: 1;
  }

  .breadcrumb-item {
    min-width: 0;
  }

  .breadcrumb-separator {
    color: var(--text-muted);
    font-size: 12px;
  }

  .breadcrumb-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
  }

  .breadcrumb-back-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
  }
  /* ── Hierarchy Card Styles ─────────────────── */
  /* 默认：所有卡片统一样式，层级仅通过 badge 体现 */
  /* 有父子关系的卡片（depth>0）通过缩进体现层级 */

  /* 可下钻的卡片（Project / Package）有双击交互 — 始终有效 */
  .card.hierarchy-project,
  .card.hierarchy-package {
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .card.hierarchy-project:hover,
  .card.hierarchy-package:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  }

  /* 层级视觉区分 — 通过缩进卡片中的父节点样式 */
  /* depth=0 的 Project 在列顶部，粗框辉光 */
  .card.hierarchy-project {
    border-left: 5px solid var(--purple);
    background: linear-gradient(135deg, var(--purple-08) 0%, rgba(255,255,255,0.02) 100%);
    padding: 12px 14px;
    margin-bottom: 8px;
    box-shadow: 0 0 12px var(--purple-10), inset 0 0 20px var(--purple-03);
  }
  .card.hierarchy-project .card-name {
    font-size: 14px;
    font-weight: 700;
  }
  .card.hierarchy-project .card-id {
    background: var(--purple-25);
    color: #d4b3ff;
    font-weight: 800;
  }
  .card.hierarchy-project:hover {
    border-left-color: var(--purple);
    background: linear-gradient(135deg, var(--purple-14) 0%, rgba(255,255,255,0.03) 100%);
    box-shadow: 0 0 20px var(--purple-18), 0 8px 24px rgba(0,0,0,0.4);
  }

  .card.hierarchy-package {
    border-left: 4px solid var(--blue);
    background: linear-gradient(135deg, var(--blue-06) 0%, rgba(255,255,255,0.02) 100%);
    padding: 10px 14px;
    margin-bottom: 6px;
  }
  .card.hierarchy-package .card-name {
    font-size: 13px;
    font-weight: 600;
  }
  .card.hierarchy-package .card-id {
    background: var(--blue-20);
    color: #99c2ff;
  }
  .card.hierarchy-package:hover {
    border-left-color: var(--blue);
    background: linear-gradient(135deg, var(--blue-12) 0%, rgba(255,255,255,0.03) 100%);
    box-shadow: 0 0 14px var(--blue-shadow), 0 8px 24px rgba(0,0,0,0.4);
  }

  .card.hierarchy-task {
    border-left: 3px solid var(--green);
  }

  /* 树形缩进连接线 */
  .card[style*="margin-left"] {
    position: relative;
  }
  .card[style*="margin-left"]::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255,255,255,0.2);
  }
  .card[style*="margin-left"]::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    width: 8px;
    height: 1px;
    background: rgba(255,255,255,0.2);
  }

  /* ── Ancestor Breadcrumb ──────────────────── */
  /* 归属路径：显示卡片的 Project > Package 链 */
  .card-ancestor {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .card-ancestor .ancestor-sep {
    margin: 0 3px;
    color: rgba(255,255,255,0.2);
  }

  /* ── Ghost Cards ─────────────────────────── */
  /* 父级引用卡片：在其他状态列中显示层级上下文 */
  .card.card-ghost {
    opacity: 0.45;
    border-style: dashed;
    border-width: 1px;
    border-left-width: 3px;
    border-color: rgba(255,255,255,0.15);
    padding: 6px 12px;
    margin-bottom: 2px;
    pointer-events: none;
    cursor: default;
    background: rgba(255,255,255,0.02);
    filter: grayscale(30%);
  }
  .card.card-ghost:hover {
    transform: none;
    box-shadow: none;
  }
  .card.card-ghost .card-name {
    font-size: 12px;
    font-weight: 500;
  }
  .card.card-ghost .card-meta {
    display: none;
  }
  .card-ghost-label {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    margin-bottom: 2px;
  }

  /* Badge 颜色区分层级类型（仅标签，不影响卡片布局） */
  .badge-project {
    background: var(--purple-15);
    color: var(--purple);
    border: 1px solid var(--purple-30);
    font-weight: 600;
  }

  .badge-package {
    background: var(--blue-15);
    color: var(--blue);
    border: 1px solid var(--blue-30);
    font-weight: 600;
  }

  .badge-task {
    background: rgba(51,204,119,0.15);
    color: var(--green);
    border: 1px solid rgba(51,204,119,0.3);
    font-weight: 600;
  }

  .progress-ring {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .progress-ring svg {
    display: block;
  }

  .progress-ring .progress-text {
    font-size: 10px;
    color: var(--text-secondary);
  }

  /* ── Custom Scrollbar ───────────────────────── */
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 5px;
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 5px;
    border: 2px solid var(--bg-secondary);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
  }

  /* ── Empty States ───────────────────────────── */
  .empty-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    min-height: 120px;
    /* Better text wrapping for empty states */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .empty-col::before {
    content: '✓';
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
  }

  .col-done .empty-col::before {
    content: '✨';
    color: var(--green);
    opacity: 0.6;
  }

  .col-done .empty-col::after {
    content: '暂无任务，真棒！';
    display: block;
    font-size: 13px;
    margin-top: 4px;
  }

  /* ── Breadcrumb Enhancements ──────────────────── */
  .breadcrumb-item {
    transition: var(--transition);
  }

  .breadcrumb-separator {
    color: var(--text-muted);
    margin: 0 6px;
    font-size: 14px;
    user-select: none;
  }

  /* ── Responsive Design ───────────────────────── */
  @media (max-width: 768px) {
    .header {
      flex-direction: column;
      gap: 12px;
      padding: 16px;
    }

    .header-left {
      width: 100%;
      flex-wrap: wrap;
    }

    .stats-bar {
      width: 100%;
      flex-wrap: wrap;
      gap: 8px;
    }

    .board {
      grid-template-columns: 1fr;
      gap: 12px;
      padding: 16px;
    }

    .col-body {
      min-height: 80px;
    }
  }

  @media (max-width: 480px) {
    .header-left h1 {
      font-size: 18px;
    }

    .stat-item {
      font-size: 12px;
    }

    .card {
      padding: 10px 12px;
    }

    .badge {
      font-size: 10px;
      padding: 2px 6px;
    }
  }

  @media (max-width: 375px) {
    .header {
      padding: 12px;
    }

    .board {
      padding: 12px;
      gap: 10px;
    }

    .col-header {
      padding: 10px 12px;
      font-size: 14px;
    }

    .date-label {
      font-size: 13px;
    }
  }

/* ── 拖拽排序样式 ────────────────────────────────── */
/* 拖拽占位样式 */
.sortable-ghost {
  opacity: 0.4;
  background: var(--purple-dark);
  border: 2px dashed var(--purple-light);
}

/* 被拖拽卡片样式 */
.sortable-chosen {
  box-shadow: 0 8px 16px rgba(138, 43, 226, 0.4);
  transform: scale(1.02);
  z-index: 100;
}

/* 拖拽中的卡片样式 */
.sortable-drag {
  cursor: grabbing;
  transform: rotate(3deg) scale(1.05);
  box-shadow: 0 12px 24px rgba(138, 43, 226, 0.5);
}

/* 可接受子任务的目标高亮 */
.drop-target {
  border: 2px solid var(--green) !important;
  box-shadow: 0 0 12px rgba(0, 255, 128, 0.5);
}

/* 拖拽悬停提示overlay */
.drag-hint-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 255, 128, 0.1);
  border: 2px dashed var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  border-radius: 8px;
}

.drag-hint-text {
  background: var(--bg-dark);
  color: var(--green);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}

/* ── 拖拽模式开关 ────────────────────────────────── */

/* 默认：卡片不拦截触摸 */
.card {
  touch-action: auto;
}

/* 拖拽模式开启时，卡片左侧显示把手 */
.drag-handle {
  display: none;
  width: 20px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  cursor: grab;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #888);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
  user-select: none;
  -webkit-user-select: none;
  z-index: 5;
  border-radius: var(--radius-md, 8px) 0 0 var(--radius-md, 8px);
}

.card:hover .drag-handle {
  opacity: 0.6;
}

.drag-handle:active {
  cursor: grabbing;
  opacity: 1;
  color: var(--purple-light, #b366ff);
}

/* 拖拽模式开启时的卡片样式 */
body.drag-mode-on .card {
  touch-action: none;  /* SortableJS 接管触摸 */
  padding-left: 28px;  /* 给把手腾位置 */
  position: relative;
}

body.drag-mode-on .drag-handle {
  display: flex;
}

/* 拖拽开关按钮 */
.drag-toggle-btn {
  background: var(--surface, #2a2a3e);
  color: var(--text-muted, #888);
  border: 1px solid var(--border, #333);
  border-radius: var(--radius-md, 6px);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.drag-toggle-btn:hover {
  border-color: var(--purple, #8a2be2);
  color: var(--text, #eee);
}

.drag-toggle-btn:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

/* 拖拽模式开启时开关样式 */
.drag-toggle-btn.active {
  background: var(--purple, #8a2be2);
  color: white;
  border-color: var(--purple, #8a2be2);
  box-shadow: 0 0 8px rgba(138, 43, 226, 0.4);
}

.drag-toggle-btn:active {
  transform: scale(0.95);
}

/* ── Card Action Buttons (Edit / Delete) ─────── */
.card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-top: 10px;
  justify-content: flex-end;
}

.card:hover .card-actions {
  opacity: 1;
}

/* Always show on touch devices */
@media (hover: none) {
  .card-actions {
    opacity: 0.6;
  }
  .card:hover .card-actions {
    opacity: 1;
  }
}

.card-action-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
  line-height: 1;
}

.card-action-btn:hover {
  transform: scale(1.1);
}

.card-edit-btn:hover {
  background: var(--blue-bg);
  border-color: var(--blue);
}

.card-delete-btn:hover {
  background: var(--red-bg);
  border-color: var(--red);
}

/* ── Edit Modal ──────────────────────────────── */
#editModal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(5,5,15,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

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

.edit-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  width: 92%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.25s ease;
}

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

.edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.edit-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.edit-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.edit-modal-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.edit-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-field label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  border-color: var(--blue);
}

.edit-field textarea {
  resize: vertical;
  min-height: 60px;
}

.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
}

.edit-btn-cancel,
.edit-btn-save {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.edit-btn-cancel {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.edit-btn-cancel:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.edit-btn-save {
  background: var(--blue);
  color: white;
}

.edit-btn-save:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.edit-btn-save:active {
  transform: translateY(0);
}

/* ── Delete Confirmation ─────────────────────── */
#deleteConfirm {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(5,5,15,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.delete-confirm-content {
  background: var(--bg-secondary);
  border: 1px solid rgba(255,68,102,0.2);
  border-radius: 16px;
  width: 88%;
  max-width: 380px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(255,68,102,0.08);
  animation: slideUp 0.2s ease;
}

.delete-confirm-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.delete-confirm-content h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.delete-confirm-name {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 4px;
  word-break: break-all;
  line-height: 1.4;
}

.delete-confirm-warn {
  font-size: 12px;
  color: var(--red);
  margin: 0 0 20px;
  opacity: 0.8;
}

.delete-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.delete-btn-cancel,
.delete-btn-confirm {
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.delete-btn-cancel {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.delete-btn-cancel:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.delete-btn-confirm {
  background: var(--red);
  color: white;
}

.delete-btn-confirm:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.delete-btn-confirm:active {
  transform: translateY(0);
}
