:root {
  --primary-dark: #0b2240; /* StoryForge Brand Navy */
  --primary-slate: #1e293b;
  --slate-muted: #64748b;
  --slate-light: #f8fafc;
  --slate-border: #cbd5e1;
  --slate-border-light: #e2e8f0;
  --accent-orange: #ff6500; /* StoryForge Flame Orange */
  --accent-orange-dark: #e05500;
  --phase-header-bg: #f8fafc;
  --phase-header-border: #cbd5e1;
  --editable-bg: #ffffff; /* Clean white */
  --editable-border: #cbd5e1;
  --editable-focus: #ff6500;
  --card-bg: #ffffff;
  --bg-page: #f1f5f9;
  --text-main: #0b2240;
  --text-muted: #475569;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(11, 34, 64, 0.08);
  --shadow-lg: 0 12px 32px rgba(11, 34, 64, 0.12);
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 5rem;
}

/* ================= TOP TOOLBAR ================= */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 34, 64, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.top-bar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.brand-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff;
}

.brand-tagline {
  font-size: 0.7rem;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.03em;
}

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

.mode-toggle-group {
  display: flex;
  background: rgba(30, 41, 59, 0.8);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.mode-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mode-btn.active {
  background: var(--accent-orange);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(255, 101, 0, 0.4);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-orange);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-orange-dark);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
}

.modal-dialog .btn-secondary,
.fm-card-actions .btn-secondary,
.fm-toolbar .btn-secondary {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

.modal-dialog .btn-secondary:hover,
.fm-card-actions .btn-secondary:hover,
.fm-toolbar .btn-secondary:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-save {
  background: #047857;
  color: #ffffff;
  border: 1px solid #059669;
}

.btn-save:hover {
  background: #059669;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* Save Status Indicator Pill */
.save-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #94a3b8;
  user-select: none;
  transition: all 0.2s ease;
}

.save-status-pill .save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.save-status-pill.status-saving {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

.save-status-pill.status-saving .save-dot {
  background: #60a5fa;
  animation: pulse-dot 0.8s infinite alternate;
}

.save-status-pill.status-saved {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.save-status-pill.status-saved .save-dot {
  background: #10b981;
}

@keyframes pulse-dot {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.2); }
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
}

.live-total-pill {
  background: #00172e;
  border: 1px solid rgba(255, 101, 0, 0.5);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.live-total-pill .label {
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.live-total-pill .val {
  color: var(--accent-orange);
  font-family: var(--font-mono);
  font-weight: 800;
}

/* ================= MAIN CONTAINER ================= */
.document-wrapper {
  max-width: 1040px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.document-sheet {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  position: relative;
}

.sheet-content {
  padding: 2rem 2.5rem;
}

@media (max-width: 768px) {
  .sheet-content {
    padding: 1.25rem;
  }
}

/* ================= HEADER SECTION (EXACT SPREADSHEET LOOK) ================= */
.estimate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  flex-wrap: wrap;
}

.company-branding {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  min-width: 0;
}

.brand-flame-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.brand-main-title {
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--primary-dark);
  text-transform: uppercase;
  line-height: 1.1;
}

.brand-tagline-text {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-orange);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.25rem;
  width: 100%;
  box-sizing: border-box;
}

.producer-details {
  font-size: 0.84rem;
  color: #475569;
  margin-top: 0.35rem;
  font-weight: 600;
  width: 100%;
}

.producer-details input {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.84rem;
  font-weight: 600;
  color: #475569;
}

/* Right Badge Box */
.estimate-badge-box {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.estimate-badge-box .doc-type {
  background: var(--primary-dark);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1.75rem;
  text-align: center;
  line-height: 1.15;
}

/* Full Width Solid Orange Divider */
.doc-orange-divider {
  width: 100%;
  height: 6px;
  background: var(--accent-orange);
  margin-bottom: 1.5rem;
}

/* ================= META GRID ================= */
.meta-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.65fr 1fr 1fr;
  gap: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  margin-bottom: 1.75rem;
}

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

.meta-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.85rem;
  border-right: 1px solid #cbd5e1;
  text-align: center;
  min-width: 0;
}

