/* ═══════════════════════════════════════════════════════════
   COMPONENT STYLES - PRÓ EFICÁCIA SIMULADOR TRIBUTÁRIO
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --navy: #0B2B4F;
  --navy2: #1A3E6F;
  --navy3: #0F2948;
  --gold: #C6A15B;
  --gold2: #D8B87A;
  --gold3: #9E7F4A;
  --gold-light: #FEF5E7;
  --cream: #FDFBF7;
  --cream2: #F7F4EF;
  --green: #2C7A4D;
  --green-bg: #E6F4ED;
  --green-bdr: #B8DFCF;
  --red: #B33A3A;
  --red-bg: #FDF0F0;
  --red-bdr: #F0C9C9;
  --amber: #C47A2E;
  --amber-bg: #FEF6E8;
  --amber-bdr: #F0DCBF;
  --blue: #2C6B9E;
  --blue-bg: #E9F1F8;
  --blue-bdr: #CDE0F0;
  --border: #E2DBD0;
  --border2: #D1C8BA;
  --text3: #6B5A3E;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
  --shadow2: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  --radius: 18px;
  --radius2: 14px;
  --radius3: 10px;
  --spacing-xs: 6px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --font-main: 'Nunito', 'Nunito Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Nunito Sans', 'Nunito', system-ui, sans-serif;
}

body {
  background: #F3F0EA;
  font-family: var(--font-body);
  color: var(--navy);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Interactive Background Canvas */
#interactive-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

#interactive-bg canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── HEADER ── */
.app-header {
  background: var(--navy);
  padding: 0 var(--spacing-xl);
  height: 68px;
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  justify-content: space-between;
}

.header-logo {
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-logo span {
  font-size: 0.75rem;
  background: var(--gold);
  color: #fff;
  padding: 2px 6px;
  border-radius: 30px;
}

.header-divider {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
}

.header-title {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.72rem;
  color: var(--gold2);
  font-weight: 500;
  margin-top: 2px;
}

.header-badge {
  margin-left: auto;
  background: var(--gold);
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.header-user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.header-user-badge:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.header-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.header-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.header-action-btn.logout {
  background: rgba(200, 169, 110, 0.1);
  color: #c8a96e;
}

.header-action-btn.logout:hover {
  background: rgba(200, 169, 110, 0.2);
}

/* ── TABS ── */
.tabs-wrapper {
  background: var(--navy2);
  border-bottom: 3px solid var(--gold);
  padding: 0 2rem;
  position: sticky;
  top: 68px;
  z-index: 99;
  overflow-x: auto;
}

.tabs {
  display: flex;
  min-width: max-content;
}

.tab-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 13px 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: all .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--gold2);
  border-bottom-color: var(--gold);
  font-weight: 800;
}

.tab-icon {
  font-size: 0.9rem;
}

/* ── PANELS ── */
.panel {
  display: none;
  padding: 2rem;
  max-width: 1360px;
  margin: 0 auto;
  animation: fadeUp .3s ease;
}

.panel.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

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

/* ── SECTION HEADERS ── */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.section-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.section-icon.navy {
  background: var(--navy);
  color: #fff;
}

.section-icon.gold {
  background: var(--gold);
  color: #fff;
}

.section-icon.green {
  background: var(--green-bg);
  color: var(--green);
}

.section-icon.red {
  background: var(--red-bg);
  color: var(--red);
}

.section-head h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
}

.section-head p {
  font-size: 0.75rem;
  color: var(--gold3);
  font-weight: 500;
  margin-top: 2px;
}

/* ── GRID ── */
.g2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.g3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
}

.g4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.ga {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ── CARDS ── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-title {
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--navy2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lfooter {
  font-family: var(--font-body);
  color: #ffffff;
  line-height: 1.5;
}

.card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
}

/* ── METRIC CARDS ── */
.metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  box-shadow: var(--shadow2);
  overflow: hidden;
}

