/* ==========================================================
   Ficha OCR — sistema visual
   ========================================================== */

:root {
  color-scheme: light;

  --primary: #3b5bfd;
  --primary-dark: #2b43d9;
  --primary-soft: #eef1ff;
  --primary-contrast: #ffffff;
  --accent: #06b6d4;

  --bg: #f3f6fc;
  --bg-deep: #e9eef8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eff3f9;

  --text: #0f172a;
  --text-soft: #475569;
  --muted: #7b8aa3;

  --border: #e5eaf3;
  --border-strong: #d2dae8;

  --success: #0f9d58;
  --success-soft: #e6f8ef;
  --danger: #e02f2f;
  --danger-soft: #fdecec;
  --warning: #c2760a;
  --warning-soft: #fff5e2;
  --info: #0284c7;
  --info-soft: #e5f3fd;

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.12);

  --sidebar-width: 272px;
  --transition: 170ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --primary: #6b83ff;
  --primary-dark: #5a72f5;
  --primary-soft: #1b2450;
  --accent: #22d3ee;

  --bg: #080d1a;
  --bg-deep: #050912;
  --surface: #101a2e;
  --surface-soft: #16223a;
  --surface-muted: #1b2842;

  --text: #e8eefb;
  --text-soft: #b8c5dc;
  --muted: #8595b1;

  --border: #22304c;
  --border-strong: #31405f;

  --success: #34d399;
  --success-soft: #10291f;
  --danger: #f87171;
  --danger-soft: #2c1417;
  --warning: #fbbf24;
  --warning-soft: #2b2010;
  --info: #38bdf8;
  --info-soft: #0d2436;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 22px 48px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 520px at 82% -12%, rgba(59, 91, 253, 0.14), transparent 62%),
    radial-gradient(900px 480px at -8% 4%, rgba(6, 182, 212, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h2 {
  font-size: 1.32rem;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

h3 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

h4 {
  font-size: 0.95rem;
}

h2 i,
h3 i {
  color: var(--primary);
  margin-right: 9px;
  font-size: 0.88em;
  vertical-align: 1px;
}

a {
  color: var(--primary);
}

code {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.86em;
  font-weight: 600;
}

::selection {
  background: var(--primary);
  color: #fff;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: content-box;
}

/* ==========================================================
   Layout
   ========================================================== */

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
}

/* Sem usuário logado não existe barra lateral:
   a área principal ocupa a tela inteira. */
.app-shell-auth {
  grid-template-columns: 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  background: linear-gradient(165deg, #0d1530 0%, #141f42 55%, #091226 100%);
  color: #e8edfb;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar h1 {
  margin: 0 0 16px;
  font-size: 1.25rem;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  padding: 11px 14px;
  font-weight: 600;
  font-size: 0.94rem;
  color: #c9d6f5;
  background: transparent;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), transform var(--transition),
    border-color var(--transition);
  position: relative;
}

.sidebar a i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.86rem;
  transition: background var(--transition), color var(--transition);
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(2px);
}

.sidebar a:hover i {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar a.is-active {
  background: linear-gradient(90deg, rgba(59, 91, 253, 0.95), rgba(59, 91, 253, 0.55));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 22px rgba(20, 35, 90, 0.45);
}

.sidebar a.is-active i {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar a.nav-logout {
  color: #f5b9b9;
}

.sidebar a.nav-logout:hover {
  background: rgba(224, 47, 47, 0.18);
  color: #ffd7d7;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 20px;
  margin-bottom: 18px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: inherit;
  background: transparent;
}

.sidebar .brand:hover {
  background: transparent;
  transform: none;
  color: inherit;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--primary) 0%, #7c5cff 55%, var(--accent) 100%);
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 10px 24px rgba(59, 91, 253, 0.4);
}

.brand-text {
  display: grid;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-text small {
  color: #93a4cc;
  font-size: 0.76rem;
  font-weight: 500;
}

.sidebar-profile {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: grid;
  gap: 10px;
}

/* A barra lateral é sempre escura, então o botão de tema
   precisa de cores próprias para não ficar claro sobre ela. */
.sidebar .sidebar-tema {
  width: 100%;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #cdd7f0;
}

.sidebar .sidebar-tema:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(140deg, #4f6bff, #22d3ee);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
}

.user-card div {
  display: grid;
  line-height: 1.3;
  min-width: 0;
}

.user-card strong {
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card small {
  color: #93a4cc;
  font-size: 0.78rem;
}

.content {
  padding: 0 32px 44px;
  min-width: 0;
}

/* Flex com margens automáticas: centraliza sem cortar o topo
   quando o conteúdo é mais alto que a tela. */
.content-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 32px 24px;
}

.content-auth .flash-stack {
  width: min(520px, 100%);
  margin: 0 0 18px;
}

.content-auth .auth-shell {
  margin-block: auto;
}

/* ==========================================================
   Barra superior
   ========================================================== */

/* A barra superior não é fixa: um cabeçalho sobreposto poderia
   interceptar o ponteiro sobre o canvas de assinatura. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 14px;
  margin-bottom: 4px;
}

.topbar-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.topbar-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition), border-color var(--transition), color var(--transition),
    box-shadow var(--transition);
}

.icon-button:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================
   Cartões
   ========================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card + .card,
section + section {
  margin-top: 20px;
}

.auth-card {
  width: min(460px, 100%);
  padding: 34px;
  box-shadow: var(--shadow-lg);
}

/* ==========================================================
   Tela de login
   ========================================================== */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  width: min(1060px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* --- Painel da marca --- */

.auth-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  padding: 46px 42px;
  color: #e8edfb;
  background:
    radial-gradient(760px 420px at 88% -10%, rgba(99, 122, 255, 0.5), transparent 62%),
    radial-gradient(620px 380px at -8% 108%, rgba(6, 182, 212, 0.36), transparent 60%),
    linear-gradient(160deg, #0f1940 0%, #1c2c6b 52%, #070e26 100%);
}

.auth-blob {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(58px);
  pointer-events: none;
  animation: auth-float 16s ease-in-out infinite;
}

.auth-blob-1 {
  width: 260px;
  height: 260px;
  top: -90px;
  right: -70px;
  background: rgba(124, 92, 255, 0.55);
}

.auth-blob-2 {
  width: 300px;
  height: 300px;
  bottom: -140px;
  left: -90px;
  background: rgba(6, 182, 212, 0.42);
  animation-delay: -6s;
  animation-duration: 20s;
}

@keyframes auth-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(14px, 22px, 0) scale(1.08);
  }
}

.auth-panel-inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 28px;
  align-content: space-between;
}

.auth-panel-brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-mark-lg {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 15px;
  font-size: 1.2rem;
  box-shadow: 0 12px 28px rgba(59, 91, 253, 0.45);
}

.auth-panel h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.auth-tagline {
  margin: 0;
  color: #a9b8dd;
  font-size: 0.92rem;
  max-width: 34ch;
}

/* --- Mockup do documento --- */

.auth-mock {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 26px 54px rgba(3, 8, 30, 0.45);
}

.auth-mock-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-mock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.26);
}

