@font-face {
  font-family: "Cairo";
  src: url("assets/Fontes/cairo-font-family-1742747359-0/Cairo-Regular-BF643384ef31630.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Cairo";
  src: url("assets/Fontes/cairo-font-family-1742747359-0/Cairo-Bold-BF643384ee22aa6.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Cordelina";
  src: url("assets/Fontes/cordelina/cordelina.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #161713;
  --muted: #6d6c65;
  --line: #dedbd1;
  --surface: #ffffff;
  --surface-soft: #f5f2eb;
  --paper: #fffefb;
  --charcoal: #11120f;
  --charcoal-soft: #1b1d18;
  --amber: #d98218;
  --amber-dark: #a95f09;
  --amber-soft: #fff1d9;
  --success: #277a4b;
  --danger: #b33a31;
  --shadow-sm: 0 8px 24px rgba(22, 23, 19, 0.08);
  --shadow-lg: 0 24px 70px rgba(22, 23, 19, 0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --font: "Cairo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Cordelina", "Cairo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}

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

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(217, 130, 24, 0.35);
  outline-offset: 2px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--amber-dark);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--amber);
  color: #1a1208;
}

.button-primary:hover {
  background: #e99728;
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: #b9b4a8;
  background: #faf9f6;
}

.button-dark {
  background: var(--charcoal);
  color: #fff;
}

.button-dark:hover {
  background: #292b25;
}

.button-ghost {
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #fff;
}

.button-ghost:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.07);
}

.button-small {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--amber-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.text-button:hover {
  text-decoration-color: currentColor;
}

/* Entrada */

.login-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(100deg, rgba(8, 9, 7, 0.97), rgba(8, 9, 7, 0.78)),
    url("assets/Capa-LinkedIn.png") center / cover no-repeat;
}

.login-card {
  width: min(100%, 470px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 6vw, 48px);
  background: rgba(17, 18, 15, 0.92);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.42);
  color: #fff;
  backdrop-filter: blur(12px);
}

.login-logo {
  width: 82px;
  height: 82px;
  margin-bottom: 24px;
  object-fit: contain;
}

.login-card .eyebrow {
  color: #f1a33d;
}

.login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 5vw, 2.55rem);
  line-height: 1.08;
}

.login-copy {
  margin: 12px 0 28px;
  color: #c7c7bf;
}

.login-form label {
  display: block;
  margin-bottom: 7px;
  color: #e5e5df;
  font-size: 0.83rem;
  font-weight: 700;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.password-row input {
  min-width: 0;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.password-row input::placeholder {
  color: #8f9189;
}

.login-card > .text-button {
  margin-top: 14px;
  padding: 0;
  color: #f1a33d;
}

/* Navegação */

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

.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  min-height: 68px;
  padding: 9px clamp(16px, 3vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(17, 18, 15, 0.97);
  color: #fff;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand strong {
  font-size: 0.95rem;
}

.brand small {
  margin-top: 4px;
  color: #9f9f97;
  font-size: 0.7rem;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.nav-button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 8px 13px;
  background: transparent;
  color: #aaa9a1;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-button:hover,
.nav-button.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-button.is-active {
  box-shadow: inset 0 -2px var(--amber);
}

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

.settings-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #9f9f97;
  font-size: 1rem;
  line-height: 1;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.settings-button:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.mode-badge {
  border: 1px solid rgba(217, 130, 24, 0.45);
  border-radius: 999px;
  padding: 4px 8px;
  color: #f1a33d;
  font-size: 0.68rem;
  font-weight: 700;
}

/* Gerador */

.generator-view {
  display: grid;
  grid-template-columns: minmax(370px, 450px) minmax(650px, 1fr);
  min-height: calc(100vh - 68px);
}

.editor-panel {
  position: relative;
  z-index: 2;
  border-right: 1px solid var(--line);
  padding: 28px 26px 44px;
  background: var(--surface);
  box-shadow: 10px 0 30px rgba(22, 23, 19, 0.04);
}

.editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.editor-heading h2,
.records-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.2;
}

.form-section {
  padding: 26px 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.section-number {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: var(--charcoal);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.section-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.field,
.field-grid {
  margin-bottom: 16px;
}

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

.field-grid .field {
  margin-bottom: 0;
}

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

.field label,
.tax-row > label {
  display: block;
  margin-bottom: 6px;
  color: #393a34;
  font-size: 0.77rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbc8bf;
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input,
select {
  min-height: 43px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aaa69c;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 130, 24, 0.12);
  outline: 0;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.7rem;
}

.items-editor {
  display: grid;
  gap: 10px;
}

.item-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(120px, 1.1fr) 112px 34px;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #faf9f6;
}

.item-field label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}

.item-field input {
  min-height: 38px;
  padding: 8px 9px;
  font-size: 0.78rem;
}

.currency-field {
  position: relative;
}

.currency-field span {
  position: absolute;
  bottom: 10px;
  left: 9px;
  color: var(--muted);
  font-size: 0.7rem;
  pointer-events: none;
}

.currency-field input {
  padding-left: 29px;
  text-align: right;
}

.remove-item-button {
  display: grid;
  width: 34px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #918e85;
  font-size: 1rem;
}

.remove-item-button:hover {
  background: #f5e4e1;
  color: var(--danger);
}

.add-item-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--amber-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

.tax-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
}

.tax-row > label {
  margin: 0;
}

.percent-input,
.suffix-input {
  position: relative;
}

.percent-input {
  width: 90px;
}

.percent-input input,
.suffix-input input {
  padding-right: 37px;
  text-align: right;
}

.percent-input span,
.suffix-input span {
  position: absolute;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.75rem;
  pointer-events: none;
}

.finance-notice {
  display: grid;
  gap: 2px;
  margin-top: 15px;
  border-left: 3px solid var(--amber);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  background: var(--amber-soft);
  color: #63400f;
  font-size: 0.72rem;
}

.finance-notice strong {
  color: #442b08;
}

.totals-card {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--charcoal);
  color: #bcbdb6;
  font-size: 0.76rem;
}

