/* ═══ Contracts dashboard view (contracts-view.js) ═══
   Builds on the Finances classes (fin-*) and the dashboard shell (qh-*, gcal-filters);
   only what is specific to contracts lives here (prefix ctr-). */
.ctr-admin-actions { display: inline-flex; gap: 8px; margin-left: auto; align-items: flex-end; flex-wrap: wrap; }
.ctr-admin-actions[hidden] { display: none; }

.ctr-table td { vertical-align: top; }
.ctr-doc { font-weight: 600; max-width: 340px; overflow-wrap: anywhere; }
.ctr-more { display: flex; justify-content: center; }

.ctr-badge--ok    { background: rgba(22, 163, 74, 0.16);  color: #22c55e; }
.ctr-badge--info  { background: rgba(14, 165, 233, 0.16); color: #38bdf8; }
.ctr-badge--warn  { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.ctr-badge--muted { background: rgba(148, 163, 184, 0.12); color: var(--muted, #94a3b8); }
.ctr-badge--bad   { background: rgba(239, 68, 68, 0.14);  color: #f87171; }

.ctr-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ctr-foot { margin-top: 4px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.ctr-danger { color: #f87171 !important; }
.ctr-signers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.84rem; }
.ctr-signers .fin-badge { margin-left: 4px; }

.ctr-pop--detail { width: min(1040px, 96vw); }
.ctr-pop--form { width: min(760px, 96vw); }
.ctr-pop--viewer { width: min(1100px, 96vw); height: 94vh; }
.ctr-pop--viewer .fin-pop-body { flex: 1; min-height: 0; }
.ctr-viewer-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.ctr-viewer { flex: 1; width: 100%; min-height: 60vh; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 8px; background: #fff; }
.ctr-viewer-img { max-width: 100%; height: auto; border-radius: 8px; align-self: center; }

.ctr-qsearch, .ctr-form input, .ctr-form select, .ctr-form textarea {
  width: 100%; box-sizing: border-box; background: var(--bg, #0f172a); color: var(--text, #f1f5f9);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 0.88rem;
}
.ctr-qsearch:focus, .ctr-form input:focus, .ctr-form select:focus, .ctr-form textarea:focus { outline: none; border-color: var(--accent, #06b6d4); }
.ctr-form textarea { resize: vertical; }
.ctr-form input[type="file"] { padding: 6px; }
.ctr-qresults { margin-top: 8px; }
.ctr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin-top: 12px; }
.ctr-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ctr-field > span { font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted, #94a3b8); }
.ctr-field--wide { grid-column: 1 / -1; }
.ctr-form-err {
  margin-top: 12px; padding: 8px 12px; border-radius: 8px; font-size: 0.84rem;
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); color: #fca5a5;
}
.ctr-form-err[hidden] { display: none; }
.ctr-form .ctr-foot { margin-top: 16px; }

[data-theme="light"] .ctr-badge--ok   { color: #15803d; }
[data-theme="light"] .ctr-badge--info { color: #0369a1; }
[data-theme="light"] .ctr-badge--warn { color: #b45309; }
[data-theme="light"] .ctr-badge--bad  { color: #b91c1c; }
[data-theme="light"] .ctr-danger { color: #b91c1c !important; }
[data-theme="light"] .ctr-foot { border-top-color: rgba(0, 0, 0, 0.08); }
[data-theme="light"] .ctr-qsearch, [data-theme="light"] .ctr-form input,
[data-theme="light"] .ctr-form select, [data-theme="light"] .ctr-form textarea { background: #fff; color: var(--ink, #0B1320); border-color: rgba(0, 0, 0, 0.16); }
[data-theme="light"] .ctr-viewer { border-color: rgba(0, 0, 0, 0.1); }
[data-theme="light"] .ctr-form-err { color: #b91c1c; }

@media (max-width: 760px) {
  .ctr-grid { grid-template-columns: 1fr; }
  .ctr-admin-actions { margin-left: 0; width: 100%; }
  .ctr-admin-actions button { flex: 1 1 auto; }
  .ctr-doc { max-width: 220px; }
}

/* Finances → GIO sales: the BoldSign contract badge opens the contract in Contracts. */
button.fin-linkbadge { background: none; border: 0; padding: 0; margin: 0; font: inherit; cursor: pointer; }
button.fin-linkbadge:hover .fin-badge { outline: 1px solid currentColor; }
