/* ═══════════════════════════════════════════════════════════════
   KOURSLY — Complete Design System
   Based on specifications v1.0
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ── */
:root {
  /* Brand */
  --color-brand-primary: #22A447;
  --color-brand-primary-dark: #08783E;
  
  /* Surfaces */
  --color-background: #F8FCF5;
  --color-surface: #FFFFFF;
  --color-surface-green: #EDF8E7;
  --color-surface-checked: #F1FAF2;
  
  /* Text */
  --color-text-primary: #173B29;
  --color-text-secondary: #6B776E;
  --color-text-tertiary: #8F9992;
  --color-text-checked: #748078;
  /* Borders */
  --color-border: #DDE8D8;
  --color-border-card: #E3ECE0;
  --color-border-checked: #BFE7C5;
  
  /* Semantic */
  --color-success: #22A447;
  --color-error: #D93838;
  --color-error-bg: #FDEAEA;
  --color-warning: #E99B19;
  
  /* Shadows */
  --shadow-card: 0 4px 14px rgba(23, 59, 41, 0.07);
  --shadow-modal: 0 -8px 32px rgba(23, 59, 41, 0.12);
  --shadow-input-focus: 0 0 0 4px rgba(34, 164, 71, 0.15);
  
  /* Radius */
  --radius-small: 10px;
  --radius-medium: 16px;
  --radius-large: 20px;
  --radius-modal: 30px;
  --radius-pill: 9999px;
  
  /* Spacing (4-pt grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  
  /* Typography */
  --font-sans: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-bounce: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── 2. Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--color-background);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

/* ── 3. App Shell ── */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--color-background);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Screen container */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-8);
  scrollbar-width: none;
}

.screen.active {
  display: flex;
}

.screen::-webkit-scrollbar {
  display: none;
}


/* ── 4. Header ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
  background: var(--color-surface);
  min-height: 88px;
  gap: var(--space-3);
}

.header-title {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.header-logo {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--radius-small);
  object-fit: contain;
}

.header-wordmark {
  height: 26px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}




/* ── 5. List Controls ── */
.list-header {
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 60px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  padding: 0 var(--space-3) 0 var(--space-4);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper:focus-within {
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-input-focus);
}

.input-wrapper input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--color-text-primary);
  outline: none;
  height: 100%;
}

.input-wrapper input::placeholder {
  color: var(--color-text-tertiary);
}

.add-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-medium);
  background: linear-gradient(135deg, #35B84F 0%, #22A447 55%, #08783E 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(34, 164, 71, 0.3);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.add-btn svg {
  width: 24px;
  height: 24px;
  color: white;
}

/* Category filter bar */
.category-filter-bar {
  display: flex;
  padding: var(--space-2) var(--space-5) var(--space-3);
  background: var(--color-surface);
}

.category-filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}

.category-filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  scroll-snap-align: start;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
}

.filter-pill.active {
  background: var(--color-brand-primary);
  color: white;
  border-color: var(--color-brand-primary);
  box-shadow: 0 2px 8px rgba(34, 164, 71, 0.25);
}

.filter-pill:active {
  transform: scale(0.96);
}





/* ── 6. Category Headers ── */
.category-section {
  padding: 0;
  margin-bottom: var(--space-3);
}

.category-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 44px;
  background: var(--color-surface-green);
  border-radius: var(--radius-medium);
  padding: 0 var(--space-5);
  margin-bottom: var(--space-3);
  position: relative;
  overflow: hidden;
}

.category-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--color-brand-primary);
  border-radius: var(--radius-medium) 0 0 var(--radius-medium);
}

.category-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(34, 164, 71, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.category-icon svg {
  width: 14px;
  height: 14px;
  color: var(--color-brand-primary);
}

.category-icon img {
  max-height: 16px;
  width: auto;
  max-width: 20px;
  object-fit: contain;
  display: block;
}

.category-name {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-brand-primary-dark);
}




























