/* ==========================================================================
   ShopIndex PWA — Design System & Component Styles
   Font: General Sans (Fontshare) — loaded via CDN in HTML
   Architecture: Mobile-first, data-theme="light|dark", accent class on <html>
   ========================================================================== */


/* ==========================================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================================== */

:root {
  /* --- Typography --- */
  --font-body:    'General Sans', 'Inter', system-ui, sans-serif;
  --font-display: 'General Sans', 'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Type scale — fluid with clamp() */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem); /*  12px → 14px */
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);     /*  14px → 16px */
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem); /*  16px → 18px */
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);   /*  18px → 24px */
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);  /*  24px → 36px */

  /* Line heights */
  --leading-tight:  1.2;
  --leading-snug:   1.35;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Font weights */
  --weight-regular:   400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;

  /* --- 4px Spacing System --- */
  --space-1:   0.25rem;  /*  4px */
  --space-2:   0.5rem;   /*  8px */
  --space-3:   0.75rem;  /* 12px */
  --space-4:   1rem;     /* 16px */
  --space-5:   1.25rem;  /* 20px */
  --space-6:   1.5rem;   /* 24px */
  --space-8:   2rem;     /* 32px */
  --space-10:  2.5rem;   /* 40px */
  --space-12:  3rem;     /* 48px */
  --space-16:  4rem;     /* 64px */
  --space-20:  5rem;     /* 80px */
  --space-24:  6rem;     /* 96px */
  --space-32:  8rem;     /* 128px */

  /* --- Border Radii --- */
  --radius-sm:   0.25rem;  /*  4px */
  --radius-md:   0.5rem;   /*  8px  — buttons, inputs */
  --radius-lg:   0.75rem;  /* 12px  — cards */
  --radius-xl:   1rem;     /* 16px */
  --radius-2xl:  1.25rem;  /* 20px  — FAB, pills */
  --radius-full: 9999px;   /* circles, pills */

  /* --- Transitions --- */
  --transition-fast:        120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth:      280ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring:      400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Content Widths --- */
  --content-narrow:  640px;
  --content-default: 960px;
  --content-wide:    1200px;

  /* --- Touch Target --- */
  --touch-target: 2.75rem; /* 44px */

  /* --- Z-Index Scale --- */
  --z-base:       0;
  --z-raised:     10;
  --z-overlay:    100;
  --z-modal:      200;
  --z-toast:      300;
  --z-top-bar:    50;
  --z-bottom-nav: 50;
  --z-fab:        60;

  /* --- Navigation Heights --- */
  --top-bar-height:    3.5rem;  /* 56px */
  --bottom-nav-height: 4rem;    /* 64px */
  --quick-add-height:  3.5rem;  /* 56px */
}

/* ==========================================================================
   2. LIGHT MODE (default)
   ========================================================================== */

:root,
[data-theme="light"] {
  /* Surfaces — warm beige neutrals */
  --color-bg:               #F7F5F0;
  --color-surface:          #FDFCFA;
  --color-surface-2:        #FFFFFF;
  --color-surface-offset:   #F0EDE7;
  --color-surface-offset-2: #E9E5DE;
  --color-divider:          #E0DDD7;
  --color-border:           #D5D1C9;
  --color-border-strong:    #B8B3AA;

  /* Text */
  --color-text:         #1E1C18;
  --color-text-muted:   #6B6860;
  --color-text-faint:   #B0ACA5;
  --color-text-inverse: #FDFCFA;

  /* Semantic — FIXED, never change with accent */
  --color-urgent:           #DC2626;
  --color-urgent-bg:        #FEF2F2;
  --color-urgent-border:    #FECACA;
  --color-urgent-text:      #991B1B;

  --color-success:          #16A34A;
  --color-success-bg:       #F0FDF4;
  --color-success-border:   #BBF7D0;
  --color-success-text:     #15803D;

  --color-warning:          #D97706;
  --color-warning-bg:       #FFFBEB;
  --color-warning-border:   #FDE68A;
  --color-warning-text:     #92400E;

  --color-error:            #DC2626;
  --color-error-bg:         #FEF2F2;
  --color-error-border:     #FECACA;
  --color-error-text:       #991B1B;

  --color-someday:          #6B7280;
  --color-someday-bg:       #F9FAFB;
  --color-someday-border:   #E5E7EB;
  --color-someday-text:     #374151;

  /* Shadows — warm-toned */
  --shadow-xs:  0 1px 2px rgb(30 28 24 / 0.04);
  --shadow-sm:  0 1px 4px rgb(30 28 24 / 0.06), 0 1px 2px rgb(30 28 24 / 0.04);
  --shadow-md:  0 4px 12px rgb(30 28 24 / 0.08), 0 2px 4px rgb(30 28 24 / 0.04);
  --shadow-lg:  0 12px 32px rgb(30 28 24 / 0.10), 0 4px 8px rgb(30 28 24 / 0.06);
  --shadow-xl:  0 24px 48px rgb(30 28 24 / 0.12), 0 8px 16px rgb(30 28 24 / 0.06);

  /* Overlays */
  --overlay-bg: rgb(30 28 24 / 0.40);
}

/* ==========================================================================
   3. DARK MODE
   ========================================================================== */

