/* ============================================================
   SMART GROCERY LIST — styles.css
   432.tools | Plus Jakarta Sans | Mobile-first, 480px max
   ============================================================ */

/* ---- CSS Custom Properties ---- */
:root {
  --bg: #F8F9FA;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-input: #FFFFFF;
  --bg-section: #F1F5F9;
  --text: #1A1A1A;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5E7EB;
  --border-focus: #16A34A;
  --primary: #16A34A;
  --primary-dark: #15803D;
  --primary-light: #DCFCE7;
  --primary-text: #FFFFFF;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --in-cart-bg: #F0FDF4;
  --in-cart-border: #22C55E;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-height: 60px;
  --bottom-bar-height: 72px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-card: #1E1E1E;
  --bg-card-hover: #2A2A2A;
  --bg-input: #2A2A2A;
  --bg-section: #1A1A1A;
  --text: #E0E0E0;
  --text-muted: #9CA3AF;
  --text-light: #6B7280;
  --border: #333333;
  --border-focus: #22C55E;
  --primary: #22C55E;
  --primary-dark: #16A34A;
  --primary-light: #052e16;
  --in-cart-bg: #052e16;
  --in-cart-border: #22C55E;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

/* ---- Status Banners (offline / syncing) ---- */
.status-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  font-family: var(--font);
  transition: transform 0.25s ease;
}
.offline-banner-bar {
  background: #374151;
  color: #F9FAFB;
}
.syncing-banner-bar {
  background: #16A34A;
  color: #fff;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
a { color: var(--primary); text-decoration: none; }

/* ---- App Container ---- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
}

/* ---- Screens ---- */
.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  background: var(--bg);
}

.screen.active {
  display: flex;
}

/* ---- Screen Headers ---- */
.screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.screen-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  text-align: center;
}

/* ---- Home Header ---- */
.home-header {
  justify-content: space-between;
  padding: 0 16px;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.home-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-icon { font-size: 22px; }

.app-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.home-header-actions {
  display: flex;
  gap: 4px;
}

/* ---- Icon Buttons ---- */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--bg-section);
  color: var(--text);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover, .btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-section);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover, .btn-secondary:active {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--bg-section); }

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

.btn-danger:hover { opacity: 0.9; }

.btn-full { width: 100%; }

.btn-small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-icon-text {
  gap: 6px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
  font-family: var(--font);
}

.btn-link:hover { opacity: 0.8; }

.btn-tour {
  position: fixed;
  bottom: 80px;
  right: 16px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

/* ---- Stats Bar ---- */
.stats-bar {
  background: var(--primary-light);
  padding: 8px 16px;
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
}

[data-theme="dark"] .stats-bar {
  color: var(--primary);
}

/* ---- Home Sections ---- */
.home-section {
  padding: 16px;
}

.home-bottom-pad { height: 80px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

/* ---- Active List Cards ---- */
.active-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.active-list-card:hover, .active-list-card:active {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--primary);
}

.active-list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.active-list-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.active-list-total {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.active-list-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}

.active-list-progress {
  margin-top: 8px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.active-list-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ---- Suggestions Grid ---- */
.suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.suggestion-chip:hover, .suggestion-chip:active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.suggestion-chip.overdue {
  border-color: var(--warning);
  background: var(--warning-light);
}

.suggestion-chip-add {
  width: 18px;
  height: 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.suggestion-chip.overdue .suggestion-chip-add {
  background: var(--warning);
}

/* ---- Recent History Cards ---- */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.history-card:hover, .history-card:active {
  box-shadow: var(--shadow);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.history-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.history-card-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.history-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* History expanded items */
.history-items-list {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: none;
}

.history-items-list.open { display: block; }

.history-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

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

.history-item-name { color: var(--text); }
.history-item-price { color: var(--text-muted); font-weight: 500; }

/* ---- Empty States ---- */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.empty-state.small {
  padding: 20px 16px;
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 12px;
}

/* ---- Forms ---- */
.screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  -webkit-overflow-scrolling: touch;
}

.form-group {
  margin-bottom: 16px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.optional {
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-light);
  margin-left: 4px;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-input::placeholder {
  color: var(--text-light);
}

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

.form-row {
  display: flex;
  gap: 12px;
}

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

.input-with-prefix {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
  transition: border-color var(--transition);
}

.input-with-prefix:focus-within {
  border-color: var(--border-focus);
}

.input-prefix {
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  height: 48px;
  display: flex;
  align-items: center;
  background: var(--bg-section);
  flex-shrink: 0;
}

.input-with-prefix .form-input {
  border: none;
  border-radius: 0;
  flex: 1;
}

.input-with-prefix .form-input:focus {
  border: none;
  outline: none;
}

.form-action-link {
  display: block;
  margin-top: 6px;
  font-size: 12px;
}

.form-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* ---- Autocomplete ---- */
.autocomplete-wrap { position: relative; }

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.autocomplete-item:hover, .autocomplete-item:active {
  background: var(--bg-section);
}

.autocomplete-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.autocomplete-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- Shopping List Screen ---- */
.list-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.list-header-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: var(--header-height);
}

.list-title-block {
  flex: 1;
  min-width: 0;
}

.list-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-store {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Budget Bar */
.budget-wrap {
  padding: 6px 16px 8px;
}

.budget-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.budget-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.budget-bar-fill.over-budget {
  background: var(--danger);
}

.budget-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
}

.budget-spent-label { color: var(--text); }
.budget-total-label { color: var(--text-muted); }

/* Running Total */
.running-total-bar {
  padding: 8px 16px 10px;
}

.total-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.running-total-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.running-total-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  flex: 1;
}

.items-count-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-section);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* Cart stats row — appears when items are swiped to cart */
.cart-stats-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 6px;
  background: var(--bg-section);
  border-radius: 8px;
  overflow: hidden;
}

