:root {
  --fiscal-bg: #f5f8f7;
  --fiscal-panel: #ffffff;
  --fiscal-panel-soft: #f7faf8;
  --fiscal-text: #17231f;
  --fiscal-muted: #65736d;
  --fiscal-line: #dfe8e4;
  --fiscal-line-strong: #cfdad5;
  --fiscal-primary: #177a57;
  --fiscal-primary-dark: #0f5f42;
  --fiscal-primary-soft: #e9f6f0;
  --fiscal-success: #177a57;
  --fiscal-success-soft: #e9f6f0;
  --fiscal-danger: #a93333;
  --fiscal-danger-soft: #fff0f0;
  --fiscal-warning: #a6650a;
  --fiscal-warning-soft: #fff5df;
  --fiscal-shadow: 0 10px 30px rgba(25, 52, 42, 0.07);
  --fiscal-shadow-soft: 0 6px 18px rgba(25, 52, 42, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  background: #ffffff;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f7faf8 0%, #f2f6f4 100%);
  color: var(--fiscal-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

body.drawer-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(23, 122, 87, 0.18);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.fiscal-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 56px;
}

.fiscal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--fiscal-line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--fiscal-shadow);
}

.fiscal-hero-copy {
  min-width: 0;
}

.fiscal-hero h1,
.tab-intro h2,
.panel h2,
.drawer-panel h2,
.fiscal-modal h2 {
  color: var(--fiscal-text);
  letter-spacing: -0.025em;
}

.fiscal-hero h1 {
  margin: 2px 0 3px;
  font-size: clamp(1.55rem, 3vw, 1.9rem);
  line-height: 1.1;
}

.fiscal-hero p,
.tab-intro p {
  max-width: 760px;
  margin: 0;
  color: var(--fiscal-muted);
  line-height: 1.5;
}

.fiscal-eyebrow,
.section-kicker,
.workflow-label {
  display: inline-block;
  color: var(--fiscal-primary);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.fiscal-actions,
.form-actions,
.context-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fiscal-hero-actions {
  flex: 0 0 auto;
}

.btn {
  appearance: none;
  min-height: 38px;
  border: 1px solid var(--fiscal-line-strong);
  border-radius: 9px;
  padding: 8px 12px;
  background: #ffffff;
  color: #31413a;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--fiscal-primary);
  border-color: var(--fiscal-primary);
  color: #ffffff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--fiscal-primary-dark);
}

.btn.success {
  background: var(--fiscal-success);
  border-color: var(--fiscal-success);
  color: #ffffff;
}

.btn.success:hover:not(:disabled) {
  background: var(--fiscal-primary-dark);
  border-color: var(--fiscal-primary-dark);
}

.btn.ghost {
  border-color: var(--fiscal-line-strong);
  background: #ffffff;
  color: #31413a;
}

.btn.ghost:hover:not(:disabled) {
  border-color: #8fb9a7;
  background: #f8fbfa;
}

.btn.danger {
  border-color: #e9c4c4;
  background: #ffffff;
  color: var(--fiscal-danger);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.fiscal-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  margin: 12px 0;
  padding: 8px 12px 8px 16px;
  border: 1px solid var(--fiscal-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
}

.context-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #44514c;
  font-size: 0.875rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fiscal-success);
  box-shadow: 0 0 0 4px var(--fiscal-success-soft);
}

.info-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  background: transparent;
  color: #50625a;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.info-trigger:hover {
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
}

.info-trigger span,
.info-dot {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #bad7c6;
  border-radius: 50%;
  background: #ffffff;
  color: var(--fiscal-primary);
  font-size: 0.75rem;
  font-weight: 900;
}

.fiscal-tabs {
  position: sticky;
  top: 6px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-top: 12px;
  padding: 5px;
  border: 1px solid var(--fiscal-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--fiscal-shadow-soft);
  backdrop-filter: blur(14px);
}

.fiscal-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 7px 10px;
  background: transparent;
  color: #44514c;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.fiscal-tab:hover {
  background: #f2f6f4;
  color: var(--fiscal-primary-dark);
}

.fiscal-tab.is-active {
  border-color: #bad7c6;
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
  box-shadow: inset 3px 0 0 var(--fiscal-primary);
}

.tab-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #eef3f1;
  color: #52625b;
  font-size: 0.75rem;
}

.fiscal-tab.is-active .tab-number {
  background: #ffffff;
  color: var(--fiscal-primary-dark);
}