[data-theme="dark"] {
  /* Surfaces — warm dark (not cold gray) */
  --color-bg:               #1A1A1A;
  --color-surface:          #242424;
  --color-surface-2:        #2C2C2C;
  --color-surface-offset:   #202020;
  --color-surface-offset-2: #1D1D1D;
  --color-divider:          #333333;
  --color-border:           #3A3A3A;
  --color-border-strong:    #505050;

  /* Text */
  --color-text:         #E8E6E2;
  --color-text-muted:   #8A8782;
  --color-text-faint:   #555350;
  --color-text-inverse: #1A1A1A;

  /* Semantic — adjusted for dark backgrounds */
  --color-urgent:           #F87171;
  --color-urgent-bg:        rgb(248 113 113 / 0.10);
  --color-urgent-border:    rgb(248 113 113 / 0.25);
  --color-urgent-text:      #FCA5A5;

  --color-success:          #4ADE80;
  --color-success-bg:       rgb(74 222 128 / 0.10);
  --color-success-border:   rgb(74 222 128 / 0.25);
  --color-success-text:     #86EFAC;

  --color-warning:          #FCD34D;
  --color-warning-bg:       rgb(252 211 77 / 0.10);
  --color-warning-border:   rgb(252 211 77 / 0.25);
  --color-warning-text:     #FDE68A;

  --color-error:            #F87171;
  --color-error-bg:         rgb(248 113 113 / 0.10);
  --color-error-border:     rgb(248 113 113 / 0.25);
  --color-error-text:       #FCA5A5;

  --color-someday:          #6B7280;
  --color-someday-bg:       rgb(107 114 128 / 0.10);
  --color-someday-border:   rgb(107 114 128 / 0.25);
  --color-someday-text:     #9CA3AF;

  /* Shadows — deeper for dark */
  --shadow-xs:  0 1px 2px rgb(0 0 0 / 0.15);
  --shadow-sm:  0 1px 4px rgb(0 0 0 / 0.22), 0 1px 2px rgb(0 0 0 / 0.15);
  --shadow-md:  0 4px 12px rgb(0 0 0 / 0.28), 0 2px 4px rgb(0 0 0 / 0.18);
  --shadow-lg:  0 12px 32px rgb(0 0 0 / 0.35), 0 4px 8px rgb(0 0 0 / 0.20);
  --shadow-xl:  0 24px 48px rgb(0 0 0 / 0.45), 0 8px 16px rgb(0 0 0 / 0.25);

  --overlay-bg: rgb(0 0 0 / 0.60);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #1A1A1A;
    --color-surface:          #242424;
    --color-surface-2:        #2C2C2C;
    --color-surface-offset:   #202020;
    --color-surface-offset-2: #1D1D1D;
    --color-divider:          #333333;
    --color-border:           #3A3A3A;
    --color-border-strong:    #505050;
    --color-text:             #E8E6E2;
    --color-text-muted:       #8A8782;
    --color-text-faint:       #555350;
    --color-text-inverse:     #1A1A1A;
    --color-urgent:           #F87171;
    --color-urgent-bg:        rgb(248 113 113 / 0.10);
    --color-urgent-border:    rgb(248 113 113 / 0.25);
    --color-urgent-text:      #FCA5A5;
    --color-success:          #4ADE80;
    --color-success-bg:       rgb(74 222 128 / 0.10);
    --color-success-border:   rgb(74 222 128 / 0.25);
    --color-success-text:     #86EFAC;
    --color-warning:          #FCD34D;
    --color-warning-bg:       rgb(252 211 77 / 0.10);
    --color-warning-border:   rgb(252 211 77 / 0.25);
    --color-warning-text:     #FDE68A;
    --color-error:            #F87171;
    --color-error-bg:         rgb(248 113 113 / 0.10);
    --color-error-border:     rgb(248 113 113 / 0.25);
    --color-error-text:       #FCA5A5;
    --color-someday:          #6B7280;
    --color-someday-bg:       rgb(107 114 128 / 0.10);
    --color-someday-border:   rgb(107 114 128 / 0.25);
    --color-someday-text:     #9CA3AF;
    --shadow-xs:  0 1px 2px rgb(0 0 0 / 0.15);
    --shadow-sm:  0 1px 4px rgb(0 0 0 / 0.22), 0 1px 2px rgb(0 0 0 / 0.15);
    --shadow-md:  0 4px 12px rgb(0 0 0 / 0.28), 0 2px 4px rgb(0 0 0 / 0.18);
    --shadow-lg:  0 12px 32px rgb(0 0 0 / 0.35), 0 4px 8px rgb(0 0 0 / 0.20);
    --shadow-xl:  0 24px 48px rgb(0 0 0 / 0.45), 0 8px 16px rgb(0 0 0 / 0.25);
    --overlay-bg: rgb(0 0 0 / 0.60);
  }
}


/* ==========================================================================
   4. ACCENT COLOR SYSTEM
   HSL-based: set --accent-h/s/l per accent class, consume via --accent
   ========================================================================== */

:root {
  /* Default accent: Shopping green */
  --accent-h: 141;
  --accent-s: 51%;
  --accent-l: 36%;

  /* Derived accent tokens — all use these three variables */
  --accent:          hsl(var(--accent-h), var(--accent-s), var(--accent-l));
  --accent-hover:    hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) - 8%));
  --accent-active:   hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) - 14%));
  --accent-light:    hsl(var(--accent-h), calc(var(--accent-s) - 10%), calc(var(--accent-l) + 42%));
  --accent-faint:    hsl(var(--accent-h), calc(var(--accent-s) - 20%), calc(var(--accent-l) + 52%));
  --accent-border:   hsl(var(--accent-h), calc(var(--accent-s) - 15%), calc(var(--accent-l) + 36%));
  --accent-text:     hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) - 6%));
  --accent-on:       #ffffff; /* text on accent background */
}

/* Dark mode accent adjustments — increase lightness */
[data-theme="dark"],
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --accent-l: 52%;
    --accent-light: hsl(var(--accent-h), calc(var(--accent-s) - 20%), 18%);
    --accent-faint:  hsl(var(--accent-h), calc(var(--accent-s) - 30%), 14%);
    --accent-border: hsl(var(--accent-h), calc(var(--accent-s) - 15%), 30%);
    --accent-text:   hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) + 4%));
    --accent-on:     #1A1A1A;
  }
}

[data-theme="dark"] {
  --accent-l: 52%;
  --accent-light:  hsl(var(--accent-h), calc(var(--accent-s) - 20%), 18%);
  --accent-faint:  hsl(var(--accent-h), calc(var(--accent-s) - 30%), 14%);
  --accent-border: hsl(var(--accent-h), calc(var(--accent-s) - 15%), 30%);
  --accent-text:   hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) + 4%));
  --accent-on:     #1A1A1A;
}

/* --- Accent Classes (applied to <html>) --- */
.accent-green,
html.accent-green {
  --accent-h: 141;
  --accent-s: 51%;
  --accent-l: 36%;
}

.accent-pink,
html.accent-pink {
  --accent-h: 330;
  --accent-s: 70%;
  --accent-l: 44%;
}

.accent-blue,
html.accent-blue {
  --accent-h: 215;
  --accent-s: 80%;
  --accent-l: 38%;
}

.accent-red,
html.accent-red {
  --accent-h: 2;
  --accent-s: 68%;
  --accent-l: 42%;
}

.accent-purple,
html.accent-purple {
  --accent-h: 275;
  --accent-s: 65%;
  --accent-l: 38%;
}

.accent-orange,
html.accent-orange {
  --accent-h: 24;
  --accent-s: 90%;
  --accent-l: 42%;
}

/* Dark mode accent lightness for all classes */
[data-theme="dark"] .accent-green,
html.accent-green[data-theme="dark"] { --accent-l: 52%; }

[data-theme="dark"] .accent-pink,
html.accent-pink[data-theme="dark"] { --accent-l: 62%; }