.metric-small {
  background: var(--cream2);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.metric-small .metric-label {
  font-size: 0.68rem;
  color: var(--gold3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.metric-small .metric-value {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 0.25rem;
}

.metric-small .metric-value.green { color: var(--green); }
.metric-small .metric-value.blue { color: var(--blue); }
.metric-small .metric-value.rose,
.metric-small .metric-value.red { color: var(--red); }

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.metric-card.navy::after {
  background: linear-gradient(90deg, var(--navy), var(--navy2));
}

.metric-card.gold::after {
  background: linear-gradient(90deg, var(--gold), var(--gold2));
}

.metric-card.green::after {
  background: linear-gradient(90deg, var(--green), #4caf7e);
}

.metric-card.red::after {
  background: linear-gradient(90deg, var(--red), #e05a5a);
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.metric-value {
  font-family: var(--font-main);
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--navy);
  line-height: 1;
}

.metric-value.green {
  color: var(--green);
}

.metric-value.gold {
  color: var(--gold);
}

.metric-value.red {
  color: var(--red);
}

.metric-sub {
  font-size: 0.71rem;
  color: var(--gold3);
  margin-top: 0.4rem;
  font-weight: 500;
}

.metric-small .metric-value.green { color: var(--green); }
.metric-small .metric-value.blue { color: var(--blue); }
.metric-small .metric-value.rose,
.metric-small .metric-value.red { color: var(--red); }

/* ── FORMS ── */
.form-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow2);
}

.form-section-title {
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title span {
  color: var(--gold);
}

.fr {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

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

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

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

.fg {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fg label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--navy2);
  letter-spacing: 0.2px;
}

.fg input,
.fg select,
.fg textarea {
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius3);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 9px 12px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  width: 100%;
}

.fg input:focus,
.fg select:focus,
.fg textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 151, 106, 0.15);
  background: #fff;
}

.fg input[readonly] {
  background: var(--cream2);
  color: var(--gold3);
}

.fg .hint {
  font-size: 0.68rem;
  color: var(--gold3);
  margin-top: 2px;
  font-weight: 500;
}

/* CNPJ field with button */
.cnpj-field {
  position: relative;
}

.cnpj-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cnpj-input-wrap input {
  flex: 1;
}

.btn-consult-cnpj {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius3);
  color: var(--navy2);
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
}

.btn-consult-cnpj:hover {
  background: var(--gold-light);
  border-color: var(--gold);
  color: var(--gold);
}

.btn-consult-cnpj:active {
  transform: scale(0.96);
}

.btn-consult-cnpj.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

#cnpj-hint {
  font-size: 0.68rem;
  color: var(--gold3);
  margin-top: 2px;
  font-weight: 500;
  transition: color .2s;
}

#cnpj-hint.loading {
  color: var(--gold);
}

#cnpj-hint.success {
  color: var(--green);
}

#cnpj-hint.error {
  color: var(--red);
}

/* ── SLIDERS ── */
.slider-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.75rem;
  background: var(--cream2);
  border-radius: var(--radius3);
}

.slider-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy2);
  min-width: 240px;
  flex-shrink: 0;
}

.slider-row input[type=range] {
  flex: 1;
  --webkit-appearance: none;
  height: 5px;
  border-radius: 3px;
  background: var(--border2);
  cursor: pointer;
  outline: none;
}

.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.slider-val {
  font-family: var(--font-main);
  font-size: 0.88rem;
  color: var(--gold3);
  min-width: 52px;
  text-align: right;
  font-weight: 700;
}

/* ── UPLOAD ZONES ── */
.upload-area {
  border: 2px dashed var(--border2);
  border-radius: var(--radius2);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  background: var(--cream);
}

.upload-area:hover,
.upload-area.drag {
  border-color: var(--gold);
  background: var(--gold-light);
}

.upload-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  display: block;
}

.upload-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.2rem;
  font-family: var(--font-main);
}

.upload-sub {
  font-size: 0.72rem;
  color: var(--gold3);
}

