/* =========================================================================
   Serviceplan — Camada de DESIGN (Palma Companhia de Seguros, SA)
   -------------------------------------------------------------------------
   Eleva o acabamento do template DreamsPOS ao nível do portal e-Acácia
   (tokens slate + gradientes, cartões KPI com acento, sombras suaves,
   estados vazios, skeletons, transições), mantendo a identidade Palma:
   vermelho #C81E1E como cor primária e teal como acento secundário.

   Carregada DEPOIS de style.css e serviceplan.css — só refina superfícies,
   cor, tipografia e micro-interacções; não altera a estrutura do layout.
   ========================================================================= */

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

:root {
  /* ---- Marca Palma ---- */
  --pl-primary: #C81E1E;
  --pl-primary-dark: #A81919;
  --pl-primary-darker: #8F1414;
  --pl-primary-2: #E8433F;          /* parceiro de gradiente (mais quente) */
  --pl-primary-soft: #FBEAEA;
  --pl-primary-ring: rgba(200, 30, 30, .14);

  /* ---- Acento secundário (teal Palma) ---- */
  --pl-teal: #0FA79E;
  --pl-teal-dark: #0B857E;
  --pl-teal-soft: #E6F7F5;

  /* ---- Neutros (rampa slate) ---- */
  --pl-ink: #0f172a;
  --pl-text: #334155;
  --pl-muted: #64748b;
  --pl-border: #e6eaf0;
  --pl-border-2: #eef1f5;
  --pl-surface: #ffffff;
  --pl-bg: #f6f8fb;

  /* ---- Semânticas ---- */
  --pl-success: #1E8E5A;  --pl-success-soft: #e7f6ee;
  --pl-info: #3b82f6;     --pl-info-soft: #e8f1fe;
  --pl-warning: #E08600;  --pl-warning-soft: #fff5e6;
  --pl-danger: #ef4444;   --pl-danger-soft: #fdeaea;

  /* ---- Raios ---- */
  --pl-radius-sm: 8px;
  --pl-radius: 12px;
  --pl-radius-lg: 16px;

  /* ---- Sombras (tinta slate, baixa opacidade) ---- */
  --pl-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --pl-shadow: 0 4px 12px rgba(15, 23, 42, .06);
  --pl-shadow-card: 0 10px 26px rgba(15, 23, 42, .07);
  --pl-shadow-hover: 0 14px 30px -10px rgba(15, 23, 42, .20);

  /* ---- Movimento ---- */
  --pl-ease: cubic-bezier(.4, 0, .2, 1);
  --pl-ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* -------------------------------------------------------------------------
   Base tipográfica e de superfície
   ------------------------------------------------------------------------- */
body {
  font-family: "Inter", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--pl-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.page-wrapper > .content { background: transparent; }
.main-wrapper { background: var(--pl-bg); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5 { color: var(--pl-ink); letter-spacing: -.01em; }
.sp-mono, .pl-mono { font-family: "SF Mono", "Consolas", "Monaco", monospace; font-variant-numeric: tabular-nums; }

/* Rótulo em maiúsculas (estilo e-Acácia) */
.pl-eyebrow {
  text-transform: uppercase; font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; color: var(--pl-muted);
}

/* -------------------------------------------------------------------------
   Cartões — raio maior, borda fina, sombra suave, elevação no hover
   ------------------------------------------------------------------------- */
.card {
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-lg);
  box-shadow: var(--pl-shadow);
  transition: box-shadow .25s var(--pl-ease), transform .25s var(--pl-ease);
}
.card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--pl-border-2);
  padding: 1rem 1.25rem;
}
.card .card-title { font-weight: 700; color: var(--pl-ink); }

/* -------------------------------------------------------------------------
   Botões — raio 10px, peso 600, brilho tinto no primário
   ------------------------------------------------------------------------- */
