@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap');
@import "tokens/typography.css";
@import "tokens/colors.css";
@import "tokens/spacing.css";
@import "tokens/effects.css";

/* ===================== Reset base ===================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--blue-500); }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: var(--tracking-display); margin: 0; }
button { font-family: inherit; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
section { padding: var(--section-y) 0; }
.eyebrow {
  display: inline-flex; font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--blue-600); margin-bottom: 16px;
}
h2.section-title { font-size: clamp(28px, 3.4vw, 40px); font-weight: 700; line-height: 1.15; }
.lede { font-size: 18px; line-height: 1.6; color: var(--text-secondary); max-width: 640px; margin: 18px 0 0; }
.grid { display: grid; gap: 20px; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.hide-m { }
.show-m-only { display: none; }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
  .split-2col { grid-template-columns: 1fr !important; }
  .sticky-col { position: static !important; }
}
@media (max-width: 640px) {
  .g4, .g3 { grid-template-columns: 1fr; }
  section { padding: 72px 0; }
  .hide-m { display: none !important; }
  .show-m-only { display: flex; }
}

/* ===================== Menu toggle (mobile hamburger) ===================== */
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--surface-card); color: var(--text-primary); cursor: pointer; flex-shrink: 0; padding: 0;
}
.menu-toggle:hover { border-color: var(--blue-400); color: var(--blue-600); }
/* Sino de notificações reaproveita o visual de .menu-toggle, mas fica sempre
   visível (não é um controle exclusivo de mobile como o hambúrguer). */
#notifToggle { display: inline-flex; }

/* ===================== Botões ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: var(--radius-full);
  font-size: 14.5px; font-weight: 500; border: 1px solid transparent; cursor: pointer;
  transition: var(--transition-base); white-space: nowrap;
}
.btn:hover { transform: var(--hover-lift); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn-primary-bg, var(--brand)); color: var(--text-on-brand); box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-secondary { background: var(--surface-card); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { border-color: var(--blue-400); color: var(--blue-600); }
.btn-inverse { background: rgba(255,255,255,.08); color: var(--text-inverse); border-color: var(--border-inverse); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 15.5px; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 13.5px; }
.btn-full { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ===================== Formulários ===================== */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13.5px; font-weight: 500; color: var(--text-secondary); }
.input, select.input, textarea.input {
  height: 46px; border-radius: var(--radius-md); border: 1px solid var(--border-default);
  padding: 0 14px; font-size: 15px; font-family: inherit; background: var(--surface-card);
  color: var(--text-primary); width: 100%; transition: var(--transition-base);
}
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.input:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring-focus); }
.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon-wrap .input { padding-left: 42px; }
.input-icon-wrap .ic { position: absolute; left: 14px; color: var(--text-muted); display: flex; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--purple-600); }
.form-error { font-size: 13px; color: var(--danger); margin-top: 4px; }

/* ===================== Cards ===================== */
.card {
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-card);
  transition: var(--transition-base);
}
.card-hover:hover { transform: var(--hover-lift); box-shadow: var(--shadow-md); border-color: var(--blue-400); }
.card-icon {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--blue-50); color: var(--blue-600); margin-bottom: 16px;
}
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; margin-bottom: 8px; }

/* ===================== Badges ===================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-full);
  font-size: 12.5px; font-weight: 600; background: var(--blue-50); color: var(--blue-600);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-inverse { background: rgba(255,255,255,.1); color: var(--text-inverse); }
.badge-neutral { background: var(--gray-100); color: var(--text-secondary); }

/* ===================== Tabelas ===================== */
.table-wrap { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow-x: auto; overflow-y: hidden; box-shadow: var(--shadow-card); -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14.5px; }
table.data-table th {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); text-align: left; padding: 14px 20px; border-bottom: 1px solid var(--border-default); background: var(--surface-subtle);
}
table.data-table td { padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--surface-subtle); }
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.empty-state { text-align: center; padding: 64px 24px; color: var(--text-muted); }