.upload-area input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.file-item {
  background: var(--cream2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
}

.fi-name {
  flex: 1;
  color: var(--navy2);
  font-weight: 600;
}

.fi-status {
  font-size: 0.68rem;
  color: var(--green);
  font-weight: 700;
}

.fi-status.warn {
  color: var(--amber);
}

.fi-status.err {
  color: var(--red);
}

.fi-rm {
  background: none;
  border: none;
  color: var(--gold3);
  cursor: pointer;
  font-size: 1rem;
}

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius2); border: 1px solid var(--border); }
.dt { width: 100%; border-collapse: collapse; font-size: 0.81rem; }
.dt th {
  background: var(--navy);
  color: rgba(255,255,255,0.85);
  font-family: var(--font-main);
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 9px 11px;
  text-align: left;
  white-space: nowrap;
}

.dt td {
  padding: 8px 11px;
  border-bottom: 1px solid var(--border);
  color: var(--navy2);
}

.dt .nc {
  text-align: right;
  font-family: var(--font-main);
  font-weight: 600;
}

.dt .tot td {
  background: var(--navy3) !important;
  color: #fff !important;
  font-weight: 800;
}

/* ── REGIME CARDS ── */
.regime-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  transition: transform .2s;
}

.regime-card.winner {
  border-color: var(--green);
  background: linear-gradient(135deg, #fff 0%, var(--green-bg) 100%);
}

.regime-card.winner::before {
  content: '✓ MELHOR OPÇÃO';
  position: absolute;
  top: -12px;
  right: 1rem;
  background: var(--green);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 100px;
}

.rc-total {
  font-size: 1.9rem;
  font-weight: 900;
}

.rc-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0.85rem 0;
}

.rc-bar-fill {
  height: 100%;
  transition: width .8s;
}

/* ── ALERTS ── */
.alert {
  border-radius: var(--radius2);
  padding: 0.85rem 1.1rem;
  display: flex;
  gap: 9px;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.alert.info {
  background: var(--blue-bg);
  border: 1px solid var(--blue-bdr);
  color: var(--blue);
}

.alert.success {
  background: var(--green-bg);
  border: 1px solid var(--green-bdr);
  color: var(--green);
}

.alert.warning {
  background: var(--amber-bg);
  border: 1px solid var(--amber-bdr);
  color: var(--amber);
}

.alert.danger {
  background: var(--red-bg);
  border: 1px solid var(--red-bdr);
  color: var(--red);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 10px 22px;
  border-radius: var(--radius2);
  border: none;
  cursor: pointer;
  transition: all .2s;
}

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

.btn-primary:hover {
  background: var(--navy3);
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--gold);
  color: #fff;
}

.btn-gold:hover {
  background: var(--gold3);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border2);
  color: var(--navy2);
}

.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold3);
}

.btn-ghost {
  background: var(--cream2);
  color: var(--navy2);
  border: 1px solid var(--border);
}

/* ── CHARTS ── */
.chart-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.chart-title {
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--navy2);
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-title::before {
  content: '';
  width: 3px;
  height: 13px;
  background: var(--gold);
  border-radius: 2px;
}

/* ── RESULT BOX ── */
.result-box {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.result-box .rb-icon {
  font-size: 2.2rem;
}

.result-box .rb-label {
  font-size: 0.72rem;
  color: var(--gold2);
  text-transform: uppercase;
}

.result-box .rb-value {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--gold2);
}

.result-box .rb-sub {
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ── TIMELINE ── */
.timeline {
  display: flex;
  position: relative;
  padding: 1.5rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border2);
}

.tl-item {
  flex: 1;
  text-align: center;
  position: relative;
}

.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border2);
  margin: 0 auto 8px;
  z-index: 1;
}

.tl-item.done .tl-dot {
  background: var(--gold);
}

.tl-item.active .tl-dot {
  background: var(--navy);
  width: 16px;
  height: 16px;
  margin-top: -2px;
}

.tl-year {
  font-weight: 800;
  font-size: 0.75rem;
}

.tl-label {
  font-size: 0.65rem;
  color: var(--gold3);
}

/* ── MARKUP ── */
.mk-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.mk-input {
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  width: 120px;
  text-align: right;
}

