/* ============================================================================
   Simulado RPPS — Design System (theme.css)
   Profissional / institucional · compacto · mobile-first · sem build.
   Sem degradês, sem emojis: paleta contida (azul NorBell + navy) e ícones SVG.
   ============================================================================ */

:root {
  /* ---- Marca: azul institucional NorBell ---- */
  --brand-50:  #eef4fb;
  --brand-100: #d7e6f6;
  --brand-200: #b3cdec;
  --brand-300: #84abdd;
  --brand-400: #5285c9;
  --brand-500: #2f66b3;
  --brand-600: #1f5499;   /* primária */
  --brand-700: #1a447d;
  --brand-800: #163a68;   /* navy institucional */
  --brand-900: #132f54;
  --brand-950: #0f2440;

  /* ---- "Acento" = navy (sem violeta; mantém sobriedade) ---- */
  --accent-400: #2f66b3;
  --accent-500: #1a447d;
  --accent-600: #163a68;

  /* ---- Semânticos (tons sóbrios) ---- */
  --success-50:#ecfdf3; --success-500:#16a34a; --success-600:#15803d; --success-700:#166534;
  --warn-50:  #fef9ec; --warn-500:#d99412; --warn-600:#b9770c; --warn-700:#92590a;
  --danger-50:#fdf0f0; --danger-500:#dc2626; --danger-600:#c01f1f; --danger-700:#991b1b;
  --info-50:  #eef4fb; --info-500:#2f66b3;
  --gold-400: #c79a3a; --gold-500:#b07f22;

  /* ---- Superfícies / texto (neutros frios, flat) ---- */
  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef1f6;
  --border:    #e3e8ef;
  --border-strong: #cdd5e0;
  --text:      #1a2233;
  --text-soft: #3d4759;
  --text-mute: #6b7587;
  --text-faint:#9aa3b2;
  --on-brand:  #ffffff;

  /* ---- Raio (discreto/corporativo) ---- */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 11px; --r-xl: 14px; --r-pill: 999px;

  /* ---- Sombras (sutis) ---- */
  --sh-xs: 0 1px 1px rgba(20,33,61,.04);
  --sh-sm: 0 1px 3px rgba(20,33,61,.07);
  --sh-md: 0 4px 14px rgba(20,33,61,.09);
  --sh-lg: 0 12px 32px rgba(20,33,61,.13);
  --sh-brand: 0 2px 8px rgba(31,84,153,.22);
  --ring: 0 0 0 3px rgba(31,84,153,.20);

  /* ---- Tipografia (compacta) ---- */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs:.75rem; --fs-sm:.84rem; --fs-md:.94rem; --fs-lg:1.05rem;
  --fs-xl:1.2rem; --fs-2xl:1.45rem; --fs-3xl:1.8rem;

  /* ---- Layout (compacto) ---- */
  --shell-max: 1480px;
  --pad-x: clamp(12px, 2.6vw, 28px);
  --header-h: 56px;
  --t-fast: .12s; --t: .2s; --t-slow: .34s;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ============================ Reset enxuto ============================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--text); font-size: var(--fs-md);
  line-height: 1.5; min-height: 100dvh; background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1,h2,h3,h4,p { margin: 0; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
svg { stroke-width: 1.75; }

/* ============================ Layout / shell ============================ */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.container  { width: 100%; max-width: var(--shell-max); margin-inline: auto; padding-inline: var(--pad-x); }
.container--narrow { max-width: 1080px; }
.stack > * + * { margin-top: .8rem; }
.center-screen { flex: 1; display: grid; place-items: center; padding: clamp(16px,4vw,40px) var(--pad-x); }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar__inner { display: flex; align-items: center; gap: 14px; min-height: var(--header-h); }
.topbar__logo { height: 34px; width: auto; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: 9px; font-size: var(--fs-sm); color: var(--text-soft); }
.topbar__avatar {
  width: 32px; height: 32px; border-radius: var(--r-pill); display: grid; place-items: center;
  font-weight: 700; font-size: .78rem; color: var(--on-brand); background: var(--brand-700);
}

/* ============================ Cartões ============================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: clamp(14px, 2vw, 22px);
}
.card--flat { box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
/* Título de bloco: cor navy + barra de destaque azul à esquerda */
.card-title {
  font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em;
  color: var(--brand-800); position: relative; padding-left: 14px;
}
.card-title::before {
  content: ""; position: absolute; left: 0; top: .14em; bottom: .14em;
  width: 4px; border-radius: 3px; background: var(--brand-600);
}
.card-sub { color: var(--text-mute); font-size: var(--fs-sm); padding-left: 14px; }

/* Faixa de cabeçalho (painéis) */
.panel-head {
  background: var(--brand-800);
  color: var(--on-brand); padding: clamp(14px,2.2vw,20px) clamp(16px,2.4vw,24px);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.panel-head h2 { font-size: var(--fs-lg); font-weight: 700; }
.panel-head p { color: color-mix(in srgb, #fff 72%, transparent); font-size: var(--fs-sm); margin-top: 2px; }

/* ============================ Botões (sólidos, sem degradê) ============================ */
.btn {
  --_bg: var(--brand-600); --_fg: var(--on-brand); --_bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r-md); border: 1px solid var(--_bd);
  background: var(--_bg); color: var(--_fg); font-weight: 600; font-size: var(--fs-sm);
  cursor: pointer; transition: background var(--t), box-shadow var(--t), border-color var(--t), transform var(--t-fast);
  white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent; line-height: 1.2;
}
.btn:hover { box-shadow: var(--sh-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--lg { padding: 12px 20px; font-size: var(--fs-md); }
.btn--sm { padding: 6px 11px; font-size: var(--fs-xs); }
.btn--block { width: 100%; }
.btn--primary { --_bg: var(--brand-600); }
.btn--primary:hover { --_bg: var(--brand-700); box-shadow: var(--sh-brand); }
.btn--accent  { --_bg: var(--accent-600); }
.btn--accent:hover { --_bg: var(--brand-900); }
.btn--gold    { --_bg: var(--gold-500); }
.btn--gold:hover { --_bg: #93691b; }
.btn--success { --_bg: var(--success-600); }
.btn--success:hover { --_bg: var(--success-700); }
.btn--danger  { --_bg: var(--danger-600); }
.btn--danger:hover { --_bg: var(--danger-700); }
.btn--ghost   { --_bg: var(--surface); --_fg: var(--brand-700); --_bd: var(--border-strong); }
.btn--ghost:hover { --_bg: var(--brand-50); --_bd: var(--brand-300); }
.btn--subtle  { --_bg: var(--surface-3); --_fg: var(--text-soft); }
.btn--subtle:hover { --_bg: var(--border); }
.btn--on-brand{ --_bg: rgba(255,255,255,.14); --_fg:#fff; --_bd: rgba(255,255,255,.30); }
.btn--on-brand:hover { --_bg: rgba(255,255,255,.24); }
.btn .spinner { width: 15px; height: 15px; }
.btn svg { width: 16px; height: 16px; }

/* ============================ Formulários ============================ */
.field { display: flex; flex-direction: column; gap: 5px; }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-soft); }
.hint  { font-size: var(--fs-xs); color: var(--text-mute); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); font-size: var(--fs-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.input.is-error, .select.is-error { border-color: var(--danger-500); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.input.is-ok { border-color: var(--success-500); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 42px; }
.input-affix {
  position: absolute; right: 6px; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--r-sm); color: var(--text-mute); cursor: pointer; background: transparent; border: 0;
}
.input-affix:hover { background: var(--surface-3); color: var(--text-soft); }

/* ============================ Badges / chips ============================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-soft); border: 1px solid transparent;
}
.badge--brand   { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge--success { background: var(--success-50); color: var(--success-700); }
.badge--warn    { background: var(--warn-50); color: var(--warn-700); }
.badge--danger  { background: var(--danger-50); color: var(--danger-700); }
.badge--gold    { background: #fbf6ea; color: var(--gold-500); }

/* ============================ Utilitários ============================ */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: clamp(10px, 1.6vw, 16px); }
.muted { color: var(--text-mute); }
.text-center { text-align: center; }
.hidden { display: none !important; }
.brand-text { color: var(--brand-700); }
.divider { height: 1px; background: var(--border); border: 0; margin: 14px 0; }

/* ============================ Animações ============================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop    { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes shimmer{ 100% { background-position: 200% 0; } }
.anim-fade-up { animation: fadeUp var(--t-slow) var(--ease) both; }
.anim-fade-in { animation: fadeIn var(--t-slow) var(--ease) both; }
.anim-pop     { animation: pop var(--t) var(--ease) both; }
.stagger > * { animation: fadeUp var(--t-slow) var(--ease) both; }
.stagger > *:nth-child(1){animation-delay:.03s} .stagger > *:nth-child(2){animation-delay:.07s}
.stagger > *:nth-child(3){animation-delay:.11s} .stagger > *:nth-child(4){animation-delay:.15s}
.stagger > *:nth-child(5){animation-delay:.19s} .stagger > *:nth-child(6){animation-delay:.23s}

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor; animation: spin .7s linear infinite; display: inline-block;
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, #e6ebf2 37%, var(--surface-3) 63%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ============================ Auth (login/público) ============================ */
.auth-wrap { width: 100%; max-width: 420px; }
.auth-logo { height: 44px; margin: 0 auto 18px; }
.auth-card { padding: clamp(20px, 3vw, 30px); }
.auth-title { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; text-align: center; }
.auth-subtitle { color: var(--text-mute); text-align: center; margin-top: 5px; font-size: var(--fs-sm); }
.auth-links { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.link-btn {
  background: none; border: 0; color: var(--brand-700); font-weight: 600; cursor: pointer;
  font-size: var(--fs-sm); padding: 7px; border-radius: var(--r-sm); transition: background var(--t);
}
.link-btn:hover { background: var(--brand-50); }

/* Centraliza telas públicas na tela inteira */
.app-shell > .auth-wrap { margin: auto; padding-block: clamp(20px, 5vh, 56px); width: 100%; padding-inline: var(--pad-x); }

/* Bloco "hero" (topo do painel): leve tom azul institucional para dar cor */
.hero-card { background: var(--brand-50); border-color: var(--brand-200); }
.hero-card .card { background: var(--surface); }

/* Cartões de escolha de modo (painel) — horizontal compacto, botão à frente */
.mode-card {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; cursor: pointer; text-align: left;
  border: 1px solid var(--border-strong);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t), border-color var(--t);
}
.mode-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--brand-400); }
.mode-card__ic {
  flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100);
}
.mode-card__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mode-card__title { font-weight: 700; font-size: var(--fs-md); color: var(--text); }
.mode-card__tag { font-weight: 600; font-size: var(--fs-xs); color: var(--text-mute); }
.mode-card__desc { color: var(--text-mute); font-size: var(--fs-xs); line-height: 1.35; }
.mode-card__cta { flex: 0 0 auto; pointer-events: none; }
/* No celular o botão desce para baixo (mantém tudo legível e clicável) */
@media (max-width: 520px) {
  .mode-card { flex-wrap: wrap; }
  .mode-card__cta { width: 100%; justify-content: center; }
}

/* ============================ Responsivo / mobile ============================ */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 720px) {
  :root { --header-h: 52px; }
  .topbar__user .topbar__greeting { display: none; }
  .topbar__logo { height: 30px; }
  .btn { padding: 10px 14px; }            /* alvo de toque confortável */
  .btn--lg { padding: 12px 16px; }
}
@media (max-width: 480px) {
  :root { --fs-2xl: 1.3rem; --fs-3xl: 1.55rem; }
  .auth-wrap { max-width: 100%; }
  /* botões de ação que precisam ficar inteiros no celular */
  .row--end .btn, .toolbar__actions .btn { flex: 1 1 auto; }
}