.fiscal-tab-content {
  margin-top: 12px;
}

.tab-panel {
  animation: tab-enter 180ms ease both;
}

@keyframes tab-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 4px 0;
}

.tab-intro h2 {
  margin: 3px 0 4px;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

.panel {
  margin: 12px 0;
  padding: 16px;
  border: 1px solid var(--fiscal-line);
  border-radius: 14px;
  background: var(--fiscal-panel);
  box-shadow: var(--fiscal-shadow-soft);
}

.panel-priority {
  border-color: #d5e4dc;
  box-shadow: var(--fiscal-shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.compact-heading {
  align-items: center;
}

.panel h2,
.drawer-panel h2,
.fiscal-modal h2 {
  margin: 2px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.2;
}

.panel h3,
.official-das-box h3 {
  margin: 0;
  color: var(--fiscal-text);
  font-size: 1rem;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--fiscal-line);
  border-radius: 11px;
  background: var(--fiscal-panel-soft);
}

.panel-toolbar p {
  margin: 0;
  line-height: 1.45;
}

.action-row {
  margin: 10px 0 4px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.module-card {
  display: flex;
  min-height: 156px;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--fiscal-line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--fiscal-shadow-soft);
}

.module-card > div {
  flex: 1;
}

.module-card h3 {
  margin: 0 0 6px;
  font-size: 0.9375rem;
}

.module-card p {
  margin: 0;
  color: var(--fiscal-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.module-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

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

.readiness-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 9px 10px 9px 13px;
  border: 1px solid var(--fiscal-line);
  border-radius: 11px;
  background: #ffffff;
}

.readiness-item strong {
  display: block;
  color: #44514c;
  font-size: 0.8125rem;
  line-height: 1.25;
}

.compact-metrics {
  margin-top: 14px;
}

.compact-copy {
  margin: 12px 2px 0;
  font-size: 0.875rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.badge.ok {
  background: var(--fiscal-success-soft);
  color: #0c6548;
}

.badge.off {
  background: var(--fiscal-danger-soft);
  color: #a12e3c;
}

.badge.neutral {
  background: #eef1f0;
  color: #68736f;
}

.badge.progress {
  background: #f4effc;
  color: #7152a7;
}

.muted {
  color: var(--fiscal-muted);
}

.info-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #cee3da;
  border-radius: 10px;
  background: #f0f7f4;
}

.info-callout p {
  margin: 1px 0 0;
  color: #486359;
  font-size: 0.875rem;
  line-height: 1.45;
}

.info-dot {
  flex: 0 0 22px;
  padding: 0;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 12px;
}

.form-grid.compact {
  grid-template-columns: 1.15fr 0.8fr 1.2fr;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #4f5d57;
  font-size: 0.75rem;
  font-weight: 700;
}

.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--fiscal-line-strong);
  border-radius: 9px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--fiscal-text);
}

.form-grid input:hover,
.form-grid select:hover {
  border-color: #8fb9a7;
}

.inline-controls {
  align-items: end;
}

.full {
  grid-column: 1 / -1;
}

.align-end {
  align-items: flex-end;
}

.confirm-check {
  display: flex !important;
  min-height: 44px;
  flex-direction: row !important;
  align-items: center;
  gap: 9px !important;
  padding: 7px 0;
  line-height: 1.4;
}

.confirm-check input {
  width: 18px !important;
  min-height: 18px !important;
  flex: 0 0 18px;
}

.inline-status {
  min-height: 22px;
  margin-top: 11px;
  font-size: 0.9375rem;
  font-weight: 750;
  line-height: 1.4;
}

.status-ok {
  color: #0c6548;
}

.status-error {
  color: #a12e3c;
}

.table-wrap {
  overflow: auto;
  margin-top: 13px;
  border-radius: 12px;
}

.fiscal-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  border: 1px solid var(--fiscal-line);
  background: #ffffff;
}

.fiscal-table th,
.fiscal-table td {
  padding: 10px;
  border-bottom: 1px solid var(--fiscal-line);
  color: #34463e;
  font-size: 0.75rem;
  text-align: left;
  vertical-align: middle;
}

.fiscal-table th {
  background: #f2f7f4;
  color: #385548;
  font-weight: 800;
  font-size: 0.6875rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.fiscal-table tbody tr:hover {
  background: #f9fcfa;
}

.fiscal-json {
  max-height: 360px;
  margin: 13px 0 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--fiscal-line);
  border-radius: 12px;
  background: #f7faf8;
  color: #34463e;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.fiscal-json[data-ok="true"] {
  border-color: #a7d8bf;
  background: #f3fbf7;
}