/* ── FOOTER ── */
.app-footer {
  background: var(--navy3);
  border-top: 3px solid var(--gold);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 3rem;
}

.footer-text {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.footer-badge {
  font-size: 0.68rem;
  color: var(--gold2);
  font-weight: 700;
}

/* ── LOGIN ── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: linear-gradient(160deg, rgba(10, 22, 40, 0.85), rgba(26, 43, 82, 0.9) 50%, rgba(13, 31, 60, 0.85));
  backdrop-filter: blur(2px);
}

.lcard {
  background: #fff;
  border-radius: 28px;
  padding: 2.5rem 2.4rem 2rem;
  width: 370px;
  max-width: 93vw;
  text-align: center;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.lcard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #1a2b52, #b8976a, #1a2b52);
  border-radius: 28px 28px 0 0;
}

.lcard img {
  height: 50px;
  margin-bottom: 1rem;
}

.lfield {
  text-align: left;
  margin-bottom: .9rem;
}

.lfield input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid #e0d9d0;
  border-radius: 8px;
}

#lbtn {
  width: 100%;
  padding: .75rem;
  background: #c8bfb0;
  color: #fff;
  cursor: not-allowed;
}

#lbtn.ativo {
  background: #1a2b52;
  cursor: pointer;
}

#lerro {
  display: none;
  color: #b52a2a;
  background: #fff0f0;
  border-radius: 6px;
  padding: .4rem .75rem;
  margin-top: .6rem;
}

/* Responsivo */
@media (max-width: 900px) {

  .g2,
  .g3,
  .g4 {
    grid-template-columns: 1fr;
  }

  .fr.c2,
  .fr.c3,
  .fr.c4 {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 1rem;
  }

  .slider-row {
    flex-wrap: wrap;
  }

  .slider-row label {
    min-width: 100%;
  }
}
/* ══ BADGES ══ */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-main);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.3px;
}
.badge.navy { background: var(--navy); color: #fff; }
.badge.gold { background: var(--gold); color: #fff; }
.badge.green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bdr); }
.badge.amber { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-bdr); }
.badge.red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-bdr); }
.badge.blue { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-bdr); }
.m-input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,151,106,0.15); }

.num-cell {
  font-family: 'Nunito', monospace;
}

.num-cell.neg {
  color: #b52a2a;
}

.num-cell.pos {
  color: #2d7d4f;
}

/* ═══════════════════════════════════════════
   ESTILOS DE PDF — imprimirRelatorio()
   ═══════════════════════════════════════════ */

/* Timbre quando a função imprimirRelatorio injeta */
#pdf-timbre-overlay {
  padding: 6px 12px 10px 12px !important;
  border-bottom: 3px solid #1a2b52 !important;
  background: #f6f4f0 !important;
  flex-shrink: 0;
  text-wrap: balance;
  position: sticky;
  top: 0;
  z-index: 10000;
}

#pdf-timbre-overlay img {
  max-width: 64px;
  max-height: 36px;
}

@page {
  size: A4 portrait;
  margin: 12mm 12mm 14mm 12mm;
}


