/* ==========================================
   MERCADOSMART - ESTILOS PRINCIPAIS
   ========================================== */

/* ---- VARIÁVEIS DE TEMA ---- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #1e2a45;
  --bg-nav: #12121f;
  --border: #2a3a5c;
  --text-primary: #e8eaf6;
  --text-secondary: #9ba4c7;
  --text-muted: #5c6a8a;
  --accent-green: #00e676;
  --accent-green-bg: rgba(0,230,118,0.12);
  --accent-blue: #4fc3f7;
  --accent-blue-bg: rgba(79,195,247,0.12);
  --accent-orange: #ffb74d;
  --accent-orange-bg: rgba(255,183,77,0.12);
  --accent-purple: #ce93d8;
  --accent-purple-bg: rgba(206,147,216,0.12);
  --accent-red: #ef5350;
  --accent-red-bg: rgba(239,83,80,0.12);
  --header-h: 56px;
  --nav-h: 68px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f5f7fa;
  --bg-nav: #ffffff;
  --border: #e0e7ef;
  --text-primary: #1a2340;
  --text-secondary: #5c6a8a;
  --text-muted: #9ba4c7;
  --accent-green: #00b248;
  --accent-green-bg: rgba(0,178,72,0.1);
  --accent-blue: #1976d2;
  --accent-blue-bg: rgba(25,118,210,0.1);
  --accent-orange: #f57c00;
  --accent-orange-bg: rgba(245,124,0,0.1);
  --accent-purple: #7b1fa2;
  --accent-purple-bg: rgba(123,31,162,0.1);
  --accent-red: #d32f2f;
  --accent-red-bg: rgba(211,47,47,0.1);
  --shadow: 0 4px 24px rgba(0,0,0,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

/* ---- RESET E BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { cursor: pointer; border: none; outline: none; background: none; }
input, select, textarea { outline: none; color: var(--text-primary); }

/* ---- SPLASH SCREEN ---- */
.splash-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #0d1b3e 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease;
}
.splash-content { text-align: center; }
.splash-logo { font-size: 72px; display: block; animation: bounce 0.8s ease infinite alternate; }
.splash-title { font-size: 28px; font-weight: 800; color: #e8eaf6; margin: 12px 0 4px; letter-spacing: -0.5px; }
.splash-subtitle { font-size: 14px; color: #9ba4c7; margin-bottom: 32px; }
.splash-loader { width: 200px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.loader-bar { width: 0%; height: 100%; background: linear-gradient(90deg, #00e676, #4fc3f7); border-radius: 4px; animation: loadBar 2s ease forwards; }
@keyframes loadBar { to { width: 100%; } }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-8px); } }

/* ---- APP CONTAINER ---- */
.app { 
  position: fixed; inset: 0; 
  display: flex; flex-direction: column;
  background: var(--bg-primary);
}
.hidden { display: none !important; }

/* ---- HEADER ---- */
.app-header {
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.app-logo { font-size: 24px; }
.app-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.header-right { display: flex; gap: 4px; }
.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  background: var(--bg-input);
  transition: background 0.2s;
}
.icon-btn:active { background: var(--border); }

/* ---- CONTENT ---- */
.app-content { flex: 1; overflow: hidden; position: relative; }
.page { 
  position: absolute; inset: 0; 
  display: none; flex-direction: column;
  background: var(--bg-primary);
}
.page.active { display: flex; }
.page-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 16px 16px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.page-scroll::-webkit-scrollbar { display: none; }
.bottom-spacer { height: 24px; }

/* ---- BOTTOM NAV ---- */
.bottom-nav {
  height: var(--nav-h);
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 9px; font-weight: 600;
  transition: color 0.2s;
  position: relative;
}
.nav-btn.active { color: var(--accent-green); }
.nav-btn.active::before {
  content: '';
  position: absolute; top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--accent-green);
  border-radius: 0 0 4px 4px;
}
.nav-icon { font-size: 20px; }
.nav-label { font-size: 9px; }

/* ---- CARDS ---- */
/* Greeting */
.greeting-card {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.greeting-time { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.greeting-title { font-size: 20px; font-weight: 700; }
.month-badge {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  padding: 6px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}

/* Summary Grid */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 10px;
  transition: transform 0.15s;
}
.summary-card:active { transform: scale(0.97); }
.summary-card.accent-green { border-left: 3px solid var(--accent-green); }
.summary-card.accent-blue { border-left: 3px solid var(--accent-blue); }
.summary-card.accent-orange { border-left: 3px solid var(--accent-orange); }
.summary-card.accent-purple { border-left: 3px solid var(--accent-purple); }
.summary-icon { font-size: 24px; }
.summary-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.summary-value { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* Section Header */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 10px;
}
.section-header h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.section-period { font-size: 12px; color: var(--text-muted); }
.link-btn { font-size: 13px; color: var(--accent-blue); font-weight: 600; background: none; border: none; }

/* Last Purchase */
.last-purchase-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 4px;
}
.lp-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.lp-name { font-size: 15px; font-weight: 700; }
.lp-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.lp-total { font-size: 18px; font-weight: 800; color: var(--accent-green); }
.lp-market { font-size: 12px; color: var(--text-secondary); }
.lp-items-preview { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.lp-item-chip {
  background: var(--bg-input); border-radius: 12px;
  padding: 3px 8px; font-size: 11px; color: var(--text-secondary);
}

/* Charts */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 4px;
  position: relative;
}
.chart-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
}