.meta-item input,
.meta-item textarea {
  width: 100%;
  box-sizing: border-box;
}

.meta-item:last-child {
  border-right: none;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0b2240;
  margin-bottom: 0.35rem;
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
}

.meta-mono {
  font-family: var(--font-mono);
  color: var(--accent-orange-dark);
  font-weight: 800;
}

/* ================= SECTION HEADINGS (NAVY BARS) ================= */
.section-block {
  margin-top: 1.75rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  background: var(--primary-dark);
  color: #ffffff;
  border-radius: 0;
  margin-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-number {
  color: var(--accent-orange);
  font-weight: 900;
}

.section-actions {
  display: flex;
  gap: 0.4rem;
}

/* ================= SECTION 01: OVERVIEW ================= */
.overview-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0;
  padding: 1.25rem;
  line-height: 1.65;
  color: var(--text-main);
  font-size: 0.95rem;
}

/* ================= TABLES ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 0;
  border: 1px solid #cbd5e1;
}

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

.data-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #cbd5e1;
}

/* ================= SECTION 02: DELIVERABLES (FULL-WIDTH CARDS) ================= */
.deliverables-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.deliverable-card {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease;
}

.deliverable-card-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-left: 4px solid var(--accent-orange);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.deliverable-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.deliverable-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-orange-dark);
  background: rgba(255, 101, 0, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.deliverable-card-header .item-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #0b2240;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
}

.mode-editor .deliverable-card-header .item-name {
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
}

.mode-editor .deliverable-card-header .item-name:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.mode-editor .deliverable-card-header .item-name:focus {
  border-color: var(--accent-orange);
  background: #ffffff;
}

.deliverable-card-body {
  padding: 0.85rem 1.15rem;
  width: 100%;
  box-sizing: border-box;
}

.deliverable-card-body .item-scope {
  width: 100% !important;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #334155;
  border: none;
  background: transparent;
  resize: vertical;
  display: block;
}

.mode-editor .deliverable-card-body .item-scope {
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  background: #fafbfc;
}

.mode-editor .deliverable-card-body .item-scope:focus {
  border-color: var(--accent-orange);
  background: #ffffff;
}

.mode-client .deliverable-card-body .item-scope {
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
}

/* Deliverables table specific orange header matching screenshot */
.deliverables-table th {
  background: var(--accent-orange) !important;
  color: #ffffff !important;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

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

.data-table tbody tr:hover {
  background-color: #f1f5f9;
}

.col-actions {
  width: 50px;
  text-align: center;
}

.col-amount {
  width: 160px;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
}

th.text-right, td.text-right {
  text-align: right;
}

/* Table Subtotal Rows */
.subtotal-row {
  background: #f8fafc;
  font-weight: 800;
}

.subtotal-row td {
  border-top: 2px solid #0b2240;
  padding: 0.85rem 1rem;
  color: var(--primary-dark);
}

.subtotal-amount {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--accent-orange-dark);
  font-weight: 800;
  white-space: nowrap;
}

/* Range Pricing Controls */
.range-cell-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  width: 100%;
}

.flat-cost-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  width: 100%;
}

.range-cost-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  width: 100%;
  background: #f8fafc;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.range-inputs-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  justify-content: flex-end;
}

