/* ════════════════════════════════════════════════════════════════════
   VER MED — Design System v02
   Paleta: azul marinho profundo + neutros + acentos semânticos
   ════════════════════════════════════════════════════════════════════ */

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

/* Anti-flash: itens com restrição nascem escondidos; app.js adiciona .permitido nos que podem aparecer */
[data-admin]:not(.permitido), [data-roles]:not(.permitido) { display: none !important; }

:root {
  --azul-marinho:   #042C53;
  --azul-profundo:  #0C447C;
  --azul-acao:      #185FA5;
  --azul-claro:     #DBEAFE;
  --azul-bg:        #E6F1FB;

  --branco:         #FFFFFF;
  --cinza-50:       #F8FAFC;
  --cinza-100:      #F1F5F9;
  --cinza-200:      #E2E8F0;
  --cinza-300:      #CBD5E1;
  --cinza-400:      #94A3B8;
  --cinza-500:      #64748B;
  --cinza-600:      #475569;
  --cinza-700:      #334155;
  --cinza-800:      #1E293B;
  --cinza-900:      #0F172A;

  --verde:          #10B981;
  --verde-bg:       #D1FAE5;
  --verde-texto:    #065F46;
  --amarelo:        #F59E0B;
  --amarelo-bg:     #FEF3C7;
  --amarelo-texto:  #92400E;
  --vermelho:       #DC2626;
  --vermelho-bg:    #FEE2E2;
  --vermelho-texto: #991B1B;
  /* Paleta do mockup VER MED — tons quentes e contraste */
  --bege-50:        #F1EFE8;
  --bege-100:       #E7E3D6;
  --verde-escuro:   #173404;
  --verde-medio:    #3B6D11;
  --verde-claro:    #EAF3DE;
  --ambar-fundo:    #FAEEDA;
  --ambar-borda:    #EF9F27;
  --ambar-texto:    #854F0B;
  --azul-card:      #E6F1FB;
  --azul-borda:     #378ADD;
  --rosa-fundo:     #FCEBEB;
  --rosa-texto:     #A32D2D;

  --fonte-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --fonte-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 10px 25px rgba(15, 23, 42, 0.10), 0 5px 10px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--fonte-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--cinza-800);
  background: var(--cinza-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; }
input, button, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--azul-acao); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--fonte-mono); }

/* ═══════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--cinza-50);
}

.login-page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 52%;
  background: var(--azul-marinho);
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 42px 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-modal);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 36px;
}

.login-brand .logo-mark { width: 30px; height: 30px; }
.login-brand .logo-text {
  font-size: 22px;
  font-weight: 600;
  color: var(--azul-marinho);
  letter-spacing: -0.015em;
}

.login-title {
  text-align: center;
  font-size: 14px;
  color: var(--cinza-500);
  margin: 0 0 28px;
  font-weight: 400;
}

.form-field { margin-bottom: 16px; }

.form-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--cinza-500);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  display: block;
  width: 100%;
  background: var(--cinza-100);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--cinza-900);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  background: var(--branco);
  border-color: var(--azul-acao);
  box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.12);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--cinza-400); }

.form-input:disabled, .form-select:disabled {
  background: var(--cinza-50);
  color: var(--cinza-400);
  cursor: not-allowed;
}

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

.form-help {
  font-size: 12px;
  color: var(--cinza-400);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--vermelho-texto);
  margin-top: 4px;
}

/* Input com botão dentro (ex: toggle de senha) */
.input-wrap {
  position: relative;
}

.input-wrap .form-input {
  padding-right: 38px;
}

.input-icon-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--cinza-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.input-icon-btn:hover {
  color: var(--cinza-700);
  background: var(--cinza-100);
}

.input-icon-btn svg { width: 18px; height: 18px; }

/* Botões */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, opacity 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--azul-marinho);
  color: var(--branco);
}
.btn-primary:hover { background: var(--azul-profundo); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--cinza-100);
  color: var(--cinza-700);
}
.btn-secondary:hover { background: var(--cinza-200); }

.btn-danger {
  background: var(--vermelho-bg);
  color: var(--vermelho-texto);
}
.btn-danger:hover { background: #FECACA; }

.btn-ghost {
  background: transparent;
  color: var(--cinza-600);
}
.btn-ghost:hover { background: var(--cinza-100); }

.btn-block { display: flex; width: 100%; margin-top: 20px; }

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--cinza-400);
}
.login-footer a { color: var(--cinza-500); }

.alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: none;
  line-height: 1.45;
}
.alert.show { display: block; }
.alert-error { background: var(--vermelho-bg); color: var(--vermelho-texto); }
.alert-success { background: var(--verde-bg); color: var(--verde-texto); }
.alert-warning { background: var(--amarelo-bg); color: var(--amarelo-texto); }

/* ═══════════════════════════════════════════════════════
   LAYOUT GERAL (pós-login)
   ═══════════════════════════════════════════════════════ */
.app-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  height: 100vh;
}
.app-layout.modo-foco {
  grid-template-columns: 1fr;
  grid-template-areas: "topbar" "main";
}
.app-layout.modo-foco .app-sidebar { display: none; }

.app-topbar {
  grid-area: topbar;
  background: var(--azul-marinho);
  color: var(--branco);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 10;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand .logo-mark { width: 22px; height: 22px; }
.topbar-brand .logo-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--branco);
  text-decoration: none;
}
.topbar-brand a { color: inherit; text-decoration: none; }
.topbar-brand a:hover { text-decoration: none; }

.topbar-actions { display: flex; align-items: center; gap: 18px; }

.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--azul-acao);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--branco);
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--branco);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255, 255, 255, 0.08); }

/* ── Botão de busca global na topbar ── */
.topbar-search-btn {
  flex: 1; max-width: 360px;
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.75);
  font-size: 13px; cursor: pointer;
  transition: background 0.15s;
}
.topbar-search-btn:hover { background: rgba(255,255,255,0.16); color: rgba(255,255,255,0.95); }
.topbar-search-text { flex: 1; text-align: left; }
.topbar-search-kbd {
  font-family: var(--fonte-sans); font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 3px;
  background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.12);
}

/* ── Botão do avatar (clicável, abre menu) ── */
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 100px;
  color: #fff; font-size: 13px; cursor: pointer;
  transition: background 0.15s;
}
.topbar-user:hover { background: rgba(255,255,255,0.16); }
.topbar-user svg { opacity: 0.7; }

/* ── Menu dropdown do avatar ── */
.user-menu {
  position: fixed; top: 56px; right: 16px;
  background: var(--branco);
  border: 1px solid var(--cinza-200);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(4,44,83,0.15);
  width: 280px; padding: 6px;
  z-index: 1000;
  display: none;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.user-menu.show { display: block; }
.user-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px; border-bottom: 1px solid var(--cinza-100);
  margin-bottom: 4px;
  position: sticky; top: -6px; background: var(--branco); z-index: 2;
}
.user-menu-header .avatar-lg {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--azul-marinho); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px;
}
.user-menu-nome { font-weight: 600; color: var(--cinza-900); font-size: 14px; }
.user-menu-role { font-size: 11px; color: var(--cinza-500); text-transform: capitalize; }
.user-menu-section { padding: 4px 0; }
.user-menu-section + .user-menu-section { border-top: 1px solid var(--cinza-100); }
/* Seção final (Meu perfil / Atalhos / Sair) sempre acessível no rodapé */
.user-menu-section:last-child {
  position: sticky; bottom: -6px;
  background: var(--branco);
  box-shadow: 0 -6px 10px -6px rgba(4,44,83,0.12);
  z-index: 2;
}
.user-menu-label {
  font-size: 10px; font-weight: 700; color: var(--cinza-400);
  letter-spacing: 0.6px; padding: 6px 10px 4px;
}
.user-menu a, .user-menu button.menu-item {
  display: block; width: 100%; text-align: left;
  padding: 6px 10px; border-radius: 6px;
  font-size: 13px; color: var(--cinza-700);
  text-decoration: none; background: transparent; border: none; cursor: pointer;
}
.user-menu a:hover, .user-menu button.menu-item:hover { background: var(--cinza-50); color: var(--azul-marinho); }
.user-menu .menu-sair { color: #DC2626; }
.user-menu .menu-sair:hover { background: #FEF2F2; color: #DC2626; }

/* ── Overlay de busca global ── */
.busca-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(4,44,83,0.35);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
.busca-overlay.show { display: flex; }
.busca-box {
  background: var(--branco);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(4,44,83,0.30);
  width: 100%; max-width: 600px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 160px);
  overflow: hidden;
}
.busca-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--cinza-100);
}
.busca-input-wrap svg { color: var(--cinza-400); flex-shrink: 0; }
.busca-input {
  flex: 1; border: none; outline: none;
  font-size: 15px; color: var(--cinza-900);
  background: transparent;
}
.busca-input::placeholder { color: var(--cinza-400); }
.busca-esc {
  font-family: var(--fonte-sans); font-size: 10px; font-weight: 600;
  padding: 3px 7px; border-radius: 4px;
  background: var(--cinza-100); color: var(--cinza-500);
}
.busca-resultados { overflow-y: auto; padding: 6px; max-height: 400px; }
.busca-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 6px;
  cursor: pointer; text-decoration: none; color: var(--cinza-900);
}
.busca-item:hover, .busca-item.focado { background: var(--cinza-50); }
.busca-item .av {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--cinza-100); color: var(--cinza-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.busca-item .info { flex: 1; min-width: 0; }
.busca-item .nm { font-size: 14px; font-weight: 500; color: var(--cinza-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.busca-item .mt { font-size: 12px; color: var(--cinza-500); }
.busca-vazio { padding: 24px 16px; text-align: center; color: var(--cinza-400); font-size: 13px; }
.busca-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; border-top: 1px solid var(--cinza-100);
  font-size: 11px; color: var(--cinza-400);
}

.app-sidebar {
  grid-area: sidebar;
  background: var(--bege-50);
  border-right: 1px solid var(--bege-100);
  padding: 16px 10px;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--cinza-700);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.6);
  color: var(--azul-marinho);
  text-decoration: none;
}
.sidebar-item.active {
  background: var(--branco);
  color: var(--azul-marinho);
  font-weight: 500;
}
.sidebar-item.disabled {
  color: var(--cinza-300);
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-divider {
  margin: 10px 16px;
  height: 1px;
  background: var(--cinza-200);
}

.sidebar-section-title {
  padding: 10px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cinza-400);
  font-weight: 500;
}

