/* Reewamp CLM contract pages: only what styles.css does not already have. Same tokens, black and white, colour for status. */

/* side pills: vendor in ink, customer outlined, the rest grey */
.pill.clm-side-vendor { background: var(--ink); color: var(--ink-ink); border-color: var(--ink); }
.pill.clm-side-customer { background: var(--surface); color: var(--text); border-color: var(--border-strong); }

/* deadlines with urgency */
.clm-due { font-variant-numeric: tabular-nums; }
.clm-due.strong { font-weight: 600; }
.clm-due-bad { color: var(--bad); font-weight: 550; }
.clm-due-warn { color: var(--warn); font-weight: 550; }
.clm-grow { flex: 1; }
.clm-sm-only { display: none; }

/* upload card */
.clm-upload { padding: 12px; margin-bottom: 16px; }
.clm-drop { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 18px; }
.clm-drop > div:nth-child(2) { flex: 1; min-width: 0; }
.clm-drop b { display: block; color: var(--text); margin-bottom: 2px; }
.clm-drop-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); flex: none; }
.clm-drop-icon .ico { width: 20px; height: 20px; color: var(--text-2); }
.clm-drop-actions { flex: none; }
#clm-upload-progress { padding: 12px 6px 2px; }
.clm-upload-head { margin-bottom: 6px; }
.clm-uplist, .clm-file-results { list-style: none; margin: 0; padding: 0; }
.clm-uplist > li { padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.clm-uplist > li:first-child { border-top: 0; }
.clm-file-line, .clm-file-results li { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.clm-file-name { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clm-file-results { margin: 4px 0 0 14px; }
.clm-file-results li { padding: 2px 0; }
.clm-bar { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.clm-bar > span { display: block; height: 100%; width: 0; background: var(--ink); transition: width .15s; }

/* list page */
.clm-kpis .value.clm-multi { flex-direction: column; align-items: flex-start; gap: 0; }
.clm-kpis .value.clm-multi > div + div { font-size: 15px; color: var(--text-2); }
.clm-kpi-date { font-size: 15px; flex-direction: column; align-items: flex-start; gap: 0; }
.clm-kpi-date .muted.small { font-size: 12.5px; font-weight: 400; letter-spacing: 0; }
.clm-pager { padding: 10px 12px 6px; }

/* contract detail */
.clm-owner select { width: auto; min-width: 150px; }
.facts .fact.clm-fact-due > div { margin-left: 2px; }
.clm-banner { margin-bottom: 16px; padding: 12px 16px; }
.clm-banner.bad b { color: var(--bad); }
.clm-top { grid-template-columns: 1fr; }
.clm-summary { margin: 0 0 4px; line-height: 1.6; color: var(--text); }
.clm-parties { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.clm-parties li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 4px 0; }
.clm-terms-card h3 { margin: 18px 0 10px; }
.clm-terms-card .card-head + h3 { margin-top: 4px; }
.clm-legend { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.clm-legend .ico { width: 12px; height: 12px; }
.clm-terms { gap: 12px 16px; }
.clm-term dt { display: flex; align-items: center; gap: 6px; }
.clm-term dd { position: relative; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; white-space: normal; }
.clm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.clm-dot.high { background: var(--good); }
.clm-dot.medium { background: var(--warn); }
.clm-dot.low { background: var(--bad); }
.clm-lock { display: inline-flex; color: var(--text-2); }
.clm-lock .ico { width: 12px; height: 12px; }
.clm-val { font: inherit; color: var(--text); background: none; border: 0; padding: 1px 4px; margin: -1px -4px; border-radius: 6px; cursor: text; text-align: left; overflow-wrap: anywhere; max-width: 100%; }
.clm-val:hover { background: var(--hover); }
.clm-val:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.clm-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; width: 100%; }
.clm-edit input, .clm-edit select { flex: 1 1 140px; min-width: 0; }

/* source popover: a <details> whose panel floats under its summary */
.clm-src { position: relative; font-size: 12px; }
.clm-src > summary { list-style: none; cursor: pointer; color: var(--muted); padding: 0 4px; border-radius: 5px; }
.clm-src > summary::-webkit-details-marker { display: none; }
.clm-src > summary:hover, .clm-src[open] > summary { color: var(--text); background: var(--surface-2); }
.clm-src-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 320px; max-width: min(320px, calc(100vw - 48px)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 12px; font-size: 13px; }
.clm-term:nth-child(3n) .clm-src-pop { left: auto; right: 0; }
.clm-src-pop .clm-excerpt { margin: 0 0 8px; }
.clm-src-pop .pill .ico { width: 11px; height: 11px; }
.clm-src-pop p { margin: 0; }

/* quoted excerpts */
.clm-excerpt { margin: 8px 0 0; padding: 8px 12px; border-left: 2px solid var(--border-strong); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 13px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.clm-excerpt > .muted.small { display: block; margin-top: 4px; white-space: normal; }

/* findings */
.clm-findings { list-style: none; margin: 0; padding: 0; }
.clm-finding { padding: 14px 0; border-top: 1px solid var(--border); }
.clm-finding:first-child { border-top: 0; padding-top: 4px; }
.clm-finding:last-child { padding-bottom: 0; }
.clm-finding.closed > :not(.clm-finding-foot) { opacity: .62; }
.clm-finding-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.clm-finding-head .row { gap: 6px; min-width: 0; }
.clm-amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clm-finding-detail { margin: 6px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.clm-formula { margin: 4px 0 0; overflow-wrap: anywhere; }
.clm-finding-foot { margin-top: 10px; gap: 6px; }

/* clauses, history */
.clm-clauses td { min-width: 0; }
.clm-clauses .pill .ico { width: 11px; height: 11px; }
.clm-clauses tr.clm-absent b { color: var(--text-2); font-weight: 500; }
.clm-more > summary { cursor: pointer; color: var(--muted); margin-top: 4px; }
.clm-old { color: var(--muted); text-decoration: line-through; overflow-wrap: anywhere; }

/* renewals */
.clm-renewal-table { table-layout: fixed; }
.clm-renewal-table th:nth-child(1) { width: 140px; } .clm-renewal-table th:nth-child(2) { width: 170px; }
.clm-renewal-table th:nth-child(4) { width: 110px; } .clm-renewal-table th:nth-child(5) { width: 130px; } .clm-renewal-table th:nth-child(6) { width: 160px; }
.clm-overdue { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }

/* settings */
.clm-list { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-top: 10px; }
.clm-list-row { display: flex; gap: 6px; align-items: center; width: 100%; max-width: 440px; }
.clm-list-row input { flex: 1; min-width: 0; }
.clm-list[data-type="number"] .clm-list-row { max-width: 200px; }
.clm-list-add { margin-top: 2px; }
.clm-num-grid { align-items: start; margin-top: 8px; }
.clm-unit { display: flex; align-items: center; gap: 8px; }
.clm-unit input { flex: 1; min-width: 0; }
.clm-help { font-weight: 400; line-height: 1.45; }
.clm-clause-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; margin-top: 8px; }

@media (max-width: 640px) {
  .clm-sm-only { display: inline; }
  .clm-drop { flex-wrap: wrap; padding: 14px; }
  .clm-drop-icon { display: none; }
  .clm-drop-actions { width: 100%; }
  .clm-drop-actions .btn { flex: 1 1 auto; }
  .clm-owner { width: 100%; }
  .clm-owner select { flex: 1; }
  .clm-finding-head { flex-direction: column; gap: 4px; }
  .clm-finding-foot .muted.small { width: 100%; }
  .clm-src-pop, .clm-term:nth-child(3n) .clm-src-pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-width: none; }
  .clm-renewal-table { table-layout: auto; }
  .clm-renewal-table th:nth-child(n) { width: auto; }
}

/* Laptop widths: the type column gives way so the findings column stays in view (the type shows on the detail page). */
@media (max-width: 1400px) {
  .clm-contracts .clm-hide-md { display: none; }
}
