/* ==========================================================================
   COJAC PRODUCTIONS - EXECUTIVE FINANCIAL PROPOSAL STYLESHEET
   Timeless luxury monochrome / carbon palette (Zero Blue)
   Strict single-page print calibration (8.5 x 11 / A4)
   ========================================================================== */

:root {
  --primary-black: #09090b;
  --secondary-charcoal: #18181b;
  --zinc-muted: #52525b;
  --zinc-light: #71717a;
  --border-light: #e4e4e7;
  --border-strong: #d4d4d8;
  --bg-page: #fafafa;
  --bg-card: #ffffff;
  --bg-subtle: #f4f4f5;
  --text-main: #09090b;
  --text-muted: #3f3f46;
  --text-light: #71717a;
  --accent-pill: #e4e4e7;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: #121214;
  color: var(--text-main);
  line-height: 1.45;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 24px 15px;
}

/* ==========================================================================
   TOP CONTROL BAR (Hidden on Print)
   ========================================================================== */
.controls-bar {
  max-width: 8.5in;
  margin: 0 auto 14px auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(24, 24, 27, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 9px 16px;
  border-radius: 8px;
  color: #f4f4f5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.controls-bar .bar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.controls-bar .badge {
  background: #3f3f46;
  color: #f4f4f5;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-primary {
  background: #ffffff;
  color: #09090b;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  background: #e4e4e7;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #27272a;
  color: #f4f4f5;
  border: 1px solid #3f3f46;
}

.btn-secondary:hover {
  background: #3f3f46;
}

.save-status {
  font-size: 11px;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   DOCUMENT PAGE CONTAINER (Exact 8.5 x 11 aspect ratio preview)
   ========================================================================== */
.document-container {
  max-width: 8.5in;
  min-height: 11in;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  padding: 0.40in 0.46in;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

/* Top Accent Stripe (Emerald & Carbon) */
.document-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #09090b 0%, #10b981 35%, #18181b 100%);
}

/* ==========================================================================
   HEADER SECTION: Dual Branding & Meta
   ========================================================================== */
.header-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border-light);
  margin-bottom: 12px;
}

.brand-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-logo-wrap {
  margin-bottom: 8px;
}

.brand-logo-img {
  height: 64px;
  width: auto;
  max-width: 320px;
  display: block;
  object-fit: contain;
}

.brand-meta {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.4;
}

.proposal-meta-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.meta-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.doc-type-tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--primary-black);
  text-transform: uppercase;
  white-space: nowrap;
}

.doc-id-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-light);
  font-family: monospace;
  white-space: nowrap;
}

.client-profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  object-fit: cover;
  flex-shrink: 0;
}

.client-details {
  flex-grow: 1;
}

.client-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.client-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.client-date-line {
  font-size: 10.5px;
  color: var(--text-light);
  margin-top: 3px;
}

/* ==========================================================================
   EXECUTIVE BRIEF / CONTEXT
   ========================================================================== */
.section-brief {
  margin-bottom: 11px;
  background: var(--bg-subtle);
  border-left: 3.5px solid var(--primary-black);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
}

.section-brief p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

.section-brief strong {
  color: var(--text-main);
}

/* ==========================================================================
   FINANCIAL SCHEDULE / RATE MATRIX
   ========================================================================== */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 7px;
}

.section-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--secondary-charcoal);
}

.section-subtitle {
  font-size: 10px;
  color: var(--text-light);
}

.rate-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 11px;
}

.rate-table th {
  background: #18181b;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 7px 10px;
  text-align: left;
}

.rate-table th.th-rate {
  text-align: right;
  width: 200px;
}

.rate-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  background: #ffffff;
}

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

.service-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.service-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

.scope-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chip {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.chip.chip-accent {
  background: #e4e4e7;
  color: #18181b;
  border-color: #d4d4d8;
  font-weight: 700;
}

.rate-display-cell {
  text-align: right;
  white-space: nowrap;
}

.gradient-badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.primary-rate-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary-black);
}

.primary-rate-val span.unit {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-light);
}

.gradient-subtext {
  font-size: 9.5px;
  color: var(--text-light);
  line-height: 1.2;
}

