@property --jc-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false
}

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

:root {
  --bg: #F0F2F7;
  --surface: #FFF;
  --text: #0F1B2D;
  --text2: #4B5563;
  --text3: #6B7280;
  --border: #E5E7EB;
  --navy: #0F1B2D;
  --accent: #2855B6;
  --blue: #2563EB;
  --qN: #9CA3AF;
  --qL: #60A5FA;
  --qM: #FBBF24;
  --qG: #FB923C;
  --qC: #EF4444;
  --yes: #059669;
  --no: #DC2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, .1);
}

[data-theme="dark"] {
  --bg: #0A0F1A;
  --surface: #141B2D;
  --text: #F1F5F9;
  --text2: #94A3B8;
  --text3: #94A3B8;
  --border: #1E293B;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, .4);
}

html {
  font-size: 15px
}

body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh
}

h1,
h2,
h3 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none
}

.ui-icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -.12em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round
}

.ui-icon.sm {
  width: .95em;
  height: .95em
}

.ui-icon.lg {
  width: 2.1rem;
  height: 2.1rem
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px
}

.skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  overflow: visible
}

.skip-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 58%, white);
  outline-offset: 2px;
}

.mode-simulador .skip-link[href="#judicialControlSection"],
.mode-simulador .skip-link[href="#flowchartSection"] {
  display: none
}

.mode-controle .skip-link[href="#flowchartSection"] {
  display: none
}

.mode-fluxograma .skip-link[href="#simuladorDetails"],
.mode-fluxograma .skip-link[href="#judicialControlSection"] {
  display: none
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 40px
}

/* HEADER */
header {
  background: var(--navy);
  color: #fff;
  padding: 24px 32px;
  border-radius: 0 0 20px 20px;
  margin: 0 -16px 20px;
  text-align: center
}

header h1 {
  font-size: 1.8rem;
  letter-spacing: -.02em;
  margin-bottom: 4px
}

header .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  letter-spacing: .05em;
  text-transform: uppercase
}

header .badge .ui-icon {
  width: .86em;
  height: .86em
}

header p {
  color: rgba(255, 255, 255, .65);
  font-size: .85rem
}

.header-portaria-link {
  color: rgba(236, 244, 255, .9);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.header-portaria-link:hover {
  color: #fff;
}

.header-portaria-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, .82);
  outline-offset: 2px;
  border-radius: 8px;
}

.header-sep {
  margin: 0 6px;
  color: rgba(255, 255, 255, .4);
}

.app-mode-switch {
  margin: 14px auto 0;
  display: inline-flex;
  align-items: center;
  border: 1.5px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, .06)
}

.mode-btn {
  min-width: 154px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .75);
  font-weight: 700;
  font-size: .8rem;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .18s, color .18s
}

.mode-btn:not(.active):hover {
  background: rgba(255, 255, 255, .12);
  color: #fff
}

.mode-btn+.mode-btn {
  border-left: 1px solid rgba(255, 255, 255, .18)
}

.mode-btn.active {
  background: #fff;
  color: var(--navy)
}

.header-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap
}

.header-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: rgba(255, 255, 255, .7);
  cursor: pointer;
  user-select: none
}

.header-row input[type=checkbox] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px
}

.header-row label:has(input[type=checkbox]:focus-visible) {
  outline: 2px solid rgba(255, 255, 255, .82);
  outline-offset: 2px;
}

/* TOOLBAR */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center
}

.toolbar-help-btn {
  flex-shrink: 0;
}

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

.toolbar-helper {
  margin: -10px 2px 16px;
  color: var(--text3);
  font-size: .74rem;
  line-height: 1.35
}

.toolbar-helper code {
  font: 700 .73rem/1 'DM Sans', sans-serif;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--surface);
  color: var(--text2)
}

.btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  filter: grayscale(0.5);
}

.btn:not(:disabled):active {
  transform: scale(0.96);
  transition-duration: 0.05s;
}

.btn .ui-icon {
  width: .95em;
  height: .95em
}

.btn-primary {
  background: linear-gradient(135deg, #3468C4, #2855B6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(40, 85, 182, .28)
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 85, 182, .38)
}

.btn-primary:not(:disabled):active {
  transform: translateY(1px) scale(0.96);
  box-shadow: 0 1px 4px rgba(40, 85, 182, .28);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border)
}

.btn-outline:not(:disabled):hover {
  border-color: var(--text3)
}

.btn-outline:not(:disabled):active {
  background: color-mix(in srgb, var(--surface) 95%, var(--text3) 5%);
}

.btn-red {
  background: #FEE2E2;
  color: #991B1B;
  border: 1.5px solid #FECACA
}

.btn-red:not(:disabled):hover {
  background: #FECACA;
  border-color: #FCA5A5;
}

.btn-red:not(:disabled):active {
  background: #FCA5A5;
}

.btn-red:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px #FECACA;
}

.idade-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: rgba(255, 255, 255, .82)
}

.idade-input input,
.idade-input select {
  width: 60px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  background: var(--surface);
  color: var(--text);
  text-align: center
}

.idade-input select {
  width: auto;
  text-align: left;
  cursor: pointer
}

.idade-status {
  font-size: .78rem;
  color: rgba(255, 255, 255, .64)
}

.hidden {
  display: none !important
}

.simulador-details {
  margin-bottom: 16px
}

.simulador-summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text2);
  padding: 10px 12px;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none
}

.simulador-summary::-webkit-details-marker {
  display: none
}

.simulador-summary::after {
  content: '+';
  font-size: .95rem;
  color: var(--text3)
}

.simulador-details[open] .simulador-summary::after {
  content: '−'
}

.simulador-body {
  margin-top: 10px
}

.mode-simulador .simulador-summary {
  display: none
}

.mode-simulador .simulador-body {
  margin-top: 0
}

.mode-simulador #judicialControlSection,
.mode-simulador #compSection,
.mode-simulador #flowchartSection {
  display: none
}

.mode-controle .footer-actions,
.mode-controle #textoSection,
.mode-controle #flowchartSection {
  display: none
}

.mode-fluxograma #simuladorDetails,
.mode-fluxograma .footer-actions,
.mode-fluxograma #textoSection,
.mode-fluxograma #compSection,
.mode-fluxograma #judicialControlSection {
  display: none
}

/* PANELS */
.calculator {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px
}

@media(max-width:1024px) {
  .calculator {
    grid-template-columns: 1fr
  }

  .mode-btn {
    min-width: 132px
  }
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--panel-color) 6%, var(--surface)), var(--surface))
}

.panel-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--panel-color);
  background: color-mix(in srgb, var(--panel-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--panel-color) 28%, transparent)
}

.panel-icon .ui-icon {
  width: 1.35rem;
  height: 1.35rem
}

.panel-header h2 {
  font-size: 1rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px
}

.panel-header .sub {
  font-size: .75rem;
  color: var(--text3);
  margin-top: 1px
}

.domains {
  padding: 12px 16px;
  flex: 1
}

/* DOMAIN ROW */
.domain-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent)
}

.domain-row:last-child {
  border-bottom: none
}

.domain-label {
  flex: 1;
  min-width: 0
}

.domain-code {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .75rem;
  color: var(--text3);
  width: 22px
}

.domain-name {
  font-size: .8rem;
  color: var(--text2)
}

.domain-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sim-help-btn {
  width: 20px;
  height: 20px;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--border));
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-soft) 70%, var(--surface));
  color: color-mix(in srgb, var(--blue) 70%, var(--text3));
  font: 700 .72rem/1 'DM Sans', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s ease, color .15s ease, background .15s ease, transform .15s ease;
}

.sim-help-btn:hover {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--border));
  color: color-mix(in srgb, var(--blue) 88%, var(--text2));
  background: color-mix(in srgb, var(--bg-soft) 40%, var(--surface));
  transform: translateY(-1px);
}

.sim-help-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 58%, white);
  outline-offset: 2px;
}

.sim-help-btn[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--blue) 65%, transparent);
  color: color-mix(in srgb, var(--blue) 95%, var(--text2));
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
}

.section-help-btn {
  width: 21px;
  height: 21px;
  font-size: .74rem;
}

.domain-help-btn {
  width: 18px;
  height: 18px;
  font-size: .68rem;
}

.note-buttons {
  display: flex;
  gap: 3px;
  flex-shrink: 0
}

.note-scale-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 4px
}

.note-scale-spacer {
  flex: 1;
  min-width: 0
}

.note-scale {
  display: grid;
  grid-template-columns: repeat(5, 34px);
  gap: 3px;
  flex-shrink: 0
}

.note-scale span {
  text-align: center;
  font-size: .66rem;
  color: var(--text3);
  font-weight: 700;
  letter-spacing: .02em
}

.note-btn {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: .8rem;
  color: var(--text3);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --hover-color: var(--text3);
  --hover-fg: #fff;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), border-color .18s ease, box-shadow .18s ease, background .2s ease, color .2s ease, filter .2s ease
}