.auth-mock-title {
  margin-left: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #c3cff0;
}

.auth-mock-body {
  padding: 18px 18px 16px;
  display: grid;
  gap: 9px;
}

.auth-mock-line {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.auth-mock-line.w-90 {
  width: 90%;
}

.auth-mock-line.w-85 {
  width: 85%;
}

.auth-mock-line.w-70 {
  width: 70%;
}

.auth-mock-line.w-45 {
  width: 45%;
}

.auth-mock-sign {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.auth-mock-sign svg {
  width: 100%;
  height: 48px;
  display: block;
}

.auth-mock-sign path {
  fill: none;
  stroke: #7dd3fc;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-mock-sign span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #93a8d4;
}

/* --- Lista de recursos --- */

.auth-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 13px;
}

.auth-features li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 0.9rem;
  color: #cdd8f4;
}

.auth-features i {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #9fb4ff;
}

/* --- Formulário --- */

.auth-form {
  padding: 46px 42px;
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
}

.auth-form h2 {
  margin-bottom: 2px;
  font-size: 1.5rem;
}

/* Especificidade maior que a regra global de .muted */
.auth-form .auth-form-sub {
  margin: 0;
  font-size: 0.92rem;
  /* --muted ficaria abaixo de 4.5:1 no cartão claro */
  color: var(--text-soft);
}