.ceiling-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #18181b;
  background: #f4f4f5;
  border: 1px solid #d4d4d8;
  padding: 1.5px 6px;
  border-radius: 3px;
  margin-top: 2px;
}

/* ==========================================================================
   INTERACTIVE BUDGET ESTIMATOR / CALCULATOR
   ========================================================================== */
.estimator-panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 13px;
  margin-bottom: 11px;
}

.estimator-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: center;
}

.inputs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.input-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.input-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-control {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.input-control input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  outline: none;
}

.totals-card {
  background: #18181b;
  color: #ffffff;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 3.5px solid #10b981;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.total-row:last-child {
  margin-bottom: 0;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.total-label {
  font-size: 10px;
  color: #a1a1aa;
  font-weight: 500;
}

.total-amount {
  font-size: 15px;
  font-weight: 800;
  color: #34d399;
  font-family: var(--font-sans);
}

.total-amount.muted {
  font-size: 12px;
  color: #a1a1aa;
  font-weight: 600;
}

/* ==========================================================================
   PAYMENT STRUCTURE & INCENTIVE OPTIONS (3 TIERS)
   ========================================================================== */
.section-payment-options {
  margin-bottom: 14px;
}

.payment-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.payment-card {
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.15s ease;
  position: relative;
  cursor: pointer;
}

.payment-card:hover {
  border-color: #a1a1aa;
}

.payment-card.selected {
  border-color: #10b981;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.12);
  background: #ffffff;
}

.payment-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 6px;
  min-height: 22px;
}

.payment-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-neutral {
  background: #f4f4f5;
  color: #52525b;
}

.badge-discount {
  background: #f4f4f5;
  color: #18181b;
  border: 1px solid #d4d4d8;
}

.badge-recommended {
  background: #18181b;
  color: #ffffff;
}

.payment-discount-tag {
  font-size: 10px;
  font-weight: 700;
  color: #71717a;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.payment-discount-tag.discount-green {
  color: #059669;
}

.editable-pct-val {
  border-bottom: 1px dashed #10b981;
  padding: 0 2px;
  cursor: text;
  display: inline-block;
  min-width: 14px;
  text-align: center;
  font-weight: 800;
}

.editable-pct-val:hover,
.editable-pct-val:focus {
  outline: none;
  background: #f0fdf4;
  border-bottom-style: solid;
}

.payment-plan-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-black);
  margin-bottom: 3px;
}

.payment-plan-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 10px;
  min-height: 28px;
}

.payment-price-block {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.payment-main-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-black);
  line-height: 1.1;
}

.payment-card.selected .payment-main-price {
  color: #059669;
}

.payment-freq {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-light);
  margin-left: 3px;
}

.payment-split-note {
  font-size: 9px;
  color: var(--text-light);
  margin-top: 3px;
  line-height: 1.25;
}

.extra-video-pill {
  font-size: 9.5px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 3px 6px;
  margin-top: 6px;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.extra-video-pill strong {
  color: #0f172a;
}

.extra-video-pill.discount {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.extra-video-pill.discount strong {
  color: #15803d;
}

.extra-video-pill.discount-max {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.extra-video-pill.discount-max strong {
  color: #047857;
}

.payment-features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  flex-grow: 1;
}

.payment-features-list li {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-select-plan {
  width: 100%;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #d4d4d8;
  background: #ffffff;
  color: #18181b;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.payment-card:hover .btn-select-plan {
  background: #18181b;
  color: #ffffff;
  border-color: #18181b;
}

.payment-card.selected .btn-select-plan {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

.selected-plan-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #166534;
}

.selected-plan-banner .banner-icon {
  font-size: 13px;
  font-weight: 800;
  color: #15803d;
}

/* ==========================================================================
   TERMS, CLAUSES & STANDARDS
   ========================================================================== */
.terms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 9px;
  margin-bottom: 11px;
}

.term-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 7px 9px;
}

.term-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--secondary-charcoal);
  letter-spacing: 0.5px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.term-body {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ==========================================================================
   SIGN-OFF / DIGITAL AUTHORIZATION
   ========================================================================== */
.signatures-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-top: 8px;
  border-top: 1.5px solid var(--border-light);
  margin-top: auto;
}