.app-main {
  grid-area: main;
  overflow-y: auto;
  padding: 28px 36px;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.page-title-group {
  flex: 1;
  min-width: 0;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--azul-marinho);
  margin: 0 0 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--cinza-500);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════
   CARDS DASHBOARD
   ═══════════════════════════════════════════════════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: var(--branco);
  border: 1px solid var(--cinza-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cinza-500);
  font-weight: 500;
  margin-bottom: 8px;
}

.card-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--azul-marinho);
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}

.card-detail {
  font-size: 13px;
  color: var(--cinza-500);
}

.bem-vindo {
  background: var(--branco);
  border: 1px solid var(--cinza-200);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}

.bem-vindo h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--azul-marinho);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.bem-vindo p {
  font-size: 14px;
  color: var(--cinza-600);
  margin: 0 0 16px;
  line-height: 1.6;
}

.bem-vindo .roadmap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.bem-vindo .roadmap-list li {
  font-size: 13px;
  color: var(--cinza-600);
  padding: 8px 12px;
  background: var(--cinza-50);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bem-vindo .roadmap-list .status-ok { color: var(--verde-texto); }
.bem-vindo .roadmap-list .status-pendente { color: var(--cinza-400); }

.version-badge {
  position: fixed;
  bottom: 14px;
  right: 18px;
  font-family: var(--fonte-mono);
  font-size: 10px;
  color: var(--cinza-400);
  background: var(--branco);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--cinza-200);
}

/* ═══════════════════════════════════════════════════════
   TABELAS (admin)
   ═══════════════════════════════════════════════════════ */
.table-container {
  background: var(--branco);
  border: 1px solid var(--cinza-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

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

.table thead th {
  background: var(--cinza-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cinza-500);
  border-bottom: 1px solid var(--cinza-200);
}

.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--cinza-100);
  vertical-align: top;
  color: var(--cinza-800);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--cinza-50); }

.table .col-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.table .text-mono {
  font-family: var(--fonte-mono);
  font-size: 12px;
  color: var(--cinza-500);
}

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--cinza-400);
  font-size: 14px;
}

.table-empty-title {
  font-size: 16px;
  color: var(--cinza-600);
  margin-bottom: 6px;
  font-weight: 500;
}

/* Badges de status */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge-success { background: var(--verde-bg); color: var(--verde-texto); }
.badge-warning { background: var(--amarelo-bg); color: var(--amarelo-texto); }
.badge-danger  { background: var(--vermelho-bg); color: var(--vermelho-texto); }
.badge-neutral { background: var(--cinza-100); color: var(--cinza-600); }
.badge-info    { background: var(--azul-bg); color: var(--azul-marinho); }

