:root {
  --primary: #1976D2;
  --primary-dark: #1565C0;
  --primary-light: #BBDEFB;
  --bg: #F4F6F9;
  --bg2: #FFFFFF;
  --bg3: #EDF1F6;
  --card: #FFFFFF;
  --card2: #F8FAFC;
  --border: #E2E8F0;
  --text: #1E293B;
  --text2: #64748B;
  --text3: #94A3B8;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --nav-height: 64px;
  --header-height: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

#app { height: 100%; display: flex; flex-direction: column; }

.screen { height: 100%; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.screen.active { display: flex; }

/* Auth */
.auth-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}
.auth-logo { text-align: center; margin-bottom: 36px; }
.logo-icon { font-size: 56px; margin-bottom: 8px; color: var(--primary); line-height: 1; }
.logo-icon i { font-size: inherit; }
.auth-logo h1 { font-size: 32px; font-weight: 700; color: var(--primary); }
.auth-logo p { color: var(--text2); margin-top: 4px; }
.auth-tabs {
  display: flex;
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text2);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active { background: var(--primary); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form.hidden { display: none; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 14px; font-weight: 500; color: var(--text2); }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  width: 100%;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-error { color: var(--danger); font-size: 14px; padding: 8px 12px; background: rgba(239,68,68,0.08); border-radius: var(--radius-sm); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  min-height: 44px;
  white-space: nowrap;
}
.btn i { font-size: 17px; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1.5px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }
.btn-sm i { font-size: 15px; }
.btn-icon { padding: 10px; min-width: 44px; min-height: 44px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.icon-btn i { font-size: 22px; }
.icon-btn:hover { background: var(--bg3); }

/* Header */
.app-header {
  height: var(--header-height);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-right { display: flex; align-items: center; gap: 8px; }
#page-title { font-size: 18px; font-weight: 600; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.notif-icon { font-size: 22px; }
.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
#notif-btn { position: relative; }

/* Main content */
#page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + 16px);
}

/* Bottom nav */
.bottom-nav {
  height: var(--nav-height);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 8px 4px;
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  transition: color 0.15s;
  min-height: var(--nav-height);
}
.nav-btn.active { color: var(--primary); }
.nav-btn i.nav-icon { font-size: 24px; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 16px; }

/* Dashboard */
.dashboard { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }
.stat-diff { font-size: 12px; margin-top: 4px; }
.stat-diff.up { color: var(--danger); }
.stat-diff.down { color: var(--primary); }

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title a { font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 500; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  box-shadow: var(--shadow);
}
.quick-btn:active { background: var(--bg3); }
.quick-btn i { font-size: 22px; color: var(--primary); }

.trend-chart {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow);
}
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 80px; }
.chart-bar {
  flex: 1;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  opacity: 0.6;
  min-height: 4px;
  transition: opacity 0.2s;
  position: relative;
}
.chart-bar:hover { opacity: 1; }
.chart-labels { display: flex; gap: 6px; margin-top: 6px; }
.chart-label { flex: 1; text-align: center; font-size: 9px; color: var(--text3); }

/* Lists page */
.page { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.list-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.list-card:active { transform: scale(0.99); }
.list-card.completed { opacity: 0.6; }
.list-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.list-card-name { font-size: 17px; font-weight: 600; }
.list-status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px;
  font-weight: 600;
  flex-shrink: 0;
}
.status-active { background: rgba(25,118,210,0.1); color: var(--primary); }
.status-shopping { background: rgba(245,158,11,0.12); color: var(--warning); }
.status-completed { background: rgba(100,116,139,0.1); color: var(--text3); }
.list-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text2);
}
.list-progress { margin-top: 10px; }
.progress-bar-track { height: 4px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width 0.3s; }
.progress-text { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* List detail */
.list-detail { display: flex; flex-direction: column; height: 100%; }
.list-detail-header { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.list-actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.store-group { margin-bottom: 0; }
.store-group-title {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  background: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.items-list { padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  touch-action: pan-y;
  position: relative;
  transition: background 0.15s;
  min-height: 56px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.item-row.checked { opacity: 0.5; }
.item-row.checked .item-name { text-decoration: line-through; color: var(--text3); }
.item-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  background: transparent;
}
.item-row.checked .item-checkbox { background: var(--primary); border-color: var(--primary); }
.item-checkbox-tick { color: #fff; font-size: 14px; opacity: 0; display: flex; align-items: center; }
.item-checkbox-tick i { font-size: 14px; }
.item-row.checked .item-checkbox-tick { opacity: 1; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 12px; color: var(--text2); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.item-qty { font-size: 13px; color: var(--text2); flex-shrink: 0; }
.item-price { font-size: 14px; font-weight: 600; color: var(--primary); flex-shrink: 0; }
.item-drag-handle {
  color: var(--text3);
  cursor: grab;
  padding: 0 2px;
  touch-action: none;
  display: flex;
  align-items: center;
}
.item-drag-handle i { font-size: 20px; }

.swipe-delete-bg {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  pointer-events: none;
}
.swipe-delete-bg i { font-size: 22px; }

.add-item-bar {
  position: sticky;
  bottom: calc(var(--nav-height) + 8px);
  left: 0;
  right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.add-item-input {
  flex: 1;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
  font-family: inherit;
}
.add-item-input:focus { border-color: var(--primary); }

/* Total bar */
.total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.total-amount { font-size: 18px; font-weight: 700; color: var(--primary); }

/* Recipes */
.recipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.1s;
  box-shadow: var(--shadow);
}
.recipe-card:active { transform: scale(0.99); }
.recipe-card-name { font-size: 17px; font-weight: 600; }
.recipe-card-meta { font-size: 13px; color: var(--text2); margin-top: 6px; display: flex; gap: 14px; align-items: center; }
.recipe-card-meta i { font-size: 15px; color: var(--primary); vertical-align: middle; }
.ingredient-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ingredient-row:last-child { border-bottom: none; }
.ingredient-name { flex: 1; font-size: 14px; }
.ingredient-qty { font-size: 13px; color: var(--text2); }
.ingredient-price { font-size: 13px; color: var(--primary); font-weight: 600; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  padding: 0;
  animation: fadeIn 0.15s;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg2);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; gap: 10px; padding-top: 8px; }
.modal-actions .btn { flex: 1; }

/* Toast */
#toast-container { position: fixed; top: 70px; right: 16px; left: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: slideDown 0.2s;
  pointer-events: auto;
}
.toast i { font-size: 18px; }
.toast.success { border-left: 3px solid var(--primary); }
.toast.success i { color: var(--primary); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.error i { color: var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast.info i { color: var(--info); }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Meals */
.meal-grid { display: grid; gap: 10px; }
.meal-day-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.meal-day-header {
  padding: 10px 14px;
  background: var(--bg3);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.meal-slots { padding: 8px 14px; display: flex; flex-direction: column; gap: 6px; }
.meal-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  min-height: 40px;
}
.meal-slot:last-child { border-bottom: none; }
.meal-slot-type { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; width: 60px; flex-shrink: 0; font-weight: 600; }
.meal-slot-name { font-size: 14px; flex: 1; }
.meal-slot-empty { color: var(--text3); font-style: italic; }
.meal-slot-clear { color: var(--text3); display: flex; align-items: center; cursor: pointer; padding: 4px; }
.meal-slot-clear i { font-size: 18px; }

/* Spending history */
.history-item { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.history-item:last-child { border-bottom: none; }
.history-icon { display: flex; align-items: center; color: var(--primary); }
.history-icon i { font-size: 22px; }
.history-info { flex: 1; }
.history-name { font-size: 14px; font-weight: 500; }
.history-date { font-size: 12px; color: var(--text2); margin-top: 2px; }
.history-total { font-size: 15px; font-weight: 700; color: var(--primary); }

/* Store color tags */
.store-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.store-tesco { background: rgba(0,82,152,0.1); color: #005298; }
.store-aldi { background: rgba(0,100,55,0.1); color: #006437; }
.store-lidl { background: rgba(0,83,154,0.1); color: #00539a; }
.store-asda { background: rgba(0,153,0,0.1); color: #007a00; }
.store-sainsburys { background: rgba(230,0,0,0.1); color: #cc0000; }
.store-morrisons { background: rgba(0,75,135,0.1); color: #004b87; }
.store-default { background: rgba(100,116,139,0.1); color: var(--text2); }

/* Notifications panel */
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}
.notif-item.unread { background: rgba(25,118,210,0.04); }
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.notif-dot.read { opacity: 0; }
.notif-text { font-size: 14px; flex: 1; }
.notif-time { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* Profile */
.profile-page { padding: 24px 16px; display: flex; flex-direction: column; gap: 16px; }
.profile-header { text-align: center; padding: 16px 0; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; font-size: 28px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.profile-name { font-size: 20px; font-weight: 600; }
.profile-email { font-size: 14px; color: var(--text2); margin-top: 4px; }

.settings-list { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.settings-item:hover { background: var(--bg3); }
.settings-item:last-child { border-bottom: none; }
.settings-item-left { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.settings-item-icon { font-size: 20px; width: 28px; color: var(--primary); display: flex; align-items: center; }
.settings-item-icon i { font-size: 20px; }
.settings-item-arrow { color: var(--text3); display: flex; align-items: center; }
.settings-item-arrow i { font-size: 20px; }

/* Empty states */
.empty-state { text-align: center; padding: 40px 24px; color: var(--text2); }
.empty-icon { font-size: 48px; margin-bottom: 12px; color: var(--text3); opacity: 0.5; }
.empty-icon i { font-size: 48px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-desc { font-size: 14px; line-height: 1.6; }

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(25,118,210,0.35);
  z-index: 20;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab i { font-size: 28px; }
.fab:active { transform: scale(0.92); box-shadow: 0 2px 10px rgba(25,118,210,0.25); }

/* Recipe selector in list */
.recipe-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.recipe-select-item:last-child { border-bottom: none; }
.recipe-select-check {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  color: transparent;
}
.recipe-select-check.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.recipe-select-check i { font-size: 15px; }

/* Inline form */
.inline-form { display: flex; flex-direction: column; gap: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row .form-group { margin: 0; }

/* Item library */
.item-library-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.item-library-row:last-child { border-bottom: none; }
.item-library-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  color: transparent;
}
.item-library-check.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.item-library-check i { font-size: 13px; }
.item-library-name { flex: 1; font-size: 15px; }
.item-library-meta { font-size: 12px; color: var(--text2); }

/* Misc */
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.text-center { text-align: center; }
.text-muted { color: var(--text2); }
.text-sm { font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }

/* Scroll snap for list cards */
.list-items-scroll { overflow-x: auto; display: flex; gap: 12px; padding: 4px 2px; scrollbar-width: none; }
.list-items-scroll::-webkit-scrollbar { display: none; }

/* Loading state */
.loading { display: flex; align-items: center; justify-content: center; padding: 32px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive: tablet and up */
@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .modal { border-radius: var(--radius); max-width: 500px; margin: auto; border: 1px solid var(--border); }
  .modal-overlay { align-items: center; padding: 20px; }
  .page, .dashboard { max-width: 640px; margin: 0 auto; }
}
@media (min-width: 1024px) {
  .page, .dashboard { max-width: 720px; }
  .form-row { grid-template-columns: 1fr 1fr 1fr; }
}
