/* ============================================================
   GestãoHE — Design System v3 "Executive"
   Tipografia: Inter (Google Fonts)
   Paleta: Verde floresta sóbrio + Cinza profissional + Branco limpo
   ============================================================ */

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

/* ── Tokens de design ───────────────────────────────────────── */
:root {
  /* Cor primária: verde floresta */
  --c-primary:        #16a34a;
  --c-primary-dark:   #15803d;
  --c-primary-deeper: #14532d;
  --c-primary-light:  #f0fdf4;
  --c-primary-muted:  #bbf7d0;
  --c-primary-glow:   rgba(22,163,74,0.15);

  /* Sidebar — dark forest premium */
  --c-sidebar-bg:     #0c1912;
  --c-sidebar-hover:  rgba(255,255,255,0.055);
  --c-sidebar-active: rgba(22,163,74,0.16);
  --c-sidebar-border: rgba(255,255,255,0.07);
  --c-sidebar-text:   rgba(255,255,255,0.72);
  --c-sidebar-icon:   rgba(255,255,255,0.38);

  /* Superfícies */
  --c-bg:         #f0f2f5;
  --c-bg-2:       #e8ebef;
  --c-surface:    #ffffff;
  --c-surface-2:  #f8f9fb;

  /* Bordas */
  --c-border:     #e4e7ec;
  --c-border-md:  #cdd2da;
  --c-border-strong: #b4bbc6;

  /* Texto */
  --c-text:       #0f172a;
  --c-text-sm:    #1e293b;
  --c-text-muted: #64748b;
  --c-text-pale:  #94a3b8;
  --c-text-inv:   #ffffff;

  /* Semântica */
  --c-success:    #16a34a;
  --c-success-bg: #f0fdf4;
  --c-warning:    #d97706;
  --c-warning-bg: #fffbeb;
  --c-danger:     #dc2626;
  --c-danger-bg:  #fef2f2;
  --c-info:       #0284c7;
  --c-info-bg:    #f0f9ff;
  --c-purple:     #7c3aed;
  --c-purple-bg:  #f5f3ff;

  /* Sombras premium */
  --shadow-xs:  0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm:  0 1px 3px rgba(15,23,42,0.07), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:  0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg:  0 8px 28px rgba(15,23,42,0.10), 0 3px 8px rgba(15,23,42,0.05);
  --shadow-xl:  0 20px 56px rgba(15,23,42,0.16), 0 4px 14px rgba(15,23,42,0.08);
  --shadow-colored: 0 4px 14px rgba(22,163,74,0.25);

  /* Dimensões */
  --sidebar-w:     260px;
  --sidebar-w-sm:   64px;
  --topbar-h:       60px;
  --radius-xs:      3px;
  --radius-sm:      6px;
  --radius-md:      8px;
  --radius-lg:     12px;
  --radius-xl:     16px;
  --radius-2xl:    20px;
  --radius-full: 9999px;

  /* Transição */
  --t:     all 0.18s ease;
  --t-slow: all 0.28s ease;
}

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

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* Scrollbar fina */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-md); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-pale); }

/* ── Layout principal ────────────────────────────────────────── */
.app-container { display: flex; min-height: 100vh; }

/* ══════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--c-sidebar-bg);
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: width 0.22s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar.collapsed { width: var(--sidebar-w-sm); }

/* Logo / marca */
.sidebar-logo {
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--c-sidebar-border);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(22,163,74,0.35);
}

.sidebar-logo-text { overflow: hidden; white-space: nowrap; }
.sidebar-logo-name {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: var(--c-sidebar-icon);
  font-weight: 400;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  line-height: 1;
}

/* Nav */
.sidebar-menu {
  flex: 1;
  padding: 8px 0 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--c-sidebar-icon);
  padding: 18px 20px 5px;
  white-space: nowrap;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 18px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--t);
  color: var(--c-sidebar-text);
  font-size: 13.5px;
  font-weight: 450;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.sidebar-item:hover {
  background: var(--c-sidebar-hover);
  color: rgba(255,255,255,0.92);
}

.sidebar-item.active {
  background: var(--c-sidebar-active);
  color: #4ade80;
  font-weight: 600;
}

.sidebar-item.active .sidebar-item-icon { color: #4ade80; }

.sidebar-item-icon {
  width: 18px;
  text-align: center;
  font-size: 13.5px;
  flex-shrink: 0;
  color: var(--c-sidebar-icon);
  transition: var(--t);
}

.sidebar-item:hover .sidebar-item-icon,
.sidebar-item.active .sidebar-item-icon { color: inherit; }

.sidebar-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }

/* Indicador ativo à esquerda */
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 3px;
  background: #22c55e;
  border-radius: 0 3px 3px 0;
}

/* User footer */
.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--c-sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  overflow: hidden;
  cursor: pointer;
  transition: var(--t);
  margin: 0;
}
.sidebar-user:hover { background: var(--c-sidebar-hover); }

.sidebar-user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.1);
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--c-sidebar-icon);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   MAIN + TOPBAR
══════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-sm); }

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

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

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.3px;
}

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

/* Botão toggle sidebar */
.btn-sidebar-toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--c-text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--t);
  font-size: 13px;
}
.btn-sidebar-toggle:hover { background: var(--c-bg); color: var(--c-text); border-color: var(--c-border-md); }

