/* ==========================================================================
   JULIO KATONA PROJETOS & ILUMINAÇÃO
   Sistema de Gestão Comercial & Orçamentos (Mobile-First & Clean UI)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: rgba(15, 23, 42, 0.09);
  --border-focus: #2563eb;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --gold-primary: #d97706;
  --gold-light: #fbbf24;
  --blue-primary: #2563eb;
  --green-primary: #16a34a;
  --red-primary: #dc2626;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  
  --grad-spectrum: linear-gradient(90deg, #ef4444 0%, #f59e0b 25%, #10b981 50%, #3b82f6 75%, #8b5cf6 100%);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 5rem;
  font-size: 15px;
  line-height: 1.5;
}

/* --- Top App Header --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
}

.app-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  display: block;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.header-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(22, 163, 74, 0.1);
  color: var(--green-primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-primary);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* --- Main Navigation Tabs (3 Abas) --- */
.nav-tab-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 59px;
  z-index: 40;
}

.nav-tab-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  padding: 0 1rem;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tab-container::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-tab-btn:hover {
  color: var(--text-primary);
}

.nav-tab-btn.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
  font-weight: 700;
}

.tab-badge {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-tab-btn.active .tab-badge {
  background: rgba(217, 119, 6, 0.12);
  color: var(--gold-primary);
}

/* --- Main Layout Container --- */
.main-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* --- Presets Bar (Modelos Rápidos) --- */
.presets-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

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

.presets-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.presets-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.preset-chip:hover {
  background: #ffffff;
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  transform: translateY(-1px);
}

.preset-chip.active {
  background: var(--text-primary);
  color: #ffffff;
  border-color: var(--text-primary);
}

/* --- Cards & Form Sections --- */
.form-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.form-section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 2px;
  background: transparent;
  transition: background var(--transition);
}

.form-section-card:focus-within::before {
  background: var(--grad-spectrum);
}