.fiscal-json[data-ok="false"] {
  border-color: #efb3b3;
  background: #fff7f7;
}

.official-das-box {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #d5e4dc;
  border-radius: 13px;
  background: #f7faf8;
}

.secondary-flow {
  background: #ffffff;
}

.workflow-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.workflow-step {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--fiscal-line-strong);
  border-radius: 10px;
  padding: 7px 9px;
  background: #ffffff;
  color: #44514c;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.workflow-step span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  background: #eef3f1;
}

.workflow-step.is-primary {
  border-color: #bad7c6;
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
}

.workflow-step.is-primary span {
  background: var(--fiscal-primary);
  color: #ffffff;
}

.workflow-step.is-danger {
  border-color: #f3c2c9;
  background: var(--fiscal-danger-soft);
  color: #a12e3c;
}

.workflow-step.is-success {
  border-color: #a7d8bf;
  background: var(--fiscal-success-soft);
  color: #0c6548;
}

.workflow-step:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.workflow-fields {
  margin-top: 14px;
}

.panel.regime-inaplicavel {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf5 100%);
}

.panel.regime-inaplicavel .official-das-box {
  opacity: 0.68;
}

.fiscal-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  pointer-events: none;
}

.fiscal-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: rgba(14, 29, 23, 0.45);
  opacity: 0;
  cursor: default;
  transition: opacity 180ms ease;
}

.fiscal-drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(640px, 94vw);
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  border-left: 1px solid var(--fiscal-line);
  background: #ffffff;
  box-shadow: -24px 0 60px rgba(20, 48, 38, 0.18);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.fiscal-drawer.is-open .drawer-panel {
  transform: translateX(0);
}

.drawer-header,
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--fiscal-line);
}

.drawer-close {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--fiscal-line);
  border-radius: 8px;
  background: #f0f4f2;
  color: #50625a;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.drawer-form {
  padding-bottom: 26px;
}

.drawer-actions {
  position: sticky;
  bottom: -24px;
  justify-content: flex-end;
  margin: 10px -24px -24px;
  padding: 14px 24px 24px;
  border-top: 1px solid var(--fiscal-line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.fiscal-modal {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--fiscal-line);
  border-radius: 16px;
  padding: 20px;
  background: #ffffff;
  color: var(--fiscal-text);
  box-shadow: 0 28px 80px rgba(20, 48, 38, 0.24);
}

.fiscal-modal::backdrop {
  background: rgba(14, 29, 23, 0.45);
}

.modal-body {
  color: #465850;
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

@media (max-width: 1020px) {
  .fiscal-tabs {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: start;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .fiscal-tab {
    min-width: 150px;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.compact > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .fiscal-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 10px;
  }

  .fiscal-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .fiscal-hero-actions,
  .fiscal-hero-actions .btn {
    width: 100%;
  }

  .fiscal-context-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .fiscal-tabs {
    top: 4px;
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .compact-heading,
  .panel-toolbar,
  .workflow-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-toolbar .form-actions,
  .panel-toolbar > .btn,
  .panel-toolbar .btn {
    width: 100%;
  }

  .overview-grid,
  .form-grid,
  .form-grid.compact,
  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .form-grid.compact > :last-child,
  .full {
    grid-column: auto;
  }

  .module-card {
    min-height: 0;
  }

  .drawer-panel {
    width: 100%;
    padding: 18px;
  }

  .drawer-actions {
    bottom: -18px;
    margin: 10px -18px -18px;
    padding: 14px 18px 18px;
  }

  .drawer-actions .btn {
    flex: 1;
  }
}

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

/* RAS-FISCAL-022 — estrutura visual oficial inspirada na Oficina Inteligente. */
:root {
  --fiscal-bg: #f5f8fb;
  --fiscal-panel: #ffffff;
  --fiscal-panel-soft: #f8fbff;
  --fiscal-text: #17233a;
  --fiscal-muted: #617086;
  --fiscal-line: #d9e3f0;
  --fiscal-line-strong: #c8d6e5;
  --fiscal-primary: #1769e0;
  --fiscal-primary-dark: #0d4cb5;
  --fiscal-primary-soft: #eef5ff;
  --fiscal-success: #169c68;
  --fiscal-success-soft: #e6f8f0;
  --fiscal-danger: #d53e4f;
  --fiscal-danger-soft: #ffeaed;
  --fiscal-warning: #d9850b;
  --fiscal-warning-soft: #fff2d9;
  --fiscal-shadow: 0 8px 24px rgba(34, 74, 130, 0.065);
  --fiscal-shadow-soft: 0 6px 18px rgba(34, 74, 130, 0.05);
}

html,
body {
  min-height: 100%;
  background: var(--fiscal-bg);
}

body {
  color: #27364a;
  font-size: 16px;
  line-height: 1.45;
}

body.fiscal-menu-open {
  overflow: hidden;
}

.fiscal-skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 1200;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--fiscal-text);
  color: #ffffff;
  text-decoration: none;
}

.fiscal-skip-link:focus {
  top: 1rem;
}

.fiscal-app-shell {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  min-height: 100vh;
}

.fiscal-sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow: auto;
  padding: 18px 14px;
  border-right: 1px solid var(--fiscal-line);
  background: #ffffff;
  box-shadow: 6px 0 24px rgba(34, 74, 130, 0.06);
}

.fiscal-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
  padding: 3px 7px 17px;
  border-bottom: 1px solid var(--fiscal-line);
}

