/* ======================================================
   RESET & BASE
====================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

body {
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  color: #0f172a;
  line-height: 1.6;
}

/* ======================================================
   VARIÁVEIS
====================================================== */
:root {
  --primary: #2563eb;
  --secondary: #22c55e;
  --accent: #fb7185;

  --header-dark: #020617;
  --header-mid: #0f172a;

  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;

  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;

  --radius: 14px;
  --radius-sm: 10px;

  --shadow-sm: 0 6px 16px rgba(2, 6, 23, 0.08);
  --shadow-md: 0 18px 40px rgba(2, 6, 23, 0.12);

  --transition: 0.25s ease;
}

/* ======================================================
   HEADER
====================================================== */
.main-header {
  background: linear-gradient(135deg, var(--header-dark), var(--header-mid));
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1180px;
  margin: auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  height: 120px;
  margin-top: -10px;
  margin-bottom: -10px;
  filter: drop-shadow(0 4px 10px rgba(255,255,255,0.3));
}

/* ======================================================
   NAV
====================================================== */
.main-nav {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 500;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--secondary);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
}

.logout-btn {
  background: transparent;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ======================================================
   AUTH OVERLAY
====================================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 22% 18%, rgba(59, 130, 246, 0.35), transparent 36%),
              radial-gradient(circle at 78% 10%, rgba(45, 212, 191, 0.35), transparent 40%),
              linear-gradient(135deg, #13233a, #0e1b2d 55%, #0f2e35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.auth-card {
  width: min(420px, 95vw);
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  border: 1px solid #1f2937;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 14px;
  color: #e2e8f0;
}

.auth-logo {
  width: 250px;
  justify-self: center;
  filter: drop-shadow(0 6px 14px rgba(37, 99, 235, 0.18));
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eef2ff;
  color: var(--primary);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  width: fit-content;
}

.auth-card h1 {
  margin: 0;
  color: #f8fafc;
  font-size: 1.4rem;
}

.auth-subtitle {
  color: #cbd5e1;
  margin-bottom: 4px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  font-weight: 600;
  color: #e2e8f0;
}

.auth-form input {
  padding: 12px 14px;
  border: 1px solid #1f2937;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.auth-hint {
  color: #cbd5e1;
  font-size: 0.95rem;
  text-align: center;
}

.summary-card-ano {
  display: grid;
  gap: 10px;
}

.ano-metrics {
  display: grid;
  gap: 6px;
}

.ano-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--bg-muted);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.ano-metric span {
  color: var(--text-muted);
}

.ano-metric strong {
  color: var(--text-dark);
}

.ano-metric.saldo-positivo strong {
  color: #16a34a;
}

.ano-metric.saldo-negativo strong {
  color: #dc2626;
}

/* INVENTÁRIO */
.low-stock {
  color: #b91c1c;
  font-weight: 700;
}

body.auth-locked main,
body.auth-locked header {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

.readonly-banner {
  max-width: 1200px;
  margin: 10px auto;
  padding: 10px 14px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ======================================================
   MAIN
====================================================== */
main {
  max-width: 1200px;
  margin: 48px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ======================================================
   SECTIONS / CARDS
====================================================== */
section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 26px 30px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

section:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ======================================================
   SECTION HEADER
====================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

/* ======================================================
   TITLES
====================================================== */
section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--secondary);
}

/* ======================================================
   DASHBOARD GRID
====================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.eventos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.evento-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 12px;
}

.evento-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.evento-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-dark);
}

.evento-dates {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.evento-dept {
  background: #eef2ff;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.evento-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.evento-metric {
  background: var(--bg-muted);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.evento-metric span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.evento-metric strong {
  color: var(--text-dark);
  font-size: 1.05rem;
}

.evento-desc {
  margin: 0;
  color: var(--text-dark);
  font-size: 0.95rem;
}

.evento-actions {
  display: flex;
  gap: 8px;
}

.evento-actions button {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: var(--text-dark);
}

/* ======================================================
   QUICK ACTIONS
====================================================== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

/* ======================================================
   SUMMARY BLOCKS
====================================================== */
.summary-block {
  background: var(--bg-muted);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.summary-title {
  font-weight: 700;
  color: var(--text-dark);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.summary-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  display: grid;
  gap: 8px;
}
.summary-card .label {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.summary-card .value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.quick-card {
  border: 1px solid #e2e8f0;
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: left;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  color: inherit;
  text-decoration: none;
}

.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
}

.quick-card.primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
}

.quick-card.ghost {
  background: white;
}

.quick-card.neutral {
  background: #f8fafc;
}

.quick-title {
  font-weight: 700;
}

.quick-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.quick-card.primary .quick-desc {
  color: rgba(255,255,255,0.9);
}

.quick-cta {
  font-weight: 600;
  color: var(--primary);
}

.quick-card.primary .quick-cta {
  color: white;
}

.export-form {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.export-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.export-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.export-action {
  width: fit-content;
}

/* ======================================================
   MODAL EXPORTAÇÃO
====================================================== */
.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: min(520px, 100%);
  padding: 18px 20px;
  display: grid;
  gap: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dark);
  font-size: 1rem;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ======================================================
   BUTTONS
====================================================== */
button,
.main-action {
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

.ghost-action {
  background: transparent;
  color: var(--text-dark);
  border: 1px solid #e2e8f0;
}

button:hover,
.main-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.2);
}

button:not(.main-action) {
  background: var(--bg-muted);
  color: var(--text-dark);
}

/* ======================================================
   FORMS
====================================================== */
.styled-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

label {
  font-weight: 600;
  font-size: 0.85rem;
}

input,
select,
textarea {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ======================================================
   FORM BUTTONS
====================================================== */
.form-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

/* ======================================================
   FILTROS
====================================================== */
.filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* ======================================================
   TABLE
====================================================== */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

thead {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

th,
td {
  padding: 12px 10px;
  font-size: 0.85rem;
  text-align: left;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

tbody tr:hover {
  background: #eef2ff;
}

/* ======================================================
   CHART
====================================================== */
.chart-wrap {
  margin: 16px auto 8px;
  max-width: 720px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
}

.chart-wrap canvas {
  width: 100% !important;
  height: 220px !important;
}

.chart-wrap h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: var(--text-dark);
}

/* ======================================================
   ANIMATIONS
====================================================== */

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.fade-in {
  animation: fadeInUp 0.6s ease both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======================================================
   NOTIFICATIONS
====================================================== */
.notification {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  background: var(--bg-card);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
  animation: slideIn 0.3s ease;
}

.notification .notification-icon {
  font-size: 1rem;
}

.notification .notification-message {
  font-weight: 600;
}

.notification.error {
  border-color: #fecdd3;
  color: #be123c;
  background: #fff1f2;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