@media print {

  @page {
    size: A4 portrait;
    margin: 12mm 10mm 18mm 10mm;
    @bottom-center {
      content: "Pró Eficácia Contabilidade Consultiva — Simulador Tributário Reforma 2027/2033 — www.proeficacia.com.br";
      font-size: 7pt;
      color: #8a6e4a;
    }
    @top-left {
      content: "Pró Eficácia · www.proeficacia.com.br";
      font-size: 7pt;
      color: #8a6e4a;
    }
    @top-right {
      content: url("https://proeficacia.com.br/wp-content/uploads/2026/05/logo2.png");
    }
  }

  body {
    background: #fff !important;
    color: #1a2b52 !important;
    font-size: 9pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #app-wrapper {
    display: block !important;
  }

  .app-header,
  .tabs-wrapper,
  .btn,
  .upload-area,
  .header-user-badge,
  .header-action-btn,
  .interactive-bg,
  canvas {
    display: none !important;
  }

  .panel {
    display: block !important;
    page-break-after: always;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .panel.active {
    display: block !important;
  }

  /* Oculta as abas não-ativas mas preserva conteúdo (html2pdf clona) */
  html2pdf canvas,
  .cw canvas {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  .cw {
    page-break-inside: avoid;
  }

  .metric-card,
  .card,
  .regime-card,
  .result-box {
    page-break-inside: avoid;
  }

  /* Timbre de página no CSS fallback */
  .panel.active::before {
    content: url("https://proeficacia.com.br/wp-content/uploads/2026/05/logo2.png") "  Pró Eficácia Contabilidade Consultiva  —  Simulador Tributário Reforma 2027/2033  —  Divinópolis/MG  —  www.proeficacia.com.br";
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0 10px 0;
    border-bottom: 2px solid #1a2b52;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 9pt;
    color: #1a2b52;
  }

  /* Footer de cada aba */
  .panel.active::after {
    content: "Pró Eficácia Contabilidade Consultiva · Divinópolis/MG · CNPJ: 16.104.982/0001-00 · www.proeficacia.com.br — Página " counter(page) " de " counter(pages);
    display: block;
    text-align: center;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #b8976a;
    font-size: 7pt;
    color: #6b5a2a;
  }

  /* Corrige contadores para cada página */
  @page {
    counter-increment: page;
    @bottom-right {
      content: "Página " counter(page) " de " counter(pages);
      font-size: 7pt;
      color: #6b5a2a;
    }
  }
}

/* ── MODAIS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 43, 79, 0.4);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #fff;
  width: 100%;
  max-width: 650px;
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

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

.modal-header {
  padding: 1.25rem 1.5rem;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 1rem;
}

.modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
}

/* Clickable User Info */
#header-user-info {
  transition: all 0.2s;
}

.header-user-badge {
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-user-badge:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.header-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.header-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.header-action-btn.logout {
  background: rgba(200, 169, 110, 0.1);
  color: #c8a96e;
}

.header-action-btn.logout:hover {
  background: rgba(200, 169, 110, 0.2);
}

/* Settings Improvements */
.settings-group {
  padding: 1.5rem !important;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.settings-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--cream);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all .2s;
}

.settings-action-row:hover {
  border-color: var(--gold);
  background: #fff;
}

.settings-action-row.danger {
  background: var(--red-bg);
  border-color: var(--red-bdr);
}

.settings-action-row .action-info strong {
  display: block;
  font-size: .85rem;
  color: var(--navy);
  margin-bottom: 2px;
}

.settings-action-row .action-info p {
  font-size: .72rem;
  color: var(--gold3);
  margin: 0;
}

/* Analysis Card Grid */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.analysis-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 1.25rem;
  cursor: pointer;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.analysis-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
  border-color: var(--gold);
}

.analysis-card .ac-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.analysis-card .ac-title {
  font-size: .95rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.3;
}

.analysis-card .ac-cnpj {
  font-size: .7rem;
  color: var(--gold3);
  font-weight: 600;
  font-family: monospace;
}

.analysis-card .ac-badge {
  font-size: .62rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
}

.ac-badge.simples {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-bdr);
}

.ac-badge.hibrido {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-bdr);
}

.ac-badge.lp {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-bdr);
}

.analysis-card .ac-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  padding: .75rem;
  background: var(--cream);
  border-radius: 10px;
}

.ac-stat-item label {
  display: block;
  font-size: .65rem;
  color: var(--gold3);
  text-transform: uppercase;
  font-weight: 700;
}

.ac-stat-item span {
  font-size: .9rem;
  font-weight: 800;
  color: var(--navy2);
}

.analysis-card .ac-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  margin-top: auto;
}

.analise-id {
  padding: 4px 8px;
  background: var(--blue-bg);
  border-radius: 6px;
  font-size: 0.65rem;
  color: var(--blue);
  margin-top: 0.5rem;
}

.analise-id code {
  font-family: 'Nunito', monospace;
  font-weight: 700;
  color: var(--navy2);
}