.totals-card > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.totals-card strong {
  color: #fff;
}

.totals-card .total-line {
  margin-top: 7px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.93rem;
}

.totals-card .total-line strong {
  color: #f1a33d;
}

.form-details {
  margin-bottom: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.form-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 0;
  list-style: none;
}

.form-details summary::-webkit-details-marker {
  display: none;
}

.form-details summary > span:first-child {
  display: flex;
  flex-direction: column;
}

.form-details summary strong {
  font-size: 0.9rem;
}

.form-details summary small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.summary-icon {
  color: var(--amber-dark);
  font-size: 1.2rem;
  transition: transform 160ms ease;
}

.form-details[open] .summary-icon {
  transform: rotate(45deg);
}

.details-content {
  padding: 3px 0 8px;
}

.email-confirmation {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #faf9f6;
  cursor: pointer;
}

.email-confirmation input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--amber);
}

.email-confirmation span {
  display: flex;
  flex-direction: column;
}

.email-confirmation strong {
  font-size: 0.8rem;
}

.email-confirmation small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.69rem;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-message {
  min-height: 21px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.form-message.is-success {
  color: var(--success);
}

.form-message.is-error {
  color: var(--danger);
}

/* Prévia */

.preview-panel {
  min-width: 0;
  background: #e8e4dc;
}

.preview-toolbar {
  position: sticky;
  z-index: 20;
  top: 68px;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px clamp(18px, 3vw, 38px);
  border-bottom: 1px solid #d2cec5;
  background: rgba(245, 242, 235, 0.94);
  backdrop-filter: blur(12px);
}

.preview-toolbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
}

.preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(39, 122, 75, 0.12);
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.theme-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.theme-control select {
  width: auto;
  min-height: 36px;
  padding: 6px 28px 6px 9px;
  font-size: 0.74rem;
}

.paper-stage {
  overflow: auto;
  padding: clamp(24px, 4vw, 58px);
}

.quote-document {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 15mm 16mm 11mm;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  color: #20211d;
  font-family: var(--font);
  font-size: 10pt;
  line-height: 1.45;
}

.document-header {
  display: grid;
  grid-template-columns: 35mm 1fr;
  align-items: center;
  gap: 11mm;
}

.document-logo {
  width: 32mm;
  height: 32mm;
  object-fit: contain;
}

.document-title {
  padding-left: 10mm;
  border-left: 1px solid #d4d0c7;
}

.document-title > p {
  margin: 0 0 1mm;
  color: var(--amber-dark);
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.document-title h1 {
  margin: 0;
  color: #151612;
  font-family: var(--font-display);
  font-size: 25pt;
  font-weight: 400;
  line-height: 1.08;
  text-transform: uppercase;
}

.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7mm;
  margin-top: 4mm;
  color: #77766f;
  font-size: 7.5pt;
}