.note-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, .45) 50%, transparent 80%);
  transform: translateX(-135%);
  opacity: 0;
  transition: transform .4s ease, opacity .2s ease;
  pointer-events: none
}

.note-btn[data-value="0"] {
  --hover-color: var(--qN);
  --hover-fg: #fff
}

.note-btn[data-value="1"] {
  --hover-color: var(--qL);
  --hover-fg: #fff
}

.note-btn[data-value="2"] {
  --hover-color: var(--qM);
  --hover-fg: #1a1a1a
}

.note-btn[data-value="3"] {
  --hover-color: var(--qG);
  --hover-fg: #fff
}

.note-btn[data-value="4"] {
  --hover-color: var(--qC);
  --hover-fg: #fff
}

@media (hover:hover) {
  .note-btn:not(.locked):hover {
    border-color: color-mix(in srgb, var(--hover-color) 48%, var(--border) 52%);
    background: linear-gradient(145deg, color-mix(in srgb, var(--hover-color) 14%, var(--surface)), color-mix(in srgb, var(--hover-color) 6%, var(--surface)));
    color: color-mix(in srgb, var(--hover-color) 54%, var(--text2) 46%);
    transform: translateY(-1px) scale(1.02);
    filter: saturate(1.05);
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--hover-color) 10%, transparent),
      0 4px 8px color-mix(in srgb, var(--hover-color) 18%, transparent)
  }

  .note-btn:not(.locked):hover::after {
    transform: translateX(110%);
    opacity: .45
  }

  .note-btn.active:not(.locked):hover {
    background: var(--hover-color);
    color: var(--hover-fg);
    border-color: var(--hover-color);
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--hover-color) 16%, transparent),
      0 5px 10px color-mix(in srgb, var(--hover-color) 22%, transparent),
      inset 0 1px 0 rgba(255, 255, 255, .22)
  }

  .note-btn:not(.locked):active {
    transform: translateY(0) scale(1)
  }
}

.note-btn.active[data-value="0"] {
  background: var(--qN);
  color: #fff;
  border-color: var(--qN)
}

.note-btn.active[data-value="1"] {
  background: var(--qL);
  color: #fff;
  border-color: var(--qL)
}

.note-btn.active[data-value="2"] {
  background: var(--qM);
  color: #1a1a1a;
  border-color: var(--qM)
}

.note-btn.active[data-value="3"] {
  background: var(--qG);
  color: #fff;
  border-color: var(--qG)
}

.note-btn.active[data-value="4"] {
  background: var(--qC);
  color: #fff;
  border-color: var(--qC)
}

.note-btn.locked {
  opacity: .7;
  cursor: not-allowed;
}

.note-btn.locked.active {
  opacity: 1
}

.section-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 6px
}

.badge-m {
  background: #EFF6FF;
  color: #1D4ED8;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .65rem
}

.badge-s {
  background: #F0FDF4;
  color: #166534;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .65rem
}

/* PANEL RESULT */
.panel-result {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 50%, var(--surface))
}

.formula {
  font-size: .78rem;
  color: var(--text3);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums
}

.formula .val {
  font-weight: 700;
  color: var(--text)
}

.result-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px
}

.result-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease, background .3s
}

.panel-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between
}

.qualifier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  transition: all .3s
}

.qualifier-badge[data-q="N"] {
  background: var(--qN)
}

.qualifier-badge[data-q="L"] {
  background: var(--qL)
}

.qualifier-badge[data-q="M"] {
  background: var(--qM);
  color: #1a1a1a
}

.qualifier-badge[data-q="G"] {
  background: var(--qG)
}

.qualifier-badge[data-q="C"] {
  background: var(--qC)
}

.qualifier-badge.large {
  width: 56px;
  height: 56px;
  font-size: 1.5rem;
  border-radius: 14px
}

.qual-name {
  font-size: .75rem;
  color: var(--text3);
  margin-top: 2px
}

.majoracao-toggles {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border)
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text2);
  cursor: pointer;
  user-select: none
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  transition: .3s;
  flex-shrink: 0
}


.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2)
}

input:checked+.toggle-switch {
  background: var(--blue)
}

input:checked+.toggle-switch::after {
  left: 18px
}

.toggle-label input[type=checkbox] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0
}

/* RESULTADO */
.resultado {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  margin-bottom: 20px
}

.resultado>h2 {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--text2)
}

.qualifiers-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px
}

.qual-card {
  text-align: center;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--bg);
  min-width: 140px
}

.qual-label {
  display: block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text3);
  margin-bottom: 8px
}

.qual-desc {
  display: block;
  font-size: .72rem;
  color: var(--text3);
  margin-top: 4px
}

.qual-sep {
  font-size: 1.5rem;
  color: var(--text3);
  font-weight: 300
}

/* TABELA CONCLUSIVA */
.tabela-section {
  margin-bottom: 24px
}

.tabela-section h3 {
  font-size: .9rem;
  text-align: center;
  margin-bottom: 12px;
  color: var(--text2)
}

.amb-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px
}

.amb-tab-label {
  font-size: .75rem;
  color: var(--text3);
  align-self: center;
  margin-right: 8px
}

.amb-tab {
  width: 36px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: .8rem;
  color: var(--text3);
  cursor: pointer;
  transition: all .15s
}

.amb-tab:not(.active):hover {
  border-color: var(--text3);
  color: var(--text2);
  background: color-mix(in srgb, var(--border) 20%, var(--surface))
}

.amb-tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy)
}

[data-theme="dark"] .amb-tab.active {
  background: var(--accent);
  color: #1a1a1a;
  border-color: var(--accent)
}

.tabela-matrix {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  grid-template-areas:
    ". top"
    "left grid";
  column-gap: 12px;
  row-gap: 10px;
  align-items: stretch;
  max-width: 680px;
  margin: 0 auto
}

.tabela-axis-top,
.tabela-axis-left {
  border: 1px solid color-mix(in srgb, var(--blue) 12%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 68%, var(--surface));
  color: var(--text2)
}

.tabela-axis-top {
  grid-area: top;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  text-align: center
}

.tabela-axis-left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  text-align: center
}

.axis-kicker {
  font-size: .64rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700
}

.axis-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text2)
}

.axis-arrow {
  font-size: .9rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--blue) 70%, var(--text3));
  line-height: 1
}

.tabela-grid {
  grid-area: grid;
  display: grid;
  grid-template-columns: auto repeat(5, 1fr);
  gap: 3px;
  max-width: 560px;
  width: 100%;
  margin: 0
}

.tc {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: .75rem;
  transition: all .3s
}

.tc.header {
  background: transparent;
  color: var(--text3);
  font-size: .7rem
}

.tc.corner {
  background: transparent
}

.tc.row-header {
  background: transparent;
  color: var(--text3);
  font-size: .7rem;
  justify-content: flex-end;
  padding-right: 8px
}

.tc.yes {
  background: #D1FAE5;
  color: #065F46
}

.tc.no {
  background: #FEE2E2;
  color: #991B1B
}

[data-theme="dark"] .tc.yes {
  background: #064E3B;
  color: #6EE7B7
}

[data-theme="dark"] .tc.no {
  background: #450A0A;
  color: #FCA5A5
}

.tc.active-cell {
  outline: 3px solid var(--navy);
  outline-offset: -1px;
  animation: pulse-cell 1.5s ease infinite;
  z-index: 1;
  font-weight: 700;
  font-size: .8rem
}

[data-theme="dark"] .tc.active-cell {
  outline-color: var(--accent)
}

.tc-sensitivity {
  position: relative;
}

.tc-sensitivity::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  border: 1.5px dashed color-mix(in srgb, var(--blue) 48%, var(--text3));
  pointer-events: none;
}

.tc-sensitivity-no {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #991B1B 34%, transparent);
}

.tc-sensitivity-yes {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #065F46 34%, transparent);
}

[data-theme="dark"] .tc-sensitivity::after {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--text3));
}

@keyframes pulse-cell {

  0%,
  100% {
    outline-offset: -1px
  }

  50% {
    outline-offset: 2px
  }
}

.tabela-labels {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px
}

.tabela-labels span {
  font-size: .7rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block
}

.dot.g {
  background: #D1FAE5;
  border: 1px solid #065F46
}

.dot.r {
  background: #FEE2E2;
  border: 1px solid #991B1B
}

.tabela-impact-note {
  max-width: 680px;
  margin: 10px auto 0;
  font-size: .74rem;
  line-height: 1.35;
  color: var(--text3);
  text-align: center
}

.tabela-impact-note strong {
  color: var(--text2)
}