[data-theme="dark"] .accent-blue,
html.accent-blue[data-theme="dark"] { --accent-l: 58%; }

[data-theme="dark"] .accent-red,
html.accent-red[data-theme="dark"] { --accent-l: 58%; }

[data-theme="dark"] .accent-purple,
html.accent-purple[data-theme="dark"] { --accent-l: 58%; }

[data-theme="dark"] .accent-orange,
html.accent-orange[data-theme="dark"] { --accent-l: 60%; }


/* ==========================================================================
   5. BASE RESET & TYPOGRAPHY
   ========================================================================== */

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

[hidden] {
  display: none !important;
}

html {
  -moz-text-size-adjust:    none;
  -webkit-text-size-adjust: none;
  text-size-adjust:         none;
  -webkit-font-smoothing:   antialiased;
  -moz-osx-font-smoothing:  grayscale;
  text-rendering:           optimizeLegibility;
  scroll-behavior:          smooth;
  hanging-punctuation:      first last;
  scroll-padding-top:       var(--space-16);
  /* Prevent pull-to-refresh on mobile */
  overscroll-behavior:      none;
}

body {
  min-height: 100dvh;
  line-height: var(--leading-normal);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
}

p, li, figcaption {
  text-wrap: pretty;
  max-width: 72ch;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

::selection {
  background: var(--accent-light);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Smooth transitions on interactive elements */
a,
button,
[role="button"],
[role="link"],
input,
textarea,
select {
  transition:
    color          var(--transition-interactive),
    background     var(--transition-interactive),
    background-color var(--transition-interactive),
    border-color   var(--transition-interactive),
    box-shadow     var(--transition-interactive),
    opacity        var(--transition-interactive);
}


/* ==========================================================================
   5b. SVG ICON DEFAULTS
   ========================================================================== */

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-xl {
  width: 32px;
  height: 32px;
}


/* ==========================================================================
   6. APP SHELL LAYOUT
   ========================================================================== */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--color-bg);
  position: relative;
}

/* ==========================================================================
   7. TOP BAR
   ========================================================================== */

.top-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-top-bar);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--top-bar-height);
  padding: 0 var(--space-4);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  /* Subtle blur glass effect */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.top-bar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.top-bar__logo-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
  flex-shrink: 0;
}

.top-bar__app-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.top-bar__title {
  flex: 3;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.top-bar__spacer {
  flex: 1;
}

.top-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.top-bar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
}

.top-bar__btn:hover {
  color: var(--color-text);
  background-color: var(--color-surface-offset);
}

.top-bar__btn:active {
  background-color: var(--color-surface-offset-2);
}

.top-bar__back {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  margin-left: calc(-1 * var(--space-2));
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
}

.top-bar__back:hover {
  color: var(--color-text);
  background-color: var(--color-surface-offset);
}


/* ==========================================================================
   8. BOTTOM NAVIGATION
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-bottom-nav);
  display: flex;
  align-items: stretch;
  height: var(--bottom-nav-height);
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  /* Safe area for notched phones */
  padding-bottom: env(safe-area-inset-bottom, 0);
  flex-shrink: 0;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--space-2) var(--space-1);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  min-height: var(--touch-target);
  -webkit-tap-highlight-color: transparent;
  transition:
    color          var(--transition-interactive),
    background     var(--transition-interactive);
}

.bottom-nav__item:hover {
  color: var(--color-text);
  background-color: var(--color-surface-offset);
}

.bottom-nav__item.active,
.bottom-nav__item[aria-current="page"] {
  color: var(--accent);
}

.bottom-nav__item.active .bottom-nav__icon,
.bottom-nav__item[aria-current="page"] .bottom-nav__icon {
  /* Filled icon on active state (handled by JS swapping icon SVG) */
}

.bottom-nav__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: transform var(--transition-spring);
}

.bottom-nav__item:active .bottom-nav__icon {
  transform: scale(0.88);
}

.bottom-nav__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  line-height: 1;
}

/* Active indicator pill */
.bottom-nav__item.active::before,
.bottom-nav__item[aria-current="page"]::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  border-radius: var(--radius-full);
  background-color: var(--accent);
}


/* ==========================================================================
   9. MAIN CONTENT
   ========================================================================== */

.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  /* Scroll area between top bar and bottom nav */
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.main-content--with-quick-add {
  padding-top: 0;
}

/* Page-level padding */
.page-content {
  padding: var(--space-2);
  max-width: 100%;
  /* cute */
  padding-bottom: 4rem;
}


/* ==========================================================================
   10. LIST CARD
   ========================================================================== */

.list-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    box-shadow    var(--transition-interactive),
    transform     var(--transition-fast),
    border-color  var(--transition-interactive),
    background    var(--transition-interactive);
  -webkit-tap-highlight-color: transparent;
}

.list-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

.list-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-xs);
}

/* Urgent list gets a very subtle warm wash — not a border strip */
.list-card--urgent {
  background-color: var(--color-urgent-bg);
  border-color: var(--color-urgent-border);
}

.list-card--someday {
  opacity: 0.82;
}

.list-card__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.list-card__icon {
  font-size: 1.375rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.list-card__title-group {
  flex: 1;
  min-width: 0;
}

.list-card__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  line-height: var(--leading-snug);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--space-1);
}

.list-card__subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.list-card__counts {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.list-card__count {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px; /* old var(--text-xs) */
  color: var(--color-text-muted);
  min-width: fit-content;
}

.list-card__count-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--color-text-faint);
  flex-shrink: 0;
}

.list-card__count--purchased .list-card__count-dot {
  background-color: var(--color-success);
}

.list-card__count--rejected .list-card__count-dot {
  background-color: var(--color-text-faint);
}

.list-card__price {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  /* cute */
  float: right;
  padding: 0.25rem 2px 0px 0px;
}

.list-card__date {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
}

.list-card__progress {
  margin-top: var(--space-2);
  height: 3px;
  background-color: var(--color-surface-offset-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.list-card__progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background-color: var(--color-success);
  transition: width var(--transition-smooth);
}

/* Grid layout for list cards */
.lists-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  padding: var(--space-2);
}


/* ==========================================================================
   11. PRIORITY BADGE
   ========================================================================== */

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.4;
  white-space: nowrap;
  flex-shrink: 0;
}

.priority-badge--urgent {
  background-color: var(--color-urgent-bg);
  color: var(--color-urgent-text);
  border: 1px solid var(--color-urgent-border);
}