/* Badge Firebase */
.firebase-status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  color: var(--c-text-muted);
  font-weight: 500;
  cursor: default;
  white-space: nowrap;
}

/* Botão usuário (topbar) */
.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--t);
  font-size: 13px;
  color: var(--c-text-sm);
  font-weight: 500;
}
.topbar-user-btn:hover { background: var(--c-bg-2); border-color: var(--c-border-md); }

.topbar-user-avatar {
  width: 27px; height: 27px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}

/* ── PAGE CONTENT ────────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; max-width: 100%; }

/* ══════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════ */
.card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--c-surface);
}

.card-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.1px;
}
.card-title i { font-size: 12.5px; }

.card-body { padding: 20px; }

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}

/* ── STAT CARDS PREMIUM ──────────────────────────────────────── */
.stat-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  padding: 20px 20px 18px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  transition: var(--t-slow);
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--c-border-md);
}

/* Borda colorida no topo */
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.accent-green::after  { background: linear-gradient(90deg, #16a34a, #22c55e); }
.stat-card.accent-blue::after   { background: linear-gradient(90deg, #1d4ed8, #3b82f6); }
.stat-card.accent-amber::after  { background: linear-gradient(90deg, #d97706, #f59e0b); }
.stat-card.accent-red::after    { background: linear-gradient(90deg, #dc2626, #ef4444); }
.stat-card.accent-purple::after { background: linear-gradient(90deg, #7c3aed, #a855f7); }
.stat-card.accent-teal::after   { background: linear-gradient(90deg, #0f766e, #14b8a6); }

/* Ícone */
.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.orange { background: #fef3c7; color: #d97706; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.teal   { background: #ccfbf1; color: #0f766e; }

.stat-info { flex: 1; min-width: 0; }

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-pale);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--c-text);
  line-height: 1.1;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--c-text-muted);
  margin-top: 5px;
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}
.stat-delta.up   { color: var(--c-success); background: #dcfce7; }
.stat-delta.down { color: var(--c-danger);  background: #fee2e2; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--t);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  outline: none;
  letter-spacing: -0.1px;
}
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(22,163,74,0.25); outline: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn i { font-size: 12px; }

.btn-primary   {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary-dark);
  box-shadow: 0 1px 3px rgba(22,163,74,0.25);
}
.btn-primary:hover:not(:disabled)  { background: var(--c-primary-dark); box-shadow: 0 2px 6px rgba(22,163,74,0.3); }
.btn-primary:active:not(:disabled) { background: #166534; transform: translateY(1px); }

.btn-secondary { background: #1e293b; color: #fff; border-color: #0f172a; }
.btn-secondary:hover:not(:disabled) { background: #0f172a; }

.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-danger    { background: #dc2626; color: #fff; border-color: #b91c1c; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #b45309; }

.btn-ghost {
  background: transparent;
  color: var(--c-text-muted);
  border-color: var(--c-border);
}
.btn-ghost:hover:not(:disabled) { background: var(--c-bg); color: var(--c-text); border-color: var(--c-border-md); }

.btn-outline-primary {
  background: transparent;
  color: var(--c-primary);
  border-color: var(--c-primary);
}
.btn-outline-primary:hover:not(:disabled) { background: var(--c-primary); color: #fff; }

.btn-sm   { padding: 5px 10px; font-size: 12px; gap: 4px; }
.btn-lg   { padding: 10px 22px; font-size: 14px; }
.btn-icon { padding: 7px; border-radius: var(--radius-md); gap: 0; }
.btn-icon.sm { padding: 5px; border-radius: var(--radius-sm); font-size: 12px; }

/* ══════════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-text-sm);
  margin-bottom: 5px;
  letter-spacing: -0.1px;
}
.form-label .required { color: var(--c-danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--c-text);
  background: #fff;
  transition: var(--t);
  outline: none;
  line-height: 1.5;
  -webkit-appearance: none;
}
.form-control::placeholder { color: var(--c-text-pale); }
.form-control:hover { border-color: var(--c-border-md); }
.form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.10);
}
.form-control:disabled { background: var(--c-bg); cursor: not-allowed; color: var(--c-text-muted); }
.form-control.is-invalid { border-color: var(--c-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.10); }

.form-hint  { font-size: 11.5px; color: var(--c-text-muted); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--c-danger); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }

/* ══════════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }

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

.table thead tr {
  background: var(--c-bg);
  border-bottom: 1.5px solid var(--c-border);
}

.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--c-text-muted);
  white-space: nowrap;
  user-select: none;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-sm);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8fafc; }

/* ══════════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-primary  { background: #dcfce7; color: #166534; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-purple   { background: #ede9fe; color: #5b21b6; }

/* ══════════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.50);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--c-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.22s cubic-bezier(.34,1.3,.64,1);
}
.modal-lg  { max-width: 780px; }
.modal-xl  { max-width: 1040px; }
.modal-sm  { max-width: 420px; }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--c-surface);
  z-index: 10;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.modal-body { padding: 22px; }
.modal-footer {
  padding: 15px 22px;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--c-surface);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE — PREMIUM
══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: var(--c-sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Grade de pontos no fundo */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

/* Glow verde */
.login-page::after {
  content: '';
  position: absolute;
  top: -150px; right: -150px;
  width: 550px; height: 550px;
  background: radial-gradient(circle, rgba(22,163,74,0.10) 0%, transparent 60%);
  pointer-events: none;
}

.login-panel {
  display: flex;
  width: 100%;
  max-width: 940px;
  min-height: 540px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0,0,0,0.5);
  position: relative;
  z-index: 1;
}

/* Coluna esquerda: marca */
.login-brand {
  flex: 1;
  background: linear-gradient(160deg,
    rgba(22,163,74,0.14) 0%,
    rgba(15,25,18,0.5) 60%,
    rgba(5,10,7,0.6) 100%);
  border: 1px solid rgba(22,163,74,0.18);
  border-right: none;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  padding: 52px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.login-brand::before {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(22,163,74,0.08) 0%, transparent 65%);
}

.login-brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}
.login-brand-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  box-shadow: 0 4px 16px rgba(22,163,74,0.4);
}
.login-brand-name {
  font-size: 22px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.6px;
}
.login-brand-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.42);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 1px;
}

.login-brand-headline {
  margin-top: 36px;
  position: relative;
}
.login-brand-headline h2 {
  font-size: 28px;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1.25;
  letter-spacing: -0.8px;
}
.login-brand-headline p {
  font-size: 13.5px;
  color: rgba(255,255,255,0.42);
  margin-top: 10px;
  line-height: 1.65;
  max-width: 320px;
}

.login-brand-features { margin-top: auto; position: relative; }
.login-brand-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  color: rgba(255,255,255,0.62);
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.login-brand-feature:last-child { border-bottom: none; }
.login-brand-feature i {
  width: 30px; height: 30px;
  background: rgba(22,163,74,0.18);
  border: 1px solid rgba(22,163,74,0.22);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: #4ade80;
  flex-shrink: 0;
}

/* Coluna direita: formulário */
.login-form-col {
  width: 390px;
  background: #fff;
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  padding: 52px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}

.login-form-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--c-primary);
  margin-bottom: 8px;
}
.login-form-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--c-text);
  letter-spacing: -0.6px;
  margin-bottom: 4px;
}
.login-form-subtitle {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 30px;
}

/* ══════════════════════════════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════════════════════════════ */
.progress-bar {
  height: 6px;
  background: var(--c-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), #22c55e);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════════════════════════
   TOASTS
══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  pointer-events: none;
}
.toast {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn 0.28s cubic-bezier(.34,1.3,.64,1);
  border: 1px solid var(--c-border);
  pointer-events: all;
}
.toast-success { border-left: 3px solid #16a34a; }
.toast-error   { border-left: 3px solid #dc2626; }
.toast-warning { border-left: 3px solid #d97706; }
.toast-info    { border-left: 3px solid #0284c7; }

.toast-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: #16a34a; }
.toast-error   .toast-icon { color: #dc2626; }
.toast-warning .toast-icon { color: #d97706; }
.toast-info    .toast-icon { color: #0284c7; }

.toast-content { flex: 1; }
.toast-title { font-size: 13px; font-weight: 650; color: var(--c-text); }
.toast-msg   { font-size: 12px; color: var(--c-text-muted); margin-top: 2px; line-height: 1.4; }

/* ══════════════════════════════════════════════════════════════
   SPINNER
══════════════════════════════════════════════════════════════ */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
}
.spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }

/* ══════════════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-text-muted);
}
.empty-state-icon {
  width: 56px; height: 56px;
  background: var(--c-bg);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 22px;
  color: var(--c-text-pale);
}
.empty-state h3 { font-size: 15px; font-weight: 650; color: var(--c-text-sm); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ══════════════════════════════════════════════════════════════
   GRID HELPERS
══════════════════════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ══════════════════════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════════════════════ */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid;
}
.alert-info    { background: #f0f9ff; color: #0c4a6e; border-color: #bae6fd; }
.alert-success { background: #f0fdf4; color: #14532d; border-color: #bbf7d0; }
.alert-warning { background: #fffbeb; color: #78350f; border-color: #fde68a; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* ══════════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1.5px solid var(--c-border);
  margin-bottom: 20px;
}
.tab {
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  color: var(--c-text-muted);
  transition: var(--t);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--c-primary); }
.tab.active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
  font-weight: 650;
}

/* ══════════════════════════════════════════════════════════════
   FILTER BAR
══════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }

/* ══════════════════════════════════════════════════════════════
   STATUS INDICATORS
══════════════════════════════════════════════════════════════ */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.active   { background: var(--c-success); box-shadow: 0 0 0 2px rgba(22,163,74,0.2); }
.status-dot.inactive { background: var(--c-text-pale); }
.status-dot.warning  { background: var(--c-warning); }

/* ══════════════════════════════════════════════════════════════
   PLANEJAMENTO ESPECÍFICO
══════════════════════════════════════════════════════════════ */
.semana-card {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--t);
  background: var(--c-surface);
}
.semana-card.preenchida { border-color: var(--c-primary); }
.semana-card.parcial    { border-color: var(--c-warning); }

.semana-header {
  padding: 12px 18px;
  background: var(--c-surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--t);
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
  font-weight: 600;
}
.semana-header:hover { background: var(--c-bg-2); }
.semana-header.preenchida {
  background: var(--c-primary-muted);
  border-bottom-color: rgba(22,163,74,0.2);
  color: var(--c-primary-deeper);
}

.cargo-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px 140px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}
.cargo-row:last-child { border-bottom: none; }

.dia-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--t);
  background: #fff;
  min-width: 68px;
  font-size: 12px;
}
.dia-btn:hover  { border-color: var(--c-primary); background: var(--c-primary-light); }
.dia-btn.sim    { border-color: var(--c-primary); background: var(--c-primary-light); color: var(--c-primary-deeper); }
.dia-btn.nao    { border-color: var(--c-border); background: var(--c-bg); color: var(--c-text-pale); }
.dia-btn.parcial{ border-color: var(--c-warning); background: #fffbeb; color: var(--c-warning); }

/* ══════════════════════════════════════════════════════════════
   VALOR MONETÁRIO
══════════════════════════════════════════════════════════════ */
.valor-monetario { font-variant-numeric: tabular-nums; font-weight: 600; }
.valor-positivo  { color: var(--c-primary-deeper); }
.valor-zero      { color: var(--c-text-pale); }

/* ══════════════════════════════════════════════════════════════
   CUSTO BREAKDOWN
══════════════════════════════════════════════════════════════ */
.custo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--c-border);
}
.custo-row:last-child { border-bottom: none; }
.custo-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 0;
  font-size: 14px;
  font-weight: 750;
  border-top: 1.5px solid var(--c-border-md);
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════
   CHARTS
══════════════════════════════════════════════════════════════ */
canvas { max-height: 300px; }

/* ══════════════════════════════════════════════════════════════
   TOOLTIPS
══════════════════════════════════════════════════════════════ */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-text);
  color: #fff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   SECTION HEADER / DIVIDER
══════════════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--c-text);
  letter-spacing: -0.5px;
}
.section-subtitle { font-size: 13px; color: var(--c-text-muted); margin-top: 3px; }

.divider-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--c-text-pale);
  margin: 6px 0 14px;
}
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

