/* ==========================================================================
   ESTILO MINIMALISTA PRETO & BRANCO (B&W) - SISTEMA FINANCEIRO COLUMBIA
   ========================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f4f4f5;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  
  --border-subtle: #e4e4e7;
  --border-strong: #18181b;
  
  --text-primary: #09090b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  
  --accent-white: #ffffff;
  --accent-black: #000000;
  
  --badge-credit-bg: #000000;
  --badge-credit-text: #ffffff;
  --badge-credit-border: #000000;
  
  --badge-debit-bg: #f4f4f5;
  --badge-debit-text: #09090b;
  --badge-debit-border: #d4d4d8;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --bg-primary: #09090b;
  --bg-secondary: #121215;
  --bg-tertiary: #18181b;
  --bg-card: #121215;
  --bg-hover: #27272a;
  
  --border-subtle: #27272a;
  --border-strong: #3f3f46;
  
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --accent-white: #ffffff;
  --accent-black: #000000;
  
  --badge-credit-bg: #1c1c1f;
  --badge-credit-text: #ffffff;
  --badge-credit-border: #52525b;
  
  --badge-debit-bg: #18181b;
  --badge-debit-text: #a1a1aa;
  --badge-debit-border: #3f3f46;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "tnum";
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

code, kbd, samp, pre, .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-feature-settings: "tnum";
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Navbar */
.navbar {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--text-primary);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 0.875rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-link {
  background: none;
  border: none;
  padding: 0.5rem 0.85rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Theme toggle & icons */
.icon-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-tertiary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.btn-danger {
  background: transparent;
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

/* ==========================================================================
   SHADCN/UI DESIGN SYSTEM STYLES
   ========================================================================== */
.btn-shadcn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  box-sizing: border-box;
}

.btn-shadcn:focus-visible {
  outline: 2px solid #09090b;
  outline-offset: 2px;
}

.btn-shadcn.bg-black {
  background-color: #09090b !important;
  color: #ffffff !important;
  border-color: #09090b !important;
}

.btn-shadcn.bg-black:hover {
  background-color: #27272a !important;
  border-color: #27272a !important;
}

.btn-shadcn.bg-zinc-100 {
  background-color: #f4f4f5 !important;
  color: #09090b !important;
  border-color: #e4e4e7 !important;
}

.btn-shadcn.bg-zinc-100:hover {
  background-color: #e4e4e7 !important;
}

.btn-shadcn.border-zinc-300 {
  background-color: #ffffff !important;
  color: #09090b !important;
  border-color: #e4e4e7 !important;
}

.btn-shadcn.border-zinc-300:hover {
  background-color: #f4f4f5 !important;
  border-color: #d4d4d8 !important;
}

.btn-shadcn.bg-red-600 {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
}

.btn-shadcn.bg-red-600:hover {
  background-color: #b91c1c !important;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem 0;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Headers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Cards & Grids */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
}

.card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.card-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Card Hero / Balance Spotlight */
.card-balance-highlight {
  border: 2px solid var(--text-primary);
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.badge-status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.725rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border-strong);
}

