/* ==========================================================================
   Proposals: list, editor, and the printable SirpiSoft documents
   ========================================================================== */

/* ---------- List ---------- */
.prop-list { padding: 4px 6px; }
.prop-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 190px 150px; gap: 16px; align-items: center; padding: 14px 10px; border-top: 1px solid var(--border); cursor: pointer; border-radius: 10px; }
.prop-row:first-child { border-top: 0; }
.prop-row:hover { background: var(--surface-2); }
.prop-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.prop-main { min-width: 0; }
.prop-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-amt { text-align: right; }
.prop-amt b { display: block; font-variant-numeric: tabular-nums; }
.prop-amt .hint { font-size: 11.5px; }
.prop-date { text-align: right; font-size: 12px; line-height: 17px; }
.prop-tabs { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.prop-status-sel { width: auto; }
.sm-sel { display: inline-block; width: auto; height: 32px; margin: 0 8px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; font-size: 13.5px; }
.callout.success { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); background: var(--success-tint); }

/* ---------- Editor ---------- */
.prop-edit { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; align-items: start; }
.pe-toc { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 2px; }
.pe-toc a { padding: 7px 10px; border-radius: 8px; color: var(--muted-foreground); text-decoration: none; font-size: 13.5px; }
.pe-toc a:hover { background: var(--surface-2); color: var(--foreground); }
.pe-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pe-body .panel { margin: 0; scroll-margin-top: 12px; }
.pe-body .panel > h2 { margin-top: 0; }
.pe-h3 { font-size: 14px; margin: 18px 0 8px; display: flex; gap: 8px; align-items: baseline; }
.pe-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pe-sec { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 12px; background: var(--surface-2); }
.pe-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pe-sec-head .input { flex: 1; font-weight: 600; }
.pe-sec-head .pd-num { color: var(--m-sky, #0284c7); font-weight: 800; font-size: 13px; width: 22px; }
.pe-md { width: 100%; min-height: 120px; font-size: 13px; line-height: 19px; resize: vertical; }
.pe-moves { display: inline-flex; gap: 2px; flex: none; }
.pe-moves .icon-btn { width: 30px; height: 30px; }
.pe-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.pe-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted-foreground); padding: 4px 6px; white-space: nowrap; }
.pe-table td { padding: 4px 6px; vertical-align: middle; }
.pe-table .input { height: 36px; min-width: 70px; }
.pe-table .a-center { text-align: center; }
.pe-calc { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.pe-calc.neg { color: var(--destructive); }
.pe-sum td { border-top: 1px solid var(--border); padding-top: 10px; font-weight: 600; }
.pe-warn { color: var(--warning); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.pe-help pre { font-size: 12px; line-height: 17px; background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; }
@media (max-width: 900px) {
  .prop-edit { grid-template-columns: 1fr; }
  .pe-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .pe-table { display: block; overflow-x: auto; }
}
@media (max-width: 760px) {
  .prop-row { grid-template-columns: minmax(0, 1fr) auto; }
  .prop-amt, .prop-date { grid-column: 1 / -1; text-align: left; }
  .pe-grid2 { grid-template-columns: 1fr; }
}

/* ---------- The document (always light, like paper) ---------- */
.pd-paper { background: #e9edf3; border-radius: 14px; padding: 28px 16px; overflow-x: auto; }
[data-theme="dark"] .pd-paper { background: #1b2230; }
.pdoc {
  --navy: #0d3864; --teal: #13959e; --teal-t: #e6f6f8; --ink: #1f2a37; --muted: #5b6b7d; --line: #dfe5ec; --zebra: #f3f6fa; --tint: #eef3fa;
  width: 210mm; max-width: 100%; margin: 0 auto; background: #fff; color: var(--ink); box-shadow: 0 10px 40px rgb(15 23 42 / .12);
  padding: 16mm 15mm 18mm; font-family: Manrope, "Geist", system-ui, sans-serif; font-size: 10.5pt; line-height: 1.55;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pdoc * { box-sizing: border-box; }
.pdoc p { margin: 0 0 8px; }
.pdoc a { color: var(--navy); }
.pdoc strong, .pdoc b { color: var(--navy); font-weight: 700; }
.pdoc code { font-family: var(--font-mono); font-size: .9em; background: var(--zebra); padding: 0 4px; border-radius: 4px; }
.pd-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.pd-logo { display: flex; align-items: center; gap: 8px; }
.pd-logo img { width: 42px; height: 42px; object-fit: contain; }
.pd-logo span { font-size: 22pt; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.pd-logo b { color: var(--navy); font-weight: 800; }
.pd-logo i { color: var(--teal); font-style: normal; }
.pd-meta { margin: 0; text-align: right; font-size: 9pt; line-height: 1.7; }
.pd-meta div { display: block; }
.pd-meta dt { display: inline; font-weight: 700; color: var(--ink); }
.pd-meta dd { display: inline; margin: 0 0 0 4px; color: var(--muted); }
.pd-eyebrow { font-size: 9pt; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); margin-bottom: 10px; }
.pd-eyebrow.sm { font-size: 7.5pt; color: var(--muted); letter-spacing: .14em; margin-bottom: 6px; }
.pd-h1 { font-family: Manrope, sans-serif; font-size: 30pt; line-height: 1.12; font-weight: 800; color: var(--navy); letter-spacing: -.02em; margin: 0 0 14px; max-width: 150mm; }
.pd-h1.sm { font-size: 21pt; max-width: none; margin-bottom: 10px; }
.pd-lede { font-size: 12.5pt; line-height: 1.55; color: #3b4a5c; max-width: 130mm; }
.pd-sub { color: var(--muted); font-size: 10pt; margin-bottom: 18px !important; }
.pd-rule { width: 26mm; height: 4px; border-radius: 3px; background: linear-gradient(90deg, var(--navy), var(--teal)); margin: 26px 0 34px; }
.pd-muted { color: var(--muted); }
.pd-small { font-size: 8.5pt; color: var(--muted); margin-top: 6px !important; }

/* Cover */
.pd-cover { display: flex; flex-direction: column; min-height: 263mm; }
.pd-cover-main { margin-top: auto; margin-bottom: auto; padding-top: 30mm; }
.pd-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; font-size: 10pt; color: #3b4a5c; }
.pd-parties b { display: block; font-size: 11pt; margin-bottom: 2px; }
.pd-contents { background: var(--tint); border-radius: 10px; padding: 12px 16px; font-size: 9.5pt; margin-top: 24px; }
.pd-cover-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 22px; padding-top: 12px; font-size: 9pt; color: var(--muted); }

/* Sections */
.pd-section { margin-top: 24px; }
.pd-cover + .pd-section { break-before: page; }
.pd-sec { font-family: Manrope, sans-serif; font-size: 16pt; font-weight: 800; color: var(--navy); margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; break-after: avoid; letter-spacing: -.01em; }
.pd-num { font-size: 9.5pt; color: var(--teal); font-weight: 800; }
.pd-h { font-size: 11.5pt; color: var(--navy); margin: 14px 0 6px; break-after: avoid; }
.pdoc ul { list-style: none; padding: 0; margin: 0 0 10px; }
.pdoc ul li { position: relative; padding-left: 18px; margin: 5px 0; }
.pdoc ul li::before { content: ""; position: absolute; left: 2px; top: .58em; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.pdoc ol { padding-left: 20px; margin: 0 0 10px; }
.pdoc ol li { margin: 4px 0; }
.pd-tag { display: inline-block; font-size: 6.8pt; font-weight: 800; letter-spacing: .1em; color: var(--teal); text-transform: uppercase; margin-left: 4px; vertical-align: 1px; }

/* Tables */
.pd-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 4px 0 10px; font-size: 9.5pt; break-inside: auto; }
.pd-table th { background: var(--navy); color: #fff; font-weight: 700; text-align: left; padding: 9px 12px; }
.pd-table th.a-center { white-space: nowrap; }
.pd-table tr > :first-child { min-width: 34mm; }
.pd-table thead tr:first-child th:first-child { border-top-left-radius: 9px; }
.pd-table thead tr:first-child th:last-child { border-top-right-radius: 9px; }
.pd-table th.pd-hl { background: var(--teal); }
.pd-table .pd-subhead th { background: #164a7c; font-weight: 600; font-size: 8.5pt; }
.pd-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pd-table tbody tr:nth-child(odd) td { background: var(--zebra); }
.pd-table tbody tr:nth-child(even) td { background: #fff; }
.pd-table tr { break-inside: avoid; }
.pd-table .a-center { text-align: center; }
.pd-table .a-right { text-align: right; }
.pd-table td:first-child { color: var(--ink); }
.pd-table tr.pd-total td { background: var(--teal-t) !important; color: var(--navy); font-weight: 700; }
.pd-table td.pd-hl { background-image: linear-gradient(rgb(19 149 158 / .06), rgb(19 149 158 / .06)); }
.pd-yes { color: var(--teal); font-weight: 800; }
.pd-no { color: #a3b1c0; }
.pd-cell-sub { font-size: 8.5pt; color: var(--muted); margin-top: 2px; }

/* Plan cards (budget header) */
.pd-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 14px; margin: 6px 0 8px; }
.pd-plan { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; break-inside: avoid; }
.pd-plan.rec { border-color: var(--teal); background: var(--teal-t); }
.pd-plan-n { font-weight: 700; color: var(--navy); font-size: 12pt; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pd-rec { font-size: 6.5pt; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; background: var(--teal); color: #fff; padding: 3px 8px; border-radius: 999px; }
.pd-plan-p { font-size: 20pt; font-weight: 800; color: var(--navy); margin: 14px 0 8px; letter-spacing: -.01em; }
.pd-plan-s { font-size: 8.5pt; color: var(--muted); line-height: 1.6; }

/* Blocks */
.pd-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0 12px; }
.pd-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; break-inside: avoid; font-size: 9.5pt; }
.pd-card-t { font-weight: 700; color: var(--navy); font-size: 10.5pt; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.pd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); flex: none; }
.pd-card ul li { padding-left: 14px; margin: 4px 0; }
.pd-card ul li::before { width: 5px; height: 5px; top: .62em; }
.pd-box { background: var(--tint); border-radius: 12px; padding: 14px 16px; margin: 8px 0 12px; break-inside: avoid; font-size: 9.5pt; }
.pd-box-t { font-weight: 700; color: var(--navy); margin-bottom: 6px; font-size: 10.5pt; }
.pd-box p:last-child { margin-bottom: 0; }
.pd-closing { margin-top: 20px; }
.pd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.pd-cols > div > :first-child { margin-top: 0; }
.pd-note { font-size: 8.5pt; color: var(--muted); margin: 4px 0 10px; }
.pd-flow { margin: 10px 0 14px; break-inside: avoid; }
.pd-flow-t { font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.pd-steps { display: flex; align-items: stretch; gap: 6px; }
.pd-step { flex: 1; border: 1.5px solid var(--navy); border-radius: 10px; padding: 10px 8px; text-align: center; font-size: 8.5pt; display: flex; flex-direction: column; justify-content: center; gap: 2px; color: var(--muted); }
.pd-step b { font-size: 9pt; }
.pd-step.on { border-color: var(--teal); background: var(--teal-t); }
.pd-step.dashed { border-style: dashed; border-color: #9fb0c3; max-width: 34%; }
.pd-arrow { align-self: center; color: var(--teal); font-weight: 800; }
.pd-branch { display: flex; flex-direction: column; align-items: center; margin-top: 8px; gap: 4px; font-size: 8.5pt; color: var(--muted); }
.pd-timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 12px; margin: 8px 0 12px; }
.pd-tl { background: var(--tint); border-radius: 10px; box-shadow: inset 0 5px 0 var(--navy); padding: 16px 14px 12px; font-size: 9pt; break-inside: avoid; }
.pd-tl.accent { box-shadow: inset 0 5px 0 var(--teal); background: var(--teal-t); }
.pd-tl-l { font-size: 7.5pt; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pd-tl-t { font-weight: 800; color: var(--navy); font-size: 11.5pt; margin: 2px 0 6px; }

/* Acceptance */
.pd-accept { break-inside: avoid; }
.pd-choices { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 6px 0 30px; font-weight: 600; color: var(--navy); }
.pd-choice { display: inline-flex; align-items: center; gap: 8px; }
.pd-choice i { width: 15px; height: 15px; border: 1.5px solid var(--navy); border-radius: 4px; display: inline-grid; place-items: center; }
.pd-choice.on i { background: var(--teal); border-color: var(--teal); }
.pd-choice.on i::after { content: "✓"; color: #fff; font-style: normal; font-size: 10px; font-weight: 800; }
.pd-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin-top: 40px; }
.pd-sign > div { border-top: 1.5px solid var(--ink); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; font-size: 9pt; color: var(--muted); }
.pd-sign b { color: var(--ink); font-size: 9.5pt; }

/* Small screens: the document scrolls sideways at a readable size (screens only: an A4 page is narrower than 760px) */
@media screen and (max-width: 760px) {
  .pd-paper { padding: 12px 8px; margin: 0 -6px; }
  .pdoc { width: 210mm; max-width: none; zoom: .48; }
}

/* ---------- Print: only the document ---------- */
#printRoot { display: none; }
@media print {
  body.printing > *:not(#printRoot) { display: none !important; }
  body.printing { background: #fff !important; overflow: visible !important; }
  body.printing #printRoot { display: block; }
  #printRoot .pdoc { width: auto; box-shadow: none; padding: 0; margin: 0; zoom: 1; }
  #printRoot .pd-cover { min-height: 255mm; }
  #printRoot .pd-section { break-inside: auto; }
}

/* ---------- Email ---------- */
.sent-block { border: 1px solid var(--border); border-radius: 12px; background: var(--card); margin-bottom: 14px; }
.sent-block summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; font-size: 13.5px; }
.sent-block summary::-webkit-details-marker { display: none; }
.sent-block summary svg { color: var(--m-sky, #0284c7); }
.sent-block summary .hint { margin-left: auto; }
.sent-block ul { list-style: none; margin: 0; padding: 0 14px 10px; }
.sent-block li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.sent-when { font-variant-numeric: tabular-nums; color: var(--muted-foreground); min-width: 120px; }
.sent-to { min-width: 0; overflow-wrap: anywhere; }
.sent-docs { display: inline-flex; gap: 4px; }
.em-from { margin: -6px 0 12px; }
.em-docs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.em-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; }
.em-doc:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.em-doc input { width: 18px; height: 18px; accent-color: var(--primary); }
.em-doc b { display: block; font-size: 13.5px; }
.em-doc .hint { font-size: 11.5px; }
.em-doc-ic { width: 30px; height: 36px; border-radius: 5px; display: grid; place-items: center; font: 800 9px/1 var(--font); letter-spacing: .06em; color: #fff; background: #0d3864; flex: none; }
.em-doc-ic.budget { background: #13959e; }
.em-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.em-chip { cursor: pointer; font: inherit; font-size: 12.5px; background: var(--card); }
.em-chip:hover { border-color: var(--primary); }
.em-modal textarea { min-height: 160px; line-height: 21px; }
.em-preview { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.em-preview-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 12px; background: var(--surface-2); font-size: 13px; }
.em-preview iframe { width: 100%; height: 560px; border: 0; background: #eef2f7; display: block; }
.auth-error.ok { color: var(--success); background: var(--success-tint); border-color: transparent; }
@media (max-width: 760px) { .em-docs { grid-template-columns: 1fr; } }
.modal:has(.em-modal) { width: min(760px, 100%); max-width: 760px; }
