/* Photo Albums — live CompanyCam library (pal- namespace) */

.pal-page { padding: 4px 0 60px; }

/* ── header ── */
.pal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.pal-eyebrow { font-size: var(--fs-xs, 11px); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin-bottom: 4px; }
.pal-title { font-family: var(--font-display); font-size: 30px; font-weight: 500; margin: 0 0 6px; color: var(--text); }
.pal-sub { color: var(--text-dim); font-size: 13.5px; max-width: 640px; line-height: 1.5; }
.pal-head-stats { display: flex; gap: 12px; flex-shrink: 0; }
.pal-kpi { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 10px 18px; text-align: center; }
.pal-kpi b { display: block; font-size: 20px; color: var(--text); }
.pal-kpi span { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── toolbar ── */
.pal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pal-search { flex: 1; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 10px 14px; font: inherit; font-size: 13.5px; }
.pal-search:focus { outline: none; border-color: var(--accent-dim); }
.pal-filter { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 9px 12px; font: inherit; font-size: 13px; }
.pal-count { margin-left: auto; color: var(--text-faint); font-size: 12.5px; }

.pal-roof-report { background: var(--bg-card); border: 1px solid var(--border-soft); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; font-size: 13px; color: var(--text); line-height: 1.6; }
.pal-roof-conf { color: var(--text-faint); font-size: 12px; }
.pal-roof-summary { color: var(--text-dim); font-size: 12.5px; margin-top: 6px; }
.pal-loading, .pal-empty { color: var(--text-dim); padding: 40px 0; text-align: center; font-size: 14px; grid-column: 1 / -1; }
.pal-error { background: oklch(0.70 0.16 25 / 0.12); border: 1px solid oklch(0.70 0.16 25 / 0.4); color: var(--text); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin: 10px 0; }

/* ── album grid ── */
.pal-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.pal-album-card { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; text-align: left; padding: 0; font: inherit; color: var(--text); transition: border-color 0.15s, transform 0.15s; }
.pal-album-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.pal-album-cover { position: relative; aspect-ratio: 4 / 3; background: var(--bg-2); }
.pal-album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pal-album-cover-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-faint); font-size: 12.5px; }
.pal-album-count { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pal-album-meta { padding: 12px 14px 13px; }
.pal-album-name { font-weight: 600; font-size: 14.5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-album-addr { color: var(--text-dim); font-size: 12.5px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-album-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--text-faint); font-size: 11.5px; }

/* ── detail head ── */
.pal-detail-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.pal-back { background: none; border: none; color: var(--accent); font: inherit; font-size: 13.5px; cursor: pointer; padding: 8px 0; white-space: nowrap; }
.pal-detail-title-wrap { flex: 1; min-width: 240px; }
.pal-detail-actions { display: flex; gap: 8px; align-items: center; }

/* ── buttons ── */
.pal-btn { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: var(--radius); cursor: pointer; }
.pal-btn:hover { border-color: var(--accent-dim); }
.pal-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.pal-btn.primary:hover { filter: brightness(1.06); }
.pal-btn.ghost { background: transparent; }
.pal-btn.sm { padding: 6px 12px; font-size: 12.5px; }
.pal-btn:disabled { opacity: 0.55; cursor: default; }
.pal-link { background: none; border: none; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; padding: 0; text-decoration: none; }
.pal-link:hover { text-decoration: underline; }

/* ── photo grid ── */
.pal-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.pal-photo-cell { position: relative; }
.pal-photo-cell.selected .pal-photo-btn { outline: 3px solid var(--accent); outline-offset: -3px; }
.pal-photo-btn { position: relative; display: block; width: 100%; aspect-ratio: 1; border: none; padding: 0; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--bg-2); }
.pal-photo-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pal-photo-check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,0.55); border: 2px solid #fff; color: #fff; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pal-photo-cell.selected .pal-photo-check { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pal-markup-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pal-photo-markup-badge { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; pointer-events: none; }
.pal-strip-thumb { position: relative; display: inline-block; width: 56px; height: 56px; flex-shrink: 0; }
.pal-strip-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.pal-photo-meta { display: flex; justify-content: space-between; gap: 6px; color: var(--text-faint); font-size: 11px; padding: 6px 2px 0; }
.pal-photo-creator { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-photo-caption { color: var(--text-dim); font-size: 11.5px; padding: 2px 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── selection bar ── */
.pal-selection-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; background: var(--bg-card); border: 1px solid var(--accent-dim); border-radius: 999px; padding: 10px 14px 10px 22px; box-shadow: 0 8px 32px rgba(0,0,0,0.45); z-index: 60; font-size: 13.5px; color: var(--text); }

/* ── lightbox ── */
.pal-lb { position: fixed; inset: 0; background: rgba(0,0,0,0.82); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pal-lb-inner { position: relative; display: flex; gap: 0; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; max-width: min(1240px, 96vw); max-height: 92vh; width: 100%; }
.pal-lb-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #000; min-width: 0; position: relative; }
.pal-lb-imgwrap { position: relative; display: flex; align-items: center; justify-content: center; max-height: 92vh; }
.pal-lb-imgwrap img { max-width: 100%; max-height: 92vh; object-fit: contain; display: block; }
.pal-lb-canvas { position: absolute; inset: 0; touch-action: none; }
.pal-lb-side { width: 300px; flex-shrink: 0; padding: 22px 20px; overflow-y: auto; border-left: 1px solid var(--border-soft); }
.pal-lb-close { position: absolute; top: 10px; right: 12px; z-index: 5; background: none; border: none; color: var(--text-dim); font-size: 26px; cursor: pointer; line-height: 1; }
.pal-lb-close:hover { color: var(--text); }
.pal-lb-close.static { position: static; }
.pal-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; background: rgba(0,0,0,0.5); border: none; color: #fff; font-size: 30px; width: 44px; height: 60px; cursor: pointer; border-radius: var(--radius); }
.pal-lb-nav.prev { left: 10px; }
.pal-lb-nav.next { right: 312px; }
.pal-lb-row { margin-bottom: 18px; }
.pal-lb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.pal-lb-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); margin-bottom: 4px; }
.pal-lb-label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.pal-lb-val { font-size: 13.5px; color: var(--text); line-height: 1.45; }
.pal-lb-val.dim, .pal-lb-val .dim { color: var(--text-faint); }