.tabela-sensitivity-legend {
  margin: 8px 0 0;
  font-size: .69rem;
  line-height: 1.35;
  color: var(--text3);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dot-sensitivity {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1.5px dashed color-mix(in srgb, var(--blue) 52%, var(--text3));
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  display: inline-block;
}

/* DECISION BANNER */
.decision {
  text-align: center;
  padding: 20px;
  border-radius: 14px;
  transition: all .4s
}

.decision.deferido {
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  border: 2px solid #059669
}

.decision.indeferido {
  background: linear-gradient(135deg, #FEE2E2, #FECACA);
  border: 2px solid #DC2626
}

.decision.impedimento {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border: 2px solid #D97706
}

[data-theme="dark"] .decision.deferido {
  background: linear-gradient(135deg, #064E3B, #065F46);
  border-color: #10B981
}

[data-theme="dark"] .decision.indeferido {
  background: linear-gradient(135deg, #450A0A, #7F1D1D);
  border-color: #F87171
}

[data-theme="dark"] .decision.impedimento {
  background: linear-gradient(135deg, #451A03, #78350F);
  border-color: #FBBF24
}

.decision-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px
}

.decision.deferido .decision-icon {
  color: #065F46
}

.decision.indeferido .decision-icon {
  color: #991B1B
}

.decision.impedimento .decision-icon {
  color: #92400E
}

[data-theme="dark"] .decision.deferido .decision-icon {
  color: #6EE7B7
}

[data-theme="dark"] .decision.indeferido .decision-icon {
  color: #FCA5A5
}

[data-theme="dark"] .decision.impedimento .decision-icon {
  color: #FCD34D
}

.decision-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 700
}

.decision.deferido .decision-label {
  color: #065F46
}

.decision.indeferido .decision-label {
  color: #991B1B
}

.decision.impedimento .decision-label {
  color: #92400E
}

[data-theme="dark"] .decision.deferido .decision-label {
  color: #6EE7B7
}

[data-theme="dark"] .decision.indeferido .decision-label {
  color: #FCA5A5
}

[data-theme="dark"] .decision.impedimento .decision-label {
  color: #FCD34D
}

.decision-reason {
  display: block;
  font-size: .8rem;
  color: var(--text2);
  margin-top: 4px
}

.decision-item {
  font-size: .75rem;
  color: var(--text3);
  margin-top: 2px
}

/* COMPARISON */
.comparison {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px
}

.comparison h3 {
  font-size: .95rem;
  margin-bottom: 16px;
  text-align: center;
  color: var(--text2)
}

/* STANDARD TEXT */
.standard-text {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px
}

.standard-text h3 {
  font-size: .95rem;
  margin-bottom: 8px;
  text-align: center;
  color: var(--text2)
}

.standard-text .helper {
  text-align: center;
  font-size: .75rem;
  color: var(--text3);
  margin-bottom: 12px
}

.standard-text textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: .8rem;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: var(--bg2);
  color: var(--text)
}

.standard-text-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap
}

.copy-feedback {
  font-size: .75rem;
  color: var(--text3)
}

/* JUDICIAL CONTROL */
.judicial-control {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px
}

.judicial-control h3 {
  font-size: .98rem;
  margin-bottom: 8px;
  text-align: center;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px
}

.judicial-control .helper {
  text-align: center;
  font-size: .75rem;
  color: var(--text3);
  margin-bottom: 12px
}

.flowchart-view {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px
}

.flowchart-view h3 {
  font-size: .98rem;
  margin-bottom: 8px;
  text-align: center;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px
}

.flowchart-view .helper {
  text-align: center;
  font-size: .75rem;
  color: var(--text3);
  margin-bottom: 12px
}

.flowchart-step-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
  padding: 4px
}

.flowchart-step-nav button {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
  color: var(--text2);
  font-size: .84rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease
}

.flowchart-step-nav button:hover {
  border-color: color-mix(in srgb, var(--blue) 24%, var(--border))
}

.flowchart-step-nav button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 70%, #fff);
  outline-offset: 2px
}

.flowchart-step-nav button.is-active {
  color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 88%, #11203f), var(--blue));
  border-color: color-mix(in srgb, var(--blue) 64%, var(--border));
  box-shadow: 0 8px 18px rgba(37, 99, 235, .24)
}

.flowchart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(250px, .58fr);
  gap: 14px;
  align-items: start
}

.flowchart-overview {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, #eef3fb);
  padding: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55)
}

.flowchart-overview h4 {
  font-size: .9rem;
  color: var(--text2);
  margin-bottom: 4px
}

.flowchart-overview-helper {
  font-size: .75rem;
  color: var(--text3);
  margin-bottom: 10px
}

.flowchart-overview-media-wrap {
  border: 1px solid color-mix(in srgb, var(--border) 88%, #d9e3f3);
  border-radius: 12px;
  overflow: hidden;
  background: #f5f8fd
}

.flowchart-overview-media {
  display: block;
  width: 100%;
  height: auto
}

.flowchart-overview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--blue);
  text-decoration: none
}

.flowchart-overview-link:hover {
  text-decoration: underline
}

.flowchart-overview-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 58%, white);
  outline-offset: 2px;
  border-radius: 4px;
}

.flowchart-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0
}

.flow-step-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
  min-width: 0;
  transition: border-color .2s ease, box-shadow .2s ease, opacity .2s ease
}

.flow-step-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 72%, #fff);
  outline-offset: 2px
}

.flow-step-eyebrow {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  color: var(--text3);
  margin-bottom: 4px
}

.flow-step-card h4 {
  margin-bottom: 6px;
  color: var(--text2);
  font-size: .93rem;
  line-height: 1.35
}

.flow-step-body {
  font-size: .83rem;
  color: var(--text2);
  line-height: 1.45;
  margin-bottom: 9px
}

.flow-step-branches {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px
}

.flow-step-branches li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.4;
  min-width: 0
}

.flow-step-branches li span:last-child {
  min-width: 0
}

.flow-branch-tag {
  flex-shrink: 0;
  min-height: 20px;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .03em;
  border: 1px solid transparent
}

.flow-branch-tag.yes {
  background: color-mix(in srgb, var(--yes) 14%, #fff);
  border-color: color-mix(in srgb, var(--yes) 35%, transparent);
  color: #065f46
}

.flow-branch-tag.no {
  background: color-mix(in srgb, var(--no) 12%, #fff);
  border-color: color-mix(in srgb, var(--no) 34%, transparent);
  color: #991b1b
}

.flow-branch-tag.next {
  background: color-mix(in srgb, var(--blue) 12%, #fff);
  border-color: color-mix(in srgb, var(--blue) 30%, transparent);
  color: #1e3a8a
}

.flowchart-has-focus .flow-step-card {
  opacity: .68
}

.flowchart-has-focus .flow-step-card.is-active {
  opacity: 1;
  border-color: color-mix(in srgb, var(--blue) 42%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 20%, transparent), 0 10px 18px rgba(37, 99, 235, .14)
}

@media (min-width:941px) {
  .flowchart-layout {
    gap: 10px;
  }

  .flowchart-overview {
    padding: 10px;
  }

  .flowchart-overview-helper {
    font-size: .72rem;
    margin-bottom: 8px;
  }

  .flowchart-overview-link {
    margin-top: 8px;
    font-size: .76rem;
  }

  .flowchart-mobile-list {
    max-height: min(78vh, 980px);
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    padding-right: 2px;
  }

  .flow-step-card {
    padding: 10px;
    border-radius: 10px;
  }

  .flow-step-eyebrow {
    font-size: .68rem;
  }

  .flow-step-card h4 {
    font-size: .9rem;
    margin-bottom: 5px;
  }

  .flow-step-body {
    font-size: .8rem;
    line-height: 1.4;
    margin-bottom: 7px;
  }

  .flow-step-branches li {
    font-size: .8rem;
    line-height: 1.35;
  }

  .flow-branch-tag {
    min-height: 18px;
    padding: 1px 6px;
    font-size: .63rem;
  }
}

@media (min-width:1280px) {
  .flowchart-layout {
    grid-template-columns: minmax(0, 1.58fr) minmax(230px, .42fr);
  }
}

[data-theme="dark"] .flowchart-overview {
  background: color-mix(in srgb, var(--surface) 90%, #1a2742)
}

[data-theme="dark"] .flowchart-overview-media-wrap {
  background: #101a2a;
  border-color: color-mix(in srgb, var(--border) 80%, #2f4368)
}

[data-theme="dark"] .flow-step-card {
  background: color-mix(in srgb, var(--surface) 96%, #0e1728)
}

[data-theme="dark"] .flow-branch-tag.yes {
  color: #6ee7b7
}

[data-theme="dark"] .flow-branch-tag.no {
  color: #fca5a5
}

[data-theme="dark"] .flow-branch-tag.next {
  color: #93c5fd
}

.jc-workflow {
  display: flex;
  flex-direction: column;
  gap: 12px
}

.jc-progress-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px 10px;
  margin-bottom: 8px
}

.jc-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: .74rem;
  color: var(--text2);
  font-weight: 700
}

.jc-progress-track {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 70%, var(--surface));
  overflow: hidden
}

.jc-progress-bar {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--blue) 70%, #fff), var(--blue));
  transition: width .28s ease
}

.jc-why-blocked {
  border: 1px solid #F59E0B;
  background: #FEF3C7;
  color: #92400E;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: .76rem;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px
}

[data-theme="dark"] .jc-why-blocked {
  background: #451A03;
  color: #FCD34D;
  border-color: #F59E0B
}

.jc-step {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 12px
}

.jc-step.active-step {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 18%, transparent);
  background: color-mix(in srgb, var(--blue) 4%, var(--bg))
}

.jc-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px
}

