:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #b91c1c;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }

/* Tela de Login / Auth com movimento sutil */
.auth-page {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
}
.auth-page::before, .auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.28;
  pointer-events: none;
  animation: floatOrb 14s ease-in-out infinite alternate;
}
.auth-page::before {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -80px;
  background: var(--accent);
}
.auth-page::after {
  width: 380px;
  height: 380px;
  bottom: -110px;
  right: -70px;
  background: #2563eb;
  animation-delay: -6s;
}
.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.12);
  animation: cardEnter 0.55s var(--ease-out) both;
}
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(185, 28, 28, 0.09);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.auth-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-footer a { color: var(--ink); font-weight: 600; transition: color 0.2s; }
.auth-footer a:hover { color: var(--accent); }

/* Shell Administrativo */
.admin-shell { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #090f1d 100%);
  color: var(--sidebar-text);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand {
  color: #fff;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
  padding: 8px 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.sidebar-nav a {
  position: relative;
  padding: 9px 13px;
  border-radius: 9px;
  font-size: 0.87rem;
  font-weight: 500;
  transition: background 0.2s var(--ease-out), color 0.2s, transform 0.2s var(--ease-out);
  display: block;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; transform: translateX(3px); }
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 99px;
  background: var(--accent);
}

.main-wrap { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.topbar h1 { margin: 0; font-family: 'Manrope', 'Segoe UI', sans-serif; font-size: 1.24rem; font-weight: 800; letter-spacing: -0.02em; }
.content-area { padding: 26px 30px; animation: fadeIn 0.35s var(--ease-out); }

/* KPIs & Painéis com movimento suave */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), border-color 0.25s;
  animation: cardEnter 0.45s var(--ease-out) both;
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}
.kpi-label { font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.kpi-val { font-family: 'Manrope', 'Segoe UI', sans-serif; font-size: 1.8rem; font-weight: 800; margin-top: 6px; letter-spacing: -0.03em; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
  animation: cardEnter 0.48s var(--ease-out) both;
}
.panel h2, .panel h3 { margin: 0 0 16px; font-family: 'Manrope', 'Segoe UI', sans-serif; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.015em; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.74rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; font-weight: 700; }
tbody tr { transition: background 0.16s ease; }
tbody tr:hover { background: #f8fafc; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.82rem; font-weight: 600; color: #334155; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.92rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.13);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.89rem;
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), box-shadow 0.2s, filter 0.18s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-dark { background: #0f172a; }
.btn-outline { background: #fff; color: #0f172a; border: 1px solid #cbd5e1; }
.btn-outline:hover { background: #f8fafc; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06); }
.btn-sm { padding: 6px 11px; font-size: 0.78rem; border-radius: 7px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.73rem; font-weight: 700; background: #e2e8f0; color: #334155; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }

.editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px; background: #f8fafc; border: 1px solid #cbd5e1; border-bottom: none; border-radius: 9px 9px 0 0; }
.editor-toolbar button { padding: 6px 10px; border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; cursor: pointer; font-size: 0.82rem; font-family: inherit; transition: background 0.15s, border-color 0.15s; }
.editor-toolbar button:hover { background: #f1f5f9; border-color: #94a3b8; }
.editor-canvas { min-height: 330px; border: 1px solid #cbd5e1; border-radius: 0 0 9px 9px; padding: 16px; background: #fff; outline: none; line-height: 1.75; }

.flash { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 0.9rem; font-weight: 500; animation: cardEnter 0.35s var(--ease-out) both; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.bar-row { display: grid; grid-template-columns: 145px 1fr 48px; gap: 12px; align-items: center; margin-bottom: 10px; font-size: 0.85rem; }
.bar-track { background: #f1f5f9; height: 10px; border-radius: 999px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, var(--accent), #ef4444); height: 100%; border-radius: 999px; transition: width 0.85s var(--ease-out); }

.theme-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.theme-option { display: block; border: 2px solid var(--border); border-radius: 12px; padding: 13px; cursor: pointer; background: #f8fafc; transition: border-color 0.2s, transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s; }
.theme-option input[type="radio"] { display: none; }
.theme-option:hover { border-color: #94a3b8; transform: translateY(-2px); background: #fff; }
.theme-option.selected { border-color: var(--accent); background: #fff; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08); }
.theme-option-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
@media (max-width: 720px) { .theme-picker-grid { grid-template-columns: 1fr; } }

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes floatOrb {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(32px, 24px) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.admin-menu-btn { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--ink); font-size: 1.2rem; cursor: pointer; align-items: center; justify-content: center; }
.admin-drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); z-index: 45; }
.admin-drawer-backdrop.is-open { display: block; }
@media (max-width: 920px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-menu-btn { display: inline-flex; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform 0.3s var(--ease-out); }
  .sidebar.is-open { transform: translateX(0); }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .topbar, .content-area { padding: 14px 16px; }
}

.ms-icon { font-family: 'Material Symbols Rounded'; font-size: 19px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; font-variation-settings: 'FILL' 0, 'wght' 420, 'GRAD' 0, 'opsz' 20; flex-shrink: 0; }
.sidebar-nav a { display: flex !important; align-items: center; gap: 10px; }
.sidebar-nav a .ms-icon { opacity: 0.78; }
.sidebar-nav a:hover .ms-icon, .sidebar-nav a.active .ms-icon { opacity: 1; color: #fff; }