.btn { border-radius: 10px; font-weight: 600; transition: all .2s var(--pl-ease); }
.btn-primary {
  background-color: var(--pl-primary); border-color: var(--pl-primary);
  box-shadow: 0 4px 12px rgba(200, 30, 30, .22);
}
.btn-primary:hover, .btn-primary:active, .btn-primary:first-child:active {
  background-color: var(--pl-primary-dark) !important; border-color: var(--pl-primary-dark) !important;
  transform: translateY(-1px); box-shadow: 0 8px 18px rgba(200, 30, 30, .28);
}
.btn-white, .btn-outline-light {
  background: #fff; border: 1px solid var(--pl-border); color: var(--pl-text);
}
.btn-white:hover { border-color: var(--pl-primary); color: var(--pl-primary); background: #fff; }
.btn-teal { background: var(--pl-teal); border-color: var(--pl-teal); color: #fff; }
.btn-teal:hover { background: var(--pl-teal-dark); border-color: var(--pl-teal-dark); color: #fff; }

/* Anel de foco acessível e consistente */
.form-control:focus, .form-select:focus {
  border-color: var(--pl-primary);
  box-shadow: 0 0 0 4px var(--pl-primary-ring);
}
.form-control, .form-select { border-radius: 10px; border-color: var(--pl-border); }

/* -------------------------------------------------------------------------
   Cabeçalho de página com gradiente (assinatura e-Acácia, em vermelho Palma)
   ------------------------------------------------------------------------- */
.pl-page-header {
  position: relative; overflow: hidden;
  border-radius: var(--pl-radius-lg);
  background: linear-gradient(115deg, var(--pl-primary-darker) 0%, var(--pl-primary) 55%, var(--pl-primary-2) 100%);
  color: #fff;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 12px 28px -12px rgba(200, 30, 30, .45);
}
.pl-page-header::before {
  content: ""; position: absolute; top: -60%; right: -5%;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 65%);
  pointer-events: none;
}
.pl-page-header::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
}
.pl-page-header h4, .pl-page-header .h4 { color: #fff; margin: 0; font-weight: 700; }
.pl-page-header .pl-sub { color: rgba(255, 255, 255, .85); margin: .25rem 0 0; font-size: .9rem; }
.pl-page-header .pl-eyebrow { color: rgba(255, 255, 255, .75); }
.pl-page-header .breadcrumb { margin: 0 0 .35rem; }
.pl-page-header .breadcrumb-item, .pl-page-header .breadcrumb-item a { color: rgba(255, 255, 255, .8); }
.pl-page-header .breadcrumb-item.active { color: #fff; }
.pl-page-header .breadcrumb-item + .breadcrumb-item::before { color: rgba(255, 255, 255, .5); }
.pl-page-header .btn-white { border-color: rgba(255, 255, 255, .35); }
/* Botões de acção sobre o gradiente: brancos com texto vermelho */
.pl-page-header .btn-primary {
  background: #fff !important; border-color: #fff !important; color: var(--pl-primary) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}
.pl-page-header .btn-primary:hover {
  background: var(--pl-primary-soft) !important; color: var(--pl-primary-dark) !important; transform: translateY(-1px);
}
.pl-page-header .btn-outline-light { border-color: rgba(255, 255, 255, .5); color: #fff; }
.pl-page-header .btn-outline-light:hover { background: rgba(255, 255, 255, .16); color: #fff; }

/* -------------------------------------------------------------------------
   Cartão KPI — barra de acento à esquerda + chip de ícone com gradiente
   ------------------------------------------------------------------------- */
.pl-kpi {
  position: relative; overflow: hidden;
  background: var(--pl-surface); border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-lg); padding: 1.15rem 1.25rem;
  box-shadow: var(--pl-shadow);
  transition: transform .25s var(--pl-ease), box-shadow .25s var(--pl-ease);
  height: 100%;
}
.pl-kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--pl-primary), var(--pl-primary-2));
  transition: width .25s var(--pl-ease);
}
.pl-kpi:hover { transform: translateY(-3px); box-shadow: var(--pl-shadow-card); }
.pl-kpi:hover::before { width: 6px; }
.pl-kpi-label { font-size: .78rem; color: var(--pl-muted); font-weight: 600; margin: 0 0 .35rem; }
.pl-kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--pl-ink); line-height: 1.1; }
.pl-kpi-trend { font-size: .75rem; font-weight: 600; margin-top: .35rem; display: inline-flex; align-items: center; gap: .25rem; }
.pl-kpi-trend.up { color: var(--pl-success); }
.pl-kpi-trend.down { color: var(--pl-danger); }