.range-input-group {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.range-input-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.range-input-group input.editable-cell {
  width: 84px;
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #0b2240;
  padding: 0.25rem 0.35rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  text-align: right;
}

.range-separator {
  font-weight: 700;
  color: #94a3b8;
  font-size: 0.9rem;
}

.btn-range-toggle {
  background: #ffffff;
  border: 1px dashed #94a3b8;
  color: #64748b;
  padding: 0.15rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-range-toggle:hover {
  background: #f1f5f9;
  border-color: #0b2240;
  color: #0b2240;
}

.btn-range-toggle.is-active {
  background: #fee2e2;
  border: 1px solid #f87171;
  color: #991b1b;
}

.btn-range-toggle.is-active:hover {
  background: #fecaca;
  color: #7f1d1d;
}

.range-client-display {
  display: none;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  color: #0b2240;
  text-align: right;
  white-space: nowrap;
}

.mode-client .range-client-display {
  display: block;
}

@media print, body.is-exporting-pdf {
  .range-client-display {
    display: none !important;
  }
}


/* ================= SECTION 03: PROCESS & PHASES ================= */
.phases-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.phase-card {
  border: 1px solid #cbd5e1;
  border-radius: 0;
  background: #ffffff;
  overflow: hidden;
}

/* Clean modern slate banner for phases */
.phase-title-bar {
  background: var(--phase-header-bg);
  border-bottom: 1px solid var(--phase-header-border);
  padding: 0.65rem 1rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: #0b2240;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.phase-items-table {
  width: 100%;
  border-collapse: collapse;
}

.phase-items-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f8fafc;
  font-size: 0.86rem;
}

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

.phase-item-name {
  font-weight: 700;
  color: var(--primary-dark);
  width: 25%;
  min-width: 160px;
  vertical-align: top;
}

.phase-item-details {
  color: #475569;
  line-height: 1.5;
}

/* ================= SECTION 04: TRAVEL BILLING ARRANGEMENT TOGGLE ================= */
.travel-section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.travel-billing-toggle-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.travel-toggle-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.travel-toggle-group {
  display: inline-flex;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
}

.travel-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.travel-toggle-btn .toggle-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.2s ease;
}

.travel-toggle-btn:hover {
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.6);
}

.travel-toggle-btn.active {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: 0 1px 4px rgba(11, 34, 64, 0.1);
}

.travel-toggle-btn.active#toggle-travel-reimbursable .toggle-indicator {
  background: var(--accent-orange);
}

.travel-toggle-btn.active#toggle-travel-client .toggle-indicator {
  background: #0284c7;
}

/* Travel Arrangement Status Pill (for Client View & Verification) */
.travel-status-pill-client {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  font-size: 0.84rem;
  line-height: 1.45;
  margin-bottom: 0.85rem;
  border: 1px solid transparent;
}