.fiscal-sidebar-brand > span:nth-child(2),
.fiscal-company-identity > span:last-child {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.fiscal-sidebar-brand strong {
  color: var(--fiscal-text);
  font-size: 1rem;
}

.fiscal-sidebar-brand small {
  margin-top: 5px;
  color: var(--fiscal-muted);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.fiscal-ras-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid #bfd3ee;
  border-radius: 13px;
  background: #ffffff;
  color: var(--fiscal-primary-dark);
  box-shadow: 0 5px 14px rgba(23, 105, 224, 0.12);
  font-size: 1.1rem;
  font-weight: 900;
}

.fiscal-tabs {
  position: static;
  z-index: auto;
  display: flex;
  grid-template-columns: none;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0 2px 10px 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.fiscal-tab {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  justify-content: stretch;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #445269;
  box-shadow: none;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
}

.fiscal-tab:hover,
.fiscal-tab:focus-visible {
  background: #f3f7fc;
  color: var(--fiscal-primary-dark);
}

.fiscal-tab.is-active {
  border: 0;
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
  box-shadow: inset 3px 0 0 var(--fiscal-primary);
}

.tab-number,
.fiscal-tab.is-active .tab-number {
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #697b91;
  font-size: 0.82rem;
}

.fiscal-tab.is-active .tab-number {
  color: var(--fiscal-primary);
}

.fiscal-sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--fiscal-line);
  border-radius: 12px;
  background: #f8fbff;
  color: var(--fiscal-muted);
  font-size: 0.75rem;
}

.fiscal-menu-backdrop,
.fiscal-mobile-only {
  display: none;
}

.fiscal-content-shell {
  min-width: 0;
  background: var(--fiscal-bg);
}

.fiscal-topbar {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 12px 16px 8px;
  padding: 13px 18px;
  border: 1px solid var(--fiscal-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--fiscal-shadow);
  backdrop-filter: blur(12px);
}

.fiscal-company-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.fiscal-company-identity strong,
.fiscal-company-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fiscal-company-identity strong {
  color: var(--fiscal-text);
  font-size: 0.95rem;
}

.fiscal-company-identity small {
  margin-top: 4px;
  color: var(--fiscal-muted);
  font-size: 0.75rem;
}

.fiscal-company-logo {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  place-items: center;
  border: 1px solid #bcd5ee;
  border-radius: 12px;
  background: #ffffff;
  color: var(--fiscal-primary-dark);
  font-size: 0.75rem;
  font-weight: 900;
}

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

.fiscal-sync-state {
  color: var(--fiscal-muted);
  font-size: 0.77rem;
}