.signature-block {
  display: flex;
  flex-direction: column;
}

.sig-header {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.sig-surface {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.sig-display {
  display: flex;
  align-items: center;
  height: 100%;
}

.sig-img {
  max-height: 38px;
  max-width: 180px;
  object-fit: contain;
}

.sig-typed-text {
  font-family: 'Cedarville Cursive', cursive;
  font-size: 26px;
  font-weight: 400;
  color: #09090b;
  line-height: 1;
  transform: rotate(-1deg);
  display: inline-block;
  padding-left: 2px;
}

.sig-placeholder {
  font-size: 10px;
  color: #a1a1aa;
  font-style: italic;
}

.btn-sig {
  background: #18181b;
  color: #ffffff;
  border: none;
  font-size: 9.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.btn-sig:hover {
  background: #27272a;
}

.btn-sig-clear {
  background: transparent;
  color: #71717a;
  border: 1px solid #d4d4d8;
  font-size: 8.5px;
  padding: 2px 5px;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 6px;
}

.btn-sig-clear:hover {
  color: #dc2626;
  border-color: #fca5a5;
}

.sig-line {
  border-bottom: 1.5px solid #a1a1aa;
  margin-bottom: 4px;
  height: 0;
}

.sig-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
}

.sig-meta {
  font-size: 9.5px;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
}

.sig-audit-badge {
  font-size: 8.5px;
  color: #059669;
  font-weight: 600;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

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

.modal-dialog {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 440px;
  overflow: hidden;
  border: 1px solid #e4e4e7;
  display: flex;
  flex-direction: column;
}

.modal-header {
  background: #18181b;
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.modal-close {
  background: transparent;
  border: none;
  color: #a1a1aa;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

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

.modal-body {
  padding: 14px 16px;
}

.sig-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e4e4e7;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.sig-tab-btn {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #71717a;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.sig-tab-btn.active {
  background: #18181b;
  color: #ffffff;
}

.canvas-wrap {
  border: 1.5px dashed #cbd5e1;
  border-radius: 6px;
  background: #fafafa;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}

#signature-canvas {
  width: 100%;
  height: 120px;
  display: block;
}

.canvas-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.canvas-hint {
  font-size: 10px;
  color: #a1a1aa;
}

.type-sig-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.type-sig-input {
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.type-sig-preview {
  height: 70px;
  background: #fafafa;
  border: 1.5px dashed #cbd5e1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cedarville Cursive', cursive;
  font-size: 30px;
  color: #09090b;
  transform: rotate(-1deg);
}

.modal-footer {
  padding: 10px 16px;
  background: #f4f4f5;
  border-top: 1px solid #e4e4e7;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   EDITABLE HIGHLIGHT HELPER
   ========================================================================== */
[contenteditable="true"] {
  outline: none;
  border-radius: 2px;
  transition: background-color 0.15s ease;
}

[contenteditable="true"]:hover {
  background-color: rgba(24, 24, 27, 0.06);
  cursor: text;
}

[contenteditable="true"]:focus {
  background-color: rgba(24, 24, 27, 0.09);
  box-shadow: 0 0 0 1px #18181b;
}

/* ==========================================================================
   PRINT SPECIFICATION (Strict 1-Page Letter / A4 fit)
   ========================================================================== */
@page {
  size: letter portrait;
  margin: 0.35in 0.42in;
}

@media print {
  body {
    background: transparent !important;
    padding: 0 !important;
  }

  .controls-bar, .modal-overlay, .btn-sig, .btn-sig-clear {
    display: none !important;
  }

  .sig-placeholder {
    visibility: hidden !important;
  }

  .document-container {
    max-width: 100% !important;
    width: 100% !important;
    min-height: auto !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    page-break-inside: avoid !important;
  }

  .document-container::before {
    display: none !important;
  }

  [contenteditable="true"]:hover,
  [contenteditable="true"]:focus {
    background: transparent !important;
    box-shadow: none !important;
  }

  .input-control {
    border: none !important;
    padding: 0 !important;
  }

  .totals-card {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .rate-table th {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .section-brief {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