.cart-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  gap: 2px;
}

.cart-stat-sep {
  width: 1px;
  height: 30px;
  background: var(--border);
  flex-shrink: 0;
}

.cart-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.cart-stat-amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.cart-stat-amount.over-budget-text {
  color: var(--danger);
}

/* ---- Organize Banner ---- */
.organize-banner {
  background: var(--warning-light);
  border-bottom: 1px solid var(--warning);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #92400E;
}

[data-theme="dark"] .organize-banner {
  background: #1c1300;
  color: var(--warning);
}

/* ---- List Scroll Area ---- */
.list-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--bottom-bar-height) + 8px);
  -webkit-overflow-scrolling: touch;
}

/* ---- List Groups ---- */
.list-group { padding: 8px 0; }

.list-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 6px 16px;
}

.in-cart-label { color: var(--primary); }

/* ---- Item Cards ---- */
.items-container { padding: 0 12px; }

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
  transition: box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
}

.item-card.in-cart {
  background: var(--in-cart-bg);
  border-color: transparent;
  border-left: 3px solid var(--in-cart-border);
  opacity: 0.8;
}

.item-card-inner {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: transform 0.15s ease;
  background: inherit;
  user-select: none;
}

/* Drag handle */
.drag-handle {
  display: none;
  padding: 4px;
  color: var(--text-light);
  cursor: grab;
  touch-action: none;
}

.drag-handle:active { cursor: grabbing; }

.organize-active .drag-handle {
  display: flex;
  align-items: center;
}

/* Item card content */
.item-card-info {
  flex: 1;
  min-width: 0;
}

.item-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-card.in-cart .item-card-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.item-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.item-category-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-section);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.item-notes-text {
  font-size: 11px;
  color: var(--text-light);
  font-style: italic;
  margin-top: 2px;
}

/* Item price block */
.item-card-price-block {
  text-align: right;
  flex-shrink: 0;
}

