:root {
  --bg-page: #161717;
  --bg-panel: #18181b;
  --bg-card: #27272a;
  --bg-card-hover: #323238;
  --border-subtle: #27272a;
  --border-default: #3f3f46;
  --border-focus: #B90200;
  --border-required: #ef4444;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-white: #ffffff;
  --color-primary: #B90200;
  --color-primary-hover: #D60300;
  --color-accent-blue: #0284c7;
  --color-accent-blue-hover: #0369a1;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --glow-focus: 0 0 0 2px rgba(185, 2, 0, 0.25);
  --glow-blue: 0 0 0 2px rgba(2, 132, 199, 0.25);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

* { box-sizing: border-box; }

body { 
  margin: 0; 
  font-family: 'Inter', 'Helvetica', sans-serif; 
  display: flex; 
  flex-direction: row;
  height: 100vh; 
  background: #161717; 
}

.sidebar {
  width: 60px;
  background: #18181b;
  border-right: 1px solid #27272a;
  display: flex;
  flex-direction: column;
  padding-top: 20px;
  z-index: 10;
  flex-shrink: 0;
  transition: width 0.3s ease;
  overflow-x: hidden;
  overflow-y: auto;
  white-space: nowrap;
}
.sidebar.open {
  width: 275px;
}
.menu-toggle {
  color: #a1a1aa;
  font-size: 24px;
  padding: 0 18px;
  cursor: pointer;
  margin-bottom: 20px;
  user-select: none;
  display: inline-block;
  width: fit-content;
}
.menu-toggle:hover {
  color: #FFFFFF;
}
.sidebar a {
  color: #a1a1aa;
  padding: 13px 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s;
  display: block;
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar.open a {
  opacity: 1;
}
.sidebar a:hover {
  background: #3f3f46;
  color: #FFFFFF;
}
.sidebar a.active {
  background: #B90200;
  color: #FFFFFF;
}

.form-container { 
  background: #18181b; 
  color: #f4f4f5; 
  border-right: 1px solid #27272a; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  flex: 1; 
  overflow-y: auto; 
  padding: 30px 20px;
}

.form-container > div { max-width: 400px; width: 100%; }

.field-group { 
  margin-bottom: 18px; 
  border-bottom: 1px solid #27272a; 
  padding-bottom: 14px; 
}

label { 
  display: block; 
  font-weight: 700; 
  margin-bottom: 8px; 
  color: #a1a1aa; 
  font-size: 12px; 
  text-transform: uppercase; 
  letter-spacing: 1px; 
}

input[type="text"], input[type="number"], select, textarea { 
  width: 100%; 
  padding: 12px; 
  border-radius: 6px; 
  border: 1px solid #3f3f46; 
  background: #27272a; 
  color: #f4f4f5; 
  font-size: 14px; 
  transition: border-color 0.3s; 
  font-family: inherit; 
  outline: none; 
  display: block;
}

input::placeholder, textarea::placeholder, ::placeholder {
  text-transform: none !important;
  color: #71717a;
  opacity: 0.9;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--glow-focus);
}

label.required::after, .label-required::after {
  content: " *";
  color: var(--color-danger);
  font-weight: 900;
}

input:required:focus, select:required:focus {
  border-color: var(--border-focus);
  box-shadow: var(--glow-focus);
}

input.is-invalid, select.is-invalid {
  border-color: var(--color-danger) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
}

.buttons { display: flex; gap: 8px; margin-top: 25px; flex-wrap: wrap; }

button { 
  padding: 12px; 
  border-radius: var(--radius-md); 
  border: none; 
  font-weight: 700; 
  cursor: pointer; 
  font-family: inherit; 
  transition: transform 0.1s, background-color 0.2s; 
}

button:active { transform: scale(0.97); }

.btn-copiar, .plus-button, .btn-shortcut { 
  background: var(--color-primary); 
  color: #FFFFFF; 
}

.btn-copiar:hover, .btn-shortcut:hover { background: var(--color-primary-hover); }

.btn-copiar.success { background: #2e7d32 !important; color: #ffffff !important; }



.btn-limpar { background: var(--border-default); color: #FFFFFF; flex: 1; min-width: 80px; }
.btn-limpar:hover { background: #52525b; }
.btn-copiar { flex: 1; min-width: 90px; }

.btn-pdf-download {
  background: var(--color-primary);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  min-width: 44px;
  height: 44px;
  cursor: pointer;
  border-radius: var(--radius-md);
  border: none;
  flex: 0 0 auto;
  transition: background-color 0.2s, transform 0.1s, opacity 0.2s;
}

.btn-pdf-download:hover {
  background: var(--color-primary-hover);
}

.btn-pdf-download:active {
  transform: scale(0.96);
}

.btn-pdf-download:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-pdf-download svg {
  display: block;
}

.spin {
  animation: spin 1s linear infinite;
}

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


.plus-button { 
  width: 34px; height: 34px; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 24px; 
  line-height: 0; 
  padding: 0; 
  margin-top: 8px; 
  border-radius: 6px; 
}

.btn-shortcut { 
  height: 30px; 
  padding: 0 12px; 
  font-size: 12px; 
  margin-top: 8px; 
  border-radius: 6px;
  width: fit-content;
  display: inline-flex;
  align-items: center;
}

.checkbox-wrap { 
  display: flex; 
  align-items: center; 
  gap: 5px; 
  font-size: 12px; 
  color: #d4d4d8; 
  cursor: pointer; 
  margin-top: 5px; 
  font-weight: 700; 
  white-space: nowrap;
}

input[type="checkbox"] { accent-color: #B90200; width: 16px; height: 16px; cursor: pointer; }

.preview-container { 
  background: #161717; 
  display: flex; 
  align-items: flex-start; 
  justify-content: center; 
  flex: 1; 
  padding: 20px; 
  overflow-y: auto; 
}

.whatsapp-message { 
  background: #144D37; 
  color: #e9edef; 
  border-radius: 7.5px; 
  padding: 16px 20px; 
  max-width: 600px; 
  width: 100%; 
  font-size: 18px; 
  line-height: 1.5; 
  white-space: pre-wrap; 
  outline: none; 
  border: 1px solid #144D37; 
  cursor: text; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
  margin: auto; 
}

.whatsapp-message:focus { border-color: #B90200; }

#previewMsg b { font-weight: bold; }

.row-item { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; width: 100%; }
.row-item input, .row-item select { flex: 1; }

.orcamento-folha {
  background: #FFFFFF;
  color: #18181b;
  width: 100%;
  max-width: 600px;
  min-height: 848px; 
  padding: 50px 40px;
  border-radius: 4px;
  font-family: 'Helvetica', 'Arial', sans-serif;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin: auto; 
}
.orcamento-folha h2 {
  text-align: center;
  margin-top: 0;
  border-bottom: 2px solid #18181b;
  padding-bottom: 15px;
  color: #18181b;
}
.orcamento-folha .info-row {
  margin-bottom: 10px;
  font-size: 16px;
}
.orcamento-folha h3 {
  font-size: 14px;
  margin-top: 30px;
  text-transform: uppercase;
  border-bottom: 1px solid #d4d4d8;
  padding-bottom: 5px;
  color: #3f3f46;
}
.orcamento-folha ul {
  list-style: none;
  padding: 0;
  margin: 15px 0;
}
.orcamento-folha li {
  padding: 8px 0;
  border-bottom: 1px dashed #e4e4e7;
  font-size: 16px;
}
.orcamento-folha .total-row {
  margin-top: 30px;
  font-size: 22px;
  font-weight: bold;
  text-align: right;
  padding-top: 15px;
  border-top: 2px solid #18181b;
}
.orcamento-folha .footer-row {
  margin-top: 50px;
  text-align: center;
  font-size: 12px;
  color: #a1a1aa;
}

.orcamento-folha-pdf-export {
  width: 210mm !important;
  min-height: 297mm !important;
  max-width: 210mm !important;
  padding: 20mm !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  background: #ffffff !important;
  color: #18181b !important;
  font-family: 'Helvetica', 'Arial', sans-serif !important;
}

.orcamento-folha-pdf-export .segundavia-folha {
  min-height: 257mm !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}


.carimbos-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 70px;
  margin-top: 110px;
}

.carimbo-img {
  width: 5.7cm;
  height: 3.8cm;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.comprovante-folha {
  background: #FFFFFF;
  color: #18181b;
  width: 100%;
  max-width: 600px;
  min-height: 848px;
  padding: 30px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin: 30px auto 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.comprovante-folha:empty,
.comprovante-folha:not(.ativo),
.comprovante-folha[style*="display: none"] {
  display: none !important;
}

.comprovante-folha canvas {
  max-width: 100%;
  height: auto !important;
  border: 1px solid #e4e4e7;
  border-radius: 2px;
}

@media print {
  @page { margin: 0; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #FFFFFF; height: auto; display: block; }
  .form-container, .sidebar { display: none !important; }
  
  .preview-container { 
    padding: 0 !important; 
    background: #FFFFFF !important; 
    display: block !important; 
  }

  #documento-completo {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .orcamento-folha {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: none !important;
    width: 100% !important;
    padding: 20mm !important;
    min-height: auto !important;
    margin: 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .orcamento-folha.folha-extra {
    page-break-before: always !important;
    break-before: page !important;
  }

  .orcamento-folha.folha-extra:empty,
  .orcamento-folha.folha-extra[style*="display: none"] {
    display: none !important;
    page-break-before: auto !important;
    break-before: auto !important;
    min-height: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
  }

  .comprovante-folha,
  .comprovante-folha:empty,
  .comprovante-folha:not(.ativo),
  .comprovante-folha[style*="display: none"] {
    display: none !important;
    page-break-before: auto !important;
    break-before: auto !important;
    min-height: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
  }

  .comprovante-folha.ativo:not(:empty) {
    page-break-before: always !important;
    break-before: page !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    max-width: none !important;
    width: 100% !important;
    padding: 10mm !important;
    min-height: 270mm !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .comprovante-folha canvas {
    max-width: 100% !important;
    max-height: 270mm !important;
    object-fit: contain !important;
    border: none !important;
  }

  .segundavia-folha {
    min-height: 250mm !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }

  .carimbos-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 70px !important;
    margin-top: 110px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .carimbo-img {
    width: 5.7cm !important;
    height: 3.8cm !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    mix-blend-mode: multiply !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}