/* Top Products */
.top-products-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.top-product-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.tp-rank {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.tp-info { flex: 1; }
.tp-name { font-size: 13px; font-weight: 600; }
.tp-count { font-size: 11px; color: var(--text-muted); }
.tp-price { font-size: 13px; font-weight: 700; color: var(--accent-green); }

/* Savings */
.savings-card {
  background: linear-gradient(135deg, rgba(0,230,118,0.15), rgba(0,230,118,0.05));
  border: 1px solid rgba(0,230,118,0.3);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  margin: 12px 0;
}
.savings-icon { font-size: 32px; }
.savings-label { font-size: 13px; color: var(--text-secondary); }
.savings-value { font-size: 20px; font-weight: 800; color: var(--accent-green); }

/* Empty states */
.empty-state {
  padding: 40px 20px; text-align: center; color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; font-weight: 600; }
.empty-sub { font-size: 13px; margin-top: 4px; opacity: 0.7; }
.empty-mini { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ---- LISTA DE COMPRAS ---- */
.list-header-card {
  background: linear-gradient(135deg, #1a3a6c, #0d2150);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  border: 1px solid rgba(79,195,247,0.2);
}
[data-theme="light"] .list-header-card { background: linear-gradient(135deg, #e3f2fd, #bbdefb); border-color: rgba(25,118,210,0.2); }
.list-header-info h2 { font-size: 18px; font-weight: 700; }
.list-date { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.list-total-box { text-align: right; }
.list-total-label { font-size: 11px; color: var(--text-secondary); }
.list-total-value { font-size: 22px; font-weight: 800; color: var(--accent-green); }

/* Action bar */
.action-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.action-btn {
  flex: 1; padding: 10px 4px;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: opacity 0.2s, transform 0.15s;
}
.action-btn:active { transform: scale(0.96); opacity: 0.85; }
.action-btn.primary { background: var(--accent-blue); color: #fff; }
.action-btn.secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.action-btn.success { background: var(--accent-green); color: #000; }

/* Category filter */
.category-filter-wrap { overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.category-filter-wrap::-webkit-scrollbar { display: none; }
.category-filters { display: flex; gap: 6px; width: max-content; padding: 2px 0; }
.cat-filter {
  padding: 6px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.2s;
}
.cat-filter.active { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }

/* Search bar */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  margin-bottom: 10px;
}
.search-icon { font-size: 14px; }
.search-bar input { flex: 1; background: none; border: none; font-size: 14px; color: var(--text-primary); }
.search-bar input::placeholder { color: var(--text-muted); }

/* Progress */
.progress-bar-wrap { margin-bottom: 12px; }
.progress-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.progress-track { height: 6px; background: var(--bg-input); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-green), var(--accent-blue)); border-radius: 6px; transition: width 0.4s ease; }

/* Shopping List Items */
.shopping-list { display: flex; flex-direction: column; gap: 2px; }
.category-group { margin-bottom: 8px; }
.category-group-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); padding: 8px 4px 4px;
  display: flex; align-items: center; gap: 6px;
}
.category-group-label span { font-size: 14px; }

.list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
  transition: all 0.25s ease;
  margin-bottom: 6px;
  position: relative;
  overflow: hidden;
}
.list-item.checked { opacity: 0.5; }
.list-item.checked .item-name { text-decoration: line-through; }
.list-item-check {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  background: none;
}
.list-item.checked .list-item-check { background: var(--accent-green); border-color: var(--accent-green); }
.list-item-check::after { content: '✓'; font-size: 13px; color: #fff; opacity: 0; transition: opacity 0.2s; }
.list-item.checked .list-item-check::after { opacity: 1; }

.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: flex; gap: 8px; }
.item-note { font-size: 11px; color: var(--text-muted); font-style: italic; margin-top: 2px; }
.item-price-box { text-align: right; flex-shrink: 0; }
.item-total { font-size: 15px; font-weight: 700; color: var(--accent-green); }
.item-unit-price { font-size: 11px; color: var(--text-muted); }
.price-up { color: var(--accent-red) !important; }
.price-down { color: var(--accent-green) !important; }
.price-badge {
  font-size: 10px; padding: 1px 5px; border-radius: 6px; margin-left: 3px;
}
.price-badge.up { background: var(--accent-red-bg); color: var(--accent-red); }
.price-badge.down { background: var(--accent-green-bg); color: var(--accent-green); }

.item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.item-act-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}
.item-act-btn:active { transform: scale(0.9); }
.item-act-btn.del { background: var(--accent-red-bg); }

/* Suggestions */
.suggestions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.suggestion-chip {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
  transition: all 0.2s;
}
.suggestion-chip:active { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-bg); }
.sug-icon { font-size: 16px; }
.sug-name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-price { font-size: 10px; color: var(--text-muted); }
.sug-add { font-size: 16px; color: var(--accent-blue); margin-left: auto; }

/* ---- HISTÓRICO ---- */
.month-filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  margin-bottom: 12px; font-size: 14px; font-weight: 600;
}
.month-nav-btn { font-size: 20px; color: var(--text-secondary); padding: 2px 8px; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  transition: all 0.2s;
}
.history-item:active { transform: scale(0.99); }
.hi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.hi-name { font-size: 15px; font-weight: 700; }
.hi-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.hi-total { font-size: 20px; font-weight: 800; color: var(--accent-green); }
.hi-market { font-size: 12px; color: var(--text-secondary); }
.hi-stats { display: flex; gap: 12px; margin-top: 8px; }
.hi-stat { font-size: 12px; color: var(--text-muted); }
.hi-stat strong { color: var(--text-secondary); }
.hi-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.hi-act-btn {
  flex: 1; padding: 6px; font-size: 12px; font-weight: 600;
  border-radius: var(--radius-sm); text-align: center;
  background: var(--bg-input); color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.hi-act-btn:active { background: var(--accent-blue-bg); color: var(--accent-blue); }

/* ---- ESTOQUE ---- */
.alert-banner {
  background: var(--accent-orange-bg); border: 1px solid var(--accent-orange);
  border-radius: var(--radius-sm); padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--accent-orange); font-weight: 600;
  margin-bottom: 10px;
}
.stock-filter-tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.stock-filter-tabs::-webkit-scrollbar { display: none; }
.stock-tab {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  white-space: nowrap; transition: all 0.2s;
}
.stock-tab.active { background: var(--accent-orange); border-color: var(--accent-orange); color: #fff; }

.stock-list { display: flex; flex-direction: column; gap: 8px; }
.stock-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.stock-status-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.status-ok { background: var(--accent-green); }
.status-low { background: var(--accent-orange); }
.status-out { background: var(--accent-red); }

.stock-info { flex: 1; min-width: 0; }
.stock-name { font-size: 14px; font-weight: 600; }
.stock-cat { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.stock-qty-wrap { display: flex; align-items: center; gap: 6px; }
.qty-mini-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-input); color: var(--text-primary);
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.qty-mini-btn:active { transform: scale(0.9); }
.stock-qty-val { font-size: 16px; font-weight: 700; min-width: 36px; text-align: center; }
.stock-unit-lbl { font-size: 11px; color: var(--text-muted); }
.stock-edit-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-size: 14px; }