.fiscal-avatar {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border: 1px solid #bfd3ee;
  border-radius: 12px;
  background: var(--fiscal-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(23, 105, 224, 0.14);
  font-size: 0.7rem;
  font-weight: 900;
}

.fiscal-icon-button {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border: 1px solid var(--fiscal-line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--fiscal-text);
  box-shadow: none;
  cursor: pointer;
  font-size: 1.2rem;
}

.fiscal-workspace {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}

.fiscal-tab-content {
  margin-top: 0;
}

.fiscal-hero,
.tab-intro {
  align-items: center;
  margin: 0 0 12px;
  padding: 18px 20px;
  border: 1px solid var(--fiscal-line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--fiscal-shadow);
}

.fiscal-hero h1,
.tab-intro h2 {
  margin: 2px 0 5px;
  color: var(--fiscal-text);
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  letter-spacing: -0.025em;
}

.fiscal-hero p,
.tab-intro p {
  color: var(--fiscal-muted);
  font-size: 0.83rem;
}

.fiscal-eyebrow,
.section-kicker,
.workflow-label {
  color: var(--fiscal-primary-dark);
}

.btn {
  min-height: 39px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: none;
  color: var(--fiscal-text);
  font-size: 0.8rem;
  font-weight: 800;
}

.btn.primary {
  border-color: var(--fiscal-primary);
  background: var(--fiscal-primary);
  color: #ffffff;
  box-shadow: 0 3px 0 var(--fiscal-primary-dark);
}

.btn.primary:hover:not(:disabled) {
  border-color: #1260cf;
  background: #1260cf;
}

.btn.success {
  border-color: var(--fiscal-success);
  background: var(--fiscal-success);
  color: #ffffff;
}

.btn.ghost {
  border-color: var(--fiscal-line);
  background: #ffffff;
  color: var(--fiscal-text);
}

.btn.ghost:hover:not(:disabled) {
  border-color: #bfd3ee;
  background: #f5f9ff;
  color: var(--fiscal-primary-dark);
}

.fiscal-context-bar {
  min-height: 44px;
  margin: 0 0 12px;
  border-color: var(--fiscal-line);
  border-radius: 13px;
  background: #ffffff;
  box-shadow: var(--fiscal-shadow-soft);
}

.info-trigger:hover {
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
}

.info-trigger span,
.info-dot {
  border-color: #bfd3ee;
  color: var(--fiscal-primary-dark);
}

.panel,
.module-card {
  border-color: var(--fiscal-line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--fiscal-shadow);
}

.panel {
  margin: 0 0 12px;
  padding: 18px;
}

.panel-priority {
  border-color: var(--fiscal-line);
  box-shadow: var(--fiscal-shadow);
}

.panel-heading {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9eef5;
}

.compact-heading {
  align-items: center;
}

.panel h2,
.drawer-panel h2,
.fiscal-modal h2 {
  color: var(--fiscal-text);
}

.panel-toolbar {
  border-color: var(--fiscal-line);
  border-radius: 12px;
  background: #f8fbff;
}

.overview-grid {
  gap: 10px;
  margin: 0 0 12px;
}

.module-card {
  position: relative;
  min-height: 158px;
  overflow: hidden;
  padding: 17px;
}

.module-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--fiscal-primary), #72a8e9);
  content: "";
}

.module-card h3 {
  color: var(--fiscal-text);
}

.module-icon {
  border-radius: 13px;
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
}

.readiness-item {
  border-color: var(--fiscal-line);
  background: #fbfdff;
}

.badge.progress {
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
}

.info-callout {
  border-color: #dbe8f5;
  background: #f7fbff;
  color: #526176;
}

.form-grid label {
  color: var(--fiscal-text);
  font-size: 0.8rem;
  font-weight: 800;
}

.form-grid input,
.form-grid select {
  min-height: 43px;
  border-color: #cbd9e7;
  border-radius: 10px;
  color: #27364a;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: #75a8e3;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(23, 104, 216, 0.1);
}

.fiscal-table th {
  background: #f5f8fc;
  color: #526176;
}

.fiscal-table tbody tr:hover {
  background: #f9fbfe;
}

.official-das-box,
.fiscal-json {
  border-color: var(--fiscal-line);
  background: #f8fbff;
}

.workflow-step.is-primary {
  border-color: #bfd3ee;
  background: var(--fiscal-primary-soft);
  color: var(--fiscal-primary-dark);
}

.workflow-step.is-primary span {
  background: var(--fiscal-primary);
}

.drawer-backdrop,
.fiscal-modal::backdrop {
  background: rgba(20, 35, 56, 0.48);
  backdrop-filter: blur(5px);
}

.drawer-panel,
.fiscal-modal {
  border-color: var(--fiscal-line);
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(4, 21, 45, 0.28);
}

