/* PrimeSign firm app. Builds on /shared/base.css. No side lines on any box. */

/* ---- Home: greeting, choice cards, filters, list ---- */
.pp-start { padding: 8px 0 4px; }
.pp-date { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); margin: 0 0 12px; }
.pp-greet { margin: 0 0 22px; font-size: 30px; font-weight: 400; letter-spacing: -0.02em; color: var(--navy); }
.pp-greet b { font-weight: 700; }
.pp-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.pp-choice {
  position: relative; display: grid; gap: 4px; text-align: left; background: #fff;
  border: 1px solid var(--rule); border-radius: 8px; padding: 20px 44px 18px 20px; min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.pp-choice:hover { border-color: var(--blue); box-shadow: 0 12px 26px #000d401a; transform: translateY(-2px); }
.pp-choice .ct { font-size: 17px; font-weight: 700; color: var(--navy); }
.pp-choice .cn { font-size: 13px; color: var(--muted); }
.pp-choice .arrow { position: absolute; right: 16px; top: 50%; margin-top: -10px; color: var(--blue); }
.pp-choice.is-main { background: var(--yellow); border-color: var(--yellow); }
.pp-choice.is-main .cn { color: var(--ink-body); }
.pp-choice.is-main .arrow { color: var(--navy); }
.pp-choice[aria-pressed="true"] { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.pp-choice.ps-alert::after { content: ''; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: #a85a52; }
@media (prefers-reduced-motion: reduce) { .pp-choice { transition: none; } .pp-choice:hover { transform: none; } }

.pp-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; padding: 34px 0 14px; }
.pp-section-head { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-right: auto; width: 100%; }
.pp-field {
  min-height: 40px; padding: 8px 16px; border: 1px solid var(--rule); border-radius: 99px; background: #fff;
  font-size: 14px; color: var(--ink); max-width: 100%;
}
.pp-field:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #0645b92e; }
.pp-search { flex: 1 1 260px; min-width: 0; max-width: 420px; }

.ps-pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; background: #8b93a7; }
.ps-pill.sent { background: var(--blue); }
.ps-pill.completed { background: #2f8f4f; }
.ps-pill.declined, .ps-pill.expired, .ps-pill.seal_failed { background: #a85a52; }
.ps-pill.sealing { background: var(--azure); }
.ps-table .title-link { color: var(--navy); font-weight: 700; text-decoration: none; }
.ps-table .title-link:hover { text-decoration: underline; }
.ps-ref { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.ps-table tbody tr[data-envelope] { cursor: pointer; }
.ps-table tbody tr[data-envelope]:hover td { background: var(--paper); }
.ps-table tbody tr[data-envelope]:focus-visible { outline: 3px solid var(--azure); outline-offset: -3px; }
.ps-who { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.ps-who > span { display: flex; align-items: center; gap: 7px; }
.ps-who i { width: 7px; height: 7px; border-radius: 50%; background: #c4cbd9; flex: none; }
.ps-who i.ok { background: #2f8f4f; }
.ps-who i.wait { background: var(--blue); }
.ps-who i.bad { background: #a85a52; }
.ps-prog { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.ps-track { height: 4px; width: 90px; border-radius: 4px; background: #e6eaf2; overflow: hidden; flex: none; }
.ps-track span { display: block; height: 100%; width: 0; background: var(--blue); }
.ps-table td.soon { color: #9e2f1c; font-weight: 700; }
.ps-table .c-sent, .ps-table .c-exp { white-space: nowrap; }
.ps-table .narrow { display: none; }
.ps-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.ps-empty b { display: block; font-size: 17px; color: var(--navy); margin-bottom: 6px; }
.ps-empty p { margin-top: 14px; }
.ps-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); padding: 14px 4px; flex-wrap: wrap; }

/* ---- Builder ---- */
.stepper {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 13px; margin-bottom: 24px;
  padding: 16px 22px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.stepper button { display: flex; align-items: center; gap: 9px; color: var(--muted); border: 0; background: transparent; padding: 0; min-height: 32px; }
.stepper .step-number { height: 26px; width: 26px; display: grid; place-items: center; border: 1px solid #d1daea; border-radius: 50%; font-size: 12px; }
.stepper .active { color: var(--blue); font-weight: 700; }
.stepper .active .step-number { background: var(--blue); color: #fff; border-color: var(--blue); }
.step-connector { width: 48px; height: 1px; background: var(--line); }
.saved { margin-left: auto; color: #4f7a64; font-size: 12px; display: flex; align-items: center; gap: 5px; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; }
.builder-main { display: grid; gap: 22px; min-width: 0; }
.section-number { font-size: 12px; color: var(--blue); background: #eaf1ff; border-radius: 5px; width: 26px; height: 26px; display: inline-grid; place-items: center; margin-right: 10px; }
.dropzone {
  display: flex; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px;
  margin-top: 16px; background: #f8fbff; border: 1px dashed #afc2df; border-radius: 8px; cursor: pointer;
}
.dropzone:hover, .dropzone.dragover { background: #eaf2ff; border-color: var(--blue); }
.dropzone:focus-within { outline: 3px solid var(--azure); outline-offset: 3px; }
.dropzone > span:last-child { display: grid; gap: 3px; }
.circle-icon { height: 42px; width: 42px; display: grid; place-items: center; border-radius: 10px; background: #edf3fd; color: var(--blue); flex: none; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid #eaf0f6; }
.file-row:last-child { border-bottom: 0; }
.file-row .spacer { min-width: 0; }
.file-icon { width: 34px; height: 40px; background: #f0f4fc; color: #647daa; border: 1px solid #dfe7f5; border-radius: 5px; display: grid; place-items: center; flex-shrink: 0; }
.grip { color: #9eaabd; font-size: 18px; cursor: grab; }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }
.recipient-card { padding: 16px; background: #fafcff; border: 1px solid #dfe8f6; border-radius: 8px; margin-bottom: 12px; --recipient: #3367c6; }
.recipient-card.purple { --recipient: #8051b5; background: #fdfbff; border-color: #e8dff5; }
.recipient-card.teal { --recipient: #25887c; background: #f6fcfb; border-color: #dceee9; }
.recipient-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: var(--recipient, #3367c6); background: color-mix(in srgb, var(--recipient, #3367c6) 12%, white); font-size: 11px; font-weight: 700;
}
.recipient-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.recipient-top strong { font-size: 12px; color: var(--recipient); }
.recipient-fields { display: grid; grid-template-columns: 1fr 1.25fr 120px 70px; gap: 10px; }
.recipient-bottom { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
.order-strip { padding: 12px 14px; background: var(--paper); border-radius: 6px; display: flex; gap: 9px; align-items: center; font-size: 12px; margin-top: 14px; flex-wrap: wrap; }
.order-pill { border: 1px solid #d9e3f1; border-radius: 5px; background: #fff; padding: 4px 9px; font-size: 11px; }
.sidebar-section { padding: 20px; border-bottom: 1px solid var(--line); }
.sidebar-section:last-child { border-bottom: 0; }
.sidebar-section h3 { margin-bottom: 12px; }
.brand-choice { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.brand-initial { background: var(--navy); color: #fff; border-radius: 6px; width: 34px; height: 34px; display: grid; place-items: center; font-weight: 700; flex: none; }
.expiry-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.summary-line { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; margin: 10px 0; color: var(--muted); }
.summary-line strong { color: var(--ink); text-align: right; }
.builder-actions { margin-top: 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sticky-side { align-self: start; }
.review-doc { display: flex; gap: 14px; align-items: center; padding: 14px; background: #f7faff; border: 1px solid #e3eaf5; border-radius: 6px; flex-wrap: wrap; }
.review-doc .spacer { min-width: 0; }
.review-checks { display: grid; gap: 16px; margin-top: 22px; }
.message-preview { white-space: pre-wrap; font-size: 13px; }
.mini-heading { margin-bottom: 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.prop-divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---- Field editor ---- */
.editor-layout {
  display: grid; grid-template-columns: 210px minmax(0, 1fr) 250px; background: #e9eef5;
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden; height: 820px; max-height: calc(100vh - 220px); min-height: 560px;
}
.editor-left, .editor-right { background: #fff; padding: 18px; overflow: auto; }
.editor-left { border-right: 1px solid var(--line); }
.editor-right { border-left: 1px solid var(--line); }
.editor-left .control, .editor-right .control { margin-bottom: 14px; }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.palette-item {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 10px 8px; min-height: 64px;
  border: 1px solid #e0e6f0; border-radius: 6px; background: #fff; color: #536684; font-size: 11px; text-align: left;
}
.palette-item:hover { background: #eef4ff; border-color: #95b3e4; color: var(--blue); }
.palette-item.signature { color: var(--blue); background: #f2f6fe; border-color: #d5e1f7; }
.palette-item[draggable] { cursor: grab; }
.editor-help { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 14px; }
.editor-center { min-width: 0; overflow: auto; position: relative; }
.editor-tools {
  min-height: 50px; background: #f8fafd; border-bottom: 1px solid #d7e0ed; display: flex; align-items: center;
  justify-content: space-between; padding: 6px 12px; position: sticky; top: 0; z-index: 5; font-size: 12px; gap: 8px; flex-wrap: wrap;
}
.editor-tools .btn { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.editor-tools .icon-btn { width: 30px; height: 30px; }
.detect-note { margin: 12px 14px 0; }
.canvas-stage { padding: 24px 14px 48px; }
.pdf-page { width: 530px; position: relative; background: #fff; box-shadow: 0 3px 12px #14284922; margin: 0 auto; outline: 1px solid #d7dfeb; isolation: isolate; touch-action: none; }
.pdf-page > img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
#field-layer { position: absolute; inset: 0; }
.placed-field {
  position: absolute; display: flex; align-items: center; gap: 4px; padding: 0 4px; overflow: visible; cursor: move;
  border: 1.5px solid var(--field-color, #3367c6); border-radius: 3px; font-size: 10px; font-weight: 700;
  background: color-mix(in srgb, var(--field-color, #3367c6) 14%, white); color: var(--field-color, #3367c6); user-select: none;
}
.placed-field .field-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.placed-field.selected { outline: 2px solid var(--field-color); outline-offset: 2px; z-index: 2; }
.placed-field.readonly { border-style: dashed; }
.placed-field svg { height: 14px; width: 14px; }
.placed-field .field-owner { position: absolute; font-size: 9px; top: -16px; left: 0; white-space: nowrap; background: #fff; padding: 0 3px; }
.placed-field:not(.selected) .field-owner { display: none; }
.resize-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--field-color); border-radius: 2px; cursor: nwse-resize; }
.page-caption { font-size: 11px; color: #718199; text-align: center; margin-top: 12px; }
.property-title { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.property-title .circle-icon { width: 32px; height: 32px; border-radius: 6px; }
.editor-right .check { margin: 12px 0; }
.prop-actions { display: grid; gap: 7px; }
.coords { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.coords .control { margin: 0; }
.keyboard-hint { font-size: 11px; color: var(--muted); padding: 10px 0; }
.page-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.page-button { width: 34px; height: 40px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; border-radius: 4px; }
.page-button.active { border-color: var(--blue); background: #eef4ff; color: var(--blue); }

/* ---- Envelope tracking ---- */
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -8px 0 20px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 22px; }
.detail-grid > * { min-width: 0; }
.recipient-progress { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 16px 0; border-bottom: 1px solid #e9edf5; }
.recipient-progress:first-child { padding-top: 0; }
.recipient-progress p { font-size: 12px; }
.recipient-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.progress-track { height: 5px; border-radius: 3px; background: #e7ecf4; overflow: hidden; margin-top: 8px; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--blue); }
.timeline { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.timeline-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.timeline-icon { height: 26px; width: 26px; border-radius: 50%; background: #eff4fc; color: #6285b4; display: grid; place-items: center; }
.timeline-icon svg { width: 13px; height: 13px; }
.timeline-item h3 { font-size: 13px; }
.timeline-item p { font-size: 12px; margin-top: 2px; }
.timeline-item time { font-size: 11px; color: var(--muted); text-align: right; }
.downloads { display: grid; gap: 4px; }
.download-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; gap: 10px; }
.download-row .spacer { min-width: 0; }
.download-row strong { font-size: 13px; }
.download-row p { font-size: 12px; }
.download-row.unavailable { opacity: 0.6; }
.download-row.sealed { background: #e9f5ef; border-radius: 8px; padding: 10px 12px; }
.verification summary { padding: 18px 22px; display: flex; gap: 8px; align-items: center; font-weight: 700; cursor: pointer; }
.seal-details { display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 12px; margin: 14px 0; }
.seal-details dt { color: var(--muted); }
.seal-details dd { margin: 0 0 8px; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.link-results { display: grid; gap: 14px; }
.link-result { padding: 16px; background: #f7faff; border: 1px solid #e3eaf5; border-radius: 8px; }
dialog.pdf-modal { width: 860px; }
.preview-page-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.preview-page-controls .control { margin: 0; }
.processed-page { position: relative; max-width: 760px; margin: auto; outline: 1px solid var(--line); }
.presented-preview { display: block; width: 100%; }
.processed-field { position: absolute; border: 1.5px dashed var(--blue); background: #0645b914; font-size: 10px; color: var(--blue); overflow: hidden; white-space: nowrap; padding: 0 3px; }

/* ---- Settings ---- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.settings-grid > * { min-width: 0; }
.colour-grid { display: grid; gap: 16px; }
.colour-pair { display: flex; gap: 10px; align-items: center; }
.colour-pair input[type="color"] { width: 52px; min-height: 40px; padding: 3px; flex: none; cursor: pointer; }
.colour-pair input[type="text"] { max-width: 140px; font-family: ui-monospace, monospace; }
.logo-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.logo-box { min-height: 90px; display: grid; place-items: center; padding: 12px; background: var(--navy); border-radius: 8px; }
.logo-box img { max-width: 100%; max-height: 64px; }
.logo-box .control-note { color: #cdd6ee; text-align: center; }
.brand-preview { --b-navy: #000d40; --b-blue: #0645b9; --b-yellow: #ffde59; }
.preview-sign, .preview-mail { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.preview-bar { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; background: var(--b-navy); color: #fff; }
.preview-logo { max-width: 120px; max-height: 36px; }
.preview-name { font-weight: 700; font-size: 14px; }
.preview-body { padding: 16px; }
.preview-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--b-blue); }
.preview-title { font-size: 20px; font-weight: 700; color: var(--b-navy); margin: 4px 0 12px; }
.preview-button { display: inline-block; padding: 9px 18px; border-radius: 6px; background: var(--b-yellow); color: var(--b-navy); font-weight: 700; font-size: 13px; }
.preview-mail { padding: 16px; display: grid; gap: 10px; background: #fbfcfe; }
.preview-mail p { font-size: 13px; color: var(--ink-body); }
.preview-mail .preview-button { justify-self: start; }
.preview-mail .preview-link { font-size: 12px; color: var(--b-blue); }

/* ---- Members ---- */
.members-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.members-grid > * { min-width: 0; }
.table-wrap.flat { border: 0; border-radius: 0; margin: -22px; }
.role-select { max-width: 130px; min-height: 34px; padding: 4px 8px; }
table.data th.act, table.data td.act { text-align: right; }

@media (max-width: 1180px) {
  .pp-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pp-choice.is-main { grid-column: 1 / -1; }
  .builder-grid, .detail-grid, .settings-grid, .members-grid { grid-template-columns: 1fr; }
  .recipient-fields { grid-template-columns: 1fr 1fr; }
  .editor-layout { grid-template-columns: 180px minmax(0, 1fr); height: auto; max-height: none; }
  .editor-right { grid-column: 1 / -1; border: 0; border-top: 1px solid var(--line); }
  .editor-center { max-height: 760px; }
}

@media (max-width: 700px) {
  .pp-greet { font-size: 23px; }
  .pp-choices { gap: 10px; }
  .pp-choice { padding: 14px 12px; }
  .pp-choice:not(.is-main) .arrow { display: none; }
  .pp-choice .ct { font-size: 15px; }
  .pp-choice .cn { font-size: 12px; }
  .pp-filters { padding-top: 22px; }
  .pp-search { max-width: none; flex-basis: 100%; }
  /* One short card per envelope in place of the table. */
  .ps-table thead { display: none; }
  .ps-table, .ps-table tbody { display: block; }
  .ps-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid #eef2f8; }
  .ps-table tbody tr:last-child { border-bottom: 0; }
  .ps-table td { display: block; padding: 0; border: 0; background: none; }
  .ps-table td.c-status { grid-column: 2; grid-row: 1; text-align: right; }
  .ps-table td.c-who, .ps-table td.c-exp { grid-column: 1 / -1; }
  .ps-table td.c-who .ps-who { display: none; }
  .ps-table td.c-who .ps-prog { margin-top: 0; }
  .ps-table td.c-sent, .ps-table td.c-last { display: none; }
  .ps-table td.c-exp { font-size: 12px; color: var(--muted); }
  .ps-table td.c-exp.none { display: none; }
  .ps-table .narrow { display: inline; }
  .ps-table .wide { display: none; }
  .ps-table tr:not([data-envelope]) { display: block; }
  .stepper { padding: 12px; gap: 8px; }
  .stepper button { font-size: 12px; gap: 6px; }
  .step-connector { width: 10px; }
  .stepper .saved { display: none; }
  .recipient-fields { grid-template-columns: 1fr; }
  .dropzone { flex-direction: column; padding: 18px; }
  .editor-layout { display: flex; flex-direction: column; min-height: 0; }
  .editor-left { border: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  .editor-left .palette { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .palette-item { min-width: 84px; }
  .editor-left .page-buttons, .editor-left .mini-heading, .editor-left .prop-divider { display: none; }
  .editor-center { max-height: none; }
  .editor-tools .snap-label { display: none; }
  .canvas-stage { padding: 18px 10px; }
  .coords { grid-template-columns: 1fr 1fr; }
  .recipient-progress { grid-template-columns: 30px minmax(0, 1fr); }
  .recipient-progress > .badge { grid-column: 2; justify-self: start; }
  .timeline-item { grid-template-columns: 28px minmax(0, 1fr); }
  .timeline-item time { grid-column: 2; text-align: left; }
  .logo-row { grid-template-columns: 1fr; }
  .table-wrap.flat { margin: -16px; }
  .members-table thead, .invites-table thead { display: none; }
  .members-table tr, .invites-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 16px; border-bottom: 1px solid #eef2f8; }
  .members-table td, .invites-table td { padding: 0; border: 0; }
  .members-table td:first-child, .invites-table td:first-child { grid-column: 1 / -1; }
}