.auth-form-grid {
  margin: 24px 0 18px;
  gap: 18px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.auth-input {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input > i {
  position: absolute;
  left: 16px;
  font-size: 0.92rem;
  color: var(--muted);
  pointer-events: none;
  transition: color var(--transition);
}

.auth-input:focus-within > i {
  color: var(--primary);
}

.auth-input input {
  height: 52px;
  padding-left: 46px;
  border-radius: 14px;
  font-size: 0.95rem;
  background: var(--surface-soft);
}

.auth-input input:hover {
  background: var(--surface-muted);
}

.auth-input input:focus {
  background: var(--surface);
}

.auth-input input::placeholder {
  color: var(--text-soft);
  opacity: 1;
}

.auth-input-reveal input {
  padding-right: 50px;
}

.auth-reveal {
  position: absolute;
  right: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 0.95rem;
}

.auth-reveal:hover {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: none;
  transform: none;
}

.auth-caps {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--warning);
}

.auth-submit {
  width: 100%;
  height: 52px;
  margin-top: 4px;
  font-size: 0.97rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  gap: 10px;
  border-radius: 14px;
}

.auth-submit i {
  font-size: 0.9rem;
  transition: transform var(--transition);
}

.auth-submit:hover i {
  transform: translateX(4px);
}

.auth-submit.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: auth-spin 0.7s linear infinite;
}