@media (max-width: 1150px) {
  .fiscal-app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .fiscal-app-shell {
    display: block;
  }

  .fiscal-mobile-only {
    display: grid;
  }

  .fiscal-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(286px, 84vw);
    height: 100vh;
    padding: 14px 12px;
    box-shadow: 12px 0 35px rgba(28, 52, 83, 0.18);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .fiscal-sidebar.is-open {
    transform: translateX(0);
  }

  .fiscal-sidebar-brand {
    margin-bottom: 8px;
    padding-bottom: 13px;
  }

  .fiscal-sidebar-brand .fiscal-mobile-only {
    margin-left: auto;
  }

  .fiscal-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
  }

  .fiscal-tab {
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    font-size: 0.8rem;
  }

  .fiscal-menu-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(23, 35, 58, 0.25);
    backdrop-filter: blur(2px);
  }

  .fiscal-topbar {
    top: 7px;
    min-height: 62px;
    margin: 7px 8px;
    padding: 9px 11px;
    border-radius: 13px;
  }

  .fiscal-sync-state {
    display: none;
  }

  .fiscal-workspace {
    padding: 2px 8px 28px;
  }

  .fiscal-hero,
  .tab-intro {
    margin-bottom: 9px;
    padding: 15px;
    border-radius: 13px;
  }

  .fiscal-hero h1,
  .tab-intro h2 {
    font-size: 1.42rem;
  }

  .panel {
    padding: 15px;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 15px;
  }

  .fiscal-company-logo {
    width: 39px;
    height: 39px;
    flex-basis: 39px;
  }

  .fiscal-company-identity small,
  .fiscal-topbar-actions .btn:first-of-type,
  .fiscal-avatar {
    display: none;
  }

  .fiscal-topbar-actions {
    gap: 6px;
  }

  .fiscal-topbar-actions .btn {
    min-height: 37px;
    padding: 7px 9px;
  }

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

  .module-card {
    min-height: 0;
  }
}

@media print {
  .fiscal-sidebar,
  .fiscal-topbar,
  .fiscal-context-bar,
  .panel-toolbar,
  .drawer-panel,
  .fiscal-drawer {
    display: none !important;
  }

  .fiscal-app-shell {
    display: block;
  }

  .fiscal-workspace {
    max-width: none;
    padding: 0;
  }
}

/* RAS-FISCAL-023 — isolamento contra o tema global de botões. */
body .fiscal-tab {
  display: grid !important;
  min-height: 40px !important;
  padding: 8px 10px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  background-image: none !important;
  color: #445269 !important;
  box-shadow: none !important;
}

body .fiscal-tab:hover,
body .fiscal-tab:focus-visible {
  background: #f3f7fc !important;
  color: var(--fiscal-primary-dark) !important;
}

body .fiscal-tab.is-active {
  background: var(--fiscal-primary-soft) !important;
  color: var(--fiscal-primary-dark) !important;
  box-shadow: inset 3px 0 0 var(--fiscal-primary) !important;
}

body .fiscal-icon-button,
body .drawer-close {
  padding: 0 !important;
  border: 1px solid var(--fiscal-line) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  background-image: none !important;
  color: var(--fiscal-text) !important;
  box-shadow: none !important;
}

body .fiscal-menu-backdrop:not([hidden]) {
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(23, 35, 58, 0.25) !important;
  background-image: none !important;
  box-shadow: none !important;
}

body .btn {
  display: inline-flex !important;
  min-height: 39px !important;
  padding: 8px 13px !important;
  border: 1px solid transparent !important;
  border-radius: 9px !important;
  background: #ffffff !important;
  background-image: none !important;
  color: var(--fiscal-text) !important;
  box-shadow: none !important;
}

