/* Free change order generator (/tools/change-order-generator,
   marketing/office_tools/change_order_generator, change_order_controller.js).
   Rules for this tool only, prefixed .ot-co-; shared pieces are in
   ../office_tools.css. The typed-signature font is the vendored Dancing Script
   next to this file's logical path (app/assets/fonts/office_tools, see
   LICENSES.md there), the same file /tools/sign-pdf uses; it only downloads
   when a typed signature is shown. Tap targets 44px or larger; no sideways
   scroll at 390px. */

@font-face { font-family: "Dancing Script"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/office_tools/dancing-script-latin-600-normal-f32dca1d.woff2") format("woff2"); }

.ot-co-group { display: flex; flex-direction: column; gap: 14px; }
.ot-co-heading { font-size: 15px; font-weight: 700; color: var(--text); margin: 4px 0 0; padding-top: 14px; border-top: 1px solid var(--gray-100); }

.ot-co-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) {
  .ot-co-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ot-co-grid-3 > :last-child { grid-column: 1 / -1; }
}
.ot-co-number-hint { margin-top: -10px; }
.ot-co-textarea { padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.45; }
.ot-co [aria-invalid="true"] { border-color: var(--danger); }

/* Line items: type tag, item, qty, price, remove. */
.ot-co-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ot-co-line, .ot-co-line-head { display: grid; grid-template-columns: 92px minmax(0, 1fr) 64px 110px 44px; gap: 8px; align-items: center; }
.ot-co-line-head { grid-template-columns: 92px minmax(0, 1fr) 64px 110px; padding-right: 52px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.ot-co-tag { font-size: 12px; font-weight: 700; border-radius: var(--radius-full); padding: 6px 8px; text-align: center; white-space: nowrap; }
.ot-co-tag-add { background: var(--success-light); color: #065f46; }
.ot-co-tag-credit { background: var(--danger-light, #fef2f2); color: #991b1b; }
.ot-co-remove { width: 44px; padding: 0; color: var(--text-secondary); }
.ot-co-add-row > .ot-btn { flex: 0 1 auto; }
@media (max-width: 560px) {
  .ot-co-line-head { display: none; }
  .ot-co-line { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr) 44px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-100); }
  .ot-co-tag { grid-column: 1 / -1; justify-self: start; }
  .ot-co-line-desc { grid-column: 1 / -1; }
}

.ot-co-business { display: flex; flex-wrap: wrap; gap: 14px; }
.ot-co-business-fields { flex: 999 1 320px; min-width: 0; }
.ot-co-logo { flex: 1 1 160px; }
.ot-co-logo-preview { max-width: 160px; max-height: 64px; object-fit: contain; align-self: flex-start; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px; background: var(--surface); }

/* Side panel: the running total. */
.ot-co-totals { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.ot-co-totals-title { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }
.ot-co-sum { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 5px 0; }
.ot-co-sum > :first-child { color: var(--text-secondary); }
.ot-co-sum > :last-child { flex: none; font-variant-numeric: tabular-nums; }
.ot-co-sum .is-add { color: #065f46; font-weight: 600; }
.ot-co-sum .is-credit { color: #991b1b; font-weight: 600; }
.ot-co-sum-detail { margin: -2px 0 2px; font-size: 13px; color: var(--text-secondary); text-align: right; }
.ot-co-sum-total { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; font-size: 20px; font-weight: 800; }
.ot-co-sum-total > :first-child { color: var(--text); }
.ot-co-totals .ot-hint { margin-top: 6px; }
.ot-co-warn { color: var(--danger); }

/* Signatures. */
.ot-co-sign-title { margin-bottom: -6px; }
.ot-co-sign { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.ot-co-sign-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ot-co-sign-label { font-size: 14px; font-weight: 600; color: var(--text); }
.ot-co-mode { gap: 6px; }
.ot-co-mode .ot-pill { padding: 0 14px; font-size: 14px; }
.ot-co-pad-wrap { position: relative; }
.ot-co-pad { width: 100%; height: 120px; display: block; box-sizing: border-box; border: 1px solid var(--border-hover); border-radius: var(--radius-md); background: var(--surface) linear-gradient(to top, transparent 28px, var(--gray-400) 28px, var(--gray-400) 29px, transparent 29px); background-size: calc(100% - 24px) 100%; background-position: 12px 0; background-repeat: no-repeat; touch-action: none; cursor: crosshair; }
.ot-co-pad-hint { position: absolute; left: 12px; bottom: 7px; font-size: 12px; color: var(--text-secondary); pointer-events: none; }
.ot-co-pad-clear { position: absolute; right: 8px; top: 8px; font-size: 14px; background: var(--surface); }
.ot-co-typed-preview { min-height: 56px; padding: 4px 12px; border-bottom: 1px solid var(--gray-400); font-family: "Dancing Script", cursive; font-weight: 600; font-size: 32px; line-height: 1.4; color: #1d3466; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ot-co-sign-fields { gap: 10px; grid-template-columns: minmax(0, 1fr); } /* the side panel is too narrow for name and date side by side */
.ot-co-sign-remove { align-self: flex-start; font-size: 14px; }
.ot-co-sign-add { min-height: 64px; border-style: dashed; color: var(--text-secondary); }
.ot-co-sign-add .ot-optional { margin-left: 4px; }

/* .ot-btn sets display, which would beat the hidden attribute. */
.ot-co [hidden] { display: none !important; }