.item-card-subtotal {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.item-card-unit-price {
  font-size: 11px;
  color: var(--text-muted);
}

/* Swipe indicators */
.swipe-bg-right {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(to right, #16A34A, #22C55E);
  display: flex;
  align-items: center;
  padding-left: 20px;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
  border-radius: var(--radius);
}

.swipe-bg-left {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(to left, #DC2626, #EF4444);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 20px;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
  border-radius: var(--radius);
}

.swipe-icon {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* Sorting placeholder */
.sort-placeholder {
  height: 60px;
  background: var(--primary-light);
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

/* ---- List Bottom Bar ---- */
.list-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 12px;
  display: flex;
  gap: 8px;
  z-index: 50;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}

.list-bottom-bar .btn {
  flex: 1;
  font-size: 13px;
  padding: 0 10px;
}


/* ---- History Screen ---- */
.spending-summary-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 0;
}

.spending-summary-item {
  flex: 1;
  text-align: center;
}

.spending-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

.spending-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.spending-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

/* ---- Settings ---- */
.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.settings-section-title {
  padding: 12px 16px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.settings-row-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.settings-list { padding: 0 0 8px; }

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}

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

.settings-list-item .delete-btn {
  color: var(--danger);
  font-size: 18px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
}

.settings-list-item .delete-btn:hover {
  background: var(--danger-light);
}

.settings-section .btn-full {
  margin: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  height: 48px;
}

.settings-about {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 28px;
  transition: background 0.2s;
}

.toggle-track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 4px;
  top: 4px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-track::before {
  transform: translateX(20px);
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  padding: 0;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px 32px;
  animation: slideUp 0.25s ease;
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.modal p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal p strong {
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions .btn { flex: 1; }

.modal-dismiss {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 12px;
}

/* Price comparison */
.price-comparison {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
}

.price-comp-item { flex: 1; }
.price-comp-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.price-comp-value { font-size: 18px; font-weight: 700; color: var(--text); display: block; margin-top: 2px; }
.price-comp-value.accent { color: var(--primary); }
.price-arrow { font-size: 18px; color: var(--text-muted); }

/* Done summary */
.done-summary {
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 4px;
}

.done-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.done-summary-row:last-child { border-bottom: none; }
.done-summary-row strong { color: var(--text); font-weight: 700; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-bar-height) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: #1A1A1A;
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}

[data-theme="dark"] .toast {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

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

/* ============================================================
   SPOTLIGHT TOUR
   Real app tour — highlights actual UI elements, navigates
   to real screens. No fake panels.
   ============================================================ */

/* Backdrop — blocks interaction with app below */
.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 990;
  /* Clicks are blocked here so user must use Next/Skip */
  pointer-events: all;
}

/* Spotlight — sits over the target element.
   The giant box-shadow dims everything outside the cutout. */
.tour-spotlight {
  position: fixed;
  z-index: 991;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.72);
  pointer-events: none;
  transition:
    left   0.38s cubic-bezier(0.4, 0, 0.2, 1),
    top    0.38s cubic-bezier(0.4, 0, 0.2, 1),
    width  0.38s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease;
  outline: 2px solid rgba(255,255,255,0.15);
  outline-offset: 1px;
}

/* Tooltip card */
.tour-tooltip {
  position: fixed;
  z-index: 995;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 18px 20px 16px;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.35),
    0 4px 16px rgba(0,0,0,0.15);
  max-width: 300px;
  width: calc(100vw - 32px);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: all;
  border: 1px solid var(--border);
}

/* Step counter: "3 / 12" */
.tour-step-counter {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.tour-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.3;
}

.tour-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 16px;
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tour-skip-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.8;
}
.tour-skip-btn:hover { opacity: 1; }

.tour-next-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  margin-left: auto;
}
.tour-next-btn:hover { background: var(--primary-dark); }
.tour-next-btn:active { transform: scale(0.97); }

/* Arrow indicator pointing from tooltip → highlighted element */
.tour-arrow-indicator {
  width: 0;
  height: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.tour-arrow-indicator.arrow-up {
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid var(--bg-card);
  top: -9px;
  filter: drop-shadow(0 -2px 2px rgba(0,0,0,0.08));
}

.tour-arrow-indicator.arrow-down {
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid var(--bg-card);
  bottom: -9px;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.08));
}

/* ---- Suggestions subtitle (algorithm insight line) ---- */
.suggestions-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 0 10px;
  font-style: italic;
}

/* ---- Utility ---- */
.text-muted { color: var(--text-muted); font-size: 13px; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---- Algorithm Status Bar (suggestions section header) ---- */
.algo-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.algo-status-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.algo-pill-gray   { background: var(--bg-section); color: var(--text-muted); }
.algo-pill-orange { background: #FEF3C7; color: #92400E; }
.algo-pill-yellow { background: #FFFBEB; color: #B45309; }
.algo-pill-blue   { background: #EFF6FF; color: #1D4ED8; }
.algo-pill-green  { background: var(--primary-light); color: var(--primary-dark); }

[data-theme="dark"] .algo-pill-orange { background: #451A03; color: #FCD34D; }
[data-theme="dark"] .algo-pill-yellow { background: #422006; color: #FDE68A; }
[data-theme="dark"] .algo-pill-blue   { background: #1E3A5F; color: #93C5FD; }

.algo-status-msg {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---- Algorithm Brain Panel (settings) ---- */
#algo-brain-panel {
  padding: 0 16px 14px;
}

.algo-brain-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.algo-brain-dot { color: var(--text-light); }

.algo-brain-table-head {
  display: grid;
  grid-template-columns: 1fr 36px 56px 80px;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.algo-brain-row {
  display: grid;
  grid-template-columns: 1fr 36px 56px 80px;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}

.algo-brain-name     { font-weight: 500; }
.algo-brain-trips    { color: var(--text-muted); font-size: 12px; text-align: center; }
.algo-brain-interval { color: var(--text-muted); font-size: 12px; }
.algo-brain-status   { font-size: 12px; font-weight: 600; }

.brain-status-learning { color: var(--text-muted); font-weight: 400; }
.brain-status-due      { color: var(--primary); }
.brain-status-overdue  { color: var(--warning); }
.brain-status-ok       { color: var(--text-muted); }

.algo-brain-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
  text-align: center;
}

/* ---- Responsive: Desktop centering ---- */
@media (min-width: 481px) {
  .app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-height: 100dvh;
  }

  .list-bottom-bar,
  .modal,
  .toast {
    max-width: 480px;
  }
}