.travel-status-pill-client.mode-client-travel {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.travel-status-pill-client.mode-reimbursable-travel {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.mode-client .travel-billing-toggle-container {
  display: flex !important;
  pointer-events: none;
}

.status-badge-selected {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 4px;
}

.status-badge-unselected {
  color: #94a3b8;
  font-size: 0.68rem;
  font-style: italic;
  font-weight: 500;
  margin-left: 4px;
}

/* ================= SECTION 04: FINANCIAL SUMMARY ================= */
.financial-summary-card {
  margin-top: 1.75rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

.financial-summary-card h4 {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f97316;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 0.5rem;
}

.summary-line-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.summary-line-item .amt {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #ffffff;
}

.summary-grand-total {
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 2px solid #f97316;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.summary-grand-total .amt {
  color: #f97316;
  font-size: 1.5rem;
  font-family: var(--font-mono);
  font-weight: 900;
}

/* ================= SECTION 05: TERMS & PAYMENT ================= */
.terms-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.payment-milestones-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 600px) {
  .payment-milestones-box {
    grid-template-columns: 1fr;
  }
}

.milestone-card {
  background: #ffffff;
  border: 1px solid var(--slate-border-light);
  border-left: 4px solid var(--accent-orange);
  padding: 1.1rem 1.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.milestone-title {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.milestone-note {
  font-size: 0.78rem;
  color: var(--slate-muted);
  margin-top: 0.2rem;
}

.milestone-amount {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--accent-orange);
}

.terms-clauses-list {
  padding-left: 1.25rem;
  color: #334155;
  font-size: 0.85rem;
  line-height: 1.6;
}

.terms-clauses-list li {
  margin-bottom: 0.5rem;
}

/* ================= SECTION 06: APPROVAL & SIGNATURES ================= */
.approval-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

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

.signature-card {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
}

.signature-card.is-signed {
  border-color: #22c55e;
  background: #f0fdf4;
}

.signature-card-header {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-badge {
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-badge.signed {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.status-badge.pending {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.sig-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sig-field-group label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
}

.signature-pad-container {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  background: #fafbfc;
  height: 90px;
  position: relative;
  overflow: hidden;
}

.signature-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.typed-signature-preview {
  display: none;
  font-family: "Brush Script MT", "Caveat", "Dancing Script", cursive;
  font-size: 1.85rem;
  color: #0f172a;
  text-align: center;
  line-height: 90px;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: #fafbfc;
}

.signature-options-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.signature-card .btn,
.signature-options-bar .btn {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.signature-card .btn:hover,
.signature-options-bar .btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

.signature-card .btn-sig-reset,
.signature-options-bar .btn-sig-reset {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
  font-weight: 600;
}

.signature-card .btn-sig-reset:hover,
.signature-options-bar .btn-sig-reset:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #9f1239;
}

.signature-card .btn-sig-sign,
.signature-options-bar .btn-sig-sign {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
  font-weight: 700;
}

.signature-card .btn-sig-sign:hover,
.signature-options-bar .btn-sig-sign:hover {
  background: #dcfce7;
  border-color: #4ade80;
  color: #166534;
}

/* Client Preset Bar (Editor Only) */
.client-preset-bar {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.client-preset-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.05em;
}

.client-preset-select {
  flex: 1;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  padding: 0.38rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
}

.client-preset-select:focus {
  outline: none;
  border-color: var(--accent-orange);
}

/* ESIGN Affirmative Consent Checkbox */
.esign-consent-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  margin-top: 0.25rem;
}

.esign-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #334155;
  cursor: pointer;
  text-transform: none !important;
  font-weight: 400 !important;
}

.esign-consent-label input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent-orange);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Client Accept & Sign Button */
.client-submit-bar {
  margin-top: 0.5rem;
}

.btn-accept-sign {
  width: 100%;
  background: #15803d;
  color: #ffffff;
  border: 1px solid #166534;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-accept-sign:hover {
  background: #166534;
  box-shadow: 0 3px 8px rgba(22, 101, 52, 0.3);
}

.btn-accept-sign:disabled {
  background: #94a3b8;
  border-color: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

/* Digital Audit Certificate Box */
.digital-audit-certificate {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.7rem;
  color: #166534;
  margin-top: 0.5rem;
}

.cert-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: #15803d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.cert-body {
  font-size: 0.68rem;
  line-height: 1.5;
  color: #334155;
  border-top: 1px dashed #bbf7d0;
  padding-top: 0.35rem;
}

.cert-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.15rem;
}

.cert-label {
  font-weight: 600;
  color: #475569;
}

.cert-val {
  font-family: var(--font-mono, monospace);
  color: #0f172a;
}

/* ================= EDITABLE CONTROLS & CELLS ================= */
.mode-editor .editable-cell {
  background-color: var(--editable-bg);
  border: 1px solid var(--editable-border);
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mode-editor .editable-cell:focus {
  outline: none;
  border-color: var(--editable-focus);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 101, 0, 0.15);
}

/* Auto-expanding textareas for full text visibility without scrolling */
textarea.auto-expand {
  overflow-y: hidden !important;
  resize: none;
  min-height: 2.2rem;
  line-height: 1.55;
  box-sizing: border-box;
  font-family: inherit;
  font-size: inherit;
}

.mode-editor textarea.editable-cell {
  resize: vertical;
  line-height: 1.55;
}

/* In Client Mode, fields render as clean, readable static document text */
.mode-client .editable-cell {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  color: var(--text-main) !important;
  font-family: inherit;
  font-size: inherit;
  pointer-events: none;
  line-height: 1.55;
}

.mode-client textarea.editable-cell,
.mode-client textarea.auto-expand {
  resize: none !important;
  overflow: hidden !important;
  height: auto;
}

.mode-client input.editable-cell {
  line-height: normal;
}

.mode-client .editor-only {
  display: none !important;
}

.mode-editor .client-only {
  display: none !important;
}

/* Action button for adding rows */
.btn-add-row {
  margin-top: 0.5rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #475569;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-add-row:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-del-row {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-del-row:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* ================= MODALS & OVERLAYS ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  background: #0f172a;
  color: #ffffff;
  padding: 1.15rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

/* ================= FILE BROWSER & TEMPLATES MANAGER ================= */
.modal-dialog.fm-dialog {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.fm-header {
  background: #0b2240;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid #ff6500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fm-header-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fm-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1.5rem 0 1.5rem;
  background: #f8fafc;
}

.fm-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s;
}

.fm-tab-btn:hover {
  color: #0b2240;
}

.fm-tab-btn.active {
  color: #ff6500;
  border-bottom-color: #ff6500;
  background: #ffffff;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.fm-tab-count {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
}

.fm-tab-btn.active .fm-tab-count {
  background: #ffedd5;
  color: #c2410c;
}

.fm-toolbar {
  padding: 0.85rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fm-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.fm-search-input {
  width: 100%;
  padding: 0.45rem 0.65rem 0.45rem 2rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.84rem;
  background: #f8fafc;
  transition: all 0.2s;
}

.fm-search-input:focus {
  background: #ffffff;
  border-color: #ff6500;
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 101, 0, 0.15);
}

.fm-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.fm-select {
  padding: 0.42rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  background: #ffffff;
  color: #334155;
  font-weight: 600;
}

.fm-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  max-height: calc(88vh - 220px);
  background: #f8fafc;
}

.fm-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.95rem 1.15rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.fm-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.fm-card.is-current {
  border-left: 4px solid #ff6500;
  background: #fffcf9;
}

.fm-card-main {
  flex: 1;
  min-width: 250px;
}

.fm-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.fm-badge-id {
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #0b2240;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 2px 7px;
  border-radius: 4px;
}

.fm-badge-client {
  font-weight: 700;
  font-size: 0.94rem;
  color: #0b2240;
}

.fm-badge-amount {
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 2px 7px;
  border-radius: 4px;
}

.fm-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.fm-tmpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}

.fm-tmpl-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.fm-tmpl-card:hover {
  border-color: #ff6500;
  box-shadow: 0 4px 14px rgba(255,101,0,0.12);
  transform: translateY(-2px);
}

.fm-tmpl-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.fm-tmpl-badge.builtin {
  background: #e0f2fe;
  color: #0369a1;
}

.fm-tmpl-badge.custom {
  background: #fef3c7;
  color: #b45309;
}

.btn-danger-subtle {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-danger-subtle:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #9f1239;
}

.btn-tmpl-gold {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.btn-tmpl-gold:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

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

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid #f97316;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.3s ease;
}

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

/* ================= FOOTER NOTE ================= */
.estimate-footer-note {
  margin-top: 2rem;
  padding: 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
}

/* ================= PRINT & PDF TEXT MIRRORING ================= */
.print-text {
  display: none !important;
}

/* ================= PRINT STYLES ================= */
@media print {
  @page {
    size: letter portrait;
    margin: 0.42in 0.48in;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 8.5pt !important;
    color: #0b2240 !important;
    width: 100% !important;
  }

  .top-bar,
  .btn,
  .btn-add-row,
  .btn-del-row,
  .editor-only,
  .toast-container,
  .modal-overlay,
  .rate-helper-bar {
    display: none !important;
  }

  .travel-billing-toggle-container {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .travel-toggle-group {
    display: inline-flex !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    padding: 3px !important;
    border-radius: 6px !important;
    gap: 4px !important;
  }

  .travel-toggle-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    padding: 0.22rem 0.55rem !important;
    font-size: 0.72rem !important;
    border-radius: 4px !important;
    background: transparent !important;
  }

  .travel-toggle-btn.active.selected {
    background: #ffffff !important;
    border: 1.5px solid #0b2240 !important;
    color: #0b2240 !important;
    font-weight: 800 !important;
  }

  .travel-toggle-btn.unselected {
    background: transparent !important;
    border: 1px dashed #cbd5e1 !important;
    color: #64748b !important;
    opacity: 0.85 !important;
  }

  .document-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .document-sheet {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .sheet-content {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  /* Form widget hiding & print text replacement */
  .editable-cell,
  input.editable-cell,
  textarea.editable-cell,
  select.editable-cell {
    display: none !important;
  }

  .print-text {
    display: block !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
  }

  span.print-text {
    display: inline-block !important;
  }

  span.print-text.text-right {
    display: block !important;
    text-align: right !important;
    font-family: var(--font-mono) !important;
    font-weight: 800 !important;
  }

  .print-text.meta-value {
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    color: #0b2240 !important;
  }

  .print-text.meta-mono {
    font-family: var(--font-mono) !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
  }

  .print-text.brand-tagline-text {
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    color: #ff6500 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
  }

  /* Header Section */
  .estimate-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    padding-bottom: 0.85rem !important;
    gap: 1.25rem !important;
  }

  .company-branding {
    display: flex !important;
    align-items: center !important;
    gap: 1.25rem !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .brand-flame-logo {
    width: 54px !important;
    height: 54px !important;
    flex-shrink: 0 !important;
  }

  .brand-text-block {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .brand-main-title {
    font-size: 1.95rem !important;
    line-height: 1.1 !important;
    color: #0b2240 !important;
  }

  .producer-details {
    font-size: 0.78rem !important;
    color: #475569 !important;
    margin-top: 0.25rem !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
  }

  .estimate-badge-box .doc-type {
    font-size: 1.25rem !important;
    padding: 0.7rem 1.35rem !important;
    background: #0b2240 !important;
    color: #ffffff !important;
  }

  .doc-orange-divider {
    height: 4px !important;
    background: #ff6500 !important;
    margin-bottom: 1.1rem !important;
  }

  /* Meta Grid - Keep 4 Columns */
  .meta-grid {
    display: grid !important;
    grid-template-columns: 1.25fr 1.65fr 1fr 1fr !important;
    gap: 0 !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    margin-bottom: 1.25rem !important;
  }

  .meta-item {
    display: flex !important;
    flex-direction: column !important;
    padding: 0.55rem 0.65rem !important;
    border-right: 1px solid #cbd5e1 !important;
    text-align: center !important;
    min-width: 0 !important;
  }

  .meta-item:last-child {
    border-right: none !important;
  }

  .meta-label {
    font-size: 0.68rem !important;
    color: #64748b !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    margin-bottom: 0.2rem !important;
  }

  /* Sections Flow & Page Breaks */
  .section-block {
    margin-top: 0.95rem !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  #section-budget {
    margin-top: 1rem !important;
  }

  #section-terms {
    page-break-before: auto !important;
    break-before: auto !important;
  }

  .section-header {
    background: #0b2240 !important;
    padding: 0.35rem 0.65rem !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border-radius: 0 !important;
  }

  .section-header * {
    color: #ffffff !important;
  }

  .section-title {
    font-size: 0.84rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.06em !important;
  }

  .section-number {
    color: #ff6500 !important;
    margin-right: 0.35rem !important;
  }

  /* Overview Box */
  .overview-box {
    border: 1px solid #cbd5e1 !important;
    padding: 0.85rem 1rem !important;
    font-size: 0.88rem !important;
    line-height: 1.55 !important;
    background: #ffffff !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  /* Deliverables Full-Width Cards */
  .deliverables-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .deliverable-card {
    border: 1px solid #cbd5e1 !important;
    border-radius: 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    box-shadow: none !important;
    margin-bottom: 0.5rem !important;
    background: #ffffff !important;
  }

  .deliverable-card-header {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #cbd5e1 !important;
    border-left: 4px solid #ff6500 !important;
    padding: 0.35rem 0.65rem !important;
    display: flex !important;
    align-items: center !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .deliverable-badge {
    font-size: 0.68rem !important;
    background: #fed7aa !important;
    color: #c2410c !important;
    padding: 0.15rem 0.35rem !important;
    margin-right: 0.45rem !important;
    font-weight: 800 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .deliverable-card-header .print-text {
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    color: #0b2240 !important;
  }

  .deliverable-card-body {
    padding: 0.45rem 0.75rem !important;
    width: 100% !important;
  }

  .deliverable-card-body .print-text {
    width: 100% !important;
    font-size: 0.82rem !important;
    line-height: 1.5 !important;
    color: #334155 !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
  }

  /* Tables */
  .table-responsive {
    overflow: visible !important;
    border: 1px solid #cbd5e1 !important;
    width: 100% !important;
  }

  .data-table {
    width: 100% !important;
    font-size: 0.82rem !important;
    border-collapse: collapse !important;
  }

  .data-table th {
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    border: none !important;
  }

  .data-table td {
    padding: 0.45rem 0.6rem !important;
    border-bottom: 1px solid #e2e8f0 !important;
    vertical-align: top !important;
    color: #0b2240 !important;
  }

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

  thead {
    display: table-header-group !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .subtotal-row {
    background: #f1f5f9 !important;
    font-weight: 800 !important;
  }

  .subtotal-row td {
    padding: 0.5rem 0.6rem !important;
    font-size: 0.84rem !important;
  }

  .subtotal-amount {
    font-family: var(--font-mono) !important;
    font-size: 0.95rem !important;
    color: #0b2240 !important;
  }

  /* Travel Status Banner */
  .travel-status-pill-client {
    border: 1px solid #cbd5e1 !important;
    padding: 0.55rem 0.85rem !important;
    font-size: 0.82rem !important;
    margin-bottom: 0.75rem !important;
    border-radius: var(--radius-sm) !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .travel-status-pill-client.mode-client-travel {
    background: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #1e3a8a !important;
  }

  /* Financial Summary Card */
  .financial-summary-card {
    background: linear-gradient(135deg, #0b2240 0%, #1e293b 100%) !important;
    color: #ffffff !important;
    border-radius: var(--radius-sm) !important;
    padding: 1rem 1.25rem !important;
    margin-top: 1.1rem !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .financial-summary-card h4 {
    font-size: 0.82rem !important;
    color: #ff6500 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding-bottom: 0.35rem !important;
    margin-bottom: 0.6rem !important;
  }

  .financial-summary-card .summary-line-item {
    color: #e2e8f0 !important;
    padding: 0.25rem 0 !important;
    font-size: 0.84rem !important;
  }

  .financial-summary-card .summary-line-item .amt {
    color: #ffffff !important;
    font-family: var(--font-mono) !important;
    font-weight: 700 !important;
  }

  .financial-summary-card .summary-grand-total {
    border-top: 2px solid #ff6500 !important;
    color: #ffffff !important;
    padding-top: 0.6rem !important;
    margin-top: 0.5rem !important;
    font-size: 1.05rem !important;
  }

  .financial-summary-card .summary-grand-total .amt {
    color: #ff6500 !important;
    font-size: 1.25rem !important;
    font-family: var(--font-mono) !important;
    font-weight: 900 !important;
  }

  /* Payment Milestones */
  .payment-milestones-box {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .milestone-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 4px solid #ff6500 !important;
    padding: 0.75rem 1rem !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .milestone-title {
    font-size: 0.82rem !important;
    color: #0b2240 !important;
  }

  .milestone-amount {
    font-size: 1.25rem !important;
    color: #ff6500 !important;
  }

  .milestone-note {
    font-size: 0.72rem !important;
    color: #64748b !important;
  }

  .terms-clauses-list {
    font-size: 0.78rem !important;
    line-height: 1.5 !important;
    color: #334155 !important;
  }

  .terms-clauses-list li {
    margin-bottom: 0.4rem !important;
  }

  /* Acceptance & Signatures */
  .approval-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .signature-card {
    border: 1px solid #cbd5e1 !important;
    padding: 0.9rem !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .sig-line {
    margin-top: 1.1rem !important;
    border-bottom: 1px solid #94a3b8 !important;
    min-height: 22px !important;
  }

  .sig-label {
    font-size: 0.68rem !important;
    color: #64748b !important;
  }

  .estimate-footer-note {
    margin-top: 1rem !important;
    padding: 0.5rem !important;
    font-size: 0.72rem !important;
    color: #64748b !important;
    border-top: 1px solid #e2e8f0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  a {
    text-decoration: none !important;
    color: inherit !important;
  }
}

/* ================= HTML2PDF DIRECT EXPORT MODE ================= */
body.is-exporting-pdf {
  background: #ffffff !important;
}

body.is-exporting-pdf .top-bar,
body.is-exporting-pdf .btn,
body.is-exporting-pdf .btn-add-row,
body.is-exporting-pdf .btn-del-row,
body.is-exporting-pdf .editor-only,
body.is-exporting-pdf .toast-container,
body.is-exporting-pdf .modal-overlay,
body.is-exporting-pdf .rate-helper-bar {
  display: none !important;
}

body.is-exporting-pdf .travel-billing-toggle-container {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

body.is-exporting-pdf .travel-toggle-group {
  display: inline-flex !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  padding: 3px !important;
  border-radius: 6px !important;
  gap: 4px !important;
}

body.is-exporting-pdf .travel-toggle-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  padding: 0.22rem 0.55rem !important;
  font-size: 0.72rem !important;
  border-radius: 4px !important;
  background: transparent !important;
}

body.is-exporting-pdf .travel-toggle-btn.active.selected {
  background: #ffffff !important;
  border: 1.5px solid #0b2240 !important;
  color: #0b2240 !important;
  font-weight: 800 !important;
}

body.is-exporting-pdf .travel-toggle-btn.unselected {
  background: transparent !important;
  border: 1px dashed #cbd5e1 !important;
  color: #64748b !important;
  opacity: 0.85 !important;
}

body.is-exporting-pdf .document-wrapper {
  max-width: 790px !important;
  width: 790px !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

body.is-exporting-pdf .document-sheet {
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  width: 790px !important;
  max-width: 790px !important;
  margin: 0 !important;
  padding: 0.5in !important;
  background: #ffffff !important;
}

body.is-exporting-pdf .sheet-content {
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

body.is-exporting-pdf .editable-cell,
body.is-exporting-pdf input.editable-cell,
body.is-exporting-pdf textarea.editable-cell,
body.is-exporting-pdf select.editable-cell {
  display: none !important;
}

body.is-exporting-pdf .print-text {
  display: block !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

body.is-exporting-pdf span.print-text {
  display: inline-block !important;
}

body.is-exporting-pdf span.print-text.text-right {
  display: block !important;
  text-align: right !important;
  font-family: var(--font-mono) !important;
  font-weight: 800 !important;
}

body.is-exporting-pdf .meta-grid {
  display: grid !important;
  grid-template-columns: 1.25fr 1.65fr 1fr 1fr !important;
}

body.is-exporting-pdf .payment-milestones-box,
body.is-exporting-pdf .approval-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
}

body.is-exporting-pdf .deliverables-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
}

body.is-exporting-pdf .deliverable-card {
  border: 1px solid #cbd5e1 !important;
  page-break-inside: avoid !important;
  break-inside: avoid !important;
  margin-bottom: 0.75rem !important;
}

body.is-exporting-pdf .deliverable-card-header {
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  border-left: 4px solid #ff6500 !important;
  padding: 0.4rem 0.75rem !important;
}

body.is-exporting-pdf .deliverable-card-body {
  padding: 0.6rem 0.85rem !important;
}

body.is-exporting-pdf .deliverable-card-body .print-text {
  width: 100% !important;
  font-size: 0.84rem !important;
  line-height: 1.55 !important;
  color: #334155 !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}