/* ── annotation bar ── */
.pal-annotate-bar { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.5); z-index: 6; flex-wrap: wrap; justify-content: center; max-width: 94%; }
.pal-tool { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-dim); font-size: 16px; cursor: pointer; }
.pal-tool.active { background: var(--accent-ghost); border-color: var(--accent-dim); color: var(--accent); }
.pal-tool-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.pal-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.pal-swatch.active { border-color: var(--text); transform: scale(1.15); }

/* ── annotations list ── */
.pal-ann-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; color: var(--text); }
.pal-ann-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pal-ann-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-ann-src { font-size: 10px; color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 4px; padding: 1px 5px; }
.pal-ann-del { background: none; border: none; color: var(--text-faint); font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1; }
.pal-ann-del:hover { color: var(--bad, #ef4444); }

/* ── caption edit ── */
.pal-caption-edit textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font: inherit; font-size: 13px; padding: 8px 10px; resize: vertical; }
.pal-caption-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ── estimate composer modal ── */
.pal-modal-veil { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pal-modal { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-lg); width: min(640px, 96vw); max-height: 90vh; overflow-y: auto; padding: 24px 26px; }
.pal-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.pal-modal-head h2 { font-family: var(--font-display); font-size: 21px; font-weight: 500; margin: 0; color: var(--text); }
.pal-compose-strip { display: flex; gap: 6px; align-items: center; margin-bottom: 16px; overflow-x: auto; }
.pal-compose-strip img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.pal-strip-more { color: var(--text-dim); font-size: 12.5px; white-space: nowrap; padding: 0 6px; }
.pal-mode-pills { display: flex; gap: 8px; margin-bottom: 16px; }
.pal-pill { background: var(--bg-2); border: 1px solid var(--border); color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.pal-pill.active { background: var(--accent-ghost); border-color: var(--accent-dim); color: var(--accent); }
.pal-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.pal-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.pal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pal-input { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font: inherit; font-size: 13.5px; padding: 9px 12px; width: 100%; box-sizing: border-box; }
.pal-input:focus { outline: none; border-color: var(--accent-dim); }
.pal-lines { display: flex; flex-direction: column; gap: 8px; }
.pal-line-row { display: grid; grid-template-columns: 1fr 64px 108px 28px; gap: 8px; align-items: center; }
.pal-line-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 2px; }
.pal-line-total { color: var(--text-dim); font-size: 13px; }
.pal-line-total b { color: var(--text); font-size: 15px; }
.pal-existing-info { color: var(--text-dim); font-size: 12.5px; }
.pal-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* done state */
.pal-compose-done { text-align: center; padding: 24px 8px; }
.pal-done-icon { width: 54px; height: 54px; border-radius: 50%; background: var(--good, #22c55e); color: #08130b; font-size: 28px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.pal-compose-done h2 { font-family: var(--font-display); font-weight: 500; margin: 0 0 10px; color: var(--text); }
.pal-done-detail { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; margin-bottom: 20px; }

/* ── responsive ── */
@media (max-width: 860px) {
  .pal-lb-inner { flex-direction: column; overflow-y: auto; }
  .pal-lb-side { width: auto; border-left: none; border-top: 1px solid var(--border-soft); }
  .pal-lb-nav.next { right: 10px; }
  .pal-lb-imgwrap img { max-height: 56vh; }
  .pal-form-grid { grid-template-columns: 1fr; }
  .pal-head { flex-direction: column; }
}
.pal-photo-star { position: absolute; top: 6px; left: 8px; font-size: 17px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.8); cursor: pointer; z-index: 2; }
.pal-photo-star.on { color: #f5c542; }
/* pipeline board DnD + delete */
.pl-card-v2 { cursor: grab; }
.pl-card-v2:active { cursor: grabbing; }
.pl-card-del { background: none; border: none; color: var(--text-faint); font-size: 15px; cursor: pointer; line-height: 1; padding: 0 2px; margin-left: 6px; }
.pl-card-del:hover { color: oklch(0.70 0.16 25); }
.pl-col-over { outline: 2px dashed var(--accent-dim); outline-offset: -4px; border-radius: var(--radius); }
/* clients hub */
.cl-page { display: grid; grid-template-columns: 300px 1fr; gap: 18px; padding: 4px 0 40px; min-height: 70vh; }
.cl-list { border-right: 1px solid var(--border-soft); padding-right: 14px; }
.cl-rows { max-height: 74vh; overflow-y: auto; }
.cl-row { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border-soft); padding: 10px 8px; cursor: pointer; font: inherit; color: var(--text); border-radius: 6px; }
.cl-row:hover { background: var(--bg-2); }
.cl-row.active { background: var(--accent-ghost); }
.cl-row-name { font-weight: 600; font-size: 13.5px; }
.cl-row-meta { color: var(--text-faint); font-size: 11.5px; margin-top: 2px; }
.cl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.cl-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.cl-body { max-height: 64vh; overflow-y: auto; }
.cl-item { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 11px 14px; margin-bottom: 8px; }
.cl-item-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--text); }
.cl-item-top span { color: var(--text-dim); font-size: 12px; }
.cl-item-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.cl-item-meta { color: var(--text-faint); font-size: 12px; margin-top: 4px; }
@media (max-width: 900px) { .cl-page { grid-template-columns: 1fr; } .cl-list { border-right: none; } }

/* Roof intelligence report */
.pal-roof-actions { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.pal-roof-issues { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-dim); }
.pal-roof-issues li { margin: 3px 0; }
.pal-sev { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.pal-sev-high { background: oklch(0.6 0.18 25 / 0.18); color: oklch(0.72 0.16 25); }
.pal-sev-med { background: oklch(0.7 0.13 60 / 0.16); color: oklch(0.78 0.12 60); }
.pal-sev-low { background: var(--bg-2); color: var(--text-faint); }
.pal-roof-access, .pal-roof-repairs { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }
.pal-roof-staging { margin-top: 3px; font-size: 12px; color: var(--text-faint); }
