:root {
  --gp-green: #2E7D32;
  --gp-green-light: #66BB6A;
  --gp-green-dark: #1B5E20;
  --gp-green-pale: #E8F5E9;
  --sidebar-width: 240px;
}

/* ========== LAYOUT ========== */
body { background: #F5F5F5; font-family: system-ui, sans-serif; }
#wrapper { min-height: 100vh; }

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--gp-green-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.2s;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-brand {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,.2);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 6px;
  padding: 3px 5px;
  flex-shrink: 0;
}
.brand-icon img { height: 22px; display: block; }
.sidebar-nav { list-style: none; padding: 8px 0; margin: 0; flex: 1; }
.nav-section {
  padding: 8px 16px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  margin-top: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.nav-section:hover { color: rgba(255,255,255,.7); }
.nav-caret { transition: transform .15s; font-size: 0.7rem; }
.nav-section[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }
.nav-subsection { list-style: none; padding: 0; margin: 0; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 0;
  transition: background .15s;
  white-space: nowrap;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.1); color: white; }
.sidebar-nav .nav-link.active { background: var(--gp-green); color: white; font-weight: 600; }
.sidebar-nav .nav-link.disabled { color: rgba(255,255,255,.3); cursor: default; }
.icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 12px 16px;
  background: rgba(0,0,0,.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-info { color: rgba(255,255,255,.8); font-size: .8rem; }
.btn-logout {
  color: rgba(255,255,255,.6);
  font-size: .75rem;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.3);
  padding: 3px 8px;
  border-radius: 4px;
}
.btn-logout:hover { color: white; }

/* ========== CONTENT ========== */
#content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: white;
  border-bottom: 1px solid #e0e0e0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.btn-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gp-green-dark);
}
.topbar-title { font-weight: 600; color: #333; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.badge-user {
  background: var(--gp-green);
  color: white;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}
.topbar-user { font-size: .85rem; color: #555; }
.content-area { padding: 20px; flex: 1; }

/* ========== METRICS ========== */
.metric-card {
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: default;
  transition: transform .1s;
}
.metric-card:hover { transform: translateY(-1px); }
.metric-prod { background: linear-gradient(135deg, #2E7D32, #43A047); color: white; }
.metric-exp { background: linear-gradient(135deg, #1565C0, #1976D2); color: white; }
.metric-estoque { background: linear-gradient(135deg, #E65100, #F57C00); color: white; }
.metric-label { font-size: .75rem; opacity: .9; margin-bottom: 4px; }
.metric-value { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.metric-sub { font-size: .7rem; opacity: .8; }
.metric-weight { font-size: .9rem; font-weight: 600; margin-top: 4px; }

.detail-card {
  background: white;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  font-size: .82rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #eee;
}
.detail-row:last-child { border-bottom: none; }

/* ========== TABLES ========== */
.gp-thead th { background: var(--gp-green) !important; color: white !important; font-size: .82rem; }
.gp-card-header { background: var(--gp-green); color: white; font-weight: 600; }
.font-mono { font-family: monospace; }
.btn-xs { padding: 2px 8px; font-size: .75rem; }

/* ========== BADGE TIPO ========== */
.badge-tipo { font-size: .7rem; padding: 2px 8px; border-radius: 10px; color: white; font-weight: 600; }
.tipo-producao { background: var(--gp-green); }
.tipo-expedicao { background: #1565C0; }
.tipo-cancelamento { background: #c62828; }
.tipo-reentrada { background: #E65100; }

/* ========== LOGIN ========== */
.login-body { background: linear-gradient(135deg, var(--gp-green-dark), var(--gp-green)); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 380px; padding: 20px; }
.login-card { background: white; border-radius: 16px; padding: 36px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.login-logo { font-size: 3rem; text-align: center; }
.login-title { text-align: center; font-weight: 700; color: var(--gp-green-dark); margin: 8px 0 4px; }
.login-subtitle { text-align: center; color: #777; font-size: .85rem; margin-bottom: 24px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; }
  .sidebar.open { width: var(--sidebar-width); }
  #content { margin-left: 0; }
}