/* ---- RELATÓRIOS ---- */
.report-period-bar { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.period-btn {
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  white-space: nowrap; transition: all 0.2s;
}
.period-btn.active { background: var(--accent-purple); border-color: var(--accent-purple); color: #fff; }

.report-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.report-stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center;
}
.rs-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.rs-value { font-size: 16px; font-weight: 800; color: var(--text-primary); }

.report-table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 4px; }
.report-table-row { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.report-table-row:last-child { border-bottom: none; }
.rtr-rank { width: 24px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.rtr-name { flex: 1; font-size: 13px; font-weight: 600; }
.rtr-val { font-size: 13px; font-weight: 700; color: var(--accent-green); }

.price-variation-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.pv-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.pv-name { flex: 1; font-size: 13px; font-weight: 600; }
.pv-old { font-size: 12px; color: var(--text-muted); }
.pv-new { font-size: 14px; font-weight: 700; }
.pv-arrow { font-size: 16px; }
.pv-up .pv-new { color: var(--accent-red); }
.pv-down .pv-new { color: var(--accent-green); }
.pv-same .pv-new { color: var(--text-secondary); }

.export-buttons { display: flex; gap: 10px; margin-bottom: 4px; }
.export-btn {
  flex: 1; padding: 12px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all 0.2s;
}
.export-btn span { font-size: 24px; }
.export-btn:active { background: var(--accent-blue-bg); border-color: var(--accent-blue); }

/* ---- FAMÍLIA ---- */
.family-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.family-tab {
  flex: 1; padding: 9px 4px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  text-align: center; transition: all 0.2s;
}
.family-tab.active { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }

.family-tab-content { display: flex; flex-direction: column; gap: 10px; }

.info-card {
  background: var(--accent-blue-bg); border: 1px solid rgba(79,195,247,0.2);
  border-radius: var(--radius-sm); padding: 12px;
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
}

.qr-container { 
  display: flex; justify-content: center; align-items: center;
  padding: 20px; background: white; border-radius: var(--radius);
  margin: 4px 0; min-height: 200px;
}
.qr-data-text {
  background: var(--bg-input); border-radius: var(--radius-sm);
  padding: 10px; font-size: 10px; color: var(--text-muted);
  word-break: break-all; max-height: 80px; overflow-y: auto;
}
.qr-scan-area { position: relative; border-radius: var(--radius); overflow: hidden; }
.qr-scan-area video { width: 100%; border-radius: var(--radius); }

.divider-text { text-align: center; color: var(--text-muted); font-size: 13px; position: relative; }
.divider-text::before, .divider-text::after {
  content: ''; position: absolute; top: 50%; width: 40%;
  height: 1px; background: var(--border);
}
.divider-text::before { left: 0; }
.divider-text::after { right: 0; }

.file-input-wrap { position: relative; }
.file-label { display: flex; align-items: center; justify-content: center; cursor: pointer; }

.backup-status { padding: 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; }
.backup-status.success { background: var(--accent-green-bg); color: var(--accent-green); }
.backup-status.error { background: var(--accent-red-bg); color: var(--accent-red); }

/* ---- CONFIGURAÇÕES ---- */
.settings-group {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.settings-group-title {
  padding: 10px 14px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); background: var(--bg-input);
}
.setting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.setting-item:last-child { border-bottom: none; }
.setting-name { font-size: 14px; font-weight: 600; }
.setting-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.theme-toggle-wrap { display: flex; gap: 4px; }
.theme-btn {
  padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--bg-input); color: var(--text-muted);
  border: 1px solid var(--border); transition: all 0.2s;
}
.theme-btn.active { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }

/* Toggle Switch */
.toggle-switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 26px; transition: 0.3s;
}
.toggle-slider:before {
  content: ""; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: var(--text-muted); border-radius: 50%; transition: 0.3s;
}
input:checked + .toggle-slider { background: var(--accent-green); border-color: var(--accent-green); }
input:checked + .toggle-slider:before { transform: translateX(20px); background: #fff; }

.categories-setting-list { padding: 8px 0; }
.cat-setting-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
}
.cat-emoji { font-size: 20px; }
.cat-name-text { flex: 1; font-size: 14px; font-weight: 600; }
.cat-color-dot { width: 12px; height: 12px; border-radius: 50%; }
.cat-del-btn { font-size: 16px; color: var(--accent-red); padding: 4px; }