/* ══════════════════════════════════════════════════════════════
   CHIP
══════════════════════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-sm);
}

/* ══════════════════════════════════════════════════════════════
   FIREBASE REALTIME
══════════════════════════════════════════════════════════════ */
@keyframes firebase-flash {
  0%   { background-color: transparent; }
  30%  { background-color: rgba(22,163,74,0.10); }
  100% { background-color: transparent; }
}
@keyframes firebase-pulse-anim {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
.firebase-updated { animation: firebase-flash 1.8s ease-out; border-radius: 4px; }
#firebase-badge.firebase-pulse { animation: firebase-pulse-anim 1.2s ease-out; }

/* ══════════════════════════════════════════════════════════════
   KPI METRIC CARD (dashboard extras)
══════════════════════════════════════════════════════════════ */
.kpi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}
.kpi-row:last-child { border-bottom: none; }
.kpi-label { font-size: 12.5px; color: var(--c-text-muted); font-weight: 500; }
.kpi-value { font-size: 14px; font-weight: 700; color: var(--c-text); font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════
   SUMMARY STRIP (linha de resumo acima de tabela)
══════════════════════════════════════════════════════════════ */
.summary-strip {
  display: flex;
  gap: 24px;
  padding: 12px 20px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.summary-strip-item { display: flex; flex-direction: column; align-items: center; }
.summary-strip-label { font-size: 10.5px; font-weight: 700; color: var(--c-text-pale); text-transform: uppercase; letter-spacing: 0.6px; }
.summary-strip-value { font-size: 15px; font-weight: 750; color: var(--c-text); margin-top: 1px; font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════════ */
@keyframes fadeIn   { from { opacity: 0; }           to { opacity: 1; } }
@keyframes slideUp  { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastIn  { from { opacity:0; transform: translateX(24px); } to { opacity:1; transform:translateX(0); } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes fadeSlideIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* Entrada suave para cards */
.page-content > * { animation: fadeSlideIn 0.22s ease both; }
.page-content > *:nth-child(2) { animation-delay: 0.03s; }
.page-content > *:nth-child(3) { animation-delay: 0.06s; }
.page-content > *:nth-child(4) { animation-delay: 0.09s; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .login-brand { display: none; }
  .login-form-col { border-radius: var(--radius-xl); width: 100%; max-width: 440px; }
  .login-panel { max-width: 440px; }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .main-content { margin-left: 0 !important; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .page-content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .stat-value { font-size: 19px; }
}

/* ══════════════════════════════════════════════════════════════
   UTILITÁRIOS PONTUAIS
══════════════════════════════════════════════════════════════ */
.text-green  { color: var(--c-primary); }
.text-muted  { color: var(--c-text-muted); }
.text-danger { color: var(--c-danger); }
.text-warning { color: var(--c-warning); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.monospace { font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════════
   ROI DE FINAIS DE SEMANA
══════════════════════════════════════════════════════════════ */

/* ── KPI strip do período (legado — mantido para compatibilidade) ── */
.roi-kpi-strip {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 0 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

/* ── KPI Grid 3×2 — novo painel executivo ROI ── */
.roi-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.roi-kpi-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 16px 18px;
  border-top: 3px solid var(--c-border);
  transition: box-shadow .18s;
}
.roi-kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.roi-kpi-card-custo { border-top-color: #f97316; }
.roi-kpi-card-fatur { border-top-color: #16a34a; }
.roi-kpi-card-pos   { border-top-color: #16a34a; background: #f0fdf4; border-color: #86efac; }
.roi-kpi-card-neg   { border-top-color: #dc2626; background: #fef2f2; border-color: #fca5a5; }
.roi-kpi-card-pend  { border-top-color: var(--c-border); }

.roi-kpi-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.roi-kpi-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.roi-kpi-card-custo .roi-kpi-card-icon { background: #fff7ed; color: #f97316; }
.roi-kpi-card-fatur .roi-kpi-card-icon { background: #f0fdf4; color: #16a34a; }
.roi-kpi-card-pos   .roi-kpi-card-icon { background: #dcfce7; color: #15803d; }
.roi-kpi-card-neg   .roi-kpi-card-icon { background: #fee2e2; color: #b91c1c; }
.roi-kpi-card-pend  .roi-kpi-card-icon { background: var(--c-bg-2); color: var(--c-text-pale); }

.roi-kpi-card-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .55px;
  line-height: 1.3;
}
.roi-kpi-card-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-bottom: 5px;
}
.roi-kpi-card-custo .roi-kpi-card-value { color: #ea580c; }
.roi-kpi-card-fatur .roi-kpi-card-value { color: #15803d; }
.roi-kpi-card-pos   .roi-kpi-card-value { color: #15803d; }
.roi-kpi-card-neg   .roi-kpi-card-value { color: #b91c1c; }

.roi-kpi-card-sub {
  font-size: 11px;
  color: var(--c-text-pale);
  line-height: 1.35;
}
.roi-kpi-card-pos .roi-kpi-card-sub { color: #166534; }
.roi-kpi-card-neg .roi-kpi-card-sub { color: #991b1b; }

@media (max-width: 900px) {
  .roi-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .roi-kpi-grid { grid-template-columns: 1fr; }
}
.roi-kpi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  flex: 1;
  min-width: 140px;
}
.roi-kpi-divider {
  width: 1px;
  height: 40px;
  background: var(--c-border);
  flex-shrink: 0;
}
.roi-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.roi-kpi-icon-custo  { background: #fff7ed; color: #f97316; }
.roi-kpi-icon-fatur  { background: #f0fdf4; color: #16a34a; }
.roi-kpi-icon-pos    { background: #f0fdf4; color: #16a34a; }
.roi-kpi-icon-neg    { background: #fef2f2; color: #dc2626; }
.roi-kpi-icon-pend   { background: var(--c-bg-2); color: var(--c-text-pale); }

.roi-kpi-label { font-size: 11px; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.roi-kpi-value { font-size: 18px; font-weight: 800; color: var(--c-text); font-variant-numeric: tabular-nums; }
.roi-kpi-value-custo { color: #f97316; }
.roi-kpi-value-fatur { color: #16a34a; }
.roi-kpi-value-pos   { color: #16a34a; }
.roi-kpi-value-neg   { color: #dc2626; }

/* ── Container dos cards ── */
.roi-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Card individual de semana ── */
.roi-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s;
}
.roi-card:hover { box-shadow: var(--shadow-md); }
.roi-card-semfds {
  opacity: 0.7;
  border-color: var(--c-border);
}
.roi-card-semfds:hover { opacity: 1; }

/* ── Cabeçalho do card ── */
.roi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  background: var(--c-surface);
  user-select: none;
  gap: 12px;
}
.roi-card-header:hover { background: var(--c-surface-2); }
.roi-card-header-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.roi-card-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.roi-semana-num {
  font-size: 14px;
  font-weight: 800;
  color: var(--c-text);
  min-width: 72px;
}
.roi-semana-periodo {
  font-size: 12px;
  color: var(--c-text-muted);
  min-width: 110px;
}
.roi-semana-dias {
  font-size: 11.5px;
  font-weight: 600;
  color: #f97316;
  display: flex;
  align-items: center;
  gap: 5px;
}
.roi-semana-dias-vazio {
  color: var(--c-text-pale);
  font-weight: 400;
}

/* ── Badge de status ── */
.roi-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.roi-status-positivo { background: #dcfce7; color: #15803d; }
.roi-status-negativo { background: #fee2e2; color: #b91c1c; }
.roi-status-pendente { background: #fef9c3; color: #a16207; }
.roi-status-neutro   { background: var(--c-bg-2); color: var(--c-text-muted); }

/* ── Multiplicador ROI no cabeçalho ── */
.roi-multiplier {
  font-size: 12px;
  font-weight: 800;
  color: var(--c-primary);
  background: var(--c-primary-light);
  padding: 3px 8px;
  border-radius: 20px;
}

/* ── Chevron ── */
.roi-chevron {
  color: var(--c-text-pale);
  font-size: 12px;
  transition: transform 0.22s ease;
}

/* ── Corpo do card ── */
.roi-card-body {
  border-top: 1px solid var(--c-border);
}

/* ── Seção de barras comparativas ── */
.roi-compare-section {
  padding: 18px 20px 14px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}
.roi-compare-bars { display: flex; flex-direction: column; gap: 10px; }
.roi-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 110px;
  align-items: center;
  gap: 10px;
}
.roi-bar-label {
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--c-text-muted);
}
.roi-bar-track {
  height: 10px;
  background: var(--c-bg-2);
  border-radius: 5px;
  overflow: hidden;
}
.roi-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}
.roi-bar-fill-custo { background: linear-gradient(90deg, #f97316, #fb923c); }
.roi-bar-fill-fatur { background: linear-gradient(90deg, #16a34a, #22c55e); }
.roi-bar-valor {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.roi-bar-valor-custo { color: #f97316; }
.roi-bar-valor-fatur { color: #16a34a; }

/* ── Indicadores numéricos ── */
.roi-indicators {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.roi-indicator {
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-align: center;
}
.roi-indicator-pos { background: #dcfce7; }
.roi-indicator-neg { background: #fee2e2; }
.roi-indicator-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--c-text-muted); margin-bottom: 2px; }
.roi-indicator-value { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.roi-indicator-pos .roi-indicator-value { color: #15803d; }
.roi-indicator-neg .roi-indicator-value { color: #b91c1c; }

/* ── Seção de detalhamento por equipe ── */
.roi-equipes-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
}
.roi-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.roi-equipe-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 12.5px;
}
.roi-equipe-row:last-child { border-bottom: none; }
.roi-equipe-name { color: var(--c-text-muted); display: flex; align-items: center; gap: 6px; }
.roi-equipe-valor { font-weight: 700; color: #f97316; font-variant-numeric: tabular-nums; }

/* ── Seção de input de faturamento ── */
.roi-input-section {
  padding: 16px 20px;
}
.roi-input-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.roi-input-group { display: flex; flex-direction: column; gap: 5px; }
.roi-input-obs { flex: 1; min-width: 200px; }
.roi-input-label { font-size: 11px; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.roi-input-prefix-wrap { position: relative; display: flex; align-items: center; }
.roi-input-prefix {
  position: absolute;
  left: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text-muted);
  pointer-events: none;
}
.roi-fat-input {
  height: 36px;
  border: 1.5px solid var(--c-border-strong);
  border-radius: var(--radius-md);
  padding: 0 12px 0 30px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  background: var(--c-surface);
  width: 160px;
  transition: border-color 0.15s;
  font-variant-numeric: tabular-nums;
}
.roi-input-obs .roi-fat-input {
  padding: 0 12px;
  font-weight: 400;
  font-size: 13px;
  width: 100%;
}
.roi-fat-input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(22,163,74,0.12); }
.roi-input-actions { display: flex; gap: 6px; align-items: flex-end; }
.roi-btn-limpar {
  background: #fff0f0;
  border: 1px solid #fecaca;
  color: #dc2626;
}
.roi-btn-limpar:hover { background: #fee2e2; }
.roi-last-update {
  margin-top: 8px;
  font-size: 11px;
  color: var(--c-text-pale);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Readonly ── */
.roi-readonly-fat {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--c-text-muted);
}
.roi-readonly-fat-vazio { color: var(--c-text-pale); font-style: italic; }
.roi-obs-text { color: var(--c-text-muted); font-style: italic; }

/* ── Sem FDS msg ── */
.roi-no-fds-msg {
  padding: 14px 20px;
  font-size: 12.5px;
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}

/* ── Responsivo ── */
@media (max-width: 768px) {
  .roi-kpi-strip { padding: 0 8px; }
  .roi-kpi { padding: 12px 8px; min-width: 120px; }
  .roi-kpi-value { font-size: 15px; }
  .roi-bar-row { grid-template-columns: 130px 1fr 90px; }
  .roi-card-header-left { flex-wrap: wrap; gap: 6px; }
  .roi-semana-periodo { min-width: unset; }
}
@media (max-width: 600px) {
  .roi-bar-row { grid-template-columns: 1fr; gap: 4px; }
  .roi-bar-track { height: 8px; }
  .roi-input-row { flex-direction: column; }
  .roi-fat-input { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   ROI — CARDS DE EQUIPE (dentro das semanas)
══════════════════════════════════════════════════════════════ */

/* Badge numérico da semana no header */
.roi-semana-badge {
  width: 34px; height: 34px;
  background: var(--c-primary-light);
  color: var(--c-primary-deeper);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  flex-shrink: 0;
}

/* Contagem de equipes no header da semana */
.roi-equipes-count {
  font-size: 11px; font-weight: 600;
  color: var(--c-text-muted);
  background: var(--c-bg-2);
  padding: 3px 8px; border-radius: 20px;
  display: flex; align-items: center; gap: 4px;
}

/* Totais da semana (seção de barras no topo do body) */
.roi-semana-totais {
  padding: 16px 20px 12px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}
.roi-semana-total-row { display: flex; flex-direction: column; gap: 8px; }
.roi-semana-inds {
  display: flex; gap: 10px; margin-top: 12px;
  flex-wrap: wrap;
}

/* Título "Detalhamento por equipe" */
.roi-equipes-titulo {
  padding: 10px 20px 8px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--c-text-muted);
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}

/* Lista de cards de equipe */
.roi-equipes-lista {
  display: flex; flex-direction: column;
}

/* ── Card individual de equipe ── */
.roi-eq-card {
  border-bottom: 1px solid var(--c-border);
}
.roi-eq-card:last-child { border-bottom: none; }

.roi-eq-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 11px 20px 11px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.roi-eq-header:hover { background: var(--c-surface-2); }
.roi-eq-header-left  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.roi-eq-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.roi-eq-avatar {
  width: 32px; height: 32px;
  background: var(--c-primary-light);
  color: var(--c-primary-deeper);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
}
.roi-eq-nome { font-size: 13px; font-weight: 700; color: var(--c-text); }
.roi-eq-sup  { font-size: 10.5px; color: var(--c-text-pale); margin-top: 1px; display: flex; align-items: center; gap: 3px; }

/* Barras dentro do card de equipe */
.roi-eq-bars {
  padding: 12px 20px 10px;
  background: var(--c-bg);
  display: flex; flex-direction: column; gap: 7px;
  border-bottom: 1px dashed var(--c-border);
}

/* Indicadores dentro do card de equipe */
.roi-eq-indicators {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px dashed var(--c-border);
}
.roi-eq-ind {
  flex: 1; min-width: 90px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  text-align: center;
}
.roi-eq-ind-pos { background: #dcfce7; }
.roi-eq-ind-neg { background: #fee2e2; }
.roi-eq-ind-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--c-text-muted); margin-bottom: 2px; }
.roi-eq-ind-value { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.roi-eq-ind-pos .roi-eq-ind-value { color: #15803d; }
.roi-eq-ind-neg .roi-eq-ind-value { color: #b91c1c; }

/* Input de faturamento dentro do card de equipe */
.roi-eq-input {
  padding: 12px 20px 12px 16px;
  background: var(--c-surface);
}

/* Responsivo */
@media (max-width: 768px) {
  .roi-eq-header { padding: 10px 14px; }
  .roi-semana-totais { padding: 12px 14px; }
  .roi-equipes-titulo { padding: 8px 14px; }
  .roi-eq-bars { padding: 10px 14px; }
  .roi-eq-indicators { padding: 8px 14px; }
  .roi-eq-input { padding: 10px 14px; }
  .roi-semana-inds { gap: 6px; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE — SISTEMA RESPONSIVO COMPLETO
   Breakpoints: ≤768px (mobile), ≤480px (small phone)
══════════════════════════════════════════════════════════════ */

/* ── Overlay da sidebar (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ── Botão fechar sidebar (mobile) ── */
.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  width: 32px; height: 32px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: background .15s;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,0.14); }

/* ── Bottom navigation bar (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  z-index: 150;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-pale);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 4px;
  border-radius: 10px;
  transition: color .15s, background .15s;
  min-width: 0;
  letter-spacing: 0;
}
.bottom-nav-item i {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 1px;
}
.bottom-nav-item span {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 56px;
}
.bottom-nav-item.active {
  color: var(--c-primary);
  background: var(--c-primary-light);
}
.bottom-nav-item:active { transform: scale(.93); }

/* ── body scroll lock quando sidebar aberta no mobile ── */
body.sidebar-open { overflow: hidden; }

/* ══════════════════════════════════════════════════════════════
   BREAKPOINT ≤ 768px — MOBILE PRINCIPAL
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Variáveis mobile */
  :root {
    --topbar-h: 54px;
  }

  /* ----- Layout ----- */
  .app-container { flex-direction: column; }
  .main-content  { margin-left: 0 !important; }

  /* ----- Sidebar: drawer deslizante ----- */
  .sidebar {
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    position: fixed;
    z-index: 200;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.3);
  }
  .sidebar.collapsed { width: 280px !important; transform: translateX(-100%); }
  .sidebar.collapsed.open { transform: translateX(0); }
  .sidebar-close-btn { display: flex; }

  /* ----- Topbar mobile ----- */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 15px; }
  .topbar-role-badge { display: none !important; }
  .badge-realtime-label { display: none; }
  .topbar-user-name { display: none; }
  .topbar-user-btn .fa-chevron-down { display: none; }
  .topbar-logout-label { display: none; }
  .topbar-logout-btn { padding: 0 8px !important; min-width: 34px; }

  /* ----- Page content com padding bottom para bottom nav ----- */
  .page-content {
    padding: 14px 12px;
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 12px);
  }

  /* ----- Bottom nav visível ----- */
  .bottom-nav { display: flex; }

  /* ----- Grids: 1 coluna ----- */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

  /* ----- Stat cards menores ----- */
  .stat-card { padding: 14px; }
  .stat-value { font-size: 18px !important; }
  .stat-icon  { width: 38px; height: 38px; font-size: 15px; }

  /* ----- Cards ----- */
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-body   { padding: 12px 14px !important; }
  .card-title  { font-size: 13px !important; }

  /* ----- Section header ----- */
  .section-header { flex-wrap: wrap; gap: 10px; }
  .section-header > div:last-child { width: 100%; display: flex; justify-content: flex-end; }
  .section-title { font-size: 17px; }

  /* ----- Divider label ----- */
  .divider-label { font-size: 10px; gap: 6px; flex-wrap: wrap; }

  /* ----- Tabelas ----- */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }

  /* ----- Modais: full-screen mobile ----- */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 20px 20px 0 0 !important;
    max-height: 92vh;
    overflow-y: auto;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }
  .modal-lg, .modal-xl, .modal-sm { max-width: 100% !important; width: 100% !important; }

  /* ----- Buttons: maior área de toque ----- */
  .btn-sm { padding: 6px 12px !important; font-size: 12px !important; }
  .btn    { min-height: 36px; }

  /* ----- Filter bar ----- */
  .filter-bar { flex-direction: column; gap: 8px; }
  .filter-bar .form-group { min-width: unset !important; width: 100%; }
  .filter-bar .btn { width: 100%; justify-content: center; }

  /* ----- Toast: reposicionado para acima do bottom nav ----- */
  .toast-container {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
    left: 12px;
    width: auto !important;
  }
  .toast { font-size: 13px; padding: 10px 14px; }

  /* ----- Dashboard: grids internos ----- */
  /* Gráfico YTD + Donut → coluna única */
  .main-content [style*="grid-template-columns:2fr 1fr"],
  .main-content [style*="grid-template-columns: 2fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
  }
  /* Custo equipe + Semanas → coluna única */
  .main-content [style*="grid-template-columns:1fr 1fr"],
  .main-content [style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
  }
  /* ROI: gráfico + tabela → coluna única */
  .main-content [style*="grid-template-columns:1fr 340px"],
  .main-content [style*="grid-template-columns: 1fr 340px"] {
    display: flex !important;
    flex-direction: column !important;
  }
  /* Ranking + painel lateral → coluna única */
  .main-content [style*="grid-template-columns:1fr 320px"],
  .main-content [style*="grid-template-columns: 1fr 320px"] {
    display: flex !important;
    flex-direction: column !important;
  }
  /* ROI KPI strip: 4 colunas → 2 colunas no mobile */
  .main-content [style*="grid-template-columns:repeat(4,1fr)"],
  .main-content [style*="grid-template-columns: repeat(4, 1fr)"],
  .main-content [style*="grid-template-columns:repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ----- ROI KPI grid: 2 colunas no mobile ----- */
  .roi-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .roi-kpi-card { padding: 12px 14px; }
  .roi-kpi-card-value { font-size: 17px; }

  /* ----- ROI KPI cards inline (dashboard) ----- */
  /* KPI value menor no mobile */
  .main-content [style*="font-size:20px;font-weight:800"] {
    font-size: 15px !important;
  }

  /* ----- Ranking: ocultar colunas secundárias no mobile ----- */
  /* Colunas: #, Equipe, Supervisor, Progresso, Custo RF, YTD, Part.%, Status */
  /* Ocultar: Supervisor(3ª), YTD(6ª), Part.%(7ª) */
  .table thead tr th:nth-child(3),
  .table tbody tr td:nth-child(3),
  .table thead tr th:nth-child(6),
  .table tbody tr td:nth-child(6),
  .table thead tr th:nth-child(7),
  .table tbody tr td:nth-child(7) { display: none !important; }

  /* ----- Section header: wrap no mobile ----- */
  .section-header > div:first-child { min-width: 0; }
  .section-header > div:last-child { flex-wrap: wrap; gap: 6px !important; }
  .section-header .btn { min-height: 36px !important; padding: 4px 10px !important; font-size: 12px !important; }

  /* ----- ROI cards de semana ----- */
  .roi-card { border-radius: 10px; }
  .roi-card-header { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .roi-semana-inds  { gap: 5px; flex-wrap: wrap; }
  .roi-semana-ind   { min-width: 70px; padding: 8px; }
  .roi-bar-label    { font-size: 11px; }

  /* ----- Login ----- */
  .login-brand { display: none; }
  .login-form-col { border-radius: 20px 20px 0 0; width: 100%; max-width: 100% !important; min-height: 100dvh; padding: 32px 20px; }
  .login-panel { max-width: 100%; }

  /* ----- Planejamento tabs/stepper ----- */
  .stepper { overflow-x: auto; gap: 4px; }
  .step-item { min-width: 52px; font-size: 10px; }

  /* ----- Charts: altura reduzida no mobile ----- */
  canvas { max-height: 260px; }
}

/* ══════════════════════════════════════════════════════════════
   BREAKPOINT ≤ 480px — PHONE PEQUENO
══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .page-content { padding: 10px 10px; padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 10px); }
  .roi-kpi-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .roi-kpi-card-value { font-size: 15px; }
  .roi-kpi-card { padding: 10px 11px; }
  .roi-kpi-card-label { font-size: 9.5px; }
  .stat-value { font-size: 16px !important; }
  .topbar-title { font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .divider-label span:last-child { display: none; }
  .section-header .section-subtitle { font-size: 11px; }
  .bottom-nav-item span { font-size: 9px; }
  .bottom-nav-item i   { font-size: 17px; }
  canvas { max-height: 220px; }
  .modal { max-height: 96vh; }
}

/* ══════════════════════════════════════════════════════════════
   VIEWPORT META & TOUCH IMPROVEMENTS
══════════════════════════════════════════════════════════════ */
/* Scroll suave no iOS */
.page-content, .sidebar-menu, .table-responsive {
  -webkit-overflow-scrolling: touch;
}
/* Evitar zoom em inputs no iOS */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
  /* Área de toque mínima de 44px */
  .sidebar-item { min-height: 44px; }
  .btn { min-height: 40px; }
  .topbar-user-btn { min-height: 40px; }
  .btn-sidebar-toggle { width: 40px; height: 40px; }
}
