/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ===== Custom Fonts ===== */

@font-face {
  font-family: 'Rimouski';
  src: url("/fonts/header-font.otf") format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Orange Kid';
  src: url("/fonts/body-font.otf") format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ===== Design Tokens ===== */
:root {
  /* Colors */
  --color-nav-beige: #ede9cd;
  --color-nav-beige-hover: #d4cfb3;
  --color-card-white: #FFFFFF;
  --color-text-primary: #333333;
  --color-text-secondary: #666666;
  --color-text-tertiary: #7a7a7a;
  --color-bg-subtle: #f5f5f5;
  --color-primary: #333333;
  --color-border: #E0E0E0;
  --color-shadow: rgba(0, 0, 0, 0.1);
  
  /* Spacing */
  --spacing-xs: 0.25rem;    /* 4px */
  --spacing-sm: 0.5rem;     /* 8px */
  --spacing-md: 1rem;       /* 16px */
  --spacing-lg: 1.5rem;     /* 24px */
  --spacing-xl: 2rem;       /* 32px */
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  /* Transitions */
  --transition-base: 200ms ease;
  --transition-slow: 400ms ease;
  
  /* Animation Durations */
  --duration-quick: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
  
  /* Animation Easing Functions */
  /* Bouncy kawaii easing for delightful, playful animations */
  --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  /* Smooth, natural easing for general animations */
  --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  /* Quick snap for immediate feedback */
  --easing-snap: cubic-bezier(0.4, 0, 1, 1);
  
  /* Typography */
  --font-header: 'Rimouski', 'Georgia', serif;
  --font-body: 'Orange Kid', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Scrollbar */
  --scrollbar-thumb: #c8bfb0;

  /* Cursors (pixelarticons) */
  --cursor-default: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="8" y="6" width="2" height="2" fill="%23fafcfe"/><rect x="8" y="8" width="4" height="2" fill="%23fafcfe"/><rect x="8" y="10" width="6" height="2" fill="%23fafcfe"/><rect x="8" y="12" width="8" height="2" fill="%23fafcfe"/><rect x="8" y="14" width="4" height="2" fill="%23fafcfe"/><rect x="8" y="16" width="2" height="2" fill="%23fafcfe"/><rect x="6" y="4" width="2" height="16" fill="black"/><rect x="8" y="4" width="2" height="2" fill="black"/><rect x="10" y="6" width="2" height="2" fill="black"/><rect x="12" y="8" width="2" height="2" fill="black"/><rect x="14" y="10" width="2" height="2" fill="black"/><rect x="16" y="12" width="2" height="2" fill="black"/><rect x="8" y="18" width="2" height="2" fill="black"/><rect x="10" y="16" width="2" height="2" fill="black"/><rect x="12" y="14" width="6" height="2" fill="black"/></svg>') 7 5, auto;
  --cursor-click: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="11" y="9" width="2" height="2" fill="%23fafcfe"/><rect x="11" y="11" width="4" height="2" fill="%23fafcfe"/><rect x="11" y="13" width="6" height="2" fill="%23fafcfe"/><rect x="11" y="15" width="8" height="2" fill="%23fafcfe"/><rect x="11" y="17" width="4" height="2" fill="%23fafcfe"/><rect x="11" y="19" width="2" height="2" fill="%23fafcfe"/><rect x="9" y="7" width="2" height="16" fill="black"/><rect x="11" y="7" width="2" height="2" fill="black"/><rect x="13" y="9" width="2" height="2" fill="black"/><rect x="15" y="11" width="2" height="2" fill="black"/><rect x="17" y="13" width="2" height="2" fill="black"/><rect x="19" y="15" width="2" height="2" fill="black"/><rect x="11" y="21" width="2" height="2" fill="black"/><rect x="13" y="19" width="2" height="2" fill="black"/><rect x="15" y="17" width="6" height="2" fill="black"/><rect x="15" y="5" width="2" height="2" fill="black"/><rect x="5" y="10" width="2" height="2" fill="black"/><rect x="5" y="5" width="2" height="2" fill="black"/><rect x="9" y="1" width="2" height="4" fill="black"/><rect x="3" y="3" width="2" height="2" fill="black"/><rect x="3" y="12" width="2" height="2" fill="black"/><rect x="17" y="3" width="2" height="2" fill="black"/></svg>') 10 8, auto;
  --cursor-grab: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="11" y="3" width="2" height="8" fill="%23fafcfe"/><rect x="7" y="5" width="2" height="6" fill="%23fafcfe"/><rect x="15" y="5" width="2" height="6" fill="%23fafcfe"/><rect x="19" y="7" width="2" height="4" fill="%23fafcfe"/><rect x="7" y="11" width="10" height="1" fill="%23fafcfe"/><rect x="19" y="11" width="2" height="1" fill="%23fafcfe"/><rect x="7" y="12" width="14" height="1" fill="%23fafcfe"/><rect x="3" y="13" width="2" height="2" fill="%23fafcfe"/><rect x="7" y="13" width="14" height="2" fill="%23fafcfe"/><rect x="3" y="15" width="4" height="2" fill="%23fafcfe"/><rect x="9" y="15" width="12" height="2" fill="%23fafcfe"/><rect x="5" y="17" width="16" height="2" fill="%23fafcfe"/><rect x="7" y="19" width="12" height="2" fill="%23fafcfe"/><rect x="21" y="7" width="2" height="5" fill="black"/><rect x="17" y="5" width="2" height="7" fill="black"/><rect x="13" y="3" width="2" height="8" fill="black"/><rect x="9" y="3" width="2" height="8" fill="black"/><rect x="5" y="5" width="2" height="8" fill="black"/><rect x="19" y="5" width="2" height="2" fill="black"/><rect x="15" y="3" width="2" height="2" fill="black"/><rect x="11" y="1" width="2" height="2" fill="black"/><rect x="7" y="3" width="2" height="2" fill="black"/><rect x="3" y="11" width="2" height="2" fill="black"/><rect x="1" y="13" width="2" height="2" fill="black"/><rect x="1" y="15" width="2" height="2" fill="black"/><rect x="3" y="17" width="2" height="2" fill="black"/><rect x="5" y="19" width="2" height="2" fill="black"/><rect x="7" y="21" width="12" height="2" fill="black"/><rect x="19" y="19" width="2" height="2" fill="black"/><rect x="21" y="12" width="2" height="7" fill="black"/><rect x="5" y="13" width="2" height="2" fill="black"/><rect x="7" y="15" width="2" height="2" fill="black"/></svg>') 12 12, grab;
  --cursor-grabbing: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="7" y="7" width="2" height="2" fill="%23fafcfe"/><rect x="11" y="7" width="2" height="2" fill="%23fafcfe"/><rect x="15" y="7" width="2" height="2" fill="%23fafcfe"/><rect x="7" y="9" width="2" height="2" fill="%23fafcfe"/><rect x="11" y="9" width="2" height="2" fill="%23fafcfe"/><rect x="15" y="9" width="2" height="2" fill="%23fafcfe"/><rect x="19" y="9" width="2" height="2" fill="%23fafcfe"/><rect x="7" y="11" width="14" height="2" fill="%23fafcfe"/><rect x="3" y="13" width="2" height="2" fill="%23fafcfe"/><rect x="7" y="13" width="14" height="2" fill="%23fafcfe"/><rect x="3" y="15" width="4" height="2" fill="%23fafcfe"/><rect x="9" y="15" width="12" height="2" fill="%23fafcfe"/><rect x="5" y="17" width="16" height="2" fill="%23fafcfe"/><rect x="7" y="19" width="12" height="2" fill="%23fafcfe"/><rect x="17" y="7" width="2" height="4" fill="black"/><rect x="13" y="5" width="2" height="6" fill="black"/><rect x="9" y="5" width="2" height="6" fill="black"/><rect x="5" y="7" width="2" height="6" fill="black"/><rect x="19" y="7" width="2" height="2" fill="black"/><rect x="15" y="5" width="2" height="2" fill="black"/><rect x="11" y="5" width="2" height="2" fill="black"/><rect x="7" y="5" width="2" height="2" fill="black"/><rect x="3" y="11" width="2" height="2" fill="black"/><rect x="1" y="13" width="2" height="2" fill="black"/><rect x="1" y="15" width="2" height="2" fill="black"/><rect x="3" y="17" width="2" height="2" fill="black"/><rect x="5" y="19" width="2" height="2" fill="black"/><rect x="7" y="21" width="12" height="2" fill="black"/><rect x="19" y="19" width="2" height="2" fill="black"/><rect x="21" y="9" width="2" height="10" fill="black"/><rect x="5" y="13" width="2" height="2" fill="black"/><rect x="7" y="15" width="2" height="2" fill="black"/></svg>') 12 12, grabbing;
  --cursor-text: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="9" y="2" width="6" height="2" fill="%23fafcfe"/><rect x="11" y="4" width="2" height="2" fill="%23fafcfe"/><rect x="11" y="18" width="2" height="2" fill="%23fafcfe"/><rect x="9" y="20" width="6" height="2" fill="%23fafcfe"/><rect x="5" y="2" width="4" height="2" fill="black"/><rect x="5" y="20" width="4" height="2" fill="black"/><rect x="9" y="4" width="2" height="2" fill="black"/><rect x="9" y="18" width="2" height="2" fill="black"/><rect x="13" y="4" width="2" height="2" fill="black"/><rect x="13" y="18" width="2" height="2" fill="black"/><rect x="15" y="2" width="4" height="2" fill="black"/><rect x="15" y="20" width="4" height="2" fill="black"/><rect x="11" y="6" width="2" height="12" fill="black"/></svg>') 12 12, text;
  --cursor-pointer: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="7" y="3" width="2" height="6" fill="%23fafcfe"/><rect x="11" y="9" width="2" height="2" fill="%23fafcfe"/><rect x="15" y="9" width="2" height="2" fill="%23fafcfe"/><rect x="7" y="11" width="10" height="1" fill="%23fafcfe"/><rect x="19" y="11" width="2" height="1" fill="%23fafcfe"/><rect x="7" y="12" width="14" height="1" fill="%23fafcfe"/><rect x="3" y="13" width="2" height="2" fill="%23fafcfe"/><rect x="7" y="13" width="14" height="2" fill="%23fafcfe"/><rect x="3" y="15" width="4" height="2" fill="%23fafcfe"/><rect x="9" y="15" width="12" height="2" fill="%23fafcfe"/><rect x="5" y="17" width="16" height="2" fill="%23fafcfe"/><rect x="7" y="19" width="12" height="2" fill="%23fafcfe"/><rect x="17" y="9" width="2" height="3" fill="black"/><rect x="13" y="7" width="2" height="4" fill="black"/><rect x="9" y="3" width="2" height="8" fill="black"/><rect x="5" y="3" width="2" height="10" fill="black"/><rect x="19" y="9" width="2" height="2" fill="black"/><rect x="15" y="7" width="2" height="2" fill="black"/><rect x="11" y="7" width="2" height="2" fill="black"/><rect x="7" y="1" width="2" height="2" fill="black"/><rect x="3" y="11" width="2" height="2" fill="black"/><rect x="1" y="13" width="2" height="2" fill="black"/><rect x="1" y="15" width="2" height="2" fill="black"/><rect x="3" y="17" width="2" height="2" fill="black"/><rect x="5" y="19" width="2" height="2" fill="black"/><rect x="7" y="21" width="12" height="2" fill="black"/><rect x="19" y="19" width="2" height="2" fill="black"/><rect x="21" y="11" width="2" height="8" fill="black"/><rect x="5" y="13" width="2" height="2" fill="black"/><rect x="7" y="15" width="2" height="2" fill="black"/></svg>') 8 2, pointer;
  --cursor-not-allowed: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="7" y="5" width="2" height="2" fill="%23fafcfe"/><rect x="13" y="12" width="2" height="1" fill="%23fafcfe"/><rect x="13" y="13" width="4" height="1" fill="%23fafcfe"/><rect x="11" y="14" width="6" height="1" fill="%23fafcfe"/><rect x="11" y="15" width="2" height="2" fill="%23fafcfe"/><rect x="11" y="17" width="4" height="3" fill="%23fafcfe"/><rect x="5" y="3" width="4" height="2" fill="black"/><rect x="5" y="5" width="2" height="9" fill="black"/><rect x="9" y="5" width="2" height="2" fill="black"/><rect x="13" y="9" width="2" height="2" fill="black"/><rect x="15" y="11" width="2" height="2" fill="black"/><rect x="17" y="13" width="2" height="4" fill="black"/><rect x="13" y="15" width="4" height="2" fill="black"/><rect x="9" y="16" width="2" height="2" fill="black"/><rect x="5" y="18" width="6" height="2" fill="black"/><rect x="11" y="20" width="4" height="2" fill="black"/><rect x="15" y="17" width="2" height="3" fill="black"/><rect x="3" y="20" width="2" height="2" fill="black"/><rect x="5" y="18" width="2" height="2" fill="black"/><rect x="7" y="16" width="2" height="2" fill="black"/><rect x="9" y="14" width="2" height="2" fill="black"/><rect x="11" y="12" width="2" height="2" fill="black"/><rect x="13" y="10" width="2" height="2" fill="black"/><rect x="15" y="8" width="2" height="2" fill="black"/><rect x="17" y="6" width="2" height="2" fill="black"/><rect x="19" y="4" width="2" height="2" fill="black"/></svg>') 6 4, not-allowed;
}

/* ===== Sync Broadcast Animation Suppression ===== */
/* When Turbo Stream updates replace DOM elements for real-time sync,
   new elements would trigger entrance animations (fade-in, slide-down).
   This suppresses those animations so synced content appears instantly.
   Also prevents image/icon flash by maintaining visibility during swap. */
.sync-replaced,
.sync-replaced * {
  animation: none !important;
  transition: none !important;
}

/* Prevent images from flashing during DOM replacement */
.sync-replaced img {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ===== Celebration Particles ===== */
/* Pixel art sparkles and confetti for task completion milestones.
   Particles are DOM elements generated by celebration_controller.js.
   Colors come from --celebration-N CSS vars, set per season/mode. */

#celebration-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10010;
  overflow: hidden;
}

.celebration-particle {
  position: absolute;
  /* No border-radius — pixel art squares */
  opacity: 0;
  will-change: transform, opacity;
}

/* Particle animation: smooth burst outward from origin, fade */
@keyframes celebration-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0);
  }
  100% {
    opacity: 0;
    transform: translate(var(--spread-x), var(--spread-y));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .celebration-particle {
    animation-name: celebration-burst;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation-fill-mode: forwards;
  }
}

/* Reduced motion: brief fade only, no movement */
@keyframes celebration-fade-only {
  0% { opacity: 0; }
  30% { opacity: 0.8; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .celebration-particle {
    animation: celebration-fade-only 600ms ease forwards;
  }
}

/* ===== Celebration Season Colors ===== */
/* Light mode defaults */
body.season-spring {
  --celebration-1: #f8bbd0;
  --celebration-2: #f48fb1;
  --celebration-3: #c8e6c9;
  --celebration-4: #fff176;
  --celebration-5: #ce93d8;
}

body.season-summer {
  --celebration-1: #ffd54f;
  --celebration-2: #ffab40;
  --celebration-3: #81d4fa;
  --celebration-4: #aed581;
  --celebration-5: #f48fb1;
}

body.season-fall {
  --celebration-1: #ffcc80;
  --celebration-2: #ff8a65;
  --celebration-3: #bcaaa4;
  --celebration-4: #f5a623;
  --celebration-5: #ef9a9a;
}

body.season-winter {
  --celebration-1: #90caf9;
  --celebration-2: #b39ddb;
  --celebration-3: #e0e0e0;
  --celebration-4: #80cbc4;
  --celebration-5: #f8bbd0;
}

/* Dark mode season overrides */
body.theme-dark.season-spring {
  --celebration-1: #f8a5c2;
  --celebration-2: #ec407a;
  --celebration-3: #a5d6a7;
  --celebration-4: #fff59d;
  --celebration-5: #ba68c8;
}

body.theme-dark.season-summer {
  --celebration-1: #ffe082;
  --celebration-2: #ffb74d;
  --celebration-3: #4fc3f7;
  --celebration-4: #9ccc65;
  --celebration-5: #f48fb1;
}

body.theme-dark.season-fall {
  --celebration-1: #ffab91;
  --celebration-2: #ff7043;
  --celebration-3: #8d6e63;
  --celebration-4: #ffa726;
  --celebration-5: #e57373;
}

body.theme-dark.season-winter {
  --celebration-1: #64b5f6;
  --celebration-2: #9575cd;
  --celebration-3: #bdbdbd;
  --celebration-4: #4db6ac;
  --celebration-5: #f8a5c2;
}

/* Day cycle overrides */
body.time-sunrise {
  --celebration-1: #ffcc80;
  --celebration-2: #ffab40;
  --celebration-3: #fff176;
  --celebration-4: #f8bbd0;
  --celebration-5: #ffe0b2;
}

body.time-sunset {
  --celebration-1: #ef9a9a;
  --celebration-2: #e57373;
  --celebration-3: #ffcc80;
  --celebration-4: #f48fb1;
  --celebration-5: #ff8a65;
}

body.time-night {
  --celebration-1: #90caf9;
  --celebration-2: #64b5f6;
  --celebration-3: #b39ddb;
  --celebration-4: #80cbc4;
  --celebration-5: #ce93d8;
}

/* Settings celebrations toggle */
.toggle-option {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}

.toggle-option-label {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text-primary);
}

.settings-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #f8bbd0;
}

/* ===== Global Scrollbars ===== */
/* Cozy thin scrollbars: auto-hide, themed for light & dark.
   Uses standard properties only (no ::-webkit-scrollbar pseudo-elements)
   so the pixel-art cursor stays intact over scrollbar areas. */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*:hover {
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* ===== Seasonal Backgrounds ===== */

body.season-spring {
  background-image: url("/backgrounds/background-spring-summer.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

body.season-summer {
  background-image: url("/backgrounds/background-summer.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

body.season-fall {
  background-image: url("/backgrounds/background-fall.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

body.season-winter {
  background-image: url("/backgrounds/background-winter.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

/* Basic Reset and Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--color-text-primary);
  padding: 0;
  margin: 0;
  min-height: 100vh;
  cursor: var(--cursor-default);
}

/* Override browser default pointer cursor on interactive elements */
a, button, select, summary, [role="button"] {
  cursor: var(--cursor-pointer);
}

/* Pixel art cursor click animation (toggled by cursor_controller.js) */
body.cursor-clicking {
  cursor: var(--cursor-click);
}

/* During drag, SortableJS sets pointer-events:none on the ghost so the
   browser resolves cursor from body. Override click cursor with grabbing. */
body:has(.sortable-chosen) {
  cursor: var(--cursor-grabbing) !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
}

h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

/* Flash Messages */
.notice, .alert {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-width: 300px;
  max-width: 400px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 1;
  transition: opacity var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@keyframes slide-in-bounce {
  0% {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
  }
  60% {
    transform: translateX(-5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .notice, .alert {
    transition: opacity var(--duration-normal) var(--easing-smooth), transform var(--duration-normal) var(--easing-bounce);
    animation: slide-in-bounce var(--duration-slow) var(--easing-bounce);
  }
}

.notice {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.close-flash {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 0;
  font-size: 1.2rem;
  opacity: 0.5;
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .close-flash:hover {
    opacity: 1;
    transform: scale(1.15);
  }

  .close-flash:active {
    transform: scale(0.9);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

.flash-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.flash-action-link {
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
  cursor: var(--cursor-pointer);
}

.notice .flash-action-link {
  color: #155724;
}

.notice .flash-action-link:hover {
  color: #0d3a16;
}

/* Forms */
.field {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
  cursor: var(--cursor-text);
}

@media (prefers-reduced-motion: no-preference) {
  input[type="email"]:focus,
  input[type="password"]:focus,
  input[type="text"]:focus,
  textarea:focus {
    outline: none;
    border-color: var(--color-text-primary);
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
  }
}

input[type="checkbox"] {
  margin-right: 5px;
}

/* Devise Forms - Narrow and Centered with Frosted Glass */
.devise-form-container {
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

.devise-form-container h2 {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  color: var(--color-text-primary);
}

/* Remember me checkbox on same line */
.remember-me-field {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.remember-me-field label {
  display: inline;
  margin-bottom: 0;
  font-weight: normal;
  cursor: var(--cursor-pointer);
}

.remember-me-field input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  margin-right: 0;
  cursor: var(--cursor-pointer);
  width: 16px;
  height: 16px;
  border: 2px solid #6a737d;
  border-radius: 3px;
  background: transparent;
  vertical-align: middle;
  flex-shrink: 0;
}

.remember-me-field input[type="checkbox"]:checked {
  background-color: #2188ff;
  border-color: #2188ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M10 3L4.5 8.5L2 6' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-size: 10px 10px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Devise links section */
.devise-links {
  text-align: center;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
}

.devise-links a {
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--duration-normal) var(--easing-smooth);
}

.devise-links a:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
}

.devise-links span {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.link-separator {
  color: var(--color-text-secondary);
  margin: 0 var(--spacing-xs);
}

.devise-subtitle {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  font-size: 0.95rem;
  text-align: center;
}

/* Cloudflare Turnstile widget on the sign-up form.
   min-height reserves the widget's footprint so the Sign up button doesn't
   jump once the challenge finishes rendering. */
.turnstile-widget {
  margin-bottom: var(--spacing-md);
  min-height: 65px;
}

.turnstile-fallback-notice {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: var(--spacing-md);
}

/* Honeypot — must never be perceivable, including to screen readers. */
.signup-hp {
  display: none;
}

/* Post-signup "check your inbox" page */
.confirm-email-panel {
  text-align: center;
}

.confirm-email-panel p {
  margin-bottom: var(--spacing-md);
}

.confirm-email-icon img.pixel-icon {
  width: 48px;
  height: 48px;
  opacity: 0.7;
}

.confirm-email-actions {
  margin: var(--spacing-lg) 0;
}

.tip-box {
  background: var(--color-card-white);
  border-left: 3px solid #f8bbd9;
  padding: 12px 16px;
  margin: var(--spacing-lg) 0;
  text-align: left;
  border-radius: var(--radius-sm);
}

.confirm-email-resend {
  margin-top: var(--spacing-sm);
}

.confirm-email-resend form {
  display: inline;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  min-height: 0;
  box-shadow: none;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: var(--cursor-pointer);
}

.btn-link:disabled {
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: var(--cursor-not-allowed);
}

.resend-countdown {
  display: block;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  margin-top: var(--spacing-xs);
}

.confirm-email-change {
  text-align: left;
  margin-bottom: var(--spacing-lg);
}

.confirm-email-change summary {
  cursor: var(--cursor-pointer);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  text-align: center;
}

.confirm-email-change-form {
  margin-top: var(--spacing-md);
}

/* Buttons */
.btn, input[type="submit"] {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border: 2px solid var(--color-text-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  min-height: 44px;
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .btn:hover, input[type="submit"]:hover {
    background-color: var(--color-text-primary);
    color: var(--color-card-white);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
  }

  .btn:active, input[type="submit"]:active {
    transform: scale(0.98);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }

  .btn:focus-visible, input[type="submit"]:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
    animation: pulse-glow 1.5s var(--easing-smooth) infinite;
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3), 0 0 8px 2px rgba(0, 0, 0, 0.15);
  }
}

.actions {
  margin-top: 1.5rem;
}

/* Error Messages */
#error_explanation {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 1.5rem;
}

#error_explanation h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

#error_explanation ul {
  margin-left: 20px;
}

.field_with_errors {
  display: inline;
}

.field_with_errors input {
  border-color: #dc3545;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-3px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(3px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .field_with_errors input {
    animation: shake var(--duration-normal) var(--easing-snap);
  }
}

/* Landing Page */
.landing-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
}

.landing-hero h1 {
  margin-bottom: 1rem;
}

.landing-subtitle {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--color-text-primary);
}

.landing-intro {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.landing-section {
  text-align: center;
  margin-bottom: 4rem;
  padding: 2rem;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

/* Content sections inside the main section */
.landing-hero,
.landing-content-section,
.landing-features-section,
.landing-aesthetic-section,
.landing-closing {
  text-align: center;
  margin-bottom: 5rem;
}

.landing-content-section h2,
.landing-aesthetic-section h2,
.landing-closing h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-primary);
}

.landing-content-section p,
.landing-aesthetic-section p,
.landing-closing p {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.landing-closing {
  margin-bottom: 0;
}

/* CTA Buttons - Modern Kawaii Style */
.cta-button {
  display: inline-block;
  padding: 0.875rem 2.25rem;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text-primary);
  background-color: #f8bbd0;
  border: none;
  border-radius: 50px;
  box-shadow: 0 2px 12px rgba(248, 187, 208, 0.4);
  cursor: var(--cursor-pointer);
  transition: all 0.2s ease;
  margin-top: 1.5rem;
}

.cta-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(244, 143, 177, 0.5);
  background-color: #f48fb1;
}

.cta-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(248, 187, 208, 0.4);
}

.landing-features-section .cta-button {
  display: block;
  width: fit-content;
  margin: 2rem auto 0;
}

.landing-closing .cta-button {
  margin-top: 2rem;
}

.landing-features-section .theme-bar {
  margin-bottom: 2rem;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.landing-feature {
  background-color: var(--color-card-white);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  text-align: left;
}

@media (prefers-reduced-motion: no-preference) {
  .landing-feature:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }
}

.landing-feature h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.landing-feature p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
  color: var(--color-text-primary);
  font-size: 0.95rem;
}

.landing-feature p:last-child {
  margin-bottom: 0;
}

.landing-aesthetic-section {
  text-align: center;
  margin-bottom: 3rem;
}

.landing-aesthetic-section > h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-primary);
}

.landing-aesthetic-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
  color: var(--color-text-primary);
}

.landing-aesthetic-section p {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.landing-aesthetic-section p:last-of-type {
  margin-bottom: 2rem;
}

/* Screenshots Gallery */
.screenshots-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.screenshot-item {
  flex: 0 0 auto;
  cursor: var(--cursor-pointer);
  transition: transform var(--duration-normal) var(--easing-smooth);
}

.screenshot-item-wide {
  width: 100%;
  display: flex;
  justify-content: center;
}

.screenshots-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

@media (prefers-reduced-motion: no-preference) {
  .screenshot-item:hover {
    transform: scale(1.05);
  }
}

.screenshot-thumb {
  width: 180px;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  transition: box-shadow var(--duration-normal) var(--easing-smooth);
}

.screenshot-thumb-wide {
  width: 100%;
  max-width: 800px;
}

@media (prefers-reduced-motion: no-preference) {
  .screenshot-thumb:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
  }
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: var(--cursor-pointer);
}

.lightbox.active {
  display: flex;
}

.lightbox-image {
  max-width: 95%;
  max-height: 95vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: var(--cursor-default);
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  color: white;
  font-size: 2.5rem;
  font-weight: normal;
  cursor: var(--cursor-pointer);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  transition: all var(--duration-normal) var(--easing-smooth);
  padding: 0;
  margin: 0;
  line-height: 1;
}

.lightbox-close::before {
  content: "";
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
  }
}

@media (max-width: 768px) {
  .landing-features-grid {
    grid-template-columns: 1fr;
  }

  .screenshots-gallery {
    flex-direction: column;
    align-items: center;
  }

  .screenshots-row {
    flex-direction: column;
    align-items: center;
  }

  .screenshot-thumb {
    width: 100%;
    max-width: 300px;
  }

  .screenshot-thumb-wide {
    max-width: 100%;
  }

  .lightbox-image {
    max-width: 95%;
  }

  .lightbox-close {
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    width: 40px;
    height: 40px;
  }
}

.cta-links {
  margin: 2rem 0;
}

.cta-links .btn {
  margin: 0 10px;
}

.waitlist-section {
  margin-top: 3rem;
  padding: 2rem;
  background-color: #f8f9fa;
  border-radius: 8px;
}

/* Dashboard */
.dashboard {
  padding: 2rem;
}

/* Links */
a {
  color: #4a90e2;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Monthly Theme Styles - Simple Inline Layout */
.theme-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 1.75rem var(--spacing-lg);
  background-color: var(--color-card-white);
  margin: 0 auto var(--spacing-lg) auto;
  max-width: 450px;
  position: relative;
  border-radius: 50px;
}

/* Cloud puffs on top using pseudo-elements */
.theme-bar::before,
.theme-bar::after {
  content: "";
  position: absolute;
  display: block;
  background: var(--color-card-white);
  border-radius: 50%;
  z-index: -1;
}

.theme-bar::before {
  width: 120px;
  height: 120px;
  top: -55px;
  left: 30px;
}

.theme-bar::after {
  width: 80px;
  height: 80px;
  top: -35px;
  left: 130px;
}

.theme-bar > * {
  position: relative;
  z-index: 1;
}

.left-theme-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  line-height: 1;
  flex-wrap: nowrap;
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.right-theme-bar {
  display: flex;
  align-items: center;
  gap: 0rem;
  line-height: 1;
  flex-shrink: 0;
}

#theme-action-icons {
  display: contents;
}

.month-display {
  font-family: var(--font-header);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-size: 1.2rem;
}

.month-display .pixel-icon {
  width: 22px;
  height: 22px;
}

.current-month {
  position: relative;
  top: 2px;
}

.theme-frame {
  flex: 1;
  min-width: 0;
  display: flex;
}

.theme-display {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.theme-content {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.theme-edit-container {
  display: flex;
  flex: 1;
  min-width: 0;
}

.theme-text {
  font-family: var(--font-body);
  line-height: 1;
  white-space: nowrap;
  flex: 1;
  overflow: visible;
  text-overflow: ellipsis;
  position: relative;
  top: 2px;
  font-size: 1.1rem;
  min-width: 0;
}

.theme-edit-form {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  width: 100%;
  margin-bottom: -4px;
}

.theme-edit-form .inline-form {
  display: flex !important;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
}

.theme-input {
  padding: 3px 5px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-sm);
  font-size: 1.1rem !important;
  font-family: var(--font-body);
  line-height: 1;
  flex: 1;
  min-width: 0;
  min-height: 0 !important;
  width: 100%;
  background-color: var(--color-card-white) !important;
  color: var(--color-text-primary);
  transition: var(--transition-base);
  height: 28px !important;
}

.theme-input {
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .theme-input:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.02);
    transform: scale(1.01);
  }
}

/* ===== Theme Intention Hover Popover ===== */
.theme-content {
  position: relative;
}

.intention-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-card-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  min-width: 260px;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 100;
  font-family: var(--font-body);
}

.intention-popover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 12px;
}

.theme-content:hover .intention-popover {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.intention-popover-text {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--color-text-primary);
  margin: 0;
  font-style: italic;
}

.intention-popover-signal {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
  margin: 0;
}

.intention-popover-label {
  font-weight: 600;
}

/* ===== Theme Intention Modal ===== */
.intention-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}

.intention-modal-card {
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.intention-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.intention-modal-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.intention-modal-title .pixel-icon {
  width: 18px;
  height: 18px;
}

.intention-form {
  width: 100%;
}

.intention-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-md);
}

.intention-save-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 10px 20px;
  background-color: #333333;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: var(--cursor-pointer);
  transition: background-color var(--duration-quick) var(--easing-smooth);
}

.intention-save-btn:hover {
  background-color: #555555;
}

.intention-save-btn .pixel-icon {
  width: 14px;
  height: 14px;
  filter: invert(1);
}

.intention-fields-body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.intention-field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.intention-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #5a5a6a;
  font-family: var(--font-body);
  font-weight: 400;
}

.intention-label-icon {
  width: 14px;
  height: 14px;
  opacity: 0.4;
  flex-shrink: 0;
}

.intention-theme-name-field {
  text-align: center;
  padding: var(--spacing-sm) 0 var(--spacing-md);
}

.intention-theme-name-input {
  font-family: var(--font-header);
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  border: none;
  border-bottom: 2px dashed #d0d0d8;
  border-radius: 0;
  background: transparent;
  padding: var(--spacing-xs) var(--spacing-sm);
  width: 100%;
  max-width: 280px;
  color: var(--color-text-primary);
  transition: border-color var(--duration-quick) var(--easing-smooth);
}

.intention-theme-name-input:focus {
  outline: none;
  border-bottom-color: var(--color-text-primary);
}

.intention-theme-name-input::placeholder {
  color: #b0b0be;
  font-weight: 400;
}

.intention-textarea {
  min-height: 72px;
  resize: vertical;
  font-size: 0.85rem;
  line-height: 1.5;
}

.icon-link {
  text-decoration: none;
  cursor: var(--cursor-pointer);
  background: none;
  border: none;
  padding: 0.15rem;
  margin: 0;
  color: inherit;
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .icon-link:hover {
    background-color: transparent;
    text-decoration: none;
    transform: scale(1.15);
  }

  .icon-link:active {
    transform: scale(0.9);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

/* Delete icon-link specific styling for category header only */
.category-header-right form.icon-link {
  padding: 0.15rem 0.15rem 0 0.15rem !important;
}

/* History icon specific styling */
.theme-group .icon-link:last-child {
  padding-bottom: 0 !important;
}

.error-messages {
  display: block;
  margin-left: 0.5rem;
  margin-top: 0.5rem;
  overflow: hidden;
}

.error-messages .error {
  color: #e74c3c;
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: no-preference) {
  .error-messages {
    animation: slide-down-fade-in var(--duration-normal) var(--easing-smooth);
  }

  .error-messages .error {
    animation: slide-down-fade-in var(--duration-normal) var(--easing-smooth);
  }
}

@keyframes slide-down-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 100px;
  }
}

/* Theme History Page */
.history-clouds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--spacing-lg) var(--spacing-lg);
  row-gap: calc(var(--spacing-xl) * 2);
  padding: var(--spacing-lg) 0;
  max-width: 1200px;
  margin: 0 auto;
}

/* Month Cloud - Similar to Theme Bar */
.month-cloud {
  --random-offset: 0px;
  background-color: var(--color-card-white);
  border-radius: 50px;
  padding: var(--spacing-sm) var(--spacing-md);
  position: relative;
  transform: translateY(var(--random-offset));
}

/* Cloud puffs on top using pseudo-elements */
.month-cloud::before,
.month-cloud::after {
  content: "";
  position: absolute;
  display: block;
  background: var(--color-card-white);
  border-radius: 50%;
  z-index: -1;
}

.month-cloud::before {
  width: 70px;
  height: 70px;
  top: -30px;
  left: 20px;
}

.month-cloud::after {
  width: 55px;
  height: 55px;
  top: -22px;
  left: 70px;
}

/* Floating animation - controlled by JS for smooth exit */
@media (prefers-reduced-motion: no-preference) {
  .month-cloud.is-floating {
    animation: float 2s ease-in-out infinite;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(var(--random-offset));
  }
  50% {
    transform: translateY(calc(var(--random-offset) - 10px));
  }
}

/* Cloud Content */
.cloud-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.cloud-month {
  font-family: var(--font-header);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.cloud-theme {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Icon Link */
.cloud-icon-link {
  flex-shrink: 0;
  padding: 0.2rem;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.2s ease;
}

.cloud-icon-link:hover .pixel-icon {
  opacity: 0.6;
}

.current-badge {
  margin-left: 1rem;
  font-size: 0.8rem;
}

.empty-category-message {
  padding: var(--spacing-lg);
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

.empty-state {
  text-align: center;
  padding: 2rem;
}

/* Categories Section - Full Width Horizontal Scroll */
.categories-section {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 0 2rem;
  margin-top: 2rem;
}

@media (max-width: 767px) {
  .categories-section {
    padding: 0 1rem;
  }
}

.categories-section h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.categories-grid {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-top: 1.75rem;
  padding-bottom: 1rem;
  margin-top: -1.75rem;
  scroll-behavior: smooth;
}

.category-card {
  background: white;
  /* border: 1px solid #e0e0e0; */
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
  min-width: 420px;
  max-width: 420px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(0);
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  60% {
    transform: translateY(5px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Loading Indicator ===== */
.loading-dot {
  width: 6px;
  height: 6px;
  background-color: var(--color-text-secondary);
  border-radius: 50%;
  animation: loading-bounce 0.6s infinite alternate;
}
.loading-dot:nth-child(2) { opacity: 0.8; }
.loading-dot:nth-child(3) { opacity: 0.6; }

@keyframes loading-bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

@keyframes slide-right-fade-in {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Animation for category deletion */
@media (prefers-reduced-motion: no-preference) {
  .category-card.removing {
    animation: slide-up-fade-out var(--duration-normal) var(--easing-smooth) forwards;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .category-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    transition: box-shadow var(--duration-normal) var(--easing-smooth);
  }

  .category-card {
    transition: box-shadow 0.2s;
    animation: bounce-in var(--duration-slow) var(--easing-bounce);
  }
}

.category-name {
  font-weight: 600;
  font-size: 1.1rem;
  flex: 1;
}

/* Category name inline edit wrapper - lives in header-left */
.category-name-edit {
  flex: 1;
  display: none;
  align-items: center;
  min-width: 0;
}

.category-name-edit .category-form-btn {
  min-width: 28px;
  min-height: 28px;
}

/* Reorder arrows for category cards */
.reorder-arrows {
  display: flex;
  align-items: center;
  gap: 0;
}

.reorder-btn {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 0.15rem;
  opacity: 0.7;
  transition: all var(--duration-normal) var(--easing-smooth);
}

.reorder-btn:hover:not(:disabled) {
  opacity: 1;
  transform: scale(1.1);
}

.reorder-btn:disabled {
  opacity: 0.3;
  cursor: var(--cursor-not-allowed);
}

.reorder-btn .pixel-icon {
  width: 16px;
  height: 16px;
}

/* Responsive arrow icons - show horizontal on desktop, vertical on mobile */
/* Using higher specificity to override .pixel-icon base styles */
.reorder-btn .reorder-icon-horizontal {
  display: inline-block;
}

.reorder-btn .reorder-icon-vertical {
  display: none;
}

@media (max-width: 767px) {
  .reorder-btn .reorder-icon-horizontal {
    display: none;
  }

  .reorder-btn .reorder-icon-vertical {
    display: inline-block;
  }
}

/* Animation states for category card reordering - cozy and smooth */
.category-card.is-animating {
  transition: transform var(--duration-slow) var(--easing-smooth);
  z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .category-card.is-animating {
    transition: none;
  }
}

.category-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-text {
  color: #000;
  font-style: italic;
  font-size: 0.9rem;
}

.category-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

/* Category Placeholder */
.category-placeholder {
  background: #f8f8f8;
  /* border: 2px dashed #ccc; */
  transition: all 0.2s;
}

.category-placeholder:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.placeholder-content {
  text-align: center;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  position: relative;
  z-index: 1;
}

.new-category-form {
  padding: 1rem;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  visibility: visible;
}

.placeholder-icon {
  font-size: 2rem;
  color: #999;
  margin-bottom: 0.5rem;
}

.placeholder-text {
  color: #000;
  margin-bottom: 1rem;
}

.btn-create {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border: 2px solid var(--color-text-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-body);
  cursor: var(--cursor-pointer);
  transition: var(--transition-base);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .btn-create:hover {
    background-color: #f5f5f5;
    color: var(--color-text-primary);
    border-color: var(--color-text-secondary);
    transform: scale(1.02);
  }

  .btn-create:active {
    transform: scale(0.98);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

/* Category Forms */
.category-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.category-form .error-messages {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.category-form .error-messages .error {
  display: block;
  color: #c00;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.category-form .error-messages .error:last-child {
  margin-bottom: 0;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-field label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  font-family: var(--font-body);
}

.name-input {
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  transition: all var(--duration-normal) var(--easing-smooth);
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1;
}

.name-input:focus {
  outline: none;
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* Fix mobile dropdown positioning */
select.name-input {
  z-index: 10;
}

.form-field {
  position: relative;
  z-index: 1;
}

@media (max-width: 767px) {
  .form-field {
    position: relative;
    z-index: auto;
  }
  
  select.name-input {
    position: relative;
    z-index: 10;
  }
  
  /* Ensure select dropdowns appear correctly on mobile */
  select {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
  }
  
  /* Fix modal container for dropdowns */
  .task-modal-container {
    position: relative;
    z-index: 10001;
    overflow-y: auto;
    overflow-x: visible;
  }
  
  .task-modal-container .form-field {
    position: relative;
    z-index: 1;
  }
  
  .task-modal-container select.name-input {
    position: relative;
    z-index: 10;
    transform: translateZ(0);
  }
  
  /* Fix mobile dropdown positioning - ensure selects are positioned correctly */
  .task-modal-container select {
    position: relative;
    z-index: 10;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
  }
  
  .task-modal-container .category-form {
    position: relative;
    z-index: 1;
    overflow: visible;
  }
  
  .task-modal-container .form-field {
    overflow: visible;
    position: relative;
  }
  
  /* Prevent dropdown from appearing in wrong place on mobile */
  .task-modal-container select.name-input {
    position: relative;
    z-index: 100;
  }
}

.form-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-save,
.btn-cancel {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border: 2px solid var(--color-text-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  min-height: 44px;
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-save:hover,
  .btn-cancel:hover {
    background-color: var(--color-text-primary);
    color: var(--color-card-white);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
  }

  .btn-save:active,
  .btn-cancel:active {
    transform: scale(0.98);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }

  .btn-save:focus-visible,
  .btn-cancel:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
    animation: pulse-glow 1.5s var(--easing-smooth) infinite;
  }
}

/* ============================================
   SORTABLE DRAG STATES
   ============================================ */

/* Activating state - shown during the delay period before drag starts (mobile) */
.sortable-activating {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2),
              0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
  position: relative;
}

/* Prevent text selection and context menu during drag states */
.sortable-activating,
.sortable-activating *,
.sortable-chosen,
.sortable-chosen *,
.sortable-drag,
.sortable-drag * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Ghost: The placeholder showing where the item will land */
.sortable-ghost {
  opacity: 0.35;
  background: var(--color-accent, #4a90d9);
  border: 2px dashed var(--color-accent, #4a90d9);
  border-radius: var(--radius-md);
  box-shadow: none;
}

/* Chosen: The actual item being dragged */
.sortable-chosen {
  cursor: var(--cursor-grabbing) !important;
  transform: scale(1.02) rotate(1deg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2),
              0 4px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

/* Drag: The clone that follows the cursor/finger */
.sortable-drag {
  opacity: 1;
  transform: scale(1.04) rotate(1.5deg);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22),
              0 6px 12px rgba(0, 0, 0, 0.12);
  z-index: 1001;
  will-change: transform;
}

@media (prefers-reduced-motion: no-preference) {
  .sortable-activating {
    transition: transform var(--duration-quick) var(--easing-bounce),
                box-shadow var(--duration-quick) var(--easing-smooth);
    animation: drag-activate-lift 200ms var(--easing-smooth);
  }

  .sortable-ghost {
    transition: opacity var(--duration-quick) var(--easing-smooth),
                background var(--duration-quick) var(--easing-smooth);
  }

  .sortable-chosen {
    transition: transform var(--duration-quick) var(--easing-bounce),
                box-shadow var(--duration-quick) var(--easing-smooth);
  }

  .sortable-drag {
    transition: transform var(--duration-quick) var(--easing-bounce),
                box-shadow var(--duration-quick) var(--easing-smooth);
  }
}

/* Subtle lift animation during activation */
@keyframes drag-activate-lift {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  }
  100% {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }
}

/* Reduced motion: Remove rotation and scale effects */
@media (prefers-reduced-motion: reduce) {
  .sortable-activating,
  .sortable-chosen,
  .sortable-drag {
    transform: none;
    animation: none;
  }
}

/* Sibling displacement optimization during sorting */
.is-sorting .focus-task-card,
.is-sorting .month-task-row {
  will-change: transform;
}

/* Remove will-change when not sorting (performance optimization) */
.focus-task-card,
.month-task-row {
  will-change: auto;
}

/* PWA-specific: Prevent pull-to-refresh interfering with drag */
@media (display-mode: standalone) {
  .focus-tasks-list,
  [data-controller*="sort"] {
    overscroll-behavior-y: contain;
  }
}

/* iOS Safari specific optimizations */
.sortable-chosen,
.sortable-drag {
  -webkit-overflow-scrolling: auto;
}

.focus-task-card,
.month-task-row {
  -webkit-touch-callout: none;
}


/* Categories Header with Collapse/Expand All */
.categories-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.categories-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-collapse-all,
.btn-expand-all,
.btn-toggle-completed,
.btn-toggle-cancelled {
  -webkit-appearance: none;
  appearance: none;
  padding: 0.4rem 0.8rem 0.4rem 0.8rem;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  transition: background-color var(--duration-normal) var(--easing-smooth), transform var(--duration-normal) var(--easing-smooth), opacity var(--duration-normal) var(--easing-smooth);
  border: none;
  text-decoration: none;
  cursor: var(--cursor-pointer);
  min-height: 44px;
  transform: scale(1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

@media (prefers-reduced-motion: no-preference) {
  .btn-collapse-all:hover,
  .btn-expand-all:hover,
  .btn-toggle-completed:hover,
  .btn-toggle-cancelled:hover {
    background-color: #f5f5f5;
    transform: scale(1.05);
  }

  .btn-collapse-all:active,
  .btn-expand-all:active,
  .btn-toggle-completed:active,
  .btn-toggle-cancelled:active {
    transform: scale(0.98);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

/* Timezone Widget */
.timezone-widget {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.8rem;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  min-height: 44px;
}

.timezone-clock {
  font-weight: 500;
  white-space: nowrap;
}

.timezone-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  color: var(--color-text-primary);
  transition: all var(--duration-normal) var(--easing-smooth);
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .timezone-edit-btn:hover {
    transform: scale(1.15);
  }

  .timezone-edit-btn:active {
    transform: scale(0.9);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

.timezone-edit-form {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.8rem;
  background-color: var(--color-card-white);
  border-radius: var(--radius-sm);
  min-height: 44px;
}

.timezone-form {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}

.timezone-select {
  flex: 1;
  padding: 0.25rem 0.5rem;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  min-width: 0;
  max-width: 200px;
}

.timezone-save-btn,
.timezone-cancel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  color: var(--color-text-primary);
  transition: all var(--duration-normal) var(--easing-smooth);
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .timezone-save-btn:hover,
  .timezone-cancel-btn:hover {
    transform: scale(1.15);
  }

  .timezone-save-btn:active,
  .timezone-cancel-btn:active {
    transform: scale(0.9);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

/* Mobile responsive for timezone widget */
@media (max-width: 768px) {
  .categories-header {
    justify-content: flex-end;
    padding-left: 0;
  }
  
  .categories-actions {
    flex-wrap: nowrap;
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-end;
  }
  
  /* Timezone widget - auto width, right aligned, with white background, matching height */
  .timezone-widget {
    flex: 0 0 auto;
    width: auto;
    padding: 0.35rem 0.5rem;
    background-color: var(--color-card-white);
    justify-content: flex-end;
    min-height: 36px;
    height: 36px;
    display: flex;
    align-items: center;
  }
  
  /* Timezone edit form - takes up full space when shown, matching height */
  .timezone-edit-form {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.35rem 0.6rem;
    min-height: 36px;
    height: 36px;
    display: flex;
    align-items: center;
  }
  
  .timezone-clock {
    font-size: 0.8rem;
  }
  
  .timezone-select {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    max-width: none;
    height: auto;
  }
  
  /* Save/Cancel buttons - smaller with no gap or padding */
  .timezone-save-btn,
  .timezone-cancel-btn {
    padding: 0.1rem;
    min-width: auto;
    width: auto;
  }
  
  .timezone-form {
    gap: 0;
  }
  
  /* Collapse/Expand buttons - take up even less space, right aligned, matching height, slightly wider */
  .btn-collapse-all,
  .btn-expand-all,
  .btn-toggle-completed,
  .btn-toggle-cancelled {
    flex: 0 0 auto;
    min-width: auto;
    width: auto;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    justify-content: center;
    position: relative;
    min-height: 36px;
    height: 36px;
    display: flex;
    align-items: center;
  }

  /* Hide text on mobile, show only icons */
  .btn-collapse-all .btn-text,
  .btn-expand-all .btn-text,
  .btn-toggle-completed .btn-text,
  .btn-toggle-cancelled .btn-text {
    display: none;
  }

  .btn-collapse-all .pixel-icon,
  .btn-expand-all .pixel-icon,
  .btn-toggle-completed .pixel-icon,
  .btn-toggle-cancelled .pixel-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.category-content {
  margin-top: 0;
}

.category-header-left {
  display: flex;
  align-items: center;
  gap: 0rem;
}

.category-header-right {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.collapse-toggle {
  padding: 0.15rem;
  color: #666;
  transition: all var(--duration-normal) var(--easing-smooth);
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .collapse-toggle:hover {
    background-color: transparent;
    transform: scale(1.15);
  }

  .collapse-toggle:active {
    transform: scale(0.9);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

/* Tasks Section */
.category-tasks {
  margin-top: 1rem;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 0.5rem;
  min-height: 40px;
}

/* Task Item - Single Line Layout */
.task-item-wrapper {
  width: 100%;
  min-height: 2rem;
}

/* Animation for newly created tasks only */
@media (prefers-reduced-motion: no-preference) {
  .task-item-wrapper[data-turbo-temporary] {
    animation: slide-down-fade-in-simple var(--duration-normal) var(--easing-smooth);
  }
}

@keyframes slide-down-fade-in-simple {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation for task deletion */
@media (prefers-reduced-motion: no-preference) {
  .task-item-wrapper.removing {
    animation: slide-up-fade-out var(--duration-normal) var(--easing-smooth) forwards;
  }
}

@keyframes slide-up-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 100px;
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    margin: 0;
    padding: 0;
  }
}

.task-item {
  display: flex;
  align-items: center;
  /* gap: 0.4rem; */
  padding: 0.35rem 0rem 0.35rem 0.4rem;
  background-color: transparent;
  transition: all 0.15s;
  width: 100%;
  flex-wrap: nowrap;
  border-radius: 4px;
}

.task-item-display {
  display: flex;
  flex-direction: column;
}

.task-item-content {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 0;
}


.task-item-readonly {
  padding: 0.35rem 0.5rem;
  width: 100%;
}

.task-item-readonly .task-name {
  font-size: 0.9rem;
  color: #333;
}

.task-edit-form {
  width: 100%;
}

.task-item:hover {
  background-color: #fafafa;
}

.task-checkbox-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  margin-right: var(--spacing-xs);
}

.task-name {
  font-size: 0.9rem;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.task-name-wrapper .task-name {
  flex: 1;
  min-width: 0;
}

.task-strikethrough {
  text-decoration: line-through;
  opacity: 0.5;
}

.task-completed {
  opacity: 0.6;
}

.task-cancelled {
  opacity: 0.45;
}

.task-cancelled .task-name {
  text-decoration: line-through;
  text-decoration-style: dashed;
}

.task-cancelled-indicator {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.5;
  margin-right: var(--spacing-xs);
}

.task-cancelled-indicator .pixel-icon {
  width: 16px;
  height: 16px;
}

.task-cancelled-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.6;
}

.task-cancelled-badge .pixel-icon {
  width: 16px;
  height: 16px;
}

.task-icons-group {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
  padding-left: 0.15rem;
}

/* Deadline countdown indicator */
.deadline-countdown {
  font-size: 0.9rem;
  font-weight: 500;
  margin-right: var(--spacing-xs);
  flex-shrink: 0;
  font-family: inherit;
  cursor: var(--cursor-default);
  position: relative;
}

/* Custom tooltip for deadline - shows immediately on hover */
.deadline-countdown::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  z-index: 100;
}

.deadline-countdown:hover::after {
  opacity: 1;
  visibility: visible;
}

.deadline-normal { color: #22c55e; }     /* Green: 8+ days */
.deadline-soon { color: #eab308; }       /* Yellow: 4-7 days */
.deadline-urgent { color: #f97316; }     /* Orange: 1-3 days */
.deadline-today { color: #ef4444; }      /* Red: today */
.deadline-overdue {
  color: #ef4444;
  font-weight: 700;
}

.task-star-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.task-progress-form,
.task-blocked-form {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.task-icon-btn {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 0;
  color: #999;
  font-size: 0.8rem;
  transition: all var(--duration-normal) var(--easing-smooth);
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .task-icon-btn:hover {
    background-color: transparent;
    transform: scale(1.15);
  }

  .task-icon-btn:active {
    transform: scale(0.9);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

.icon-filled-yellow {
  filter: brightness(0) saturate(100%) invert(89%) sepia(99%) saturate(7498%) hue-rotate(329deg) brightness(101%) contrast(101%) !important;
}

.icon-filled-red {
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%) !important;
}


/* Task Form - Inline Layout (matches task item style) */
.task-form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 0.2rem 0rem 0.2rem 0.4rem;
  background-color: transparent;
  transition: all 0.15s;
  min-height: auto;
}

.task-name-input-inline {
  flex: 1;
  padding: 8px !important;
  border: none;
  border-radius: 0;
  font-size: 0.8rem;
  line-height: 1.2;
  font-family: var(--font-body);
  background-color: transparent;
  color: var(--color-text-primary);
  transition: var(--transition-base);
  min-width: 0;
  min-height: 18px;
  height: 20px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: var(--cursor-text);
}

.task-name-input-inline {
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .task-name-input-inline:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.02);
    transform: scale(1.01);
  }
}

.task-form-btn {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 0;
  margin: 0;
  color: #666;
  font-size: 0.9rem;
  transition: all 0.15s;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  width: 18px;
  height: 18px;
}

.task-form-btn:hover .pixel-icon {
  opacity: 0.6;
}

.task-form-errors {
  position: absolute;
  background: #fee;
  color: #c33;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 0.25rem;
  z-index: 10;
}

@media (prefers-reduced-motion: no-preference) {
  .task-form-errors {
    animation: slide-down-fade-in var(--duration-normal) var(--easing-smooth);
  }
}

/* Add Task Section */
.add-task-section {
  margin-top: 0.25rem;
}

.btn-add-task {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0.2rem;
  background-color: transparent;
  color: var(--color-text-secondary);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: var(--transition-base);
  text-decoration: none;
  min-height: 44px;
}

.btn-add-task {
  transition: all var(--duration-normal) var(--easing-smooth);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-add-task:hover {
    background-color: #f5f5f5;
    color: var(--color-text-primary);
    border-color: var(--color-text-secondary);
  }
}

/* Category Form - Inline Layout (matches task item style) */
.category-form-inline {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 0;
  background-color: transparent;
  transition: all 0.15s;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.category-name-input-inline {
  flex: 1;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-body);
  background-color: transparent;
  color: var(--color-text-primary);
  transition: var(--transition-base);
  min-width: 0;
  height: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}


.category-name-input-inline {
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .category-name-input-inline:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.02);
    transform: scale(1.01);
  }
}

.category-form-btn {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 0.15rem;
  margin: 0;
  color: #666;
  font-size: 0.9rem;
  transition: all 0.15s;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.category-form-btn:hover .pixel-icon {
  opacity: 0.6;
}

.category-form-errors {
  position: absolute;
  background: #fee;
  color: #c33;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 0.25rem;
  z-index: 10;
}

@media (prefers-reduced-motion: no-preference) {
  .category-form-errors {
    animation: slide-down-fade-in var(--duration-normal) var(--easing-smooth);
  }
}

/* Focus Page Styles */
.focus-tasks-list {
  max-width: 500px;
  margin: 0 auto;
  padding: var(--spacing-lg) 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.focus-task-card {
  background-color: var(--color-card-white);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}

/* Focus cards (not backlog) are draggable */
.focus-task-card:not(.backlog-task-card) {
  cursor: var(--cursor-grab);
  touch-action: pan-y; /* Allow vertical scrolling by default */
}

/* When actively dragging (not during activation), disable touch actions */
.focus-task-card.sortable-chosen,
.focus-task-card.sortable-drag {
  touch-action: none;
  cursor: var(--cursor-grabbing);
}

/* Activation state keeps pan-y to allow scroll cancellation */
.focus-task-card.sortable-activating {
  cursor: var(--cursor-grabbing);
}

/* Re-enable touch for interactive elements inside focus cards */
.focus-task-card:not(.backlog-task-card) a,
.focus-task-card:not(.backlog-task-card) .task-link-inline,
.focus-task-card:not(.backlog-task-card) .task-checkbox-btn,
.focus-task-card:not(.backlog-task-card) .task-icon-btn,
.focus-task-card:not(.backlog-task-card) button {
  touch-action: manipulation;
  pointer-events: auto;
}

.focus-task-card:not(.backlog-task-card):active {
  cursor: var(--cursor-grabbing);
}

@media (prefers-reduced-motion: no-preference) {
  .focus-task-card {
    animation: slide-down-fade-in-simple var(--duration-normal) var(--easing-smooth);
  }

  .focus-task-card.removing {
    animation: slide-up-fade-out var(--duration-normal) var(--easing-smooth) forwards;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .focus-task-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    transition: transform var(--duration-normal) var(--easing-smooth), box-shadow var(--duration-normal) var(--easing-smooth);
  }

  .focus-task-card {
    transition: transform var(--duration-normal) var(--easing-smooth), box-shadow 0.2s ease;
  }
}

/* ===== Focus Achievements (Today's Wins) ===== */
/* Mirrors .focus-tasks-list so the cards line up exactly when toggling between the two views.
   No horizontal padding, so max-width IS the card width. */
.focus-achievements {
  max-width: 500px;
  margin: 0 auto;
  padding: var(--spacing-lg) 0 120px 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* --- Summary strip --- */
.focus-wins-strip {
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  padding: var(--spacing-lg) var(--spacing-md);
  text-align: center;
}

.focus-wins-headline {
  font-family: var(--font-header);
  font-size: 1.3rem;
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-sm) 0;
}

.focus-wins-number {
  font-family: var(--font-header);
  font-size: 3.5rem;
  line-height: 1;
  color: #16a34a;
  margin: 0;
}

.focus-wins-number-label {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin: var(--spacing-xs) 0 0 0;
}

.focus-wins-rule {
  height: 1px;
  background: var(--color-border);
  margin: var(--spacing-md) auto 0 auto;
  width: 80%;
}

.focus-wins-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-xs) var(--spacing-md);
  margin-top: var(--spacing-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.focus-wins-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.focus-wins-chip-count {
  color: var(--color-text-primary);
  font-weight: 600;
}

.focus-wins-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #e1e4e8;
}

.focus-wins-dot--finished { background: #16a34a; }
.focus-wins-dot--subtasks { background: #f5a623; }
.focus-wins-dot--started  { background: #f5a623; }
.focus-wins-dot--let_go   { background: #2188ff; }

/* --- Groups --- */
.focus-achievement-group {
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  padding: var(--spacing-md);
  border-left: 3px solid #e1e4e8;
}

.focus-achievement-group--finished { border-left-color: #16a34a; }
.focus-achievement-group--subtasks { border-left-color: #f5a623; }
.focus-achievement-group--started  { border-left-color: #f5a623; }
.focus-achievement-group--let_go   { border-left-color: #2188ff; }

.focus-achievement-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.focus-achievement-header-label {
  font-family: var(--font-header);
  font-size: 1.05rem;
  color: var(--color-text-primary);
}

.focus-achievement-header-count {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
  white-space: nowrap;
  padding-left: var(--spacing-sm);
}

.focus-achievement-note {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  margin: var(--spacing-xs) 0 0 0;
}

.focus-achievement-row {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  margin-top: var(--spacing-sm);
  border-top: 1px solid var(--color-border);
}

.focus-achievement-icon {
  flex-shrink: 0;
  margin-top: 2px;
  display: inline-flex;
}

.focus-achievement-row-body {
  min-width: 0;
}

/* No strikethrough: this is a list of wins, not a list of crossed-off obligations. */
.focus-achievement-name {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  text-decoration: none;
  cursor: var(--cursor-pointer);
}

.focus-achievement-name:hover {
  text-decoration: underline;
}

.focus-achievement-sub {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin: 2px 0 0 0;
}

/* Sits tight under the task name - it labels the task, not the lines below it. */
.focus-subtask-total {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  margin: 0 0 var(--spacing-xs) 0;
  line-height: 1.2;
}

.focus-subtask-list {
  list-style: none;
  margin: var(--spacing-xs) 0 var(--spacing-sm) 0;
  padding: 0;
}

.focus-subtask {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
  padding: 1px 0;
}

.focus-subtask .pixel-icon-sm {
  flex-shrink: 0;
}

.focus-subtask--done .pixel-icon-sm {
  /* #16a34a — matches the completed segment of the subtask donut */
  filter: brightness(0) saturate(100%) invert(45%) sepia(82%) saturate(462%) hue-rotate(90deg) brightness(93%) contrast(94%);
}

.focus-subtask--doing .pixel-icon-sm {
  /* #f5a623 — matches the in-progress segment of the subtask donut */
  filter: brightness(0) saturate(100%) invert(72%) sepia(74%) saturate(1004%) hue-rotate(340deg) brightness(101%) contrast(92%);
}

@media (prefers-reduced-motion: no-preference) {
  .focus-wins-strip,
  .focus-achievement-group {
    animation: slide-down-fade-in-simple var(--duration-normal) var(--easing-smooth);
  }
}

/* Month page task row - entire row is draggable */
.month-task-row {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: var(--cursor-grab);
  touch-action: pan-y; /* Allow vertical scrolling by default */
}

/* When actively dragging (not during activation), disable touch actions */
.month-task-row.sortable-chosen,
.month-task-row.sortable-drag {
  touch-action: none;
  cursor: var(--cursor-grabbing);
}

/* Activation state keeps pan-y to allow scroll cancellation */
.month-task-row.sortable-activating {
  cursor: var(--cursor-grabbing);
}

.month-task-row:active {
  cursor: var(--cursor-grabbing);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #000;
}

.empty-state i {
  margin-bottom: 1rem;
  color: #000;
}

.empty-state p {
  margin-bottom: 0.5rem;
}

.empty-state-hint {
  font-size: 0.9rem;
  color: #000;
}

/* Navigation Styles */
.user-nav {
  display: flex;
  justify-content: center;
  align-items: stretch;
  background-color: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0;
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0 var(--spacing-lg);
  text-decoration: none;
  color: var(--color-text-primary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
}

.nav-brand-icon {
  width: 24px;
  height: 24px;
}

.nav-links {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.nav-link {
  padding: var(--spacing-lg);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: var(--transition-base);
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  height: 100%;
  min-height: 44px;
}

.nav-link {
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .nav-link:hover,
  .nav-link.active {
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--color-text-primary);
    text-decoration: underline;
    transform: scale(1.02);
  }

  .nav-link:active {
    transform: scale(0.98);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

/* Button_to form wrapper */
.nav-links form {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  height: 100%;
}

.btn-logout,
.btn-logout button {
  padding: var(--spacing-lg);
  background-color: transparent;
  color: var(--color-text-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  cursor: var(--cursor-pointer);
  transition: var(--transition-base);
  font-size: 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: 0;
  height: 100%;
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  min-height: 44px;
}

.btn-logout,
.btn-logout button {
  transition: all var(--duration-normal) var(--easing-smooth);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-logout:hover,
  .btn-logout button:hover {
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--color-text-primary);
    text-decoration: underline;
    transform: scale(1.02);
  }

  .btn-logout:active,
  .btn-logout button:active {
    transform: scale(0.98);
    transition: transform var(--duration-quick) var(--easing-bounce);
  }
}

/* Sync Status Indicator - positioned in theme-bar cloud */
.sync-status-cloud {
  position: absolute;
  top: -20px;
  right: 30px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-primary);
  opacity: 0.6;
  transition: opacity var(--transition-base);
  white-space: nowrap;
  z-index: 2;
  cursor: var(--cursor-pointer);
}

.sync-status-cloud:hover {
  opacity: 1;
}

.sync-status-cloud::before {
  content: "○ ";
  color: #88c88a;
}

/* Page Content Wrapper */
.page-content {
  padding: var(--spacing-xl);
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Pixelarticons Styling ===== */
.pixel-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  filter: brightness(0) saturate(100%);
}

.task-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pixel-icon-large {
  width: 48px;
  height: 48px;
}

/* Icon hover effects - consistent grey/darker effect for all icons */
.task-icon-btn:hover .pixel-icon,
.icon-link:hover .pixel-icon,
.collapse-toggle:hover .pixel-icon {
  opacity: 0.6;
}

/* Checkbox button styling */
.task-checkbox-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: var(--cursor-pointer);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform var(--duration-quick) var(--easing-bounce);
  transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
  .task-checkbox-btn:hover {
    transform: scale(1.15);
  }

  .task-checkbox-btn:active {
    transform: scale(0.85);
  }
}

/* ===== Responsive Layout ===== */

/* Prevent iOS Safari auto-zoom on input focus (triggers when font-size < 16px) */
@media (max-width: 768px) {
  input[type="email"],
  input[type="password"],
  input[type="text"],
  input[type="number"],
  input[type="url"],
  input[type="tel"],
  input[type="search"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Mobile Devices (up to 767px) */
@media (max-width: 767px) {
  body {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  /* Mobile: Use pseudo-element for fixed background (iOS Safari compatible) */
  body[class*="season-"] {
    background-image: none !important;
  }

  body[class*="season-"]::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center bottom;
    pointer-events: none;
  }

  /* Season-specific backgrounds for mobile pseudo-element */
  body.season-spring::before {
    background-image: url("/backgrounds/background-spring-summer.png");
  }

  body.season-summer::before {
    background-image: url("/backgrounds/background-summer.png");
  }

  body.season-fall::before {
    background-image: url("/backgrounds/background-fall.png");
  }

  body.season-winter::before {
    background-image: url("/backgrounds/background-winter.png");
  }

  /* Dark mode backgrounds for mobile pseudo-element */
  body.theme-dark.season-spring::before {
    background-image: url("/backgrounds/background-spring-dark.png");
  }
  body.theme-dark.season-summer::before {
    background-image: url("/backgrounds/background-summer-dark.png");
  }
  body.theme-dark.season-fall::before {
    background-image: url("/backgrounds/background-fall-dark.png");
  }
  body.theme-dark.season-winter::before {
    background-image: url("/backgrounds/background-winter-dark.png");
  }

  /* Day Cycle mobile backgrounds - Sunrise */
  body.time-sunrise.season-spring::before {
    background-image: url("/backgrounds/background-spring-sunrise.png");
  }
  body.time-sunrise.season-summer::before {
    background-image: url("/backgrounds/background-summer-sunrise.png");
  }
  body.time-sunrise.season-fall::before {
    background-image: url("/backgrounds/background-fall-sunrise.png");
  }
  body.time-sunrise.season-winter::before {
    background-image: url("/backgrounds/background-winter-sunrise.png");
  }

  /* Day Cycle mobile backgrounds - Day */
  body.time-day.season-spring::before {
    background-image: url("/backgrounds/background-spring-summer.png");
  }
  body.time-day.season-summer::before {
    background-image: url("/backgrounds/background-summer.png");
  }
  body.time-day.season-fall::before {
    background-image: url("/backgrounds/background-fall.png");
  }
  body.time-day.season-winter::before {
    background-image: url("/backgrounds/background-winter.png");
  }

  /* Day Cycle mobile backgrounds - Sunset */
  body.time-sunset.season-spring::before {
    background-image: url("/backgrounds/background-spring-sunset.png");
  }
  body.time-sunset.season-summer::before {
    background-image: url("/backgrounds/background-summer-sunset.png");
  }
  body.time-sunset.season-fall::before {
    background-image: url("/backgrounds/background-fall-sunset.png");
  }
  body.time-sunset.season-winter::before {
    background-image: url("/backgrounds/background-winter-sunset.png");
  }

  /* Day Cycle mobile backgrounds - Night */
  body.time-night.season-spring::before {
    background-image: url("/backgrounds/background-spring-dark.png");
  }
  body.time-night.season-summer::before {
    background-image: url("/backgrounds/background-summer-dark.png");
  }
  body.time-night.season-fall::before {
    background-image: url("/backgrounds/background-fall-dark.png");
  }
  body.time-night.season-winter::before {
    background-image: url("/backgrounds/background-winter-dark.png");
  }

  .page-content {
    padding: var(--spacing-md);
  }

  .dashboard {
    padding: var(--spacing-md) 0;
    margin: 0;
  }

  .nav-brand {
    display: none;
  }

  .user-nav {
    flex-direction: row;
    align-items: stretch;
    gap: 0;
  }

  .nav-links {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
  }

  .nav-links form {
    flex: 1;
  }

  .nav-link,
  .btn-logout,
  .btn-logout button {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px var(--spacing-sm) 10px var(--spacing-sm);
    flex: 1;
    gap: 0.25rem;
    min-width: 0;
  }

  .nav-link .pixel-icon,
  .btn-logout .pixel-icon {
    margin-bottom: 0;
  }

  .theme-bar {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg) var(--spacing-md);
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin-top: var(--spacing-sm);
  }

  .theme-bar::before,
  .theme-bar::after {
    display: none;
  }

  .sync-status-cloud {
    position: absolute;
    top: -28px;
    left: 0;
    right: 0;
    text-align: center;
  }

  .left-theme-bar {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding-right: 80px; /* Reserve space for absolutely positioned icons */
  }

  .right-theme-bar {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    flex-direction: row;
    gap: var(--spacing-sm);
  }

  .month-display {
    width: 100%;
  }

  .theme-frame {
    width: 100%;
    flex-direction: column;
  }

  .theme-display {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .theme-content {
    width: 100%;
  }

  .theme-edit-container {
    width: 100%;
    flex-direction: column;
  }

  .theme-edit-form {
    width: 100%;
    flex-direction: row;
    gap: var(--spacing-sm);
  }

  .theme-edit-form .inline-form {
    flex-direction: row;
    width: 100%;
    gap: var(--spacing-sm);
    align-items: center;
  }

  .theme-input {
    flex: 1;
    padding: var(--spacing-sm) !important;
    min-height: 44px !important;
    height: auto !important;
    font-size: 1rem !important;
  }

  .intention-textarea {
    min-height: 88px;
  }

  .intention-modal-overlay {
    padding: var(--spacing-sm);
  }

  .intention-popover {
    min-width: 200px;
    max-width: 280px;
  }

  .categories-grid {
    flex-direction: column;
    overflow-x: visible;
    gap: var(--spacing-md);
    padding-bottom: 0;
  }

  .category-card {
    min-width: 100%;
    max-width: 100%;
    padding: var(--spacing-md);
  }

  .category-actions {
    flex-wrap: wrap;
    gap: var(--spacing-sm);
  }

  .focus-tasks-list {
    max-width: 100%;
    padding: var(--spacing-md) 0 200px 0;
  }

  .focus-achievements {
    max-width: 100%;
    padding: var(--spacing-md) 0 200px 0;
  }

  .focus-task-card {
    padding: var(--spacing-md);
    gap: 0;
  }

  /* Mobile modal fixes */
  #task-detail-container > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-md) !important;
  }

  #task-detail-container .theme-bar {
    flex-wrap: wrap;
    margin-bottom: var(--spacing-sm) !important;
  }

  #task-detail-container .theme-edit-form {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
  }

  #task-detail-container .theme-input {
    flex: 1;
    min-width: 0;
  }

  /* Backlog filters mobile */
  .category-form[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Mobile modal - wider with less padding */
  .lightbox.active {
    padding: 0.5rem;
  }

  .task-modal-container {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: var(--spacing-md) !important;
    max-height: 95vh !important;
  }

  .task-modal-content {
    gap: var(--spacing-sm) !important;
  }

  .task-modal-body {
    gap: var(--spacing-sm) !important;
  }
}

/* Task Modal Styles - Desktop */
.task-modal-container {
  position: relative;
  z-index: 10001;
  max-width: 800px;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.task-modal-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  flex: 1;
  min-height: 0;
}

.task-modal-header {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.task-modal-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
}

.task-modal-back {
  flex-shrink: 0;
}

.task-modal-back-desktop {
  display: none;
}

.task-cancelled-badge-desktop {
  display: none;
}

.task-modal-name-row {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.task-modal-name-row-mobile {
  display: flex;
  align-items: center;
  gap: 0;
}

.task-modal-name-row-desktop {
  display: none;
}

.task-modal-actions {
  flex-shrink: 0;
}

.task-modal-actions-desktop {
  display: none;
}

.task-checkbox-form-desktop {
  display: none;
}

@media (min-width: 768px) {
  .task-modal-header {
    flex-direction: row;
    align-items: center;
    gap: 0;
  }
  
  .task-modal-header-top {
    display: none;
  }
  
  .task-modal-name-row-mobile {
    display: none;
  }
  
  .task-modal-actions-mobile {
    display: none;
  }
  
  .task-modal-back-desktop {
    display: block;
    flex-shrink: 0;
  }

  .task-cancelled-badge-desktop {
    display: inline-flex;
  }

.task-modal-name-row-desktop {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.task-modal-name-row-desktop .task-name-wrapper {
  gap: 0;
  flex: 1;
  min-width: 0;
}

.task-modal-name-row-desktop .task-name-display {
  gap: 0;
}
  
  .task-modal-actions-desktop {
    display: block;
    flex-shrink: 0;
  }

  .task-checkbox-form-desktop {
    display: inline-flex;
  }
}

.task-modal-back {
  flex-shrink: 0;
}

.task-modal-actions {
  flex-shrink: 0;
}

.task-modal-name-row {
  width: 100%;
}

.task-modal-name-row .task-name {
  font-size: 1.2rem;
  font-weight: 600;
}

.task-modal-left .form-field label {
  font-family: var(--font-header);
  font-size: 1.1rem;
  font-weight: 700;
}

.task-modal-right .form-field label {
  font-family: var(--font-header);
  font-size: 0.95rem;
  font-weight: 600;
}

.task-name-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  position: relative;
  min-height: 1.5rem;
}

.task-item-content .task-name-wrapper {
  flex: 1;
  min-width: 0;
}

.task-name-display {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
  width: 100%;
  justify-content: space-between;
}

.task-name-edit[style*="display: flex"],
.task-name-edit[style*="display:flex"] {
  display: flex !important;
}

.task-name-display[style*="display: none"],
.task-name-display[style*="display:none"] {
  display: none !important;
}

.task-name-display .task-name {
  flex: 1;
  min-width: 0;
}

.task-name-display .task-icon-btn {
  flex-shrink: 0;
  margin-left: auto;
}

.task-name-edit {
  display: none;
  align-items: center;
  gap: 0;
  width: 100%;
  flex: 1;
  min-width: 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

.task-name-edit[style*="display: block"],
.task-name-edit[style*="display:flex"] {
  display: flex !important;
}

.task-name-edit-form {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  min-height: 18px;
  height: 18px;
  flex: 1;
}

.task-name-edit-form .task-name-input-inline {
  flex: 1;
  min-width: 0;
  min-height: 18px;
  height: 24px;
  padding: 0 8px !important;
  line-height: 20px;
}

.task-name-edit-form .task-form-btn {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.task-modal-body {
  display: grid;
  grid-template-columns: 1fr 0.4fr;
  gap: var(--spacing-xl);
  flex: 1;
  min-height: 0;
}

.task-modal-left {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  min-width: 0;
  min-height: 0;
  overflow-y: hidden;
}

/* --- Description scroll containment: pin header & buttons, scroll textarea --- */

/* Flex propagation chain: task-modal-left → form-field → editor → textarea */
.task-modal-left > .form-field {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Display mode: rendered markdown scrolls within the panel */
.task-modal-left .task-modal-description-display {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Edit mode: outer editor wrapper fills available space */
.task-modal-left .category-form.marksmith-editor-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.task-modal-left .category-form.marksmith-editor-wrapper > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Marksmith inner wrapper: flex column so we can constrain the editor height */
.task-modal-left .marksmith-editor-wrapper .marksmith {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Marksmith toolbar (tabs + icons) has ms:flex-1 which must NOT grow */
.task-modal-left .marksmith-toolbar {
  flex: 0 0 auto !important;
}

/* Editor content fills remaining space between toolbar and form-actions */
.task-modal-left .marksmith-editor-content {
  min-height: 0;
}

.task-modal-left .marksmith-editor-pane {
  min-height: 0;
}

/* Textarea: stop auto-growing, scroll internally instead */
.task-modal-left .marksmith-textarea {
  field-sizing: normal !important;
  resize: none !important;
  flex: 1;
  min-height: 100px;
  overflow-y: auto;
}

/* Bottom toolbar has ms:flex-1 which must NOT grow */
.task-modal-left .marksmith-bottom-toolbar {
  flex: 0 0 auto !important;
}

.task-modal-left .marksmith-editor-wrapper .form-actions {
  flex-shrink: 0;
}

.task-modal-left .draft-restore-banner {
  flex-shrink: 0;
}

.task-modal-right {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  min-width: 0;
  overflow-y: auto;
}

/* Task Modal - Cancel/Delete Actions at bottom of sidebar */
.task-modal-danger-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: auto;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

.task-modal-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--duration-normal) var(--easing-smooth),
              color var(--duration-normal) var(--easing-smooth);
  width: 100%;
}

.task-modal-action-btn .pixel-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.task-modal-cancel-btn {
  color: var(--color-text-secondary, #666);
}

.task-modal-cancel-btn:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--color-text-primary);
}

.task-modal-delete-btn {
  color: #b91c1c;
}

.task-modal-delete-btn:hover {
  background-color: rgba(185, 28, 28, 0.06);
  color: #991b1b;
}

/* ===== Theme Alignment Rating ===== */
.theme-alignment-rating {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.alignment-option {
  cursor: var(--cursor-pointer);
}

.alignment-option .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}

.alignment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-card-white);
  opacity: 0.45;
  transition: opacity var(--duration-quick) var(--easing-smooth),
              border-color var(--duration-quick) var(--easing-smooth),
              background var(--duration-quick) var(--easing-smooth);
}

.alignment-btn .pixel-icon {
  width: 18px;
  height: 18px;
}

/* Hover: preview the level's color */
.alignment-level-1:hover { opacity: 0.85; border-color: #ef4444; background: rgba(239, 68, 68, 0.08); }
.alignment-level-1:hover .pixel-icon { filter: invert(29%) sepia(96%) saturate(3000%) hue-rotate(350deg) brightness(97%); }
.alignment-level-2:hover { opacity: 0.85; border-color: #eab308; background: rgba(234, 179, 8, 0.08); }
.alignment-level-2:hover .pixel-icon { filter: invert(75%) sepia(60%) saturate(600%) hue-rotate(10deg) brightness(100%); }
.alignment-level-3:hover { opacity: 0.85; border-color: #22c55e; background: rgba(34, 197, 94, 0.08); }
.alignment-level-3:hover .pixel-icon { filter: invert(55%) sepia(60%) saturate(500%) hue-rotate(100deg) brightness(95%); }

/* Active (selected): filled color */
.alignment-btn.active { opacity: 1; }
.alignment-level-1.active { border-color: #ef4444; background: rgba(239, 68, 68, 0.12); }
.alignment-level-1.active .pixel-icon { filter: invert(29%) sepia(96%) saturate(3000%) hue-rotate(350deg) brightness(97%); }
.alignment-level-2.active { border-color: #eab308; background: rgba(234, 179, 8, 0.12); }
.alignment-level-2.active .pixel-icon { filter: invert(75%) sepia(60%) saturate(600%) hue-rotate(10deg) brightness(100%); }
.alignment-level-3.active { border-color: #22c55e; background: rgba(34, 197, 94, 0.12); }
.alignment-level-3.active .pixel-icon { filter: invert(55%) sepia(60%) saturate(500%) hue-rotate(100deg) brightness(95%); }

.alignment-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  opacity: 0.35;
  cursor: var(--cursor-pointer);
  margin-left: var(--spacing-xs);
  transition: opacity var(--duration-quick) var(--easing-smooth);
}

.alignment-clear:hover {
  opacity: 0.8;
}

.alignment-clear .pixel-icon {
  width: 14px;
  height: 14px;
}

/* ===== Theme Intention Hint (Task Modal) ===== */
.intention-hint-block {
  font-family: var(--font-body);
  font-size: 0.82rem;
  background-color: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.intention-hint-trigger {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  cursor: var(--cursor-pointer);
  list-style: none;
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  user-select: none;
}

.intention-hint-trigger::-webkit-details-marker {
  display: none;
}

.intention-hint-trigger .pixel-icon {
  width: 13px;
  height: 13px;
  opacity: 0.55;
  flex-shrink: 0;
}

.intention-hint-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
}

.intention-hint-block[open] .intention-hint-chevron {
  transform: rotate(90deg);
}

.intention-hint-content {
  padding-top: var(--spacing-xs);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  border-top: 1px solid var(--color-border);
  margin-top: var(--spacing-xs);
}

.intention-hint-text {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--color-text-primary);
  margin: 0;
  font-style: italic;
}

.intention-compass-label {
  font-style: normal;
}

.intention-hint-signal {
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0;
}

.intention-hint-label {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.intention-hint-aligned {
  color: #15803d;
}

.intention-hint-misaligned {
  color: #b91c1c;
}

/* ===== Necessary Pill Toggle (Task Modal) ===== */
.necessary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px dashed var(--color-border);
  border-radius: 999px;
  cursor: var(--cursor-pointer);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  background: transparent;
  transition: var(--transition-base);
  user-select: none;
}

.necessary-pill:hover {
  border-color: #ea580c;
  color: #ea580c;
  background: rgba(234, 88, 12, 0.06);
}

.necessary-pill .pixel-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  transition: var(--transition-base);
}

.necessary-pill:hover .pixel-icon {
  opacity: 0.8;
  filter: invert(42%) sepia(90%) saturate(1400%) hue-rotate(360deg) brightness(92%);
}

.necessary-pill.active {
  border-style: solid;
  border-color: #ea580c;
  color: #c2410c;
  background: rgba(234, 88, 12, 0.1);
}

.necessary-pill.active .pixel-icon {
  opacity: 1;
  filter: invert(42%) sepia(90%) saturate(1400%) hue-rotate(360deg) brightness(92%);
}

/* ===== Necessary Badge (Task Card) ===== */
.necessary-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: var(--spacing-xs);
}

.necessary-badge .pixel-icon {
  width: 13px;
  height: 13px;
  opacity: 0.85;
  filter: invert(52%) sepia(94%) saturate(1800%) hue-rotate(346deg) brightness(98%);
}

/* Fully aligned task star indicator */
.aligned-star {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: var(--spacing-xs);
}

.aligned-star .pixel-icon {
  width: 14px;
  height: 14px;
  filter: invert(16%) sepia(50%) saturate(3000%) hue-rotate(255deg) brightness(80%) drop-shadow(0 0 0px rgba(128, 90, 213, 0));
  animation: star-shimmer 3s ease-in-out infinite;
}

@keyframes star-shimmer {
  0%, 100% { opacity: 0.7; transform: scale(1); filter: invert(16%) sepia(50%) saturate(3000%) hue-rotate(255deg) brightness(80%) drop-shadow(0 0 0px rgba(128, 90, 213, 0)); }
  50% { opacity: 1; transform: scale(1.15); filter: invert(16%) sepia(50%) saturate(3000%) hue-rotate(255deg) brightness(80%) drop-shadow(0 0 3px rgba(128, 90, 213, 0.6)); }
}

/* Stagger stars so they twinkle at different times.
   Target the parent wrapper elements (month-task-row on dashboard,
   focus-task-card on focus page) since task-item-wrapper is always
   the sole child of its parent and nth-child would never match 2n+. */
.month-task-row:nth-child(2n) .aligned-star .pixel-icon,
.focus-task-card:nth-child(2n) .aligned-star .pixel-icon { animation-delay: -1.1s; animation-duration: 3.4s; }
.month-task-row:nth-child(3n) .aligned-star .pixel-icon,
.focus-task-card:nth-child(3n) .aligned-star .pixel-icon { animation-delay: -0.4s; animation-duration: 2.7s; }
.month-task-row:nth-child(4n) .aligned-star .pixel-icon,
.focus-task-card:nth-child(4n) .aligned-star .pixel-icon { animation-delay: -2.3s; animation-duration: 3.8s; }
.month-task-row:nth-child(5n) .aligned-star .pixel-icon,
.focus-task-card:nth-child(5n) .aligned-star .pixel-icon { animation-delay: -1.7s; animation-duration: 2.5s; }
.month-task-row:nth-child(7n) .aligned-star .pixel-icon,
.focus-task-card:nth-child(7n) .aligned-star .pixel-icon { animation-delay: -0.8s; animation-duration: 3.1s; }

/* ===== Alignment Visual Indicators (Fade & Shine) ===== */

/* Not Aligned — muted task name text */
.task-alignment-1 .task-name,
.task-alignment-1 .task-name-link {
  color: #999 !important;
}

/* Unrated — tiny hollow dot indicator */
.unrated-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: var(--spacing-xs);
  width: 14px;
  height: 14px;
  position: relative;
  cursor: var(--cursor-default);
}

.unrated-indicator::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border: 1px solid #ccc;
  border-radius: 50%;
}

/* Tooltip for unrated indicator (matches deadline-countdown pattern) */
.unrated-indicator::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  z-index: 100;
}

.unrated-indicator:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Prevent alignment styling on completed tasks */
.task-completed.task-alignment-1 .task-name,
.task-completed.task-alignment-1 .task-name-link {
  color: inherit !important;
}

.task-modal-description-display {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

.task-modal-description-text {
  flex: 1;
  min-width: 0;
  min-height: 4rem;
  padding: var(--spacing-sm);
  line-height: 1.6;
  color: var(--color-text-primary);
  overflow-x: hidden;
}

/* Fix icon centering */
.task-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

@media (max-width: 767px) {
  .task-modal-container {
    overflow-y: auto;
  }

  .task-modal-left {
    overflow-y: visible;
  }

  .task-modal-header {
    position: sticky;
    top: calc(-1 * var(--spacing-md));
    z-index: 10;
    background-color: var(--color-card-white);
    padding-top: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    margin-top: calc(-1 * var(--spacing-md));
    margin-bottom: 0;
    gap: var(--spacing-sm);
  }

  .task-modal-header-top {
    width: 100%;
  }

  .task-modal-name-row {
    width: 100%;
  }

  .task-modal-content {
    flex: initial;
    min-height: initial;
  }

  .task-modal-body {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-sm) !important;
    flex: initial;
    min-height: initial;
  }

  .task-name-edit-form {
    width: 100%;
  }

  /* Undo description scroll containment on mobile (whole modal scrolls instead) */
  .task-modal-left > .form-field,
  .task-modal-left .category-form.marksmith-editor-wrapper,
  .task-modal-left .category-form.marksmith-editor-wrapper > form,
  .task-modal-left .marksmith-editor-wrapper .marksmith {
    flex: initial;
    min-height: initial;
  }

  .task-modal-left .marksmith-textarea {
    field-sizing: content !important;
    overflow-y: visible;
    min-height: 200px;
  }

  .task-modal-left .task-modal-description-display {
    flex: initial;
    overflow-y: visible;
  }
}

/* Tablet Devices (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .page-content {
    padding: var(--spacing-lg);
  }

  .dashboard {
    padding: var(--spacing-lg);
  }

  .categories-grid {
    gap: var(--spacing-md);
  }

  .category-card {
    min-width: 300px;
    max-width: 320px;
  }

  .category-card.category-card--recurring {
    min-width: 280px;
    max-width: 300px;
  }
}

/* Desktop (1024px and above) */
@media (min-width: 1024px) {
  .page-content {
    padding: var(--spacing-xl);
  }

  .dashboard {
    padding: var(--spacing-xl);
  }

  .categories-grid {
    gap: var(--spacing-lg);
  }

  .category-card {
    min-width: 420px;
    max-width: 420px;
  }
}

.task-name-link {
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}

.task-name-link:hover .task-name {
  text-decoration: underline;
}

/* ===== Task Search and Filter Styles ===== */

/* Search Widget */
.task-search-widget {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.6rem;
  background-color: var(--color-card-white);
  border-radius: var(--radius-sm);
  min-height: 44px;
  height: 44px;
  width: 280px;
}

.task-search-widget .search-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

/* Override global input[type="text"] styles for search input */
.task-search-widget .task-search-input,
.task-search-widget .task-search-input:focus {
  flex: 1;
  border: none !important;
  background: transparent !important;
  font-size: 0.85rem;
  font-family: var(--font-body);
  color: var(--color-text-primary);
  min-width: 0;
  padding: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  line-height: 1.2;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0 !important;
  transform: none !important;
  width: auto;
}

.task-search-input::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.7;
}

.task-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.1rem;
  cursor: var(--cursor-pointer);
  opacity: 0.6;
  transition: all var(--duration-normal) var(--easing-smooth);
}

.task-search-clear:hover {
  opacity: 1;
  transform: scale(1.1);
}

.task-search-clear .pixel-icon {
  width: 14px;
  height: 14px;
}

/* Filter Buttons Container */
.task-filter-buttons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Filter Button Base */
.btn-filter {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.4rem 0.6rem;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  cursor: var(--cursor-pointer);
  min-height: 44px;
  transition: background-color var(--duration-normal) var(--easing-smooth), transform var(--duration-normal) var(--easing-smooth), opacity var(--duration-normal) var(--easing-smooth);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-filter:hover {
    background-color: #f5f5f5;
    transform: scale(1.05);
  }

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

/* Filter Button States: Include (show only) — pastel green */
.btn-filter.filter-include {
  background-color: #d4edda;
  color: var(--color-text-primary);
}

/* Filter Button States: Exclude (hide matching) — pastel red */
.btn-filter.filter-exclude {
  background-color: #f8d7da;
  color: var(--color-text-primary);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-filter.filter-include:hover,
  .btn-filter.filter-exclude:hover {
    opacity: 0.85;
    transform: scale(1.05);
  }
}

/* Toolbar Row Container - Desktop: inline, Mobile: stacked */
.toolbar-row {
  display: contents; /* On desktop, children flow directly into parent flex */
}

/* Mobile Responsive: Search and Filter */
@media (max-width: 768px) {
  /* Make categories-actions a column layout on mobile */
  .categories-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  /* Toolbar rows become visible flex containers on mobile */
  .toolbar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
  }

  /* Top row: timezone stays compact, search takes remaining space */
  .toolbar-row-top {
    justify-content: flex-start;
  }

  .toolbar-row-top .timezone-widget {
    flex-shrink: 0;
  }

  .toolbar-row-top .task-search-widget {
    flex: 1;
    width: auto;
    min-width: 0;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 0.25rem 0.5rem;
  }


  /* Bottom row: all buttons share space evenly */
  .toolbar-row-bottom {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  .task-search-input::placeholder {
    font-size: 0.8rem;
  }

  .task-filter-buttons {
    display: flex;
    gap: 0.35rem;
  }

  /* Make all toolbar buttons more square and evenly sized on mobile */
  .btn-filter,
  .btn-collapse-all,
  .btn-expand-all,
  .btn-toggle-completed,
  .btn-toggle-cancelled {
    padding: 0.5rem;
    min-height: 40px;
    height: 40px;
    min-width: 40px;
    width: 40px;
    justify-content: center;
  }

  /* Hide text on mobile, show only icons */
  .btn-filter .btn-text {
    display: none;
  }

  .btn-filter .pixel-icon {
    width: 18px;
    height: 18px;
  }
}

/* ===== Subtask Progress Donut ===== */
.subtask-donut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--spacing-xs);
  cursor: var(--cursor-default);
  flex-shrink: 0;
  position: relative;
}

.subtask-donut-svg {
  width: 16px;
  height: 16px;
}

/* Custom tooltip for subtask donut - matches deadline style */
.subtask-donut::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-quick) var(--easing-smooth);
  pointer-events: none;
  z-index: 10;
}

.subtask-donut:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Wrapper span from _show_subtask_donut partial: align correctly in flex rows */
[id^="show-subtask-donut-"] {
  display: inline-flex;
  align-items: center;
}

/* ===== Category Progress Indicator ===== */
.category-progress-wrapper {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.category-progress {
  display: inline-flex;
  align-items: center;
  cursor: var(--cursor-pointer, pointer);
  margin-left: var(--spacing-xs);
  position: relative;
  line-height: 1;
}

.category-progress-svg {
  width: 20px;
  height: 20px;
  display: block;
}

.category-progress-numbers {
  display: inline-flex;
  gap: var(--spacing-xs);
  font-size: 0.75rem;
  align-items: center;
  color: var(--color-text-secondary, #6b7280);
  line-height: 1;
}

.category-progress-stat {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.category-progress-dot {
  font-size: 0.5rem;
  line-height: 1;
}

/* Tooltip for category progress — shown above the indicator */
.category-progress::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  background-color: #1a1a2e;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-quick, 150ms) var(--easing-smooth, ease);
  pointer-events: none;
  z-index: 10;
}

.category-progress:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ===== Markdown Body Styles ===== */
.markdown-body {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-primary);
  overflow-wrap: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-family: var(--font-header);
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  font-weight: 600;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 { font-size: 1em; }

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body p {
  margin-bottom: 0.75em;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5em;
  margin-bottom: 0.75em;
}

.markdown-body li {
  margin-bottom: 0.25em;
}

.markdown-body li:last-child {
  margin-bottom: 0;
}

/* Task list items - use absolute positioning for checkbox (like GitHub) */
.markdown-body .task-list-item {
  list-style: none;
  position: relative;
  margin-left: 0;
  padding-left: 1.5em;
}

/* Position checkbox absolutely to the left */
.markdown-body .task-list-item > .task-list-item-checkbox {
  position: absolute;
  left: 0;
  top: 0.25em;
}

/* Nested task lists - styling and text-decoration context break */
.markdown-body .task-list-item > ul,
.markdown-body .task-list-item > ol {
  margin-top: 0.25em;
  margin-bottom: 0;
  padding-left: 0.5em;
  display: inline-block;
  width: 100%;
  vertical-align: top;
  text-decoration: none;
  color: var(--color-text-primary);
}

.markdown-body .task-list-item-checkbox {
  -webkit-appearance: none;
  appearance: none;
  cursor: var(--cursor-pointer);
  width: 16px;
  height: 16px;
  border: 2px solid #6a737d;
  border-radius: 3px;
  background: transparent;
  vertical-align: middle;
}

.markdown-body .task-list-item-checkbox:checked,
.markdown-body .task-list-item-checkbox[data-state="checked"] {
  background-color: #2188ff;
  border-color: #2188ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M10 3L4.5 8.5L2 6' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-size: 10px 10px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Checked task items - grey out and strikethrough */
.markdown-body .task-list-item:has(> .task-list-item-checkbox:checked),
.markdown-body .task-list-item:has(> .task-list-item-checkbox[data-state="checked"]) {
  color: #999;
  text-decoration: line-through;
}

/* In-progress checkbox: bottom half filled with amber */
.markdown-body .task-list-item-checkbox[data-state="in-progress"] {
  background-image: linear-gradient(to top, #f5a623 50%, transparent 50%);
  border-color: #f5a623;
  background-color: transparent;
}

/* In-progress task items - bold text, no strikethrough */
.markdown-body .task-list-item--in-progress {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

/* Code blocks */
.markdown-body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.875em;
  padding: 0.2em 0.4em;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.markdown-body pre {
  background-color: #f6f8fa;
  border-radius: var(--radius-sm);
  padding: 1em;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  margin-bottom: 0.75em;
}

.markdown-body pre code {
  padding: 0;
  background-color: transparent;
  font-size: 0.85em;
  line-height: 1.5;
}

/* Blockquotes */
.markdown-body blockquote {
  border-left: 4px solid var(--color-border);
  padding-left: 1em;
  margin-left: 0;
  margin-bottom: 0.75em;
  color: var(--color-text-secondary);
}

/* Links */
.markdown-body a {
  color: #2188ff;
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

/* Horizontal rules */
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1em 0;
}

/* Tables */
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0.75em;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--color-border);
  padding: 0.5em 0.75em;
  text-align: left;
}

.markdown-body th {
  background-color: #f6f8fa;
  font-weight: 600;
}

/* Images */
.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* Empty description placeholder */
.task-modal-description-empty {
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ===== Draft Description Styles ===== */

.description-label-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

.description-label-row .icon-link {
  margin-left: auto;
}

.draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: #e67e22;
  background: #fef3e2;
  border: 1px solid #f0c78a;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-weight: normal;
  line-height: 1;
}

.draft-badge .pixel-icon-xs {
  width: 12px;
  height: 12px;
}

.draft-restore-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  background: #fef9e7;
  border: 1px solid #f0c78a;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.draft-restore-message {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-text-primary);
}

.draft-restore-message .pixel-icon-xs {
  width: 14px;
  height: 14px;
}

.draft-restore-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.draft-restore-btn,
.draft-discard-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: var(--cursor-pointer);
  border: 1px solid;
  min-height: 28px;
}

.draft-restore-btn {
  background: #e67e22;
  color: white;
  border-color: #d35400;
}

.draft-restore-btn:hover {
  background: #d35400;
}

.draft-discard-btn {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.draft-discard-btn:hover {
  background: var(--color-border);
}

.draft-save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-left: auto;
}

.draft-save-indicator .pixel-icon-xs {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

.form-actions-left {
  display: flex;
  gap: 0.5rem;
}

/* ===== Marksmith Editor Styles ===== */
.marksmith-editor-wrapper {
  width: 100%;
}

/* Main container styling */
.marksmith-editor-wrapper .marksmith {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--color-card-white);
}

/* Markdown toolbar (Web Component) */
markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background-color: #f6f8fa;
  border-bottom: 1px solid var(--color-border);
}

/* All toolbar buttons and custom elements */
markdown-toolbar md-bold,
markdown-toolbar md-header,
markdown-toolbar md-italic,
markdown-toolbar md-quote,
markdown-toolbar md-code,
markdown-toolbar md-link,
markdown-toolbar md-image,
markdown-toolbar md-unordered-list,
markdown-toolbar md-ordered-list,
markdown-toolbar md-task-list,
markdown-toolbar md-mention,
markdown-toolbar md-strikethrough,
markdown-toolbar [data-md-button] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0.35rem;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: var(--cursor-pointer);
  color: var(--color-text-secondary);
  transition: all var(--duration-quick) var(--easing-smooth);
}

markdown-toolbar md-bold:hover,
markdown-toolbar md-header:hover,
markdown-toolbar md-italic:hover,
markdown-toolbar md-quote:hover,
markdown-toolbar md-code:hover,
markdown-toolbar md-link:hover,
markdown-toolbar md-image:hover,
markdown-toolbar md-unordered-list:hover,
markdown-toolbar md-ordered-list:hover,
markdown-toolbar md-task-list:hover,
markdown-toolbar md-mention:hover,
markdown-toolbar md-strikethrough:hover,
markdown-toolbar [data-md-button]:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: var(--color-text-primary);
}

/* SVG icons inside toolbar buttons */
markdown-toolbar svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: currentColor;
  color: inherit;
}

/* Ensure SVG paths also inherit color */
markdown-toolbar svg path,
markdown-toolbar svg circle,
markdown-toolbar svg rect,
markdown-toolbar svg line,
markdown-toolbar svg polyline,
markdown-toolbar svg polygon {
  fill: currentColor;
  stroke: currentColor;
}

/* Tabs container (Write/Preview) */
.marksmith-editor-wrapper .marksmith-tablist,
.marksmith .tabnav,
[role="tablist"] {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  background-color: #f6f8fa;
  padding: 0;
  margin: 0;
}

/* Tab buttons */
.marksmith-editor-wrapper .marksmith-tab,
.marksmith .tabnav-tab,
[role="tab"] {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.marksmith-editor-wrapper .marksmith-tab[aria-selected="true"],
.marksmith .tabnav-tab.selected,
[role="tab"][aria-selected="true"] {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-text-primary);
  background-color: var(--color-card-white);
}

/* Textarea styling */
.marksmith-editor-wrapper textarea,
.marksmith textarea {
  border: none !important;
  border-radius: 0 !important;
  resize: vertical;
  min-height: 150px;
  width: 100%;
  padding: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
}

.marksmith-editor-wrapper textarea:focus,
.marksmith textarea:focus {
  box-shadow: none !important;
  transform: none !important;
  outline: none;
}

/* Preview panel */
.marksmith-editor-wrapper .marksmith-preview,
.marksmith .preview-content {
  padding: 0.75rem;
  min-height: 150px;
}

/* Form actions spacing after editor */
.marksmith-editor-wrapper .form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* Preview tab styling */
.marksmith-preview-tab {
  /* Tab is now visible for Preview functionality */
}

/* Mobile responsive */
@media (max-width: 768px) {
  markdown-toolbar {
    gap: 0.15rem;
    padding: 0.35rem;
  }

  markdown-toolbar md-bold,
  markdown-toolbar md-header,
  markdown-toolbar md-italic,
  markdown-toolbar md-quote,
  markdown-toolbar md-code,
  markdown-toolbar md-link,
  markdown-toolbar md-image,
  markdown-toolbar md-unordered-list,
  markdown-toolbar md-ordered-list,
  markdown-toolbar md-task-list,
  markdown-toolbar md-mention,
  markdown-toolbar md-strikethrough,
  markdown-toolbar [data-md-button] {
    width: 36px;
    height: 36px;
    padding: 0.4rem;
  }

  markdown-toolbar svg {
    width: 16px;
    height: 16px;
  }

  .marksmith-editor-wrapper textarea,
  .marksmith textarea {
    min-height: 120px;
  }
}

/* ===== Task Links ===== */

/* Links Section in Modal Sidebar */
.task-links-section {
  margin-top: var(--spacing-sm);
}

.task-links-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
}

/* Individual Link Pill */
.task-link-pill {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--color-nav-beige);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-base);
  min-width: 0;
}

.task-link-pill:hover {
  background-color: var(--color-nav-beige-hover);
}

.task-link-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--color-text-primary);
}

.task-link-content:hover {
  text-decoration: none;
}

.task-link-favicon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 2px;
  object-fit: contain;
}

.task-link-favicon-loading {
  opacity: 0.5;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.task-link-domain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.task-link-delete-form {
  display: flex;
  align-items: center;
}

.task-link-delete-btn {
  opacity: 0;
  background: none;
  border: none;
  padding: 2px;
  cursor: var(--cursor-pointer);
  transition: opacity var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-link-delete-btn .pixel-icon {
  width: 14px;
  height: 14px;
}

.task-link-pill:hover .task-link-delete-btn {
  opacity: 0.6;
}

.task-link-pill .task-link-delete-btn:hover {
  opacity: 1;
}

/* Edit link name button */
.task-link-edit-btn {
  opacity: 0;
  pointer-events: none;
  background: none;
  border: none;
  padding: 2px;
  cursor: var(--cursor-pointer);
  transition: opacity var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Touch device: always show action buttons since there's no hover */
@media (hover: none), (pointer: coarse) {
  .task-link-delete-btn,
  .task-link-edit-btn {
    opacity: 0.6;
    pointer-events: auto;
  }
}

.task-link-edit-btn .pixel-icon {
  width: 14px;
  height: 14px;
}

.task-link-pill:hover .task-link-edit-btn,
.task-link-pill:focus-within .task-link-edit-btn {
  opacity: 0.6;
  pointer-events: auto;
}

.task-link-pill .task-link-edit-btn:hover {
  opacity: 1;
}

.task-link-edit-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
}

/* Task link display wrapper */
.task-link-display {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
}

/* Inline title edit mode */
.task-link-edit-mode {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
}

.task-link-title-form {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
}

input.task-link-title-input {
  flex: 1;
  min-width: 0;
  width: auto;
  font-size: 0.85rem;
  font-family: var(--font-body);
  padding: 2px 2px;
  margin: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-primary);
  outline: none;
  box-sizing: border-box;
  min-height: 0;
  height: auto;
  line-height: 1;
}

.task-link-title-input:focus {
  outline: none;
}

.task-link-title-input:focus-visible {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 1px;
}

/* Edit mode buttons are always visible */
.task-link-edit-mode .task-link-edit-btn {
  opacity: 0.7;
  pointer-events: auto;
}

.task-link-edit-mode .task-link-edit-btn:hover {
  opacity: 1;
}

/* Title prompt (keep or update) */
.task-link-prompt .task-link-prompt-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.task-link-prompt-text {
  font-size: 0.85rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.task-link-prompt-actions {
  display: flex;
  gap: var(--spacing-xs);
  flex-shrink: 0;
}

.task-link-prompt-form {
  display: inline;
}

.task-link-prompt-btn {
  font-size: 0.8rem;
  font-family: var(--font-body);
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  background: var(--color-bg-input, #fff);
  color: var(--color-text-primary);
  transition: background-color var(--transition-base);
}

.task-link-prompt-btn:hover {
  background-color: var(--color-nav-beige-hover);
}

/* Add Link Button */
.task-link-form-wrapper {
  margin-top: var(--spacing-xs);
}

.task-link-add-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-body);
  width: 100%;
  transition: all var(--transition-base);
}

.task-link-add-btn:hover {
  border-color: var(--color-text-primary);
  color: var(--color-text-primary);
}

.task-link-add-btn .pixel-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.task-link-input-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

/* Inline form with checkmark/x icons */
.task-link-inline-form {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  background-color: transparent;
}

.task-link-url-input-inline {
  flex: 1;
  padding: 6px 8px !important;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  min-width: 0;
}

.task-link-url-input-inline:focus {
  outline: none;
  border-color: var(--color-text-secondary);
}

.task-link-inline-form .task-form-btn {
  margin-left: 4px;
}

.task-link-error {
  color: #e74c3c;
  font-size: 0.8rem;
  margin-top: 2px;
}

/* Focus View Link Row (single-line layout with truncation) */
.task-item-links-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: nowrap;
  overflow: hidden;
  /* Indent to align with task content (after checkbox: 18px icon + 4px margin) */
  padding-left: calc(0.4rem + 22px);
  margin-top: 2px;
}

.task-link-icons-container {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--spacing-sm);
  overflow: hidden;
  min-width: 0;
}

.task-link-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-base);
  min-width: 0;
  flex: 1 1 0;
}

.task-link-inline:hover {
  color: var(--color-text-primary);
  text-decoration: none;
}

/* Truncate link text with ellipsis */
.task-link-inline span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-link-inline .task-link-favicon-sm {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Icons-only mode: hide text when > 4 links */
.task-link-icons-container.links-icons-only .task-link-inline {
  flex: 0 0 auto;
}

.task-link-icons-container.links-icons-only .task-link-inline span {
  display: none;
}

.task-link-favicon-sm {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  object-fit: contain;
}

/* Error Message for Link Form */
.task-link-input-form .error-message {
  color: #e74c3c;
  font-size: 0.8rem;
  margin-top: -4px;
}
/* ===== Settings Page ===== */

.settings-page {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.settings-title {
  font-family: var(--font-header);
  font-size: 2rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.settings-section {
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.settings-section-title {
  font-family: var(--font-header);
  font-size: 1.25rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--color-border);
}

.settings-section-title .pixel-icon {
  width: 24px;
  height: 24px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.settings-label {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 1rem;
}

.settings-hint {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-md) 0;
}

.settings-input,
.settings-select {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card-white);
  color: var(--color-text-primary);
  transition: border-color var(--transition-base);
  min-height: 44px;
}

.settings-input:focus,
.settings-select:focus {
  outline: none;
  border-color: var(--color-text-primary);
}

.settings-select {
  cursor: var(--cursor-pointer);
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--spacing-md) 0;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--spacing-md);
}

/* Icon Selection */
.icon-options {
  display: flex;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
  margin-top: var(--spacing-sm);
}

.icon-option {
  cursor: var(--cursor-pointer);
}

.icon-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.icon-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border: 3px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  background: var(--color-card-white);
}

.icon-option input[type="radio"]:checked + .icon-preview {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 2px var(--color-text-primary);
}

.icon-option:hover .icon-preview {
  border-color: var(--color-text-secondary);
}

.icon-preview-img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
}

.icon-label {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* Billing Status in Settings */
.settings-billing-status {
  margin-bottom: var(--spacing-lg);
}

.billing-status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.billing-status-badge .pixel-icon {
  width: 16px;
  height: 16px;
}

.billing-status-active {
  background: #d4edda;
  color: #155724;
}

.billing-status-active .pixel-icon {
  filter: invert(24%) sepia(89%) saturate(391%) hue-rotate(88deg) brightness(96%) contrast(87%);
}

.billing-status-trial {
  background: #fff3cd;
  color: #856404;
}

.billing-status-trial .pixel-icon {
  filter: invert(41%) sepia(97%) saturate(397%) hue-rotate(15deg) brightness(93%) contrast(90%);
}

.billing-status-inactive {
  background: #f8d7da;
  color: #721c24;
}

.billing-status-inactive .pixel-icon {
  filter: invert(18%) sepia(95%) saturate(1804%) hue-rotate(340deg) brightness(85%) contrast(91%);
}

.billing-status-details {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.billing-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

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

.billing-status-label {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.billing-status-value {
  font-weight: 500;
  color: var(--color-text-primary);
}

.billing-status-notice {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: var(--spacing-sm);
}

.billing-status-warning {
  background: #fff3cd;
  color: #856404;
}

.billing-status-warning .pixel-icon {
  width: 16px;
  height: 16px;
  filter: invert(41%) sepia(97%) saturate(397%) hue-rotate(15deg) brightness(93%) contrast(90%);
}

/* Primary and Danger Buttons */
.btn-primary {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  border: 2px solid var(--color-text-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  min-height: 44px;
}

.btn-primary .pixel-icon {
  filter: invert(1);
}

.btn-primary:hover {
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 10px 20px;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border: 2px solid var(--color-text-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  min-height: 44px;
}

.btn-secondary:hover {
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.btn-primary:hover .pixel-icon {
  filter: none;
}

.btn-danger {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--color-card-white);
  color: #dc3545;
  border: 2px solid #dc3545;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  min-height: 44px;
}

.btn-danger:hover {
  background-color: #dc3545;
  color: var(--color-card-white);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

/* ===== Integrations Tab ===== */

.integration-card {
  background: var(--color-background-alt, #fafafa);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-md);
}

.integration-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.integration-card-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.integration-card-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.integration-card-logo--spotify {
  background: #1DB954;
  color: white;
}

.integration-card-title {
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 2px 0;
}

.integration-card-description {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

.integration-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.integration-badge--connected {
  background: #d4edda;
  color: #155724;
}

.integration-badge--disconnected {
  background: #e9ecef;
  color: #6c757d;
}

.integration-badge--beta {
  background: #fff3cd;
  color: #856404;
}

.integration-badge--beta .pixel-icon-sm {
  width: 14px;
  height: 14px;
  filter: brightness(0) saturate(100%) invert(38%) sepia(62%) saturate(1000%) hue-rotate(18deg);
}

.integration-badge .pixel-icon-sm {
  width: 14px;
  height: 14px;
}

.integration-badge--connected .pixel-icon-sm {
  filter: invert(25%) sepia(60%) saturate(500%) hue-rotate(100deg) brightness(90%);
}

.integration-card-body {
  border-top: 1px solid var(--color-border);
  padding-top: var(--spacing-md);
}

.integration-account {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.integration-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.integration-avatar--placeholder {
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.integration-account-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.integration-account-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.integration-account-meta {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.integration-account-meta .pixel-icon-sm {
  width: 14px;
  height: 14px;
}

.integration-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  background: #f8f9fa;
  margin-bottom: var(--spacing-md);
}

.integration-notice--info {
  background: #e7f3ff;
  color: #0c5460;
}

.integration-notice--success {
  background: #d4edda;
  color: #155724;
}

.integration-notice--warning {
  background: #fff3cd;
  color: #856404;
}

.integration-notice .pixel-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.integration-import-prompt {
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.integration-import-prompt p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-sm) 0;
}

.integration-import-detail {
  font-size: 0.8rem !important;
  opacity: 0.8;
}

.integration-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.integration-delete-hint {
  width: 100%;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin: 0;
}

.integration-beta-prompt {
  text-align: center;
  padding: var(--spacing-sm) 0;
}

.integration-beta-prompt p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: var(--spacing-sm) 0 var(--spacing-md);
  line-height: 1.5;
}

.integration-beta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff3cd;
  color: #856404;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  border: 2px solid var(--color-text-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  min-height: 44px;
}

.btn-secondary:hover {
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.btn-secondary:hover .pixel-icon {
  filter: invert(1);
}

.btn-text.btn-text--danger,
.btn-text--danger {
  color: #dc3545;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  font-size: 0.85rem;
  font-family: inherit;
  padding: 0;
}

.btn-text.btn-text--danger:hover,
.btn-text--danger:hover {
  color: #c82333;
  text-decoration: underline;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Danger Zone Section */
.settings-section-danger {
  border: 2px solid #dc3545;
}

.settings-section-danger .settings-section-title {
  color: #dc3545;
  border-bottom-color: #dc3545;
}

.settings-section-danger .settings-section-title .pixel-icon {
  filter: invert(27%) sepia(94%) saturate(2932%) hue-rotate(343deg) brightness(91%) contrast(87%);
}

.settings-warning {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-md);
}

/* --- Recurring Tasks (Settings) --- */

.recurring-templates-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.recurring-templates-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.recurring-template-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card-white);
}

.recurring-template-card--paused {
  opacity: 0.6;
}

.recurring-template-info {
  flex: 1;
  min-width: 0;
}

.recurring-template-name {
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.recurring-template-schedule {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.recurring-template-settings {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xs);
  flex-wrap: wrap;
}

.recurring-template-meta {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  background: var(--color-bg-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.recurring-template-actions {
  display: flex;
  gap: var(--spacing-xs);
  flex-shrink: 0;
  align-items: flex-start;
}

.recurring-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recurring-badge--paused {
  background: var(--color-warning-bg, #fef3cd);
  color: var(--color-warning-text, #856404);
}

.recurring-badge--ended {
  background: var(--color-bg-subtle);
  color: var(--color-text-tertiary);
}

.recurring-badge--archived {
  background: var(--color-bg-subtle);
  color: var(--color-text-tertiary);
}

.recurring-template-card--archived {
  opacity: 0.7;
}

.archived-templates-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: var(--spacing-xs) 0;
}

.archived-templates-toggle:hover {
  color: var(--color-text-primary);
}

.archived-templates-toggle .pixel-icon {
  width: 16px;
  height: 16px;
}

.archived-chevron {
  transition: transform 0.2s ease;
}

.archived-templates-list {
  margin-top: var(--spacing-sm);
}

.recurring-empty-state {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
  color: var(--color-text-secondary);
}

.recurring-empty-state .pixel-icon--lg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
  margin-bottom: var(--spacing-sm);
}

.vacation-mode-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.vacation-mode-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-warning-text, #856404);
}

/* Recurrence Builder Form */

.recurrence-frequency-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.settings-input--narrow {
  width: 80px;
}

.settings-select--narrow {
  width: auto;
}

.days-of-week-selector {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.day-toggle {
  cursor: pointer;
}

.day-toggle input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.day-toggle-label {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-card-white);
  transition: all 0.15s ease;
}

.day-toggle input:checked + .day-toggle-label {
  background: var(--color-text-primary);
  color: var(--color-card-white);
  border-color: var(--color-text-primary);
}

.day-toggle input:focus-visible + .day-toggle-label {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
}

.monthly-pattern-selector,
.end-condition-selector,
.generation-mode-selector,
.month-end-selector,
.deadline-mode-selector {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.recurring-form-actions {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  margin-top: var(--spacing-lg);
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  cursor: pointer;
}

/* Pixel-art radio buttons (replace browser default circles) */
.pixel-radio {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}

.pixel-radio input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pixel-radio .pixel-radio-on,
.pixel-radio .pixel-radio-off {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.pixel-radio .pixel-radio-on {
  display: none;
}

.pixel-radio .pixel-radio-off {
  display: inline-block;
}

.pixel-radio input[type="radio"]:checked ~ .pixel-radio-on {
  display: inline-block;
}

.pixel-radio input[type="radio"]:checked ~ .pixel-radio-off {
  display: none;
}

.pixel-radio input[type="radio"]:focus-visible ~ .pixel-radio-on,
.pixel-radio input[type="radio"]:focus-visible ~ .pixel-radio-off {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.radio-option-title {
  display: block;
  font-weight: 500;
  color: var(--color-text-primary);
}

.radio-option-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.settings-textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--spacing-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono, monospace);
  font-size: 0.9rem;
  resize: vertical;
  background: var(--color-card-white);
  color: var(--color-text-primary);
}

.settings-back-link {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.settings-back-link:hover {
  color: var(--color-text-primary);
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--spacing-md) 0;
}

.btn-small {
  font-size: 0.8rem;
  padding: 4px 10px;
  min-height: auto;
}

.btn-danger {
  background: transparent;
  color: #dc3545;
  border: 2px solid #dc3545;
}

.btn-danger:hover {
  background: #dc3545;
  color: white;
}

/* Template Links (in recurring task template form) */
.template-links-section {
  margin-top: var(--spacing-xs);
}

.template-links-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
}

.template-link-pill {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 6px 10px;
  background: var(--color-bg-subtle, #f5f5f5);
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.template-link-pill:hover {
  background: var(--color-border);
}

.template-link-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--color-text-primary);
}

.template-link-favicon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.template-link-domain {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-link-delete-form {
  display: inline;
}

.template-link-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.template-link-pill:hover .template-link-delete-btn,
.template-link-pill:focus-within .template-link-delete-btn {
  opacity: 0.6;
}

.template-link-delete-btn:hover {
  opacity: 1 !important;
}

.template-link-delete-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
}

.template-link-delete-btn .pixel-icon {
  width: 14px;
  height: 14px;
}

.template-link-add-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 8px 12px;
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 100%;
  transition: all 0.15s ease;
}

.template-link-add-btn:hover {
  border-style: solid;
  color: var(--color-text-primary);
  background: var(--color-bg-subtle, #f5f5f5);
}

.template-link-add-btn .pixel-icon {
  width: 16px;
  height: 16px;
}

.template-link-input-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.template-link-inline-form {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.template-link-url-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  background: var(--color-card-white);
  color: var(--color-text-primary);
}

.template-link-url-input:focus {
  outline: none;
  border-color: var(--color-text-primary);
}

.template-link-error {
  color: #dc3545;
  font-size: 0.8rem;
}

/* Template link display wrapper */
.template-link-display {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
}

/* Template link favicon with border-radius and object-fit */
.template-link-favicon {
  border-radius: 2px;
  object-fit: contain;
}

/* Edit link name button */
.template-link-edit-btn {
  opacity: 0;
  pointer-events: none;
  background: none;
  border: none;
  padding: 2px;
  cursor: var(--cursor-pointer);
  transition: opacity var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-link-edit-btn .pixel-icon {
  width: 14px;
  height: 14px;
}

/* Touch device: always show action buttons since there's no hover */
@media (hover: none), (pointer: coarse) {
  .template-link-delete-btn,
  .template-link-edit-btn {
    opacity: 0.6;
    pointer-events: auto;
  }
}

.template-link-pill:hover .template-link-edit-btn,
.template-link-pill:focus-within .template-link-edit-btn {
  opacity: 0.6;
  pointer-events: auto;
}

.template-link-pill .template-link-edit-btn:hover {
  opacity: 1;
}

.template-link-edit-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
}

/* Edit mode */
.template-link-edit-mode {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
}

.template-link-title-form {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
}

input.template-link-title-input {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 2px 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  background: transparent;
  color: var(--color-text-primary);
  line-height: 1.2;
  text-decoration: none;
}

.template-link-title-input:focus {
  outline: none;
}

.template-link-title-input:focus-visible {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 1px;
}

/* Edit mode buttons are always visible */
.template-link-edit-mode .template-link-edit-btn {
  opacity: 0.7;
  pointer-events: auto;
}

.template-link-edit-mode .template-link-edit-btn:hover {
  opacity: 1;
}

/* Template Content Editor — edit page task content section */
.template-content-editor {
  background: var(--color-card-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.template-content-editor .settings-section-title {
  margin-bottom: var(--spacing-xs);
}

.template-content-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.template-content-form .form-field label {
  font-family: var(--font-header);
  font-size: 0.95rem;
  font-weight: 600;
  display: block;
  margin-bottom: var(--spacing-xs);
}

.template-content-editor .template-links-section {
  margin-top: var(--spacing-md);
}

.template-propagation-section {
  border-top: 1px solid var(--color-border);
  padding-top: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.template-propagation-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xs);
}

.template-propagation-overwrite {
  margin-left: var(--spacing-lg);
}

/* Recurring category visual distinction on dashboard */
.category-card--recurring,
.category-card--recurring:hover {
  background: #f7f5ee;
  border: none;
  box-shadow: none;
  max-width: 360px;
  min-width: 360px;
}

.category-card--recurring .reorder-arrows {
  display: none;
}

.category-card--recurring .category-header .pixel-icon--recurring {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  margin-left: 4px;
}

@media (max-width: 768px) {
  .category-card--recurring,
  .category-card--recurring:hover {
    min-width: 100%;
    max-width: 100%;
  }

  .recurring-template-card {
    flex-direction: column;
  }

  .recurring-template-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .recurrence-frequency-row {
    flex-wrap: wrap;
  }

  .days-of-week-selector {
    gap: 4px;
  }

  .day-toggle-label {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .settings-page {
    padding: var(--spacing-md);
  }

  .settings-title {
    font-size: 1.5rem;
  }

  .settings-section {
    padding: var(--spacing-md);
  }

  .icon-options {
    justify-content: center;
  }

  .icon-preview-img {
    width: 48px;
    height: 48px;
  }
}

/* ===== Settings Page Tabs ===== */

.settings-tabs {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-lg);
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  padding: var(--spacing-xs);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.settings-tab {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-sm) var(--spacing-xs);
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--duration-normal) var(--easing-smooth);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-tab .pixel-icon {
  width: 18px;
  height: 18px;
  transition: transform var(--duration-normal) var(--easing-bounce);
}

.settings-tab:hover {
  color: var(--color-text-primary);
  background-color: rgba(248, 187, 217, 0.1);
}

.settings-tab:hover .pixel-icon {
  transform: scale(1.15);
}

.settings-tab.active {
  color: var(--color-text-primary);
  background: linear-gradient(135deg, rgba(248, 187, 217, 0.15), rgba(255, 182, 193, 0.15));
  border-color: #f8bbd9;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(248, 187, 217, 0.2);
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

/* ===== Billing: Card on File ===== */

.billing-subsection {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
}

.billing-subsection-title {
  font-family: var(--font-header);
  font-size: 1rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.billing-subsection-title .pixel-icon {
  width: 20px;
  height: 20px;
}

.billing-card-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-md);
  background: #fafafa;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.billing-card-brand {
  font-weight: 700;
  color: var(--color-text-primary);
  min-width: 60px;
  font-size: 0.9rem;
}

.billing-card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.billing-card-number {
  font-family: monospace;
  color: var(--color-text-primary);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.billing-card-expiry {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

/* ===== Billing: Invoice History ===== */

.billing-invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.billing-invoice-table th {
  text-align: left;
  padding: var(--spacing-sm);
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 2px solid var(--color-border);
}

.billing-invoice-table td {
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.billing-invoice-table tr:last-child td {
  border-bottom: none;
}

.billing-invoice-status {
  display: inline-block;
  padding: 2px var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.billing-invoice-status--paid {
  background: #d4edda;
  color: #155724;
}

.billing-invoice-status--open {
  background: #fff3cd;
  color: #856404;
}

.billing-invoice-status--void,
.billing-invoice-status--uncollectible {
  background: #f8d7da;
  color: #721c24;
}

.billing-invoice-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--transition-base);
}

.billing-invoice-link:hover {
  color: var(--color-text-primary);
}

.billing-invoice-link .pixel-icon {
  width: 14px;
  height: 14px;
}

/* ===== Billing: Payment Method Actions ===== */

.billing-card-actions {
  margin-left: auto;
  flex-shrink: 0;
}

.btn-secondary--small {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.8rem;
}

/* ===== Billing: Upcoming Invoice ===== */

.billing-detail--discount .billing-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: #2e7d32;
}

.billing-value--discount {
  color: #2e7d32;
  font-weight: bold;
}

.billing-detail--total {
  border-top: 2px solid var(--color-border);
  margin-top: var(--spacing-xs);
  padding-top: var(--spacing-sm);
}

.billing-detail--total .billing-label {
  font-weight: 600;
  color: var(--color-text-primary);
}

.billing-detail--total .billing-value {
  font-size: 1.05rem;
}

.pixel-icon--small {
  width: 14px;
  height: 14px;
}

/* Settings Tabs Mobile */
@media (max-width: 600px) {
  .settings-tabs {
    gap: var(--spacing-xs);
    padding: 4px;
  }

  .settings-tab {
    font-size: 0.8rem;
    padding: var(--spacing-xs) var(--spacing-xs);
    flex-direction: column;
    gap: 2px;
  }

  .billing-invoice-table {
    font-size: 0.8rem;
  }

  .billing-invoice-table th,
  .billing-invoice-table td {
    padding: var(--spacing-xs);
  }

  .billing-card-info {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }
}

/* ===== Pricing Page ===== */

.pricing-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

.pricing-hero {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.pricing-hero h1 {
  font-family: var(--font-header);
  font-size: 2.2rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
}

.pricing-subtitle {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.pricing-trial-notice,
.pricing-subscribed-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px dashed rgba(255, 182, 193, 0.6);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-xl);
}

.pricing-trial-notice {
  border: 2px dashed #f0ad4e;
}

.pricing-subscribed-notice {
  border: 2px solid #5cb85c;
}

.pricing-subscribed-notice .btn-secondary-small {
  margin-left: var(--spacing-md);
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.85rem;
}

/* Pricing cards grid - simple layout, no glass (glass is on parent .landing-section) */
.pricing-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-xl);
  margin-bottom: 5rem;
}

.pricing-card {
  background: var(--color-card-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  position: relative;
}

.pricing-card-featured {
  border: 2px solid #f8bbd9;
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(248, 187, 217, 0.25);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: linear-gradient(135deg, #f8bbd9, #ffb6c1);
  color: #fff;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
}

.pricing-card-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.pricing-card-header h2 {
  font-family: var(--font-header);
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xs);
}

.pricing-description {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.pricing-amount {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.pricing-amount .price {
  font-family: var(--font-header);
  font-size: 3rem;
  color: var(--color-text-primary);
}

.pricing-amount .period {
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.pricing-savings {
  font-size: 0.85rem;
  color: #5cb85c;
  margin-top: var(--spacing-sm);
}

.price-slider-container {
  margin-top: var(--spacing-md);
  padding: 0 var(--spacing-sm);
}

.price-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #e0e0e0, #f8bbd9);
  appearance: none;
  cursor: var(--cursor-pointer);
}

.price-slider::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f8bbd9;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: var(--cursor-pointer);
  transition: transform var(--transition-base);
}

.price-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.price-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--spacing-xl) 0;
  flex-grow: 1;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid #f0f0f0;
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-features .pixel-icon {
  width: 16px;
  height: 16px;
  filter: invert(48%) sepia(79%) saturate(522%) hue-rotate(86deg) brightness(90%) contrast(86%);
}

.pricing-form {
  margin-top: auto;
}

.cta-button-featured {
  background: linear-gradient(135deg, #f8bbd9, #ffb6c1);
}

/* Pricing content sections - no glass, matches landing page content sections */
.pricing-hero,
.pricing-content-section,
.pricing-faq-section,
.pricing-closing {
  text-align: center;
  margin-bottom: 5rem;
}

.pricing-hero h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.pricing-subtitle {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--color-text-primary);
  max-width: 600px;
  margin: 0 auto;
}

.pricing-content-section h2,
.pricing-faq-section h2,
.pricing-closing h2 {
  font-size: 2rem;
  font-family: var(--font-header);
  margin-bottom: 1.5rem;
  color: var(--color-text-primary);
}

.pricing-content-section p,
.pricing-closing p {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.pricing-closing {
  margin-bottom: 0;
}

.pricing-inspiration {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

/* FAQ grid - solid cards like landing-feature */
.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.faq-item {
  background-color: var(--color-card-white);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  text-align: left;
}

@media (prefers-reduced-motion: no-preference) {
  .faq-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }
}

.faq-item h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--color-text-primary);
}

.faq-item p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
  color: var(--color-text-primary);
  font-size: 0.95rem;
}

.faq-item p:last-child {
  margin-bottom: 0;
}

.indie-values {
  margin: var(--spacing-lg) auto;
  max-width: 400px;
}

.indie-values p {
  margin-bottom: var(--spacing-sm);
}

.pricing-closing .cta-button {
  margin-top: 2rem;
  margin-bottom: var(--spacing-lg);
}

.pricing-closing-note {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .pricing-cards-grid {
    grid-template-columns: 1fr;
  }

  .pricing-card-featured {
    transform: none;
  }

  .faq-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Trial Banner ===== */

.trial-banner {
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.9), rgba(248, 187, 217, 0.9));
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  margin: 0 auto var(--spacing-lg);
  padding: var(--spacing-sm) var(--spacing-md);
  width: fit-content;
}

.trial-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.trial-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: #333;
}

.trial-info .pixel-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0);
}

.trial-text {
  font-size: 0.95rem;
}

.trial-cta {
  background: #fff;
  border: 1px solid transparent;
  color: #333;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-sm);
  font-weight: bold;
  text-decoration: none;
  transition: transform var(--transition-base), box-shadow var(--transition-base), color var(--transition-base);
}

.trial-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

@media (max-width: 600px) {
  .trial-banner-content {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== Email Confirmation Banner ===== */

.confirmation-banner {
  background: linear-gradient(135deg, rgba(255, 223, 128, 0.95), rgba(255, 193, 7, 0.9));
  border-radius: var(--radius-md);
  margin: 0 auto var(--spacing-lg);
  padding: var(--spacing-sm) var(--spacing-md);
  width: fit-content;
}

.confirmation-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.confirmation-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: #333;
}

.confirmation-info .pixel-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0);
}

.confirmation-text {
  font-size: 0.95rem;
}

.confirmation-text small {
  opacity: 0.8;
}

.confirmation-cta {
  background: #fff;
  color: #333;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-weight: bold;
  font-size: 0.95rem;
  cursor: var(--cursor-pointer);
  transition: transform var(--transition-base), box-shadow var(--transition-base), color var(--transition-base);
}

.confirmation-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  color: #ffc107;
}

@media (max-width: 600px) {
  .confirmation-banner-content {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== Monthly Recap Banner ===== */

.recap-banner {
  background: linear-gradient(135deg, rgba(196, 181, 253, 0.9), rgba(167, 139, 250, 0.85));
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  margin: 0 auto var(--spacing-lg);
  padding: var(--spacing-sm) var(--spacing-md);
  width: fit-content;
  transition: opacity var(--duration-normal) var(--easing-smooth),
              transform var(--duration-normal) var(--easing-smooth);
}

.recap-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.recap-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: #333;
}

.recap-info .pixel-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0);
}

.recap-text {
  font-size: 0.95rem;
}

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

.recap-cta {
  background: #fff;
  border: 1px solid transparent;
  color: #333;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-sm);
  font-weight: bold;
  text-decoration: none;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.recap-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.recap-close {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: var(--spacing-xs);
  opacity: 0.5;
  transition: opacity var(--duration-normal) var(--easing-smooth),
              transform var(--duration-normal) var(--easing-smooth);
}

.recap-close:hover {
  opacity: 1;
  transform: scale(1.15);
}

.recap-close:active {
  transform: scale(0.9);
  transition: transform var(--duration-quick) var(--easing-bounce);
}

.recap-close .pixel-icon {
  width: 16px;
  height: 16px;
  filter: brightness(0);
}

@media (max-width: 600px) {
  .recap-banner-content {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== Billing Page ===== */

.billing-page {
  max-width: 700px;
  margin: 0 auto;
  padding: var(--spacing-xl);
}

.billing-title {
  font-family: var(--font-header);
  font-size: 2rem;
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.billing-section {
  background: var(--color-card-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.billing-section-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1.2rem;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid #f8bbd9;
}

.billing-section-title .pixel-icon {
  width: 24px;
  height: 24px;
}

.billing-plan-card {
  padding: var(--spacing-lg);
  background: #fafafa;
  border-radius: var(--radius-md);
}

.billing-plan-status {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-weight: bold;
  margin-bottom: var(--spacing-lg);
}

.billing-plan-active {
  background: #d4edda;
  color: #155724;
}

.billing-plan-active .pixel-icon {
  filter: invert(27%) sepia(94%) saturate(532%) hue-rotate(86deg) brightness(96%) contrast(93%);
}

.billing-plan-trial {
  background: #fff3cd;
  color: #856404;
}

.billing-plan-trial .pixel-icon {
  filter: invert(41%) sepia(98%) saturate(524%) hue-rotate(11deg) brightness(93%) contrast(91%);
}

.billing-plan-inactive {
  background: #f0eeeb;
  color: #666666;
}

.billing-plan-inactive .pixel-icon {
  filter: invert(40%) sepia(10%) saturate(200%) hue-rotate(340deg) brightness(90%) contrast(90%);
}

.billing-plan-warning {
  background: #fff3cd;
  color: #856404;
}

.billing-plan-warning .pixel-icon {
  filter: invert(41%) sepia(98%) saturate(524%) hue-rotate(11deg) brightness(93%) contrast(91%);
}

.billing-manage-section {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
}

.billing-manage-title {
  font-family: var(--font-header);
  font-size: 1rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.billing-manage-title .pixel-icon {
  width: 20px;
  height: 20px;
}

.billing-plan-details {
  margin-bottom: var(--spacing-lg);
}

.billing-detail {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.billing-detail:last-child {
  border-bottom: none;
}

.billing-label {
  color: var(--color-text-secondary);
}

.billing-value {
  font-weight: bold;
}

.billing-notice {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  margin-top: var(--spacing-md);
}

.billing-notice-warning {
  background: #fff3cd;
  color: #856404;
}

.billing-trial-progress {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--spacing-md);
}

.billing-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #f8bbd9, #ffb6c1);
  border-radius: 4px;
}

.billing-hint {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-md);
}

.billing-description {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color var(--transition-base);
  background: none;
  border: none;
  padding: 0;
  cursor: var(--cursor-pointer);
  font-family: inherit;
  font-size: inherit;
}

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

.btn-text-danger {
  color: #dc3545;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  font-size: inherit;
  font-family: inherit;
  padding: 0;
}

.btn-text-danger:hover {
  color: #c82333;
  text-decoration: underline;
}

.billing-cancel-section {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
}

/* Plan change section for annual subscribers */
.billing-change-plan {
  margin-bottom: var(--spacing-lg);
}

.plan-change-slider {
  background: var(--color-background-alt);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-md);
}

.plan-change-current {
  margin-bottom: var(--spacing-md);
  color: var(--color-text-muted);
}

.plan-change-current strong {
  color: var(--color-text);
}

.plan-change-new {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.plan-change-new label {
  color: var(--color-text);
  font-weight: 500;
}

.plan-change-new select {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-background);
  color: var(--color-text);
  font-size: 1rem;
  cursor: var(--cursor-pointer);
}

.plan-change-new select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.plan-change-form {
  display: flex;
  justify-content: flex-end;
}

.plan-change-form input[type="submit"]:disabled {
  opacity: 0.5;
  cursor: var(--cursor-not-allowed);
}

@media (max-width: 768px) {
  .plan-change-new {
    flex-direction: column;
    align-items: stretch;
  }

  .plan-change-form {
    justify-content: stretch;
  }

  .plan-change-form input[type="submit"] {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .billing-page {
    padding: var(--spacing-md);
  }

  .billing-section {
    padding: var(--spacing-md);
  }
}

/* =============================================
   DARK MODE THEME
   Complete dark mode styles that mirror light mode
   ============================================= */

/* ----- Dark Mode Seasonal Backgrounds ----- */
body.theme-dark.season-spring {
  background-image: url("/backgrounds/background-spring-dark.png");
}

body.theme-dark.season-summer {
  background-image: url("/backgrounds/background-summer-dark.png");
}

body.theme-dark.season-fall {
  background-image: url("/backgrounds/background-fall-dark.png");
}

body.theme-dark.season-winter {
  background-image: url("/backgrounds/background-winter-dark.png");
}

/* ----- Day Cycle Mode Backgrounds ----- */
/* Sunrise backgrounds (6-9 AM) - light theme */
body.time-sunrise.season-spring {
  background-image: url("/backgrounds/background-spring-sunrise.png");
}
body.time-sunrise.season-summer {
  background-image: url("/backgrounds/background-summer-sunrise.png");
}
body.time-sunrise.season-fall {
  background-image: url("/backgrounds/background-fall-sunrise.png");
}
body.time-sunrise.season-winter {
  background-image: url("/backgrounds/background-winter-sunrise.png");
}

/* Day backgrounds (9 AM-5 PM) - light theme, use existing light backgrounds */
body.time-day.season-spring {
  background-image: url("/backgrounds/background-spring-summer.png");
}
body.time-day.season-summer {
  background-image: url("/backgrounds/background-summer.png");
}
body.time-day.season-fall {
  background-image: url("/backgrounds/background-fall.png");
}
body.time-day.season-winter {
  background-image: url("/backgrounds/background-winter.png");
}

/* Sunset backgrounds (5-8 PM) - dark theme */
body.time-sunset.season-spring {
  background-image: url("/backgrounds/background-spring-sunset.png");
}
body.time-sunset.season-summer {
  background-image: url("/backgrounds/background-summer-sunset.png");
}
body.time-sunset.season-fall {
  background-image: url("/backgrounds/background-fall-sunset.png");
}
body.time-sunset.season-winter {
  background-image: url("/backgrounds/background-winter-sunset.png");
}

/* Night backgrounds (8 PM-6 AM) - dark theme, use existing dark backgrounds */
body.time-night.season-spring {
  background-image: url("/backgrounds/background-spring-dark.png");
}
body.time-night.season-summer {
  background-image: url("/backgrounds/background-summer-dark.png");
}
body.time-night.season-fall {
  background-image: url("/backgrounds/background-fall-dark.png");
}
body.time-night.season-winter {
  background-image: url("/backgrounds/background-winter-dark.png");
}

/* ----- Dark Mode CSS Variable Overrides ----- */
body.theme-dark {
  --color-nav-beige: #2a2a3e;
  --color-nav-beige-hover: #363650;
  --color-card-white: #2a2a3e;
  --color-text-primary: #f5f5f5;
  --color-text-secondary: #a0a0b0;
  --color-border: #3d3d52;
  --scrollbar-thumb: #4a4a5e;

  /* Cursors (white for dark backgrounds) */
  --cursor-default: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="8" y="6" width="2" height="2" fill="%231f2237"/><rect x="8" y="8" width="4" height="2" fill="%231f2237"/><rect x="8" y="10" width="6" height="2" fill="%231f2237"/><rect x="8" y="12" width="8" height="2" fill="%231f2237"/><rect x="8" y="14" width="4" height="2" fill="%231f2237"/><rect x="8" y="16" width="2" height="2" fill="%231f2237"/><rect x="6" y="4" width="2" height="16" fill="white"/><rect x="8" y="4" width="2" height="2" fill="white"/><rect x="10" y="6" width="2" height="2" fill="white"/><rect x="12" y="8" width="2" height="2" fill="white"/><rect x="14" y="10" width="2" height="2" fill="white"/><rect x="16" y="12" width="2" height="2" fill="white"/><rect x="8" y="18" width="2" height="2" fill="white"/><rect x="10" y="16" width="2" height="2" fill="white"/><rect x="12" y="14" width="6" height="2" fill="white"/></svg>') 7 5, auto;
  --cursor-click: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="11" y="9" width="2" height="2" fill="%231f2237"/><rect x="11" y="11" width="4" height="2" fill="%231f2237"/><rect x="11" y="13" width="6" height="2" fill="%231f2237"/><rect x="11" y="15" width="8" height="2" fill="%231f2237"/><rect x="11" y="17" width="4" height="2" fill="%231f2237"/><rect x="11" y="19" width="2" height="2" fill="%231f2237"/><rect x="9" y="7" width="2" height="16" fill="white"/><rect x="11" y="7" width="2" height="2" fill="white"/><rect x="13" y="9" width="2" height="2" fill="white"/><rect x="15" y="11" width="2" height="2" fill="white"/><rect x="17" y="13" width="2" height="2" fill="white"/><rect x="19" y="15" width="2" height="2" fill="white"/><rect x="11" y="21" width="2" height="2" fill="white"/><rect x="13" y="19" width="2" height="2" fill="white"/><rect x="15" y="17" width="6" height="2" fill="white"/><rect x="15" y="5" width="2" height="2" fill="white"/><rect x="5" y="10" width="2" height="2" fill="white"/><rect x="5" y="5" width="2" height="2" fill="white"/><rect x="9" y="1" width="2" height="4" fill="white"/><rect x="3" y="3" width="2" height="2" fill="white"/><rect x="3" y="12" width="2" height="2" fill="white"/><rect x="17" y="3" width="2" height="2" fill="white"/></svg>') 10 8, auto;
  --cursor-grab: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="11" y="3" width="2" height="8" fill="%231f2237"/><rect x="7" y="5" width="2" height="6" fill="%231f2237"/><rect x="15" y="5" width="2" height="6" fill="%231f2237"/><rect x="19" y="7" width="2" height="4" fill="%231f2237"/><rect x="7" y="11" width="10" height="1" fill="%231f2237"/><rect x="19" y="11" width="2" height="1" fill="%231f2237"/><rect x="7" y="12" width="14" height="1" fill="%231f2237"/><rect x="3" y="13" width="2" height="2" fill="%231f2237"/><rect x="7" y="13" width="14" height="2" fill="%231f2237"/><rect x="3" y="15" width="4" height="2" fill="%231f2237"/><rect x="9" y="15" width="12" height="2" fill="%231f2237"/><rect x="5" y="17" width="16" height="2" fill="%231f2237"/><rect x="7" y="19" width="12" height="2" fill="%231f2237"/><rect x="21" y="7" width="2" height="5" fill="white"/><rect x="17" y="5" width="2" height="7" fill="white"/><rect x="13" y="3" width="2" height="8" fill="white"/><rect x="9" y="3" width="2" height="8" fill="white"/><rect x="5" y="5" width="2" height="8" fill="white"/><rect x="19" y="5" width="2" height="2" fill="white"/><rect x="15" y="3" width="2" height="2" fill="white"/><rect x="11" y="1" width="2" height="2" fill="white"/><rect x="7" y="3" width="2" height="2" fill="white"/><rect x="3" y="11" width="2" height="2" fill="white"/><rect x="1" y="13" width="2" height="2" fill="white"/><rect x="1" y="15" width="2" height="2" fill="white"/><rect x="3" y="17" width="2" height="2" fill="white"/><rect x="5" y="19" width="2" height="2" fill="white"/><rect x="7" y="21" width="12" height="2" fill="white"/><rect x="19" y="19" width="2" height="2" fill="white"/><rect x="21" y="12" width="2" height="7" fill="white"/><rect x="5" y="13" width="2" height="2" fill="white"/><rect x="7" y="15" width="2" height="2" fill="white"/></svg>') 12 12, grab;
  --cursor-grabbing: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="7" y="7" width="2" height="2" fill="%231f2237"/><rect x="11" y="7" width="2" height="2" fill="%231f2237"/><rect x="15" y="7" width="2" height="2" fill="%231f2237"/><rect x="7" y="9" width="2" height="2" fill="%231f2237"/><rect x="11" y="9" width="2" height="2" fill="%231f2237"/><rect x="15" y="9" width="2" height="2" fill="%231f2237"/><rect x="19" y="9" width="2" height="2" fill="%231f2237"/><rect x="7" y="11" width="14" height="2" fill="%231f2237"/><rect x="3" y="13" width="2" height="2" fill="%231f2237"/><rect x="7" y="13" width="14" height="2" fill="%231f2237"/><rect x="3" y="15" width="4" height="2" fill="%231f2237"/><rect x="9" y="15" width="12" height="2" fill="%231f2237"/><rect x="5" y="17" width="16" height="2" fill="%231f2237"/><rect x="7" y="19" width="12" height="2" fill="%231f2237"/><rect x="17" y="7" width="2" height="4" fill="white"/><rect x="13" y="5" width="2" height="6" fill="white"/><rect x="9" y="5" width="2" height="6" fill="white"/><rect x="5" y="7" width="2" height="6" fill="white"/><rect x="19" y="7" width="2" height="2" fill="white"/><rect x="15" y="5" width="2" height="2" fill="white"/><rect x="11" y="5" width="2" height="2" fill="white"/><rect x="7" y="5" width="2" height="2" fill="white"/><rect x="3" y="11" width="2" height="2" fill="white"/><rect x="1" y="13" width="2" height="2" fill="white"/><rect x="1" y="15" width="2" height="2" fill="white"/><rect x="3" y="17" width="2" height="2" fill="white"/><rect x="5" y="19" width="2" height="2" fill="white"/><rect x="7" y="21" width="12" height="2" fill="white"/><rect x="19" y="19" width="2" height="2" fill="white"/><rect x="21" y="9" width="2" height="10" fill="white"/><rect x="5" y="13" width="2" height="2" fill="white"/><rect x="7" y="15" width="2" height="2" fill="white"/></svg>') 12 12, grabbing;
  --cursor-text: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="9" y="2" width="6" height="2" fill="%231f2237"/><rect x="11" y="4" width="2" height="2" fill="%231f2237"/><rect x="11" y="18" width="2" height="2" fill="%231f2237"/><rect x="9" y="20" width="6" height="2" fill="%231f2237"/><rect x="5" y="2" width="4" height="2" fill="white"/><rect x="5" y="20" width="4" height="2" fill="white"/><rect x="9" y="4" width="2" height="2" fill="white"/><rect x="9" y="18" width="2" height="2" fill="white"/><rect x="13" y="4" width="2" height="2" fill="white"/><rect x="13" y="18" width="2" height="2" fill="white"/><rect x="15" y="2" width="4" height="2" fill="white"/><rect x="15" y="20" width="4" height="2" fill="white"/><rect x="11" y="6" width="2" height="12" fill="white"/></svg>') 12 12, text;
  --cursor-pointer: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="7" y="3" width="2" height="6" fill="%231f2237"/><rect x="11" y="9" width="2" height="2" fill="%231f2237"/><rect x="15" y="9" width="2" height="2" fill="%231f2237"/><rect x="7" y="11" width="10" height="1" fill="%231f2237"/><rect x="19" y="11" width="2" height="1" fill="%231f2237"/><rect x="7" y="12" width="14" height="1" fill="%231f2237"/><rect x="3" y="13" width="2" height="2" fill="%231f2237"/><rect x="7" y="13" width="14" height="2" fill="%231f2237"/><rect x="3" y="15" width="4" height="2" fill="%231f2237"/><rect x="9" y="15" width="12" height="2" fill="%231f2237"/><rect x="5" y="17" width="16" height="2" fill="%231f2237"/><rect x="7" y="19" width="12" height="2" fill="%231f2237"/><rect x="17" y="9" width="2" height="3" fill="white"/><rect x="13" y="7" width="2" height="4" fill="white"/><rect x="9" y="3" width="2" height="8" fill="white"/><rect x="5" y="3" width="2" height="10" fill="white"/><rect x="19" y="9" width="2" height="2" fill="white"/><rect x="15" y="7" width="2" height="2" fill="white"/><rect x="11" y="7" width="2" height="2" fill="white"/><rect x="7" y="1" width="2" height="2" fill="white"/><rect x="3" y="11" width="2" height="2" fill="white"/><rect x="1" y="13" width="2" height="2" fill="white"/><rect x="1" y="15" width="2" height="2" fill="white"/><rect x="3" y="17" width="2" height="2" fill="white"/><rect x="5" y="19" width="2" height="2" fill="white"/><rect x="7" y="21" width="12" height="2" fill="white"/><rect x="19" y="19" width="2" height="2" fill="white"/><rect x="21" y="11" width="2" height="8" fill="white"/><rect x="5" y="13" width="2" height="2" fill="white"/><rect x="7" y="15" width="2" height="2" fill="white"/></svg>') 8 2, pointer;
  --cursor-not-allowed: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="7" y="5" width="2" height="2" fill="%231f2237"/><rect x="13" y="12" width="2" height="1" fill="%231f2237"/><rect x="13" y="13" width="4" height="1" fill="%231f2237"/><rect x="11" y="14" width="6" height="1" fill="%231f2237"/><rect x="11" y="15" width="2" height="2" fill="%231f2237"/><rect x="11" y="17" width="4" height="3" fill="%231f2237"/><rect x="5" y="3" width="4" height="2" fill="white"/><rect x="5" y="5" width="2" height="9" fill="white"/><rect x="9" y="5" width="2" height="2" fill="white"/><rect x="13" y="9" width="2" height="2" fill="white"/><rect x="15" y="11" width="2" height="2" fill="white"/><rect x="17" y="13" width="2" height="4" fill="white"/><rect x="13" y="15" width="4" height="2" fill="white"/><rect x="9" y="16" width="2" height="2" fill="white"/><rect x="5" y="18" width="6" height="2" fill="white"/><rect x="11" y="20" width="4" height="2" fill="white"/><rect x="15" y="17" width="2" height="3" fill="white"/><rect x="3" y="20" width="2" height="2" fill="white"/><rect x="5" y="18" width="2" height="2" fill="white"/><rect x="7" y="16" width="2" height="2" fill="white"/><rect x="9" y="14" width="2" height="2" fill="white"/><rect x="11" y="12" width="2" height="2" fill="white"/><rect x="13" y="10" width="2" height="2" fill="white"/><rect x="15" y="8" width="2" height="2" fill="white"/><rect x="17" y="6" width="2" height="2" fill="white"/><rect x="19" y="4" width="2" height="2" fill="white"/></svg>') 6 4, not-allowed;
  --color-text-tertiary: #8a8a9a;
  --color-bg-subtle: #1e1e2e;
  --color-primary: #f5f5f5;
  --color-shadow: rgba(0, 0, 0, 0.4);
}

/* ----- Dark Mode Navigation ----- */
body.theme-dark .user-nav {
  background-color: rgba(30, 30, 46, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .nav-link {
  color: #f5f5f5;
}

body.theme-dark .nav-link:hover,
body.theme-dark .nav-link.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

body.theme-dark .btn-logout,
body.theme-dark .btn-logout button {
  color: #f5f5f5;
}

body.theme-dark .btn-logout:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .nav-brand {
  color: #f5f5f5;
}

/* ----- Dark Mode Cloud Cards ----- */
body.theme-dark .theme-bar,
body.theme-dark .month-cloud {
  background-color: #2a2a3e;
}

body.theme-dark .theme-bar::before,
body.theme-dark .theme-bar::after,
body.theme-dark .month-cloud::before,
body.theme-dark .month-cloud::after {
  background: #2a2a3e;
}

/* ----- Dark Mode Glass Effects ----- */
body.theme-dark .devise-form-container,
body.theme-dark .landing-section {
  background: rgba(30, 30, 46, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ----- Dark Mode Form Inputs ----- */
body.theme-dark input[type="email"],
body.theme-dark input[type="password"],
body.theme-dark input[type="text"],
body.theme-dark input[type="number"],
body.theme-dark input[type="search"],
body.theme-dark textarea {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark input[type="email"]:focus,
body.theme-dark input[type="password"]:focus,
body.theme-dark input[type="text"]:focus,
body.theme-dark input[type="number"]:focus,
body.theme-dark input[type="search"]:focus,
body.theme-dark textarea:focus {
  border-color: #a0a0b0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

body.theme-dark input[type="email"]::placeholder,
body.theme-dark input[type="password"]::placeholder,
body.theme-dark input[type="text"]::placeholder,
body.theme-dark input[type="number"]::placeholder,
body.theme-dark input[type="search"]::placeholder,
body.theme-dark textarea::placeholder {
  color: #6a6a7a;
}

/* ----- Dark Mode Checkboxes & Radios ----- */
body.theme-dark input[type="checkbox"],
body.theme-dark input[type="radio"] {
  accent-color: #f5f5f5;
}

body.theme-dark .pixel-radio .pixel-radio-on,
body.theme-dark .pixel-radio .pixel-radio-off {
  filter: invert(1) brightness(0.85);
}

body.theme-dark .remember-me-field input[type="checkbox"] {
  border-color: #6a6a7a;
}

body.theme-dark .remember-me-field input[type="checkbox"]:checked {
  background-color: #f5f5f5;
  border-color: #f5f5f5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M10 3L4.5 8.5L2 6' stroke='%231e1e2e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

/* Dark mode subtask checkboxes in descriptions */
body.theme-dark .markdown-body .task-list-item-checkbox {
  border-color: #6a6a7a;
}

body.theme-dark .markdown-body .task-list-item-checkbox:checked,
body.theme-dark .markdown-body .task-list-item-checkbox[data-state="checked"] {
  background-color: #f5f5f5;
  border-color: #f5f5f5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M10 3L4.5 8.5L2 6' stroke='%231e1e2e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

body.theme-dark .marksmith-rendered-body .task-list-item > .task-list-item-checkbox,
body.theme-dark .marksmith-rendered-body .task-list-item > input[type="checkbox"] {
  border-color: #6a6a7a !important;
}

body.theme-dark .marksmith-rendered-body .task-list-item > .task-list-item-checkbox:checked,
body.theme-dark .marksmith-rendered-body .task-list-item > input[type="checkbox"]:checked,
body.theme-dark .marksmith-rendered-body .task-list-item > .task-list-item-checkbox[data-state="checked"],
body.theme-dark .marksmith-rendered-body .task-list-item > input[type="checkbox"][data-state="checked"] {
  background-color: #f5f5f5 !important;
  border-color: #f5f5f5 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M10 3L4.5 8.5L2 6' stroke='%231e1e2e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") !important;
}

/* Dark mode: in-progress checkbox */
body.theme-dark .markdown-body .task-list-item-checkbox[data-state="in-progress"] {
  background-image: linear-gradient(to top, #f5a623 50%, transparent 50%);
  border-color: #f5a623;
  background-color: transparent;
}

body.theme-dark .markdown-body .task-list-item--in-progress {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

body.theme-dark .marksmith-rendered-body .task-list-item > .task-list-item-checkbox[data-state="in-progress"],
body.theme-dark .marksmith-rendered-body .task-list-item > input[type="checkbox"][data-state="in-progress"] {
  background-image: linear-gradient(to top, #f5a623 50%, transparent 50%) !important;
  border-color: #f5a623 !important;
  background-color: transparent !important;
}

body.theme-dark .marksmith-rendered-body .task-list-item--in-progress {
  font-weight: 600 !important;
  color: inherit !important;
  text-decoration: none !important;
}

/* ----- Dark Mode Buttons ----- */
body.theme-dark .btn,
body.theme-dark input[type="submit"] {
  background-color: #1e1e2e;
  color: #f5f5f5;
  border: 2px solid #f5f5f5;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

body.theme-dark .btn:hover,
body.theme-dark input[type="submit"]:hover {
  background-color: #f5f5f5;
  color: #1e1e2e;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}

body.theme-dark .btn:active,
body.theme-dark input[type="submit"]:active {
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

body.theme-dark .btn-primary {
  background-color: #f8a5c2;
  color: #1e1e2e;
  border-color: #f8a5c2;
}

body.theme-dark .btn-primary:hover {
  background-color: #f78fb3;
  border-color: #f78fb3;
  color: #1e1e2e;
}

body.theme-dark .btn-primary .pixel-icon {
  filter: none;
}

body.theme-dark .btn-secondary {
  background-color: #2a2a3e;
  color: #f5f5f5;
  border-color: #f5f5f5;
}

body.theme-dark .btn-secondary:hover {
  background-color: #363650;
  color: #f5f5f5;
}

body.theme-dark .btn-danger {
  background-color: #7f1d1d;
  color: #fca5a5;
  border-color: #7f1d1d;
}

body.theme-dark .btn-danger:hover {
  background-color: #991b1b;
  border-color: #991b1b;
}

body.theme-dark .cta-button {
  background-color: #f8a5c2;
  color: #1e1e2e;
  box-shadow: 0 2px 12px rgba(248, 165, 194, 0.3);
}

body.theme-dark .cta-button:hover {
  background-color: #f78fb3;
  box-shadow: 0 4px 20px rgba(247, 143, 179, 0.4);
}

/* ----- Dark Mode Flash Messages ----- */
body.theme-dark .notice {
  background-color: #1a3a2a;
  color: #86efac;
  border: 1px solid #22543d;
}

body.theme-dark .alert {
  background-color: #3a1a1a;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

body.theme-dark .notice .flash-action-link {
  color: #86efac;
}

body.theme-dark .notice .flash-action-link:hover {
  color: #bbf7d0;
}

/* ----- Dark Mode Error States ----- */
body.theme-dark #error_explanation {
  background-color: #3a1a1a;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

body.theme-dark .field_with_errors input {
  border-color: #f87171;
}

body.theme-dark .error-message,
body.theme-dark .inline-errors {
  background: #3a1a1a;
  color: #fca5a5;
}

/* ----- Dark Mode Deadline Colors ----- */
body.theme-dark .deadline-normal { color: #4ade80; }
body.theme-dark .deadline-soon { color: #fbbf24; }
body.theme-dark .deadline-urgent { color: #fb923c; }
body.theme-dark .deadline-today { color: #f87171; }
body.theme-dark .deadline-overdue { color: #f87171; }

/* ----- Dark Mode Pixel Icons ----- */
body.theme-dark .pixel-icon {
  filter: invert(1);
}

body.theme-dark .task-link-favicon[src$="link.svg"],
body.theme-dark .task-link-favicon-sm[src$="link.svg"] {
  filter: invert(1);
}

/* ----- Dark Mode Category Cards ----- */
body.theme-dark .category-card {
  background: #2a2a3e;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

body.theme-dark .category-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

body.theme-dark .category-header {
  color: #f5f5f5;
}

body.theme-dark .category-name {
  color: #f5f5f5;
}

body.theme-dark .category-card--recurring,
body.theme-dark .category-card--recurring:hover {
  background: #1e1e2e;
  border: none;
  box-shadow: none;
}

/* ----- Dark Mode Task Items ----- */
body.theme-dark .task-item {
  background: transparent;
  border-color: transparent;
  color: #f5f5f5;
}

body.theme-dark .task-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.theme-dark .task-checkbox-label {
  color: #f5f5f5;
}

body.theme-dark .task-title {
  color: #f5f5f5;
}

body.theme-dark .task-title-input {
  background-color: transparent;
  color: #f5f5f5;
}

body.theme-dark .task-title-input:focus {
  background-color: #1e1e2e;
}

body.theme-dark .task-description {
  color: #a0a0b0;
}

body.theme-dark .task-meta {
  color: #a0a0b0;
}

body.theme-dark .task-actions button {
  color: #a0a0b0;
}

body.theme-dark .task-actions button:hover {
  color: #f5f5f5;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Task inline edit */
body.theme-dark .task-inline-edit {
  background-color: #1e1e2e;
  color: #f5f5f5;
}

body.theme-dark .task-inline-edit:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Task drag and drop */
body.theme-dark .task-item.dragging {
  background: #363650;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

body.theme-dark .task-drag-placeholder {
  background: #1e1e2e;
  border-color: #4a4a5e;
}

/* ----- Dark Mode Subtasks ----- */
body.theme-dark .subtask-item {
  background: #1e1e2e;
  border-color: #3d3d52;
}

body.theme-dark .subtask-item:hover {
  background: #2a2a3e;
}

body.theme-dark .subtask-input {
  background-color: transparent;
  color: #f5f5f5;
}

body.theme-dark .subtask-input:focus {
  background-color: #1e1e2e;
}

/* ----- Dark Mode Select Dropdowns ----- */
body.theme-dark select,
body.theme-dark .settings-select {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark select:focus,
body.theme-dark .settings-select:focus {
  border-color: #a0a0b0;
}

body.theme-dark select option {
  background-color: #1e1e2e;
  color: #f5f5f5;
}

/* ----- Dark Mode Empty States ----- */
body.theme-dark .empty-category-message,
body.theme-dark .empty-state,
body.theme-dark .no-tasks-message {
  color: #f5f5f5;
}

body.theme-dark .empty-state-hint {
  color: #f5f5f5;
}

/* ----- Dark Mode Links ----- */
body.theme-dark a {
  color: #f5f5f5;
}

body.theme-dark a:hover {
  color: #a0a0b0;
}

body.theme-dark .devise-links a {
  color: #f5f5f5;
}

body.theme-dark .devise-links a:hover {
  color: #a0a0b0;
}

body.theme-dark .devise-links span {
  color: #a0a0b0;
}

body.theme-dark .link-separator {
  color: #a0a0b0;
}

/* Blue accent links in dark mode */
body.theme-dark .link-primary,
body.theme-dark .markdown-body a {
  color: #7db8ff;
}

body.theme-dark .link-primary:hover,
body.theme-dark .markdown-body a:hover {
  color: #a8d1ff;
}

/* ----- Dark Mode Dividers ----- */
body.theme-dark hr,
body.theme-dark .settings-divider,
body.theme-dark .divider {
  border-color: #3d3d52;
}

/* ----- Dark Mode Settings Page ----- */
body.theme-dark .settings-page {
  color: #f5f5f5;
}

body.theme-dark .settings-title {
  color: #f5f5f5;
}

body.theme-dark .settings-section {
  background-color: #2a2a3e;
}

body.theme-dark .settings-section-title {
  color: #f5f5f5;
}

body.theme-dark .settings-label {
  color: #f5f5f5;
}

body.theme-dark .settings-hint {
  color: #a0a0b0;
}

body.theme-dark .settings-input {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .settings-input:focus {
  border-color: #a0a0b0;
}

body.theme-dark .settings-warning {
  color: #fca5a5;
}

body.theme-dark .settings-section-danger {
  border-color: #7f1d1d;
}

/* Integration card dark theme */
body.theme-dark .integration-card {
  background-color: #1e1e2e;
  border-color: #3d3d52;
}

body.theme-dark .integration-card-body {
  border-top-color: #3d3d52;
}

body.theme-dark .integration-badge--connected {
  background-color: #1a3a2a;
  color: #86efac;
}

body.theme-dark .integration-badge--disconnected {
  background-color: #2a2a3e;
  color: #a0a0b0;
}

body.theme-dark .integration-badge--beta {
  background-color: #3a2e1a;
  color: #fcd34d;
}

body.theme-dark .integration-beta-badge {
  background-color: #3a2e1a;
  color: #fcd34d;
}

body.theme-dark .integration-avatar--placeholder {
  background: #3d3d52;
}

body.theme-dark .integration-notice {
  background: #2a2a3e;
  color: #a0a0b0;
}

body.theme-dark .integration-notice--info {
  background-color: #1a2a3a;
  color: #93c5fd;
}

body.theme-dark .integration-notice--success {
  background-color: #1a3a2a;
  color: #86efac;
}

body.theme-dark .integration-notice--warning {
  background-color: #3a3a1a;
  color: #fcd34d;
}

body.theme-dark .integration-import-prompt {
  background: #2a2a3e;
}

body.theme-dark .integration-import-prompt p {
  color: #a0a0b0;
}

body.theme-dark .integration-account-meta .pixel-icon-sm {
  filter: invert(70%) sepia(0%) saturate(0%) brightness(120%);
}

body.theme-dark .integration-badge--connected .pixel-icon-sm {
  filter: invert(76%) sepia(40%) saturate(400%) hue-rotate(100deg) brightness(105%);
}

body.theme-dark .btn-text--danger {
  color: #fca5a5;
}

body.theme-dark .btn-text--danger:hover {
  color: #f87171;
}

/* Icon options in settings */
body.theme-dark .icon-option {
  border-color: #3d3d52;
}

body.theme-dark .icon-option:hover {
  border-color: #a0a0b0;
}

body.theme-dark .icon-option:has(input:checked) {
  border-color: #f5f5f5;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Billing status */
body.theme-dark .billing-status-badge {
  background-color: #1e1e2e;
}

body.theme-dark .billing-status-active {
  background-color: #1a3a2a;
  color: #86efac;
}

body.theme-dark .billing-status-trial {
  background-color: #2a2a1a;
  color: #fbbf24;
}

body.theme-dark .billing-status-inactive {
  background-color: #3a1a1a;
  color: #fca5a5;
}

body.theme-dark .billing-status-details {
  color: #a0a0b0;
}

body.theme-dark .billing-status-label {
  color: #a0a0b0;
}

body.theme-dark .billing-status-value {
  color: #f5f5f5;
}

body.theme-dark .billing-status-warning {
  background-color: #3a2a1a;
  color: #fbbf24;
}

/* ----- Dark Mode Landing Page ----- */
body.theme-dark .landing-title,
body.theme-dark .landing-subtitle {
  color: #f5f5f5;
}

body.theme-dark .landing-description {
  color: #a0a0b0;
}

body.theme-dark .feature-card {
  background-color: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.theme-dark .feature-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.theme-dark .feature-title {
  color: #f5f5f5;
}

body.theme-dark .feature-description {
  color: #a0a0b0;
}

/* ----- Dark Mode Pricing Page ----- */
body.theme-dark .pricing-card {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.theme-dark .pricing-card-featured {
  border: 2px solid rgba(168, 85, 247, 0.5);
}

body.theme-dark .pricing-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.theme-dark .pricing-card-header h2 {
  color: #f5f5f5;
}

body.theme-dark .pricing-amount .price {
  color: #f5f5f5;
}

body.theme-dark .pricing-features li {
  color: #f5f5f5;
  border-bottom-color: #3d3d52;
}

body.theme-dark .faq-item {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.theme-dark .faq-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.theme-dark .faq-item h3 {
  color: #f5f5f5;
}

body.theme-dark .faq-item p {
  color: #f5f5f5;
}

/* Price slider */
body.theme-dark .price-slider-track {
  background-color: #3d3d52;
}

body.theme-dark .price-slider-fill {
  background-color: #f8a5c2;
}

/* ----- Dark Mode Billing Page ----- */
body.theme-dark .billing-page {
  color: #f5f5f5;
}

body.theme-dark .billing-section {
  background-color: #2a2a3e;
}

body.theme-dark .billing-title {
  color: #f5f5f5;
}

body.theme-dark .billing-label {
  color: #a0a0b0;
}

body.theme-dark .billing-value {
  color: #f5f5f5;
}

body.theme-dark .billing-section-title {
  border-bottom-color: #3d3d52;
}

body.theme-dark .billing-plan-card {
  background-color: #1e1e2e;
}

body.theme-dark .billing-plan-active {
  background-color: #1a3a2a;
  color: #86efac;
}

body.theme-dark .billing-plan-active .pixel-icon {
  filter: invert(70%) sepia(50%) saturate(400%) hue-rotate(86deg) brightness(110%);
}

body.theme-dark .billing-plan-trial {
  background-color: #2a2a1a;
  color: #fbbf24;
}

body.theme-dark .billing-plan-trial .pixel-icon {
  filter: invert(80%) sepia(60%) saturate(600%) hue-rotate(10deg) brightness(110%);
}

body.theme-dark .billing-plan-warning {
  background-color: #2a2a1a;
  color: #fbbf24;
}

body.theme-dark .billing-plan-warning .pixel-icon {
  filter: invert(80%) sepia(60%) saturate(400%) hue-rotate(11deg) brightness(100%) contrast(95%);
}

body.theme-dark .billing-manage-section {
  border-top-color: #3d3d52;
}

body.theme-dark .billing-manage-title {
  color: #f5f5f5;
}

body.theme-dark .billing-plan-inactive {
  background-color: #2a2a28;
  color: #b0aca8;
}

body.theme-dark .billing-plan-inactive .pixel-icon {
  filter: invert(70%) sepia(10%) saturate(200%) hue-rotate(340deg) brightness(100%) contrast(90%);
}

body.theme-dark .billing-notice-warning {
  background-color: #3a2a1a;
  color: #fbbf24;
}

body.theme-dark .billing-notice-warning .pixel-icon {
  filter: invert(80%) sepia(60%) saturate(600%) hue-rotate(10deg) brightness(110%);
}

body.theme-dark .billing-trial-progress {
  background-color: #3d3d52;
}

body.theme-dark .plan-change-slider {
  background-color: #1e1e2e;
}

body.theme-dark .plan-change-new select {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

/* ----- Dark Mode: Settings Tabs ----- */
body.theme-dark .settings-tabs {
  background-color: #1e1e2e;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.theme-dark .settings-tab {
  color: #6a6a7a;
}

body.theme-dark .settings-tab:hover {
  color: #f5f5f5;
  background-color: rgba(248, 165, 194, 0.08);
}

body.theme-dark .settings-tab.active {
  color: #f5f5f5;
  background: linear-gradient(135deg, rgba(248, 165, 194, 0.15), rgba(255, 182, 193, 0.1));
  border-color: #f8a5c2;
  box-shadow: 0 2px 12px rgba(248, 165, 194, 0.15);
}

/* ----- Dark Mode: Card on File ----- */
body.theme-dark .billing-subsection {
  border-top-color: #3d3d52;
}

body.theme-dark .billing-subsection-title {
  color: #f5f5f5;
}

body.theme-dark .billing-card-info {
  background-color: #1e1e2e;
  border-color: #3d3d52;
}

body.theme-dark .billing-card-brand {
  color: #f5f5f5;
}

body.theme-dark .billing-card-number {
  color: #f5f5f5;
}

body.theme-dark .billing-card-expiry {
  color: #a0a0b0;
}

/* ----- Dark Mode: Invoice Table ----- */
body.theme-dark .billing-invoice-table th {
  color: #a0a0b0;
  border-bottom-color: #3d3d52;
}

body.theme-dark .billing-invoice-table td {
  color: #f5f5f5;
  border-bottom-color: #3d3d52;
}

body.theme-dark .billing-invoice-status--paid {
  background-color: #1a3a2a;
  color: #86efac;
}

body.theme-dark .billing-invoice-status--open {
  background-color: #2a2a1a;
  color: #fbbf24;
}

body.theme-dark .billing-invoice-status--void,
body.theme-dark .billing-invoice-status--uncollectible {
  background-color: #3a1a1a;
  color: #fca5a5;
}

body.theme-dark .billing-invoice-link {
  color: #a0a0b0;
}

body.theme-dark .billing-invoice-link:hover {
  color: #f5f5f5;
}

/* ----- Dark Mode: Upcoming Invoice ----- */
body.theme-dark .billing-detail--discount .billing-label {
  color: #86efac;
}

body.theme-dark .billing-value--discount {
  color: #86efac;
}

body.theme-dark .billing-detail--total {
  border-top-color: #3d3d52;
}

body.theme-dark .billing-detail--total .billing-label {
  color: #f5f5f5;
}

/* ----- Dark Mode Lightbox/Modal ----- */
body.theme-dark .lightbox-overlay {
  background-color: rgba(0, 0, 0, 0.95);
}

body.theme-dark .lightbox-content {
  background-color: #2a2a3e;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

body.theme-dark .lightbox-close {
  color: #f5f5f5;
  background-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .lightbox-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* ----- Dark Mode Theme Bar Content ----- */
body.theme-dark .theme-display {
  color: #f5f5f5;
}

body.theme-dark .theme-title {
  color: #f5f5f5;
}

body.theme-dark .theme-description {
  color: #a0a0b0;
}

body.theme-dark .theme-edit-btn {
  color: #a0a0b0;
}

body.theme-dark .theme-edit-btn:hover {
  color: #f5f5f5;
}

/* Theme edit form */
body.theme-dark .theme-edit-container {
  background-color: #2a2a3e;
}

body.theme-dark .theme-edit-input {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .theme-edit-input:focus {
  border-color: #a0a0b0;
}

/* ----- Dark Mode Theme Intention ----- */
body.theme-dark .intention-popover {
  background-color: #2a2a3e;
  border-color: #3d3d52;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body.theme-dark .intention-popover-text {
  color: #d0d0e0;
}

body.theme-dark .intention-popover-signal {
  color: #a0a0b0;
}

body.theme-dark .intention-modal-card {
  background-color: #2a2a3e;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.theme-dark .intention-modal-title {
  color: #f5f5f5;
}

body.theme-dark .intention-hint-block {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: #3d3d52;
}

body.theme-dark .intention-hint-trigger {
  color: #a0a0b0;
}

body.theme-dark .intention-hint-content {
  border-top-color: #3d3d52;
}

body.theme-dark .intention-hint-text {
  color: #d0d0e0;
}

body.theme-dark .intention-hint-aligned {
  color: #4ade80;
}

body.theme-dark .intention-hint-misaligned {
  color: #f87171;
}

body.theme-dark .intention-label {
  color: #a0a0b8;
}

body.theme-dark .intention-label-icon {
  filter: invert(1);
  opacity: 0.4;
}

body.theme-dark .intention-theme-name-input {
  color: #f5f5f5;
  border-bottom-color: #4a4a5e;
}

body.theme-dark .intention-theme-name-input:focus {
  border-bottom-color: #8a8aa0;
}

body.theme-dark .intention-theme-name-input::placeholder {
  color: #5a5a70;
}

body.theme-dark .intention-save-btn {
  background-color: #e8e8f0;
  color: #1e1e2e;
}

body.theme-dark .intention-save-btn:hover {
  background-color: #f5f5f5;
}

body.theme-dark .intention-save-btn .pixel-icon {
  filter: none;
}

/* ----- Dark Mode Month Cloud Content ----- */
body.theme-dark .month-title {
  color: #f5f5f5;
}

body.theme-dark .month-date {
  color: #a0a0b0;
}

/* ----- Dark Mode Sync Status ----- */
body.theme-dark .sync-status {
  color: #a0a0b0;
}

body.theme-dark .sync-status-synced {
  color: #4ade80;
}

body.theme-dark .sync-status-syncing {
  color: #fbbf24;
}

body.theme-dark .sync-status-error {
  color: #f87171;
}

/* ----- Dark Mode Search/Filter ----- */
body.theme-dark .task-search-widget {
  background-color: #1e1e2e;
  border-color: #3d3d52;
}

body.theme-dark .task-search-input {
  background-color: transparent;
  color: #f5f5f5;
}

body.theme-dark .task-search-input::placeholder {
  color: #6a6a7a;
}

body.theme-dark .task-search-clear {
  color: #a0a0b0;
}

body.theme-dark .task-search-clear:hover {
  color: #f5f5f5;
}

body.theme-dark .filter-btn {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .filter-btn:hover {
  background-color: #2a2a3e;
  border-color: #a0a0b0;
}

body.theme-dark .filter-btn.active {
  background-color: #f5f5f5;
  color: #1e1e2e;
}

/* ----- Dark Mode Filter Buttons (btn-filter) ----- */
body.theme-dark .btn-filter {
  background-color: #1e1e2e;
  color: #f5f5f5;
}

body.theme-dark .btn-filter:hover {
  background-color: #2a2a3e;
  color: #f5f5f5;
}

body.theme-dark .btn-filter.filter-include {
  background-color: #1a3a2a;
  color: #f5f5f5;
}

body.theme-dark .btn-filter.filter-exclude {
  background-color: #8b2020;
  color: #f5f5f5;
}

@media (prefers-reduced-motion: no-preference) {
  body.theme-dark .btn-filter.filter-include:hover {
    opacity: 0.85;
  }

  body.theme-dark .btn-filter.filter-exclude:hover {
    opacity: 0.85;
  }
}

/* ----- Dark Mode Collapse/Expand/Toggle Buttons ----- */
body.theme-dark .btn-collapse-all,
body.theme-dark .btn-expand-all,
body.theme-dark .btn-toggle-completed,
body.theme-dark .btn-toggle-cancelled {
  background-color: #1e1e2e;
  color: #f5f5f5;
}

body.theme-dark .btn-collapse-all:hover,
body.theme-dark .btn-expand-all:hover,
body.theme-dark .btn-toggle-completed:hover,
body.theme-dark .btn-toggle-cancelled:hover {
  background-color: #2a2a3e;
}

body.theme-dark .task-modal-cancel-btn {
  color: #a0a0b0;
}

body.theme-dark .task-modal-cancel-btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #f5f5f5;
}

body.theme-dark .task-modal-delete-btn {
  color: #f87171;
}

body.theme-dark .task-modal-delete-btn:hover {
  background-color: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
}

body.theme-dark .task-modal-danger-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

/* ----- Dark Mode Backlog Filter Labels ----- */
body.theme-dark .form-field label {
  color: #a0a0b0;
}

/* ----- Dark Mode Toolbar ----- */
body.theme-dark .toolbar-btn {
  background-color: transparent;
  color: #a0a0b0;
}

body.theme-dark .toolbar-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

body.theme-dark .toolbar-btn.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #f5f5f5;
}

/* ----- Dark Mode Add Task/Category Buttons ----- */
body.theme-dark .add-task-btn,
body.theme-dark .add-category-btn,
body.theme-dark .btn-add-task,
body.theme-dark .btn-create {
  background-color: transparent;
  border-color: #3d3d52;
  color: #6a6a7a;
}

body.theme-dark .add-task-btn:hover,
body.theme-dark .add-category-btn:hover,
body.theme-dark .btn-add-task:hover,
body.theme-dark .btn-create:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: #4a4a5e;
  color: #a0a0b0;
}

/* ----- Dark Mode Placeholder Text ----- */
body.theme-dark .placeholder-text {
  color: #f5f5f5;
}

/* ----- Dark Mode Markdown Editor ----- */
body.theme-dark .markdown-editor {
  background-color: #1e1e2e;
  border-color: #3d3d52;
}

body.theme-dark .markdown-editor-toolbar {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .markdown-editor-toolbar button {
  color: #a0a0b0;
}

body.theme-dark .markdown-editor-toolbar button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

body.theme-dark .markdown-preview {
  background-color: #1e1e2e;
  color: #f5f5f5;
}

/* Markdown body styles */
body.theme-dark .markdown-body {
  color: #f5f5f5;
}

body.theme-dark .markdown-body h1,
body.theme-dark .markdown-body h2,
body.theme-dark .markdown-body h3,
body.theme-dark .markdown-body h4,
body.theme-dark .markdown-body h5,
body.theme-dark .markdown-body h6 {
  color: #f5f5f5;
}

body.theme-dark .markdown-body code {
  background-color: #2d2d42;
  color: inherit;
}

body.theme-dark .markdown-body pre {
  background-color: #f6f8fa;
  color: #24292f;
}

body.theme-dark .markdown-body pre code {
  background-color: transparent;
  color: inherit;
}

body.theme-dark .markdown-body blockquote {
  border-left-color: #4a4a5e;
  color: #a0a0b0;
}

body.theme-dark .markdown-body table th {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .markdown-body table td {
  border-color: #3d3d52;
}

body.theme-dark .markdown-body hr {
  border-color: #3d3d52;
}

/* ----- Dark Mode Marksmith Editor ----- */
/* Complete dark mode override for Marksmith editor.
   Using !important to override Tailwind's ms: utility classes. */

/* Outer wrapper - keep transparent so it doesn't affect Save/Cancel buttons */
body.theme-dark .marksmith-editor-wrapper {
  background-color: transparent !important;
}

/* Main .marksmith container - dark background and border */
body.theme-dark .marksmith-editor-wrapper .marksmith,
body.theme-dark .marksmith {
  background-color: #1e1e2e !important;
  border-color: #3d3d52 !important;
}

/* Top toolbar bar (contains tabs + formatting buttons) - this is the key fix */
body.theme-dark .marksmith-toolbar {
  background-color: #2a2a3e !important;
  border-color: #3d3d52 !important;
}

/* Tabs container */
body.theme-dark .marksmith-tabs {
  background-color: transparent !important;
}

/* Individual tab buttons (Write, Preview) - inactive state */
body.theme-dark .marksmith-tab {
  color: #a0a0b0 !important;
  background-color: transparent !important;
  border-color: transparent !important;
}

body.theme-dark .marksmith-tab:hover {
  color: #f5f5f5 !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Active/selected tab - connected to content area */
body.theme-dark .marksmith-tab.active {
  color: #f5f5f5 !important;
  background-color: #1e1e2e !important;
  border-color: #3d3d52 !important;
  border-bottom-color: #1e1e2e !important;
}

/* Formatting toolbar (markdown-toolbar element containing B, H, I, etc.) */
body.theme-dark markdown-toolbar {
  background-color: transparent !important;
  border-color: #3d3d52 !important;
}

/* Individual formatting buttons */
body.theme-dark markdown-toolbar md-bold,
body.theme-dark markdown-toolbar md-header,
body.theme-dark markdown-toolbar md-italic,
body.theme-dark markdown-toolbar md-quote,
body.theme-dark markdown-toolbar md-code,
body.theme-dark markdown-toolbar md-link,
body.theme-dark markdown-toolbar md-image,
body.theme-dark markdown-toolbar md-unordered-list,
body.theme-dark markdown-toolbar md-ordered-list,
body.theme-dark markdown-toolbar md-task-list,
body.theme-dark markdown-toolbar md-mention,
body.theme-dark markdown-toolbar md-strikethrough {
  color: #a0a0b0 !important;
}

body.theme-dark markdown-toolbar md-bold:hover,
body.theme-dark markdown-toolbar md-header:hover,
body.theme-dark markdown-toolbar md-italic:hover,
body.theme-dark markdown-toolbar md-quote:hover,
body.theme-dark markdown-toolbar md-code:hover,
body.theme-dark markdown-toolbar md-link:hover,
body.theme-dark markdown-toolbar md-image:hover,
body.theme-dark markdown-toolbar md-unordered-list:hover,
body.theme-dark markdown-toolbar md-ordered-list:hover,
body.theme-dark markdown-toolbar md-task-list:hover,
body.theme-dark markdown-toolbar md-mention:hover,
body.theme-dark markdown-toolbar md-strikethrough:hover {
  color: #f5f5f5 !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* SVG icons inside formatting buttons */
body.theme-dark markdown-toolbar svg {
  fill: currentColor !important;
}

/* Editor content area border */
body.theme-dark .marksmith-editor-content {
  border-color: #3d3d52 !important;
}

/* Textarea */
body.theme-dark .marksmith-editor-wrapper textarea,
body.theme-dark .marksmith textarea,
body.theme-dark .marksmith-textarea {
  background-color: #1e1e2e !important;
  color: #f5f5f5 !important;
  border-color: #3d3d52 !important;
}

body.theme-dark .marksmith-editor-wrapper textarea::placeholder,
body.theme-dark .marksmith textarea::placeholder {
  color: #6b6b7b !important;
}

/* Bottom toolbar (Markdown is supported, Upload files) */
body.theme-dark .marksmith-bottom-toolbar {
  background-color: #2a2a3e !important;
  border-color: #3d3d52 !important;
}

body.theme-dark .marksmith-bottom-toolbar a,
body.theme-dark .marksmith-bottom-toolbar button,
body.theme-dark .marksmith-bottom-toolbar span {
  color: #a0a0b0 !important;
}

body.theme-dark .marksmith-bottom-toolbar a:hover,
body.theme-dark .marksmith-bottom-toolbar button:hover {
  color: #f5f5f5 !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body.theme-dark .marksmith-bottom-toolbar svg {
  fill: currentColor !important;
}

/* ===== Marksmith Preview - Match markdown-body styling exactly ===== */
/* Override Tailwind prose to match the app's .markdown-body styles */
.marksmith-rendered-body {
  font-family: var(--font-body) !important;
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
  color: var(--color-text-primary) !important;
  overflow-wrap: break-word !important;
}

.marksmith-rendered-body h1,
.marksmith-rendered-body h2,
.marksmith-rendered-body h3,
.marksmith-rendered-body h4,
.marksmith-rendered-body h5,
.marksmith-rendered-body h6 {
  font-family: var(--font-header) !important;
  margin-top: 1.25em !important;
  margin-bottom: 0.5em !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  color: var(--color-text-primary) !important;
}

.marksmith-rendered-body h1 { font-size: 1.5em !important; }
.marksmith-rendered-body h2 { font-size: 1.3em !important; }
.marksmith-rendered-body h3 { font-size: 1.15em !important; }
.marksmith-rendered-body h4,
.marksmith-rendered-body h5,
.marksmith-rendered-body h6 { font-size: 1em !important; }

.marksmith-rendered-body h1:first-child,
.marksmith-rendered-body h2:first-child,
.marksmith-rendered-body h3:first-child {
  margin-top: 0 !important;
}

.marksmith-rendered-body p {
  margin-top: 0 !important;
  margin-bottom: 0.75em !important;
}

.marksmith-rendered-body p:last-child {
  margin-bottom: 0 !important;
}

.marksmith-rendered-body ul,
.marksmith-rendered-body ol {
  padding-left: 1.5em !important;
  margin-top: 0 !important;
  margin-bottom: 0.75em !important;
}

.marksmith-rendered-body li {
  margin-top: 0 !important;
  margin-bottom: 0.25em !important;
  padding-left: 0 !important;
}

.marksmith-rendered-body li:last-child {
  margin-bottom: 0 !important;
}

/* Task list items with checkboxes - match markdown-body exactly */
.marksmith-rendered-body .task-list-item {
  list-style: none !important;
  position: relative !important;
  margin-left: 0 !important;
  padding-left: 1.5em !important;
}

.marksmith-rendered-body .task-list-item > .task-list-item-checkbox,
.marksmith-rendered-body .task-list-item > input[type="checkbox"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  position: absolute !important;
  left: 0 !important;
  top: 0.25em !important;
  cursor: var(--cursor-pointer) !important;
  width: 16px !important;
  height: 16px !important;
  border: 2px solid #6a737d !important;
  border-radius: 3px !important;
  background: transparent !important;
}

.marksmith-rendered-body .task-list-item > .task-list-item-checkbox:checked,
.marksmith-rendered-body .task-list-item > input[type="checkbox"]:checked,
.marksmith-rendered-body .task-list-item > .task-list-item-checkbox[data-state="checked"],
.marksmith-rendered-body .task-list-item > input[type="checkbox"][data-state="checked"] {
  background-color: #2188ff !important;
  border-color: #2188ff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M10 3L4.5 8.5L2 6' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") !important;
  background-size: 10px 10px !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* Checked task items - grey out and strikethrough */
.marksmith-rendered-body .task-list-item:has(> .task-list-item-checkbox:checked),
.marksmith-rendered-body .task-list-item:has(> input[type="checkbox"]:checked),
.marksmith-rendered-body .task-list-item:has(> .task-list-item-checkbox[data-state="checked"]),
.marksmith-rendered-body .task-list-item:has(> input[type="checkbox"][data-state="checked"]) {
  color: #999 !important;
  text-decoration: line-through !important;
}

/* In-progress checkbox in Marksmith editor preview */
.marksmith-rendered-body .task-list-item > .task-list-item-checkbox[data-state="in-progress"],
.marksmith-rendered-body .task-list-item > input[type="checkbox"][data-state="in-progress"] {
  background-image: linear-gradient(to top, #f5a623 50%, transparent 50%) !important;
  border-color: #f5a623 !important;
  background-color: transparent !important;
}

.marksmith-rendered-body .task-list-item--in-progress {
  font-weight: 600 !important;
  color: inherit !important;
  text-decoration: none !important;
}

/* Code - inline */
.marksmith-rendered-body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace !important;
  font-size: 0.875em !important;
  padding: 0.2em 0.4em !important;
  background-color: rgba(0, 0, 0, 0.05) !important;
  border-radius: 4px !important;
  color: var(--color-text-primary) !important;
}

/* Code blocks */
.marksmith-rendered-body pre {
  background-color: #f6f8fa !important;
  border-radius: var(--radius-sm) !important;
  padding: 1em !important;
  white-space: pre-wrap !important;
  overflow-wrap: break-word !important;
  margin-bottom: 0.75em !important;
  margin-top: 0 !important;
}

.marksmith-rendered-body pre code {
  padding: 0 !important;
  background-color: transparent !important;
  font-size: 0.85em !important;
  line-height: 1.5 !important;
}

/* Blockquotes - left border style, NOT quotation marks */
.marksmith-rendered-body blockquote {
  border-left: 4px solid var(--color-border) !important;
  padding-left: 1em !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0.75em !important;
  color: var(--color-text-secondary) !important;
  font-style: normal !important;
  quotes: none !important;
}

/* Remove any ::before/::after quote marks from blockquotes */
.marksmith-rendered-body blockquote::before,
.marksmith-rendered-body blockquote::after,
.marksmith-rendered-body blockquote p::before,
.marksmith-rendered-body blockquote p::after,
.marksmith-rendered-body blockquote p:first-of-type::before,
.marksmith-rendered-body blockquote p:last-of-type::after {
  content: none !important;
  display: none !important;
}

/* Links */
.marksmith-rendered-body a {
  color: #2188ff !important;
  text-decoration: none !important;
}

.marksmith-rendered-body a:hover {
  text-decoration: underline !important;
}

/* Horizontal rules */
.marksmith-rendered-body hr {
  border: none !important;
  border-top: 1px solid var(--color-border) !important;
  margin: 1em 0 !important;
}

/* Tables */
.marksmith-rendered-body table {
  border-collapse: collapse !important;
  width: 100% !important;
  margin-bottom: 0.75em !important;
}

.marksmith-rendered-body th,
.marksmith-rendered-body td {
  border: 1px solid var(--color-border) !important;
  padding: 0.5em 0.75em !important;
  text-align: left !important;
}

.marksmith-rendered-body th {
  background-color: #f6f8fa !important;
  font-weight: 600 !important;
}

/* Images */
.marksmith-rendered-body img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: var(--radius-sm) !important;
}

/* Preview pane */
body.theme-dark .marksmith-preview-pane {
  background-color: #1e1e2e !important;
  color: #f5f5f5 !important;
}

/* Marksmith rendered body - prose-invert for dark mode
   Marksmith uses .dark class but this app uses body.theme-dark,
   so we need to manually set the inverted prose variables */
body.theme-dark .marksmith-rendered-body,
body.theme-dark .marksmith-preview-pane {
  --tw-prose-body: #e0e0e0 !important;
  --tw-prose-headings: #ffffff !important;
  --tw-prose-lead: #b0b0b0 !important;
  --tw-prose-links: #60a5fa !important;
  --tw-prose-bold: #ffffff !important;
  --tw-prose-counters: #b0b0b0 !important;
  --tw-prose-bullets: #6b6b7b !important;
  --tw-prose-hr: #4a4a5e !important;
  --tw-prose-quotes: #e8e8e8 !important;
  --tw-prose-quote-borders: #4a4a5e !important;
  --tw-prose-captions: #b0b0b0 !important;
  --tw-prose-kbd: #ffffff !important;
  --tw-prose-code: #f5f5f5 !important;
  --tw-prose-pre-code: #e0e0e0 !important;
  --tw-prose-pre-bg: rgba(0, 0, 0, 0.4) !important;
  --tw-prose-th-borders: #4a4a5e !important;
  --tw-prose-td-borders: #3d3d52 !important;
  color: #e0e0e0 !important;
}

/* Ensure all text elements in preview are light colored */
body.theme-dark .marksmith-rendered-body h1,
body.theme-dark .marksmith-rendered-body h2,
body.theme-dark .marksmith-rendered-body h3,
body.theme-dark .marksmith-rendered-body h4,
body.theme-dark .marksmith-rendered-body h5,
body.theme-dark .marksmith-rendered-body h6 {
  color: #ffffff !important;
}

body.theme-dark .marksmith-rendered-body p,
body.theme-dark .marksmith-rendered-body li,
body.theme-dark .marksmith-rendered-body span {
  color: #e0e0e0 !important;
}

body.theme-dark .marksmith-rendered-body strong,
body.theme-dark .marksmith-rendered-body b {
  color: #ffffff !important;
}

body.theme-dark .marksmith-rendered-body em,
body.theme-dark .marksmith-rendered-body i {
  color: #e0e0e0 !important;
}

body.theme-dark .marksmith-rendered-body code {
  color: inherit !important;
  background-color: #2d2d42 !important;
}

body.theme-dark .marksmith-rendered-body pre {
  background-color: #f6f8fa !important;
  color: #24292f !important;
}

body.theme-dark .marksmith-rendered-body pre code {
  background-color: transparent !important;
  color: inherit !important;
}

body.theme-dark .marksmith-rendered-body blockquote {
  color: #c0c0c0 !important;
  border-left-color: #4a4a5e !important;
}

body.theme-dark .marksmith-rendered-body a {
  color: #60a5fa !important;
}

body.theme-dark .marksmith-rendered-body a:hover {
  color: #93c5fd !important;
}

body.theme-dark .marksmith-rendered-body ul,
body.theme-dark .marksmith-rendered-body ol {
  color: #e0e0e0 !important;
}

body.theme-dark .marksmith-rendered-body table th {
  background-color: #2a2a3e !important;
  color: #ffffff !important;
  border-color: #4a4a5e !important;
}

body.theme-dark .marksmith-rendered-body table td {
  color: #e0e0e0 !important;
  border-color: #3d3d52 !important;
}

/* Editor pane container */
body.theme-dark .marksmith-editor-pane {
  background-color: #1e1e2e !important;
}

/* ----- Marksmith Toolbar Pixelart Icons ----- */
/* Hide the default SVG icons inside all toolbar buttons */
markdown-toolbar md-bold svg,
markdown-toolbar md-header svg,
markdown-toolbar md-italic svg,
markdown-toolbar md-quote svg,
markdown-toolbar md-code svg,
markdown-toolbar md-link svg,
markdown-toolbar md-image svg,
markdown-toolbar md-unordered-list svg,
markdown-toolbar md-ordered-list svg,
markdown-toolbar md-task-list svg,
markdown-toolbar md-strikethrough svg {
  display: none !important;
}

/* Base styling for all toolbar buttons with icons */
markdown-toolbar md-bold,
markdown-toolbar md-header,
markdown-toolbar md-italic,
markdown-toolbar md-quote,
markdown-toolbar md-code,
markdown-toolbar md-link,
markdown-toolbar md-image,
markdown-toolbar md-unordered-list,
markdown-toolbar md-ordered-list,
markdown-toolbar md-task-list,
markdown-toolbar md-strikethrough {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  position: relative;
}

/* All toolbar icons use mask-image technique */
markdown-toolbar md-bold::before,
markdown-toolbar md-header::before,
markdown-toolbar md-italic::before,
markdown-toolbar md-quote::before,
markdown-toolbar md-code::before,
markdown-toolbar md-link::before,
markdown-toolbar md-image::before,
markdown-toolbar md-unordered-list::before,
markdown-toolbar md-ordered-list::before,
markdown-toolbar md-task-list::before,
markdown-toolbar md-strikethrough::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background-color: #525266;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Bold icon - pixelarticons v2 */
markdown-toolbar md-bold::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/bold.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/bold.svg");
}

/* Italic icon - pixelarticons v2 */
markdown-toolbar md-italic::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/italic.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/italic.svg");
}

/* Heading icon - pixelarticons v2 */
markdown-toolbar md-header::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/heading.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/heading.svg");
}

/* Quote icon - pixelarticons v2 */
markdown-toolbar md-quote::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/quote-text-inline.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/quote-text-inline.svg");
}

/* Code icon - pixelarticons v2 */
markdown-toolbar md-code::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/code.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/code.svg");
}

/* Link icon - pixelarticons v2 */
markdown-toolbar md-link::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/link.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/link.svg");
}

/* Image icon - pixelarticons v2 */
markdown-toolbar md-image::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/image.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/image.svg");
}

/* Ordered list icon - custom numbered list matching bulletlist style */
markdown-toolbar md-ordered-list::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='10' y='5' width='12' height='2' fill='black'/%3E%3Crect x='10' y='9' width='8' height='2' fill='black'/%3E%3Crect x='10' y='13' width='12' height='2' fill='black'/%3E%3Crect x='10' y='17' width='8' height='2' fill='black'/%3E%3Crect x='4' y='5' width='2' height='2' fill='black'/%3E%3Crect x='2' y='5' width='2' height='2' fill='black'/%3E%3Crect x='4' y='7' width='2' height='2' fill='black'/%3E%3Crect x='2' y='9' width='6' height='2' fill='black'/%3E%3Crect x='2' y='13' width='2' height='2' fill='black'/%3E%3Crect x='4' y='13' width='2' height='2' fill='black'/%3E%3Crect x='6' y='15' width='2' height='2' fill='black'/%3E%3Crect x='2' y='17' width='2' height='2' fill='black'/%3E%3Crect x='4' y='17' width='2' height='2' fill='black'/%3E%3Crect x='2' y='19' width='6' height='2' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='10' y='5' width='12' height='2' fill='black'/%3E%3Crect x='10' y='9' width='8' height='2' fill='black'/%3E%3Crect x='10' y='13' width='12' height='2' fill='black'/%3E%3Crect x='10' y='17' width='8' height='2' fill='black'/%3E%3Crect x='4' y='5' width='2' height='2' fill='black'/%3E%3Crect x='2' y='5' width='2' height='2' fill='black'/%3E%3Crect x='4' y='7' width='2' height='2' fill='black'/%3E%3Crect x='2' y='9' width='6' height='2' fill='black'/%3E%3Crect x='2' y='13' width='2' height='2' fill='black'/%3E%3Crect x='4' y='13' width='2' height='2' fill='black'/%3E%3Crect x='6' y='15' width='2' height='2' fill='black'/%3E%3Crect x='2' y='17' width='2' height='2' fill='black'/%3E%3Crect x='4' y='17' width='2' height='2' fill='black'/%3E%3Crect x='2' y='19' width='6' height='2' fill='black'/%3E%3C/svg%3E");
}

/* Unordered list icon - pixelarticons v2 bulletlist */
markdown-toolbar md-unordered-list::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/bulletlist.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/bulletlist.svg");
}

/* Task list icon - list-box from local pixelarticons */
markdown-toolbar md-task-list::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/list-box.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/list-box.svg");
}

/* Strikethrough icon - pixelarticons v2 (using strikethrough if available, else custom) */
markdown-toolbar md-strikethrough::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M6 4h12v2H8v4h8v2H2v-2h4V6H6V4zm10 10h2v6H6v-2h8v-2h2v-2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M6 4h12v2H8v4h8v2H2v-2h4V6H6V4zm10 10h2v6H6v-2h8v-2h2v-2z'/%3E%3C/svg%3E");
}

/* Hover state - darken all icons */
markdown-toolbar md-bold:hover::before,
markdown-toolbar md-header:hover::before,
markdown-toolbar md-italic:hover::before,
markdown-toolbar md-quote:hover::before,
markdown-toolbar md-code:hover::before,
markdown-toolbar md-link:hover::before,
markdown-toolbar md-image:hover::before,
markdown-toolbar md-unordered-list:hover::before,
markdown-toolbar md-ordered-list:hover::before,
markdown-toolbar md-task-list:hover::before,
markdown-toolbar md-strikethrough:hover::before {
  background-color: #1a1a2e;
}

/* ----- Dark Mode Toolbar Icons ----- */
/* All icons in dark mode */
body.theme-dark markdown-toolbar md-bold::before,
body.theme-dark markdown-toolbar md-header::before,
body.theme-dark markdown-toolbar md-italic::before,
body.theme-dark markdown-toolbar md-quote::before,
body.theme-dark markdown-toolbar md-code::before,
body.theme-dark markdown-toolbar md-link::before,
body.theme-dark markdown-toolbar md-image::before,
body.theme-dark markdown-toolbar md-unordered-list::before,
body.theme-dark markdown-toolbar md-ordered-list::before,
body.theme-dark markdown-toolbar md-task-list::before,
body.theme-dark markdown-toolbar md-strikethrough::before {
  background-color: #a0a0b0;
}

/* Dark mode hover states */
body.theme-dark markdown-toolbar md-bold:hover::before,
body.theme-dark markdown-toolbar md-header:hover::before,
body.theme-dark markdown-toolbar md-italic:hover::before,
body.theme-dark markdown-toolbar md-quote:hover::before,
body.theme-dark markdown-toolbar md-code:hover::before,
body.theme-dark markdown-toolbar md-link:hover::before,
body.theme-dark markdown-toolbar md-image:hover::before,
body.theme-dark markdown-toolbar md-unordered-list:hover::before,
body.theme-dark markdown-toolbar md-ordered-list:hover::before,
body.theme-dark markdown-toolbar md-task-list:hover::before,
body.theme-dark markdown-toolbar md-strikethrough:hover::before {
  background-color: #f5f5f5;
}

/* ----- Bottom Toolbar Pixelart Icons ----- */
/* Hide the original SVGs in bottom toolbar */
.marksmith-bottom-toolbar .marksmith-help-link svg,
.marksmith-bottom-toolbar .marksmith-upload-button svg,
.marksmith-bottom-toolbar .marksmith-gallery-link svg {
  display: none !important;
}

/* Add pixelart icons using ::before pseudo-elements */
.marksmith-bottom-toolbar .marksmith-help-link::before,
.marksmith-bottom-toolbar .marksmith-upload-button::before,
.marksmith-bottom-toolbar .marksmith-gallery-link::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  background-color: #525266;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  flex-shrink: 0;
}

/* Markdown help link - pixelarticons v2 */
.marksmith-bottom-toolbar .marksmith-help-link::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/markdown.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/markdown.svg");
}

/* Upload files button - pixelarticons v2 */
.marksmith-bottom-toolbar .marksmith-upload-button::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/upload.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/upload.svg");
}

/* Gallery link - pixelarticons v2 */
.marksmith-bottom-toolbar .marksmith-gallery-link::before {
  -webkit-mask-image: url("/icons/pixelarticons-v2/svg/gallery-thumbnails.svg");
  mask-image: url("/icons/pixelarticons-v2/svg/gallery-thumbnails.svg");
}

/* Hover states for bottom toolbar icons */
.marksmith-bottom-toolbar .marksmith-help-link:hover::before,
.marksmith-bottom-toolbar .marksmith-upload-button:hover::before,
.marksmith-bottom-toolbar .marksmith-gallery-link:hover::before {
  background-color: #1a1a2e;
}

/* Dark mode for bottom toolbar icons */
body.theme-dark .marksmith-bottom-toolbar .marksmith-help-link::before,
body.theme-dark .marksmith-bottom-toolbar .marksmith-upload-button::before,
body.theme-dark .marksmith-bottom-toolbar .marksmith-gallery-link::before {
  background-color: #a0a0b0;
}

body.theme-dark .marksmith-bottom-toolbar .marksmith-help-link:hover::before,
body.theme-dark .marksmith-bottom-toolbar .marksmith-upload-button:hover::before,
body.theme-dark .marksmith-bottom-toolbar .marksmith-gallery-link:hover::before {
  background-color: #f5f5f5;
}

/* ----- Dark Mode Backlog ----- */
body.theme-dark .backlog-container {
  background-color: #2a2a3e;
}

body.theme-dark .backlog-header {
  color: #f5f5f5;
}

body.theme-dark .backlog-filters {
  background-color: #1e1e2e;
}

body.theme-dark .backlog-sort-btn {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .backlog-sort-btn:hover {
  background-color: #2a2a3e;
}

/* ----- Dark Mode Focus Page ----- */
body.theme-dark .focus-container {
  background-color: #2a2a3e;
}

body.theme-dark .focus-header {
  color: #f5f5f5;
}

body.theme-dark .focus-task-card {
  background-color: #1e1e2e;
  border-color: #3d3d52;
}

body.theme-dark .focus-task-card:hover {
  background-color: #2a2a3e;
}

/* ----- Dark Mode Focus Achievements ----- */
/* The status colours (green/amber/blue) and the token-driven text, border, card and shadow
   colours all carry over, and body.theme-dark .pixel-icon inverts the icons. Only the two
   card surfaces need overriding. */
body.theme-dark .focus-wins-strip,
body.theme-dark .focus-achievement-group {
  background-color: #2a2a3e;
}

body.theme-dark .focus-wins-number {
  color: #4ade80;
}

/* body.theme-dark .pixel-icon inverts every icon, which would undo the status tinting on the
   subtask list. Re-apply it after the inversion. */
body.theme-dark .focus-subtask--done .pixel-icon-sm {
  filter: brightness(0) saturate(100%) invert(72%) sepia(45%) saturate(559%) hue-rotate(88deg) brightness(94%) contrast(89%);
}

body.theme-dark .focus-subtask--doing .pixel-icon-sm {
  filter: brightness(0) saturate(100%) invert(78%) sepia(48%) saturate(1163%) hue-rotate(332deg) brightness(102%) contrast(94%);
}

/* ----- Dark Mode Labels/Tags ----- */
body.theme-dark .label,
body.theme-dark .tag {
  background-color: #363650;
  color: #f5f5f5;
}

body.theme-dark .label:hover,
body.theme-dark .tag:hover {
  background-color: #4a4a5e;
}

/* ----- Dark Mode Tooltips ----- */
body.theme-dark .tooltip {
  background-color: #1e1e2e;
  color: #f5f5f5;
  border-color: #3d3d52;
}

/* ----- Dark Mode Loading/Skeleton ----- */
body.theme-dark .loading-skeleton {
  background: linear-gradient(90deg, #2a2a3e 25%, #363650 50%, #2a2a3e 75%);
}

/* ----- Dark Mode Confirmation Banner ----- */
body.theme-dark .confirmation-banner {
  background-color: #2a2a1a;
  border-color: #3d3d1a;
  color: #fbbf24;
}

/* ----- Dark Mode Plan Change ----- */
body.theme-dark .plan-change-container {
  background-color: #2a2a3e;
}

body.theme-dark .plan-change-title {
  color: #f5f5f5;
}

body.theme-dark .plan-change-description {
  color: #a0a0b0;
}

/* ----- Dark Mode Completed Tasks Toggle ----- */
body.theme-dark .completed-tasks-toggle {
  color: #a0a0b0;
}

body.theme-dark .completed-tasks-toggle:hover {
  color: #f5f5f5;
}

/* ----- Dark Mode Generic Backgrounds (hardcoded colors) ----- */
/* Replaces #f8f9fa, #f6f8fa, #f5f5f5, #fafafa, #f8f8f8, #f0f0f0 */
body.theme-dark .bg-light,
body.theme-dark [style*="background-color: #f"] {
  background-color: #1e1e2e !important;
}

/* ----- Dark Mode Generic Text Colors ----- */
/* Text that uses #333, #000 */
body.theme-dark .text-dark,
body.theme-dark .text-black {
  color: #f5f5f5;
}

/* Text that uses #666, #999 */
body.theme-dark .text-muted,
body.theme-dark .text-secondary {
  color: #a0a0b0;
}

/* ----- Dark Mode Delete Confirmation ----- */
body.theme-dark .delete-confirm {
  background-color: #3a1a1a;
  color: #fca5a5;
}

/* ----- Dark Mode Drag Handles ----- */
body.theme-dark .drag-handle {
  color: #4a4a5e;
}

body.theme-dark .drag-handle:hover {
  color: #a0a0b0;
}

/* ----- Dark Mode Task Detail Container ----- */
body.theme-dark #task-detail-container {
  background-color: #2a2a3e;
}

body.theme-dark #task-detail-container .theme-input {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

/* ----- Dark Mode Sortable/Draggable ----- */
body.theme-dark .sortable-drag {
  background-color: #363650;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

body.theme-dark .sortable-ghost {
  opacity: 0.4;
}

/* ----- Dark Mode Categories Header ----- */
body.theme-dark .categories-header {
  color: #f5f5f5;
}

body.theme-dark .categories-section h2 {
  color: #f5f5f5;
}

/* ----- Dark Mode Subtask Donut ----- */
body.theme-dark .subtask-donut::after {
  background-color: #1e1e2e;
  color: #f5f5f5;
  border-color: #3d3d52;
}

/* ----- Dark Mode Category Progress ----- */
body.theme-dark .category-progress::after {
  background-color: #1e1e2e;
  color: #f5f5f5;
  border-color: #3d3d52;
}

body.theme-dark .category-progress-numbers {
  color: #a0a0b0;
}

/* ----- Dark Mode Date Pickers ----- */
body.theme-dark input[type="date"],
body.theme-dark input[type="time"],
body.theme-dark input[type="datetime-local"] {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
  color-scheme: dark;
}

body.theme-dark input[type="date"]:focus,
body.theme-dark input[type="time"]:focus,
body.theme-dark input[type="datetime-local"]:focus {
  border-color: #a0a0b0;
}

/* ----- Dark Mode Timezone Widget ----- */
body.theme-dark .timezone-widget {
  color: #a0a0b0;
}

body.theme-dark .timezone-display {
  color: #f5f5f5;
}

/* ----- Dark Mode Category Edit ----- */
body.theme-dark .category-name-edit {
  background-color: transparent;
}

body.theme-dark .category-edit-input {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .category-edit-input:focus {
  border-color: #a0a0b0;
}

body.theme-dark .category-actions button {
  color: #a0a0b0;
}

body.theme-dark .category-actions button:hover {
  color: #f5f5f5;
}

/* ----- Dark Mode Delete Button States ----- */
body.theme-dark .delete-btn {
  color: #a0a0b0;
}

body.theme-dark .delete-btn:hover {
  color: #f87171;
  background-color: rgba(248, 113, 113, 0.1);
}

/* ----- Dark Mode Edit Button States ----- */
body.theme-dark .edit-btn {
  color: #a0a0b0;
}

body.theme-dark .edit-btn:hover {
  color: #f5f5f5;
  background-color: rgba(255, 255, 255, 0.1);
}

/* ----- Dark Mode Close/Cancel Buttons ----- */
body.theme-dark .close-btn,
body.theme-dark .cancel-btn {
  color: #a0a0b0;
}

body.theme-dark .close-btn:hover,
body.theme-dark .cancel-btn:hover {
  color: #f5f5f5;
}

/* ----- Dark Mode List Continuation ----- */
body.theme-dark .list-continuation {
  color: #a0a0b0;
}

body.theme-dark .list-continuation:hover {
  color: #f5f5f5;
}

/* ----- Dark Mode Text that was hardcoded #333, #000, #666, #999 ----- */
/* These catch any remaining hardcoded text colors */
body.theme-dark [style*="color: #333"],
body.theme-dark [style*="color: #000"],
body.theme-dark [style*="color: black"] {
  color: #f5f5f5 !important;
}

body.theme-dark [style*="color: #666"],
body.theme-dark [style*="color: #999"] {
  color: #a0a0b0 !important;
}

/* ----- Dark Mode Backgrounds that were hardcoded light colors ----- */
body.theme-dark [style*="background-color: #f5f5f5"],
body.theme-dark [style*="background-color: #fafafa"],
body.theme-dark [style*="background-color: #f8f8f8"],
body.theme-dark [style*="background-color: #f8f9fa"],
body.theme-dark [style*="background-color: #f6f8fa"],
body.theme-dark [style*="background-color: #f0f0f0"],
body.theme-dark [style*="background: #f5f5f5"],
body.theme-dark [style*="background: #fafafa"],
body.theme-dark [style*="background: #f8f8f8"],
body.theme-dark [style*="background: white"],
body.theme-dark [style*="background-color: white"] {
  background-color: #1e1e2e !important;
}

/* ----- Dark Mode Borders that were hardcoded light colors ----- */
body.theme-dark [style*="border-color: #ccc"],
body.theme-dark [style*="border-color: #ddd"],
body.theme-dark [style*="border-color: #e0e0e0"],
body.theme-dark [style*="border: 1px solid #ccc"],
body.theme-dark [style*="border: 1px solid #ddd"] {
  border-color: #3d3d52 !important;
}

/* ----- Dark Mode Box Shadows ----- */
body.theme-dark [style*="box-shadow"] {
  --shadow-color: rgba(0, 0, 0, 0.4);
}

/* ----- Dark Mode Hover Effects with rgba(0,0,0,0.02) or similar ----- */
body.theme-dark .hover-light:hover,
body.theme-dark tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ----- Dark Mode Focus Ring ----- */
body.theme-dark *:focus-visible {
  outline-color: #f5f5f5;
}

/* ----- Dark Mode Selection ----- */
body.theme-dark ::selection {
  background-color: rgba(248, 165, 194, 0.3);
  color: #f5f5f5;
}

/* ----- Dark Mode Task Icon Buttons ----- */
body.theme-dark .task-icon-btn {
  color: #6a6a7a;
}

body.theme-dark .task-icon-btn:hover {
  color: #f5f5f5;
  background-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .task-icon-btn:hover .pixel-icon {
  filter: invert(1);
}

/* ----- Dark Mode Task Checkbox ----- */
body.theme-dark .task-checkbox-btn {
  color: #a0a0b0;
}

body.theme-dark .task-checkbox-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .task-checkbox-form {
  color: #f5f5f5;
}

/* ----- Dark Mode Task Links ----- */
body.theme-dark .task-links-section {
  color: #f5f5f5;
}

body.theme-dark .task-link-pill {
  background-color: #1e1e2e;
  border-color: #3d3d52;
}

body.theme-dark .task-link-pill:hover {
  background-color: #2a2a3e;
  border-color: #4a4a5e;
}

body.theme-dark .task-link-content {
  color: #f5f5f5;
}

body.theme-dark .task-link-content:hover {
  color: #a0a0b0;
}

body.theme-dark .task-link-domain {
  color: #a0a0b0;
}

body.theme-dark .task-link-delete-btn {
  color: #6a6a7a;
}

body.theme-dark .task-link-delete-btn:hover {
  color: #f87171;
  background-color: rgba(248, 113, 113, 0.1);
}

body.theme-dark .task-link-edit-btn {
  color: #6a6a7a;
}

body.theme-dark .task-link-edit-btn:hover {
  color: #a0a0b0;
}

body.theme-dark .task-link-edit-btn:focus-visible {
  outline-color: #a0a0b0;
}

body.theme-dark .task-link-title-input:focus-visible {
  outline-color: #a0a0b0;
}

body.theme-dark .task-link-title-input {
  background: transparent;
  color: #f5f5f5;
}

body.theme-dark .task-link-prompt-btn {
  background: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .task-link-prompt-btn:hover {
  background-color: #2a2a3e;
}

body.theme-dark .task-link-add-btn {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #a0a0b0;
}

body.theme-dark .task-link-add-btn:hover {
  background-color: #2a2a3e;
  border-color: #4a4a5e;
  color: #f5f5f5;
}

body.theme-dark .task-link-url-input-inline {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .task-link-url-input-inline:focus {
  border-color: #a0a0b0;
}

/* ----- Dark Mode Template Links ----- */
body.theme-dark .template-link-pill {
  background-color: #1e1e2e;
}

body.theme-dark .template-link-pill:hover {
  background-color: #2a2a3e;
}

body.theme-dark .template-link-content {
  color: #f5f5f5;
}

body.theme-dark .template-link-domain {
  color: #a0a0b0;
}

body.theme-dark .template-link-delete-btn:hover {
  opacity: 1;
}

body.theme-dark .template-link-add-btn {
  border-color: #3d3d52;
  color: #a0a0b0;
}

body.theme-dark .template-link-add-btn:hover {
  background-color: #2a2a3e;
  border-color: #4a4a5e;
  color: #f5f5f5;
}

body.theme-dark .template-link-url-input {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .template-link-url-input:focus {
  border-color: #a0a0b0;
}

body.theme-dark .template-link-title-input {
  color: #f5f5f5;
}

body.theme-dark .template-link-title-input:focus-visible {
  outline-color: #a0a0b0;
}

body.theme-dark .template-link-edit-btn:focus-visible {
  outline-color: #a0a0b0;
}

body.theme-dark .template-content-editor {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .template-content-form .form-field label {
  color: #a0a0b0;
}

body.theme-dark .template-propagation-section {
  border-top-color: #3d3d52;
}


/* ----- Dark Mode Archived Templates ----- */
body.theme-dark .archived-templates-toggle {
  color: #a0a0b0;
}

body.theme-dark .archived-templates-toggle:hover {
  color: #f5f5f5;
}

body.theme-dark .task-link-inline {
  color: #7db8ff;
}

body.theme-dark .task-link-inline:hover {
  color: #a8d1ff;
}

body.theme-dark .task-link-error {
  background-color: #3a1a1a;
  color: #fca5a5;
}

/* ----- Dark Mode Focus Task Card ----- */
body.theme-dark .focus-task-card:not(.backlog-task-card) {
  background-color: #1e1e2e;
}

body.theme-dark .focus-task-card:not(.backlog-task-card):hover {
  background-color: #2a2a3e;
}

body.theme-dark .focus-task-card:not(.backlog-task-card) a,
body.theme-dark .focus-task-card:not(.backlog-task-card) button {
  color: #f5f5f5;
}

/* ----- Dark Mode Task Name Display ----- */
body.theme-dark .task-name-display {
  color: #f5f5f5;
}

body.theme-dark .task-name-display .task-icon-btn {
  color: #6a6a7a;
}

body.theme-dark .task-name-display .task-icon-btn:hover {
  color: #f5f5f5;
}

body.theme-dark .task-name {
  color: #f5f5f5;
}

body.theme-dark .task-name-wrapper {
  color: #f5f5f5;
}

/* ----- Dark Mode Task Forms ----- */
body.theme-dark .task-form-btn {
  background-color: transparent;
  border-color: transparent;
  color: #f5f5f5;
}

body.theme-dark .task-form-btn:hover {
  background-color: transparent;
}

/* ----- Dark Mode Completed Tasks ----- */
body.theme-dark .task-completed .task-title,
body.theme-dark .task-completed .task-checkbox-label {
  color: #6a6a7a;
  text-decoration: line-through;
}

/* ----- Dark Mode Icons Group ----- */
body.theme-dark .task-icons-group {
  color: #6a6a7a;
}

body.theme-dark .task-icons-group button:hover {
  color: #f5f5f5;
}

/* ----- Dark Mode Theme Text & Input ----- */
body.theme-dark .theme-text {
  color: #f5f5f5;
}

body.theme-dark .theme-input {
  background-color: transparent;
  color: #f5f5f5;
}

body.theme-dark .theme-input:focus {
  background-color: rgba(255, 255, 255, 0.05);
}

body.theme-dark .theme-input::placeholder {
  color: #6a6a7a;
}

/* ----- Dark Mode Icon Links ----- */
body.theme-dark .icon-link {
  color: #a0a0b0;
}

body.theme-dark .icon-link:hover {
  color: #f5f5f5;
}

/* ----- Dark Mode Error Messages ----- */
body.theme-dark .error-messages .error {
  color: #f87171;
}

body.theme-dark .field-error {
  color: #f87171;
}

/* ----- Dark Mode Category Header ----- */
body.theme-dark .category-header-right .icon-link {
  color: #6a6a7a;
}

body.theme-dark .category-header-right .icon-link:hover {
  color: #f5f5f5;
}

/* Delete icon in dark mode */
body.theme-dark .category-header-right form.icon-link:hover {
  color: #f87171;
}

/* ----- Dark Mode Inline Form ----- */
body.theme-dark .inline-form input {
  background-color: #1e1e2e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .inline-form input:focus {
  border-color: #a0a0b0;
}

/* ----- Dark Mode Month Cloud Details ----- */
body.theme-dark .month-cloud .month-name,
body.theme-dark .month-cloud .month-year {
  color: #f5f5f5;
}

/* ----- Dark Mode Current Month Highlight ----- */
body.theme-dark .current-month {
  color: #f5f5f5;
}

/* ----- Dark Mode Theme Group ----- */
body.theme-dark .theme-group {
  color: #f5f5f5;
}

/* ----- Dark Mode Theme Frame ----- */
body.theme-dark .theme-frame {
  color: #f5f5f5;
}

/* ----- Dark Mode Theme Content ----- */
body.theme-dark .theme-content {
  color: #f5f5f5;
}

/* ----- Dark Mode Trial Banner ----- */
body.theme-dark .trial-banner {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(139, 92, 246, 0.4));
  border: 1px solid rgba(168, 85, 247, 0.3);
}

body.theme-dark .trial-info {
  color: #f5f5f5;
}

body.theme-dark .trial-info .pixel-icon {
  filter: invert(1);
}

body.theme-dark .trial-cta {
  background: rgba(168, 85, 247, 0.3);
  color: #f5f5f5;
  border: 1px solid rgba(168, 85, 247, 0.5);
}

body.theme-dark .trial-cta:hover {
  background: rgba(168, 85, 247, 0.5);
  color: #f5f5f5;
}

/* ----- Dark Mode Confirmation Banner ----- */
body.theme-dark .confirmation-banner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(245, 158, 11, 0.3));
  border: 1px solid rgba(251, 191, 36, 0.3);
}

body.theme-dark .confirmation-info {
  color: #f5f5f5;
}

body.theme-dark .confirmation-info .pixel-icon {
  filter: invert(1);
}

/* ----- Dark Mode Recap Banner ----- */
body.theme-dark .recap-banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(124, 58, 237, 0.4));
  border: 1px solid rgba(139, 92, 246, 0.3);
}

body.theme-dark .recap-info {
  color: #f5f5f5;
}

body.theme-dark .recap-info .pixel-icon {
  filter: invert(1);
}

body.theme-dark .recap-cta {
  background: rgba(139, 92, 246, 0.3);
  color: #f5f5f5;
  border: 1px solid rgba(139, 92, 246, 0.5);
}

body.theme-dark .recap-cta:hover {
  background: rgba(139, 92, 246, 0.5);
  color: #f5f5f5;
}

body.theme-dark .recap-close .pixel-icon {
  filter: invert(1);
}

/* ----- Dark Mode Task Modal ----- */
body.theme-dark .task-modal-container {
  background-color: #2a2a3e;
}

body.theme-dark .task-modal-header {
  background-color: #2a2a3e;
}

body.theme-dark .task-modal-content {
  background-color: #2a2a3e;
}

body.theme-dark .task-modal-left .form-field label,
body.theme-dark .task-modal-right .form-field label {
  color: #a0a0b0;
}

body.theme-dark .task-modal-name-row {
  color: #f5f5f5;
}

body.theme-dark .task-modal-back {
  color: #a0a0b0;
}

body.theme-dark .task-modal-back:hover {
  color: #f5f5f5;
}

body.theme-dark .task-modal-description-display {
  color: #f5f5f5;
}

body.theme-dark .task-modal-description-text {
  color: #f5f5f5;
}

body.theme-dark .task-modal-description-empty {
  color: #6a6a7a;
}

/* ----- Dark Mode Draft Styles ----- */
body.theme-dark .draft-badge {
  color: #f0a04b;
  background: #3a2e1a;
  border-color: #5a4220;
}

body.theme-dark .draft-restore-banner {
  background: #2a2515;
  border-color: #5a4220;
}

body.theme-dark .draft-restore-btn {
  background: #e67e22;
  border-color: #d35400;
}

body.theme-dark .draft-discard-btn {
  color: #aaa;
  border-color: #444;
}

body.theme-dark .draft-discard-btn:hover {
  background: #333;
}

/* ----- Dark Mode Theme Alignment Rating ----- */
body.theme-dark .alignment-btn {
  border-color: #3d3d52;
  background: #1e1e2e;
}

body.theme-dark .aligned-star .pixel-icon {
  filter: invert(70%) sepia(30%) saturate(800%) hue-rotate(220deg) brightness(110%) drop-shadow(0 0 0px rgba(192, 160, 255, 0));
  animation-name: star-shimmer-dark;
}

@keyframes star-shimmer-dark {
  0%, 100% { opacity: 0.7; transform: scale(1); filter: invert(70%) sepia(30%) saturate(800%) hue-rotate(220deg) brightness(110%) drop-shadow(0 0 0px rgba(192, 160, 255, 0)); }
  50% { opacity: 1; transform: scale(1.15); filter: invert(70%) sepia(30%) saturate(800%) hue-rotate(220deg) brightness(110%) drop-shadow(0 0 4px rgba(192, 160, 255, 0.5)); }
}

/* ----- Dark Mode Alignment Indicators ----- */
body.theme-dark .task-alignment-1 .task-name,
body.theme-dark .task-alignment-1 .task-name-link {
  color: #6a6a7a !important;
}

body.theme-dark .unrated-indicator::before {
  border-color: #4a4a5a;
}

/* ----- Dark Mode Necessary ----- */
body.theme-dark .necessary-pill {
  border-color: #3d3d52;
  color: #9a9ab0;
}

body.theme-dark .necessary-pill:hover {
  border-color: #ea580c;
  color: #fb923c;
  background: rgba(234, 88, 12, 0.1);
}

body.theme-dark .necessary-pill:hover .pixel-icon {
  filter: invert(55%) sepia(80%) saturate(1200%) hue-rotate(360deg) brightness(100%);
}

body.theme-dark .necessary-pill.active {
  border-color: #ea580c;
  color: #fb923c;
  background: rgba(234, 88, 12, 0.15);
}

body.theme-dark .necessary-pill.active .pixel-icon {
  filter: invert(55%) sepia(80%) saturate(1200%) hue-rotate(360deg) brightness(100%);
}

body.theme-dark .necessary-badge .pixel-icon {
  filter: invert(62%) sepia(90%) saturate(1500%) hue-rotate(346deg) brightness(105%);
}

body.theme-dark .task-completed.task-alignment-1 .task-name,
body.theme-dark .task-completed.task-alignment-1 .task-name-link {
  color: inherit !important;
}

/* ----- Dark Mode Pricing Page Content Sections ----- */
body.theme-dark .pricing-content-section h2,
body.theme-dark .pricing-faq-section h2,
body.theme-dark .pricing-closing h2 {
  color: #f5f5f5;
}

body.theme-dark .pricing-content-section p,
body.theme-dark .pricing-closing p {
  color: #f5f5f5;
}

body.theme-dark .pricing-inspiration {
  border-color: #3d3d52;
  color: #a0a0b0;
}

body.theme-dark .indie-values p {
  color: #a0a0b0;
}

/* ----- Dark Mode Pricing Page Notices ----- */
body.theme-dark .pricing-trial-notice,
body.theme-dark .pricing-subscribed-notice {
  background: rgba(30, 30, 46, 0.6);
  border: 1px dashed rgba(168, 85, 247, 0.4);
}

body.theme-dark .pricing-trial-notice .pixel-icon,
body.theme-dark .pricing-subscribed-notice .pixel-icon {
  filter: invert(1);
}

body.theme-dark .pricing-hero h1 {
  color: #f5f5f5;
}

body.theme-dark .pricing-subtitle {
  color: #a0a0b0;
}

body.theme-dark .pricing-description {
  color: #a0a0b0;
}

body.theme-dark .pricing-amount {
  color: #f5f5f5;
}

body.theme-dark .pricing-savings {
  color: #4ade80;
}

body.theme-dark .pricing-card-header h2 {
  color: #f5f5f5;
}

body.theme-dark .pricing-badge {
  background-color: rgba(248, 165, 194, 0.2);
  color: #f8a5c2;
}

/* ===== Theme Toggle Styles (Settings Page) ===== */
.theme-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: var(--cursor-pointer);
  padding: 0.5rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: all var(--duration-normal) var(--easing-smooth);
}

.theme-option:hover {
  border-color: var(--color-text-secondary);
}

.theme-option:has(input:checked) {
  border-color: var(--color-text-primary);
  background-color: rgba(0, 0, 0, 0.05);
}

body.theme-dark .theme-option:has(input:checked) {
  background-color: rgba(255, 255, 255, 0.1);
}

.theme-option input[type="radio"] {
  cursor: var(--cursor-pointer);
  accent-color: var(--color-text-primary);
}

.theme-option-label {
  font-size: 0.95rem;
  cursor: var(--cursor-pointer);
}

/* ===== Legal Pages (Terms & Privacy) ===== */

.legal-page {
  text-align: left;
  line-height: 1.7;
  color: var(--color-text-primary);
}

.legal-page h1 {
  font-family: var(--font-header);
  font-size: 1.8rem;
  margin-bottom: var(--spacing-xs);
}

.legal-updated {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xl);
}

.legal-page h2 {
  font-family: var(--font-header);
  font-size: 1.2rem;
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-sm);
}

.legal-page h3 {
  font-family: var(--font-header);
  font-size: 1rem;
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.legal-page p {
  margin-bottom: var(--spacing-sm);
  font-size: 0.95rem;
}

.legal-page ul {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
}

.legal-page li {
  margin-bottom: var(--spacing-xs);
  font-size: 0.95rem;
}

.legal-page a {
  color: #0288d1;
  text-decoration: underline;
}

.legal-page a:hover {
  opacity: 0.7;
}

.legal-entity {
  margin-top: var(--spacing-xl);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

/* Legal pages dark mode */
body.theme-dark .legal-page {
  color: #f5f5f5;
}

body.theme-dark .legal-page a {
  color: #81d4fa;
}

body.theme-dark .legal-updated,
body.theme-dark .legal-entity {
  color: #a0a0b0;
}

/* ===== Quick Add FAB & Panel ===== */

/* Floating Action Button */
.quick-add-fab {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #f8bbd0;
  border: none;
  cursor: var(--cursor-pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(248, 187, 208, 0.5);
  transition: all var(--duration-normal) var(--easing-smooth);
  z-index: 1000;
}

.quick-add-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(244, 143, 177, 0.6);
  background-color: #f48fb1;
}

.quick-add-fab:active {
  transform: scale(0.95);
}

.quick-add-fab .pixel-icon {
  width: 24px;
  height: 24px;
  transition: opacity var(--duration-quick), transform var(--duration-normal) var(--easing-smooth);
}

.quick-add-fab .quick-add-icon-plus {
  opacity: 1;
}

.quick-add-fab .quick-add-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-45deg);
}

.quick-add-fab.active {
  background-color: #f48fb1;
}

.quick-add-fab.active .quick-add-icon-plus {
  opacity: 0;
  transform: rotate(45deg);
}

.quick-add-fab.active .quick-add-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Overlay backdrop */
.quick-add-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-smooth);
}

.quick-add-overlay.active {
  display: block;
  opacity: 1;
}

/* Input Panel - Desktop: Popover above FAB */
.quick-add-panel {
  position: fixed;
  bottom: calc(var(--spacing-lg) + 72px);
  right: var(--spacing-lg);
  width: 380px;
  max-width: calc(100vw - 2 * var(--spacing-lg));
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: var(--spacing-md);
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: all var(--duration-normal) var(--easing-bounce);
  z-index: 1001;
}

.quick-add-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Input wrapper */
.quick-add-input-wrapper {
  display: flex;
  gap: var(--spacing-sm);
}

.quick-add-input {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-body);
  min-height: 48px;
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  transition: border-color var(--duration-quick);
}

.quick-add-input:focus {
  outline: none;
  border-color: var(--color-text-primary);
}

.quick-add-input::placeholder {
  color: var(--color-text-secondary);
}

.quick-add-submit {
  width: 48px;
  height: 48px;
  border: 2px solid var(--color-text-primary);
  border-radius: var(--radius-sm);
  background-color: var(--color-card-white);
  cursor: var(--cursor-pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-quick);
  flex-shrink: 0;
}

.quick-add-submit:hover {
  background-color: var(--color-text-primary);
}

.quick-add-submit:hover .pixel-icon {
  filter: invert(1);
}

.quick-add-submit .pixel-icon {
  width: 20px;
  height: 20px;
}

/* Suggestions dropdown */
.quick-add-suggestions {
  display: none;
  margin-top: var(--spacing-sm);
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-card-white);
}

.quick-add-suggestions.active {
  display: block;
}

.quick-add-suggestion {
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: var(--cursor-pointer);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--duration-quick);
  border-bottom: 1px solid var(--color-border);
}

.quick-add-suggestion:last-child {
  border-bottom: none;
}

.quick-add-suggestion:hover,
.quick-add-suggestion.highlighted {
  background-color: rgba(248, 187, 208, 0.2);
}

.quick-add-suggestion-month {
  font-weight: 600;
  color: var(--color-text-primary);
}

.quick-add-suggestion-category {
  font-weight: 600;
  color: var(--color-text-primary);
}

.quick-add-suggestion-month-small {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

.quick-add-suggestion-hint {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Hint text */
.quick-add-hint {
  margin-top: var(--spacing-sm);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  text-align: center;
}

.quick-add-hint code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.8rem;
  margin-right: 2px;
}

.quick-add-hint-detail {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Shortcut preview pills */
.quick-add-preview {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--spacing-xs);
  padding: 0 var(--spacing-xs);
}

.quick-add-preview.active {
  display: flex;
}

.quick-add-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
  background-color: rgba(248, 187, 208, 0.25);
  color: var(--color-text-primary);
  border: 1px solid rgba(248, 187, 208, 0.5);
  white-space: nowrap;
}

/* Mobile: Bottom sheet */
@media (max-width: 768px) {
  .quick-add-fab {
    width: 48px;
    height: 48px;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
  }

  .quick-add-fab .pixel-icon {
    width: 20px;
    height: 20px;
  }

  .quick-add-panel {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--spacing-lg);
    transform: translateY(100%);
  }

  .quick-add-panel.active {
    transform: translateY(0);
  }

  .quick-add-input {
    min-height: 52px;
    font-size: 1.1rem;
  }

  .quick-add-submit {
    width: 52px;
    height: 52px;
  }

  .quick-add-suggestions {
    max-height: 40vh;
  }

  .quick-add-suggestion {
    padding: var(--spacing-md);
    min-height: 48px;
  }
}

/* Dark mode support */
body.theme-dark .quick-add-panel {
  background-color: #1e1e2e;
  border: 1px solid #3d3d52;
}

body.theme-dark .quick-add-input {
  background-color: #2a2a3e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .quick-add-input::placeholder {
  color: #6a6a7a;
}

body.theme-dark .quick-add-input:focus {
  border-color: #a0a0b0;
}

body.theme-dark .quick-add-submit {
  background-color: #2a2a3e;
  border-color: #a0a0b0;
}

body.theme-dark .quick-add-submit:hover {
  background-color: #a0a0b0;
}

body.theme-dark .quick-add-suggestions {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .quick-add-suggestion {
  border-color: #3d3d52;
}

body.theme-dark .quick-add-suggestion:hover,
body.theme-dark .quick-add-suggestion.highlighted {
  background-color: rgba(248, 187, 208, 0.15);
}

body.theme-dark .quick-add-suggestion-month {
  color: #f5f5f5;
}

body.theme-dark .quick-add-suggestion-category {
  color: #f5f5f5;
}

body.theme-dark .quick-add-suggestion-month-small,
body.theme-dark .quick-add-suggestion-hint {
  color: #a0a0b0;
}

body.theme-dark .quick-add-hint {
  color: #6a6a7a;
}

body.theme-dark .quick-add-hint code {
  background-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .quick-add-pill {
  background-color: rgba(248, 187, 208, 0.15);
  color: #f5f5f5;
  border-color: rgba(248, 187, 208, 0.3);
}

/* Inline task shortcut preview (compact pills below the add-task input) */
.inline-shortcut-preview {
  display: none;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px 8px 2px;
  align-items: center;
  width: 100%;
}

.inline-shortcut-preview.active {
  display: flex;
}

.inline-shortcut-preview .quick-add-pill {
  font-size: 0.65rem;
  padding: 1px 6px;
}


/* ===== Keyboard Shortcuts ===== */

/* Task highlight for arrow-key navigation */
.task-highlighted {
  background-color: rgba(248, 187, 208, 0.2);
  border-left: 3px solid #f8bbd0;
  border-radius: var(--radius-sm);
  transition: background-color var(--duration-quick) var(--easing-smooth);
}

body.theme-dark .task-highlighted {
  background-color: rgba(248, 187, 208, 0.12);
  border-left-color: #ce93d8;
}

/* Highlighted link within a highlighted task (l key cycles) */
.task-link-highlighted {
  outline: 2px solid #f8bbd0;
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  background-color: rgba(248, 187, 208, 0.15);
}

body.theme-dark .task-link-highlighted {
  outline-color: #ce93d8;
  background-color: rgba(206, 147, 216, 0.15);
}

/* Go-to mode indicator */
.goto-indicator {
  display: none;
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-sm);
  z-index: 10003;
  pointer-events: none;
  opacity: 0.9;
}

body.theme-dark .goto-indicator {
  background-color: #e0e0e0;
  color: #1a1a2e;
}

/* Keyboard shortcuts help modal */
.keyboard-shortcuts-help {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

.keyboard-shortcuts-help.active {
  display: flex;
}

.keyboard-shortcuts-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: var(--cursor-pointer);
}

.keyboard-shortcuts-modal {
  position: relative;
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  max-width: 800px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.keyboard-shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
}

.keyboard-shortcuts-header h2 {
  font-family: var(--font-header);
  font-size: 1.4rem;
  margin: 0;
  color: var(--color-text-primary);
}

.keyboard-shortcuts-close {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration-quick) var(--easing-smooth);
}

.keyboard-shortcuts-close:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Shortcuts grid layout */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
}

@media (max-width: 700px) {
  .shortcuts-grid {
    grid-template-columns: 1fr;
  }
}

.shortcuts-section {
  margin-bottom: var(--spacing-md);
}

.shortcuts-section h3 {
  font-family: var(--font-header);
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-sm) 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
  gap: var(--spacing-sm);
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.shortcut-or {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  opacity: 0.6;
  margin: 0 1px;
}

.shortcut-desc {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-primary);
  text-align: right;
}

/* Kbd key cap styling */
.keyboard-shortcuts-help kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-primary);
  background-color: var(--color-nav-beige);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  min-width: 1.4em;
  text-align: center;
  line-height: 1.4;
}

/* Dark mode for shortcuts help */
body.theme-dark .keyboard-shortcuts-modal {
  background-color: #1a1a2e;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.theme-dark .keyboard-shortcuts-header {
  border-bottom-color: #3d3d52;
}

body.theme-dark .keyboard-shortcuts-header h2 {
  color: #f5f5f5;
}

body.theme-dark .keyboard-shortcuts-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.theme-dark .shortcuts-section h3 {
  color: #a0a0b0;
}

body.theme-dark .shortcut-desc {
  color: #f5f5f5;
}

body.theme-dark .shortcut-keys {
  color: #a0a0b0;
}

body.theme-dark .keyboard-shortcuts-help kbd {
  background-color: #2a2a3e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

/* ===== Help Panel FAB & Panel ===== */

.help-panel-fab {
  position: fixed;
  bottom: calc(var(--spacing-lg) + 56px + var(--spacing-sm));
  right: var(--spacing-lg);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #b3e5fc;
  border: none;
  cursor: var(--cursor-pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(179, 229, 252, 0.5);
  transition: all var(--duration-normal) var(--easing-smooth);
  z-index: 1000;
}

.help-panel-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(129, 212, 250, 0.6);
  background-color: #81d4fa;
}

.help-panel-fab:active {
  transform: scale(0.95);
}

.help-panel-fab .pixel-icon {
  width: 24px;
  height: 24px;
  transition: opacity var(--duration-quick), transform var(--duration-normal) var(--easing-smooth);
}

.help-panel-fab .help-panel-icon-info {
  opacity: 1;
}

.help-panel-fab .help-panel-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-45deg);
}

.help-panel-fab.active {
  background-color: #81d4fa;
}

.help-panel-fab.active .help-panel-icon-info {
  opacity: 0;
  transform: rotate(45deg);
}

.help-panel-fab.active .help-panel-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Overlay */
.help-panel-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-smooth);
}

.help-panel-overlay.active {
  display: block;
  opacity: 1;
}

/* Panel */
.help-panel {
  position: fixed;
  bottom: calc(var(--spacing-lg) + 56px + var(--spacing-sm) + 56px + var(--spacing-sm));
  right: var(--spacing-lg);
  width: 380px;
  max-width: calc(100vw - 2 * var(--spacing-lg));
  height: 480px;
  max-height: 70vh;
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: all var(--duration-normal) var(--easing-bounce);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.help-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Tab navigation */
.help-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.help-panel-tab {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-xs);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all var(--duration-quick);
}

.help-panel-tab .pixel-icon {
  width: 18px;
  height: 18px;
}

.help-panel-tab:hover {
  color: var(--color-text-primary);
  background-color: rgba(179, 229, 252, 0.1);
}

.help-panel-tab.active {
  color: var(--color-text-primary);
  border-bottom-color: #81d4fa;
}

/* Tab content */
.help-panel-content {
  display: none;
  padding: var(--spacing-md);
  overflow-y: auto;
  flex: 1;
}

.help-panel-content.active {
  display: block;
}

/* Section intro text */
.help-panel-section-intro {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
}

/* Contact form fields */
.help-panel-field {
  margin-bottom: var(--spacing-md);
}

.help-panel-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-xs);
}

.help-panel-select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  cursor: var(--cursor-pointer);
}

.help-panel-textarea {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  background-color: var(--color-card-white);
  color: var(--color-text-primary);
  resize: vertical;
  min-height: 80px;
}

.help-panel-textarea:focus,
.help-panel-select:focus {
  outline: none;
  border-color: var(--color-text-primary);
}

.help-panel-char-count {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

.help-panel-submit {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: #b3e5fc;
  border: 2px solid #81d4fa;
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  transition: all var(--duration-quick);
}

.help-panel-submit:hover {
  background-color: #81d4fa;
}

.help-panel-submit:disabled {
  opacity: 0.6;
  cursor: var(--cursor-not-allowed);
}

.help-panel-submit .pixel-icon {
  width: 18px;
  height: 18px;
}

/* Keyboard shortcuts banner (bottom of panel) */
.help-panel-shortcut-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.help-panel-shortcut-banner .pixel-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
}

.help-panel kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  background-color: rgba(0, 0, 0, 0.06);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  margin: 0 2px;
}






.guide-tips {
  padding: 0 var(--spacing-xs);
}

.guide-tips-heading {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-family: var(--font-header);
  font-size: 0.9rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.guide-tips-heading .pixel-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.guide-tips-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.guide-tips-list li {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  padding-left: var(--spacing-md);
  position: relative;
}

.guide-tips-list li::before {
  content: "·";
  position: absolute;
  left: var(--spacing-xs);
  color: #81d4fa;
  font-weight: bold;
  font-size: 1.2em;
}

/* About tab */
.help-panel-about h3 {
  font-family: var(--font-header);
  margin-bottom: var(--spacing-sm);
}

.help-panel-about p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--spacing-sm);
}

.help-panel-about-values {
  background: rgba(179, 229, 252, 0.1);
  border-left: 3px solid #81d4fa;
  padding: var(--spacing-sm) var(--spacing-md);
  margin: var(--spacing-md) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.help-panel-about-values p {
  margin: var(--spacing-xs) 0;
  font-size: 0.85rem;
}

.help-panel-about-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin: var(--spacing-md) 0;
}

.help-panel-about-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: #0288d1;
  text-decoration: none;
  font-size: 0.9rem;
  transition: opacity var(--duration-quick);
}

.help-panel-about-links a:hover {
  opacity: 0.7;
}

.help-panel-about-links a .pixel-icon {
  width: 16px;
  height: 16px;
}

.help-panel-about-version {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  opacity: 0.7;
  margin-top: var(--spacing-md);
}

.help-panel-about-credits {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
}

.help-panel-about-credits h4 {
  font-family: var(--font-header);
  font-size: 0.85rem;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-secondary);
}

.help-panel-about-credits ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.help-panel-about-credits li {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  opacity: 0.85;
}

.help-panel-about-credits li .pixel-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.help-panel-about-credits a {
  color: #0288d1;
  text-decoration: none;
}

.help-panel-about-credits a:hover {
  opacity: 0.7;
}

.help-panel-referral-note {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  opacity: 0.6;
  margin-top: var(--spacing-xs);
  font-style: italic;
}

/* ===== Help Panel Mobile ===== */
@media (max-width: 768px) {
  .help-panel-fab {
    width: 48px;
    height: 48px;
    bottom: calc(var(--spacing-md) + 48px + var(--spacing-sm));
    right: var(--spacing-md);
  }

  .help-panel-fab .pixel-icon {
    width: 20px;
    height: 20px;
  }

  .help-panel {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }

  .help-panel.active {
    transform: translateY(0);
  }

  .help-panel-tab {
    font-size: 0.75rem;
    padding: var(--spacing-sm) var(--spacing-xs);
  }

  .help-panel-textarea {
    min-height: 100px;
    font-size: 1rem;
  }

  .guide-tips-list li {
    font-size: 0.8rem;
  }
}

/* ===== Help Panel Dark Mode ===== */
body.theme-dark .help-panel {
  background-color: #1e1e2e;
  border: 1px solid #3d3d52;
}

body.theme-dark .help-panel-tabs {
  background-color: #1e1e2e;
  border-bottom-color: #3d3d52;
}

body.theme-dark .help-panel-tab {
  color: #6a6a7a;
}

body.theme-dark .help-panel-tab:hover {
  color: #f5f5f5;
  background-color: rgba(179, 229, 252, 0.08);
}

body.theme-dark .help-panel-tab.active {
  color: #f5f5f5;
  background-color: rgba(179, 229, 252, 0.1);
}

body.theme-dark .help-panel-select,
body.theme-dark .help-panel-textarea {
  background-color: #2a2a3e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .help-panel-select:focus,
body.theme-dark .help-panel-textarea:focus {
  border-color: #a0a0b0;
}

body.theme-dark .help-panel-submit {
  background-color: rgba(179, 229, 252, 0.2);
  border-color: rgba(129, 212, 250, 0.3);
  color: #f5f5f5;
}

body.theme-dark .help-panel-submit:hover {
  background-color: rgba(179, 229, 252, 0.3);
}

body.theme-dark .help-panel-shortcut-banner {
  border-top-color: #3d3d52;
  color: #6a6a7a;
}

body.theme-dark .help-panel kbd {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .help-panel-guide h3,
body.theme-dark .help-panel-about h3 {
  color: #f5f5f5;
}

body.theme-dark .help-panel-about-values {
  background: rgba(179, 229, 252, 0.05);
  border-left-color: rgba(129, 212, 250, 0.3);
}

body.theme-dark .help-panel-about-links a {
  color: #81d4fa;
}

body.theme-dark .help-panel-about-credits a {
  color: #81d4fa;
}

body.theme-dark .help-panel-field label {
  color: #f5f5f5;
}

/* Guide tab dark mode */

body.theme-dark .guide-tips-heading {
  color: #f5f5f5;
}

/* ===== Spotify Player FAB & Panel ===== */

.spotify-player-fab {
  position: fixed;
  bottom: calc(var(--spacing-lg) + 3 * (56px + var(--spacing-sm)));
  right: var(--spacing-lg);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #1DB954;
  border: none;
  cursor: var(--cursor-pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(29, 185, 84, 0.4);
  transition: all var(--duration-normal) var(--easing-smooth);
  z-index: 1000;
  color: white;
}

.spotify-player-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(29, 185, 84, 0.6);
  background-color: #1ed760;
}

.spotify-player-fab:active {
  transform: scale(0.95);
}

.spotify-player-fab svg,
.spotify-player-fab .pixel-icon {
  width: 22px;
  height: 22px;
  transition: opacity var(--duration-quick), transform var(--duration-normal) var(--easing-smooth);
}

.spotify-player-fab .spotify-fab-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-45deg);
  filter: brightness(0) invert(1);
}

.spotify-player-fab.active {
  background-color: #1ed760;
}

.spotify-player-fab.active .spotify-fab-icon-open {
  opacity: 0;
  transform: rotate(45deg);
}

.spotify-player-fab.active .spotify-fab-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Overlay */
.spotify-player-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-smooth);
}

.spotify-player-overlay.active {
  display: block;
  opacity: 1;
}

/* Panel */
.spotify-player-panel {
  position: fixed;
  bottom: calc(var(--spacing-lg) + 3 * (56px + var(--spacing-sm)) + 56px + var(--spacing-sm));
  right: var(--spacing-lg);
  width: 360px;
  max-height: 520px;
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: all var(--duration-normal) var(--easing-bounce);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.spotify-player-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Panel Tabs */
.spotify-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.spotify-panel-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: var(--cursor-pointer);
  transition: all var(--transition-base);
}

.spotify-panel-tab:focus {
  outline: none;
}

.spotify-panel-tab:focus-visible {
  outline: 2px solid #1DB954;
  outline-offset: 2px;
}

.spotify-panel-tab:hover {
  background-color: #f8f9fa;
  color: var(--color-text-primary);
}

.spotify-panel-tab.active {
  color: #1DB954;
  border-bottom-color: #1DB954;
}

.spotify-panel-tab .pixel-icon {
  width: 16px;
  height: 16px;
}

/* Now Playing */
.spotify-now-playing {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  text-decoration: none;
  color: inherit;
}

.spotify-now-playing:hover {
  text-decoration: none;
  color: inherit;
}

.spotify-album-art {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  display: none;
  flex-shrink: 0;
}

.spotify-now-playing.has-track .spotify-album-art {
  display: block;
}

.spotify-track-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.spotify-track-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-artist-name {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Bar */
.spotify-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 var(--spacing-lg);
}

.spotify-time {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.spotify-progress-track {
  flex: 1;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  cursor: var(--cursor-pointer);
  overflow: hidden;
}

.spotify-progress-fill {
  height: 100%;
  background: #1DB954;
  border-radius: 2px;
  width: 0%;
  transition: width 1s linear;
}

/* Playback Controls */
.spotify-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-lg);
}

.spotify-control-btn {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  color: var(--color-text-primary);
}

.spotify-control-btn:hover {
  background-color: #f0f0f0;
}

.spotify-control-btn .pixel-icon {
  width: 20px;
  height: 20px;
}

.spotify-control-btn--play {
  background-color: #1DB954;
  padding: 10px;
}

.spotify-control-btn--play:hover {
  background-color: #1ed760;
}

.spotify-control-btn--play .pixel-icon {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
  /* Optical alignment: play triangle is visually heavier on the right */
  transform: translateX(1px);
}

.spotify-control-btn--sm {
  opacity: 0.5;
}

.spotify-control-btn--sm:hover {
  opacity: 1;
}

.spotify-control-btn.disabled,
.spotify-control-btn:disabled {
  opacity: 0.2;
  cursor: var(--cursor-not-allowed);
  pointer-events: none;
}

.spotify-control-btn--sm.active {
  opacity: 1;
  color: #1DB954;
}

.spotify-control-btn--sm.active .pixel-icon {
  filter: invert(55%) sepia(94%) saturate(383%) hue-rotate(100deg) brightness(90%) contrast(93%);
}

.spotify-control-btn--sm.repeat-one {
  position: relative;
}

.spotify-control-btn--sm.repeat-one::after {
  content: "1";
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #1DB954;
}

/* Volume */
.spotify-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px var(--spacing-lg) var(--spacing-sm);
}

.spotify-volume .pixel-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
}

.spotify-volume-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  border-radius: 2px;
  outline: none;
}

.spotify-volume-slider:focus-visible {
  outline: 2px solid #1DB954;
  outline-offset: 2px;
}

.spotify-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1DB954;
  cursor: var(--cursor-pointer);
}

/* Device Status */
.spotify-device-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  padding: 4px var(--spacing-lg) var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
}

.spotify-device-status-message {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.spotify-device-status-message.spotify-error {
  width: 100%;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background-color: #c0392b;
  border-radius: 6px;
}

.spotify-attribution {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #1DB954;
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity var(--transition-base);
}

.spotify-attribution:hover {
  opacity: 1;
  text-decoration: none;
}

.spotify-attribution svg {
  flex-shrink: 0;
}

/* Browse Section */
/* Browse section fills remaining panel space */
[data-spotify-player-target~="browseSection"],
[data-spotify-player-target~="playerControls"] {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.spotify-search {
  padding: var(--spacing-sm) var(--spacing-md);
  flex-shrink: 0;
}

.spotify-search-wrapper {
  position: relative;
}

.spotify-search-input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  cursor: var(--cursor-text);
  font-size: 0.85rem;
  outline: none;
  box-sizing: border-box;
}

.spotify-search-input:focus {
  border-color: #1DB954;
  box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.15);
}

.spotify-search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: var(--cursor-pointer);
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotify-search-clear:hover {
  opacity: 1;
}

.spotify-search-clear .pixel-icon-sm {
  width: 14px;
  height: 14px;
}

.spotify-search-results,
.spotify-browse-content {
  overflow-y: auto;
  max-height: 340px;
  padding: 0 var(--spacing-sm);
}

.spotify-browse-hint {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  padding: var(--spacing-lg);
}

.spotify-browse-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 8px;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  font-family: inherit;
  text-align: left;
  transition: background-color var(--transition-base);
}

.spotify-browse-item:hover {
  background-color: #f8f9fa;
}

.spotify-browse-item-art {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.spotify-browse-item-art--sm {
  width: 36px;
  height: 36px;
}

.spotify-browse-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.spotify-browse-item-name {
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-browse-item-meta {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-explicit-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  background-color: var(--color-text-secondary);
  color: var(--color-bg-primary, #fff);
  border-radius: 2px;
  padding: 1px 4px;
  margin-right: 4px;
  vertical-align: middle;
  line-height: 1;
}

/* Context Action Buttons (Play / Shuffle) */
.spotify-context-actions {
  display: flex;
  gap: 8px;
  padding: 12px;
}

.spotify-context-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: var(--cursor-pointer);
  background: #1DB954;
  color: #fff;
  transition: background 0.15s, transform 0.1s;
}

.spotify-context-btn:hover {
  background: #1ed760;
  transform: scale(1.02);
}

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

.spotify-context-btn .pixel-icon {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.spotify-context-btn--shuffle {
  background: transparent;
  color: #1DB954;
  border: 1.5px solid #1DB954;
}

.spotify-context-btn--shuffle:hover {
  background: rgba(29, 185, 84, 0.1);
}

.spotify-context-btn--shuffle .pixel-icon {
  filter: brightness(0) saturate(100%) invert(56%) sepia(74%) saturate(531%) hue-rotate(101deg) brightness(93%) contrast(95%);
}

.spotify-explore-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.8rem;
  color: #1DB954;
  text-decoration: none;
  border-top: 1px solid var(--color-border);
  cursor: var(--cursor-pointer);
}

.spotify-explore-link .pixel-icon-sm {
  filter: brightness(0) saturate(100%) invert(56%) sepia(74%) saturate(531%) hue-rotate(101deg) brightness(93%) contrast(95%);
}

.spotify-explore-link:hover {
  text-decoration: underline;
}

/* DJ Entry */
.spotify-browse-item--dj {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
  padding-bottom: 12px;
}

.spotify-dj-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1DB954, #191414);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

/* Spotify Player Dark Theme */
body.theme-dark .spotify-player-panel {
  background-color: #1e1e2e;
}

body.theme-dark .spotify-panel-tabs {
  border-bottom-color: #3d3d52;
}

body.theme-dark .spotify-panel-tab {
  color: #a0a0b0;
}

body.theme-dark .spotify-panel-tab:hover {
  background-color: #2a2a3e;
  color: #f5f5f5;
}

body.theme-dark .spotify-panel-tab.active {
  color: #1DB954;
  border-bottom-color: #1DB954;
}

body.theme-dark .spotify-track-name {
  color: #f5f5f5;
}

body.theme-dark .spotify-progress-track {
  background: #3d3d52;
}

body.theme-dark .spotify-control-btn:hover {
  background-color: #2a2a3e;
}

body.theme-dark .spotify-volume-slider {
  background: #3d3d52;
}

body.theme-dark .spotify-device-status {
  border-bottom-color: #3d3d52;
}

body.theme-dark .spotify-search-input {
  background-color: #2a2a3e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .spotify-search-input:focus {
  border-color: #1DB954;
}

body.theme-dark .spotify-search-clear .pixel-icon-sm {
  filter: brightness(0) invert(1);
}

body.theme-dark .spotify-browse-item:hover {
  background-color: #2a2a3e;
}

body.theme-dark .spotify-browse-item-name {
  color: #f5f5f5;
}

body.theme-dark .spotify-explicit-badge {
  background-color: #a0a0b0;
  color: #1e1e2e;
}

body.theme-dark .spotify-explore-link {
  border-top-color: #3d3d52;
}

body.theme-dark .spotify-context-btn--shuffle {
  color: #1ed760;
  border-color: #1ed760;
}

body.theme-dark .spotify-context-btn--shuffle .pixel-icon {
  filter: brightness(0) saturate(100%) invert(70%) sepia(74%) saturate(531%) hue-rotate(101deg) brightness(100%) contrast(95%);
}

/* Browse Section Labels */
.spotify-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  padding: 12px 12px 4px;
  margin-top: 4px;
}

/* Browse Header (Detail View) */
.spotify-browse-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
}

.spotify-browse-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text-secondary);
  transition: background-color 0.15s, color 0.15s;
}

.spotify-browse-back:hover {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--color-text-primary);
}

.spotify-browse-back .pixel-icon {
  width: 16px;
  height: 16px;
}

/* Detail View Info Header */
.spotify-detail-info {
  padding: 12px;
}

.spotify-detail-header-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: background-color 0.15s;
}

.spotify-detail-header-link:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.spotify-detail-cover {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.spotify-detail-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.spotify-detail-artist {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Track Rows (Detail View) */
.spotify-detail-tracks {
  max-height: 280px;
  overflow-y: auto;
}

.spotify-track-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  width: 100%;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  font-family: inherit;
  text-align: left;
  transition: background-color 0.15s;
  color: var(--color-text-primary);
}

.spotify-track-row:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.spotify-track-row--playing {
  background-color: rgba(30, 215, 96, 0.08);
}

.spotify-track-row--playing .spotify-track-row-name {
  color: #1DB954;
}

.spotify-track-row--playing .spotify-track-row-num {
  color: #1DB954;
}

.spotify-track-row-num {
  width: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.spotify-track-row-info {
  flex: 1;
  min-width: 0;
}

.spotify-track-row-name {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotify-track-row-artist {
  display: block;
  font-size: 11px;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotify-track-row-duration {
  font-size: 11px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

/* Dark mode: browse detail */
body.theme-dark .spotify-browse-back:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .spotify-detail-header-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

body.theme-dark .spotify-detail-title {
  color: #f5f5f5;
}

body.theme-dark .spotify-track-row:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

body.theme-dark .spotify-track-row--playing {
  background-color: rgba(30, 215, 96, 0.12);
}

body.theme-dark .spotify-track-row-name {
  color: #f5f5f5;
}

body.theme-dark .spotify-browse-header {
  border-bottom-color: #3d3d52;
}

body.theme-dark .spotify-browse-item--dj {
  border-bottom-color: #3d3d52;
}

/* Spotify Player Mobile */
@media (max-width: 768px) {
  .spotify-player-panel {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .spotify-player-fab {
    width: 48px;
    height: 48px;
    bottom: calc(var(--spacing-md) + 3 * (48px + var(--spacing-sm)));
    right: var(--spacing-md);
  }
}

/* ===== Month Wrapped ===== */

/* --- Mode Toggle --- */
.wrapped-mode-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.mode-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: var(--cursor-pointer);
  opacity: 0.5;
  transition: all var(--duration-quick) var(--easing-smooth);
}

.mode-btn.active {
  background: white;
  opacity: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mode-btn .pixel-icon {
  width: 18px;
  height: 18px;
}

/* --- Card Scroll Mode --- */
.wrapped-cards {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 1rem;
  scroll-behavior: smooth;
}

/* --- Card Base --- */
.wrapped-card {
  min-width: 300px;
  max-width: 300px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
}

.wrapped-card-inner {
  padding: var(--spacing-xl) var(--spacing-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--spacing-sm);
  min-height: 480px;
  justify-content: center;
}

/* --- Download Button --- */
.wrapped-download-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  border-radius: 6px;
  padding: 5px 6px;
  cursor: var(--cursor-pointer);
  opacity: 0;
  transition: opacity var(--duration-quick) var(--easing-smooth),
              background var(--duration-quick) var(--easing-smooth);
  z-index: 2;
  line-height: 1;
}

.wrapped-card:hover .wrapped-download-btn {
  opacity: 0.7;
}

.wrapped-download-btn:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.85);
}

.wrapped-download-btn.downloading {
  opacity: 1;
  animation: wrapped-pulse 0.8s ease-in-out infinite;
}

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

/* --- Hero Icon (large centered icon) --- */
.wrapped-hero-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--spacing-sm);
  opacity: 0.85;
}

.wrapped-hero-icon-sm {
  width: 32px;
  height: 32px;
  opacity: 0.85;
}

.pixel-icon-sm {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* --- Typography --- */
.wrapped-big-text {
  font-family: var(--font-header);
  font-size: 2rem;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.wrapped-big-number {
  font-family: var(--font-header);
  font-size: 3.5rem;
  color: var(--color-text-primary);
  line-height: 1;
}

.wrapped-adjective {
  font-family: var(--font-header);
  font-size: 2.2rem;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.wrapped-vibe {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--color-text-primary);
  font-style: italic;
}

.wrapped-label {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text-primary);
}

.wrapped-subtle {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

/* --- Card Color Palette (rich cozy pastels) --- */
.wrapped-card-intro { background: linear-gradient(135deg, #c9a0e8, #d8b5f0); }
.wrapped-card-tasks { background: linear-gradient(135deg, #f0b090, #f5c0a5); }
.wrapped-card-vibe { background: linear-gradient(135deg, #b8a0e8, #cab0f0); }
.wrapped-card-cat-alignment { background: linear-gradient(135deg, #88d0a8, #9cd8b8); }
.wrapped-card-rhythm { background: linear-gradient(135deg, #f098b0, #f5a8c0); }
.wrapped-card-login { background: linear-gradient(135deg, #98b0f0, #a8c0f5); }
.wrapped-card-week { background: linear-gradient(135deg, #f0cc70, #f5d890); }
.wrapped-card-day { background: linear-gradient(135deg, #78d0c8, #90d8d0); }
.wrapped-card-top-cat { background: linear-gradient(135deg, #e090c0, #e8a0d0); }
.wrapped-card-breakdown { background: linear-gradient(135deg, #b8b0d8, #c8c0e5); }
.wrapped-card-subtasks { background: linear-gradient(135deg, #80d0a0, #95d8b0); }
.wrapped-card-deadlines { background: linear-gradient(135deg, #f0c068, #f5d088); }
.wrapped-card-month-ref { background: linear-gradient(135deg, #b8b0d8, #c8c0e5); }
.wrapped-card-intention { background: linear-gradient(135deg, #a0c8e8, #b0d8f0); }
.wrapped-card-necessary { background: linear-gradient(135deg, #e8c0a0, #f0d0b0); }
.wrapped-card-weekly { background: linear-gradient(135deg, #a0e8c8, #b0f0d8); }
.wrapped-card-progress { background: linear-gradient(135deg, #d0c0e8, #e0d0f0); }
.wrapped-card-trend { background: linear-gradient(135deg, #98c8f0, #a8d8f5); }
.wrapped-card-suggestions { background: linear-gradient(135deg, #f0e098, #f5e8b0); }
.wrapped-card-summary { background: linear-gradient(135deg, #c9a0e8, #f098b0, #98b0f0); }
.wrapped-card-soundtrack-intro { background: linear-gradient(135deg, #a8e0b0, #b8e8c0); }
.wrapped-card-soundtrack-tracks { background: linear-gradient(135deg, #e8c8a0, #f0d8b0); }
.wrapped-card-soundtrack-mood { background: linear-gradient(135deg, #c0a8f0, #d0b8f5); }
.wrapped-card-soundtrack-focus { background: linear-gradient(135deg, #a0d8e0, #b0e0e8); }

/* --- Theme Badge (intro card) --- */
.wrapped-theme-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--color-text-primary);
  margin-top: var(--spacing-sm);
}

/* --- Comparison (tasks completed card) --- */
.wrapped-comparison {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin-top: var(--spacing-sm);
}

.wrapped-comparison-up {
  background: rgba(76, 175, 80, 0.15);
  color: #2e7d32;
}

.wrapped-comparison-down {
  background: rgba(244, 67, 54, 0.1);
  color: #c62828;
}

/* --- Alignment Breakdown (vibe card) --- */
.wrapped-alignment-score {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-primary);
  margin-top: var(--spacing-xs);
}

.wrapped-alignment-breakdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.alignment-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.8rem;
}

.alignment-tag.alignment-fully { background: rgba(76, 175, 80, 0.15); color: #2e7d32; }
.alignment-tag.alignment-somewhat { background: rgba(255, 193, 7, 0.15); color: #f57f17; }
.alignment-tag.alignment-not { background: rgba(244, 67, 54, 0.1); color: #c62828; }

/* --- Split Card (most/least aligned) --- */
.wrapped-split {
  display: flex;
  gap: var(--spacing-md);
  width: 100%;
  margin-top: var(--spacing-sm);
}

.wrapped-split-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
}

.wrapped-split-up { background: rgba(76, 175, 80, 0.08); }
.wrapped-split-down { background: rgba(244, 67, 54, 0.05); }

.wrapped-split-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-primary);
}

.wrapped-split-value {
  font-family: var(--font-header);
  font-size: 1.3rem;
  color: var(--color-text-primary);
}

.wrapped-split-score {
  font-family: var(--font-header);
  font-size: 1.5rem;
  color: var(--color-text-primary);
}

/* --- Rhythm Extras (merged day/week insights) --- */
.wrapped-rhythm-extras {
  margin-top: var(--spacing-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wrapped-rhythm-extras .wrapped-subtle {
  font-size: 0.8rem;
}

/* --- Day Cycle Bars --- */
.wrapped-day-cycle-bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--spacing-sm);
}

.day-cycle-bar-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.day-cycle-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-primary);
  width: 52px;
  text-align: left;
}

.day-cycle-bar-track {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.day-cycle-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s var(--easing-bounce);
}

.day-cycle-sunrise { background: linear-gradient(90deg, #ffcc80, #ffab40); }
.day-cycle-day { background: linear-gradient(90deg, #fff176, #ffd54f); }
.day-cycle-sunset { background: linear-gradient(90deg, #ef9a9a, #e57373); }
.day-cycle-night { background: linear-gradient(90deg, #90caf9, #64b5f6); }

.day-cycle-count {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-primary);
  width: 20px;
  text-align: right;
}

/* --- Mini Bars (vertical, for weeks) --- */
.wrapped-mini-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-sm);
  height: 100px;
  margin-top: var(--spacing-md);
}

.mini-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
}

.mini-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.mini-bar-fill {
  width: 100%;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s var(--easing-bounce);
  min-height: 4px;
}

.mini-bar-highlight {
  background: linear-gradient(to top, #ffab40, #ffcc80);
}

.mini-bar-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-primary);
  margin-top: 4px;
}

/* --- Horizontal Bars (for days of week) --- */
.wrapped-mini-bars-horizontal {
  flex-direction: column;
  height: auto;
  align-items: stretch;
  gap: 4px;
}

.day-bar-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.day-bar-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-primary);
  width: 30px;
}

.day-bar-track {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.day-bar-fill {
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  transition: width 0.6s var(--easing-bounce);
  min-width: 4px;
}

.day-bar-highlight {
  background: linear-gradient(90deg, #80cbc4, #4db6ac);
}

.day-bar-count {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-primary);
  width: 16px;
  text-align: right;
}

/* --- Category Bars (breakdown card) --- */
.wrapped-category-bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--spacing-sm);
}

.category-bar-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.category-bar-label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
  width: 80px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-bar-track {
  flex: 1;
  height: 16px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ce93d8, #ba68c8);
  border-radius: 8px;
  transition: width 0.6s var(--easing-bounce);
  min-width: 4px;
}

.category-bar-count {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
  width: 20px;
  text-align: right;
}

/* --- Categories Reference List (Your Month card) --- */
.wrapped-categories-list {
  width: 100%;
  text-align: left;
}

.wrapped-cat-section {
  border-bottom: 1px solid var(--color-border);
}

.wrapped-cat-section:last-child {
  border-bottom: none;
}

.wrapped-cat-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--spacing-sm) 0;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text-primary);
  gap: var(--spacing-xs);
}

.wrapped-cat-name {
  flex: 1;
  text-align: left;
}

.wrapped-cat-count {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 8px;
  border-radius: 10px;
}

.wrapped-chevron {
  transition: transform var(--duration-quick) var(--easing-smooth);
}

.wrapped-cat-tasks {
  padding: 0 0 var(--spacing-sm) var(--spacing-sm);
}

.wrapped-task-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 3px 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

/* --- Summary Card --- */
.wrapped-summary-title {
  font-family: var(--font-header);
  font-size: 1.6rem;
  color: var(--color-text-primary);
}

.wrapped-summary-theme {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--color-text-primary);
  font-style: italic;
}

.wrapped-summary-grid {
  display: flex;
  gap: var(--spacing-lg);
  margin: var(--spacing-md) 0;
}

.wrapped-summary-stat {
  text-align: center;
}

.wrapped-summary-number {
  font-family: var(--font-header);
  font-size: 1.8rem;
  color: var(--color-text-primary);
}

.wrapped-summary-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.wrapped-summary-badge {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
}

.wrapped-summary-adjective {
  font-family: var(--font-header);
  font-size: 1.2rem;
}

.wrapped-summary-vibe {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.wrapped-summary-personality {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

.wrapped-summary-brand {
  font-family: var(--font-header);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  opacity: 0.5;
  margin-top: var(--spacing-md);
}

.wrapped-summary-intention {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

.wrapped-summary-necessary {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

.wrapped-summary-soundtrack {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wrapped-summary-mood {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

/* --- Spotify Soundtrack Cards --- */
.spotify-stats-row {
  display: flex;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-md);
}

.spotify-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spotify-stat-number {
  font-family: var(--font-header);
  font-size: 1.6rem;
  color: var(--color-text-primary);
}

.spotify-stat-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.spotify-wrapped-attribution {
  margin-top: var(--spacing-md);
}

.spotify-wrapped-attribution a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  opacity: 0.7;
}

.spotify-wrapped-attribution a:hover {
  opacity: 1;
}

.spotify-wrapped-attribution svg {
  flex-shrink: 0;
}

.spotify-logo-text {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Track list (top tracks card) */
.spotify-track-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--spacing-sm);
  width: 100%;
}

.spotify-track-list .spotify-track-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.spotify-track-list .spotify-track-row:hover {
  background: rgba(255, 255, 255, 0.5);
}

.spotify-track-rank {
  font-family: var(--font-header);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.spotify-album-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.spotify-album-placeholder {
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotify-album-hero {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.spotify-track-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.spotify-track-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-track-artist {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-track-plays {
  font-family: var(--font-header);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

/* Audio feature bars (mood card) */
.spotify-feature-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: var(--spacing-sm);
}

.spotify-feature-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.spotify-feature-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-primary);
  width: 80px;
  text-align: left;
  flex-shrink: 0;
}

.spotify-feature-track {
  flex: 1;
  height: 10px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 5px;
  overflow: hidden;
}

.spotify-feature-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s var(--easing-bounce);
}

.spotify-feature-energy { background: linear-gradient(90deg, #ff9800, #ff5722); }
.spotify-feature-valence { background: linear-gradient(90deg, #ffeb3b, #ffc107); }
.spotify-feature-danceability { background: linear-gradient(90deg, #e91e63, #f06292); }
.spotify-feature-instrumental { background: linear-gradient(90deg, #9c27b0, #ce93d8); }

.spotify-feature-value {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.spotify-feature-bpm {
  font-family: var(--font-header);
  font-size: 0.9rem;
  color: var(--color-text-primary);
}

/* Genre tags */
.spotify-genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--spacing-md);
}

.spotify-genre-tag {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-primary);
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 20px;
}

/* Focus anthem card */
.spotify-anthem-hero {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin: var(--spacing-md) 0;
  text-decoration: none;
  color: inherit;
}

.spotify-anthem-info {
  display: flex;
  flex-direction: column;
}

.spotify-anthem-title {
  font-family: var(--font-header);
  font-size: 1.1rem;
  color: var(--color-text-primary);
}

.spotify-anthem-artist {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.spotify-anthem-stat {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Weekly energy mini-bars (focus card) */
.spotify-weekly-energy-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-sm);
  height: 60px;
  margin-top: var(--spacing-xs);
}

.spotify-energy-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.spotify-energy-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.spotify-energy-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #1db954, #1ed760);
  border-radius: 4px;
  transition: height 0.6s var(--easing-bounce);
}

.spotify-energy-week {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Dark mode adjustments for Spotify cards */
body.theme-dark .spotify-track-list .spotify-track-row {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .spotify-track-list .spotify-track-row:hover {
  background: rgba(255, 255, 255, 0.15);
}

body.theme-dark .spotify-feature-track {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .spotify-genre-tag {
  background: rgba(255, 255, 255, 0.12);
}

body.theme-dark .spotify-energy-bar-track {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .spotify-album-placeholder {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .spotify-album-thumb,
body.theme-dark .spotify-album-hero {
  filter: none;
}

/* --- Intention vs Reality Card --- */
.wrapped-intention-quote {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  color: var(--color-text-primary);
  padding: var(--spacing-md);
  margin: var(--spacing-sm) 0;
  background: rgba(255, 255, 255, 0.5);
  border-left: 3px solid rgba(0, 0, 0, 0.15);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  text-align: left;
  line-height: 1.5;
}

.wrapped-signals {
  width: 100%;
  margin-top: var(--spacing-xs);
}

.wrapped-signal {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-align: left;
}

.wrapped-signal-aligned { background: rgba(76, 175, 80, 0.1); }
.wrapped-signal-misaligned { background: rgba(244, 67, 54, 0.08); }

.wrapped-signal-label {
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-text-primary);
}

.wrapped-signal-text {
  color: var(--color-text-primary);
}

.wrapped-intention-divider {
  width: 40px;
  height: 2px;
  background: rgba(0, 0, 0, 0.1);
  margin: var(--spacing-md) auto;
  border-radius: 1px;
}

.wrapped-intention-result {
  font-family: var(--font-header);
  font-size: 1.4rem;
  color: var(--color-text-primary);
  margin-top: var(--spacing-xs);
}

.wrapped-intention-score {
  font-size: 1.8rem;
}

/* --- Necessary vs Aligned Card --- */
.wrapped-quadrant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-sm);
  width: 100%;
  margin: var(--spacing-sm) 0;
}

.wrapped-quadrant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--spacing-sm) var(--spacing-xs);
  border-radius: var(--radius-md);
  text-align: center;
}

.wrapped-quadrant-sweet-spot { background: rgba(76, 175, 80, 0.12); }
.wrapped-quadrant-obligations { background: rgba(255, 152, 0, 0.12); }
.wrapped-quadrant-passion { background: rgba(33, 150, 243, 0.12); }
.wrapped-quadrant-drift { background: rgba(158, 158, 158, 0.12); }

.wrapped-quadrant-number {
  font-family: var(--font-header);
  font-size: 1.6rem;
  color: var(--color-text-primary);
}

.wrapped-quadrant-label {
  font-family: var(--font-header);
  font-size: 0.85rem;
  color: var(--color-text-primary);
}

.wrapped-quadrant-desc {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* --- Weekly Alignment Card --- */
.wrapped-weekly-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--spacing-md);
  height: 120px;
  width: 100%;
  margin: var(--spacing-md) 0;
}

.wrapped-weekly-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  max-width: 60px;
}

.wrapped-weekly-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.wrapped-weekly-bar-fill {
  width: 100%;
  max-width: 36px;
  background: rgba(76, 175, 80, 0.3);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s var(--easing-bounce);
  min-height: 4px;
}

.wrapped-weekly-drift {
  background: rgba(255, 152, 0, 0.4);
}

.wrapped-weekly-bar-empty {
  width: 100%;
  max-width: 36px;
  height: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.wrapped-weekly-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-primary);
  margin-top: 4px;
}

.wrapped-weekly-score {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.wrapped-weekly-score-empty {
  opacity: 0.3;
}

/* --- Multi-Month Trend Card --- */
.wrapped-trend-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--spacing-sm);
  height: 120px;
  width: 100%;
  margin: var(--spacing-md) 0;
}

.wrapped-trend-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  max-width: 50px;
}

.wrapped-trend-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.wrapped-trend-bar-fill {
  width: 100%;
  max-width: 30px;
  background: rgba(100, 150, 220, 0.3);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s var(--easing-bounce);
  min-height: 4px;
}

.wrapped-trend-current {
  background: linear-gradient(to top, rgba(100, 150, 220, 0.5), rgba(130, 180, 250, 0.6));
}

.wrapped-trend-month {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-primary);
  margin-top: 4px;
}

.wrapped-trend-score {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

/* --- Suggestions Card --- */
.wrapped-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  width: 100%;
  margin: var(--spacing-sm) 0;
  text-align: left;
}

.wrapped-suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-primary);
  line-height: 1.4;
}

.wrapped-suggestion-item img {
  margin-top: 2px;
  flex-shrink: 0;
}

/* ====================================
   TRENDS PAGE
   ==================================== */
.trends-container {
  max-width: 700px;
  margin: 0 auto;
}

.trends-section {
  margin-bottom: var(--spacing-xl);
}

.trends-section-title {
  font-family: var(--font-header);
  font-size: 1.3rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
}

/* --- Alignment Chart --- */
.trends-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-sm);
  height: 180px;
  padding: var(--spacing-md);
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  overflow-x: auto;
}

.trends-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 50px;
  height: 100%;
}

.trends-chart-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.trends-chart-bar-fill {
  width: 100%;
  max-width: 32px;
  background: linear-gradient(to top, #b8a0e8, #d8b5f0);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
}

.trends-chart-score {
  font-family: var(--font-header);
  font-size: 0.8rem;
  color: var(--color-text-primary);
  margin-top: 4px;
}

.trends-chart-month {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.trends-chart-theme {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  opacity: 0.6;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* --- Stats Grid --- */
.trends-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

.trends-stat-card {
  padding: var(--spacing-lg);
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  text-align: center;
}

.trends-stat-number {
  font-family: var(--font-header);
  font-size: 2rem;
  color: var(--color-text-primary);
}

.trends-stat-label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

/* --- Vibe Badge --- */
.trends-vibe-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, #c9a0e8, #d8b5f0);
  border-radius: var(--radius-lg);
  text-align: center;
}

.trends-vibe-adjective {
  font-family: var(--font-header);
  font-size: 2rem;
  color: var(--color-text-primary);
}

.trends-vibe-desc {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-primary);
  opacity: 0.7;
}

/* --- Category Frequency --- */
.trends-category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  padding: var(--spacing-lg);
}

.trends-category-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.trends-category-name {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-primary);
  width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trends-category-bar-track {
  flex: 1;
  height: 16px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.trends-category-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ce93d8, #ba68c8);
  border-radius: 8px;
  min-width: 4px;
}

.trends-category-count {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* --- Trends Dark Mode --- */
body.theme-dark .trends-chart {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .trends-stat-card {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .trends-category-list {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .trends-subsection {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .trends-chart-bar-fill {
  background: linear-gradient(to top, #5548a0, #7068b8);
}

body.theme-dark .trends-vibe-badge {
  background: linear-gradient(135deg, #5c3d8f, #7b52b5);
}

body.theme-dark .trends-vibe-adjective { color: #ffffff; }
body.theme-dark .trends-vibe-desc { color: rgba(255, 255, 255, 0.7); }

body.theme-dark .trends-category-bar-track {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .trends-category-bar-fill {
  background: linear-gradient(90deg, #9c64b5, #8040a0);
}

/* --- Trends: Spotify Listening Journey --- */
.trends-spotify-bar {
  background: linear-gradient(180deg, #1db954, #1ed760) !important;
}

.trends-subsection {
  margin-top: var(--spacing-lg);
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  box-shadow: 0 2px 8px var(--color-shadow);
}

.trends-subsection-title {
  font-family: var(--font-header);
  font-size: 1.1rem;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.trends-energy-valence-chart {
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-end;
  height: 120px;
  padding: var(--spacing-sm) 0;
}

.trends-ev-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.trends-ev-bars {
  flex: 1;
  display: flex;
  gap: 3px;
  align-items: flex-end;
  width: 100%;
}

.trends-ev-bar {
  flex: 1;
  border-radius: 3px;
  transition: height 0.6s var(--easing-bounce);
}

.trends-ev-energy {
  background: linear-gradient(180deg, #ff9800, #ff5722);
}

.trends-ev-valence {
  background: linear-gradient(180deg, #ffeb3b, #ffc107);
}

.trends-ev-month {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.trends-ev-legend {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  margin-top: var(--spacing-sm);
}

.trends-ev-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.trends-ev-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.trends-ev-energy-swatch { background: #ff9800; }
.trends-ev-valence-swatch { background: #ffeb3b; }

.trends-genre-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.trends-genre-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.trends-genre-month-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--color-text-secondary);
}

.trends-genre-pill {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-primary);
  padding: 3px 10px;
  background: rgba(29, 185, 84, 0.15);
  border-radius: 20px;
}

.trends-spotify-attribution {
  margin-top: var(--spacing-lg);
  text-align: center;
}

.trends-spotify-attribution a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  opacity: 0.7;
}

.trends-spotify-attribution a:hover {
  opacity: 1;
}

body.theme-dark .trends-spotify-bar {
  background: linear-gradient(180deg, #1db954, #1ed760) !important;
}

body.theme-dark .trends-genre-pill {
  background: rgba(29, 185, 84, 0.25);
}

/* === Trends: AI Coaching Section === */

.trends-ai-section {
  margin-bottom: var(--spacing-xl);
}

.trends-ai-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.trends-ai-badge {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  color: #6b4fa8;
  background: #ede8f8;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Analysis summary badges */
.trends-ai-analysis-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--spacing-sm);
}

.trends-ai-analysis-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  background: var(--color-card-white);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  padding: 3px 10px;
}

.trends-ai-analysis-badge .pixel-icon {
  width: 11px;
  height: 11px;
  opacity: 0.5;
}

.trends-ai-insights-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.trends-ai-insight {
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  padding: var(--spacing-md) var(--spacing-lg);
  border-left: 3px solid transparent;
}

.trends-ai-insight--working  { border-left-color: #4caf50; }
.trends-ai-insight--pattern  { border-left-color: #9c64b5; }
.trends-ai-insight--watch    { border-left-color: #ff9800; }
.trends-ai-insight--edge     { border-left-color: #2196f3; }

.trends-ai-insight-category {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

.trends-ai-insight--working .trends-ai-insight-category  { color: #2e7d32; }
.trends-ai-insight--pattern .trends-ai-insight-category  { color: #6b3fa0; }
.trends-ai-insight--watch .trends-ai-insight-category    { color: #e65100; }
.trends-ai-insight--edge .trends-ai-insight-category     { color: #1565c0; }

.trends-ai-insight-headline {
  font-family: var(--font-header);
  font-size: 0.95rem;
  color: var(--color-text-primary);
  margin: 0 0 4px 0;
}

.trends-ai-insight-body {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Coaching note callout */
.trends-ai-coaching-note {
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  padding: var(--spacing-md) var(--spacing-lg);
  border-left: 3px solid #6b4fa8;
}

.trends-ai-coaching-note-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.trends-ai-coaching-note-text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
  margin: 0;
  line-height: 1.5;
}

/* Actions row */
.trends-ai-actions {
  margin-top: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.trends-ai-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b4fa8;
  background: #ede8f8;
  border: 1px solid #ddd5f5;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.trends-ai-chat-btn:hover {
  background: #e0d8f5;
}

.trends-ai-chat-btn .pixel-icon {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.trends-ai-refresh-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.trends-ai-refresh-link:hover {
  opacity: 1;
}

.trends-ai-refresh-link .pixel-icon {
  width: 12px;
  height: 12px;
}

/* Loading skeleton */
.trends-ai-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.trends-ai-skeleton-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xs);
}

.trends-ai-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #ddd5f5;
  border-top-color: #6b4fa8;
  border-radius: 50%;
  animation: trends-ai-spin 0.8s linear infinite;
}

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

.trends-ai-skeleton-card {
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  padding: var(--spacing-md) var(--spacing-lg);
  border-left: 3px solid #e0e0e0;
}

.skeleton-line {
  background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  height: 10px;
  margin-bottom: 8px;
}

.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line--short  { width: 25%; }
.skeleton-line--medium { width: 50%; }
.skeleton-line--long   { width: 80%; }

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* No-key prompt */
.trends-ai-prompt {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  border: 1px dashed var(--color-border);
  margin-bottom: var(--spacing-xl);
}

.trends-ai-prompt-icon {
  width: 20px;
  height: 20px;
  opacity: 0.5;
  flex-shrink: 0;
  margin-top: 2px;
}

.trends-ai-prompt-text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
}

.trends-ai-prompt-text a {
  color: #6b4fa8;
  text-decoration: underline;
}

/* Error state */
.trends-ai-error {
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
}

.trends-ai-error .pixel-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
  flex-shrink: 0;
}

.trends-ai-error-link {
  color: #6b4fa8;
  text-decoration: underline;
  margin-left: auto;
  white-space: nowrap;
}

/* === Dark Mode: AI Coaching === */
body.theme-dark .trends-ai-badge {
  background: #2a1e4a;
  color: #b89eed;
}

body.theme-dark .trends-ai-analysis-badge {
  background: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .trends-ai-insight {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .trends-ai-insight--working .trends-ai-insight-category  { color: #66bb6a; }
body.theme-dark .trends-ai-insight--pattern .trends-ai-insight-category  { color: #b89eed; }
body.theme-dark .trends-ai-insight--watch .trends-ai-insight-category    { color: #ffb74d; }
body.theme-dark .trends-ai-insight--edge .trends-ai-insight-category     { color: #64b5f6; }

body.theme-dark .trends-ai-coaching-note {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border-left-color: #b89eed;
}

body.theme-dark .trends-ai-chat-btn {
  background: #2a1e4a;
  border-color: #4a3580;
  color: #b89eed;
}

body.theme-dark .trends-ai-chat-btn:hover {
  background: #3a2e5a;
}

body.theme-dark .trends-ai-skeleton-card {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border-left-color: #3d3d52;
}

body.theme-dark .skeleton-line {
  background: linear-gradient(90deg, #363650 25%, #404060 50%, #363650 75%);
  background-size: 200% 100%;
}

body.theme-dark .trends-ai-spinner {
  border-color: #4a3580;
  border-top-color: #b89eed;
}

body.theme-dark .trends-ai-prompt {
  background: #2a2a3e;
  border-color: #3d3d52;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .trends-ai-prompt-text a {
  color: #b89eed;
}

body.theme-dark .trends-ai-error {
  background: #2a2a3e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .trends-ai-error-link {
  color: #b89eed;
}

/* --- Dark Mode — cozy warm gradients --- */
body.theme-dark .wrapped-card {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-dark .wrapped-card-intro { background: linear-gradient(145deg, #5c3d8f, #7b52b5, #5c3d8f); }
body.theme-dark .wrapped-card-tasks { background: linear-gradient(145deg, #8f4a3d, #b56252, #8f4a3d); }
body.theme-dark .wrapped-card-vibe { background: linear-gradient(145deg, #5548a0, #7068b8, #5548a0); }
body.theme-dark .wrapped-card-cat-alignment { background: linear-gradient(145deg, #3d7860, #4e9878, #3d7860); }
body.theme-dark .wrapped-card-rhythm { background: linear-gradient(145deg, #8f3d58, #b55270, #8f3d58); }
body.theme-dark .wrapped-card-login { background: linear-gradient(145deg, #3d4890, #5260b5, #3d4890); }
body.theme-dark .wrapped-card-week { background: linear-gradient(145deg, #8f7830, #b59840, #8f7830); }
body.theme-dark .wrapped-card-day { background: linear-gradient(145deg, #307870, #409890, #307870); }
body.theme-dark .wrapped-card-top-cat { background: linear-gradient(145deg, #7d3878, #a04895, #7d3878); }
body.theme-dark .wrapped-card-breakdown { background: linear-gradient(145deg, #484468, #605880, #484468); }
body.theme-dark .wrapped-card-subtasks { background: linear-gradient(145deg, #388050, #489868, #388050); }
body.theme-dark .wrapped-card-deadlines { background: linear-gradient(145deg, #8f7830, #b59840, #8f7830); }
body.theme-dark .wrapped-card-month-ref { background: linear-gradient(145deg, #484468, #605880, #484468); }
body.theme-dark .wrapped-card-intention { background: linear-gradient(145deg, #3d5a8f, #4a70b5, #3d5a8f); }
body.theme-dark .wrapped-card-necessary { background: linear-gradient(145deg, #8f6a3d, #b58050, #8f6a3d); }
body.theme-dark .wrapped-card-weekly { background: linear-gradient(145deg, #3d8f6a, #4eb580, #3d8f6a); }
body.theme-dark .wrapped-card-progress { background: linear-gradient(145deg, #6a4a8f, #8560b5, #6a4a8f); }
body.theme-dark .wrapped-card-trend { background: linear-gradient(145deg, #3d5890, #5268b5, #3d5890); }
body.theme-dark .wrapped-card-suggestions { background: linear-gradient(145deg, #8f8430, #b5a840, #8f8430); }
body.theme-dark .wrapped-card-summary { background: linear-gradient(145deg, #5c3d8f, #8f3d58, #3d4890); }
body.theme-dark .wrapped-card-soundtrack-intro { background: linear-gradient(145deg, #2d6b3d, #3d8b55, #2d6b3d); }
body.theme-dark .wrapped-card-soundtrack-tracks { background: linear-gradient(145deg, #7a5830, #9a7048, #7a5830); }
body.theme-dark .wrapped-card-soundtrack-mood { background: linear-gradient(145deg, #5038a0, #6850b8, #5038a0); }
body.theme-dark .wrapped-card-soundtrack-focus { background: linear-gradient(145deg, #306870, #408880, #306870); }

body.theme-dark .wrapped-big-text,
body.theme-dark .wrapped-big-number,
body.theme-dark .wrapped-adjective,
body.theme-dark .wrapped-split-value,
body.theme-dark .wrapped-split-score,
body.theme-dark .wrapped-summary-title,
body.theme-dark .wrapped-summary-number,
body.theme-dark .wrapped-summary-adjective,
body.theme-dark .wrapped-cat-header,
body.theme-dark .wrapped-quadrant-number,
body.theme-dark .wrapped-intention-result,
body.theme-dark .wrapped-intention-score {
  color: #ffffff;
}

body.theme-dark .wrapped-label,
body.theme-dark .wrapped-vibe,
body.theme-dark .wrapped-alignment-score,
body.theme-dark .day-cycle-label,
body.theme-dark .day-cycle-count,
body.theme-dark .day-bar-label,
body.theme-dark .day-bar-count,
body.theme-dark .category-bar-count,
body.theme-dark .mini-bar-label,
body.theme-dark .wrapped-summary-label,
body.theme-dark .wrapped-summary-vibe,
body.theme-dark .wrapped-summary-personality,
body.theme-dark .wrapped-summary-intention,
body.theme-dark .wrapped-summary-necessary,
body.theme-dark .wrapped-task-item,
body.theme-dark .wrapped-subtle,
body.theme-dark .wrapped-quadrant-label,
body.theme-dark .wrapped-quadrant-desc,
body.theme-dark .wrapped-weekly-label,
body.theme-dark .wrapped-weekly-score,
body.theme-dark .wrapped-trend-month,
body.theme-dark .wrapped-trend-score,
body.theme-dark .wrapped-signal-label,
body.theme-dark .wrapped-signal-text {
  color: rgba(255, 255, 255, 0.7);
}

body.theme-dark .category-bar-label {
  color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .wrapped-theme-badge {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .wrapped-summary-badge {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .wrapped-comparison-up {
  background: rgba(76, 175, 80, 0.25);
  color: #81c784;
}

body.theme-dark .wrapped-comparison-down {
  background: rgba(244, 67, 54, 0.2);
  color: #e57373;
}

body.theme-dark .alignment-tag.alignment-fully { background: rgba(76, 175, 80, 0.25); color: #81c784; }
body.theme-dark .alignment-tag.alignment-somewhat { background: rgba(255, 193, 7, 0.25); color: #ffd54f; }
body.theme-dark .alignment-tag.alignment-not { background: rgba(244, 67, 54, 0.2); color: #e57373; }

body.theme-dark .wrapped-split-up { background: rgba(76, 175, 80, 0.12); }
body.theme-dark .wrapped-split-down { background: rgba(244, 67, 54, 0.1); }
body.theme-dark .wrapped-split-label { color: rgba(255, 255, 255, 0.6); }

body.theme-dark .wrapped-intention-quote {
  background: rgba(255, 255, 255, 0.08);
  border-left-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .wrapped-intention-divider { background: rgba(255, 255, 255, 0.15); }

body.theme-dark .wrapped-signal-aligned { background: rgba(76, 175, 80, 0.15); }
body.theme-dark .wrapped-signal-misaligned { background: rgba(244, 67, 54, 0.12); }

body.theme-dark .wrapped-quadrant-sweet-spot { background: rgba(76, 175, 80, 0.18); }
body.theme-dark .wrapped-quadrant-obligations { background: rgba(255, 152, 0, 0.18); }
body.theme-dark .wrapped-quadrant-passion { background: rgba(33, 150, 243, 0.18); }
body.theme-dark .wrapped-quadrant-drift { background: rgba(158, 158, 158, 0.18); }

body.theme-dark .wrapped-weekly-bar-fill { background: rgba(76, 175, 80, 0.4); }
body.theme-dark .wrapped-weekly-drift { background: rgba(255, 152, 0, 0.5); }
body.theme-dark .wrapped-weekly-bar-empty { background: rgba(255, 255, 255, 0.08); }

body.theme-dark .wrapped-trend-bar-fill { background: rgba(100, 150, 220, 0.4); }
body.theme-dark .wrapped-trend-current { background: linear-gradient(to top, rgba(100, 150, 220, 0.6), rgba(130, 180, 250, 0.7)); }

body.theme-dark .wrapped-suggestion-item {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .mode-btn.active {
  background: rgba(255, 255, 255, 0.15);
}

body.theme-dark .wrapped-mode-toggle {
  background: rgba(255, 255, 255, 0.08);
}

body.theme-dark .day-cycle-bar-track,
body.theme-dark .day-bar-track,
body.theme-dark .category-bar-track {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .mini-bar-fill:not(.mini-bar-highlight) {
  background: rgba(255, 255, 255, 0.15);
}

body.theme-dark .day-bar-fill:not(.day-bar-highlight) {
  background: rgba(255, 255, 255, 0.15);
}

body.theme-dark .wrapped-cat-count {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}

body.theme-dark .wrapped-cat-section {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .wrapped-card img {
  filter: brightness(0) invert(1);
}

body.theme-dark .wrapped-download-btn {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .wrapped-download-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

/* --- Copy Button --- */
.wrapped-copy-btn {
  position: absolute;
  top: 10px;
  right: 42px;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  border-radius: 6px;
  padding: 5px 6px;
  cursor: var(--cursor-pointer);
  opacity: 0;
  transition: opacity var(--duration-quick) var(--easing-smooth),
              background var(--duration-quick) var(--easing-smooth);
  z-index: 2;
  line-height: 1;
}

.wrapped-card:hover .wrapped-copy-btn {
  opacity: 0.7;
}

.wrapped-copy-btn:hover {
  opacity: 1 !important;
  background: rgba(255, 255, 255, 0.85);
}

.wrapped-copy-btn:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.85);
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
}

.wrapped-copy-btn.copying {
  opacity: 1;
  animation: wrapped-pulse 0.8s ease-in-out infinite;
}

body.theme-dark .wrapped-copy-btn {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-dark .wrapped-copy-btn:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

body.theme-dark .wrapped-copy-btn:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

/* --- Story-Sized Card (for export) --- */
.wrapped-card-story {
  width: 540px !important;
  min-width: 540px !important;
  max-width: 540px !important;
  height: 960px !important;
  min-height: 960px !important;
  max-height: 960px !important;
  display: flex !important;
  border-radius: 0 !important;
}

.wrapped-card-story .wrapped-card-inner {
  min-height: 100%;
  padding: 3rem 2rem;
  gap: 1rem;
  justify-content: center;
}

.wrapped-card-story .wrapped-big-number {
  font-size: 5rem;
}

.wrapped-card-story .wrapped-adjective {
  font-size: 3rem;
}

.wrapped-card-story .wrapped-big-text {
  font-size: 2.5rem;
}

.wrapped-card-story .wrapped-label {
  font-size: 1.1rem;
}

.wrapped-card-story .wrapped-summary-brand {
  position: absolute;
  bottom: 2rem;
  opacity: 0.4;
}

/* --- Responsive (Mobile) --- */
@media (max-width: 767px) {
  .wrapped-cards {
    flex-direction: column;
    overflow-x: visible;
    gap: var(--spacing-md);
    padding-bottom: var(--spacing-md);
  }

  .wrapped-card {
    min-width: unset;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
  }

  .wrapped-card-inner {
    min-height: 420px;
    padding: var(--spacing-xl) var(--spacing-lg);
  }

  .wrapped-big-number {
    font-size: 3rem;
  }

  .wrapped-big-text {
    font-size: 1.8rem;
  }

  .wrapped-adjective {
    font-size: 2rem;
  }

  .wrapped-download-btn,
  .wrapped-copy-btn {
    opacity: 0.5;
  }

  .wrapped-split {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
}

/* ===== Welcome Video Modal ===== */

.welcome-video-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}

.welcome-video-card {
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.welcome-video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.welcome-video-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--color-text-primary);
}

.welcome-video-title .pixel-icon {
  width: 20px;
  height: 20px;
}

.welcome-video-intro {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: var(--spacing-md);
}

.welcome-video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  margin-bottom: var(--spacing-sm);
}

.welcome-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
}

.welcome-video-speed-hint {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
  text-align: center;
  font-style: italic;
}

.welcome-video-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.welcome-video-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: 10px 24px;
  width: 100%;
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: var(--cursor-pointer);
  transition: background-color var(--duration-quick) var(--easing-smooth);
}

.welcome-video-btn-primary:hover {
  background-color: #555555;
}

.welcome-video-btn-primary .pixel-icon {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.welcome-video-btn-secondary {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: var(--cursor-pointer);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: var(--spacing-xs);
  transition: color var(--duration-quick);
}

.welcome-video-btn-secondary:hover {
  color: var(--color-text-primary);
}

/* Guide hint pulse on FAB when user closes modal */
.help-panel-fab.guide-hint-active {
  animation: guide-hint-pulse 1.5s ease-in-out 3;
}

.help-panel-fab.guide-hint-active::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background-color: var(--color-text-primary);
  color: var(--color-card-white);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-body);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1001;
}

@keyframes guide-hint-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(129, 212, 250, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(129, 212, 250, 0); }
}

/* Guide video section in help panel */
.guide-video-section {
  margin-bottom: var(--spacing-md);
}

.guide-video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  margin-top: var(--spacing-sm);
}

.guide-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
}

/* Onboarding inline hint — visible tooltip below form inputs */
.onboarding-inline-hint {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(179, 229, 252, 0.7), rgba(129, 212, 250, 0.7));
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--color-text-primary);
  line-height: 1.4;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.onboarding-inline-hint::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 16px;
  border: 6px solid transparent;
  border-bottom-color: rgba(179, 229, 252, 0.7);
}

.onboarding-inline-hint .pixel-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Onboarding checklist in guide tab */
.onboarding-checklist {
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.onboarding-steps-list {
  list-style: none;
  padding: 0;
  margin: var(--spacing-sm) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.onboarding-step.completed .onboarding-step-label,
.onboarding-step.completed .onboarding-step-link {
  text-decoration: line-through;
  opacity: 0.6;
}

.onboarding-step-check .pixel-icon {
  width: 18px;
  height: 18px;
}

.onboarding-complete-message {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  font-style: italic;
  padding: var(--spacing-sm) 0;
}

/* Onboarding FAB indicator (red dot on top-right of guide FAB) */
.onboarding-fab-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background-color: #e57373;
  border-radius: 50%;
  border: 2px solid var(--color-bg-primary, #fff);
  pointer-events: none;
}

/* Onboarding checklist intro text */
.onboarding-checklist-intro {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-md);
  line-height: 1.4;
}

/* Onboarding section headings */
.onboarding-section-heading {
  font-family: var(--font-header);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin: var(--spacing-md) 0 var(--spacing-xs);
  opacity: 0.7;
}

.onboarding-section-heading:first-of-type {
  margin-top: 0;
}

/* Onboarding clickable step links */
.onboarding-step-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: var(--cursor-pointer);
  transition: color var(--duration-quick);
}

.onboarding-step-link:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
}

/* Onboarding locked steps */
.onboarding-step.locked {
  opacity: 0.4;
}

.onboarding-step.locked .onboarding-step-link {
  pointer-events: none;
  cursor: default;
  color: var(--color-text-secondary);
  text-decoration: none;
}

/* Onboarding arrival hint banner */
.onboarding-arrival-hint {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: linear-gradient(135deg, rgb(179, 229, 252), rgb(149, 218, 250));
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  margin: 0 auto var(--spacing-lg);
  width: fit-content;
  max-width: 600px;
  font-size: 0.85rem;
  color: var(--color-text-primary);
  line-height: 1.4;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.onboarding-arrival-hint .pixel-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.onboarding-arrival-hint-skip {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: var(--spacing-xs) var(--spacing-sm);
  flex-shrink: 0;
  opacity: 0.6;
  font-size: 0.8rem;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: inherit;
  transition: opacity var(--duration-quick);
}

.onboarding-arrival-hint-skip:hover {
  opacity: 1;
}

.onboarding-arrival-hint-next,
.onboarding-arrival-hint-gotit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: inherit;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--duration-quick);
}

.onboarding-arrival-hint-next:hover,
.onboarding-arrival-hint-gotit:hover {
  background: rgba(0, 0, 0, 0.14);
}

.onboarding-arrival-hint-next .pixel-icon,
.onboarding-arrival-hint-gotit .pixel-icon {
  width: 12px;
  height: 12px;
}

/* Anchored variant — absolutely positioned above target element */
.onboarding-arrival-hint-anchored {
  position: absolute;
  z-index: 1000;
  margin: 0;
}

/* Downward arrow pointing at the target element */
.onboarding-arrival-hint-anchored::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgb(164, 224, 251);
}

/* Upward arrow when tooltip is positioned below the anchor */
.onboarding-arrival-hint-anchored.onboarding-arrival-hint-below::after {
  bottom: auto;
  top: -8px;
  border-top: none;
  border-bottom: 8px solid rgb(164, 224, 251);
}

/* Left-of-anchor variant — positioned to the left with a right-pointing arrow */
.onboarding-arrival-hint-anchored.onboarding-arrival-hint-left::after {
  bottom: auto;
  left: auto;
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid rgb(164, 224, 251);
  border-right: none;
}

/* Modal variant — floats above the task lightbox overlay */
.onboarding-arrival-hint-modal {
  z-index: 10002;
}

/* Onboarding first-use tooltip banners — matches trial banner pill style */
.onboarding-tooltip-banner {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: linear-gradient(135deg, rgba(179, 229, 252, 0.7), rgba(129, 212, 250, 0.7));
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  margin: 0 auto var(--spacing-lg);
  width: fit-content;
  transition: opacity var(--duration-normal) var(--easing-smooth),
              transform var(--duration-normal) var(--easing-smooth);
}

.onboarding-tooltip-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.onboarding-tooltip-content .pixel-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.onboarding-tooltip-text {
  font-size: 0.85rem;
  color: var(--color-text-primary);
  line-height: 1.4;
  margin: 0;
}

.onboarding-tooltip-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex-shrink: 0;
}

.onboarding-tooltip-next {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  border-radius: var(--radius-sm);
  cursor: var(--cursor-pointer);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-primary);
  transition: background var(--duration-quick);
  white-space: nowrap;
}

.onboarding-tooltip-next:hover {
  background: rgba(0, 0, 0, 0.14);
}

.onboarding-tooltip-next .pixel-icon {
  width: 12px;
  height: 12px;
}

.onboarding-tooltip-dismiss {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: var(--spacing-xs) var(--spacing-sm);
  flex-shrink: 0;
  opacity: 0.6;
  font-size: 0.8rem;
  color: inherit;
  font-family: inherit;
  transition: opacity var(--duration-quick);
}

.onboarding-tooltip-dismiss:hover {
  opacity: 1;
}

/* Dark mode — Welcome video modal */
body.theme-dark .welcome-video-card {
  background-color: #2a2a3e;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.theme-dark .welcome-video-title {
  color: #f5f5f5;
}

body.theme-dark .welcome-video-intro,
body.theme-dark .welcome-video-speed-hint {
  color: #a0a0b0;
}

body.theme-dark .welcome-video-btn-primary {
  background-color: #f5f5f5;
  color: #1e1e2e;
}

body.theme-dark .welcome-video-btn-primary:hover {
  background-color: #e0e0e0;
}

body.theme-dark .welcome-video-btn-primary .pixel-icon {
  filter: none;
}

body.theme-dark .welcome-video-btn-secondary {
  color: #a0a0b0;
}

body.theme-dark .welcome-video-btn-secondary:hover {
  color: #f5f5f5;
}

body.theme-dark .help-panel-fab.guide-hint-active::after {
  background-color: #f5f5f5;
  color: #1e1e2e;
}

/* Dark mode — Onboarding inline hint */
body.theme-dark .onboarding-inline-hint {
  background: linear-gradient(135deg, rgba(56, 96, 130, 0.6), rgba(44, 82, 112, 0.6));
  color: #d0d0e0;
}

body.theme-dark .onboarding-inline-hint::before {
  border-bottom-color: rgba(56, 96, 130, 0.6);
}

body.theme-dark .onboarding-inline-hint .pixel-icon {
  filter: invert(0.8);
}

/* Dark mode — Onboarding checklist */
body.theme-dark .onboarding-checklist {
  border-bottom-color: #3d3d52;
}

body.theme-dark .onboarding-step {
  color: #a0a0b0;
}

body.theme-dark .onboarding-complete-message {
  color: #a0a0b0;
}

/* Dark mode — Onboarding step links */
body.theme-dark .onboarding-step-link {
  color: #a0a0b0;
}

body.theme-dark .onboarding-step-link:hover {
  color: #f5f5f5;
}

/* Dark mode — Onboarding arrival hint */
body.theme-dark .onboarding-arrival-hint {
  background: linear-gradient(135deg, rgb(56, 96, 130), rgb(44, 82, 112));
  color: #d0d0e0;
}

body.theme-dark .onboarding-arrival-hint-anchored::after {
  border-top-color: rgb(50, 89, 120);
}

body.theme-dark .onboarding-arrival-hint-anchored.onboarding-arrival-hint-below::after {
  border-top-color: transparent;
  border-bottom-color: rgb(50, 89, 120);
}

body.theme-dark .onboarding-arrival-hint-anchored.onboarding-arrival-hint-left::after {
  border-top-color: transparent;
  border-left-color: rgb(50, 89, 120);
}

body.theme-dark .onboarding-fab-indicator {
  border-color: var(--color-bg-primary, #1e1e2e);
}

body.theme-dark .onboarding-arrival-hint-gotit:hover,
body.theme-dark .onboarding-arrival-hint-next:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Dark mode — Onboarding tooltips */
body.theme-dark .onboarding-tooltip-banner {
  background: linear-gradient(135deg, rgba(56, 96, 130, 0.6), rgba(44, 82, 112, 0.6));
  border-color: rgba(100, 160, 200, 0.3);
}

body.theme-dark .onboarding-tooltip-text {
  color: #f5f5f5;
}

body.theme-dark .onboarding-tooltip-next {
  background: rgba(255, 255, 255, 0.12);
  color: #f5f5f5;
}

body.theme-dark .onboarding-tooltip-next:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile — Onboarding components */
@media (max-width: 767px) {
  /* Welcome video modal — bottom sheet on mobile */
  .welcome-video-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .welcome-video-card {
    padding: var(--spacing-md);
    max-height: 95vh;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .welcome-video-header {
    margin-bottom: var(--spacing-sm);
  }

  .welcome-video-title {
    font-size: 1rem;
  }

  .welcome-video-intro {
    font-size: 0.85rem;
    margin-bottom: var(--spacing-sm);
  }

  .welcome-video-speed-hint {
    font-size: 0.75rem;
    margin-bottom: var(--spacing-sm);
  }

  .welcome-video-actions {
    margin-top: var(--spacing-sm);
  }

  .welcome-video-btn-primary {
    padding: 12px 24px;
    font-size: 0.95rem;
    min-height: 44px;
  }

  .welcome-video-btn-secondary {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Tooltip banners — tighter on mobile */
  .onboarding-tooltip-banner {
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
  }

  .onboarding-tooltip-text {
    font-size: 0.85rem;
  }

  .onboarding-tooltip-dismiss {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Onboarding inline hint — wrap text on mobile */
  .onboarding-inline-hint {
    white-space: normal;
    max-width: 280px;
    font-size: 0.75rem;
  }

  /* Checklist — ensure tap targets are large enough */
  .onboarding-step {
    min-height: 44px;
  }

  .onboarding-step-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Arrival hint — full width on mobile */
  .onboarding-arrival-hint {
    width: auto;
    max-width: none;
    margin-left: var(--spacing-sm);
    margin-right: var(--spacing-sm);
  }

  /* Guide hint tooltip on FAB — position left so it doesn't overflow screen edge */
  .help-panel-fab.guide-hint-active::after {
    right: auto;
    left: auto;
    right: 0;
    max-width: calc(100vw - 2 * var(--spacing-md));
    white-space: normal;
    text-align: right;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .day-cycle-bar-fill,
  .day-bar-fill,
  .category-bar-fill,
  .mini-bar-fill,
  .spotify-feature-fill,
  .spotify-energy-bar-fill,
  .wrapped-weekly-bar-fill,
  .wrapped-trend-bar-fill,
  .trends-ev-bar {
    transition: none;
  }

  .wrapped-chevron {
    transition: none;
  }
}

/* ===== AI Chat FAB & Panel ===== */

/* Floating Action Button - Lavender, positioned above help panel FAB */
.ai-chat-fab {
  position: fixed;
  bottom: calc(var(--spacing-lg) + 56px + var(--spacing-sm) + 56px + var(--spacing-sm));
  right: var(--spacing-lg);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #d1c4e9;
  border: none;
  cursor: var(--cursor-pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(209, 196, 233, 0.5);
  transition: all var(--duration-normal) var(--easing-smooth);
  z-index: 1000;
}

.ai-chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(179, 157, 219, 0.6);
  background-color: #b39ddb;
}

.ai-chat-fab:active {
  transform: scale(0.95);
}

.ai-chat-fab .pixel-icon {
  width: 24px;
  height: 24px;
  transition: opacity var(--duration-quick), transform var(--duration-normal) var(--easing-smooth);
}

.ai-chat-fab .ai-chat-icon-sparkle {
  opacity: 1;
}

.ai-chat-fab .ai-chat-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-45deg);
}

.ai-chat-fab.active {
  background-color: #b39ddb;
}

.ai-chat-fab.active .ai-chat-icon-sparkle {
  opacity: 0;
  transform: rotate(45deg);
}

.ai-chat-fab.active .ai-chat-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Overlay */
.ai-chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.ai-chat-overlay.active {
  display: block;
}

/* Chat Panel */
.ai-chat-panel {
  position: fixed;
  bottom: calc(var(--spacing-lg) + 56px + var(--spacing-sm) + 56px + var(--spacing-sm) + 56px + var(--spacing-sm));
  right: var(--spacing-lg);
  width: 400px;
  max-width: calc(100vw - 2 * var(--spacing-lg));
  height: 520px;
  max-height: 65vh;
  background-color: var(--color-card-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: all var(--duration-normal) var(--easing-bounce);
  z-index: 1001;
  overflow: hidden;
}

.ai-chat-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header — no colored background, matches help-panel style */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.ai-chat-title .pixel-icon {
  width: 20px;
  height: 20px;
}

.ai-chat-header-actions {
  display: flex;
  gap: 4px;
}

.ai-chat-mode-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-card-white);
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
  transition: background-color var(--duration-quick);
}

.ai-chat-mode-btn:hover {
  background-color: rgba(209, 196, 233, 0.2);
}

.ai-chat-mode-btn .pixel-icon {
  width: 16px;
  height: 16px;
}

/* API Key Prompt */
.ai-chat-key-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: var(--spacing-lg);
  text-align: center;
  gap: var(--spacing-md);
}

.ai-chat-key-icon {
  width: 48px;
  height: 48px;
  opacity: 0.6;
}

.ai-chat-key-prompt h3 {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: var(--color-text-primary);
  margin: 0;
}

.ai-chat-key-prompt p {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
}

.ai-chat-key-note {
  font-size: 0.85rem !important;
  opacity: 0.7;
}

/* Chat Area */
.ai-chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Messages Container */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

/* Message Bubbles */
.ai-chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.ai-chat-message-user {
  align-self: flex-end;
  background-color: #f3e5f5;
  color: var(--color-text-primary);
  border-bottom-right-radius: 4px;
}

.ai-chat-message-assistant {
  align-self: flex-start;
  background-color: var(--color-card-white);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
  white-space: normal;
}

.ai-chat-message-assistant.streaming {
  border-color: #d1c4e9;
}

.ai-chat-message-system {
  align-self: center;
  background-color: rgba(209, 196, 233, 0.15);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  text-align: center;
  border-radius: var(--radius-lg);
  max-width: 90%;
}

.ai-chat-message-error {
  align-self: center;
  background-color: #fce4ec;
  color: #c62828;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-md);
}

.ai-chat-message-error .pixel-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Action Buttons */
.ai-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.ai-chat-action-btn {
  padding: 6px 12px;
  background-color: rgba(209, 196, 233, 0.15);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-primary);
  transition: all var(--duration-quick);
}

.ai-chat-action-btn:hover {
  background-color: rgba(209, 196, 233, 0.3);
  border-color: #b39ddb;
}

.ai-chat-action-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.ai-chat-action-btn.applied {
  background-color: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32;
}

/* Proposal Cards */
.ai-proposal-card {
  margin-top: var(--spacing-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-card-white);
  overflow: hidden;
}

.ai-proposal-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-secondary);
}

.ai-proposal-header .pixel-icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.ai-proposal-changes,
.ai-proposal-preview {
  padding: 8px 12px;
}

.ai-proposal-field {
  padding: 4px 0;
}

.ai-proposal-field + .ai-proposal-field {
  border-top: 1px solid var(--color-border);
}

.ai-proposal-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.ai-proposal-diff {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  line-height: 1.4;
}

.ai-proposal-current {
  color: var(--color-text-secondary);
  text-decoration: line-through;
  opacity: 0.7;
}

.ai-proposal-arrow {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.ai-proposal-proposed {
  color: var(--color-text-primary);
  font-weight: 500;
}

.ai-proposal-preview {
  font-size: 0.85rem;
  line-height: 1.4;
}

.ai-proposal-preview span {
  color: var(--color-text-primary);
}

.ai-proposal-actions {
  display: flex;
  gap: var(--spacing-sm);
  padding: 8px 12px;
  border-top: 1px solid var(--color-border);
}

.ai-proposal-approve {
  padding: 4px 14px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 600;
  border: 1px solid #a5d6a7;
  border-radius: var(--radius-sm);
  background-color: rgba(165, 214, 167, 0.15);
  color: #2e7d32;
  cursor: pointer;
  transition: background-color var(--duration-quick);
}

.ai-proposal-approve:hover {
  background-color: rgba(165, 214, 167, 0.3);
}

.ai-proposal-approve:disabled {
  opacity: 0.7;
  cursor: default;
}

.ai-proposal-dismiss {
  padding: 4px 14px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background-color var(--duration-quick);
}

.ai-proposal-dismiss:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.ai-proposal-card.applied {
  border-color: #a5d6a7;
  background-color: rgba(165, 214, 167, 0.08);
}

.ai-proposal-card.applied .ai-proposal-approve {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.ai-proposal-card.dismissed {
  opacity: 0.5;
  border-color: var(--color-border);
}

/* Tool Use Indicator */
.ai-tool-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px var(--spacing-md);
}

.ai-tool-label {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-left: 4px;
  font-style: italic;
}

/* Tool Badge Bubble (separate chat bubble for tool calls) */
.ai-chat-tool-bubble {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background-color: rgba(209, 196, 233, 0.1);
  border: 1px dashed rgba(209, 196, 233, 0.4);
  max-width: 85%;
}

.ai-tool-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

.ai-tool-badge::before {
  content: "✦ ";
  margin-right: 3px;
  color: #d1c4e9;
}

/* Markdown rendering in assistant messages */
.ai-chat-message-assistant strong {
  font-weight: 600;
}

.ai-chat-message-assistant em {
  font-style: italic;
}

.ai-chat-message-assistant code {
  background-color: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.ai-chat-message-assistant ul,
.ai-chat-message-assistant ol {
  margin: 4px 0;
  padding-left: 20px;
}

.ai-chat-message-assistant li {
  margin: 2px 0;
}

/* Typing Indicator */
.ai-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px var(--spacing-md);
}

.typing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #b39ddb;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Input Area */
.ai-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-card-white);
}

.ai-chat-input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  outline: none;
  transition: border-color var(--duration-quick);
}

.ai-chat-input:focus {
  border-color: #b39ddb;
}

.ai-chat-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background-color: var(--color-text-primary);
  cursor: var(--cursor-pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color var(--duration-quick);
}

.ai-chat-send .pixel-icon {
  width: 18px;
  height: 18px;
  filter: invert(1);
}

.ai-chat-send:hover {
  opacity: 0.8;
}

.ai-chat-send:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ===== AI Chat Views ===== */

.ai-chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ===== AI Chat Header Updates ===== */

.ai-chat-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background-color var(--duration-quick);
  padding: 0;
}

.ai-chat-back-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.ai-chat-back-btn .pixel-icon {
  width: 16px;
  height: 16px;
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.ai-chat-history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  border-radius: var(--radius-sm);
  transition: background-color var(--duration-quick);
  padding: 0;
}

.ai-chat-history-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.ai-chat-history-btn .pixel-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

/* ===== AI Chat Home View — Mode Grid ===== */

.ai-chat-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
}

.ai-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-card-white);
  cursor: var(--cursor-pointer);
  text-align: left;
  transition: all var(--duration-quick);
}

.ai-mode-card:hover {
  border-color: #b39ddb;
  background-color: rgba(209, 196, 233, 0.1);
  transform: translateY(-1px);
}

.ai-mode-card:active {
  transform: translateY(0);
}

.ai-mode-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.ai-mode-name {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.ai-mode-desc {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  line-height: 1.3;
}

/* ===== AI Chat Home View — Recent Conversations ===== */

.ai-chat-recent {
  padding: var(--spacing-xs) var(--spacing-md) var(--spacing-xs);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  flex-shrink: 0;
}

.ai-chat-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
}

.ai-chat-recent-title {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.ai-chat-view-all {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: #7b1fa2;
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 0;
  text-decoration: underline;
}

.ai-chat-recent-list {
  display: flex;
  flex-direction: column;
}

.ai-recent-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  width: 100%;
  padding: 5px 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: var(--cursor-pointer);
  text-align: left;
  transition: background-color var(--duration-quick);
}

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

.ai-recent-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.ai-recent-icon {
  width: 14px;
  height: 14px;
  opacity: 0.5;
  flex-shrink: 0;
}

.ai-recent-title {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-recent-date {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-chat-recent-empty {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  padding: var(--spacing-xs) 0;
  text-align: center;
}

/* ===== AI Chat Home View — General Chat Button ===== */

.ai-chat-general-entry {
  padding: var(--spacing-xs) var(--spacing-md) var(--spacing-sm);
  flex-shrink: 0;
}

.ai-chat-general-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  width: 100%;
  padding: 8px var(--spacing-md);
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  cursor: var(--cursor-pointer);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: all var(--duration-quick);
}

.ai-chat-general-btn:hover {
  border-color: #b39ddb;
  color: var(--color-text-primary);
}

.ai-chat-general-btn .pixel-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
}

/* ===== AI Chat History View ===== */

.ai-chat-history-search {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.ai-chat-history-search .pixel-icon {
  width: 16px;
  height: 16px;
  opacity: 0.4;
  flex-shrink: 0;
}

.ai-chat-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: transparent;
  color: var(--color-text-primary);
}

.ai-chat-search-input::placeholder {
  color: var(--color-text-secondary);
}

.ai-chat-history-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-xs) 0;
}

.ai-history-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background-color var(--duration-quick);
}

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

.ai-history-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.ai-history-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  flex-shrink: 0;
}

.ai-history-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-history-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-history-date {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.ai-chat-empty {
  padding: var(--spacing-lg) var(--spacing-md);
  text-align: center;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
}

/* ----- AI Chat Focus Styles ----- */
.ai-chat-back-btn:focus-visible,
.ai-chat-history-btn:focus-visible,
.ai-mode-card:focus-visible,
.ai-chat-view-all:focus-visible,
.ai-recent-item:focus-visible,
.ai-chat-general-btn:focus-visible,
.ai-history-item:focus-visible,
.ai-chat-send:focus-visible {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 2px;
}

/* ===== AI Chat Mobile ===== */
@media (max-width: 768px) {
  .ai-chat-fab {
    width: 48px;
    height: 48px;
    bottom: calc(var(--spacing-md) + 2 * (48px + var(--spacing-sm)));
    right: var(--spacing-md);
  }

  .ai-chat-fab .pixel-icon {
    width: 20px;
    height: 20px;
  }

  .ai-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 85vh;
    max-width: 100vw;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .ai-chat-mode-grid {
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .ai-mode-card {
    padding: 6px 8px;
  }
}

/* ===== Integrations Settings ===== */

.integration-card {
  background-color: var(--color-card-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.integration-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.integration-header .pixel-icon {
  width: 24px;
  height: 24px;
}

.integration-title {
  font-family: var(--font-body);
  font-size: 1.1rem;
  margin: 0;
}

/* API Key Status */
.ai-key-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
}

.ai-key-status--active {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.ai-key-status .pixel-icon {
  width: 16px;
  height: 16px;
}

.ai-key-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.ai-key-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.settings-form-actions {
  margin-top: var(--spacing-lg);
}

/* Memory Bank */
.memory-bank-category {
  margin-bottom: var(--spacing-lg);
}

.memory-bank-category-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 4px 0;
  padding-bottom: 4px;
  color: var(--color-text-primary);
  border-bottom: 2px solid var(--color-border);
}

.memory-bank-entry {
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}

.memory-bank-entry:last-child {
  border-bottom: none;
  margin-bottom: var(--spacing-sm);
}

.memory-bank-entry-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.memory-bank-entry-content {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.4;
}

.memory-bank-entry-label {
  font-weight: 600;
  color: #7b1fa2;
}

.memory-bank-entry-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.memory-bank-entry-edit {
  padding: var(--spacing-sm) 0;
}

.memory-bank-edit-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.memory-bank-new-form {
  margin-top: var(--spacing-sm);
}

.memory-bank-new-form .memory-bank-new-fields {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.memory-bank-new-form .settings-input {
  flex: 1;
  min-height: 36px;
  padding: 6px var(--spacing-md);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.875rem;
  min-height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}

.btn-square {
  width: 36px;
  height: 36px;
  min-height: 36px !important;
  min-width: 36px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.4rem;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
}

.btn-icon {
  background: none;
  border: none;
  cursor: var(--cursor-pointer);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration-quick);
}

.btn-icon:hover {
  background-color: #f5f5f5;
}

.btn-icon .pixel-icon {
  width: 16px;
  height: 16px;
}

.btn-icon-danger:hover {
  background-color: #fce4ec;
}

.hidden {
  display: none !important;
}

/* ===== Dark mode FABs — darken all 3 for contrast with white icons ===== */
body.theme-dark .quick-add-fab {
  background-color: #f48fb1;
  box-shadow: 0 4px 16px rgba(244, 143, 177, 0.4);
}

body.theme-dark .quick-add-fab:hover,
body.theme-dark .quick-add-fab.active {
  background-color: #f06292;
}

body.theme-dark .help-panel-fab {
  background-color: #81d4fa;
  box-shadow: 0 4px 16px rgba(129, 212, 250, 0.4);
}

body.theme-dark .help-panel-fab:hover,
body.theme-dark .help-panel-fab.active {
  background-color: #4fc3f7;
}

body.theme-dark .ai-chat-fab {
  background-color: #9575cd;
  box-shadow: 0 4px 16px rgba(149, 117, 205, 0.4);
}

body.theme-dark .ai-chat-fab:hover,
body.theme-dark .ai-chat-fab.active {
  background-color: #7e57c2;
}

/* ===== Dark theme adjustments for AI ===== */

/* --- AI Chat Panel (matches help-panel & quick-add dark mode) --- */
body.theme-dark .ai-chat-panel {
  background-color: #1e1e2e;
  border: 1px solid #3d3d52;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body.theme-dark .ai-chat-header {
  border-bottom-color: #3d3d52;
}

/* --- AI Chat Key Prompt (dark mode) --- */
body.theme-dark .ai-chat-key-icon {
  filter: invert(1) brightness(0.85);
}

/* --- AI Chat Messages --- */
body.theme-dark .ai-chat-message-user {
  background-color: rgba(209, 196, 233, 0.15);
}

body.theme-dark .ai-chat-message-assistant {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .ai-chat-message-error {
  background-color: rgba(198, 40, 40, 0.15);
  color: #f5a0a0;
}

/* --- AI Chat Mode & Action Buttons --- */
body.theme-dark .ai-chat-mode-btn {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .ai-chat-mode-btn:hover {
  background-color: rgba(209, 196, 233, 0.15);
}

body.theme-dark .ai-chat-action-btn {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .ai-chat-action-btn:hover {
  background-color: rgba(209, 196, 233, 0.15);
}

body.theme-dark .ai-chat-action-btn.applied {
  background-color: rgba(46, 125, 50, 0.2);
  border-color: rgba(56, 142, 60, 0.3);
  color: #a5d6a7;
}

/* --- AI Proposal Cards (dark mode) --- */
body.theme-dark .ai-proposal-card {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .ai-proposal-header {
  border-bottom-color: #3d3d52;
  color: #a0a0b0;
}

body.theme-dark .ai-proposal-field + .ai-proposal-field {
  border-top-color: #3d3d52;
}

body.theme-dark .ai-proposal-current {
  color: #6a6a7a;
}

body.theme-dark .ai-proposal-proposed {
  color: #f5f5f5;
}

body.theme-dark .ai-proposal-actions {
  border-top-color: #3d3d52;
}

body.theme-dark .ai-proposal-approve {
  background-color: rgba(46, 125, 50, 0.15);
  border-color: rgba(56, 142, 60, 0.3);
  color: #a5d6a7;
}

body.theme-dark .ai-proposal-approve:hover {
  background-color: rgba(46, 125, 50, 0.25);
}

body.theme-dark .ai-proposal-dismiss {
  border-color: #3d3d52;
  color: #a0a0b0;
}

body.theme-dark .ai-proposal-dismiss:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

body.theme-dark .ai-proposal-card.applied {
  border-color: rgba(56, 142, 60, 0.3);
  background-color: rgba(46, 125, 50, 0.1);
}

body.theme-dark .ai-proposal-card.applied .ai-proposal-approve {
  background-color: rgba(46, 125, 50, 0.2);
  color: #a5d6a7;
}

body.theme-dark .ai-tool-label {
  color: #a0a0b0;
}

body.theme-dark .ai-chat-tool-bubble {
  background-color: rgba(209, 196, 233, 0.05);
  border-color: rgba(209, 196, 233, 0.15);
}

body.theme-dark .ai-tool-badge {
  color: #a0a0b0;
}

body.theme-dark .ai-tool-badge::before {
  color: #7e6ba3;
}

body.theme-dark .ai-chat-message-assistant code {
  background-color: rgba(255, 255, 255, 0.08);
}

/* --- AI Chat Input --- */
body.theme-dark .ai-chat-input {
  background-color: #2a2a3e;
  border-color: #3d3d52;
  color: #f5f5f5;
}

body.theme-dark .ai-chat-input::placeholder {
  color: #6a6a7a;
}

body.theme-dark .ai-chat-input:focus {
  border-color: #a0a0b0;
}

body.theme-dark .ai-chat-input-area {
  background-color: #1e1e2e;
  border-top-color: #3d3d52;
}

body.theme-dark .ai-chat-send {
  background-color: #f5f5f5;
}

body.theme-dark .ai-chat-send .pixel-icon {
  filter: invert(0);
}

body.theme-dark .typing-dot {
  background-color: #d1c4e9;
}

/* --- AI Chat Views (dark mode) --- */
body.theme-dark .ai-chat-back-btn:hover,
body.theme-dark .ai-chat-history-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .ai-mode-card {
  background-color: #2a2a3e;
  border-color: #3d3d52;
}

body.theme-dark .ai-mode-card:hover {
  border-color: #9575cd;
  background-color: rgba(149, 117, 205, 0.15);
}

body.theme-dark .ai-mode-name {
  color: #f5f5f5;
}

body.theme-dark .ai-mode-desc {
  color: #8a8a9a;
}

body.theme-dark .ai-chat-recent {
  border-top-color: #3d3d52;
}

body.theme-dark .ai-chat-recent-title {
  color: #8a8a9a;
}

body.theme-dark .ai-chat-view-all {
  color: #b39ddb;
}

body.theme-dark .ai-recent-item {
  border-bottom-color: #3d3d52;
}

body.theme-dark .ai-recent-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

body.theme-dark .ai-recent-title {
  color: #f5f5f5;
}

body.theme-dark .ai-recent-date {
  color: #8a8a9a;
}

body.theme-dark .ai-chat-general-btn {
  border-color: #3d3d52;
  color: #8a8a9a;
}

body.theme-dark .ai-chat-general-btn:hover {
  border-color: #9575cd;
  color: #f5f5f5;
}

body.theme-dark .ai-chat-history-search {
  border-bottom-color: #3d3d52;
}

body.theme-dark .ai-chat-search-input {
  color: #f5f5f5;
}

body.theme-dark .ai-chat-search-input::placeholder {
  color: #6a6a7a;
}

body.theme-dark .ai-history-item {
  border-bottom-color: #3d3d52;
}

body.theme-dark .ai-history-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

body.theme-dark .ai-history-title {
  color: #f5f5f5;
}

body.theme-dark .ai-history-date {
  color: #8a8a9a;
}

body.theme-dark .ai-chat-empty {
  color: #8a8a9a;
}

/* --- Integration Cards (dark mode) --- */
body.theme-dark .integration-card {
  background-color: var(--color-card-white);
  border-color: var(--color-border);
}

body.theme-dark .integration-title {
  color: #f5f5f5;
}

body.theme-dark .integration-header .pixel-icon {
  filter: invert(1) brightness(0.85);
}

/* --- API Key Status (dark mode) --- */
body.theme-dark .ai-key-status--active {
  background-color: rgba(46, 125, 50, 0.2);
  color: #a5d6a7;
  border-color: rgba(56, 142, 60, 0.3);
}

body.theme-dark .ai-key-status--active .pixel-icon {
  filter: invert(1) brightness(0.85);
}

body.theme-dark .ai-key-actions .btn-secondary {
  background-color: #2a2a3e;
  color: #f5f5f5;
  border-color: #f5f5f5;
}

body.theme-dark .ai-key-actions .btn-secondary:hover {
  background-color: #363650;
}

body.theme-dark .ai-key-actions .btn-text-danger {
  color: #f5a0a0;
}

body.theme-dark .ai-key-actions .btn-text-danger:hover {
  color: #ff8a80;
}

/* --- Memory Bank (dark mode) --- */
body.theme-dark .memory-bank-category-title {
  border-bottom-color: #3d3d52;
}

body.theme-dark .memory-bank-entry {
  border-bottom-color: #3d3d52;
}

body.theme-dark .memory-bank-entry-content {
  color: #f5f5f5;
}

body.theme-dark .memory-bank-entry-label {
  color: #ce93d8;
}

body.theme-dark .memory-bank-new-form .btn-primary {
  background-color: #f8a5c2;
  color: #1e1e2e;
  border-color: #f8a5c2;
}

/* --- Icon Buttons (dark mode) --- */
body.theme-dark .btn-icon {
  color: #a0a0b0;
}

body.theme-dark .btn-icon .pixel-icon {
  filter: invert(1) brightness(0.85);
}

body.theme-dark .btn-icon:hover {
  background-color: #363650;
}

body.theme-dark .btn-icon-danger:hover {
  background-color: #4a1515;
}

body.theme-dark .btn-icon-danger:hover .pixel-icon {
  filter: brightness(0) saturate(100%) invert(70%) sepia(50%) saturate(600%) hue-rotate(314deg);
}
