/* ============================================================
   Iuris CRM — Páginas legais públicas
   Tokens portados de apps/web/app/globals.css (Tema Grafite v2).
   Primária = grafite. Verde (--accent) só como sinal de destaque.
   ============================================================ */

:root {
  /* surfaces */
  --background: #FAFAFA;
  --foreground: #0A0A0A;
  --card: #FFFFFF;
  --muted: #F4F4F5;
  --muted-foreground: #71717A;
  --subtle: #A1A1AA;
  --border: #E4E4E7;
  --border-strong: #D4D4D8;

  /* brand / primary — grafite */
  --primary: #18181B;
  --primary-hover: #27272A;
  --primary-foreground: #FFFFFF;
  --primary-soft: #F4F4F5;

  /* accent — verde sóbrio */
  --accent: #047857;
  --accent-soft: rgba(4, 120, 87, 0.10);

  /* estados semânticos */
  --success: #047857;
  --warning: #B45309;
  --warning-soft: rgba(180, 83, 9, 0.08);
  --danger: #B91C1C;
  --info: #1D4ED8;
  --info-soft: rgba(29, 78, 216, 0.07);

  /* nota amarelada (paridade com o campo de notas internas do app) */
  --note: #FEF9C3;
  --note-foreground: #713F12;
  --note-border: #CA8A04;

  --shadow-card: 0 1px 2px rgba(10, 10, 10, 0.04), 0 1px 1px rgba(10, 10, 10, 0.02);
  --shadow-popover: 0 8px 24px rgba(10, 10, 10, 0.10), 0 2px 6px rgba(10, 10, 10, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --dot-color: rgba(10, 10, 10, 0.08);

  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* layout */
  --topbar-h: 60px;
  --content-max: 780px;
  --toc-w: 250px;
}

[data-theme='dark'] {
  --background: #09090B;
  --foreground: #FAFAFA;
  --card: #18181B;
  --muted: #27272A;
  --muted-foreground: #A1A1AA;
  --subtle: #71717A;
  --border: #27272A;
  --border-strong: #3F3F46;

  --primary: #FAFAFA;
  --primary-hover: #E4E4E7;
  --primary-foreground: #18181B;
  --primary-soft: #27272A;

  --accent: #10B981;
  --accent-soft: rgba(16, 185, 129, 0.15);

  --success: #10B981;
  --warning: #D97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #DC2626;
  --info: #3B82F6;
  --info-soft: rgba(59, 130, 246, 0.12);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 1px rgba(0, 0, 0, 0.20);
  --shadow-popover: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.30);

  --dot-color: rgba(255, 255, 255, 0.08);
}

/* ============================================================
   Reset enxuto
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

a:hover {
  text-decoration-color: var(--foreground);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Scrollbars finas (paridade com o app) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--foreground);
  text-decoration: none;
  line-height: 1;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand__tile {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  display: block;
}

.brand__tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand__name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand__suffix {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.75;
}

.topbar__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar__link {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  white-space: nowrap;
}

.topbar__link:hover {
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}

.topbar__link[aria-current='page'] {
  background: var(--primary-soft);
  color: var(--foreground);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--muted);
  color: var(--foreground);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

[data-theme='dark'] .theme-toggle .icon-sun,
:root:not([data-theme='dark']) .theme-toggle .icon-moon {
  display: none;
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  position: relative;
  border-bottom: 1px solid var(--border);
  background-color: var(--card);
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: hidden;
}

.hero__inner {
  position: relative;
  max-width: calc(var(--content-max) + var(--toc-w) + 48px);
  margin: 0 auto;
  padding: 52px 24px 44px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--background);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.hero__lead {
  margin: 16px 0 0;
  max-width: 62ch;
  font-size: 16.5px;
  color: var(--muted-foreground);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.meta-row__item {
  font-size: 13px;
  color: var(--muted-foreground);
}

.meta-row__item strong {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 2px;
}

/* ============================================================
   Layout de documento: índice sticky + conteúdo
   ============================================================ */

.layout {
  max-width: calc(var(--content-max) + var(--toc-w) + 48px);
  margin: 0 auto;
  padding: 0 24px 96px;
  display: grid;
  grid-template-columns: var(--toc-w) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
  max-height: calc(100vh - var(--topbar-h) - 56px);
  overflow-y: auto;
  padding: 28px 0 8px;
}

.toc__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.toc__list a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted-foreground);
  text-decoration: none;
}

.toc__list a:hover {
  color: var(--foreground);
  text-decoration: none;
}

.toc__list a.is-active {
  color: var(--foreground);
  border-left-color: var(--foreground);
  font-weight: 500;
}