.priority-badge--standard {
  background-color: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.priority-badge--someday {
  background-color: var(--color-someday-bg);
  color: var(--color-someday-text);
  border: 1px solid var(--color-someday-border);
}

/* Small inline badge for item rows — absolute positioned top-right */
.priority-badge--sm {
  padding: 2px var(--space-2);
  font-size: 11px; /* old var(--text-xs) */
  line-height: 1.4;
  position: absolute;
  right: 10px;
  top: var(--space-2);
}

/* Dot-only variant */
.priority-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.priority-dot--urgent   { background-color: var(--color-urgent); }
.priority-dot--standard { background-color: var(--color-text-faint); }
.priority-dot--someday  { background-color: var(--color-someday); }


/* ==========================================================================
   12. ITEM ROW
   ========================================================================== */

.item-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: var(--touch-target);
  -webkit-tap-highlight-color: transparent;
  transition:
    background    var(--transition-fast),
    opacity       var(--transition-interactive);
}

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

.item-row:hover {
  background-color: var(--color-surface-offset);
}

.item-row:active {
  background-color: var(--color-surface-offset-2);
}

/* Checkbox / state toggle */
.item-row__check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  margin: calc(-1 * var(--space-2));
  margin-right: calc(var(--space-3) - var(--space-2));
  flex-shrink: 0;
  cursor: pointer;
}

.item-row__checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background-color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background    var(--transition-interactive),
    border-color  var(--transition-interactive);
  position: relative;
}

.item-row__checkbox:checked {
  background-color: var(--color-success);
  border-color: var(--color-success);
}

.item-row__checkbox:checked::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 7px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.item-row__checkbox:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Content area */
.item-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-row__name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.item-row__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--leading-snug);
}

.item-row__detail {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.item-row__price {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.item-row__qty {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.item-row__note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right side */
.item-row__end {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
  align-self: stretch;
}

.item-row__priority-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.item-row__priority-dot--urgent   { background-color: var(--color-urgent); }
.item-row__priority-dot--standard { display: none; }
.item-row__priority-dot--someday  { background-color: var(--color-text-faint); }

/* More actions button */
.item-row__more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  margin: calc(-1 * var(--space-2));
  margin-top: var(--space-3);
  color: var(--color-text-faint);
  flex-shrink: 0;
}

.item-row__more:hover {
  color: var(--color-text-muted);
}

/* --- Purchased state --- */
.item-row.purchased,
.item-row--purchased {
  opacity: 0.65;
}

.item-row.purchased .item-row__name,
.item-row--purchased .item-row__name {
  text-decoration: line-through;
  color: var(--color-text-muted);
  text-decoration-color: var(--color-text-faint);
}

.item-row.purchased .item-row__checkbox,
.item-row--purchased .item-row__checkbox {
  border-color: var(--color-success);
  background-color: var(--color-success);
}

/* --- Postponed state --- */
.item-row.postponed,
.item-row--postponed {
  opacity: 0.55;
  background-color: var(--color-surface-offset);
}

.item-row.postponed .item-row__name,
.item-row--postponed .item-row__name {
  font-style: italic;
}

/* --- Swipe action reveal --- */
.item-row__swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  transform: translateX(100%);
  transition: transform var(--transition-interactive);
}

.item-row__swipe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  border: none;
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  gap: var(--space-1);
  flex-direction: column;
  color: #fff;
}

.item-row__swipe-btn--reject {
  background-color: var(--color-urgent);
}

.item-row__swipe-btn--postpone {
  background-color: var(--color-warning);
}

.item-row.swiping .item-row__swipe-actions {
  transform: translateX(0);
}


/* ==========================================================================
   13. REJECTED SECTION
   ========================================================================== */

.rejected-section {
  margin-top: var(--space-2);
  background-color: var(--color-surface-offset);
  border-top: 0px solid var(--color-border); /* 1px */
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-md);
  
  /* cute */
  max-width: 720px;
  margin: 2.5rem auto;
}

.rejected-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  border-bottom: 0px solid var(--color-border); /* old 1px */
}

.rejected-section__title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rejected-section__count {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.rejected-section .item-row {
  background-color: transparent;
  opacity: 0.60;
}

.rejected-section .item-row__name {
  text-decoration: line-through;
  color: var(--color-text-muted);
  text-decoration-style: dashed;
}


/* ==========================================================================
   13b. SELECTION MODE & BULK ACTIONS
   ========================================================================== */

.select-toggle {
  align-self: flex-end;
  margin: var(--space-2) var(--space-3) 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.bulk-bar {
  position: sticky;
  top: var(--quick-add-height);
  z-index: var(--z-raised);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background-color: var(--accent-faint);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  margin: var(--space-2) var(--space-3);
  gap: var(--space-3);
}

.bulk-bar__count {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--accent-text);
  white-space: nowrap;
}

.bulk-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.bulk-bar__delete {
  color: var(--color-urgent) !important;
}

.item-row--selectable {
  cursor: pointer;
  user-select: none;
}

.item-row--selectable::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.item-row--selected {
  background-color: var(--accent-faint) !important;
  outline: 2px solid var(--accent-border);
  outline-offset: -2px;
}


/* ==========================================================================
   14. QUICK ADD BAR
   ========================================================================== */

.quick-add {
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--quick-add-height);
  padding: var(--space-2) var(--space-3);
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* Opaque shield above the sticky bar so items don't peek through */
.quick-add::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: var(--top-bar-height, 56px);
  background-color: var(--color-bg);
  pointer-events: none;
}

.quick-add__input {
  flex: 1;
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  background-color: var(--color-surface-offset);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--color-text);
  outline: none;
  transition:
    border-color  var(--transition-interactive),
    background    var(--transition-interactive),
    box-shadow    var(--transition-interactive);
}

.quick-add__input::placeholder {
  color: var(--color-text-faint);
}

.quick-add__input:focus {
  background-color: var(--color-surface-2);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-faint);
}

.quick-add__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--accent);
  color: var(--accent-on);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background    var(--transition-interactive),
    transform     var(--transition-fast);
}

.quick-add__btn:hover {
  background-color: var(--accent-hover);
}

.quick-add__btn:active {
  transform: scale(0.90);
}

.quick-add__suggestions {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: var(--space-4);
  right: var(--space-4);
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: var(--z-modal);
  max-height: 240px;
  overflow-y: auto;
}

.quick-add__suggestion-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--color-divider);
  transition: background var(--transition-fast);
}

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

.quick-add__suggestion-item:hover {
  background-color: var(--color-surface-offset);
}

.quick-add__suggestion-name {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.quick-add__suggestion-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}