/* ═══════════════════════════════════════════════════════
   MODAIS
   ═══════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  overflow-y: auto;
  padding: 40px 16px;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: var(--branco);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  position: relative;
}

.modal-large { max-width: 800px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--cinza-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--azul-marinho);
  letter-spacing: -0.01em;
}

.modal-close {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--cinza-400);
  cursor: pointer;
  display: flex;
}
.modal-close:hover { color: var(--cinza-700); background: var(--cinza-100); }

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cinza-200);
  background: var(--cinza-50);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Fieldsets dentro de modais para organizar */
.fieldset {
  border: none;
  padding: 0;
  margin: 0 0 20px;
}

.fieldset-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cinza-500);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--cinza-200);
}

/* Grid de checkboxes (ex: unidades vinculadas) */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--cinza-50);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}
.checkbox-item:hover { background: var(--cinza-100); }
.checkbox-item input { margin: 0; }

/* Grid de dias da semana (horários) */
.dias-grid {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.dias-grid > div { padding: 4px 0; }
.dia-label { font-weight: 500; color: var(--cinza-600); }
.dia-input {
  background: var(--cinza-100);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  outline: none;
  color: var(--cinza-900);
  font-family: var(--fonte-mono);
}
.dia-input:focus {
  background: var(--branco);
  border-color: var(--azul-acao);
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--cinza-300);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--cinza-500);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--cinza-50);
}
.upload-area:hover {
  border-color: var(--azul-acao);
  background: var(--azul-bg);
  color: var(--azul-profundo);
}
.upload-area.has-file {
  background: var(--verde-bg);
  border-color: var(--verde);
  border-style: solid;
  color: var(--verde-texto);
}

.preview-imagem {
  max-width: 120px;
  max-height: 80px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--cinza-200);
  background: white;
  display: block;
}

/* Loading inline */
.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cinza-500);
  font-size: 13px;
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--cinza-200);
  border-top-color: var(--azul-acao);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast (notificações) */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--cinza-900);
  color: var(--branco);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-modal);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 360px;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-success { background: #064E3B; }
.toast-error   { background: #7F1D1D; }

/* Switch / toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--cinza-300);
  border-radius: 22px;
  transition: 0.2s;
}
.switch-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--branco);
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .switch-slider { background: var(--azul-acao); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }

/* Responsivo */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto 1fr;
    grid-template-areas: "topbar" "sidebar" "main";
  }
  .app-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--cinza-200);
    display: flex;
    overflow-x: auto;
    padding: 8px 12px;
    gap: 4px;
  }
  .sidebar-section-title, .sidebar-divider { display: none; }
  .sidebar-item {
    padding: 8px 14px;
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }
  .sidebar-item.active {
    border-bottom-color: var(--azul-marinho);
    border-left-color: transparent;
  }
  .app-main { padding: 18px; }
  .form-field-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════
   POLISH GLOBAL — D34
   ══════════════════════════════════════════════════════════════════ */

/* ── Toast melhorado ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  min-width: 260px;
  max-width: 420px;
  padding: 12px 16px;
  background: var(--branco);
  color: var(--cinza-900);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(4,44,83,0.18), 0 2px 6px rgba(4,44,83,0.08);
  font-size: 13px;
  font-weight: 500;
  z-index: 9000;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--azul-marinho);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast .toast-ic { flex-shrink: 0; display: flex; align-items: center; }
.toast .toast-msg { flex: 1; line-height: 1.4; }
.toast-success { border-left-color: #10B981; }
.toast-success .toast-ic { color: #10B981; }
.toast-erro    { border-left-color: #DC2626; }
.toast-erro .toast-ic    { color: #DC2626; }
.toast-aviso   { border-left-color: #F59E0B; }
.toast-aviso .toast-ic   { color: #F59E0B; }
.toast-info    { border-left-color: var(--azul-marinho); }
.toast-info .toast-ic    { color: var(--azul-marinho); }
/* Stacking de toasts */
.toast + .toast { bottom: 80px; }
.toast + .toast + .toast { bottom: 136px; }

/* ── Skeleton loading ── */
@keyframes vm-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  display: inline-block;
  background: linear-gradient(90deg,
    rgba(4,44,83,0.04) 0%,
    rgba(4,44,83,0.10) 50%,
    rgba(4,44,83,0.04) 100%);
  background-size: 200% 100%;
  animation: vm-shimmer 1.6s linear infinite;
  border-radius: 6px;
  color: transparent;
  user-select: none;
}
.skeleton-line { height: 14px; width: 100%; margin: 6px 0; }
.skeleton-line.curta { width: 60%; }
.skeleton-line.media { width: 80%; }
.skeleton-line.titulo { height: 18px; width: 40%; margin-bottom: 12px; }
.skeleton-card {
  background: var(--branco);
  border: 1px solid var(--cinza-100);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 8px;
}