.jc-step-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  color: var(--text2)
}

.jc-step-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--blue) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--blue) 32%, transparent);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700
}

.jc-step-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--text3);
  background: var(--surface)
}

.jc-step-state.done {
  border-color: #10B981;
  color: #065F46;
  background: #D1FAE5
}

.jc-step-state.pending {
  border-color: #F59E0B;
  color: #92400E;
  background: #FEF3C7
}

.jc-step-state.blocked {
  border-color: var(--border);
  color: var(--text3);
  background: var(--surface)
}

[data-theme="dark"] .jc-step-state.done {
  border-color: #10B981;
  color: #6EE7B7;
  background: #064E3B
}

[data-theme="dark"] .jc-step-state.pending {
  border-color: #F59E0B;
  color: #FCD34D;
  background: #451A03
}

.jc-step-helper {
  font-size: .76rem;
  color: var(--text3);
  margin-bottom: 10px
}

.jc-step-note {
  font-size: .75rem;
  color: var(--text2);
  margin: -2px 0 10px;
  line-height: 1.35
}

.jc-step-guidance {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text2);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px
}

.jc-step-guidance.pending {
  border-color: #F59E0B;
  background: #FEF3C7;
  color: #92400E
}

.jc-step-guidance.done {
  border-color: #10B981;
  background: #D1FAE5;
  color: #065F46
}

.jc-step-guidance.blocked {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text3)
}

.jc-step-guidance-text {
  font-size: .74rem;
  line-height: 1.35;
  flex: 1 1 auto
}

[data-theme="dark"] .jc-step-guidance.pending {
  background: #451A03;
  color: #FCD34D;
  border-color: #F59E0B
}

[data-theme="dark"] .jc-step-guidance.done {
  background: #064E3B;
  color: #6EE7B7;
  border-color: #10B981
}

.jc-qual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 10px
}

.jc-qual-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px
}

.jc-qual-item .jc-field-title {
  width: 100%;
  text-align: center;
  margin-bottom: 0
}

.jc-qual-item .jc-q-buttons {
  justify-content: center;
  margin: 0 auto
}

.jc-field-title {
  font-size: .74rem;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 6px;
  line-height: 1.2
}

.jc-field-title-with-help {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.jc-field-title-with-help>span {
  flex: 1 1 auto;
  min-width: 0;
}

.jc-domain-help-btn {
  flex-shrink: 0;
  margin-top: -1px;
}

.jc-q-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

/* ---- Rotating border for pending/invalid fields ---- */
.jc-q-buttons.jc-invalid {
  border: 1.5px solid transparent;
  border-radius: 9px;
  padding: 6px;
  background: #FEF2F2;
  position: relative;
}

[data-theme="dark"] .jc-q-buttons.jc-invalid {
  background: #450A0A
}

.jc-q-buttons.jc-invalid,
.jc-segmented.jc-invalid,
.jc-mini-textarea.jc-invalid,
.jc-reduction-alert.jc-invalid,
.jc-autofill-btn.jc-invalid,
.btn.jc-invalid {
  position: relative;
  isolation: isolate
}

/* Segmented controls need inner spacing so the rotating border is not hidden by full-size buttons */
.jc-segmented.jc-invalid {
  padding: 2px;
  background: var(--surface);
  overflow: visible !important;
}

.jc-segmented.jc-invalid .jc-seg-btn:first-child {
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
}

.jc-segmented.jc-invalid .jc-seg-btn:last-child {
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
}

/* For wide segmented controls (e.g., "Manter" / "Alterar"), avoid the conic
   sliver artifact between buttons and highlight the whole group container. */
.jc-segmented-wide.jc-invalid {
  border: 1.5px solid #EF4444 !important;
  border-radius: 10px;
  padding: 4px;
  background: color-mix(in srgb, #FEF2F2 70%, var(--surface));
  box-shadow: 0 0 0 0 rgba(239, 68, 68, .36);
  animation: jc-segmented-wide-invalid-pulse 1.4s ease-out infinite;
}

.jc-segmented-wide.jc-invalid::before,
.jc-segmented-wide.jc-invalid::after {
  content: none;
}

/* select can't host ::before, so keep a static red border */
.jc-select.jc-invalid {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18)
}

/* The rotating conic-gradient pseudo-element */
.jc-q-buttons.jc-invalid::before,
.jc-segmented.jc-invalid::before,
.jc-mini-textarea.jc-invalid::before,
.jc-reduction-alert.jc-invalid::before,
.jc-autofill-btn.jc-invalid::before,
.btn.jc-invalid::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--jc-angle),
      transparent 0%,
      #EF4444 10%,
      transparent 20%,
      transparent 100%);
  animation: jc-border-spin 2.5s linear infinite;
  z-index: 0;
  pointer-events: none
}

/* Inner mask: creates the "border only" illusion */
.jc-q-buttons.jc-invalid::after,
.jc-segmented.jc-invalid::after,
.jc-mini-textarea.jc-invalid::after,
.jc-reduction-alert.jc-invalid::after,
.jc-autofill-btn.jc-invalid::after,
.btn.jc-invalid::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: inherit;
  z-index: 0;
  pointer-events: none
}

/* Ensure child content sits above the pseudo-elements */
.jc-q-buttons.jc-invalid>*,
.jc-segmented.jc-invalid>*,
.jc-mini-textarea.jc-invalid>*,
.jc-reduction-alert.jc-invalid>*,
.jc-autofill-btn.jc-invalid>*,
.btn.jc-invalid>* {
  position: relative;
  z-index: 1
}

/* Buttons can contain plain text nodes (not wrapped elements).
   Keep animated layers behind to avoid hiding label text. */
.btn.jc-invalid {
  z-index: 0
}

.btn.jc-invalid::before {
  z-index: -2
}

.btn.jc-invalid::after {
  z-index: -1
}

/* Dark mode: use a lighter red for better contrast */
[data-theme="dark"] .jc-q-buttons.jc-invalid::before,
[data-theme="dark"] .jc-segmented.jc-invalid::before,
[data-theme="dark"] .jc-mini-textarea.jc-invalid::before,
[data-theme="dark"] .jc-reduction-alert.jc-invalid::before,
[data-theme="dark"] .jc-autofill-btn.jc-invalid::before,
[data-theme="dark"] .btn.jc-invalid::before {
  background: conic-gradient(from var(--jc-angle),
      transparent 0%,
      #F87171 10%,
      transparent 20%,
      transparent 100%)
}

[data-theme="dark"] .jc-select.jc-invalid {
  border-color: #F87171 !important;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.22)
}

[data-theme="dark"] .jc-segmented-wide.jc-invalid {
  border-color: #F87171 !important;
  background: color-mix(in srgb, #450A0A 52%, var(--surface));
  box-shadow: 0 0 0 0 rgba(248, 113, 113, .4);
}

@keyframes jc-border-spin {
  to {
    --jc-angle: 360deg
  }
}

@keyframes jc-segmented-wide-invalid-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .36);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@media (prefers-reduced-motion: reduce) {

  .jc-q-buttons.jc-invalid::before,
  .jc-segmented.jc-invalid::before,
  .jc-mini-textarea.jc-invalid::before,
  .jc-reduction-alert.jc-invalid::before,
  .jc-autofill-btn.jc-invalid::before,
  .btn.jc-invalid::before {
    animation: none;
    background: #EF4444
  }

  .jc-segmented-wide.jc-invalid {
    animation: none;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, .2);
  }
}

.jc-inline-note {
  font-size: .77rem;
  color: var(--text2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
  background: var(--surface)
}

.jc-actions-main {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center
}

.jc-actions-main .btn {
  padding: 8px 12px;
  font-size: .78rem
}

.jc-primary-btn {
  box-shadow: 0 2px 8px rgba(197, 165, 90, .28)
}

.jc-autofill-details {
  margin-top: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px
}

.jc-autofill-details summary {
  cursor: pointer;
  font-size: .75rem;
  color: var(--text2);
  font-weight: 700
}

.jc-autofill-body {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center
}

.jc-autofill-hint {
  font-size: .74rem;
  color: var(--text3);
  flex: 1 1 280px
}

.jc-autofill-btn {
  background: transparent;
  color: var(--text2);
  border: 1px dashed var(--border);
  padding: 7px 10px;
  font-size: .75rem
}

.jc-autofill-btn:not(:disabled):hover {
  border-color: color-mix(in srgb, var(--blue) 35%, var(--border));
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 6%, var(--surface))
}