/* ==========================================================================
   15. FLOATING ACTION BUTTON (FAB)
   ========================================================================== */

.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0));
  right: var(--space-4);
  z-index: var(--z-fab);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 45px; /* old 56px */
  border-radius: var(--radius-2xl);
  background-color: var(--accent);
  color: var(--accent-on);
  box-shadow: var(--shadow-lg);
  border: none;
  cursor: pointer;
  transition:
    background    var(--transition-interactive),
    box-shadow    var(--transition-interactive),
    transform     var(--transition-spring);
  -webkit-tap-highlight-color: transparent;
}

.fab:hover {
  background-color: var(--accent-hover);
  box-shadow: var(--shadow-xl);
}

.fab:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-md);
}

.fab__icon {
  width: 24px;
  height: 24px;
  transition: transform var(--transition-spring);
}

.fab:active .fab__icon {
  transform: rotate(45deg);
}

/* Extended FAB with label */
.fab--extended {
  width: auto;
  padding: 0 var(--space-5);
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}


/* ==========================================================================
   16. MODAL & BOTTOM SHEET
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background-color: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--transition-interactive) ease both;
}

.modal-overlay.closing {
  animation: fadeOut var(--transition-interactive) ease both;
}

.modal {
  background-color: var(--color-surface-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border);
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInScale var(--transition-smooth) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-overlay.closing .modal {
  animation: slideOutScale var(--transition-interactive) ease both;
}

.modal__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal__title {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  line-height: var(--leading-tight);
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  margin: calc(-1 * var(--space-2));
}

.modal__close:hover {
  color: var(--color-text);
  background-color: var(--color-surface-offset);
}

.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  -webkit-overflow-scrolling: touch;
}

.modal__footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* Bottom sheet */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-modal);
  background-color: var(--color-surface-2);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border);
  border-bottom: none;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
  animation: slideInUp var(--transition-smooth) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bottom-sheet.closing {
  animation: slideOutDown var(--transition-interactive) ease both;
}

.bottom-sheet__handle {
  display: flex;
  justify-content: center;
  padding: var(--space-3) var(--space-4) var(--space-2);
  flex-shrink: 0;
}

.bottom-sheet__handle-bar {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-full);
  background-color: var(--color-border);
}

.bottom-sheet__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5) var(--space-4);
  flex-shrink: 0;
}

.bottom-sheet__title {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.bottom-sheet__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bottom-sheet__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}


/* ==========================================================================
   17. FORM ELEMENTS
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  line-height: var(--leading-snug);
}

.form-label--optional::after {
  content: ' (optional)';
  font-weight: var(--weight-regular);
  color: var(--color-text-faint);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: calc(-1 * var(--space-1));
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: calc(-1 * var(--space-1));
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Input base */
.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color  var(--transition-interactive),
    background    var(--transition-interactive),
    box-shadow    var(--transition-interactive);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-faint);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background-color: var(--color-surface-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-faint);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-input--error,
.form-select--error {
  border-color: var(--color-error-border);
  background-color: var(--color-error-bg);
}

.form-input--error:focus,
.form-select--error:focus {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-bg);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6860' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
  cursor: pointer;
}

.form-textarea {
  min-height: 88px;
  resize: vertical;
  line-height: var(--leading-normal);
}

/* Row layout for form groups side-by-side */
.form-row {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr;
  gap: var(--space-3);
}

/* Priority selector — 3 option pills */
.priority-selector {
  display: flex;
  gap: var(--space-2);
}

.priority-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background-color: var(--color-surface-offset);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  color: var(--color-text-muted);
  transition:
    border-color  var(--transition-interactive),
    background    var(--transition-interactive),
    color         var(--transition-interactive);
}

.priority-option:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.priority-option.selected--urgent {
  background-color: var(--color-urgent-bg);
  border-color: var(--color-urgent);
  color: var(--color-urgent-text);
}

.priority-option.selected--standard {
  background-color: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.priority-option.selected--someday {
  background-color: var(--color-someday-bg);
  border-color: var(--color-someday-border);
  color: var(--color-someday-text);
}


/* ==========================================================================
   18. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background    var(--transition-interactive),
    border-color  var(--transition-interactive),
    color         var(--transition-interactive),
    box-shadow    var(--transition-interactive),
    transform     var(--transition-fast);
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Full-width */
.btn--full {
  width: 100%;
}

/* Small variant */
.btn--sm {
  min-height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--text-xs);
}

/* Large variant */
.btn--lg {
  min-height: 52px;
  padding: 0 var(--space-6);
  font-size: var(--text-base);
}

/* Primary — uses accent */
.btn-primary {
  background-color: var(--accent);
  color: var(--accent-on);
  border-color: transparent;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  background-color: var(--accent-active);
}

/* Secondary — outlined accent */
.btn-secondary {
  background-color: var(--accent-light);
  color: var(--accent-text);
  border-color: var(--accent-border);
}

.btn-secondary:hover {
  background-color: var(--accent-faint);
  border-color: var(--accent);
}

/* Ghost — transparent */
.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--color-surface-offset);
  color: var(--color-text);
}

/* Outlined — neutral border */
.btn-outlined {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outlined:hover {
  background-color: var(--color-surface-offset);
  border-color: var(--color-border-strong);
}

/* Danger */
.btn-danger {
  background-color: var(--color-urgent-bg);
  color: var(--color-urgent-text);
  border-color: var(--color-urgent-border);
}

.btn-danger:hover {
  background-color: var(--color-urgent);
  color: #fff;
  border-color: var(--color-urgent);
}


/* ==========================================================================
   19. TOAST NOTIFICATION
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
  pointer-events: none;
  width: calc(100% - var(--space-8));
  max-width: 480px;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn var(--transition-smooth) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.toast.hiding {
  animation: toastOut var(--transition-interactive) ease both;
}

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast__message {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--leading-snug);
}

.toast__action {
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent-text);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  margin: calc(-1 * var(--space-1));
  border-radius: var(--radius-sm);
}

.toast__action:hover {
  background-color: var(--color-surface-offset);
}

/* Toast variants */
.toast--success {
  border-color: var(--color-success-border);
  background-color: var(--color-success-bg);
}

.toast--success .toast__icon { color: var(--color-success); }

.toast--error {
  border-color: var(--color-urgent-border);
  background-color: var(--color-urgent-bg);
}

.toast--error .toast__icon { color: var(--color-urgent); }

.toast--warning {
  border-color: var(--color-warning-border);
  background-color: var(--color-warning-bg);
}

.toast--warning .toast__icon { color: var(--color-warning); }


/* ==========================================================================
   20. EMPTY STATE
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  gap: var(--space-4);
  min-height: 320px;
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  color: var(--color-text-faint);
  flex-shrink: 0;
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  line-height: var(--leading-snug);
}

.empty-state__description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 280px;
  line-height: var(--leading-relaxed);
}


/* ==========================================================================
   21. SEARCH INPUT
   ========================================================================== */

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-faint);
  pointer-events: none;
  flex-shrink: 0;
  transition: color var(--transition-interactive);
}

