/* Leads board and calendar · version 17 (calls · version 22) */
.lead-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.lead-column { display: flex; flex-direction: column; gap: 10px; min-height: 120px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--canvas); }
.lead-column > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.lead-column h3 { margin: 0; font-size: 12px; font-weight: 850; letter-spacing: .02em; text-transform: uppercase; color: #465267; }
.lead-count { min-width: 24px; padding: 2px 8px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 850; text-align: center; }
.lead-card { display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: var(--shadow-sm); text-align: left; cursor: pointer; font: inherit; color: var(--ink); transition: transform .12s ease, border-color .12s ease; }
.lead-card:hover, .lead-card:focus-visible { transform: translateY(-1px); border-color: var(--line-dark); outline: none; }
.lead-card:focus-visible { box-shadow: 0 0 0 3px rgba(59,130,246,.35); }
.lead-card strong { font-size: 13px; letter-spacing: -.01em; }
.lead-meta { color: var(--muted); font-size: 11px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 10px; }
.lead-visit { font-weight: 800; color: #1e5caf; }
.lead-visit.is-past { color: var(--red); }
.lead-owner { margin-left: auto; color: #465267; font-weight: 800; }
.lead-empty { margin: 6px 4px; color: var(--muted); font-size: 11px; }
.lead-empty-board { padding: 28px; border: 1px dashed var(--line-dark); border-radius: var(--radius); text-align: center; }

.lead-drawer { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; background: rgba(16,24,39,.35); }
.lead-drawer[hidden] { display: none; }
.lead-form { display: flex; flex-direction: column; width: min(560px, 100%); max-height: 100%; margin: 0; overflow-y: auto; border-radius: 0; }
.lead-form .form-grid { padding: 0 21px; margin-top: 4px; }
.lead-form .form-grid label.full { grid-column: 1 / -1; }
.lead-form .form-grid textarea { padding: 10px 11px; min-height: 72px; resize: vertical; }
.lead-form .form-error { min-height: 18px; margin: 10px 21px 0; color: var(--red); font-size: 11px; font-weight: 800; }
.lead-form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 21px 18px; }
.lead-form-actions .button[hidden] { display: none; }
.lead-history { padding: 0 21px 24px; }
.lead-history h4 { margin: 10px 0 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8b97a8; }
.lead-history ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lead-history li { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 11px; }
.lead-history small { color: var(--muted); }

.calendar-controls { display: flex; align-items: center; gap: 8px; }
.calendar-controls strong { min-width: 150px; text-align: center; font-size: 13px; white-space: nowrap; }
.calendar-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
.cal-dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: #999; }
.cal-dot.visit { background: #1e5caf; } .cal-dot.work { background: var(--green); } .cal-dot.inspection { background: #7b40b2; } .cal-dot.permit { background: var(--orange); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-weekday { padding: 4px 0; color: #8b97a8; font-size: 10px; font-weight: 850; letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.cal-cell { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 72px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font: inherit; color: var(--ink); cursor: pointer; }
.cal-cell.is-blank { border-color: transparent; background: transparent; cursor: default; }
.cal-cell.is-today { border-color: var(--red); }
.cal-cell.is-today .cal-day { color: var(--red); }
.cal-cell.is-selected { background: #fff5f6; box-shadow: inset 0 0 0 2px var(--red); }
.cal-cell.has-events { border-color: var(--line-dark); }
.cal-cell:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.35); }
.cal-day { font-size: 12px; font-weight: 850; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-dots .cal-dot { margin: 0; }
.cal-more { position: absolute; right: 8px; bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; }
.calendar-agenda { margin-top: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.calendar-agenda h3 { margin: 0 0 10px; font-size: 14px; }
.calendar-agenda ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cal-event a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 10px 14px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 11px; }
.cal-event a:hover { border-color: var(--line-dark); }
.cal-event.visit a { border-left-color: #1e5caf; } .cal-event.work a { border-left-color: var(--green); } .cal-event.inspection a { border-left-color: #7b40b2; } .cal-event.permit a { border-left-color: var(--orange); }
.cal-event strong { font-size: 12px; }
.cal-event small { color: var(--muted); text-transform: capitalize; }

@media (max-width: 1180px) { .lead-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .lead-board { grid-template-columns: 1fr; }
  .lead-form { width: 100%; }
  .lead-form .form-grid { grid-template-columns: 1fr; }
  .calendar-page .page-toolbar, .leads-page .page-toolbar { flex-wrap: wrap; }
  .calendar-controls { width: 100%; justify-content: space-between; }
  .calendar-controls strong { min-width: 0; flex: 1; font-size: 12px; }
  .lead-form-actions { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); }
  .calendar-grid { gap: 4px; }
  .cal-cell { min-height: 52px; padding: 6px; border-radius: 9px; }
  .cal-more { display: none; }
}

/* Calls through the business number (Version 22) */
.lead-quick { padding: 0 21px 12px; }
.lead-missed { align-self: flex-start; padding: 2px 8px; border-radius: 999px; background: #fdecec; color: var(--red); font-size: 10px; font-weight: 850; }
.lead-quick .button { width: 100%; min-height: 48px; }
.lead-call { margin: 0 21px 12px; padding: 12px 14px; border: 1px solid #c7d7f2; border-radius: 12px; background: #f3f7fe; font-size: 13px; line-height: 1.45; }
.lead-call p { margin: 0 0 8px; }
.lead-call p:last-child { margin-bottom: 0; }
.lead-call-phone { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-call-phone input { flex: 1 1 180px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-dark); border-radius: 10px; font: inherit; font-size: 16px; }
.lead-calls { padding: 0 21px 8px; }
.lead-calls h4 { margin: 10px 0 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8b97a8; }
.lead-calls ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lead-call-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.lead-call-row span { font-weight: 750; }
.lead-call-row small { color: var(--muted); }
.lead-call-row.is-missed span, .lead-call-row.is-voicemail span { color: var(--red); }
.lead-call-row audio { flex-basis: 100%; width: 100%; margin-top: 4px; }