/* Chip de ícone com gradiente (variantes de cor) */
.pl-chip {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.5rem; transition: transform .25s var(--pl-ease);
}
.pl-kpi:hover .pl-chip { transform: scale(1.06); }
.pl-chip-red   { background: linear-gradient(135deg, #E8433F, #C81E1E); box-shadow: 0 6px 14px rgba(200, 30, 30, .28); }
.pl-chip-teal  { background: linear-gradient(135deg, #2CC6BC, #0B857E); box-shadow: 0 6px 14px rgba(15, 167, 158, .28); }
.pl-chip-blue  { background: linear-gradient(135deg, #60a5fa, #2563eb); box-shadow: 0 6px 14px rgba(37, 99, 235, .25); }
.pl-chip-amber { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 6px 14px rgba(217, 119, 6, .25); }
.pl-chip-green { background: linear-gradient(135deg, #34d399, #16a34a); box-shadow: 0 6px 14px rgba(22, 163, 74, .25); }
.pl-chip-gray  { background: linear-gradient(135deg, #94a3b8, #475569); box-shadow: 0 6px 14px rgba(71, 85, 105, .22); }

/* Variantes da barra de acento por cor */
.pl-kpi.accent-teal::before  { background: linear-gradient(180deg, #2CC6BC, #0B857E); }
.pl-kpi.accent-blue::before  { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.pl-kpi.accent-amber::before { background: linear-gradient(180deg, #fbbf24, #d97706); }
.pl-kpi.accent-green::before { background: linear-gradient(180deg, #34d399, #16a34a); }

/* -------------------------------------------------------------------------
   Título de secção
   ------------------------------------------------------------------------- */
.pl-section-title { font-size: 1.02rem; font-weight: 700; color: var(--pl-ink); margin: 0; }
.pl-section-sub { font-size: .82rem; color: var(--pl-muted); margin: .1rem 0 0; }

/* -------------------------------------------------------------------------
   Tabelas — cabeçalho slate, linhas com hover, cantos arredondados
   ------------------------------------------------------------------------- */
.table > :not(caption) > * > * { padding: .75rem 1.25rem; }
.table thead.thead-light th, .table > thead th {
  background: #f7f9fc; color: var(--pl-muted);
  text-transform: uppercase; font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  border-bottom: 1px solid var(--pl-border);
}
.table tbody tr { transition: background .15s var(--pl-ease); }
.table tbody tr:hover { background: #f9fafc; }
.table td { color: var(--pl-text); vertical-align: middle; border-color: var(--pl-border-2); }

/* Distintivo com contagem de registos */
.pl-count-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--pl-primary-soft); color: var(--pl-primary);
  font-size: .74rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px;
}

/* Distintivos suaves (triádicos) */
.badge-soft { font-weight: 600; padding: .35em .65em; border-radius: 8px; font-size: .74rem; }
.badge-soft-success { background: var(--pl-success-soft); color: var(--pl-success); }
.badge-soft-info    { background: var(--pl-info-soft); color: var(--pl-info); }
.badge-soft-warning { background: var(--pl-warning-soft); color: var(--pl-warning); }
.badge-soft-danger  { background: var(--pl-danger-soft); color: var(--pl-danger); }
.badge-soft-teal    { background: var(--pl-teal-soft); color: var(--pl-teal-dark); }

/* -------------------------------------------------------------------------
   Estado vazio (ícone em círculo + título + subtítulo)
   ------------------------------------------------------------------------- */
.pl-empty { text-align: center; padding: 3rem 1.5rem; }
.pl-empty-icon {
  width: 72px; height: 72px; margin: 0 auto 1rem;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--pl-primary-soft), #fff);
  color: var(--pl-primary); font-size: 2rem;
  box-shadow: inset 0 0 0 1px var(--pl-border);
}
.pl-empty-title { font-weight: 700; color: var(--pl-ink); margin: 0 0 .25rem; }
.pl-empty-text { color: var(--pl-muted); font-size: .88rem; margin: 0; }

/* -------------------------------------------------------------------------
   Skeleton (shimmer) para superfícies assíncronas
   ------------------------------------------------------------------------- */
.pl-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e6ebf2 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: plShimmer 1.4s ease infinite; border-radius: 8px;
}
@keyframes plShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* -------------------------------------------------------------------------
   Entradas animadas (fade-up escalonado) + transição de página
   ------------------------------------------------------------------------- */
@keyframes plFadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.pl-fade-up { animation: plFadeUp .5s var(--pl-ease-out) both; }
.pl-stagger > * { animation: plFadeUp .5s var(--pl-ease-out) both; }
.pl-stagger > *:nth-child(1) { animation-delay: .04s; }
.pl-stagger > *:nth-child(2) { animation-delay: .10s; }
.pl-stagger > *:nth-child(3) { animation-delay: .16s; }
.pl-stagger > *:nth-child(4) { animation-delay: .22s; }
.pl-stagger > *:nth-child(5) { animation-delay: .28s; }
.pl-stagger > *:nth-child(6) { animation-delay: .34s; }

.pl-view-enter-active, .pl-view-leave-active { transition: opacity .22s var(--pl-ease), transform .22s var(--pl-ease); }
.pl-view-enter-from { opacity: 0; transform: translateY(8px); }
.pl-view-leave-to { opacity: 0; transform: translateY(-4px); }

/* -------------------------------------------------------------------------
   Barra lateral e cabeçalho — acabamento mais suave
   ------------------------------------------------------------------------- */
.sidebar { border-right: 1px solid var(--pl-border); }
.header { box-shadow: var(--pl-shadow-sm); }
.sidebar .sidebar-menu ul li a { border-radius: 10px; transition: background .15s var(--pl-ease), color .15s var(--pl-ease); }
.sidebar .sidebar-menu ul li a:hover { background: var(--pl-primary-soft); color: var(--pl-primary); }
.sidebar .sidebar-menu ul li a.active { background: var(--pl-primary-soft); }
.sidebar .sidebar-menu ul li a.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--pl-primary);
}
.sidebar .sidebar-menu ul li a { position: relative; }

/* -------------------------------------------------------------------------
   Autenticação — dois painéis (marca + formulário)
   ------------------------------------------------------------------------- */
.pl-auth { display: flex; min-height: 100vh; background: var(--pl-bg); }
.pl-auth-brand {
  position: relative; overflow: hidden;
  flex: 0 0 44%; max-width: 44%;
  padding: 2.5rem; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, var(--pl-primary-darker) 0%, var(--pl-primary) 55%, var(--pl-primary-2) 100%);
}
.pl-auth-brand::before {
  content: ""; position: absolute; top: -15%; right: -20%;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 60%);
}
.pl-auth-brand::after {
  content: ""; position: absolute; bottom: -25%; left: -15%;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, .16), transparent 60%);
}
.pl-auth-brand > * { position: relative; z-index: 1; }
.pl-auth-brand-top { display: flex; align-items: center; gap: .75rem; }
.pl-auth-logo {
  width: 52px; height: 52px; border-radius: 14px; background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}
.pl-auth-logo img { max-width: 100%; max-height: 100%; }
.pl-auth-brandname { font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.pl-auth-brandname small { display: block; font-weight: 500; font-size: .72rem; color: rgba(255, 255, 255, .8); }
.pl-auth-slogan { font-size: 2.4rem; font-weight: 800; color: #fff; line-height: 1.1; margin: .5rem 0 1rem; letter-spacing: -.02em; }
.pl-auth-tag { color: rgba(255, 255, 255, .88); font-size: 1rem; max-width: 30ch; margin-bottom: 1.75rem; }
.pl-auth-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.pl-auth-list li { display: flex; align-items: center; gap: .75rem; font-size: .92rem; color: rgba(255, 255, 255, .92); }
.pl-auth-list i {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
  background: rgba(255, 255, 255, .16); backdrop-filter: blur(4px);
}
.pl-auth-copy { color: rgba(255, 255, 255, .7); font-size: .8rem; margin: 0; }

.pl-auth-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.pl-auth-card {
  width: 100%; max-width: 440px; background: var(--pl-surface);
  border: 1px solid var(--pl-border); border-radius: var(--pl-radius-lg);
  box-shadow: var(--pl-shadow-card); padding: 2.75rem 2.5rem;
  animation: plFadeUp .5s var(--pl-ease-out) both;
}

/* Marca dentro do cartão — só em ecrãs pequenos (o painel já a mostra). */
.pl-auth-cardlogo { display: none; margin-bottom: 1.25rem; }
.pl-auth-cardlogo img { max-height: 46px; }
@media (max-width: 991.98px) {
  .pl-auth-brand { display: none; }
  .pl-auth-cardlogo { display: block; }
}

/* Cabeçalho do formulário */
.pl-auth-head { margin-bottom: 1.5rem; }
.pl-auth-head h3 { font-weight: 800; color: var(--pl-ink); font-size: 1.5rem; margin: .1rem 0 .35rem; letter-spacing: -.02em; }
.pl-auth-head p { color: var(--pl-muted); font-size: .9rem; margin: 0; }

/* Campos com ícone */
.pl-field { position: relative; margin-bottom: 1.15rem; }
.pl-field > label { display: block; font-weight: 600; color: var(--pl-ink); font-size: .82rem; margin-bottom: .4rem; }
.pl-field .pl-field-icon {
  position: absolute; left: 14px; top: 41px; color: var(--pl-muted); font-size: 1.1rem; pointer-events: none;
}
.pl-field .form-control {
  height: 48px; padding-left: 42px; border-radius: 12px; font-size: .95rem;
}
.pl-field .pl-eye {
  position: absolute; right: 14px; top: 41px; color: var(--pl-muted); cursor: pointer; font-size: 1.1rem;
}
.pl-field .pl-eye:hover { color: var(--pl-primary); }
.pl-field .form-control.is-invalid { border-color: var(--pl-danger); }
.pl-field .pl-field-err { color: var(--pl-danger); font-size: .78rem; margin-top: .35rem; }

.pl-auth-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; font-size: .88rem; }
.pl-auth-row .form-check-label { color: var(--pl-muted); }
.pl-auth-row a { font-weight: 600; }

.pl-auth-submit {
  height: 48px; font-weight: 700; font-size: 1rem; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.pl-auth-alt { text-align: center; margin-top: 1.25rem; color: var(--pl-muted); font-size: .9rem; }
.pl-auth-alt a { font-weight: 700; }

.pl-auth-demo {
  margin-top: 1.5rem; padding: .85rem 1rem; border-radius: 12px;
  background: var(--pl-teal-soft); border: 1px dashed rgba(15, 167, 158, .4);
  color: var(--pl-teal-dark); font-size: .82rem;
}
.pl-auth-demo i { color: var(--pl-teal); }
.pl-auth-foot { text-align: center; color: var(--pl-muted); font-size: .78rem; margin: 1.5rem 0 0; }

/* Spinner do botão */
.pl-spin { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: plSpin .7s linear infinite; }
@keyframes plSpin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------------
   Acessibilidade: respeitar redução de movimento
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