/* ── 9. Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 72px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-tertiary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  transition: color var(--transition-fast);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  margin-bottom: var(--space-1);
  color: var(--color-text-tertiary);
  transition: color var(--transition-fast);
}

.nav-item.active {
  color: var(--color-brand-primary);
}

.nav-item.active svg {
  color: var(--color-brand-primary);
}

/* ── 10. Floating Action ── */
.clear-fab {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  margin: var(--space-4) auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-fast);
  width: fit-content;
}


.clear-fab.visible {
  display: inline-flex;
}

.clear-fab:active {
  transform: scale(0.98);
}

.clear-fab svg {
  width: 18px;
  height: 18px;
  color: var(--color-error);
}

/* ── 11. Modals ── */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding-top: 60px;
}

.modal.visible {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
}

.modal-content {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 60px);
  background: var(--color-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 250ms ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

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

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-close:active {
  background: var(--color-border);
}

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

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

.modal-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.modal-footer-spacer {
  flex: 1;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary,
.modal-footer .btn-danger {
  height: 44px;
  padding: 0 12px;
  font-size: 14px;
  min-width: 0;
}

.modal-footer .btn-danger {
  flex: 0 0 auto;
}

.modal-footer .btn-secondary {
  flex: 0 0 auto;
}

.modal-footer .btn-primary {
  flex: 1;
  padding-left: 5px;
  padding-right: 5px;
}

.modal-footer {
  gap: 6px;
  padding: var(--space-3) var(--space-4);
  justify-content: space-between;
}

.photo-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-body {
  padding: var(--space-5);
}

.detail-footer {
  display: flex;
  gap: 12px;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.detail-footer .btn-primary,
.detail-footer .btn-secondary {
  flex: 1;
}

.catalog-header {
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.scan-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #000;
  overflow: hidden;
}

.barcode-frame {
  width: 240px;
  height: 240px;
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-large);
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scan-hint {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  margin-top: var(--space-4);
  text-align: center;
}

.scan-actions {
  padding: var(--space-4) var(--space-5);
  display: flex;
  gap: 12px;
}




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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-3);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 2;
}

.modal-header h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.modal-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface-green);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.modal-close:active {
  background: #D8F0D0;
}

.modal-close svg {
  width: 20px;
  height: 20px;
  color: var(--color-text-primary);
}



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








.stepper-value::-webkit-outer-spin-button,





/* ── 14. Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 var(--space-6);
  background: linear-gradient(135deg, #35B84F 0%, #22A447 55%, #08783E 100%);
  color: white;
  border: none;
  border-radius: var(--radius-medium);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 12px rgba(34, 164, 71, 0.3);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(34, 164, 71, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 var(--space-6);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-secondary:active {
  background: var(--color-surface-green);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 var(--space-6);
  background: var(--color-error-bg);
  color: var(--color-error);
  border: none;
  border-radius: var(--radius-medium);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-danger:active {
  background: #F8DADA;
}

/* ── 15. Empty States ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--color-text-secondary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--color-border);
}

.empty-state p {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-primary);
}

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

/* ── 16. Snackbar ── */
.snackbar {
  position: fixed;
  bottom: calc(72px + var(--space-4));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: var(--space-3) var(--space-5);
  background: var(--color-text-primary);
  color: white;
  border-radius: var(--radius-medium);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(23, 59, 41, 0.2);
  z-index: 300;
  opacity: 0;
  transition: all 300ms ease;
  pointer-events: none;
  white-space: nowrap;
}

.snackbar.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── 17. Animations ── */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes checkBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}