.badge-status.favorable {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.badge-status.unfavorable {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Charts Section */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.775rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-color.credit {
  background: var(--text-primary);
}

.legend-color.debit {
  background: var(--border-strong);
  border: 1px dashed var(--text-secondary);
}

.legend-color.balance {
  background: #ffffff;
  border: 1px solid #71717a;
}

.svg-chart-container {
  width: 100%;
  height: 220px;
  position: relative;
}

/* Tables */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-tag.credit {
  background: var(--badge-credit-bg);
  color: var(--badge-credit-text);
  border-color: var(--badge-credit-border);
}

.badge-tag.debit {
  background: var(--badge-debit-bg);
  color: var(--badge-debit-text);
  border-color: var(--badge-debit-border);
}

.badge-tag.payment {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.amount-positive {
  font-weight: 600;
  color: var(--text-primary);
}

.amount-negative {
  font-weight: 500;
  color: var(--text-secondary);
}

/* Filters & Toolbar */
.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.input-control, .select-control {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-control:focus, .select-control:focus {
  border-color: var(--text-primary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  padding: 1rem;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: translateY(10px);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-secondary);
}

/* Segmented Control / Toggle Tabs */
.segmented-control {
  display: flex;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.segmented-btn {
  flex: 1;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.segmented-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Combobox / Autocomplete Dropdown */
.combobox-container {
  position: relative;
  width: 100%;
}

.combobox-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}

.combobox-item {
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s ease;
}

.combobox-item:last-child {
  border-bottom: none;
}

.combobox-item:hover {
  background: var(--bg-hover);
}

.combobox-item-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.combobox-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.combobox-item-price {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.combobox-create-btn {
  padding: 0.75rem 0.85rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  border-top: 1px solid var(--border-strong);
  transition: background 0.15s ease;
}

.combobox-create-btn:hover {
  background: var(--bg-tertiary);
  text-decoration: underline;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.2s ease forwards;
}

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   FOLHA A4 / IMPRESSÃO EM TABELAS POR MÊS (PRINT VIEW)
   ========================================================================== */

.print-report-container {
  background: #ffffff;
  color: #09090b;
  border: 1px solid #d4d4d8;
  border-radius: var(--radius-md);
  padding: 2.25rem 2.5rem;
  margin: 1.5rem auto;
  max-width: 940px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

.print-header {
  border-bottom: 2px solid #18181b;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.print-title {
  font-size: 1.45rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: #09090b;
  line-height: 1.15;
}

.print-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  background-color: #fafafa;
}

.print-meta-box h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #52525b;
  margin-bottom: 0.35rem;
  font-weight: 800;
}

.print-summary-box {
  background: #f4f4f5;
  border: 1.5px solid #18181b;
  padding: 1rem 0.85rem;
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
  align-items: stretch;
}

@media (max-width: 768px) {
  .print-summary-box {
    grid-template-columns: repeat(2, 1fr);
  }
}

.print-summary-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.print-summary-item .label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #52525b;
  font-weight: 700;
}

.print-summary-item .val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #09090b;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.print-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.825rem;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  overflow: hidden;
}

.print-table th {
  background: #18181b;
  color: #ffffff;
  padding: 0.65rem 0.6rem;
  text-align: left;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #27272a;
}

.print-table td {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid #e4e4e7;
  color: #09090b;
  vertical-align: top;
  box-sizing: border-box;
}

.print-table tr:last-child td {
  border-bottom: none;
}

.print-table tr:nth-child(even) td {
  background: #fafafa;
}

.print-table .align-right {
  text-align: right;
}

/* Colunas financeiras formatadas com espaçamento e separação clara */
.print-table th.col-valor,
.print-table td.col-valor {
  width: 20% !important;
  text-align: right;
  padding-right: 0.6rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-size: 0.75rem;
  box-sizing: border-box;
}

.print-table th.col-saldo,
.print-table td.col-saldo {
  width: 20% !important;
  text-align: right;
  padding-right: 0.6rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  border-left: 1px solid #e4e4e7;
  background-color: #fbfbfb;
  font-size: 0.75rem;
  box-sizing: border-box;
}

.print-table tr:nth-child(even) td.col-saldo {
  background-color: #f4f4f5;
}

.print-table th.col-saldo {
  background: #18181b;
  border-left: 1px solid #27272a;
}

/* Evitar quebras de página no meio de linhas */
.print-table tr {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.print-table thead {
  display: table-header-group !important;
}

.print-conclusion-box {
  border: 1.5px dashed #18181b;
  padding: 0.9rem 1.15rem;
  font-size: 0.825rem;
  line-height: 1.45;
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
  background: #fafafa;
  border-radius: 6px;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  box-sizing: border-box;
}

.print-sheet-ref-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.64rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #71717a;
  border-bottom: 1px solid #e4e4e7;
  padding-bottom: 0.45rem;
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.print-signatures {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  text-align: center;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.sign-box {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sign-space {
  height: 75px; /* Espaço amplo e dedicado para assinatura manual à caneta e aposição de carimbo */
}

.sign-line {
  border-top: 1.5px solid #18181b;
  padding-top: 0.5rem;
  font-size: 0.825rem;
  font-weight: 800;
  color: #09090b;
}

.sign-sub {
  font-size: 0.725rem;
  color: #52525b;
  font-weight: 500;
}

.print-footer-notice {
  font-size: 0.68rem;
  color: #71717a;
  text-align: center;
  border-top: 1px solid #e4e4e7;
  padding-top: 0.6rem;
  margin-top: 1.5rem;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  line-height: 1.4;
}

.print-footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.65rem;
  color: #52525b;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed #d4d4d8;
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   REGRAS ESTRITAS DE IMPRESSÃO (A4 MULTI-PAGE & EXECUTIVE FIT)
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 10mm;
  }

  html, body {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10.5pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .navbar, .nav-actions, .no-print, .toolbar, .btn, .modal-backdrop, .toast-container {
    display: none !important;
  }
  
  .main-content, .container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .print-report-container {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .print-summary-box {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    background: #f4f4f5 !important;
    border-color: #18181b !important;
  }

  .print-header,
  .print-meta-grid,
  .print-summary-box,
  .print-conclusion-box,
  .print-signatures,
  .sign-box,
  .print-audit-box,
  .print-footer-notice {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-table {
    width: 100% !important;
    table-layout: fixed !important;
    page-break-inside: auto !important;
  }

  .print-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-table thead {
    display: table-header-group !important;
  }

  .print-table tfoot {
    display: table-footer-group !important;
  }
}

/* ==========================================================================
   IMPRESSÃO INDIVIDUAL DE ORDEM DE SERVIÇO / COMPROVANTE TÉCNICO (A4)
   ========================================================================== */
.single-print-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background-color: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
}

@media print {
  body.printing-single {
    background: #ffffff !important;
  }

  body.printing-single .single-print-overlay {
    position: static !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
    width: 100% !important;
  }

  body.printing-single .single-print-overlay > .no-print {
    display: none !important;
  }

  body.printing-single main,
  body.printing-single nav,
  body.printing-single header,
  body.printing-single .print-report-container,
  body.printing-single .modal-backdrop {
    display: none !important;
  }

  body.printing-single .print-single-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
  }
}

/* ==========================================================================
   ENHANCED UI/UX: COMMAND PALETTE & SIMULATOR SLIDERS
   ========================================================================== */
.cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 9, 11, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  padding-left: 1rem;
  padding-right: 1rem;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.cmd-palette-box {
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 600px;
  overflow: hidden;
  animation: slideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .cmd-palette-box {
  background: #18181b;
  border-color: #27272a;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Interactive Range Sliders for Simulator */
input[type=range].slider-thumb-modern {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: #e4e4e7;
  outline: none;
  transition: background 0.2s;
}

input[type=range].slider-thumb-modern::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #09090b;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type=range].slider-thumb-modern::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #18181b;
}

[data-theme="dark"] input[type=range].slider-thumb-modern {
  background: #27272a;
}

[data-theme="dark"] input[type=range].slider-thumb-modern::-webkit-slider-thumb {
  background: #ffffff;
  border-color: #09090b;
}

/* Bottom Nav Bar for Mobile Screens */
.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #e4e4e7;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] .mobile-bottom-bar {
  background: rgba(9, 9, 11, 0.92);
  border-top-color: #27272a;
}

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

.animate-fade-in {
  animation: fadeInStep 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