.doc {
  padding: 34px 0 0;
  min-width: 0;
}

.doc__intro {
  padding: 18px 20px;
  margin-bottom: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-card);
  font-size: 14.5px;
  color: var(--muted-foreground);
}

.doc__intro p {
  margin: 0 0 10px;
}

.doc__intro p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Tipografia do documento
   ============================================================ */

.doc section {
  scroll-margin-top: calc(var(--topbar-h) + 20px);
  padding-bottom: 12px;
}

.doc section + section {
  margin-top: 44px;
}

.doc h2 {
  display: flex;
  gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 650;
}

.doc h2 .num {
  flex-shrink: 0;
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.doc h3 {
  margin: 30px 0 10px;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.doc h3 .num {
  color: var(--subtle);
  font-weight: 500;
  margin-right: 7px;
  font-variant-numeric: tabular-nums;
}

.doc p {
  margin: 0 0 14px;
}

.doc ul,
.doc ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.doc li {
  margin-bottom: 7px;
}

.doc li > ul,
.doc li > ol {
  margin-top: 7px;
  margin-bottom: 4px;
}

.doc strong {
  font-weight: 650;
}

.doc dfn {
  font-style: normal;
  font-weight: 650;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--muted);
  word-break: break-word;
}

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

.table-wrap {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  position: relative;
  padding: 10px 14px;
  background: var(--muted);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

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

tbody th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 650;
  vertical-align: top;
}

tbody tr:last-child th {
  border-bottom: none;
}

/* ============================================================
   Callouts
   ============================================================ */

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  background: var(--card);
  font-size: 14px;
}

.callout p {
  margin: 0 0 8px;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout__body {
  min-width: 0;
}

.callout__label {
  display: block;
  margin-bottom: 3px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.callout--info {
  border-left-color: var(--info);
  background: var(--info-soft);
}

.callout--info .callout__label {
  color: var(--info);
}

.callout--warn {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.callout--warn .callout__label {
  color: var(--warning);
}

.callout--accent {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.callout--accent .callout__label {
  color: var(--accent);
}

/* Cartão de contato / identificação */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 0 0 20px;
}

.card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.card__label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.card p {
  margin: 0;
  font-size: 14px;
}

.card p + p {
  margin-top: 6px;
}

/* Passos numerados (procedimento de exclusão) */
.steps {
  counter-reset: step;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.steps > li {
  position: relative;
  counter-increment: step;
  padding: 0 0 0 40px;
  margin-bottom: 16px;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  border-top: 1px solid var(--border);
  background: var(--card);
}

.footer__inner {
  max-width: calc(var(--content-max) + var(--toc-w) + 48px);
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
}

.footer h4 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
}

.footer p,
.footer li {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer a {
  color: var(--muted-foreground);
}

.footer a:hover {
  color: var(--foreground);
}

.footer__bottom {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--subtle);
}

/* Voltar ao topo */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--muted-foreground);
  box-shadow: var(--shadow-popover);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  color: var(--foreground);
  background: var(--muted);
}

.to-top svg {
  width: 17px;
  height: 17px;
}

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

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .toc {
    position: static;
    max-height: none;
    padding: 28px 0 0;
    overflow: visible;
  }

  .toc__inner {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
  }

  .doc {
    padding-top: 28px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14.5px;
  }

  .topbar {
    padding: 0 16px;
    gap: 8px;
  }

  .brand__name {
    font-size: 17px;
  }

  .topbar__link {
    padding: 7px 8px;
    font-size: 13px;
  }

  .hero__inner {
    padding: 36px 16px 32px;
  }

  .layout {
    padding: 0 16px 72px;
  }

  .footer__inner {
    padding: 32px 16px;
  }

  .to-top {
    right: 14px;
    bottom: 14px;
  }
}

/* ============================================================
   Impressão — documento limpo, sem cromo de navegação
   ============================================================ */

@media print {
  :root {
    --background: #FFFFFF;
    --card: #FFFFFF;
    --foreground: #000000;
    --muted-foreground: #333333;
    --border: #CCCCCC;
  }

  .topbar,
  .toc,
  .to-top,
  .theme-toggle {
    display: none !important;
  }

  .hero {
    background-image: none;
    border-bottom: 2px solid #000;
  }

  .layout {
    display: block;
    max-width: none;
    padding: 0;
  }

  .doc section {
    break-inside: avoid-page;
  }

  .doc h2 {
    break-after: avoid-page;
  }

  .table-wrap {
    overflow: visible;
    break-inside: avoid-page;
  }

  a {
    text-decoration: none;
  }

  a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.82em;
    color: #555;
    word-break: break-all;
  }
}