/* ── 19. Login Screen ── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--color-background);
  z-index: 1000;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.login-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-container.hidden {
  display: none !important;
}

.login-box {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.login-logo {
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-2);
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-wordmark {
  width: 200px;
  height: auto;
  margin-bottom: var(--space-2);
}

.login-box h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}


.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.login-input {
  width: 100%;
  height: 56px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-input:focus {
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-input-focus);
}

.login-input::placeholder {
  color: var(--color-text-tertiary);
}

.login-btn {
  width: 100%;
  height: 56px;
  background: linear-gradient(135deg, #35B84F 0%, #22A447 55%, #08783E 100%);
  color: white;
  border: none;
  border-radius: var(--radius-medium);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(34, 164, 71, 0.3);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

/* ── 20. Responsive ── */
@media (min-width: 481px) {
  body {
    padding: 24px;
    background: linear-gradient(180deg, #F8FCF5 0%, #EDF8E7 100%);
  }
  
  .app-container {
    min-height: auto;
    height: calc(100vh - 48px);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-card);
    overflow: hidden;
  }
  
  .bottom-nav {
    position: absolute;
    border-radius: 0 0 var(--radius-large) var(--radius-large);
  }
}

@media (max-width: 480px) {
  .app-container {
    border-radius: 0;
  }
}

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

/* Dark mode placeholder — to be implemented separately */
@media (prefers-color-scheme: dark) {
  /* Future dark mode implementation */
}


/* ── 21. Component Styles ── */

/* Item card */
.item {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 56px;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border-card);
  border-radius: 14px;
  margin-bottom: 6px;
  box-shadow: 0 1px 3px rgba(23, 59, 41, 0.04);
  transition: transform 100ms ease, background 200ms ease, box-shadow 150ms ease;
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.item:active {
  transform: scale(0.99);
  background: #F5F9F2;
  box-shadow: 0 1px 2px rgba(23, 59, 41, 0.06);
}

/* Checked state */
.item.done {
  background: var(--color-surface-checked);
  border-color: var(--color-border-checked);
}

.item.done .check-circle {
  background: var(--color-success);
  border-color: var(--color-success);
}

.item.done .check-circle svg {
  opacity: 1;
  transform: scale(1);
}

.item.done .item-name {
  text-decoration: line-through;
  color: var(--color-text-checked);
}

/* Item surface for swipe — default row (catalog) */
.item-surface {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 100%;
  padding: 8px 12px;
  background: var(--color-surface);
  position: relative;
  z-index: 1;
  transition: transform 200ms ease;
  touch-action: pan-y;
  cursor: pointer;
}
/* List items: column layout for expandable content */
.list-item .item-surface {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
}

/* Item name */
.item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-name-and-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.item-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--color-surface-green);
  color: var(--color-brand-primary-dark);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

/* Edit button */
.item-edit-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  margin-left: auto;
}

.item-edit-btn:active {
  background: var(--color-surface-green);
  color: var(--color-brand-primary);
}

/* Old .item-add-btn */
.item-add-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-medium);
  background: var(--color-brand-primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
  color: white;
}

.item-add-btn:active {
  background: var(--color-brand-primary-dark);
}

/* Profile icon button (old name) */
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-surface-green);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease;
  color: var(--color-text-primary);
}

.icon-btn:active {
  background: #D8F0D0;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

/* Autocomplete */
.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  font-size: 15px;
  color: var(--color-text-primary);
}

.autocomplete-item:hover {
  background: var(--color-surface-green);
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  margin-top: 8px;
  box-shadow: var(--shadow-card);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
}

/* List and catalog containers */
.list-container, .catalog-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px;
  padding-bottom: 32px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox: hide scrollbar */
  -ms-overflow-style: none; /* IE/Edge: hide scrollbar */
}

/* Chrome/Safari: hide scrollbar */
.list-container::-webkit-scrollbar,
.catalog-container::-webkit-scrollbar {
  display: none;
}

.catalog-container {
  padding-top: 8px;
}

/* Input wrappers */
.list-input-wrapper, .catalog-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Main input fields (list + catalog search bars) */
#itemInput, #catalogSearchInput {
  flex: 1;
  height: 52px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
#itemInput:focus, #catalogSearchInput:focus {
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-input-focus);
}
#itemInput::placeholder, #catalogSearchInput::placeholder {
  color: var(--color-text-tertiary);
}

