/* Invoice Document Styles */
.invoice-doc {
  font-family: Calibri, Arial, Helvetica, 'Segoe UI', sans-serif;
  font-size: 11pt;
  color: #1a1a1a;
  padding: 0.9in 0.75in 0.2in;
  max-width: 8.5in;
  line-height: 1.4;
}

/* --- HEADER: logo+company left, INVOICE right --- */
.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.inv-company {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.inv-logo {
  height: 140px;
  width: auto;
}
.inv-company-info {
  font-size: 11pt;
  line-height: 1.5;
  padding-top: 0.25rem;
}
.inv-company-name {
  font-size: 17pt;
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.inv-meta {
  text-align: right;
  font-size: 11pt;
  line-height: 1.5;
}
.inv-title {
  font-size: 16pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.1rem;
}
.inv-number {
  font-size: 13pt;
  margin-bottom: 1.25rem;
}
.inv-label {
  font-size: 11pt;
  font-weight: 700;
  text-transform: uppercase;
  color: #1a1a1a;
  margin-top: 0.75rem;
}
.inv-meta-value {
  font-size: 11pt;
  margin-top: 0.1rem;
}

/* --- BILLING SECTION: BILL TO left, Service Type right --- */
.inv-billing {
  display: flex;
  justify-content: flex-start;
  gap: 1.5in;
  margin-bottom: 1.5rem;
  padding-top: 1rem;
  border-top: 1.5px solid #1a1a1a;
}
.inv-billto {
  min-width: 2.5in;
  flex-shrink: 0;
}
.inv-service-type {
  flex: 1;
}
.inv-section-label {
  font-size: 11.5pt;
  font-weight: 700;
  text-transform: uppercase;
  color: #1a1a1a;
  margin-bottom: 0.4rem;
}
.inv-client-name {
  font-size: 15pt;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.inv-client-detail {
  font-size: 11pt;
  line-height: 1.5;
}
.inv-tier-name {
  font-size: 15pt;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.inv-note {
  font-size: 11pt;
  font-weight: 700;
  color: #1a1a1a;
}

/* --- LINE ITEM TABLE --- */
.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
}
.inv-table th {
  font-size: 11.5pt;
  font-weight: 700;
  text-transform: uppercase;
  text-align: left;
  padding: 0.4rem 0;
  border-bottom: 1.5px solid #1a1a1a;
}
.inv-table th.num {
  text-align: right;
}
.inv-table td {
  padding: 0.5rem 0;
  vertical-align: top;
  font-size: 11pt;
}
.inv-table td.num {
  text-align: right;
}
.inv-table tr.line-item td {
  padding-top: 0.75rem;
}
.line-desc {
  font-weight: 700;
}
.line-sub {
  font-size: 11pt;
  color: #1a1a1a;
  font-weight: 400;
  display: block;
  margin-top: 0.1rem;
}

/* --- TOTALS + BANK INFO (side by side) --- */
.inv-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  border-top: 1.5px solid #1a1a1a;
  padding-top: 0.75rem;
}
.inv-bottom-left {
  flex: 1;
  font-size: 11pt;
  line-height: 1.6;
}
.inv-bottom-right {
  min-width: 3in;
  text-align: right;
}
.inv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
}
.inv-total-row.bordered-top {
  border-top: 1px solid #1a1a1a;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}
.inv-total-row.bordered-bottom {
  border-bottom: 1.5px solid #1a1a1a;
  padding-bottom: 0.5rem;
}
.inv-total-label {
  font-size: 11pt;
  font-weight: 700;
  text-align: left;
}
.inv-total-value {
  font-size: 11pt;
  text-align: right;
}

/* --- PAYEE + ACH SECTIONS --- */
.inv-footer-section {
  margin-bottom: 1.25rem;
  font-size: 11pt;
  line-height: 1.6;
}
.inv-footer-section strong {
  display: block;
  margin-bottom: 0.1rem;
}

/* --- REMITTANCE NOTES --- */
.inv-notes {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e0e0e0;
  font-size: 11pt;
  color: #1a1a1a;
  line-height: 1.8;
}

.inv-footer { font-size: 11pt; line-height: 1.7; }
.inv-footer-columns { display: flex; gap: 3rem; margin-bottom: 1.5rem; }
.inv-footer-col { flex: 1; }

/* ============================================
   PROPOSAL DOCUMENT STYLES
   Matches Brolly proposal template exactly
   ============================================ */

.proposal-doc {
  font-family: Calibri, 'Segoe UI', -apple-system, sans-serif;
  font-size: 11pt;
  color: #1a1a1a;
  line-height: 1.2;
}

/* Page structure - A4 proportions */
.prop-page {
  width: 8.5in;
  height: 11in;
  padding: 0.5in 0.63in 0.8in;
  position: relative;
  page-break-after: always;
  border: 1px solid #e0e0e0;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
  overflow: hidden;
  background: #fff;
}
.prop-page:last-child {
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 0;
  page-break-after: auto;
}

/* Page header: logo top-right */
.prop-page-header {
  text-align: right;
  margin-bottom: 1.5rem;
  min-height: 70px;
}
.prop-page-header img {
  height: 65px;
  width: auto;
}

/* Page footer */
.prop-page-footer {
  position: absolute;
  bottom: 0.5in;
  left: 0.63in;
  right: 0.63in;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9pt;
  color: #666;
}
.prop-page-footer-center {
  font-size: 8pt;
  color: #888;
  text-align: center;
  flex: 1;
}

/* ---- COVER PAGE ---- */
.prop-cover-page {
  padding: 0;
  display: flex;
  flex-direction: row;
  width: 8.5in;
  height: 11in;
  overflow: hidden;
}
.prop-cover-page .prop-page-header {
  display: none;
}
.prop-cover-page .prop-page-footer {
  display: none;
}

/* Left purple panel */
.prop-cover-panel {
  width: 18%;
  background: linear-gradient(180deg, #A023E1 0%, #6B10A0 100%);
  padding: 10% 0 8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
.prop-cover-panel-logo {
  height: 56px;
  filter: brightness(10);
}
.prop-cover-panel-bottom {
  text-align: center;
}
.prop-cover-panel-label {
  font-size: 8pt;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.8;
  line-height: 1.6;
}
.prop-cover-panel-divider {
  width: 16px;
  height: 1.5px;
  background: rgba(255,255,255,0.5);
  margin: 0.5rem auto;
}
.prop-cover-panel-id {
  font-size: 8pt;
  font-weight: 600;
  opacity: 0.9;
}
.prop-cover-panel-date {
  font-size: 7pt;
  opacity: 0.6;
  margin-top: 0.15rem;
}

/* Right content area */
.prop-cover-content {
  flex: 1;
  padding: 18% 8% 5% 8%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.prop-cover-title {
  font-family: 'Oswald', 'Segoe UI Semibold', sans-serif;
  font-size: 32pt;
  font-weight: 500;
  color: #A023E1;
  line-height: 1.08;
  margin-bottom: 1.25rem;
}
.prop-cover-divider {
  width: 40px;
  height: 3px;
  background: #A023E1;
  margin-bottom: 1.75rem;
}
.prop-cover-prepared {
  font-size: 9pt;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #999;
  margin-bottom: 0.3rem;
}
.prop-cover-client {
  font-family: 'Oswald', 'Segoe UI Semibold', sans-serif;
  font-size: 14pt;
  font-weight: 700;
  text-transform: uppercase;
  color: #000;
  margin-bottom: 0.2rem;
}
.prop-cover-erp {
  font-size: 10pt;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cover footer (inside white content area) */
.prop-cover-footer {
  position: absolute;
  bottom: 4%;
  left: 8%;
  right: 8%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 8pt;
  color: #aaa;
}
.prop-cover-footer-page {
  position: absolute;
  right: 0;
}

/* ---- SECTION HEADINGS ---- */
.prop-heading {
  font-size: 12pt;
  font-weight: 700;
  color: #A023E1;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}
.prop-heading:first-child,
.prop-page-header + .prop-heading {
  margin-top: 0;
}

/* Sub-headings (purple, within content) */
.prop-subheading {
  font-size: 12pt;
  font-weight: 700;
  color: #A023E1;
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
}

/* ---- BODY TEXT ---- */
.prop-body {
  margin-bottom: 0.75rem;
  text-align: justify;
  font-size: 11pt;
  line-height: 1.2;
}
.prop-body strong {
  font-weight: 700;
}

/* Indented definition blocks (Security, Reliability, etc.) */
.prop-indent {
  margin-left: 0.5in;
  margin-bottom: 0.75rem;
}
.prop-indent p {
  margin-bottom: 0.6rem;
  text-align: justify;
  font-size: 11pt;
  line-height: 1.2;
}

/* ---- PRICING TABLE ---- */
.prop-pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 11pt;
}
.prop-pricing-table th {
  background: #A023E1;
  color: #fff;
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-weight: 600;
  font-size: 11pt;
  border: 1px solid #A023E1;
}
.prop-pricing-table td {
  padding: 0.5rem 0.6rem;
  border: 1px solid #e0d0e8;
  vertical-align: top;
  background: #f3e0f7;
  color: #5a1a8a;
  font-weight: 500;
}
.prop-pricing-table td:first-child {
  font-weight: 700;
  color: #000;
  background: #e8c8f0;
}

/* ---- TERMS SECTION ---- */
.prop-term-label {
  font-weight: 700;
  color: #000;
  font-size: 11pt;
  margin-top: 1rem;
  margin-bottom: 0.2rem;
}

/* ---- SIGNATURE SECTION ---- */
.prop-sig-field {
  margin-top: 1.25rem;
  font-weight: 700;
  font-size: 11pt;
}
.prop-sig-field span {
  display: inline-block;
  border-bottom: 1px solid #222;
  min-width: 250px;
  margin-left: 0.25rem;
}

/* ---- LISTS ---- */
.prop-list {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
  list-style-type: disc;
}
.prop-list li {
  margin-bottom: 0.5rem;
  text-align: justify;
  font-size: 11pt;
  line-height: 1.2;
}
.prop-list-nested {
  margin-left: 1.25rem;
  margin-top: 0.3rem;
  list-style-type: circle;
}
.prop-list-nested li {
  margin-bottom: 0.3rem;
}

/* ---- PRINT STYLES ---- */
@page {
  size: letter;
  margin: 0;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  .proposal-doc {
    margin: 0;
    padding: 0;
  }
  .prop-page {
    width: 8.5in;
    height: 11in;
    min-height: 11in;
    max-height: 11in;
    padding: 0.5in 0.63in 0.8in;
    border: none;
    margin-bottom: 0;
    page-break-after: always;
    page-break-inside: avoid;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
  }
  .prop-page:last-child {
    page-break-after: auto;
  }
  .prop-cover-page {
    width: 8.5in;
    height: 11in;
    min-height: 11in;
    max-height: 11in;
    page-break-after: always;
    display: flex !important;
    flex-direction: row !important;
    padding: 0 !important;
    overflow: hidden;
    border: none;
  }
  .prop-cover-panel {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .prop-pricing-table th,
  .prop-pricing-table td {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .prop-page-footer {
    position: absolute;
    bottom: 0.4in;
    left: 0.63in;
    right: 0.63in;
  }
  .document-preview {
    border: none !important;
    box-shadow: none !important;
    max-width: none !important;
  }
  .editable-section {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
  }
  .edit-indicator,
  .edit-modified-badge,
  .section-editor,
  .section-default,
  .editable-toggle-bar { display: none !important; }
}

/* ---- EDITABLE SECTIONS ---- */
.editable-section {
  position: relative;
  border: 1.5px dashed transparent;
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  margin: -0.3rem -0.4rem;
  transition: border-color 0.15s, background 0.15s;
}
.editable-section:hover {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.04);
}
.editable-section:hover .edit-indicator {
  opacity: 1;
}
.editable-section[data-modified="true"] {
  border-color: rgba(167, 139, 250, 0.3);
}
.edit-indicator {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  opacity: 0;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 0.6rem;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
  z-index: 10;
  line-height: 1.4;
}
.editable-section.editing {
  border-color: #7c3aed;
  background: rgba(167, 139, 250, 0.06);
}
.editable-section.editing .section-content { display: none; }
.editable-section.editing .edit-indicator { display: none; }
.editable-section.editing .section-editor { display: block !important; }

.section-editor {
  display: none;
}
.edit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.4rem;
  border: 1px solid #dfe6e9;
  border-radius: 4px;
  font-family: Calibri, 'Segoe UI', sans-serif;
  font-size: 10.5pt;
  line-height: 1.4;
  resize: vertical;
}
.section-editor-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
  justify-content: flex-end;
}
.section-editor-actions button {
  padding: 0.2rem 0.5rem;
  border: none;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-save-edit { background: #7c3aed; color: #fff; }
.btn-cancel-edit { background: #e2e8f0; color: #334155; }
.btn-reset-edit { background: transparent; color: #7c3aed; border: 1px solid #e2e8f0 !important; }
.section-default { display: none; }

/* Toggle bar */
.editable-toggle-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}
.editable-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-weight: 500;
  color: #555;
}
.editable-toggle-count {
  font-size: 0.75rem;
  color: #7c3aed;
  font-weight: 500;
}

/* Modified badge */
.edit-modified-badge {
  position: absolute;
  top: -0.55rem;
  left: 0.5rem;
  font-size: 0.55rem;
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.3px;
  z-index: 5;
}
.editable-section:not([data-modified="true"]) .edit-modified-badge {
  display: none;
}

/* Hide editable UI when toggled off */
.hide-editable-ui .editable-section {
  border-color: transparent !important;
  background: none !important;
}
.hide-editable-ui .edit-indicator,
.hide-editable-ui .edit-modified-badge {
  display: none !important;
}