.ac-date {
  font-size: .68rem;
  color: var(--gold3);
  font-weight: 500;
}

.ac-actions {
  display: flex;
  gap: .5rem;
}

/* User Card Improvements */
.user-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all .2s;
}

.user-card:hover {
  border-color: var(--navy);
  transform: scale(1.01);
}

.user-info-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 42px;
  height: 42px;
  background: var(--navy2);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
}

.user-details strong {
  display: block;
  font-size: .9rem;
  color: var(--navy);
}

.user-details span {
  font-size: .72rem;
  color: var(--gold3);
}

.user-badge {
  font-size: .65rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 100px;
  margin-left: 8px;
}

.user-badge.admin {
  background: var(--navy);
  color: #fff;
}

.user-badge.consultor {
  background: var(--gold-light);
  color: var(--gold3);
  border: 1px solid var(--gold);
}

.user-badge.cliente {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-bdr);
}

/* User Form */
.user-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  align-items: flex-end;
}

/* ══ COMPARATIVO 2026 vs 2033 ══ */
.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.cmp-table th {
  padding: 7px 10px;
  text-align: left;
  background: #1a2b52;
  color: #fff;
  font-weight: 700;
}

.cmp-table td {
  padding: 7px 10px;
}

.cmp-table .td-right {
  text-align: right;
}

.cmp-table .td-center {
  text-align: center;
}

.cmp-table .cmp-simples {
  background: #f6f4f0;
}

.cmp-table .cmp-hibrido {
  background: #f0f5ff;
}

.cmp-table .cmp-lp {
  background: #fff3f0;
}

.cmp-table .cmp-title {
  font-weight: 700;
  color: #1a2b52;
}

.cmp-table .cmp-subtitle {
  font-size: 0.67rem;
  font-weight: 400;
  color: #6b7a99;
}

.cmp-table .cmp-hibrido-title {
  color: #1a5fa8;
}

.cmp-table .cmp-lp-title {
  color: #b52a2a;
}

.cmp-table .cmp-value {
  font-family: 'Nunito', monospace;
  font-weight: 700;
}

.cmp-table .cmp-ref {
  color: #6b7a99;
}

.cmp-table .cmp-positive {
  color: #2d7d4f;
}

.cmp-table .cmp-footer {
  font-size: 0.67rem;
  color: #8a6e4a;
  font-style: italic;
  margin-top: 0.6rem;
}

.mono {
  font-family: 'Nunito', monospace;
}

.mono.bold {
  font-weight: 700;
}

.num-cell {
  font-family: 'Nunito', monospace;
}

.num-cell.neg {
  color: #b52a2a;
}

.num-cell.pos {
  color: #2d7d4f;
}

/* User Form */
.user-form-grid {

.user-form-grid .fg label {
  font-size: .7rem;
  font-weight: 700;
  color: var(--gold3);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: block;
  margin-bottom: .4rem;
}

.user-form-grid .fg input,
.user-form-grid .fg select {
  width: 100%;
  padding: .65rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: .88rem;
  outline: none;
  background: #fff;
  transition: all .2s;
}

.user-form-grid .fg input:focus,
.user-form-grid .fg select:focus {
  border-color: var(--navy);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 43, 79, 0.05);
}

.pass-toggle {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: .9rem;
  user-select: none;
  opacity: .5;
  transition: opacity .2s;
}

.pass-toggle:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   IMPRESSÃO - Gráficos com espaçamento correto
   ═══════════════════════════════════════════════════════════ */

@media print {
  /* Garantir espaçamento adequado para gráficos */
  .chart-wrap {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 12pt;
    padding: 8pt;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  
  /* Canvas em modo de impressão */
  .chart-wrap canvas {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Métricas e cards para impressão */
  .metric-card,
  .card,
  .regime-card,
  .result-box {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 10pt;
  }
  
  /* Tabelas */
  .table-wrap {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 10pt;
  }
  
  /* Evitar cortes em elementos importantes */
  .section-head {
    page-break-after: avoid;
    break-after: avoid;
  }
}