/* Barcode */
.barcode-input-wrapper {
  display: flex;
  gap: 8px;
}

.barcode-input-wrapper input {
  flex: 1;
}

.scan-small-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-medium);
  background: var(--color-surface-green);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.scan-small-btn svg {
  width: 20px;
  height: 20px;
  color: var(--color-text-primary);
}

/* Scanned barcode */
.scanned-barcode {
  padding: 12px 16px;
  background: var(--color-surface-green);
  border-radius: var(--radius-medium);
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--color-text-primary);
  text-align: center;
}

/* Detail modal */
.detail-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 16px;
  color: var(--color-text-primary);
}

.detail-photo-container {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: var(--radius-large);
  margin-bottom: 16px;
}

.detail-photo {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Photo section */
.photo-hero-preview {
  width: 100%;
  max-height: 200px;
  overflow: hidden;
  border-radius: var(--radius-large);
  margin-bottom: 16px;
  text-align: center;
}

.photo-hero-preview img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-large);
}

.photo-choices {
  display: flex;
  gap: 12px;
}

.btn-photo-choice {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-medium);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-photo-choice:active {
  background: var(--color-surface-green);
}

.btn-upload-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-upload-choice input {
  display: none;
}

/* Form row */
.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* Catalog thumb */
.catalog-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-surface-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.catalog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-thumb svg {
  width: 20px;
  height: 20px;
  color: var(--color-brand-primary);
}

/* Swipe background */
.swipe-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 20px;
  background: var(--color-error);
  border-radius: var(--radius-large);
}

.swipe-bg svg {
  width: 24px;
  height: 24px;
  color: white;
}

/* ── 22. Quick Add Modal ── */
.quick-add-modal {
  max-height: 70vh;
}

.quick-add-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-add-list::-webkit-scrollbar {
  display: none;
}

.quick-add-category {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  background: var(--color-surface-green);
  border-radius: var(--radius-medium);
  padding: 0 16px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-brand-primary-dark);
  position: relative;
  overflow: hidden;
}

.quick-add-category::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-brand-primary);
  border-radius: var(--radius-medium) 0 0 var(--radius-medium);
}

.quick-add-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-medium);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 150ms ease;
}

.quick-add-item:active {
  transform: scale(0.99);
  background: var(--color-surface-green);
  border-color: var(--color-brand-primary);
}

.quick-add-item svg {
  width: 20px;
  height: 20px;
  color: var(--color-brand-primary);
  flex-shrink: 0;
}

.quick-add-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Missing styles added (class fixes) ── */

/* Swipe-to-delete background */
.item-delete-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 20px;
  background: var(--color-error);
  border-radius: var(--radius-large);
}
.item-delete-bg svg {
  width: 24px;
  height: 24px;
  color: white;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

/* Edit icon button in list items */
.edit-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
  transition: background var(--transition-fast);
}
.edit-btn:active {
  background: var(--color-surface-green);
}
.edit-btn svg {
  width: 16px;
  height: 16px;
  color: var(--color-text-tertiary);
}

/* Quantity badge */
.qty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-brand-primary);
  color: white;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Catalog item structure */
.item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.item-details {
  font-size: 13px;
  color: var(--color-text-secondary);
  display: flex;
  gap: 8px;
}

/* Expandable item details */
.item-expand {
  overflow: hidden;
  max-height: 0;
  transition: max-height 200ms ease;
}
.item.expanded .item-expand {
  max-height: 300px;
  padding: 8px 0 4px;
}
.expand-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px;
}
.expand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-secondary);
}
.expand-row svg {
  width: 16px;
  height: 16px;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}
.expand-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  padding: 4px 0;
}
.expand-photo {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: var(--radius-medium);
  margin-top: 8px;
}

/* Add-to-list + button in catalog items */
.add-to-list-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-small);
  background: linear-gradient(135deg, #35B84F 0%, #22A447 55%, #08783E 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.add-to-list-btn:active {
  transform: scale(0.95);
}
.add-to-list-btn svg {
  width: 18px;
  height: 18px;
  color: white;
}

