/* ============================================================
   Calcula Chef - Stylesheet
   Design: Elegante, moderno, verde escuro + branco
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --green-900: #0d2b1f;
  --green-800: #14422f;
  --green-700: #1a5c40;
  --green-600: #1f7a54;
  --green-500: #25a06c;
  --green-400: #34c77e;
  --green-300: #6ee0a6;
  --green-100: #d6f5e7;
  --green-50:  #f0fdf6;

  --white:     #ffffff;
  --gray-50:   #f8fafc;
  --gray-100:  #f1f5f9;
  --gray-200:  #e2e8f0;
  --gray-300:  #cbd5e1;
  --gray-400:  #94a3b8;
  --gray-500:  #64748b;
  --gray-600:  #475569;
  --gray-700:  #334155;
  --gray-800:  #1e293b;
  --gray-900:  #0f172a;

  --red-500:   #ef4444;
  --red-100:   #fee2e2;
  --red-600:   #dc2626;

  --profit:    #16a34a;
  --loss:      #dc2626;
  --profit-bg: #f0fdf4;
  --loss-bg:   #fef2f2;

  --sidebar-width: 260px;
  --header-height: 64px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.10), 0 8px 10px -6px rgba(0,0,0,.06);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: .18s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 50%, var(--green-600) 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.08);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--green-700), var(--green-500));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 16px rgba(20,66,47,.3);
}

.login-logo .logo-icon svg { width: 32px; height: 32px; color: white; }

.login-logo h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--green-800);
  letter-spacing: -0.5px;
}

.login-logo p {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 4px;
}

.login-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 24px;
}

.login-tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
}

.login-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--gray-500);
  transition: all var(--transition);
}

.login-tab.active {
  background: var(--white);
  color: var(--green-700);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--white);
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(37,160,108,.12);
}

.form-control::placeholder { color: var(--gray-400); }

.form-control.is-invalid { border-color: var(--red-500); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

.invalid-feedback {
  font-size: 12px;
  color: var(--red-600);
  margin-top: 4px;
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(20,66,47,.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  box-shadow: 0 6px 16px rgba(20,66,47,.35);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--green-700);
  border-color: var(--green-500);
}

.btn-outline:hover {
  background: var(--green-50);
  border-color: var(--green-700);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-200);
}

.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-danger {
  background: var(--red-500);
  color: white;
  border-color: var(--red-500);
}

.btn-danger:hover { background: var(--red-600); border-color: var(--red-600); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-lg { padding: 13px 28px; font-size: 15px; }

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-icon svg { width: 16px; height: 16px; }

/* ============================================================
   LAYOUT - SIDEBAR
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--green-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-mark {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--green-500), var(--green-400));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo .logo-mark svg { width: 22px; height: 22px; color: white; }

.sidebar-logo .logo-text {
  font-size: 17px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--green-300);
  font-weight: 500;
}

.restaurant-selector {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.restaurant-selector label {
  font-size: 11px;
  font-weight: 600;
  color: var(--green-300);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
  display: block;
}

.restaurant-selector select {
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: white;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
}

.restaurant-selector select:focus {
  border-color: var(--green-400);
  background: rgba(255,255,255,.12);
}

.restaurant-selector select option { background: var(--green-900); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--green-300);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: white;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.user-card:hover { background: rgba(255,255,255,.06); }

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--green-500), var(--green-400));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--green-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-logout {
  color: rgba(255,255,255,.4);
  transition: color var(--transition);
}

.user-card:hover .user-logout { color: rgba(255,255,255,.8); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--gray-600);
  transition: all var(--transition);
}

.hamburger:hover { background: var(--gray-100); }
.hamburger svg { width: 22px; height: 22px; }

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -0.2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-body {
  padding: 28px;
  flex: 1;
}

/* ============================================================
   CARDS & PANELS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
}

.card-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

.card-body { padding: 24px; }

/* ============================================================
   STATS / KPI CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.green { background: var(--green-100); color: var(--green-700); }
.stat-icon.red   { background: var(--red-100);   color: var(--red-600); }
.stat-icon.gray  { background: var(--gray-100);  color: var(--gray-600); }
.stat-icon svg { width: 20px; height: 20px; }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -1px;
  line-height: 1;
}

.stat-value.profit { color: var(--profit); }
.stat-value.loss   { color: var(--loss); }

.stat-change {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up   { color: var(--profit); }
.stat-change.down { color: var(--loss); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--gray-50); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green  { background: var(--green-100);  color: var(--green-700); }
.badge-red    { background: var(--red-100);    color: var(--red-600); }
.badge-gray   { background: var(--gray-100);   color: var(--gray-600); }
.badge-profit { background: var(--profit-bg);  color: var(--profit); }
.badge-loss   { background: var(--loss-bg);    color: var(--loss); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

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

.alert-success { background: var(--green-50);  border-color: var(--green-200); color: var(--green-800); }
.alert-danger  { background: var(--red-100);   border-color: #fca5a5;          color: var(--red-600); }
.alert-info    { background: var(--gray-100);  border-color: var(--gray-300);  color: var(--gray-700); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.modal-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-800);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--gray-100);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: all var(--transition);
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ============================================================
   FICHA TÉCNICA (ingredientes do prato)
   ============================================================ */