.document-meta strong {
  margin-left: 1.2mm;
  color: #252620;
}

.document-accent {
  width: 100%;
  height: 2.3mm;
  margin: 8mm 0 7mm;
  background: linear-gradient(90deg, var(--amber) 0 26%, #171814 26% 100%);
}

.document-section {
  margin-top: 7mm;
  break-inside: avoid;
}

.document-kicker {
  margin: 0 0 3mm;
  color: var(--amber-dark);
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.document-section h2 {
  margin: 0 0 3mm;
  color: #191a16;
  font-size: 14pt;
  line-height: 1.25;
}

.company-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #d9d6cd;
  border-left: 1px solid #d9d6cd;
}

.company-grid > div {
  display: flex;
  min-height: 15mm;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid #d9d6cd;
  border-bottom: 1px solid #d9d6cd;
  padding: 2.5mm 3.5mm;
}

.company-grid > div:nth-child(4) {
  grid-column: 1;
}

.company-grid-wide {
  grid-column: 1 / -1;
}

.company-grid span,
.conditions-grid span {
  margin-bottom: 1mm;
  color: #77766f;
  font-size: 6.8pt;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.company-grid strong,
.conditions-grid strong {
  font-size: 8.5pt;
}

.document-description {
  white-space: pre-line;
}

.table-wrap {
  overflow: hidden;
  border: 1px solid #d4d0c7;
}

.document-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.document-table th,
.document-table td {
  border-bottom: 1px solid #dedbd3;
  padding: 2.6mm 3mm;
  text-align: left;
  vertical-align: top;
}

.document-table th {
  background: #1a1b17;
  color: #fff;
  font-size: 7pt;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.document-table th:nth-child(1) {
  width: 31%;
}

.document-table th:nth-child(2) {
  width: 45%;
}

.document-table th:last-child,
.document-table td:last-child {
  width: 24%;
  text-align: right;
  white-space: nowrap;
}

.document-table tbody td {
  font-size: 8.2pt;
}

.document-table tbody td:nth-child(2) {
  color: #6b6a63;
}

.document-table tfoot td {
  border-bottom-color: #e3e0d8;
  background: #faf8f3;
  font-size: 8pt;
}

.document-table tfoot td:first-child {
  text-align: right;
}

.document-table .document-total-row td {
  border-bottom: 0;
  background: var(--amber);
  color: #17120b;
  font-size: 10pt;
  font-weight: 700;
  text-transform: uppercase;
}

.conditions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4mm 8mm;
  border-top: 1px solid #d9d6cd;
  padding-top: 4mm;
}

.conditions-grid > div {
  display: flex;
  flex-direction: column;
}

.not-included {
  margin: 4mm 0 0;
  border-left: 2px solid var(--amber);
  padding: 2.5mm 3mm;
  background: #faf5e9;
  color: #5f5d56;
  font-size: 7.5pt;
}

.not-included strong {
  color: #33342e;
}

.document-signature {
  margin-top: 7mm;
  text-align: center;
  break-inside: avoid;
}

.document-signature img {
  width: 100%;
  max-height: 48mm;
  object-fit: contain;
}

.document-footer {
  display: flex;
  justify-content: space-between;
  gap: 10mm;
  margin-top: 6mm;
  border-top: 1px solid #d4d0c7;
  padding-top: 3mm;
  color: #6d6c65;
  font-size: 6.8pt;
}

/* Configurações */

.settings-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 28px));
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.settings-dialog::backdrop {
  background: rgba(8, 9, 7, 0.68);
  backdrop-filter: blur(5px);
}

.settings-card {
  overflow: auto;
  max-height: min(760px, calc(100vh - 28px));
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.settings-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 24px 26px 20px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.settings-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
}

.dialog-close {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 1.2rem;
}

.dialog-close:hover {
  border-color: #b9b4a8;
  color: var(--ink);
}

.settings-section {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 23px 26px;
  border-bottom: 1px solid var(--line);
}

.settings-section-stack {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 14px;
}

.settings-section h3 {
  margin: 0;
  font-size: 0.95rem;
}

.settings-section p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.settings-tax {
  width: 100px;
}

