@import url('https://fonts.googleapis.com/css2?family=Uncial+Antiqua&display=swap');

/* InstaSSEL — Folha de estilos compartilhada (painel + páginas de auth) */

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  color: #1e1e2e;
  line-height: 1.5;
}

/* ============================================================
   PÁGINAS DE AUTH (login, cadastro, recuperar, redefinir, política)
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.auth-logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: #6d28d9;
  letter-spacing: -.5px;
  margin-bottom: 4px;
  text-align: center;
}
.auth-logo span { color: #a78bfa; }
.auth-logo-sub {
  font-size: .78rem;
  color: #9ca3af;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 28px;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  padding: 36px 40px;
  width: 100%;
  max-width: 460px;
}

.auth-titulo {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.auth-sub {
  font-size: .88rem;
  color: #6b7280;
  margin-bottom: 24px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: .85rem;
  color: #6b7280;
}
.auth-footer a { color: #6d28d9; text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  font-size: .85rem;
  text-align: center;
}
.auth-links a { color: #6d28d9; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* ============================================================
   LAYOUT DO PAINEL (sidebar + main)
   ============================================================ */
.painel-wrap {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #6d28d9;
  border-bottom: 1px solid #f3f4f6;
  letter-spacing: -.3px;
}
.sidebar-logo span { color: #a78bfa; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: .88rem;
  color: #374151;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background .12s;
}
.sidebar-nav a:hover { background: #f5f3ff; color: #6d28d9; }
.sidebar-nav a.ativo  { background: #f5f3ff; color: #6d28d9; font-weight: 600; }
.sidebar-nav a.disabled {
  color: #c4c4c4;
  cursor: default;
  pointer-events: none;
}
.sidebar-nav .nav-badge {
  margin-left: auto;
  font-size: .7rem;
  background: #e5e7eb;
  color: #6b7280;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #f3f4f6;
}
.sidebar-footer .sf-nome  { font-size: .82rem; font-weight: 700; color: #374151; margin-bottom: 2px; }
.sidebar-footer .sf-email {
  font-size: .75rem;
  color: #9ca3af;
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer a.sair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: #dc2626;
  text-decoration: none;
  font-weight: 600;
}
.sidebar-footer a.sair:hover { text-decoration: underline; }

/* Área principal */
.painel-main {
  flex: 1;
  padding: 0 40px 70px;
  overflow-x: hidden;
}

/* Header do painel */
.painel-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0;
  margin-bottom: 28px;
  border-bottom: 1px solid #e5e7eb;
}
.ph-usuario {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f5f3ff;
  color: #6d28d9;
  border-radius: 20px;
  padding: 6px 14px 6px 9px;
  font-size: .84rem;
  font-weight: 600;
}
.ph-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #ede9fe; overflow: hidden; flex-shrink: 0;
  font-size: .68rem; font-weight: 700;
}
.ph-sair {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 20px;
  padding: 6px 14px 6px 10px;
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.ph-sair:hover { background: #fecaca; }

/* Menu do usuário (botão + dropdown) na topbar, visível só no mobile */
.sidebar-mobile-user { display: none; position: relative; }
.sb-user-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: #f5f3ff; color: #6d28d9; border-radius: 50%;
  border: none; cursor: pointer; padding: 0; overflow: hidden;
  font-size: .9rem; font-weight: 700;
}
.sidebar-mobile-user.open .sb-user-icon { background: #ede9fe; }

.sb-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  z-index: 400;
  overflow: hidden;
  padding: 6px;
}
.sidebar-mobile-user.open .sb-user-dropdown { display: block; }
.sb-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: .86rem; color: #374151; text-decoration: none;
  transition: background .12s;
}
.sb-dropdown-item svg { flex-shrink: 0; }
.sb-dropdown-item:hover { background: #f5f3ff; color: #6d28d9; }
.sb-dropdown-item.sb-dropdown-danger { color: #dc2626; }
.sb-dropdown-item.sb-dropdown-danger:hover { background: #fee2e2; }
.sb-dropdown-divider { height: 1px; background: #f3f4f6; margin: 4px 0; }

/* Botão hambúrguer (topbar mobile) */
.sb-menu-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: none; color: #374151;
  cursor: pointer; border-radius: 8px; flex-shrink: 0; padding: 0;
}
.sb-menu-btn:hover { background: #f5f3ff; color: #6d28d9; }

.painel-footer {
  position: fixed;
  bottom: 0;
  left: 240px;
  right: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 10px 24px;
  font-size: .72rem;
  color: #9ca3af;
  text-align: center;
  z-index: 50;
}
.painel-footer a { color: #6b7280; text-decoration: none; font-weight: 600; }
.painel-footer a:hover { color: #374151; }

.painel-titulo {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.painel-sub {
  color: #6b7280;
  font-size: .9rem;
  margin-bottom: 32px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  padding: 28px;
  margin-bottom: 20px;
}
.card-titulo {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: #1e1e2e;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 12px;
}
.card-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}
.card-placeholder .placeholder-icone { font-size: 2.5rem; margin-bottom: 12px; }
.card-placeholder p { font-size: .9rem; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.campo { margin-bottom: 18px; }

label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
label .opc { font-weight: 400; color: #9ca3af; }
label .req { color: #dc2626; font-weight: 700; margin-left: 2px; }

input[type=text],
input[type=email],
input[type=password] {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  color: #111;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
input:disabled,
input[readonly] {
  background: #f9fafb;
  color: #6b7280;
  border-color: #e5e7eb;
  cursor: not-allowed;
}
.campo-hint { font-size: .77rem; color: #9ca3af; margin-top: 4px; }

.check-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .88rem;
  color: #374151;
  margin-bottom: 20px;
}
.check-wrap input[type=checkbox] { margin-top: 3px; accent-color: #6d28d9; flex-shrink: 0; }
.check-wrap a { color: #6d28d9; text-decoration: none; font-weight: 600; }

/* Switch toggle — PADROES.md §9.5, usado por ex. em "Lembrar de mim" no login */
.x-switch { position: relative; display: inline-flex; flex-shrink: 0; width: 30px; height: 17px; }
.x-switch-input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.x-switch-track { width: 30px; height: 17px; border-radius: 9px; background: #d1d5db; transition: background .15s; display: block; }
.x-switch-thumb { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; }
.x-switch-input:checked + .x-switch-track { background: #6d28d9; }
.x-switch-input:checked + .x-switch-track .x-switch-thumb { transform: translateX(13px); }

/* Campo somente leitura estilizado */
.dado-readonly {
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .95rem;
  color: #6b7280;
  letter-spacing: .03em;
}

/* Linha de dados (meus dados) */
.dado-linha {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
  align-items: center;
}
.dado-linha:last-child { border-bottom: none; }
.dado-chave { font-size: .82rem; font-weight: 600; color: #6b7280; min-width: 120px; flex-shrink: 0; }
.dado-valor { font-size: .92rem; color: #1e1e2e; }

@media (max-width: 480px) {
  .dado-linha { flex-direction: column; align-items: flex-start; gap: 2px; }
  .dado-chave { min-width: unset; }
}

/* Divisor de seção */
.secao-titulo {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9ca3af;
  margin: 28px 0 14px;
}

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }

.btn-primary { background: #6d28d9; color: #fff; }
.btn-outline  { background: transparent; color: #6d28d9; border: 1.5px solid #6d28d9; }
.btn-danger   { background: #dc2626; color: #fff; }
.btn-neutral  { background: #e5e7eb; color: #374151; }
.btn-full     { width: 100%; }
.btn-sm       { padding: 7px 14px; font-size: .82rem; }

/* ============================================================
   MODAL — PADROES.md §9.1, base do sckConfirm (§9.6)
   z-index acima do .lb-overlay (2000) do lightbox de fotos.php —
   sckConfirm precisa aparecer por cima mesmo com o lightbox aberto.
   ============================================================ */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(17,17,17,.5); z-index: 2500;
  align-items: flex-start; justify-content: center; padding: 2rem 1rem; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal-backdrop-center { align-items: center; }
.modal {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 520px;
  display: flex; flex-direction: column; overscroll-behavior: contain;
}
.modal-header {
  padding: 1.1rem 1.2rem; border-bottom: 1px solid #e5e7eb;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1rem; margin: 0; color: #1e1e2e; }
.modal-body { padding: 1.2rem; color: #374151; font-size: .92rem; line-height: 1.5; }
.modal-body p { white-space: pre-line; margin: 0; }
.modal-footer {
  padding: 1rem 1.2rem; border-top: 1px solid #e5e7eb;
  display: flex; justify-content: flex-end; gap: .6rem;
}
@media (max-width: 480px) {
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}
.btn-modal-close {
  background: none; border: none; color: #9ca3af;
  cursor: pointer; width: 30px; height: 30px; padding: 0;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.btn-modal-close:hover { background: #f3f4f6; color: #374151; }

/* ============================================================
   FOTO DE PERFIL
   ============================================================ */
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.perfil-avatar-grande {
  width: 110px; height: 110px; border-radius: 50%; background: #f5f3ff;
  border: 3px solid #ddd6fe; color: #6d28d9; font-family: system-ui, sans-serif;
  font-size: 2.2rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0; margin: 0 auto;
}
.pf-upload-trigger {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 16px; border: 2px dashed #ddd6fe; border-radius: 10px;
  background: #f5f3ff; color: #6d28d9; cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.pf-upload-trigger:hover { background: #ede9fe; }
.pf-upload-trigger span { font-size: .85rem; font-weight: 600; }
.pf-upload-trigger small { font-size: .72rem; color: #9ca3af; }

/* ============================================================
   ALERTAS / FLASH
   ============================================================ */
.alerta {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: .88rem;
  margin-bottom: 20px;
  line-height: 1.5;
}
.alerta-erro   { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.alerta-ok     { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alerta-aviso  { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.alerta-info   { background: #eff6ff; border: 1px solid #93c5fd; color: #1d4ed8; }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 640px) {
  .auth-card { padding: 28px 20px; }
  .cards-duplo { grid-template-columns: 1fr !important; }
  .painel-wrap { flex-direction: column; }

  /* Topbar fixa: hamburger + logo + user/sair — sempre visível */
  .sidebar-mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 300;
  }
  .sidebar-mobile-title {
    flex: 1;
    font-family: 'Uncial Antiqua', serif;
    font-size: 1.05rem;
    color: #6d28d9;
  }
  .sidebar-mobile-user { display: flex !important; align-items: center; gap: 8px; }

  /* Sidebar vira gaveta (drawer): fora da tela por padrão, desliza ao abrir */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 950;
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,.15); }
  .sidebar-logo { padding: 16px 16px 20px; }

  .sidebar-nav {
    padding: 12px 8px;
  }
  .sidebar-nav a {
    font-size: .88rem;
    padding: 10px 12px;
    white-space: normal;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, .45);
    z-index: 900;
  }
  .sidebar-overlay.open { display: block; }

  /* Esconde o header desktop no mobile (o topbar mobile acima faz esse papel) */
  .painel-header { display: none !important; }

  .painel-main { padding: 20px 16px 60px; }
  .painel-footer { left: 0; }
}
@media (min-width: 641px) {
  /* Elementos exclusivos do mobile ficam fora da tela em telas maiores */
  .sidebar-mobile-topbar, .sb-menu-btn, .sidebar-overlay { display: none !important; }
}

/* ============================================================
   PULL-TO-REFRESH — mesmo padrão do Secoke Control/SCK Financial
   ============================================================ */
#ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-64px);
  opacity: 0;
  width: 40px;
  height: 40px;
  background: #6d28d9;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 970;
  pointer-events: none;
  transition: transform .26s cubic-bezier(.34,1.4,.64,1), opacity .2s ease;
}
#ptr-indicator.ptr-pulling { transition: none; }
.ptr-icon { width: 20px; height: 20px; display: block; }
#ptr-indicator.ptr-refreshing .ptr-icon { animation: ptr-spin .65s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