/* ===================== Alertas / Flash ===================== */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius-md); font-size: 14.5px; margin-bottom: 20px; }
.alert-success { background: var(--success-bg); color: #0a6b34; }
.alert-danger  { background: var(--danger-bg); color: #9c1d2d; }
.alert-warning { background: var(--warning-bg); color: #7a5205; }
.alert-info    { background: var(--info-bg); color: var(--blue-600); }

/* ===================== Header institucional ===================== */
.site-header {
  position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-subtle);
}
.site-header .inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 24px; }
.site-header nav { display: flex; gap: 28px; }
.site-header nav a { font-size: 14.5px; font-weight: 500; color: var(--text-secondary); }
.wordmark img { display: block; }

@media (max-width: 640px) {
  .site-header .inner { height: 64px; }
  .site-header .menu-toggle { display: inline-flex; }
  .site-header nav {
    display: none; flex-direction: column; gap: 0; position: fixed; top: 64px; left: 0; right: 0; z-index: 60;
    background: var(--surface-card); border-bottom: 1px solid var(--border-subtle); box-shadow: var(--shadow-lg); padding: 8px 0;
  }
  .site-header nav.open { display: flex; }
  .site-header nav a { padding: 14px var(--gutter); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; gap: 8px; }
}

/* ===================== Área logada (admin + portal) ===================== */
.app-shell { display: flex; min-height: 100vh; background: var(--surface-subtle); }
.app-shell.has-bg {
  background-size: cover; background-position: center; background-attachment: fixed;
  background-image: linear-gradient(rgba(248,250,252,.94), rgba(248,250,252,.94)), var(--bg-image);
}
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--surface-card); border-right: 1px solid var(--border-default);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar img.brand { height: 34px; width: fit-content; margin: 4px 10px 26px; }
.navitem {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-md);
  font-size: 14.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: var(--transition-base);
}
.navitem:hover { background: var(--surface-subtle); color: var(--text-primary); }
.navitem.active { background: color-mix(in srgb, var(--menu-active, var(--blue-600)) 12%, white); color: var(--menu-active, var(--blue-600)); font-weight: 600; }
.navitem.danger { color: var(--danger); }
.sidebar .nav-footer { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border-subtle); padding-top: 12px; }

.main-col { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 32px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-default);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 20px; font-weight: 600; }
.main-content { padding: 32px; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 200; }
.sidebar-backdrop.open { display: block; }

@media (max-width: 960px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 210;
    transform: translateX(-100%); transition: transform var(--duration-base) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar { padding: 14px 18px; }
  .main-content { padding: 18px; }
}

.stat-box { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 18px; background: var(--surface-card); }
.stat-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-family: var(--font-mono); font-size: 30px; font-weight: 600; margin-top: 8px; }
.stat-delta { font-size: 13px; margin-top: 4px; font-weight: 500; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

.panel { background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.panel-body { padding: 24px; }

.embed-wrap { border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; background: var(--gray-50); }
.embed-wrap iframe { width: 100%; height: auto; aspect-ratio: 16 / 10; min-height: 320px; border: 0; display: block; }
.embed-slot { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); min-height: 260px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .04em; text-align: center; padding: 24px; }

@media (max-width: 640px) {
  .embed-wrap iframe { aspect-ratio: 3 / 4; min-height: 380px; }
}

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.toolbar .input { max-width: 280px; }

/* ===================== Login split ===================== */
.login-split { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-page); }
.login-form-side { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px,6vw,96px); }
.login-art-side {
  background: var(--gradient-inverse); display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 48px; position: relative; overflow: hidden;
}
.login-art-side::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--border-inverse) 1px, transparent 1px), linear-gradient(90deg, var(--border-inverse) 1px, transparent 1px);
  background-size: 56px 56px; opacity: .5;
}
@media (max-width: 900px) { .login-split { grid-template-columns: 1fr; } .login-art-side { display: none; } }

/* Utility */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:32px}
.flex{display:flex}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-1{gap:8px}.gap-2{gap:16px}