.category-section-bordered {
  margin-top: var(--space-4);
}

/* Login error + shake */
.error-msg {
  color: var(--color-error);
  font-size: 14px;
  font-weight: 600;
  min-height: 20px;
}
.shake {
  animation: shake 300ms ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Form inputs incl. select & textarea */
.form-input,
select.form-input,
textarea.form-input {
  width: 100%;
  height: 52px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--color-text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
textarea.form-input {
  height: auto;
  min-height: 60px;
  padding-top: 12px;
  resize: vertical;
}
.form-input:focus {
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-input-focus);
}
.form-input::placeholder {
  color: var(--color-text-tertiary);
}

/* User menu dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-card);
  min-width: 160px;
  padding: 8px;
  display: none;
  z-index: 150;
}
.dropdown.active {
  display: block;
}
.dropdown button {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--color-text-primary);
  cursor: pointer;
  border-radius: var(--radius-small);
  transition: background var(--transition-fast);
}
.dropdown button:active {
  background: var(--color-surface-green);
}

/* Item animations */
.item {
  animation: slideInUp 200ms ease-out;
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.item.removing {
  animation: slideOutRight 250ms ease-in forwards;
}
@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(100%); }
}
.check-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--color-surface);
  transition: all var(--transition-bounce);
}

.check-circle svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0);
  transition: all 150ms ease-out;
  stroke: white;
}

.item.done .check-circle {
  background: var(--color-success);
  border-color: var(--color-success);
}

.item.done .check-circle svg {
  opacity: 1;
  transform: scale(1);
  animation: checkBounce 200ms ease-out;
}

.nav-item:active,
.check-circle:active {
  transform: scale(0.96);
}
.item.swiping .item-surface {
  transition: none;
}
.item.swiped .item-delete-bg svg {
  opacity: 1;
}

/* Offline banner */
.offline-banner {
  display: none;
  background: var(--color-warning);
  color: white;
  padding: var(--space-2) var(--space-5);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 99;
}
.offline-banner.visible {
  display: block;
}

/* Confirm modal */
.confirm-modal .modal-body {
  text-align: center;
  padding: var(--space-6) var(--space-5);
}
.confirm-modal p {
  font-size: 16px;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
}

/* Full-width photo button */
.btn-photo-full {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed #99CC8C;
  border-radius: var(--radius-medium);
  background: var(--color-surface-green);
  color: var(--color-brand-primary-dark);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.btn-photo-full:active {
  border-color: var(--color-brand-primary);
}
.btn-photo-full svg {
  width: 22px;
  height: 22px;
  color: var(--color-brand-primary);
}

/* Install PWA Banner */
#installBanner {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  padding: 16px;
  z-index: 9000;
  display: none;
  align-items: center;
  gap: 12px;
}
#installBanner img { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; }
#installBanner .install-text { flex: 1; }
#installBanner .install-title { font-family: var(--font-sans); font-weight: 700; font-size: 15px; color: #1A1A1A; }
#installBanner .install-sub { font-family: var(--font-sans); font-size: 13px; color: #666; }
#installBtn { background: var(--color-brand-primary); color: #fff; border: none; border-radius: 10px; padding: 8px 16px; font-family: var(--font-sans); font-weight: 700; font-size: 14px; cursor: pointer; flex-shrink: 0; }
#installDismiss { background: none; border: none; color: #999; font-size: 20px; cursor: pointer; padding: 0 4px; flex-shrink: 0; }

/* Misc display utilities */
.hidden { display: none !important; }
.margin-bottom-16 { margin-bottom: 16px; }
.no-border { border: none; padding: 0; }
.category-badge { background: var(--color-surface-green); color: var(--color-brand-primary-dark); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); }

.gallery-btn {
  background: var(--color-surface-green);
  color: var(--color-brand-primary-dark);
  border: 1px solid var(--color-border);
}