.auth-submit.is-loading > i {
  display: none;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Especificidade maior que a regra global de .hint */
.auth-form .auth-hint {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.auth-hint i {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Botão flutuante de tema (fora do cartão) */
.auth-theme {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 40;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
}

.auth-theme:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

@media (prefers-reduced-motion: reduce) {
  .auth-blob,
  .auth-submit.is-loading::before {
    animation: none;
  }

  .auth-submit i,
  .auth-theme {
    transition: none;
  }
}

.narrow-card {
  width: min(760px, 100%);
}

.hero-grid,
.grid-2 {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* cartões dentro de grades não acumulam a margem de irmãos */
.hero-grid > .card + .card,
.grid-2 > .card + .card,
.detail-grid > .card + .card {
  margin-top: 0;
}

.page-intro {
  background:
    radial-gradient(520px 200px at 100% 0%, rgba(59, 91, 253, 0.12), transparent 70%),
    radial-gradient(360px 180px at 0% 100%, rgba(6, 182, 212, 0.12), transparent 70%),
    var(--surface);
  border-color: var(--border-strong);
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 22px 24px;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #7c5cff 55%, var(--accent));
}

.stat-card strong {
  display: block;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 6px 0 4px;
  color: var(--text);
}

@supports (-webkit-background-clip: text) {
  .stat-card strong {
    background: linear-gradient(120deg, var(--text) 30%, var(--primary) 120%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.stat-card p {
  margin: 0;
  font-size: 0.87rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.section-header.column {
  flex-direction: column;
  gap: 10px;
}

.eyebrow,
.badge,
.hint,
.muted,
.empty-state {
  color: var(--muted);
}

.eyebrow {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  color: #cfdcf8;
}

.hint {
  font-size: 0.86rem;
}

.muted {
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 26px;
  font-size: 0.92rem;
}

/* ==========================================================
   Abas
   ========================================================== */

.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 5px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  width: fit-content;
  max-width: 100%;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  color: var(--text-soft);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent;
  transition: all var(--transition);
}

.settings-tab:hover {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.settings-tab.is-active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================
   Botões
   ========================================================== */

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(59, 91, 253, 0.24);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition),
    background var(--transition);
}

button:hover,
.button-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(59, 91, 253, 0.32);
  filter: brightness(1.05);
}

button:active,
.button-link:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(59, 91, 253, 0.24);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.danger-button {
  background: linear-gradient(135deg, #f2555a 0%, var(--danger) 100%);
  box-shadow: 0 8px 18px rgba(224, 47, 47, 0.26);
}

.danger-button:hover {
  box-shadow: 0 12px 24px rgba(224, 47, 47, 0.32);
}

.warning-button {
  background: linear-gradient(135deg, #f0a52b 0%, var(--warning) 100%);
  box-shadow: 0 8px 18px rgba(194, 118, 10, 0.24);
}

.warning-button:hover {
  box-shadow: 0 12px 24px rgba(194, 118, 10, 0.3);
}

.success-button {
  background: linear-gradient(135deg, #22c17d 0%, var(--success) 100%);
  box-shadow: 0 8px 18px rgba(15, 157, 88, 0.26);
}

.success-button:hover {
  box-shadow: 0 12px 24px rgba(15, 157, 88, 0.32);
}

.ghost-button {
  background: var(--surface);
  color: var(--text-soft);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.ghost-button:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.inline-form {
  display: inline-block;
}

.action-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.link-action {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.link-action:hover {
  background: var(--primary-soft);
  text-decoration: underline;
}

/* ==========================================================
   Formulários
   ========================================================== */

.form-grid {
  display: grid;
  gap: 16px;
}

.relatorio-filters {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  font-family: inherit;
  font-size: 0.94rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input::placeholder {
  color: var(--muted);
}

input:hover,
select:hover {
  border-color: var(--muted);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 91, 253, 0.16);
}

input[type="file"] {
  padding: 10px 12px;
  background: var(--surface-soft);
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  background: var(--primary-soft);
  color: var(--primary);
  cursor: pointer;
  transition: background var(--transition);
}

input[type="file"]::file-selector-button:hover {
  background: var(--border);
}

/* ==========================================================
   Tabelas
   ========================================================== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.92rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:nth-child(even) {
  background: var(--surface-soft);
}

tbody tr:hover {
  background: var(--primary-soft);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.linha-verde {
  background-color: var(--success-soft) !important;
}

.linha-vigilancia,
.tabela-vigilancia tr {
  background-color: var(--warning-soft) !important;
}

.linha-vigilancia:hover,
.tabela-vigilancia tr:hover {
  background-color: var(--warning-soft);
  filter: brightness(0.98);
}

/* ==========================================================
   Chips, avisos e estados
   ========================================================== */

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-soft);
}

.status-success {
  color: var(--success);
  background: var(--success-soft);
}

.status-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
}

.flash {
  border-radius: var(--radius-md);
  padding: 13px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
}

.flash-success { background: linear-gradient(135deg, #22c17d, var(--success)); }
.flash-danger { background: linear-gradient(135deg, #f2555a, var(--danger)); }
.flash-warning { background: linear-gradient(135deg, #f0a52b, var(--warning)); }
.flash-info { background: linear-gradient(135deg, #38bdf8, var(--info)); }

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.detail-card {
  border: 1px solid var(--border);
  box-shadow: none;
  background: var(--surface-soft);
  padding: 20px;
}

.detail-card h3 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-card p {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

/* ==========================================================
   OCR, assinatura e biometria
   ========================================================== */

.ocr-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(260px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.ocr-preview-panel,
.pdf-preview-panel {
  display: grid;
  gap: 10px;
}

.ocr-canvas-wrapper {
  position: relative;
  min-height: 360px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-soft);
  transition: border-color var(--transition);
}

.ocr-canvas-wrapper.has-image {
  border-style: solid;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.ocr-canvas-wrapper img {
  width: 100%;
  display: none;
}

.ocr-canvas-wrapper.has-image img {
  display: block;
}

.ocr-selection {
  position: absolute;
  border: 3px solid var(--danger);
  background: rgba(224, 47, 47, 0.16);
  pointer-events: none;
  border-radius: 4px;
}

.signature-find-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.signature-layout {
  margin-top: 18px;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.pdf-preview {
  width: 100%;
  min-height: 820px;
  height: 80vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
}

@media (max-width: 1024px) {
  .pdf-preview {
    min-height: 680px;
    height: 72vh;
  }
}

/* O canvas mantém fundo branco e tinta escura nos dois temas:
   é a mesma aparência que a assinatura terá no PDF. */
#signature-pad {
  width: 100%;
  height: 240px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: #ffffff;
  touch-action: none;
  cursor: crosshair;
  box-shadow: inset 0 2px 10px rgba(15, 23, 42, 0.06);
}

.signature-mode-group {
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: fit-content;
}

.signature-mode-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.signature-mode-group input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* A digital é traço preto com fundo transparente: o painel usa fundo claro
   (como o papel) para a digital ficar visível nos dois temas. */
#biometria-preview {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  display: inline-block;
  box-shadow: var(--shadow-sm);
}

#biometria-preview img {
  display: block;
  width: 320px;
  max-width: 100%;
  height: auto;
}

/* ==========================================================
   Movimento
   ========================================================== */

@keyframes surgir {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.content > section,
.content > nav.pagination {
  animation: surgir 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.content > section:nth-child(2) { animation-delay: 0.05s; }
.content > section:nth-child(3) { animation-delay: 0.1s; }
.content > section:nth-child(4) { animation-delay: 0.15s; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================
   Responsivo
   ========================================================== */

@media (max-width: 1080px) {
  :root {
    --sidebar-width: 232px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

  .sidebar nav {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .content {
    padding: 0 18px 36px;
  }

  .ocr-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 16px 0 12px;
  }
}

@media (max-width: 1040px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: min(820px, 100%);
  }

  .auth-panel {
    padding: 36px 30px;
  }

  .auth-form {
    padding: 36px 30px;
  }

  .auth-mock {
    display: none;
  }
}

@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: 1fr;
    width: min(520px, 100%);
    border-radius: 24px;
  }

  .auth-panel {
    padding: 28px 26px;
  }

  .auth-panel-inner {
    gap: 20px;
  }

  .auth-panel h1 {
    font-size: 1.45rem;
  }

  .auth-tagline {
    font-size: 0.88rem;
  }

  .auth-features {
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
  }

  .auth-features li {
    font-size: 0.84rem;
    gap: 9px;
  }

  .auth-features i {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 9px;
    font-size: 0.82rem;
  }

  .auth-form {
    padding: 30px 26px 32px;
  }

  .auth-form h2 {
    font-size: 1.32rem;
  }

  .auth-form-grid {
    margin: 20px 0 16px;
  }
}

@media (max-width: 560px) {
  .content-auth {
    padding: 16px 14px;
    justify-content: flex-start;
  }

  .auth-panel {
    padding: 24px 20px;
  }

  .auth-features {
    grid-template-columns: 1fr;
  }

  .auth-form {
    padding: 26px 20px 28px;
  }

  .auth-input input {
    height: 50px;
  }

  .auth-reveal {
    width: 40px;
    height: 40px;
  }

  .auth-submit {
    height: 50px;
  }

  .auth-theme {
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }
}

/* Telas baixas (celular deitado): o cartão de marca encolhe
   para que o formulário continue visível sem rolagem. */
@media (max-height: 620px) and (min-width: 821px) {
  .auth-mock {
    display: none;
  }

  .auth-panel,
  .auth-form {
    padding: 30px 34px;
  }

  .auth-panel-inner {
    gap: 20px;
  }
}

@media (max-width: 620px) {
  .card {
    padding: 20px;
    border-radius: var(--radius-lg);
  }

  .topbar-title {
    font-size: 1.2rem;
  }

  .settings-tabs {
    width: 100%;
  }

  .settings-tab {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ==========================================================
   Impressão
   ========================================================== */

@media print {
  .sidebar,
  .topbar,
  .pagination,
  .relatorio-filters {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}