.jc-autofill-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  filter: grayscale(0.5);
}

.jc-segmented {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface)
}

.jc-seg-btn {
  min-width: 68px;
  height: 32px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-weight: 700;
  cursor: pointer;
  font-size: .78rem;
  outline: none
}

.jc-seg-btn:not(:disabled):not(.active):hover {
  background: color-mix(in srgb, var(--border) 40%, var(--surface));
  color: var(--text)
}

.jc-seg-btn:last-child {
  border-right: none
}

.jc-seg-btn.active {
  background: var(--blue);
  color: #fff
}

.jc-seg-btn:disabled {
  cursor: not-allowed;
  color: var(--text3);
  background: color-mix(in srgb, var(--border) 18%, var(--surface));
  opacity: .75
}

.jc-seg-btn:focus-visible {
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 72%, #fff 28%);
}

.jc-q-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 72%, #fff 28%);
}

.jc-segmented-wide {
  width: 100%;
  border: none;
  background: transparent;
  gap: 6px;
  flex-wrap: wrap
}

.jc-segmented-wide .jc-seg-btn {
  flex: 1 1 220px;
  min-width: 180px;
  height: auto;
  line-height: 1.25;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-right: 1.5px solid var(--border);
  border-radius: 8px
}

.jc-segmented-wide .jc-seg-btn:last-child {
  border-right: 1.5px solid var(--border)
}

.jc-med-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px
}

.jc-field {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface)
}

.jc-field-span-2 {
  grid-column: 1 / -1
}

.jc-field-helper {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.35
}

.jc-q-btn {
  min-width: 36px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text3);
  font-weight: 700;
  cursor: pointer;
  transition: all .15s
}

.jc-q-btn:not(:disabled):not(.active):hover {
  border-color: var(--text3)
}

.jc-q-btn.active[data-value="0"] {
  background: var(--qN);
  color: #fff;
  border-color: var(--qN)
}

.jc-q-btn.active[data-value="1"] {
  background: var(--qL);
  color: #fff;
  border-color: var(--qL)
}

.jc-q-btn.active[data-value="2"] {
  background: var(--qM);
  color: #1a1a1a;
  border-color: var(--qM)
}

.jc-q-btn.active[data-value="3"] {
  background: var(--qG);
  color: #fff;
  border-color: var(--qG)
}

.jc-q-btn.active[data-value="4"] {
  background: var(--qC);
  color: #fff;
  border-color: var(--qC)
}

.jc-ativ-mode-block {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border)
}

.jc-field-title-margin {
  margin-top: 8px
}

.jc-mini-textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: .76rem;
  line-height: 1.35;
  font-family: inherit;
  background: var(--bg2);
  color: var(--text)
}

.jc-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .76rem;
  background: var(--surface);
  color: var(--text2)
}

.jc-complete-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 6px
}

.jc-complete-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  background: var(--bg)
}

.jc-complete-item .jc-field-title {
  font-size: .7rem
}

.jc-trace {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--text2);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 4px
}

.jc-trace-line {
  border-left: 2px solid var(--border);
  padding-left: 8px
}

.jc-status-badge {
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  color: var(--text2)
}

.jc-status-badge.dispensa {
  border-color: #10B981;
  color: #065F46;
  background: #D1FAE5
}

.jc-status-badge.necessaria {
  border-color: #EF4444;
  color: #991B1B;
  background: #FEE2E2
}

.jc-status-badge.pending {
  border-color: #F59E0B;
  color: #92400E;
  background: #FEF3C7
}

[data-theme="dark"] .jc-status-badge.dispensa {
  border-color: #10B981;
  color: #6EE7B7;
  background: #064E3B
}

[data-theme="dark"] .jc-status-badge.necessaria {
  border-color: #F87171;
  color: #FCA5A5;
  background: #450A0A
}

[data-theme="dark"] .jc-status-badge.pending {
  border-color: #F59E0B;
  color: #FCD34D;
  background: #451A03
}

.jc-textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: .8rem;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: var(--bg2);
  color: var(--text)
}

.jc-admin-rec-wrap {
  margin-top: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px
}

.jc-help-details {
  margin-top: 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--blue) 4%, var(--surface));
  padding: 8px
}

.jc-help-details summary {
  cursor: pointer;
  font-size: .75rem;
  color: var(--text2);
  font-weight: 700
}

.jc-help-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px
}

.jc-help-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px
}

.jc-help-title {
  font-size: .74rem;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 4px
}

.jc-help-item p {
  font-size: .73rem;
  color: var(--text2);
  line-height: 1.45
}

.jc-help-item p+p {
  margin-top: 5px
}

.jc-reduction-alert {
  margin-top: 8px;
  border: 1px solid #F59E0B;
  background: #FFFBEB;
  color: #92400E;
  border-radius: 8px;
  padding: 8px;
  font-size: .74rem;
  display: flex;
  flex-direction: column;
  gap: 6px
}

.jc-reduction-alert label {
  display: inline-flex;
  align-items: center;
  gap: 6px
}

[data-theme="dark"] .jc-reduction-alert {
  border-color: #F59E0B;
  background: #451A03;
  color: #FCD34D
}

.jc-next-target {
  animation: jc-next-target-pulse .95s ease
}

@keyframes jc-next-target-pulse {

  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 40%, transparent)
  }

  70% {
    box-shadow: 0 0 0 10px transparent
  }

  100% {
    box-shadow: 0 0 0 0 transparent
  }
}

.jc-social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px
}

.jc-social-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  background: var(--bg)
}

.jc-social-item .jc-field-title {
  font-size: .7rem;
  text-align: center
}

.jc-social-item .jc-segmented {
  display: flex;
  width: max-content;
  justify-content: center;
  margin: 0 auto
}

#jcImpedimentoButtons,
#jcHasAtivMedButtons {
  display: flex;
  width: max-content;
  justify-content: center;
  margin: 0 auto
}

@media(max-width:900px) {
  .jc-qual-grid {
    grid-template-columns: 1fr
  }

  .jc-med-grid {
    grid-template-columns: 1fr
  }

  .jc-social-grid {
    grid-template-columns: 1fr
  }

  .jc-complete-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr))
  }

  .jc-help-grid {
    grid-template-columns: 1fr
  }

  .jc-actions-main .jc-primary-btn,
  .jc-autofill-btn {
    width: 100%;
    justify-content: center
  }
}

.comp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

@media(max-width:600px) {
  .comp-grid {
    grid-template-columns: 1fr
  }

  .jc-complete-grid {
    grid-template-columns: 1fr
  }
}

@media(min-width:1200px) {
  html {
    font-size: 16px
  }

  body {
    line-height: 1.58
  }

  header h1 {
    font-size: 2rem
  }

  header p {
    font-size: .92rem
  }

  .mode-btn,
  .header-row label {
    font-size: .86rem
  }

  .btn {
    font-size: .9rem
  }

  .simulador-summary {
    font-size: .86rem
  }

  .panel-header h2 {
    font-size: 1.08rem
  }

  .panel-header .sub {
    font-size: .82rem
  }

  .domain-code {
    font-size: .78rem
  }

  .domain-name {
    font-size: .88rem;
    line-height: 1.35
  }

  .note-scale span {
    font-size: .72rem
  }

  .formula {
    font-size: .84rem
  }

  .qual-name {
    font-size: .8rem
  }

  .resultado>h2 {
    font-size: 1.2rem
  }

  .tabela-section h3 {
    font-size: .96rem
  }

  .judicial-control h3 {
    font-size: 1.08rem
  }

  .judicial-control .helper {
    font-size: .82rem
  }

  .flowchart-view h3 {
    font-size: 1.08rem
  }

  .flowchart-view .helper {
    font-size: .82rem
  }

  .jc-progress-head {
    font-size: .8rem
  }

  .jc-why-blocked {
    font-size: .82rem
  }

  .jc-step-title {
    font-size: .9rem
  }

  .jc-step-state {
    font-size: .74rem
  }

  .jc-step-helper {
    font-size: .82rem
  }

  .jc-step-note {
    font-size: .81rem;
    line-height: 1.45
  }

  .jc-step-guidance-text {
    font-size: .8rem
  }

  .jc-field-title {
    font-size: .8rem;
    line-height: 1.3
  }

  .jc-field-helper {
    font-size: .79rem;
    line-height: 1.45
  }

  .jc-inline-note {
    font-size: .82rem;
    line-height: 1.45
  }

  .jc-actions-main .btn {
    font-size: .83rem
  }

  .jc-autofill-details summary,
  .jc-autofill-btn,
  .jc-autofill-hint {
    font-size: .8rem
  }

  .jc-seg-btn {
    font-size: .82rem
  }

  .jc-mini-textarea,
  .jc-select {
    font-size: .82rem;
    line-height: 1.45
  }

  .jc-complete-item .jc-field-title,
  .jc-social-item .jc-field-title {
    font-size: .76rem
  }

  .jc-trace {
    font-size: .83rem;
    line-height: 1.5
  }

  .jc-status-badge {
    font-size: .84rem
  }

  .jc-textarea {
    font-size: .84rem;
    line-height: 1.52
  }

  .jc-help-details summary,
  .jc-help-title {
    font-size: .8rem
  }

  .jc-help-item p {
    font-size: .79rem;
    line-height: 1.5
  }

  .jc-reduction-alert {
    font-size: .8rem
  }

  .copy-feedback,
  .comp-quals,
  .comp-change,
  footer {
    font-size: .8rem
  }
}