.ingredient-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.ingredient-row .cost-display {
  padding: 10px 14px;
  background: var(--green-50);
  border: 1.5px solid var(--green-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--green-700);
  text-align: right;
  white-space: nowrap;
}

.add-ingredient-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green-600);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--green-300);
  background: var(--green-50);
  width: 100%;
  justify-content: center;
  transition: all var(--transition);
  margin-top: 8px;
}

.add-ingredient-btn:hover { background: var(--green-100); border-color: var(--green-500); }
.add-ingredient-btn svg { width: 16px; height: 16px; }

/* ============================================================
   PROFIT SIMULATOR
   ============================================================ */
.simulator-card {
  background: linear-gradient(135deg, var(--green-900), var(--green-800));
  border-radius: var(--radius-lg);
  padding: 24px;
  color: white;
  margin-bottom: 24px;
}

.simulator-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.simulator-card h3 svg { width: 20px; height: 20px; color: var(--green-400); }

.slider-group { margin-bottom: 18px; }

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.8);
  margin-bottom: 8px;
}

.slider-label span { color: var(--green-300); font-weight: 700; }

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,.2);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-400);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.simulator-result {
  background: rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: center;
  margin-top: 20px;
}

.sim-item label {
  font-size: 11px;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: block;
  margin-bottom: 4px;
}

.sim-item .value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sim-item .value.profit { color: var(--green-300); }
.sim-item .value.loss   { color: #f87171; }

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container {
  position: relative;
  height: 280px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: var(--gray-300);
  margin: 0 auto 16px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 14px;
  color: var(--gray-400);
  margin-bottom: 20px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header-text h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.4px;
}

.page-header-text p {
  font-size: 14px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--gray-400);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--white);
  outline: none;
  color: var(--gray-800);
  transition: all var(--transition);
}

.search-input-wrap input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(37,160,108,.12);
}

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 999;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green-500), var(--green-400));
  transition: width .4s ease;
}

.progress-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }

/* ============================================================
   NOTIFICATIONS DOT
   ============================================================ */
.notif-dot {
  width: 8px;
  height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  position: absolute;
  top: 4px;
  right: 4px;
}

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; }

  .hamburger { display: flex; }

  .page-body { padding: 20px 16px; }

  .topbar { padding: 0 16px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .form-row   { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }

  .ingredient-row { grid-template-columns: 1fr 100px; }
  .ingredient-row .cost-display { display: none; }

  .simulator-result { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; }

  .modal { border-radius: var(--radius-lg); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}

/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.page-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.page-btn.active { background: var(--green-700); color: white; border-color: var(--green-700); }

/* ============================================================
   CÓDIGO / PRÉ-FORMATADO
   ============================================================ */
code {
  font-size: 12px;
  background: var(--gray-100);
  color: var(--green-700);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

/* ============================================================
   DIVISOR
   ============================================================ */
.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 24px 0;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--green-600);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

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

/* ============================================================
   RESPONSIVE GRID AJUSTES
   ============================================================ */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  div[style*="grid-template-columns:1fr 1fr"] {
    display: block !important;
  }
  div[style*="grid-template-columns:1fr 340px"] {
    display: block !important;
  }
  div[style*="grid-template-columns:1fr 1fr;gap:24px"] {
    display: block !important;
  }
}