.settings-cnae-list {
  display: grid;
  gap: 8px;
}

.settings-cnae-row {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

.settings-cnae-row input {
  min-height: 39px;
  padding: 8px 9px;
  font-size: 0.76rem;
}

.settings-cnae-row .remove-item-button {
  height: 39px;
}

.settings-footer {
  position: sticky;
  z-index: 2;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 26px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
}

.settings-footer .form-message {
  margin: 0;
}

.settings-footer > div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

/* Visual digital: mais escuro para envio em tela */

.quote-document.theme-digital {
  background: #151612;
  color: #e9e7df;
}

.theme-digital .document-title {
  border-left-color: #3f403a;
}

.theme-digital .document-title h1,
.theme-digital .document-meta strong,
.theme-digital .document-section h2 {
  color: #fff;
}

.theme-digital .document-title > p,
.theme-digital .document-kicker {
  color: #f1a33d;
}

.theme-digital .document-meta,
.theme-digital .company-grid span,
.theme-digital .conditions-grid span {
  color: #aaa9a1;
}

.theme-digital .company-grid {
  border-top-color: #3c3e37;
  border-left-color: #3c3e37;
}

.theme-digital .company-grid > div {
  border-right-color: #3c3e37;
  border-bottom-color: #3c3e37;
}

.theme-digital .document-table {
  color: #eeece5;
}

.theme-digital .table-wrap,
.theme-digital .document-table th,
.theme-digital .document-table td {
  border-color: #404139;
}

.theme-digital .document-table th {
  background: #090a08;
}

.theme-digital .document-table tbody td:nth-child(2) {
  color: #b8b7af;
}

.theme-digital .document-table tfoot td {
  background: #22231e;
}

.theme-digital .document-table .document-total-row td {
  background: var(--amber);
  color: #17120b;
}

.theme-digital .conditions-grid,
.theme-digital .document-footer {
  border-color: #3c3e37;
}

.theme-digital .not-included {
  background: #22231e;
  color: #c9c7be;
}

.theme-digital .not-included strong {
  color: #fff;
}

.theme-digital .document-footer {
  color: #aaa9a1;
}

/* Registros */

.records-view {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 70px;
}

.records-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.records-feedback {
  border: 1px dashed #c7c3b8;
  border-radius: var(--radius-md);
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.records-list {
  display: grid;
  gap: 12px;
}

.record-card {
  display: grid;
  grid-template-columns: 105px minmax(180px, 1fr) minmax(130px, 0.5fr) 130px auto;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(22, 23, 19, 0.035);
}

.record-card:hover {
  border-color: #c7c2b5;
  box-shadow: var(--shadow-sm);
}

.record-folio span,
.record-client span,
.record-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.record-folio strong {
  font-size: 1rem;
}

.record-client strong,
.record-meta strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-value {
  font-size: 0.92rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.record-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.record-actions .button {
  min-height: 35px;
  padding: 7px 10px;
  font-size: 0.72rem;
}

.payment-editor {
  display: flex;
  align-items: center;
  gap: 7px;
}

.payment-editor label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.payment-editor input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--success);
}

.payment-editor input[type="date"] {
  width: 130px;
  min-height: 35px;
  padding: 6px 8px;
  font-size: 0.72rem;
}

/* Impressão e responsividade */

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: auto 1fr;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .topbar-actions {
    justify-self: end;
  }

  .generator-view {
    grid-template-columns: 1fr;
  }

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

  .preview-toolbar {
    top: 113px;
  }

  .record-card {
    grid-template-columns: 90px minmax(160px, 1fr) 120px auto;
  }

  .record-meta {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 10px;
    padding: 8px 13px;
  }

  .brand small,
  .topbar-actions .button:first-of-type,
  .mode-badge {
    display: none;
  }

  .main-nav {
    gap: 2px;
  }

  .nav-button {
    padding: 8px 10px;
    font-size: 0.74rem;
  }

  .settings-button {
    width: 32px;
    height: 32px;
  }

  .editor-panel {
    padding: 24px 17px 38px;
  }

  .field-grid-2,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .item-row {
    grid-template-columns: 1fr 98px 34px;
  }

  .item-row .item-field:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .item-row .remove-item-button {
    grid-column: 3;
    grid-row: 1;
  }

  .preview-toolbar {
    position: static;
    align-items: flex-start;
    padding: 11px 15px;
  }

  .preview-toolbar > div:first-child {
    display: none;
  }

  .preview-actions {
    width: 100%;
    justify-content: space-between;
  }

  .paper-stage {
    padding: 14px 10px 26px;
  }

  .quote-document {
    width: 100%;
    min-height: 0;
    padding: 22px 18px 18px;
    font-size: 8.5pt;
  }

  .document-header {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 14px;
  }

  .document-logo {
    width: 64px;
    height: 64px;
  }

  .document-title {
    padding-left: 14px;
  }

  .document-title h1 {
    font-size: 20pt;
  }

  .document-meta {
    gap: 10px;
    margin-top: 8px;
  }

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

  .company-grid > div,
  .company-grid > div:nth-child(4),
  .company-grid-wide {
    grid-column: 1;
  }

  .document-table th:nth-child(2),
  .document-table tbody td:nth-child(2) {
    display: none;
  }

  .document-table th:nth-child(1) {
    width: 62%;
  }

  .document-table th:last-child,
  .document-table td:last-child {
    width: 38%;
  }

  .document-table th,
  .document-table td {
    padding: 8px;
  }

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

  .document-footer {
    flex-direction: column;
    gap: 2px;
  }

  .quote-document.pdf-rendering {
    width: 210mm;
    min-height: 297mm;
    padding: 15mm 16mm 11mm;
    font-size: 10pt;
  }

  .pdf-rendering .document-header {
    grid-template-columns: 35mm 1fr;
    gap: 11mm;
  }

  .pdf-rendering .document-logo {
    width: 32mm;
    height: 32mm;
  }

  .pdf-rendering .document-title {
    padding-left: 10mm;
  }

  .pdf-rendering .document-title h1 {
    font-size: 25pt;
  }

  .pdf-rendering .document-meta {
    gap: 7mm;
    margin-top: 4mm;
  }

  .pdf-rendering .company-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pdf-rendering .company-grid-wide {
    grid-column: 1 / -1;
  }

  .pdf-rendering .company-grid > div:nth-child(4) {
    grid-column: 1;
  }

  .pdf-rendering .document-table th:nth-child(2),
  .pdf-rendering .document-table tbody td:nth-child(2) {
    display: table-cell;
  }

  .pdf-rendering .document-table th:nth-child(1) {
    width: 31%;
  }

  .pdf-rendering .document-table th:nth-child(2) {
    width: 45%;
  }

  .pdf-rendering .document-table th:last-child,
  .pdf-rendering .document-table td:last-child {
    width: 24%;
  }

  .pdf-rendering .document-table th,
  .pdf-rendering .document-table td {
    padding: 2.6mm 3mm;
  }

  .pdf-rendering .conditions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4mm 8mm;
  }

  .pdf-rendering .document-footer {
    flex-direction: row;
    gap: 10mm;
  }

  .records-view {
    width: min(100% - 28px, 1180px);
    padding-top: 28px;
  }

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

  .record-card {
    grid-template-columns: 90px 1fr;
    gap: 13px;
  }

  .record-value {
    text-align: left;
  }

  .record-actions,
  .payment-editor {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .settings-dialog {
    width: min(100% - 16px, 680px);
    max-height: calc(100vh - 16px);
  }

  .settings-card {
    max-height: calc(100vh - 16px);
  }

  .settings-header,
  .settings-section,
  .settings-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .settings-cnae-row {
    grid-template-columns: 105px minmax(0, 1fr) 34px;
  }

  .settings-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-footer > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .login-screen {
    padding: 12px;
  }

  .login-card {
    padding: 28px 22px;
  }

  .password-row {
    grid-template-columns: 1fr;
  }

  .brand span {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .button {
    padding: 7px 9px;
  }

  .settings-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .settings-cnae-row {
    grid-template-columns: minmax(0, 1fr) 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
  }

  .settings-cnae-row input:first-child {
    grid-column: 1;
  }

  .settings-cnae-row input:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .settings-cnae-row .remove-item-button {
    grid-column: 2;
    grid-row: 1;
  }
}

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

  .topbar,
  .editor-panel,
  .preview-toolbar {
    display: none !important;
  }

  .generator-view,
  .preview-panel,
  .paper-stage {
    display: block;
    min-height: auto;
    padding: 0;
    background: #fff;
  }

  .quote-document {
    margin: 0;
    box-shadow: none;
  }
}