.about-card { padding: 20px; text-align: center; }
.about-logo { font-size: 48px; margin-bottom: 8px; }
.about-name { font-size: 18px; font-weight: 800; }
.about-version { font-size: 13px; color: var(--text-muted); margin: 4px 0; }
.about-desc { font-size: 13px; color: var(--text-secondary); }

.danger-group .settings-group-title.danger-title { color: var(--accent-red); }
.page-title-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.page-title-bar h2 { font-size: 20px; font-weight: 800; }

/* ---- MODAIS ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end;
  backdrop-filter: blur(4px);
}
.modal-sheet {
  width: 100%; background: var(--bg-secondary);
  border-radius: 24px 24px 0 0;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s ease;
}
.modal-tall { max-height: 95vh; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 40px; height: 4px; border-radius: 4px;
  background: var(--border); margin: 12px auto 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-input); color: var(--text-secondary);
  font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.modal-body { padding: 8px 16px 32px; display: flex; flex-direction: column; gap: 12px; }

/* Input Groups */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.input-group input, .input-group select, .input-group textarea {
  width: 100%; padding: 11px 13px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; color: var(--text-primary);
}
.input-group input:focus, .input-group select:focus { border-color: var(--accent-blue); }
.input-row { display: flex; gap: 10px; }
.input-group.half { flex: 1; }

