/* Contractor portal (contractor.html). Builds on home.css; everything is scoped to .cp. */
.cp .cp-main { max-width: 760px; margin: 24px auto 60px; padding: 0 16px; }
.cp .cp-main h1 { font-size: clamp(28px, 6vw, 40px); margin: 6px 0 4px; }
.cp .cp-header { padding: 18px 16px; }
.cp #job-message:empty { display: none; }
.cp #job-message { color: #637083; }
.cp [hidden] { display: none !important; }
.cp .portal-card { padding: 22px; margin-bottom: 16px; }
.cp .portal-card > p { min-height: 0; margin-bottom: 12px; }
.cp h2 { font-size: 20px; margin: 0 0 8px; }
.cp h3 { font-size: 16px; margin: 18px 0 8px; }
.cp select { width: 100%; border: 1px solid #cfd7e2; border-radius: 4px; padding: 10px; background: #fafbfd; color: #253a68; font: inherit; }
.cp button { justify-content: center; max-width: none; }
.cp .btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cp .btn-row button { width: auto; flex: 1 1 140px; margin-top: 0; }
.cp button.secondary { background: #fff; color: #1b6e93; border: 1px solid #1b6e93; }
.cp button.secondary:hover { background: #eef6fa; }
.cp button.danger { background: #fff; color: #9f3025; border: 1px solid #d9a39d; }
.cp button.danger:hover { background: #fbeeec; }
.cp button.link { background: none; color: #1b6e93; padding: 0; margin: 0; width: auto; text-decoration: underline; font-weight: 600; }
.cp .muted { color: #637083; font-size: 13px; }
.cp .small { font-size: 12px; }
.cp .ok { color: #1f7a4d; }
.cp .warn { color: #9a5b00; }
.cp .err { color: #9f3025; }

.cp .cp-tabs { display: flex; gap: 4px; border-bottom: 1px solid #dbe2ec; margin: 16px 0; }
.cp .cp-tabs button { width: auto; flex: 1; margin: 0; background: none; color: #637083; border-radius: 0; border-bottom: 3px solid transparent; padding: 12px 8px; }
.cp .cp-tabs button[aria-selected="true"] { color: #253a68; border-bottom-color: #1b6e93; }
.cp .cp-tabs button:hover { background: #eef2f8; }

.cp .alert { border-radius: 8px; padding: 14px 16px; margin: 12px 0; font-size: 14px; border: 1px solid; }
.cp .alert strong { display: block; margin-bottom: 2px; }
.cp .alert.info { background: #eef6fa; border-color: #bcdbe9; }
.cp .alert.warn { background: #fff7e8; border-color: #f0d49c; }
.cp .alert.bad { background: #fbeeec; border-color: #ecc1bb; }
.cp .alert button { width: auto; margin-top: 8px; padding: 8px 14px; }

.cp .job-list { display: grid; gap: 10px; }
.cp .job-item { display: block; width: 100%; text-align: left; background: #fff; color: #253a68; border: 1px solid #dbe2ec; border-radius: 8px; padding: 14px 16px; margin: 0; }
.cp .job-item:hover { background: #f7fafc; border-color: #b7c4d6; }
.cp .job-item .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cp .job-item .title { font-weight: 700; font-size: 15px; }
.cp .job-item .meta { color: #637083; font-size: 13px; font-weight: 400; margin-top: 4px; }

.cp .pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef2f8; color: #253a68; white-space: nowrap; }
.cp .pill.s-DISPATCHED, .cp .pill.s-SUBMITTED { background: #e3f1f8; color: #155a79; }
.cp .pill.s-SCHEDULED { background: #ede9fb; color: #4b3a9a; }
.cp .pill.s-IN_PROGRESS { background: #fff1d6; color: #8a5300; }
.cp .pill.s-WORK_COMPLETED, .cp .pill.s-APPROVED { background: #e2f4ea; color: #1f7a4d; }
.cp .pill.s-INVOICED { background: #ede9fb; color: #4b3a9a; }
.cp .pill.s-PAID, .cp .pill.s-SUCCESS, .cp .pill.s-CLOSED { background: #1f7a4d; color: #fff; }
.cp .pill.s-REJECTED, .cp .pill.s-FAILED { background: #fbeeec; color: #9f3025; }
.cp .pill.s-PENDING { background: #fff1d6; color: #8a5300; }
.cp .pill.emergency { background: #9f3025; color: #fff; }

.cp dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; margin: 12px 0; }
.cp dl.facts dt { font-weight: 600; color: #637083; }
.cp dl.facts dd { margin: 0; white-space: pre-wrap; }

.cp .photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.cp .photos a { display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #eef2f8; }
.cp .photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cp .timeline { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.cp .timeline li { border-left: 2px solid #dbe2ec; padding: 0 0 12px 14px; position: relative; }
.cp .timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #1b6e93; }
.cp .timeline .when { color: #637083; font-size: 12px; }

.cp .inv-lines { display: grid; gap: 10px; }
.cp .inv-line { border: 1px solid #dbe2ec; border-radius: 8px; padding: 12px; background: #fafbfd; }
.cp .inv-line .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cp .inv-line label { margin-top: 6px; }
.cp .inv-line .line-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 14px; }
.cp .totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-size: 14px; margin-top: 14px; }
.cp .totals .grand { font-weight: 700; font-size: 16px; }

.cp .choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #dbe2ec; border-radius: 8px; padding: 12px; margin: 8px 0; cursor: pointer; font-weight: 400; font-size: 14px; }
.cp .choice input { width: auto; margin-top: 4px; }
.cp .choice strong { display: block; }
.cp .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 13px; }
.cp .check input { width: auto; margin-top: 3px; }
.cp .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cp .three { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
@media (max-width: 520px) {
  .cp .two, .cp .three, .cp .inv-line .grid { grid-template-columns: 1fr; }
  .cp dl.facts { grid-template-columns: 1fr; }
  .cp dl.facts dt { margin-top: 6px; }
}