.search-input {
  display: block;
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 18px + var(--space-2));
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-surface-offset);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  transition:
    border-color  var(--transition-interactive),
    background    var(--transition-interactive),
    box-shadow    var(--transition-interactive);
}

.search-input::placeholder {
  color: var(--color-text-faint);
}

.search-input:focus {
  background-color: var(--color-surface-2);
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-faint);
}

.search-input:focus + .search-icon,
.search-wrapper:focus-within .search-icon {
  color: var(--accent);
}

.search-clear {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: var(--color-surface-offset-2);
  border: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.search-input:not(:placeholder-shown) ~ .search-clear {
  opacity: 1;
  pointer-events: auto;
}

/* Full-page search bar in top bar */
.top-bar--search {
  padding: var(--space-2) var(--space-3);
  gap: var(--space-2);
}

.search-bar-input {
  flex: 1;
  min-height: 38px;
  padding: 0 var(--space-3) 0 var(--space-8);
  font-size: var(--text-base);
  background-color: var(--color-surface-offset);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  color: var(--color-text);
  /* cute */
  width: 100%;
}

.search-bar-input:focus {
  border-color: var(--accent-border);
  background-color: var(--color-surface-2);
}


/* ==========================================================================
   22. TAGS & HASHTAGS
   ========================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background-color: var(--color-surface-offset-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  white-space: nowrap;
  line-height: 1.5;
}

.tag--removable {
  padding-right: var(--space-1);
}

.tag__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tag__remove:hover {
  background-color: var(--color-border);
  color: var(--color-text-muted);
}

.hashtag {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 11px; /* old var(--text-xs) */
  font-weight: var(--weight-medium);
  background-color: var(--accent-faint);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background    var(--transition-fast),
    border-color  var(--transition-fast);
}

.hashtag:hover {
  background-color: var(--accent-light);
}

/* Tag list */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}


/* ==========================================================================
   23. CATEGORY BADGE
   ========================================================================== */

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 11px; /* old var(--text-xs) */
  font-weight: var(--weight-medium);
  background-color: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.category-badge__icon {
  font-size: 0.85em;
}


/* ==========================================================================
   24. TEMPLATE CARD
   ========================================================================== */

.template-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    box-shadow    var(--transition-interactive),
    border-color  var(--transition-interactive),
    transform     var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.template-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}

.template-card:active {
  transform: scale(0.98);
}

.template-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--accent-light);
  color: var(--accent-text);
  font-size: 1.375rem;
  flex-shrink: 0;
}

.template-card__body {
  flex: 1;
  min-width: 0;
}

.template-card__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.template-card__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.template-card__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}


/* ==========================================================================
   25. SETTINGS
   ========================================================================== */

.settings-group {
  margin-bottom: var(--space-6);
}

.settings-group__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 var(--space-4);
  margin-bottom: var(--space-2);
}

.settings-list {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

/* cute */
.settings-list.lang-list { display: flex; flex-wrap: wrap; }
.settings-list.lang-list button { width: 50%; text-align: left; }

@media (min-width: 767px) {
	.settings-list.lang-list button { width: 20%; }
}

.settings-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  min-height: var(--touch-target);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

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

.settings-item:hover {
  background-color: var(--color-surface-offset);
}

.settings-item:active {
  background-color: var(--color-surface-offset-2);
}

.settings-item--no-action {
  cursor: default;
}

.settings-item--no-action .form-select,
.settings-item--no-action .form-input,
.settings-item--no-action button {
  pointer-events: auto;
  cursor: pointer;
}

.settings-item--destructive .settings-item__label {
  color: var(--color-urgent);
}

.settings-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-offset);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

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

.settings-item__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  line-height: var(--leading-snug);
  margin-right: 0.5rem;
}

.settings-item__sublabel {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item__value {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.settings-item__chevron {
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  flex-shrink: 0;
}

/* Toggle / switch */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__track {
  display: block;
  width: 48px;
  height: 28px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-offset-2);
  cursor: pointer;
  transition: background var(--transition-interactive);
  border: 2px solid var(--color-border);
}

.toggle__input:checked + .toggle__track {
  background-color: var(--accent);
  border-color: var(--accent);
}

.toggle__track::after {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background-color: #fff;
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
  transition: transform var(--transition-spring);
  margin-top: 2px;
}

.toggle__input:checked + .toggle__track::after {
  transform: translateX(22px);
}

.toggle__input:focus-visible + .toggle__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ==========================================================================
   26. HELP & FAQ
   ========================================================================== */

.help-section {
  padding: var(--space-5) 0px var(--space-4) 0px; /* old var(--space-4) */
}

.help-section__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-4);
  /* cute */
  text-align: center;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.faq-item {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-interactive);
  /* cute */
  margin-bottom: 1rem;
}

.faq-item.open {
  border-color: var(--accent-border);
}

.faq-item__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  cursor: pointer;
  min-height: var(--touch-target);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.faq-item__question:hover {
  background-color: var(--color-surface-offset);
}

.faq-item__chevron {
  width: 18px;
  height: 18px;
  color: var(--color-text-faint);
  flex-shrink: 0;
  transition: transform var(--transition-interactive);
}

.faq-item.open .faq-item__chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-item__answer {
  display: none;
  padding: var(--space-3) var(--space-4) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  border-top: 1px solid var(--color-divider);
}

.faq-item.open .faq-item__answer {
  display: block;
  animation: fadeIn var(--transition-interactive) ease both;
}


/* ==========================================================================
   27. EXPORT OPTIONS
   ========================================================================== */

.export-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: none;
  background-color: var(--color-surface);
  cursor: pointer;
  min-height: var(--touch-target);
  transition:
    background    var(--transition-interactive),
    box-shadow    var(--transition-interactive);
  -webkit-tap-highlight-color: transparent;
}

.export-option:hover {
  background-color: var(--accent-faint);
}

.export-option:active {
  background-color: var(--color-surface-offset);
}

.export-option__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-offset);
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: background var(--transition-interactive), color var(--transition-interactive);
}

.export-option:hover .export-option__icon {
  background-color: var(--accent-light);
  color: var(--accent-text);
}

