:root {
  --navy: #1E1E64;
  --gold: #C8922A;
  --offwhite: #F8F6F2;
  --paper: #FFFFFF;
  --ink: #171827;
  --muted: #646775;
  --line: #D8D4CC;
  --soft-line: #ECE7DD;
  --success: #0F766E;
  --danger: #B42318;
  --warning: #A15C07;
  --info: #285C7E;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--offwhite);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--offwhite);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--gold);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, .32);
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0;
}

.brand p,
.brand h1,
.topbar-meta {
  margin: 0;
}

.brand p {
  font-size: .82rem;
  color: #E7DBC5;
  font-weight: 700;
}

.brand h1 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar-meta {
  font-size: .86rem;
  color: #EDE8DD;
  text-align: right;
}

.main {
  width: min(1280px, calc(100% - 28px));
  margin: 22px auto 44px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.tab-button {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.tab-button[aria-selected="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 8px 20px rgba(30, 30, 100, .16);
}

.panel {
  display: grid;
  gap: 16px;
}

.module {
  display: grid;
  gap: 16px;
}

.form-card,
.result-card,
.notice,
.report,
.section,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.form-card,
.result-card,
.empty-state {
  padding: clamp(16px, 3vw, 26px);
  box-shadow: 0 18px 42px rgba(30, 30, 100, .08);
}

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

.module-title h2,
.module-title p {
  margin: 0;
}

.module-title h2 {
  color: var(--navy);
  font-size: clamp(1.32rem, 2vw, 1.8rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.module-title p {
  margin-top: 6px;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.5;
}

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

.field {
  display: grid;
  gap: 7px;
  grid-column: span 12;
}

.field.half {
  grid-column: span 6;
}

.field.third {
  grid-column: span 4;
}

.field.quarter {
  grid-column: span 3;
}

.field label {
  color: var(--navy);
  font-size: .88rem;
  font-weight: 800;
}

.field small {
  color: var(--muted);
  line-height: 1.4;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #CFC9BD;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 146, 42, .18);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  padding: 8px 14px;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--navy);
  color: #fff;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 800;
  color: var(--navy);
  background: #fff;
  text-decoration: none;
}

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

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

.btn.secondary {
  border-color: var(--line);
  background: #fff;
}

.btn.danger {
  border-color: #F1B6B0;
  background: #FFF7F6;
  color: var(--danger);
}

.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: .86rem;
}

.btn:hover:not(:disabled) {
  filter: brightness(.98);
}

.status-line {
  margin-top: 14px;
  min-height: 22px;
  color: var(--muted);
  font-weight: 700;
}

.status-line.error {
  color: var(--danger);
}

.notice {
  padding: 13px 14px;
  color: #423827;
  background: #FFF8E8;
  border-color: #E7CF9B;
  line-height: 1.45;
}

.notice.info {
  background: #F2F7FA;
  border-color: #C9DCE7;
  color: #233B4A;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--navy);
  font-size: 1.08rem;
  margin-bottom: 6px;
}

.report {
  overflow: hidden;
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  color: #fff;
  background: var(--navy);
  border-bottom: 4px solid var(--gold);
}

.report-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.report-brand .brand-mark {
  width: 42px;
  height: 42px;
}

.report-brand p,
.report-brand h2,
.report-title p,
.report-title h3 {
  margin: 0;
}

.report-brand p,
.report-title p {
  font-size: .78rem;
  color: #E9DECA;
  font-weight: 800;
}

.report-brand h2,
.report-title h3 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.report-title {
  text-align: right;
}

.report-body {
  padding: 18px 20px 20px;
  display: grid;
  gap: 14px;
}

.report-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metric,
.kv,
.publication,
.movement,
.address-item,
.fipe-price,
.validation-box {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.metric span,
.kv dt {
  display: block;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong,
.kv dd {
  display: block;
  margin: 5px 0 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.section {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.section h4 {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.section-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.list {
  display: grid;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 11px;
  text-align: left;
  border-bottom: 1px solid var(--soft-line);
  vertical-align: top;
  font-size: .92rem;
}

th {
  color: var(--navy);
  background: #FBF7EF;
  font-size: .78rem;
  text-transform: uppercase;
}

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

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  padding: 5px 9px;
  font-size: .78rem;
  font-weight: 800;
}

.tag.success {
  border-color: #A4D5CC;
  color: var(--success);
  background: #F1FBF8;
}

.tag.warning {
  border-color: #E4C27A;
  color: var(--warning);
  background: #FFF8E8;
}

.tag.danger {
  border-color: #F0B5AF;
  color: var(--danger);
  background: #FFF7F6;
}

.publication p,
.movement p,
.address-item p,
.fipe-price p,
.validation-box p {
  margin: 0;
  line-height: 1.45;
}

.publication strong,
.movement strong,
.address-item strong,
.fipe-price strong,
.validation-box strong {
  color: var(--navy);
}

.publication .excerpt {
  margin-top: 8px;
  color: #343541;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}


.process-number-list {
  display: grid;
  gap: 10px;
}

.process-accordion {
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.process-accordion summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--navy);
  font-weight: 900;
  list-style-position: inside;
}

.process-accordion[open] summary {
  border-bottom: 1px solid var(--soft-line);
  background: #FBF7EF;
}

.process-details {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.copy-row {
  padding: 0 14px 14px;
}

.report-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
  background: #FBF8F2;
}

.chart {
  width: 100%;
  height: 220px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .report-meta,
  .section-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .field.third,
  .field.quarter {
    grid-column: span 6;
  }
}

@media (max-width: 680px) {
  .topbar,
  .report-header,
  .module-title,
  .report-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-meta,
  .report-title {
    text-align: left;
  }

  .tabs,
  .report-meta,
  .section-grid,
  .section-grid.two {
    grid-template-columns: 1fr;
  }

  .field.half,
  .field.third,
  .field.quarter {
    grid-column: span 12;
  }

  .segmented {
    grid-auto-flow: row;
  }

  .segmented button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

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

@media print {
  :root {
    background: #fff;
  }

  body {
    background: #fff;
    color: #111;
  }

  .no-print,
  .form-card,
  .tabs,
  .empty-state,
  .actions,
  .copy-row {
    display: none !important;
  }

  .main {
    width: 100%;
    margin: 0;
  }

  .panel,
  .module {
    display: block;
  }

  .result-card {
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  .report {
    border: 0;
    border-radius: 0;
    page-break-inside: auto;
  }

  .report-header {
    background: var(--navy) !important;
    color: #fff !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .section,
  .metric,
  .kv,
  .publication,
  .movement,
  .address-item,
  .fipe-price,
  .validation-box,
  .table-wrap {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-body {
    padding: 14px 0;
  }

  .report-footer {
    padding-left: 0;
    padding-right: 0;
  }

}


.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid #CFC9BD;
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
  color: var(--navy);
  font-weight: 800;
}

.checkline input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.process-cost {
  margin-top: 14px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 7px;
  border: 1px solid #D9C79E;
  border-radius: 999px;
  background: #FFF8E8;
  color: #6E4A07;
  padding: 3px 8px;
  font-size: .7rem;
  font-weight: 800;
  text-transform: none;
}

.subsection-title {
  margin: 14px 0 8px;
  color: var(--navy);
  font-size: .95rem;
}