.comp-card {
  padding: 16px;
  border-radius: 10px;
  text-align: center
}

.comp-card.inss {
  background: #FEF3C7;
  border: 1.5px solid #F59E0B
}

.comp-card.pericia {
  background: #DBEAFE;
  border: 1.5px solid #3B82F6
}

[data-theme="dark"] .comp-card.inss {
  background: #451A03;
  border-color: #F59E0B
}

[data-theme="dark"] .comp-card.pericia {
  background: #1E2A4A;
  border-color: #3B82F6
}

.comp-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 8px
}

.comp-quals {
  font-size: .8rem;
  color: var(--text2);
  margin-bottom: 8px
}

.comp-result {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px
}

.comp-result .ui-icon {
  width: .95em;
  height: .95em
}

.comp-result.yes {
  color: var(--yes)
}

.comp-result.no {
  color: var(--no)
}

.comp-change {
  margin-top: 8px;
  font-size: .75rem;
  color: var(--text3)
}

/* FOOTER */
.footer-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap
}

footer {
  text-align: center;
  padding: 20px;
  color: var(--text3);
  font-size: .75rem
}

footer p {
  margin-bottom: 4px
}

@media(min-width:1200px) {
  .comp-title {
    font-size: .9rem
  }

  .comp-quals {
    font-size: .84rem
  }

  .comp-change {
    font-size: .8rem
  }

  footer {
    font-size: .8rem
  }
}

@media(min-width:1600px) {
  html {
    font-size: 16.5px
  }
}

/* ANIMATION */
@keyframes pop {
  0% {
    transform: scale(1)
  }

  50% {
    transform: scale(1.08)
  }

  100% {
    transform: scale(1)
  }
}

.pop {
  animation: pop .3s ease
}

/* REDESIGN LAYER (2026-02) */
:root {
  --bg: #e8edf6;
  --bg2: #f2f6fd;
  --surface: #fdfefe;
  --text: #111c30;
  --text2: #34445f;
  --text3: #63738f;
  --border: #d4deec;
  --navy: #102342;
  --accent: #2855B6;
  --blue: #2855b6;
  --radius: 14px;
  --shadow: 0 10px 24px rgba(15, 27, 45, .06), 0 1px 2px rgba(15, 27, 45, .08);
  --shadow-lg: 0 16px 42px rgba(15, 27, 45, .1), 0 3px 10px rgba(15, 27, 45, .08);
  --bg-soft: #f4f7fc;
}

[data-theme="dark"] {
  --bg: #0b1322;
  --bg2: #0f1a2d;
  --surface: #131f35;
  --text: #edf3ff;
  --text2: #b7c7e3;
  --text3: #8ea2c6;
  --border: #24344f;
  --navy: #1b2f54;
  --accent: #5A8DFF;
  --blue: #5a8dff;
  --bg-soft: #101a2d;
  --shadow: 0 12px 28px rgba(2, 6, 14, .5);
  --shadow-lg: 0 18px 46px rgba(2, 6, 14, .62);
}

html {
  font-size: 16px;
}

body {
  line-height: 1.58;
  background:
    radial-gradient(circle at 12% -8%, rgba(40, 85, 182, .16), transparent 34%),
    radial-gradient(circle at 88% -12%, rgba(40, 85, 182, .10), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0)),
    var(--bg);
}

.app {
  max-width: 1480px;
  padding: 0 18px 46px;
}

header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #0e1f3c 0%, #14284c 55%, #1b3660 100%);
  border: 1px solid rgba(199, 217, 255, .18);
  border-top: none;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 18px 42px rgba(6, 14, 30, .32);
  padding: 30px 36px 28px;
  margin: 0 -18px 26px;
}

[data-theme="dark"] header {
  background: linear-gradient(145deg, #0f1c34 0%, #152746 50%, #1d355d 100%);
  border-color: rgba(159, 190, 255, .25);
}

header::before,
header::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

header::before {
  width: 320px;
  height: 320px;
  top: -210px;
  right: -70px;
  background: radial-gradient(circle, rgba(40, 85, 182, .16), transparent 68%);
}

header::after {
  width: 380px;
  height: 380px;
  left: -170px;
  top: -250px;
  background: radial-gradient(circle, rgba(72, 124, 255, .18), transparent 70%);
}

header h1 {
  font-size: clamp(1.85rem, 2.8vw, 2.35rem);
  line-height: 1.15;
  margin-bottom: 6px;
}

header p {
  max-width: 860px;
  margin: 0 auto;
  color: rgba(236, 244, 255, .74);
  font-size: .9rem;
}

header .badge {
  border: 1px solid rgba(9, 20, 41, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), 0 8px 20px rgba(0, 0, 0, .2);
}

.app-mode-switch {
  margin-top: 16px;
  border: 1px solid rgba(232, 242, 255, .22);
  background: rgba(255, 255, 255, .08);
  border-radius: 12px;
}

.mode-btn {
  min-width: 170px;
  padding: 10px 14px;
  font-size: .84rem;
  letter-spacing: .01em;
}

.mode-btn.active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), 0 8px 18px rgba(5, 12, 28, .24);
}

.header-row {
  margin-top: 17px;
  gap: 12px 16px;
  justify-content: center;
}

.header-row label {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 6px 12px;
}

.header-row label:hover {
  background: rgba(255, 255, 255, .14);
}

.idade-input {
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 12px;
  padding: 8px 10px;
}

.idade-status {
  color: rgba(241, 248, 255, .82);
}

.simulador-details {
  margin-bottom: 18px;
}