.export-option__label {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  text-align: left;
}

.export-option__sublabel {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: var(--weight-regular);
}

.export-option__chevron {
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  flex-shrink: 0;
}


/* ==========================================================================
   28. COLOR PICKER (Accent selector)
   ========================================================================== */

.color-picker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  flex-wrap: wrap;
}

.color-picker__option {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  cursor: pointer;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform     var(--transition-spring),
    border-color  var(--transition-interactive);
  -webkit-tap-highlight-color: transparent;
}

.color-picker__option:hover {
  transform: scale(1.15);
}

.color-picker__option.selected {
  border-color: var(--color-text);
  transform: scale(1.1);
}

.color-picker__swatch {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

/* Individual swatch colors */
.color-picker__option[data-accent="green"] .color-picker__swatch  { background: #2D8A4E; }
.color-picker__option[data-accent="pink"] .color-picker__swatch   { background: #C2185B; }
.color-picker__option[data-accent="blue"] .color-picker__swatch   { background: #1565C0; }
.color-picker__option[data-accent="red"] .color-picker__swatch    { background: #C62828; }
.color-picker__option[data-accent="purple"] .color-picker__swatch { background: #6A1B9A; }
.color-picker__option[data-accent="orange"] .color-picker__swatch { background: #E65100; }

/* Dark mode swatch variants */
[data-theme="dark"] .color-picker__option[data-accent="green"] .color-picker__swatch  { background: #4CAF6E; }
[data-theme="dark"] .color-picker__option[data-accent="pink"] .color-picker__swatch   { background: #E91E8A; }
[data-theme="dark"] .color-picker__option[data-accent="blue"] .color-picker__swatch   { background: #42A5F5; }
[data-theme="dark"] .color-picker__option[data-accent="red"] .color-picker__swatch    { background: #EF5350; }
[data-theme="dark"] .color-picker__option[data-accent="purple"] .color-picker__swatch { background: #AB47BC; }
[data-theme="dark"] .color-picker__option[data-accent="orange"] .color-picker__swatch { background: #FF7043; }

.color-picker__option.selected::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(0px, -2px);
}


/* ==========================================================================
   29. LANGUAGE OPTION
   ========================================================================== */

.language-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: var(--touch-target);
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.language-option:hover {
  background-color: var(--color-surface-offset);
}

.language-option.selected {
  background-color: var(--accent-light);
}

.language-option__flag {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.language-option__label {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.language-option__check {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.language-option.selected .language-option__check {
  opacity: 1;
}


/* ==========================================================================
   30. BADGE (counter)
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--weight-bold);
  line-height: 1;
  background-color: var(--accent);
  color: var(--accent-on);
  flex-shrink: 0;
}

.badge--urgent {
  background-color: var(--color-urgent);
  color: #fff;
}

.badge--neutral {
  background-color: var(--color-surface-offset-2);
  color: var(--color-text-muted);
}

/* Nav badge */
.bottom-nav__badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--weight-bold);
  background-color: var(--color-urgent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}


/* ==========================================================================
   31. SECTION HEADERS
   ========================================================================== */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-2);
}

.section-header__title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-header__action {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--accent-text);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.section-header__action:hover {
  background-color: var(--accent-faint);
}


/* ==========================================================================
   32. ITEM LIST CONTAINER
   ========================================================================== */

.item-list {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  margin: 0;
}

.item-list + .item-list {
  margin-top: var(--space-3);
}


/* ==========================================================================
   33. SKELETON LOADER
   ========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-offset) 0%,
    var(--color-surface-offset-2) 40%,
    var(--color-surface-offset) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  border-radius: var(--radius-sm);
}

.skeleton-text--sm { height: 0.75em; }
.skeleton-text--lg { height: 1.25em; }

.skeleton-avatar {
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 96px;
  border-radius: var(--radius-lg);
}


/* ==========================================================================
   34. SORT / FILTER BAR
   ========================================================================== */

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background-color: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  transition:
    background    var(--transition-fast),
    border-color  var(--transition-fast),
    color         var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:hover {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.filter-chip.active,
.filter-chip--active {
  background-color: var(--accent-light);
  color: var(--accent-text);
  border-color: var(--accent-border);
}


/* ==========================================================================
   35. DIVIDER
   ========================================================================== */

.divider {
  height: 1px;
  background-color: var(--color-divider);
  border: none;
  margin: 0;
}

.divider--space {
  margin: var(--space-4) 0;
}

.divider--label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.divider--label::before,
.divider--label::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--color-divider);
}


/* ==========================================================================
   36. CONTEXT MENU / ACTION SHEET
   ========================================================================== */

.action-menu {
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-width: 200px;
  /* cute */
  position: absolute;
  bottom: 10%;
  top: unset;
  right: calc(50% - 130px);
  z-index: 200;
  width: 260px;
}

.action-menu__item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  min-height: var(--touch-target);
  border-bottom: 1px solid var(--color-divider);
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.action-menu__item:last-child { border-bottom: none; }

.action-menu__item:hover {
  background-color: var(--color-surface-offset);
}

.action-menu__item--destructive {
  color: var(--color-urgent);
}

.action-menu__icon {
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.action-menu__item--destructive .action-menu__icon {
  color: var(--color-urgent);
}


/* ==========================================================================
   37. ALERT / INLINE MESSAGE
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.alert[hidden] {
  display: none;
}

.alert__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert--warning {
  background-color: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

.alert--warning .alert__icon { color: var(--color-warning); }

.alert--error {
  background-color: var(--color-urgent-bg);
  border-color: var(--color-urgent-border);
  color: var(--color-urgent-text);
}

.alert--error .alert__icon { color: var(--color-urgent); }

.alert--success {
  background-color: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

.alert--success .alert__icon { color: var(--color-success); }

.alert--info {
  background-color: var(--accent-faint);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.alert--info .alert__icon { color: var(--accent); }

.alert__content {
  flex: 1;
}

.alert__title {
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.alert__action {
  font-weight: var(--weight-semibold);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  color: inherit;
  padding: 0;
}


/* ==========================================================================
   38. UTILITY CLASSES
   ========================================================================== */

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Visibility */
.hidden  { display: none !important; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* Opacity */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-75  { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Text color */
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-accent { color: var(--accent-text); }
.text-urgent  { color: var(--color-urgent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

/* Text size */
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }

/* Text weight */
.font-regular  { font-weight: var(--weight-regular); }
.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

/* Text alignment */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Truncate */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Display */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.flex-row   { flex-direction: row; }
.flex-wrap  { flex-wrap: wrap; }
.flex-1     { flex: 1; }
.flex-none  { flex: none; }
.items-start  { align-items: flex-start; }
.items-center { align-items: center; }
.items-end    { align-items: flex-end; }
.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

/* Gap */
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }

/* Padding */
.p-2  { padding: var(--space-2); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }
.p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }
.px-3 { padding-inline: var(--space-3); }
.px-4 { padding-inline: var(--space-4); }
.py-2 { padding-block: var(--space-2); }
.py-3 { padding-block: var(--space-3); }
.py-4 { padding-block: var(--space-4); }

/* Margin */
.m-0  { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

/* Width/Height */
.w-full { width: 100%; }
.min-h-touch { min-height: var(--touch-target); }

/* Border radius */
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Scroll */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }


/* ==========================================================================
   39. KEYFRAME ANIMATIONS
   ========================================================================== */

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(100%);
  }
}

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

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

@keyframes slideInScale {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideOutScale {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }
}

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

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

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

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

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

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

@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.6); }
  70%  { opacity: 1; transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes checkPop {
  0%   { transform: scale(0.6); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Checkbox check animation */
.item-row__checkbox:checked {
  animation: checkPop var(--transition-spring) both;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.spinner--lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}


/* ==========================================================================
   40. REDUCED MOTION
   ========================================================================== */

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

  .skeleton {
    animation: none;
    background: var(--color-surface-offset-2);
  }
}


/* ==========================================================================
   41. RESPONSIVE — TABLET (768px+)
   ========================================================================== */

@media (min-width: 768px) {
  /* 2-column list grid */
  .lists-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    padding: var(--space-5);
  }

  /* Bottom sheet becomes modal-style on tablet+ */
  .bottom-sheet {
    left: 50%;
    right: auto;
    width: 100%;
    max-width: 520px;
    transform: translateX(-50%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    bottom: var(--space-8);
    max-height: 80dvh;
  }

  .bottom-sheet.closing {
    animation: slideOutScale var(--transition-interactive) ease both;
  }

  .bottom-sheet {
    animation: slideInScale var(--transition-smooth) cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  /* Wider page content */
  .page-content {
    padding: var(--space-5) var(--space-6);
  }

  /* Toast wider */
  .toast-container {
    right: var(--space-5);
    left: auto;
    transform: none;
    width: 380px;
    max-width: none;
  }
}


/* ==========================================================================
   42. RESPONSIVE — DESKTOP (1024px+)
   ========================================================================== */

@media (min-width: 1024px) {
  /* 3-column list grid */
  .lists-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
    max-width: var(--content-wide);
    margin: 0 auto;
    padding: var(--space-6) var(--space-0);
  }

  /* Constrain content width */
  .main-content {
    display: flex;
    flex-direction: column;
  }

  .page-content {
    width: 100%;
    max-width: var(--content-default);
    margin: 0 auto;
    padding: var(--space-6);
  }

  /* App shell gets sidebar-like top bar on desktop */
  .app-shell {
    /* max-width: 1440px; */ 
    margin: 0 auto;
  }

  /* Narrow list items for desktop */
  .item-list {
    margin: 0 auto;
    max-width: 720px;
  }

  /* Bottom nav optional: desktop may prefer top nav */
  /* Keep bottom nav visible but constrained for PWA desktop use */
  .bottom-nav {
    /* max-width: 1440px; */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
  }
}


/* ==========================================================================
   43. SAFE AREA INSETS (notched phones)
   ========================================================================== */

.top-bar {
  padding-top: env(safe-area-inset-top, 0);
  height: calc(var(--top-bar-height) + env(safe-area-inset-top, 0));
}

/* Adjust main content for taller top bar on notched devices */
.main-content--with-quick-add {
  padding-top: 0;
}


/* ==========================================================================
   44. SCROLLBAR STYLING (WebKit)
   ========================================================================== */

/* Thin scrollbars on main content */
.main-content,
.modal__body,
.bottom-sheet__body,
.quick-add__suggestions {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.main-content::-webkit-scrollbar,
.modal__body::-webkit-scrollbar,
.bottom-sheet__body::-webkit-scrollbar {
  width: 4px;
}

.main-content::-webkit-scrollbar-track,
.modal__body::-webkit-scrollbar-track {
  background: transparent;
}

.main-content::-webkit-scrollbar-thumb,
.modal__body::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: var(--radius-full);
}


/* ==========================================================================
   45. PRICE DISPLAY
   ========================================================================== */

.price-display {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.price-display--large {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  line-height: 1.2;
}

.price-display--estimated {
  font-style: italic;
  color: var(--color-text-faint);
}


/* ==========================================================================
   46. QUANTITY + UNIT INLINE
   ========================================================================== */

.qty-unit {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.qty-unit__number {
  font-weight: var(--weight-medium);
}

.qty-unit__unit {
  font-weight: var(--weight-regular);
}


/* ==========================================================================
   47. LIST DETAIL PAGE SPECIFICS
   ========================================================================== */

/* Summary bar below quick-add — compact inline row */
.list-summary-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.list-summary-bar__place {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.list-summary-bar__total {
  font-weight: var(--weight-medium);
  color: var(--color-text);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.list-total {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.list-total__label {
  font-weight: var(--weight-regular);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1;
}


/* ==========================================================================
   48. SEARCH RESULTS
   ========================================================================== */

.search-results {
  padding: 0 var(--space-4);
}

.search-results__group {
  margin-bottom: var(--space-5);
}

.search-results__group-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-3) 0 var(--space-2);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: var(--touch-target);
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.search-result-item:hover {
  background-color: var(--color-surface-offset);
}

.search-result-item__highlight {
  color: var(--accent-text);
  font-weight: var(--weight-semibold);
}

.search-result-item__name {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text);
  min-width: 0;
}

.search-result-item__list {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
}

/* ── Item row thumbnail ──────────────────────────────────────────────────── */
.item-row__thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  align-self: center;
}

/* ── Photo area (item form) ──────────────────────────────────────────────── */
.photo-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.photo-area__preview {
  position: relative;
  display: inline-block;
  align-self: flex-start;
}

.photo-area__img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--color-border);
}

.photo-area__remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-faint);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.photo-area__remove:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.photo-area__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.photo-area__history-hint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
}

.photo-area__hint-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.photo-area__hint-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  flex: 1;
  min-width: 0;
}

/* --- */

@media (max-width: 767px) {
	.page-content .items-center { width: 100%; }
}

@media (min-width: 768px) {
	.page-content .settings-item { display: flex; flex-direction: row; }
}