body .btn.primary {
  border-color: var(--fiscal-primary) !important;
  background: var(--fiscal-primary) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

body .btn.primary:hover:not(:disabled) {
  border-color: #1260cf !important;
  background: #1260cf !important;
}

body .btn.success {
  border-color: var(--fiscal-success) !important;
  background: var(--fiscal-success) !important;
  color: #ffffff !important;
}

body .btn.ghost {
  border-color: var(--fiscal-line) !important;
  background: #ffffff !important;
  color: var(--fiscal-text) !important;
}

body .btn.ghost:hover:not(:disabled) {
  border-color: #bfd3ee !important;
  background: #f5f9ff !important;
  color: var(--fiscal-primary-dark) !important;
}

body .btn.danger {
  border-color: #efc4cb !important;
  background: #ffffff !important;
  color: var(--fiscal-danger) !important;
}

body .info-trigger,
body .info-dot {
  border-radius: 999px !important;
  background: transparent !important;
  background-image: none !important;
  color: #526176 !important;
  box-shadow: none !important;
}

body .info-trigger:hover {
  background: var(--fiscal-primary-soft) !important;
  color: var(--fiscal-primary-dark) !important;
}

body .info-trigger span,
body .info-dot {
  border: 1px solid #bfd3ee !important;
  background: #ffffff !important;
  color: var(--fiscal-primary-dark) !important;
}

body .workflow-step {
  min-height: 42px !important;
  padding: 7px 9px !important;
  border: 1px solid var(--fiscal-line-strong) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  background-image: none !important;
  color: #445269 !important;
  box-shadow: none !important;
}

body .workflow-step.is-primary {
  border-color: #bfd3ee !important;
  background: var(--fiscal-primary-soft) !important;
  color: var(--fiscal-primary-dark) !important;
}

body .workflow-step.is-danger {
  border-color: #efc4cb !important;
  background: #fff3f5 !important;
  color: #a72535 !important;
}

body .workflow-step.is-success {
  border-color: #b9ddca !important;
  background: #edf9f3 !important;
  color: #08724a !important;
}

body .drawer-backdrop {
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(20, 35, 56, 0.48) !important;
  background-image: none !important;
  box-shadow: none !important;
}

@media (max-width: 820px) {
  body .fiscal-tab {
    min-height: 38px !important;
    padding: 7px 9px !important;
  }
}


/* RAS-FISCAL-024 — rolagem previsível e repositório de comprovantes. */
html,
body {
  height: 100%;
  overflow: hidden;
}

.fiscal-app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.fiscal-content-shell {
  height: 100dvh;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #aebed2 #edf2f8;
  scrollbar-width: auto;
}

.fiscal-content-shell::-webkit-scrollbar {
  width: 12px;
}

.fiscal-content-shell::-webkit-scrollbar-track {
  background: #edf2f8;
}

.fiscal-content-shell::-webkit-scrollbar-thumb {
  border: 3px solid #edf2f8;
  border-radius: 999px;
  background: #aebed2;
}

.proof-toolbar,
.proof-filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.proof-filters {
  flex: 1;
}

.proof-filters label {
  display: flex;
  min-width: 190px;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  color: var(--fiscal-muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.proof-filters input,
.drawer-form textarea {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--fiscal-line-strong);
  border-radius: 9px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--fiscal-text);
  font: inherit;
}

.drawer-form textarea {
  resize: vertical;
}

.proof-table td:first-child strong,
.proof-table td:first-child small {
  display: block;
}

.proof-table td:first-child small {
  margin-top: 3px;
  color: var(--fiscal-muted);
}

.proof-file-name {
  display: block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proof-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.empty-repository {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed var(--fiscal-line-strong);
  border-radius: 12px;
  background: var(--fiscal-panel-soft);
  color: var(--fiscal-muted);
  text-align: center;
}

.empty-repository strong {
  color: var(--fiscal-text);
}

.proof-file-field small {
  color: var(--fiscal-muted);
  font-weight: 500;
}

@media (max-width: 820px) {
  .fiscal-content-shell {
    height: 100dvh;
  }

  .proof-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .proof-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .proof-filters label,
  .proof-toolbar .form-actions,
  .proof-toolbar .btn {
    width: 100%;
  }
}


/* RAS-FISCAL-025 — conferência do arquivo antes do envio. */
.proof-selected-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #b9d2ee;
  border-radius: 11px;
  background: #f5f9ff;
}

.proof-selected-preview[hidden] {
  display: none;
}

.proof-selected-preview strong,
.proof-selected-preview small {
  display: block;
  overflow-wrap: anywhere;
}

.proof-selected-preview small {
  margin-top: 4px;
  color: var(--fiscal-muted);
}

@media (max-width: 600px) {
  .proof-selected-preview {
    align-items: stretch;
    flex-direction: column;
  }
}


/* RAS-FISCAL-026 — ações dos comprovantes no documento fiscal. */
.document-proof-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 170px;
}

.document-proof-actions .btn {
  width: 100%;
  min-height: 42px;
  white-space: normal;
}

.document-proof-actions .view-proof-button {
  background: #ffffff;
  border-color: #c7d8ec;
  color: #23466f;
}