.simulador-summary {
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: .82rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

[data-theme="dark"] .simulador-summary {
  background: linear-gradient(180deg, #17253f, #131f35);
}

.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 18px;
  gap: 10px 12px;
}

.btn {
  border-radius: 11px;
  font-size: .84rem;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 13px;
}

.btn-primary {
  background: linear-gradient(180deg, #3468C4, #2855B6);
  color: #fff;
  border: 1px solid #224DA5;
  box-shadow: 0 8px 18px rgba(40, 85, 182, .28);
}

.btn-primary:not(:disabled):hover {
  background: linear-gradient(180deg, #3E72CE, #2F60BF);
  box-shadow: 0 11px 22px rgba(40, 85, 182, .38);
}

.btn-primary:not(:disabled):active {
  box-shadow: 0 4px 8px rgba(40, 85, 182, .28);
}

.btn-outline {
  background: linear-gradient(180deg, #ffffff, #f4f8ff);
  border-color: #c3d1e7;
  color: #1f3150;
}

[data-theme="dark"] .btn-outline {
  background: linear-gradient(180deg, #1a2c4a, #15253f);
  border-color: #2d4265;
  color: #d6e4ff;
}

[data-theme="dark"] .btn-outline:not(:disabled):active {
  background: linear-gradient(180deg, #13223b, #0f1c2e);
}

.btn-red {
  border-color: #e57878;
  background: linear-gradient(180deg, #fff8f8, #ffecec);
}

.btn-red:not(:disabled):hover {
  background: linear-gradient(180deg, #ffecec, #ffdfdf);
  border-color: #d16b6b;
}

.btn-red:not(:disabled):active {
  background: linear-gradient(180deg, #ffd3d3, #f5c4c4);
  border-color: #c05c5c;
}

[data-theme="dark"] .btn-red {
  background: linear-gradient(180deg, #3b1d2a, #321825);
}

[data-theme="dark"] .btn-red:not(:disabled):hover {
  background: linear-gradient(180deg, #4d2637, #401e2e);
  border-color: #6a364b;
}

[data-theme="dark"] .btn-red:not(:disabled):active {
  background: linear-gradient(180deg, #5b2d41, #4c2437);
  border-color: #7d3f58;
}

[data-theme="dark"] .btn-red:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px #6a364b;
}

.calculator {
  gap: 18px;
  margin-bottom: 22px;
}

@media (min-width: 1001px) {
  .calculator {
    grid-template-columns: 1.03fr 1.03fr 1.2fr;
  }
}

.panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}

[data-theme="dark"] .panel {
  background: linear-gradient(180deg, #162741, #121f34);
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--panel-color), color-mix(in srgb, var(--panel-color) 35%, #fff));
}

.panel-header {
  padding: 18px 20px 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-color) 8%, #fff), transparent);
}

.panel-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.panel-header h2 {
  font-size: 1.03rem;
}

.panel-header .sub {
  font-size: .78rem;
}

.domains {
  padding: 12px 16px 10px;
}

.domain-row {
  gap: 10px;
  padding: 8px 0;
}

.domain-code {
  width: 24px;
  font-size: .76rem;
}

.domain-name {
  font-size: .82rem;
  color: var(--text2);
}

.note-scale {
  grid-template-columns: repeat(5, 33px);
}

.note-btn {
  width: 33px;
  height: 33px;
  border-radius: 9px;
  font-size: .8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68);
}

.note-btn.active {
  box-shadow: 0 9px 18px color-mix(in srgb, var(--hover-color) 26%, transparent), inset 0 1px 0 rgba(255, 255, 255, .2);
}

.panel-result {
  padding: 12px 16px 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-soft) 62%, var(--surface)), color-mix(in srgb, var(--bg-soft) 34%, var(--surface)));
}

.formula {
  font-size: .8rem;
}

.result-bar {
  height: 10px;
  border-radius: 999px;
}

.result-fill {
  border-radius: 999px;
}

.qualifier-badge {
  border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 16px rgba(14, 26, 48, .15);
}

.majoracao-toggles {
  gap: 7px;
}

.toggle-label {
  border-radius: 10px;
  padding: 6px 8px;
}

.resultado {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

[data-theme="dark"] .resultado {
  background: linear-gradient(180deg, #172740, #121f35);
}

.resultado>h2 {
  font-size: 1.16rem;
  margin-bottom: 18px;
}

.qualifiers-row {
  gap: 12px;
  margin-bottom: 20px;
}

.qual-card {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  min-width: 156px;
  padding: 12px 18px;
}

.tabela-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 12px;
  background: color-mix(in srgb, var(--bg-soft) 76%, var(--surface));
}

.tabela-section h3 {
  font-size: .92rem;
}

.tabela-matrix {
  max-width: 700px;
  row-gap: 11px;
}

.tabela-axis-top,
.tabela-axis-left {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 72%, var(--surface));
}

.tabela-grid {
  max-width: 560px;
  gap: 4px;
}

.tabela-impact-note {
  max-width: 700px;
  color: var(--text2);
}

.tc {
  height: 46px;
  border-radius: 8px;
  border: 1px solid rgba(104, 126, 160, .16);
}

.tc.header,
.tc.corner,
.tc.row-header {
  border: none;
}

.tc.active-cell {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--navy) 56%, transparent), 0 8px 18px rgba(12, 27, 51, .24);
}

.tabela-labels {
  margin-top: 12px;
}

.decision {
  border-radius: 16px;
  box-shadow: 0 12px 26px rgba(20, 30, 50, .14);
}

.decision-label {
  letter-spacing: .01em;
}

.decision-reason {
  font-size: .83rem;
}

.footer-actions {
  margin-bottom: 18px;
}

.footer-actions .btn {
  min-width: 212px;
}

.comparison,
.standard-text,
.judicial-control {
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  background: linear-gradient(180deg, #ffffff, #f9fbff);
}

[data-theme="dark"] .comparison,
[data-theme="dark"] .standard-text,
[data-theme="dark"] .judicial-control {
  background: linear-gradient(180deg, #16273f, #121f33);
}

.judicial-control:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.standard-text h3,
.comparison h3,
.judicial-control h3 {
  font-size: 1.02rem;
}

.standard-text .helper,
.judicial-control .helper {
  font-size: .79rem;
}

.standard-text textarea,
.jc-textarea {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: .85rem;
}

.jc-progress-wrap {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 10px 12px;
}

.jc-progress-track {
  height: 8px;
}

.jc-step {
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-soft) 64%, var(--surface)), color-mix(in srgb, var(--bg-soft) 30%, var(--surface)));
  padding: 12px;
}

[data-theme="dark"] .jc-step {
  box-shadow: none;
}

.jc-step-header {
  margin-bottom: 6px;
}

.jc-step-title {
  font-size: .92rem;
}

.jc-step-note,
.jc-step-helper,
.jc-field-helper,
.jc-inline-note,
.jc-step-guidance-text {
  line-height: 1.45;
}

.jc-field,
.jc-social-item,
.jc-complete-item {
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 72%, var(--bg-soft));
}

.jc-q-btn,
.jc-seg-btn {
  min-height: 34px;
  border-radius: 9px;
}

/* Keep this specific toggle as a true 2-column segmented control */
#jcAtivModeButtons {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#jcAtivModeButtons .jc-seg-btn {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 0;
}

.jc-select,
.jc-mini-textarea {
  border-radius: 10px;
}

.jc-status-badge {
  border-radius: 10px;
  border-width: 1px;
}

.comp-card {
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

footer {
  margin-top: 10px;
  padding: 14px 8px 20px;
  font-size: .75rem;
  color: color-mix(in srgb, var(--text3) 82%, transparent);
}

.footer-norm-link {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--blue);
  font: 600 .75rem/1.2 'DM Sans', sans-serif;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-norm-link:hover {
  color: color-mix(in srgb, var(--blue) 78%, var(--navy));
}

.footer-norm-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 58%, white);
  outline-offset: 2px;
  border-radius: 8px;
}

.footer-norm-link .ui-icon {
  width: .9em;
  height: .9em;
}

.footer-text-link {
  margin-left: 8px;
  border: none;
  background: transparent;
  color: var(--text3);
  font: 600 .72rem/1.2 'DM Sans', sans-serif;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.footer-text-link:hover {
  color: var(--text2);
}

.footer-text-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 58%, white);
  outline-offset: 2px;
  border-radius: 8px;
}

.sim-help-popover {
  position: absolute;
  z-index: 45;
  width: min(380px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  color: var(--text);
}

.sim-help-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sim-help-popover-header h4 {
  margin: 0;
  font-size: .9rem;
  color: var(--text2);
}

.sim-help-close {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text3);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sim-help-close:hover {
  background: var(--bg);
  color: var(--text);
}

.sim-help-close:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 58%, white);
  outline-offset: 2px;
}

.sim-help-close:not(:disabled):active {
  transform: scale(0.96);
  transition-duration: 0.05s;
}

.sim-help-summary {
  margin: 8px 0 0;
  font-size: .78rem;
  line-height: 1.4;
  color: var(--text2);
}

.sim-help-list {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
}

.sim-help-list li {
  font-size: .76rem;
  line-height: 1.38;
  color: var(--text2);
}

.sim-help-source {
  margin: 8px 0 0;
  font-size: .7rem;
  line-height: 1.35;
  color: var(--text3);
}

.sim-help-excerpt {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  font-size: .75rem;
  line-height: 1.35;
  color: var(--text2);
}

.sim-help-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.sim-help-link {
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--blue) 78%, var(--text2));
  font: 700 .74rem/1.3 'DM Sans', sans-serif;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.sim-help-link:not(:disabled):not([aria-disabled="true"]):hover {
  color: color-mix(in srgb, var(--blue) 90%, var(--text));
}

.sim-help-link:disabled,
.sim-help-link[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  filter: grayscale(0.5);
  text-decoration: none;
}

.sim-help-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--blue) 58%, white);
  outline-offset: 2px;
  border-radius: 6px;
}

.sim-help-popover.mobile {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  width: auto;
  max-height: min(68vh, 520px);
  overflow: auto;
}

.sim-help-popover.floating {
  position: fixed;
}

.portaria-modal {
  width: min(1000px, calc(100vw - 32px));
  max-height: calc(100vh - 38px);
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.portaria-modal::backdrop {
  background: rgba(8, 16, 29, .58);
}

.portaria-modal-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.portaria-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portaria-modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

.portaria-modal-helper {
  margin: 0;
  color: var(--text2);
  font-size: .78rem;
}

.portaria-modal-status {
  margin: 0;
  font-size: .77rem;
  color: var(--text3);
}

.portaria-modal-status.error {
  color: var(--no);
}

.portaria-modal-content {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 12px;
  max-height: min(62vh, 620px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 500 .79rem/1.45 'Source Sans 3', sans-serif;
  color: var(--text2);
}

.portaria-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.padrao-modal {
  width: min(560px, calc(100vw - 32px));
}

.padrao-modal-card {
  gap: 12px;
}

.padrao-modal-summary {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 10px 12px;
  display: grid;
  gap: 5px;
}

.padrao-modal-summary div {
  font-size: .77rem;
  color: var(--text2);
}

.padrao-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.confirm-modal {
  width: min(560px, calc(100vw - 32px));
}

.confirm-modal-card {
  gap: 14px;
}

.confirm-modal-message {
  margin: 0;
  white-space: pre-line;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

[data-theme="dark"] .portaria-modal::backdrop {
  background: rgba(2, 7, 16, .74);
}

@media (max-width:680px) {
  .footer-norm-link {
    display: inline-flex;
    margin-left: 0;
    margin-top: 6px;
  }

  .footer-text-link {
    display: inline-block;
    margin-left: 0;
    margin-top: 4px;
  }

  .portaria-modal {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 20px);
  }

  .padrao-modal {
    width: calc(100vw - 18px);
  }

  .confirm-modal {
    width: calc(100vw - 18px);
  }

  .portaria-modal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .portaria-close-btn {
    width: 100%;
    justify-content: center;
  }

  .portaria-modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .padrao-modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .confirm-modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion:no-preference) {

  header,
  .simulador-summary,
  .toolbar,
  .calculator .panel,
  #resultado,
  #textoSection,
  #compSection,
  #judicialControlSection {
    animation: premium-fade-in .52s ease both;
  }

  .calculator .panel:nth-child(2) {
    animation-delay: .05s;
  }

  .calculator .panel:nth-child(3) {
    animation-delay: .1s;
  }
}

@keyframes premium-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* PALETTE: Animations */
@keyframes popover-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .sim-help-popover:not(.hidden) { animation: popover-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) both; }
  dialog[open] { animation: dialog-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
  dialog[open]::backdrop, .portaria-modal::backdrop { animation: backdrop-in 0.3s ease-out both; }
}