/* Qty control */
.qty-control { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 34px; height: 38px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border);
  font-size: 20px; color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.qty-control input { flex: 1; text-align: center; }

/* Total display */
.total-display {
  padding: 11px 13px; background: var(--accent-green-bg);
  border: 1px solid rgba(0,230,118,0.3); border-radius: var(--radius-sm);
  font-size: 18px; font-weight: 800; color: var(--accent-green);
  text-align: center;
}

/* Price history info */
.price-history-info {
  background: var(--accent-blue-bg); border: 1px solid rgba(79,195,247,0.2);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 12px; color: var(--accent-blue);
}

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 180px; overflow-y: auto;
}
.autocomplete-item {
  padding: 10px 13px; font-size: 14px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:active { background: var(--bg-input); }
.ac-price { font-size: 12px; color: var(--accent-green); font-weight: 600; }

/* Finalize modal */
.finalize-summary { text-align: center; padding: 10px 0; }
.finalize-emoji { font-size: 48px; margin-bottom: 8px; }
.finalize-total { font-size: 32px; font-weight: 900; color: var(--accent-green); }
.finalize-count { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Voice */
.voice-visual { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 0; }
.voice-circle {
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--accent-blue-bg); border: 3px solid var(--accent-blue);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.voice-circle.listening {
  background: var(--accent-red-bg); border-color: var(--accent-red);
  animation: pulse 1s ease infinite;
}
.voice-mic { font-size: 36px; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.voice-transcript { font-size: 15px; font-weight: 600; text-align: center; min-height: 22px; }
.voice-help { text-align: center; font-size: 12px; color: var(--text-muted); line-height: 1.8; }

/* Color picker */
.color-picker-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.color-dot {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.15s;
}
.color-dot.selected { border-color: white; transform: scale(1.15); }

/* Buttons */
.btn-full {
  width: 100%; padding: 13px; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; text-align: center;
  transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-full:active { transform: scale(0.98); opacity: 0.9; }
.btn-full.primary { background: var(--accent-blue); color: #fff; }
.btn-full.secondary { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary); }
.btn-full.success { background: var(--accent-green); color: #000; }
.btn-full.danger { background: var(--accent-red); color: #fff; }
.btn-primary-sm { padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; background: var(--accent-blue); color: #fff; }
.btn-outline { padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; background: none; border: 1px dashed var(--border); color: var(--text-secondary); width: 100%; margin: 4px 0 8px; }
.btn-danger { width: 100%; padding: 12px; border-radius: var(--radius); background: var(--accent-red-bg); border: 1px solid var(--accent-red); color: var(--accent-red); font-size: 14px; font-weight: 700; margin: 8px 0; }

.styled-select {
  width: 100%; padding: 10px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary);
}
.styled-select-sm {
  padding: 6px 10px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-primary); width: 100px;
}
.styled-input-sm {
  width: 60px; padding: 6px 10px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary); text-align: center;
}
.styled-textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-primary);
  resize: none; min-height: 80px; font-family: inherit;
}
.qr-select-wrap { display: flex; flex-direction: column; gap: 6px; }
.qr-select-wrap label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }

/* ---- TOAST ---- */
.toast-container { 
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 16px; right: 16px;
  z-index: 9000; display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.toast {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: all;
}
.toast.success { background: #1a3a1a; border: 1px solid var(--accent-green); color: var(--accent-green); }
.toast.error { background: #3a1a1a; border: 1px solid var(--accent-red); color: var(--accent-red); }
.toast.info { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); }
.toast.warning { background: #3a2a0a; border: 1px solid var(--accent-orange); color: var(--accent-orange); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* Loading overlay */
.loading-overlay {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  color: var(--text-primary); font-size: 14px;
}
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--accent-blue); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- PURCHASE DETAIL MODAL ---- */
.purchase-detail-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.pd-total { font-size: 24px; font-weight: 900; color: var(--accent-green); }
.pd-items-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--bg-input); border-radius: var(--radius-sm);
}
.pd-item-name { flex: 1; font-size: 13px; font-weight: 600; }
.pd-item-qty { font-size: 12px; color: var(--text-muted); }
.pd-item-price { font-size: 13px; font-weight: 700; color: var(--accent-green); }
.pd-actions { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