/* ── Focus rings consistentes ── */
:focus-visible {
  outline: 2px solid var(--azul-acao);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--azul-acao);
  outline-offset: 2px;
}

/* ── Smooth transitions globais (sutis) ── */
button, a, .sidebar-item, .evento-card, .ck-card, .kpi-card,
.atalho, .tab-item, .menu-acao-item, .busca-item {
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
button:active:not(:disabled) { transform: scale(0.98); }

/* ── Empty states humanos ── */
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--cinza-500);
}
.empty-state .es-ic {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  background: var(--cinza-50);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--cinza-400);
}
.empty-state .es-titulo { font-size: 14px; font-weight: 500; color: var(--cinza-700); margin-bottom: 4px; }
.empty-state .es-msg { font-size: 13px; color: var(--cinza-500); }

/* ── Modal de confirmação custom ── */
.vm-confirm-backdrop {
  position: fixed; inset: 0;
  background: rgba(4,44,83,0.45);
  z-index: 9500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.vm-confirm-backdrop.show { opacity: 1; }
.vm-confirm-modal {
  background: var(--branco);
  border-radius: 12px;
  padding: 24px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(4,44,83,0.25);
  transform: scale(0.94);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vm-confirm-backdrop.show .vm-confirm-modal { transform: scale(1); }
.vm-confirm-modal .vc-titulo { font-size: 16px; font-weight: 600; color: var(--azul-marinho); margin-bottom: 8px; }
.vm-confirm-modal .vc-msg { font-size: 13px; color: var(--cinza-700); line-height: 1.5; margin-bottom: 20px; }
.vm-confirm-modal .vc-btns { display: flex; justify-content: flex-end; gap: 8px; }
.vm-confirm-modal .vc-btn {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--cinza-200); background: var(--branco); color: var(--cinza-700);
  cursor: pointer;
}
.vm-confirm-modal .vc-btn:hover { background: var(--cinza-50); }
.vm-confirm-modal .vc-btn.primary { background: var(--azul-marinho); color: #fff; border-color: var(--azul-marinho); }
.vm-confirm-modal .vc-btn.primary:hover { background: #0C447C; }
.vm-confirm-modal .vc-btn.danger { background: #DC2626; color: #fff; border-color: #DC2626; }
.vm-confirm-modal .vc-btn.danger:hover { background: #B91C1C; }

/* ── Atalhos de teclado overlay (ajuda) ── */
.atalhos-help-backdrop {
  position: fixed; inset: 0;
  background: rgba(4,44,83,0.4);
  z-index: 9400;
  display: none; align-items: center; justify-content: center;
}
.atalhos-help-backdrop.show { display: flex; }
.atalhos-help-modal {
  background: var(--branco);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(4,44,83,0.25);
}
.atalhos-help-modal h3 { margin: 0 0 16px; color: var(--azul-marinho); }
.atalhos-help-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.atalhos-help-grid kbd {
  background: var(--cinza-50);
  border: 1px solid var(--cinza-200);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--fonte-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cinza-700);
}

/* ── Status do salvamento (autosave) refinado ── */
.save-indicator { transition: opacity 0.2s ease; }
.save-indicator .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cinza-300);
  transition: background 0.2s ease, box-shadow 0.3s ease;
}
.save-indicator.salvando .dot {
  background: #F59E0B;
  animation: vm-pulse 1s ease infinite;
}
.save-indicator.salvo .dot { background: #10B981; }
.save-indicator.erro .dot { background: #DC2626; }
@keyframes vm-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

/* ── Refinar evento-card (Fase 2) — sombras sutis ── */
.evento-card {
  transition: box-shadow 0.18s ease, transform 0.05s ease;
}
.evento-card:hover {
  box-shadow: 0 4px 14px rgba(4,44,83,0.08);
}

/* ── Page fade-in ── */
@keyframes vm-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.app-main { animation: vm-fade-in 0.25s ease; }

/* ── Scrollbar customizada (Webkit) ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(4,44,83,0.15); border-radius: 5px; border: 2px solid var(--branco); }
::-webkit-scrollbar-thumb:hover { background: rgba(4,44,83,0.3); }