@media (max-width:1200px) {
  .calculator {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel:nth-child(3) {
    grid-column: 1 / -1;
  }

  header {
    margin: 0 -18px 22px;
    padding: 26px 22px 24px;
  }
}

@media (max-width:940px) {
  html {
    font-size: 15.5px;
  }

  .calculator {
    grid-template-columns: 1fr;
  }

  .panel:nth-child(3) {
    grid-column: auto;
  }

  .app-mode-switch {
    width: min(100%, 430px);
    display: flex;
  }

  .mode-btn {
    min-width: 0;
    flex: 1;
  }

  .flowchart-view {
    overflow-x: clip;
  }

  .flowchart-step-nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding: 0 0 2px;
  }

  .flowchart-step-nav button {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .flowchart-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .flowchart-overview {
    display: none;
  }

  .flow-step-card {
    display: none;
    padding: 13px;
  }

  .flowchart-view[data-active-flow-step="all"] .flow-step-card,
  .flow-step-card.is-active {
    display: block;
  }

  .toolbar {
    justify-content: center;
  }

  .tabela-matrix {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "left"
      "grid";
    gap: 8px;
  }

  .tabela-axis-top,
  .tabela-axis-left {
    width: 100%;
    min-height: 0;
    flex-direction: row;
    justify-content: center;
    padding: 7px 10px;
  }

  .tabela-axis-left .axis-arrow {
    order: 3;
  }

  .tabela-impact-note {
    text-align: left;
    margin-top: 8px;
  }

  .tabela-sensitivity-legend {
    justify-content: flex-start;
    text-align: left;
  }

  .tabela-grid {
    max-width: 100%;
  }
}

@media (max-width:680px) {
  .app {
    padding: 0 12px 36px;
  }

  header {
    margin: 0 -12px 18px;
    border-radius: 0 0 18px 18px;
    padding: 20px 14px 18px;
  }

  header h1 {
    font-size: 1.58rem;
  }

  header p {
    font-size: .78rem;
  }

  .header-row {
    gap: 8px;
  }

  .header-row label {
    width: 100%;
    justify-content: center;
  }

  .idade-input {
    width: 100%;
    justify-content: center;
  }

  .toolbar {
    padding: 10px;
  }

  .toolbar .btn,
  .toolbar .toggle-label,
  .toolbar .toolbar-toggle-group {
    width: 100%;
    justify-content: center;
  }

  .toolbar .toolbar-toggle-group .toggle-label {
    width: auto;
  }

  .panel-header,
  .domains,
  .panel-result {
    padding-left: 12px;
    padding-right: 12px;
  }

  .note-scale {
    grid-template-columns: repeat(5, 31px);
  }

  .note-btn {
    width: 31px;
    height: 31px;
    border-radius: 8px;
    font-size: .75rem;
  }

  .qual-card {
    width: 100%;
    min-width: 0;
  }

  .standard-text-actions,
  .footer-actions {
    justify-content: stretch;
  }

  .standard-text-actions .btn,
  .footer-actions .btn {
    width: 100%;
  }

  .jc-progress-head {
    flex-wrap: wrap;
  }

  .jc-step-guidance {
    flex-direction: column;
    align-items: stretch;
  }

  .jc-actions-main .btn,
  .jc-autofill-btn {
    width: 100%;
    justify-content: center;
  }
}

.mode-btn:not(:disabled):active,
.amb-tab:not(:disabled):active,
.jc-q-btn:not(:disabled):active,
.jc-seg-btn:not(:disabled):active,
.flowchart-step-nav button:not(:disabled):active {
  transform: scale(0.96);
  transition-duration: 0.05s;
}

.sim-help-btn:not(:disabled):active {
  transform: translateY(0) scale(0.96);
  transition-duration: 0.05s;
}

/* A11Y FOCUS STYLES (Palette) */
.note-btn:focus-visible,
.amb-tab:focus-visible,
.mode-btn:focus-visible,
.btn:focus-visible,
.simulador-summary:focus-visible,
.jc-help-details summary:focus-visible,
.jc-autofill-details summary:focus-visible,
.idade-input input:focus-visible,
.idade-input select:focus-visible,
.jc-textarea:focus-visible,
.jc-mini-textarea:focus-visible,
.jc-select:focus-visible,
.standard-text textarea:focus-visible,
.toast-close:focus-visible,
.toggle-label:has(input[type=checkbox]:focus-visible),
.jc-reduction-alert label:has(input[type=checkbox]:focus-visible) {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px var(--blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 72%, #fff 28%);
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10000;
  max-width: 400px;
  width: calc(100% - 48px);
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-message {
  font-size: 0.85rem;
  line-height: 1.4;
  flex: 1;
}

.toast-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text3);
  cursor: pointer;
  padding: 0 4px;
  margin-left: 4px;
}

.toast-close:hover {
  color: var(--text);
}

.toast-success {
  border-left: 4px solid var(--yes);
}
.toast-success .toast-icon { color: var(--yes); }

.toast-error {
  border-left: 4px solid var(--no);
}
.toast-error .toast-icon { color: var(--no); }

.toast-warning {
  border-left: 4px solid #F59E0B;
}
.toast-warning .toast-icon { color: #D97706; }

[data-theme="dark"] .toast-warning .toast-icon { color: #FCD34D; }

@media (max-width: 600px) {
  .toast-container {
    bottom: 16px;
    right: 16px;
    width: calc(100% - 32px);
  }
}

.panel-blue { --panel-color: #2563EB; }
.panel-purple { --panel-color: #7C3AED; }
.panel-red { --panel-color: #DC2626; }

@media print {
  body { background: #fff; color: #000; }
  .app { max-width: none; padding: 0; margin: 0; }
  .skip-link, .app-mode-switch, .header-row, .toolbar, .footer-actions, footer, .toast-container, .sim-help-btn, .btn, .majoracao-toggles, .jc-actions-main, .jc-autofill-details, .header-portaria-link { display: none !important; }
  header { background: 0 0; color: #000; box-shadow: none; border: 0; padding: 0; margin: 0 0 20px; text-align: left; }
  header::before, header::after { display: none; }
  header h1 { font-size: 1.5rem; color: #000; }
  header p { color: #333; }
  header .badge { border: 1px solid #000; color: #000; background: 0 0; box-shadow: none; }
  .panel, .resultado, .judicial-control, .flowchart-view, .standard-text, .comparison { box-shadow: none; border: 1px solid #ccc; background: #fff; page-break-inside: avoid; }
  .panel-header { background: #f4f4f4; border-bottom: 1px solid #ccc; }
  textarea { border: 0; resize: none; overflow: visible; height: auto !important; min-height: 0; }
  .tc.yes { background: #eee; color: #000; border: 1px solid #ccc; }
  .tc.no { background: #fff; color: #000; border: 1px solid #ccc; }
  .decision.deferido, .decision.indeferido, .decision.impedimento { background: #fff; color: #000; border: 2px solid #000; break-inside: avoid; }
}

/* BACK TO TOP */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity .3s ease, transform .3s ease, background-color .2s, visibility 0s 0s;
  z-index: 9000;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.back-to-top:hover {
  background: color-mix(in srgb, var(--accent) 85%, black);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}

.back-to-top:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px var(--blue), 0 0 0 4px rgba(255, 255, 255, .8);
}

.back-to-top.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease, background-color .2s, visibility 0s .3s;
}

.back-to-top .ui-icon {
  width: 1.4rem;
  height: 1.4rem;
  stroke-width: 2.5;
}

@media (max-width: 600px) {
  .back-to-top {
    bottom: 70px;
    right: 16px;
  }
}

@media print {
  .back-to-top {
    display: none !important;
  }
}