.section-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* --- Grid & Inputs --- */
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-hint {
  font-size: 0.725rem;
  font-weight: 400;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.btn-input-action {
  min-height: 46px;
  padding: 0 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-input-action:hover {
  background: var(--bg-card);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

/* --- Catalog Selector & Items Table --- */
.catalog-search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.catalog-cat-pills {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  scrollbar-width: none;
}

.cat-pill {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.cat-pill.active {
  background: var(--gold-primary);
  color: #ffffff;
  border-color: var(--gold-primary);
}

.catalog-available-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-bottom: 1.5rem;
}

.catalog-item-card {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  transition: var(--transition);
}

.catalog-item-card:hover {
  border-color: var(--gold-primary);
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.cat-item-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.cat-item-spec {
  font-size: 0.775rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cat-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.cat-item-price {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--gold-primary);
}

.btn-add-item {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--text-primary);
  color: #ffffff;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.btn-add-item:hover {
  background: var(--gold-primary);
}

/* --- Selected Items Table (Mobile-First Cards) --- */
.selected-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.selected-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .selected-item-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
}

.item-info-col {
  flex-grow: 1;
}

.item-info-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.item-controls-col {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.qty-counter {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  overflow: hidden;
}

.btn-qty {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-qty:hover {
  background: rgba(15, 23, 42, 0.08);
}

.qty-input {
  width: 44px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.unit-price-input {
  width: 85px;
  height: 34px;
  padding: 0 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
}

.row-total-price {
  min-width: 85px;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-remove-row {
  background: transparent;
  border: none;
  color: var(--red-primary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
}

.btn-remove-row:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* --- Services & Operational Costs Toggles --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.service-card-toggle {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
}

.service-card-toggle.enabled {
  background: #ffffff;
  border-color: var(--gold-primary);
  box-shadow: var(--shadow-sm);
}

.service-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.service-toggle-title {
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.switch-control {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: var(--gold-primary);
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* --- Totals & Commercial Summary Card --- */
.summary-checkout-card {
  background: radial-gradient(circle at 100% 0%, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.summary-rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #94a3b8;
}

.summary-row.total {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  padding-top: 0.5rem;
}

.summary-row.total span.highlight-gold {
  color: var(--gold-light);
}

.summary-extenso {
  font-size: 0.8rem;
  color: #cbd5e1;
  font-style: italic;
  margin-top: 0.25rem;
}

/* --- Action Buttons Bar --- */
.actions-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-action-primary {
  flex: 1 1 200px;
  min-height: 52px;
  padding: 0 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gold-primary);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.btn-action-primary:hover {
  background: #b45309;
  transform: translateY(-2px);
}

.btn-action-secondary {
  flex: 1 1 160px;
  min-height: 52px;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition);
}

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

.btn-action-whatsapp {
  flex: 1 1 180px;
  min-height: 52px;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  background: #25d366;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-action-whatsapp:hover {
  background: #1eb954;
  transform: translateY(-2px);
}

/* --- Tab 2: Histórico de Orçamentos (CRM Cards) --- */
.quotes-filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  scrollbar-width: none;
}

.quote-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.quote-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition);
}

.quote-history-card:hover {
  border-color: var(--gold-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.quote-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.quote-id-badge {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--gold-primary);
  background: rgba(217, 119, 6, 0.1);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.status-dropdown-select {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
}

.status-rascunho { background: #f1f5f9; color: #475569; }
.status-enviada { background: #dbeafe; color: #1d4ed8; }
.status-aprovada { background: #dcfce7; color: #15803d; }
.status-faturada { background: #fef3c7; color: #b45309; }
.status-cancelada { background: #fee2e2; color: #b91c1c; }

.quote-client-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.quote-project-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.quote-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.quote-card-actions {
  display: flex;
  gap: 0.4rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.btn-card-action {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.btn-card-action:hover {
  background: var(--bg-card);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

/* --- Tab 3: Gestão de Catálogo (CRUD) --- */
.catalog-manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.catalog-manage-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.catalog-manage-table th {
  background: var(--bg-subtle);
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.catalog-manage-table td {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
}

/* --- Modal & Preview Sheet (Folha Timbrada Oficial) --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

/* Modal de Diálogo (Formulários / Edição) */
.modal-dialog-card {
  background: #ffffff;
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.btn-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-modal-close:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.08);
}

.modal-dialog-body {
  padding: 1.5rem;
}

.modal-dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-dialog-primary {
  background: var(--gold-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-dialog-primary:hover {
  background: var(--gold-hover);
  transform: translateY(-1px);
}

.btn-dialog-secondary {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.btn-dialog-secondary:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-dialog-danger {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid #fca5a5;
  cursor: pointer;
  transition: var(--transition);
}

.btn-dialog-danger:hover {
  background: #fecaca;
}

.modal-sheet-container {
  background: #ffffff;
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

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

.modal-sheet-body {
  padding: 2.5rem 2.5rem 3.5rem;
  overflow-y: auto;
  flex-grow: 1;
  background: #ffffff;
}

@media (max-width: 640px) {
  .modal-sheet-body {
    padding: 1.5rem 1.25rem 2.5rem;
  }
}

/* --- Official Proposal Layout (Executive & Poetic Design) --- */
.proposal-paper {
  background: #ffffff;
  color: #0f172a;
  font-size: 13.5px;
  line-height: 1.65;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.letterhead-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0 1.5rem;
  border-bottom: 2px solid #0f172a;
  margin-bottom: 1.5rem;
  gap: 1.5rem;
  position: relative;
}

.letterhead-top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-spectrum);
}

.letterhead-logo {
  height: 48px;
  width: auto;
  display: block;
}

.letterhead-company-info {
  text-align: right;
  font-size: 11px;
  color: #475569;
  line-height: 1.45;
}

.letterhead-company-info strong {
  font-size: 13px;
  color: #0f172a;
  display: block;
  margin-bottom: 0.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.proposal-meta-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--gold-primary);
  border-radius: 8px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
  font-size: 13px;
  line-height: 1.6;
}

.proposal-section-block {
  margin-bottom: 1.5rem;
  page-break-inside: avoid;
  break-inside: avoid;
}

.proposal-section-title {
  font-size: 13.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: #0f172a;
  margin: 1.5rem 0 0.65rem;
  border-bottom: 1.5px solid #e2e8f0;
  padding-bottom: 0.4rem;
  line-height: 1.4;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.proposal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.85rem 0 1.25rem;
  font-size: 12.5px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.proposal-table thead {
  display: table-header-group;
}

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

.proposal-table th {
  background: #0f172a;
  color: #ffffff;
  padding: 9px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
}

.proposal-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.proposal-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.proposal-table td {
  border-top: 1px solid #e2e8f0;
  padding: 9px 12px;
  vertical-align: middle;
}

.proposal-table td.cell-item {
  vertical-align: top;
}

.proposal-total-highlight {
  background: radial-gradient(circle at 100% 0%, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border: 1.5px solid #334155;
  border-left: 4px solid var(--gold-light);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  margin: 1.75rem 0;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.proposal-total-highlight .total-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-light);
  margin-bottom: 0.25rem;
}

.proposal-total-highlight .total-value {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.proposal-total-highlight .total-extenso {
  font-size: 12px;
  color: #cbd5e1;
  font-style: italic;
  margin-top: 0.3rem;
}

.proposal-signature-block {
  margin-top: 2.75rem;
  text-align: center;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

.signature-svg-wrap {
  width: 220px;
  height: 85px;
  margin: 0 auto 0.35rem;
  color: #0f172a;
}

.signature-line {
  border-top: 1.5px solid #0f172a;
  padding-top: 0.5rem;
  font-weight: 800;
  font-size: 12px;
  color: #0f172a;
}

/* --- Standalone Proposal View Styling --- */
.standalone-page-wrap {
  padding: 1.5rem 1rem;
}

.standalone-sheet-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
  .standalone-sheet-card {
    padding: 1.5rem 1.25rem;
  }
}

/* ==========================================================================
   PRINT STYLES FOR CLEAN A4 PDF EXPORT (PREMIUM COHESIVE LAYOUT)
   ========================================================================== */
@media print {
  *, *:before, *:after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html, body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 11pt !important;
    min-height: 0 !important;
    height: auto !important;
    width: 100% !important;
  }
  
  .app-header,
  .nav-tab-bar,
  .presets-card,
  .form-section-card,
  .summary-checkout-card,
  .actions-bottom-bar,
  .quotes-filter-bar,
  .quote-history-grid,
  .catalog-manage-header,
  .catalog-manage-table,
  .modal-sheet-header,
  .no-print {
    display: none !important;
  }
  
  .modal-overlay,
  .standalone-page-wrap {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .modal-sheet-container,
  .standalone-sheet-card {
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .modal-sheet-body {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
    width: 100% !important;
  }
  
  .proposal-paper {
    font-size: 11pt !important;
    line-height: 1.6 !important;
    color: #0f172a !important;
    width: 100% !important;
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .proposal-meta-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 4px solid #d97706 !important;
    border-radius: 6px !important;
  }

  .proposal-section-title {
    page-break-after: avoid !important;
    break-after: avoid !important;
    font-size: 11.5pt !important;
    margin-top: 1.5rem !important;
  }

  .proposal-table {
    page-break-inside: auto !important;
    break-inside: auto !important;
    font-size: 10pt !important;
    width: 100% !important;
  }

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

  .proposal-table th {
    background: #0f172a !important;
    color: #ffffff !important;
    border: none !important;
  }

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

  .proposal-total-highlight {
    background: #0f172a !important;
    color: #ffffff !important;
    border-left: 4px solid #fbbf24 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .proposal-signature-block,
  .proposal-section-block,
  li {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  @page {
    size: A4 portrait;
    margin: 1.6cm 1.4cm 1.6cm 1.4cm;
  }
}
