:root {
  --pki-navy: #07234c;
  --pki-blue: #008ce5;
  --pki-blue-dark: #0070c0;
  --pki-ice: #edf8fd;
  --pki-bg: #f5f9fc;
  --pki-card: #fff;
  --pki-text: #0d2240;
  --pki-muted: #5f7189;
  --pki-border: #dce7ef;
  --pki-green: #0e7a4f;
  --pki-green-bg: #e3f6ed;
  --pki-teal: #00756b;
  --pki-teal-bg: #dcf3f0;
  --pki-amber: #8a5800;
  --pki-amber-bg: #fff2d6;
  --pki-blue-bg: #e2f1fc;
  --pki-red: #b42318;
  --pki-red-bg: #fde8e6;
  --pki-grey-bg: #eef2f6;
  --pki-radius: 12px;
  --pki-shadow: 0 1px 2px #07234c0d, 0 6px 20px #07234c0a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.pki { margin: 0; background: var(--pki-bg); color: var(--pki-text); font: 14px/1.5 "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.pki a { color: var(--pki-blue-dark); text-decoration: none; }
.pki a:hover { text-decoration: underline; }
.pki h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; }
.pki h2 { font-size: 15px; margin: 0 0 14px; letter-spacing: -.01em; }
.pki p { margin: 0 0 12px; }
.pki input, .pki select, .pki textarea, .pki button { font: inherit; color: inherit; }
.pki :focus-visible { outline: 3px solid #00a5ee; outline-offset: 2px; }
.pki [hidden] { display: none !important; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pki-muted { color: var(--pki-muted); font-weight: 400; }
.pki-small { font-size: 12.5px; }

/* Header */
.pki-header { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 58px; background: var(--pki-navy); color: #fff; }
.pki-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: inherit !important; white-space: nowrap; text-decoration: none !important; }
.pki-mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, #00b4ee, #008ce5 55%, #0aa58f); box-shadow: inset 0 0 0 2px #ffffff30; }
.pki-brand-lg { font-size: 18px; color: var(--pki-navy) !important; margin-bottom: 22px; }
.pki-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.pki-nav a { color: #c8d6e8; padding: 7px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; text-decoration: none !important; }
.pki-nav a:hover { color: #fff; background: #ffffff14; }
.pki-nav a[aria-current] { color: #fff; background: #ffffff22; }
.pki-badge { display: inline-block; min-width: 19px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: #0f9bb5; color: #fff; font-size: 11.5px; line-height: 18px; text-align: center; }
.pki-user { display: flex; gap: 14px; align-items: center; font-size: 13px; color: #c8d6e8; white-space: nowrap; }
.pki-user a { color: #fff; }

/* Layout */
.pki-main { max-width: 1440px; margin: 0 auto; padding: 22px 24px 60px; }
.pki-narrow { max-width: 760px; }
.pki-card { background: var(--pki-card); border: 1px solid var(--pki-border); border-radius: var(--pki-radius); box-shadow: var(--pki-shadow); padding: 18px 20px; margin-bottom: 16px; }
.pki-grid { display: grid; gap: 12px 16px; }
.pki-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pki-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pki-span-2 { grid-column: span 2; }
.pki-tight { gap: 10px; }
.pki-stack { display: grid; gap: 14px; justify-items: start; }

/* Form controls */
.pki-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; border: 0; padding: 0; }
.pki-field > span:first-child, .pki-field legend { font-size: 12px; font-weight: 600; color: var(--pki-muted); text-transform: uppercase; letter-spacing: .04em; }
.pki-field legend { margin-bottom: 6px; padding: 0; }
.pki input[type=text], .pki input[type=url], .pki input[type=search], .pki input[type=email], .pki input[type=tel], .pki input[type=password], .pki input[type=number], .pki input[type=date], .pki select, .pki textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid #c9d7e3; border-radius: 9px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.pki textarea { resize: vertical; min-height: 64px; }
.pki input:focus, .pki select:focus, .pki textarea:focus { outline: none; border-color: var(--pki-blue); box-shadow: 0 0 0 3px #008ce526; }
.pki-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pki-check input, .pki-switch input { width: 17px; height: 17px; accent-color: var(--pki-blue); margin: 0; }
.pki-switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; padding: 9px 12px; border: 1px solid var(--pki-border); border-radius: 9px; background: var(--pki-bg); }
.pki-switch:has(input:checked) { background: var(--pki-green-bg); border-color: #9fdcc0; color: var(--pki-green); }
.pki-field-group { display: grid; gap: 10px; align-content: start; }
.pki-affix { display: flex; align-items: center; border: 1px solid #c9d7e3; border-radius: 9px; background: #fff; overflow: hidden; }
.pki-affix:focus-within { border-color: var(--pki-blue); box-shadow: 0 0 0 3px #008ce526; }
.pki .pki-affix input { border: 0; box-shadow: none; border-radius: 0; }
.pki-affix em { font-style: normal; color: var(--pki-muted); padding: 0 11px; }
.pki-affix-pre em { padding-right: 0; }
.pki-readout { margin: 0; padding: 9px 0; }

/* Buttons */
.pki-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 9px; border: 1px solid #c9d7e3; background: #fff; color: var(--pki-text) !important; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s; }
.pki-btn:hover { background: var(--pki-ice); border-color: #a9c6dc; }
.pki-btn-primary { background: var(--pki-blue); border-color: var(--pki-blue); color: #fff !important; }
.pki-btn-primary:hover { background: var(--pki-blue-dark); border-color: var(--pki-blue-dark); }
.pki-btn-ghost { background: transparent; border-color: transparent; }
.pki-btn-danger { color: var(--pki-red) !important; border-color: #f2b8b2; }
.pki-btn-danger:hover { background: var(--pki-red-bg); border-color: var(--pki-red); }
.pki-btn-sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.pki-btn-wide { width: 100%; }
.pki-btn:disabled { opacity: .55; cursor: wait; }
.pki-link-btn { background: none; border: 0; padding: 0; color: var(--pki-muted); font-size: 12px; cursor: pointer; text-decoration: underline; }
.pki-link-btn:hover { color: var(--pki-red); }

/* Alerts */
.pki-alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.pki-alert-error { background: var(--pki-red-bg); border-color: #f4bdb6; color: var(--pki-red); }
.pki-alert-ok { background: var(--pki-green-bg); border-color: #a9dfc5; color: var(--pki-green); }

/* Login */
.pki-login-page { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #d9f0fc, transparent), var(--pki-bg); }
.pki-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.pki-login-card { width: 100%; max-width: 400px; padding: 32px; display: grid; gap: 14px; }
.pki-login-card h1 { margin: 0; }
.pki-login-card p { margin: 0; }

/* Stats */
.pki-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin-bottom: 16px; }
.pki-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--pki-radius); background: var(--pki-card); border: 1px solid var(--pki-border); color: var(--pki-text) !important; text-decoration: none !important; box-shadow: var(--pki-shadow); transition: border-color .15s, transform .15s; }
.pki-stat:hover { border-color: #9cc9ea; transform: translateY(-1px); }
.pki-stat strong { font-size: 22px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pki-stat span { font-size: 12px; color: var(--pki-muted); line-height: 1.3; }
.pki-stat.is-active { border-color: var(--pki-blue); box-shadow: 0 0 0 2px #008ce533; }

/* Filters */
.pki-filters { display: grid; gap: 12px; }
.pki-filter-row { grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr)); align-items: end; }
.pki-filter-near { grid-template-columns: minmax(240px, 2fr) minmax(150px, 1fr) minmax(150px, 2fr); }
.pki-filter-small { grid-template-columns: repeat(6, minmax(120px, 1fr)) auto; }
.pki-filters:has(input[name=view]) .pki-filter-small { grid-template-columns: repeat(5, minmax(120px, 1fr)) auto; }
.pki-check-inline { min-height: 40px; font-size: 13px; }
.pki-filter-buttons { display: flex; gap: 6px; }
.pki-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 2px; }
.pki-chip { padding: 4px 11px; border-radius: 999px; background: var(--pki-grey-bg); color: var(--pki-text) !important; font-size: 12.5px; font-weight: 600; text-decoration: none !important; }
.pki-chip:hover { background: var(--pki-blue-bg); }
.pki-chip.is-active { background: var(--pki-navy); color: #fff !important; }

/* Results */
.pki-results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 12px; }
.pki-count { margin: 0 !important; font-size: 16px !important; font-weight: 500; }
.pki-results-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pki-toggle { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--pki-grey-bg); }
.pki-toggle a { padding: 5px 14px; border-radius: 8px; color: var(--pki-muted); font-weight: 600; text-decoration: none !important; }
.pki-toggle a[aria-current] { background: #fff; color: var(--pki-text); box-shadow: 0 1px 2px #07234c22; }
.pki-table-wrap { background: var(--pki-card); border: 1px solid var(--pki-border); border-radius: var(--pki-radius); box-shadow: var(--pki-shadow); overflow: hidden; }
.pki-table { width: 100%; border-collapse: collapse; }
.pki-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--pki-muted); padding: 10px 12px; background: #f8fbfd; border-bottom: 1px solid var(--pki-border); white-space: nowrap; }
.pki-table td { padding: 11px 12px; border-bottom: 1px solid #edf2f6; vertical-align: top; }
.pki-table tbody tr:last-child td { border-bottom: 0; }
.pki-table tbody tr:hover { background: #f8fcff; }
.pki-table tr:has(input[name="ids[]"]:checked) { background: #eef7fe; }
.pki-col-check { width: 36px; }
.pki-col-check input { width: 16px; height: 16px; accent-color: var(--pki-blue); }
.pki-col-name { min-width: 220px; max-width: 340px; }
.pki-name { font-weight: 700; color: var(--pki-text) !important; }
.pki-sub { font-size: 12.5px; color: var(--pki-muted); }
.pki-ellipsis { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pki-tags { display: flex; gap: 4px; margin-top: 4px; }
.pki-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-tag-elec { background: #f1eafd; color: #6a3fc0; }
.pki-distance { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 6px; background: var(--pki-navy); color: #fff; font-size: 11.5px; font-weight: 700; }
.pki-rates { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pki-empty { text-align: center; padding: 40px 20px; }

.pki-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pki-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--pki-grey-bg); color: var(--pki-muted); }
.pki-pill-contract { background: var(--pki-teal-bg); color: var(--pki-teal); }
.pki-pill-approved { background: var(--pki-green-bg); color: var(--pki-green); }
.pki-pill-contacted { background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-pill-interested { background: var(--pki-amber-bg); color: var(--pki-amber); }
.pki-pill-meeting_scheduled { background: #dff4f8; color: #0b6f86; }
.pki-pill-invited { background: #e5ecfd; color: #2f55c4; }
.pki-pill-web_application, .pki-pill-inbound_other { background: #f1eafd; color: #6a3fc0; }
.pki-pill-not_interested, .pki-pill-rejected { background: var(--pki-red-bg); color: var(--pki-red); }
.pki-pill-follow { background: #fff; border: 1px solid var(--pki-border); }
.pki-pill-follow.is-due { background: var(--pki-amber-bg); border-color: #f0cf8a; color: var(--pki-amber); }

.pki-bulkbar { position: sticky; top: 66px; z-index: 900; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; margin-bottom: 10px; border-radius: 10px; background: var(--pki-navy); color: #fff; }
.pki-bulkbar select { min-height: 34px; width: auto; padding: 4px 10px; color: var(--pki-text); }
.pki-bulkbar[hidden] { display: none; }
.pki-bulk-or { color: #c8d6e8; font-size: 13px; }

.pki-pagination { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.pki-pagination > span:first-child { margin-right: auto; }
.pki-pagination a { min-width: 34px; padding: 5px 10px; border-radius: 8px; text-align: center; font-weight: 600; color: var(--pki-text) !important; text-decoration: none !important; }
.pki-pagination a:hover { background: var(--pki-ice); }
.pki-pagination a[aria-current] { background: var(--pki-navy); color: #fff !important; }
.pki-gap { padding: 0 4px; color: var(--pki-muted); }

/* Map */
.pki-map-card { padding: 0; overflow: hidden; }
.pki-map { height: calc(100vh - 380px); min-height: 460px; background: #e8eef3; }
.pki-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 10px 16px; font-size: 12.5px; color: var(--pki-muted); border-top: 1px solid var(--pki-border); }
.pki-legend li { display: flex; align-items: center; gap: 6px; }
.pki-dot { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #07234c44; }
.pki-dot-contract { background: #00756b; } .pki-dot-approved { background: #12a150; } .pki-dot-interested { background: #e9a100; }
.pki-dot-contacted { background: #008ce5; } .pki-dot-inbound { background: #7c4dcc; } .pki-dot-meeting { background: #0f9bb5; } .pki-dot-none { background: #8a9bb0; } .pki-dot-declined { background: #d6453a; }
.pki-popup strong { display: block; font-size: 13.5px; }
.pki-popup span { color: var(--pki-muted); }

/* Installer page */
.pki-back { display: inline-block; margin-bottom: 10px; font-weight: 600; }
.pki-detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.pki-detail-head .pki-pills { margin: 6px 0; }
.pki-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.pki-detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.pki-detail-form .pki-card > .pki-field { margin-top: 12px; }
.pki-savebar { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; padding: 12px 0; background: linear-gradient(transparent, var(--pki-bg) 30%); }
.pki-side { position: sticky; top: 74px; }
.pki-note-form { display: grid; gap: 10px; justify-items: start; padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--pki-border); }
.pki-note-form > * { width: 100%; }
.pki-note-form > button { width: auto; }
.pki-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-height: calc(100vh - 360px); min-height: 120px; overflow-y: auto; }
.pki-note { position: relative; padding: 10px 12px; border-radius: 10px; background: var(--pki-bg); border: 1px solid #e8eff5; }
.pki-note-status { background: transparent; border-style: dashed; }
.pki-note-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 12px; margin-bottom: 4px; }
.pki-note-kind { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; color: var(--pki-blue-dark); }
.pki-note-job .pki-note-kind { color: var(--pki-teal); }
.pki-note-status .pki-note-kind { color: var(--pki-muted); }
.pki-order { font-weight: 700; padding: 0 7px; border-radius: 5px; background: var(--pki-teal-bg); color: var(--pki-teal); }
.pki-note-body { white-space: normal; overflow-wrap: anywhere; }
.pki-note-delete { position: absolute; top: 9px; right: 12px; }
.pki-danger { margin-top: 4px; text-align: right; }

/* Meetings */
.pki-meetings h2 { margin-top: 22px; }
.pki-day h3 { font-size: 14px; margin: 0 0 10px; }
.pki-meeting-list { list-style: none; margin: 0; padding: 0; }
.pki-meeting { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 10px 0; border-top: 1px solid #edf2f6; }
.pki-meeting:first-child { border-top: 0; padding-top: 0; }
.pki-meeting-time { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.pki-meeting.is-past .pki-meeting-time { color: var(--pki-muted); text-decoration: line-through; }
.pki-meeting-notes { margin-top: 3px; font-size: 13px; }
.pki-meeting-side { display: grid; gap: 4px; justify-items: end; font-size: 13px; }
.pki-pill-meeting { background: #dff4f8; color: #0b6f86; }
@media (max-width: 600px) { .pki-meeting { grid-template-columns: 1fr; gap: 4px; } .pki-meeting-side { justify-items: start; } }

/* WhatsApp */
.pki-btn-wa { color: #0b7a3e !important; border-color: #9fdcb7; }
.pki-btn-wa:hover { background: #e7f8ee; border-color: #25a85a; }
.pki-btn-wa-solid { background: #1a9e55; border-color: #1a9e55; }
.pki-btn-wa-solid:hover { background: #12823f; border-color: #12823f; }
.pki-alert-warn { background: var(--pki-amber-bg); border-color: #f0cf8a; color: var(--pki-amber); margin: 0; }
.pki-wa-fields { display: grid; gap: 10px; }
.pki-wa-fields .pki-field small { font-size: 12px; }
.pki-wa-preview { display: grid; gap: 6px; padding: 12px; border-radius: 10px; background: #efeae2; }
.pki-wa-preview-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b6255; }
.pki-wa-bubble { justify-self: start; max-width: 100%; padding: 8px 11px; border-radius: 9px; background: #fff; box-shadow: 0 1px 1px #0000001a; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.pki-wa-preview .pki-wa-bubble, .pki-wa-out .pki-wa-bubble { background: #d9fdd3; }
.pki-wa-status-note { margin: 0; color: var(--pki-green); font-weight: 600; }
.pki-wa-form { display: grid; gap: 14px; }
.pki-wa-form > button { justify-self: start; }
.pki-wa-thread { list-style: none; margin: 0; padding: 12px; display: grid; gap: 10px; border-radius: 10px; background: #efeae2; max-height: 420px; overflow-y: auto; }
.pki-wa-msg { display: grid; gap: 3px; }
.pki-wa-msg .pki-wa-bubble { white-space: normal; }
.pki-wa-msg.pki-wa-out { justify-items: end; }
.pki-wa-msg.pki-wa-out .pki-wa-bubble { justify-self: end; }
.pki-wa-meta { font-size: 11.5px; color: #5f6b5a; }
.pki-wa-state { display: inline-block; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--pki-grey-bg); color: var(--pki-muted); }
.pki-wa-state-sent { background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-wa-state-delivered, .pki-wa-state-read { background: var(--pki-green-bg); color: var(--pki-green); }
.pki-wa-state-failed { background: var(--pki-red-bg); color: var(--pki-red); }
.pki-wa-error { font-size: 12px; color: var(--pki-red); }
.pki-wa-counts { margin: 0 0 10px; padding-left: 18px; }
.pki-wa-who summary { cursor: pointer; font-weight: 600; color: var(--pki-blue-dark); }
.pki-wa-who ul { margin: 8px 0 0; padding-left: 18px; max-height: 320px; overflow-y: auto; font-size: 13px; }
.pki-wa-page .pki-toggle { margin-bottom: 6px; }
.pki-section-title { margin-top: 20px !important; }
.pki-wa-batches, .pki-wa-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pki-wa-batches li { display: grid; gap: 1px; padding-bottom: 10px; border-bottom: 1px solid #edf2f6; }
.pki-wa-batches li:last-child { border-bottom: 0; padding-bottom: 0; }
.pki-wa-log-item { padding: 10px 12px; border-radius: 10px; background: var(--pki-bg); border: 1px solid #e8eff5; }
.pki-wa-log-item.pki-wa-in { background: #f2fbf5; border-color: #cdebd8; }
.pki-wa-log-item.is-new { box-shadow: inset 3px 0 0 #1a9e55; }
.pki-wa-log-item .pki-note-kind { color: #0b7a3e; }

/* Import */
.pki-progress { height: 10px; border-radius: 99px; background: var(--pki-grey-bg); overflow: hidden; margin: 8px 0 10px; }
.pki-progress span { display: block; height: 100%; background: linear-gradient(90deg, #00b4ee, #008ce5); transition: width .3s; }

@media (max-width: 1200px) {
  .pki-filter-small, .pki-filters:has(input[name=view]) .pki-filter-small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pki-filter-buttons { grid-column: 1 / -1; }
  .pki-detail { grid-template-columns: 1fr; }
  .pki-side { position: static; }
  .pki-timeline { max-height: none; }
}
@media (max-width: 900px) {
  .pki-header { padding: 0 16px; gap: 14px; }
  .pki-user span { display: none; }
  .pki-main { padding: 16px 16px 48px; }
  .pki-filter-row, .pki-filter-near { grid-template-columns: 1fr 1fr; }
  .pki-filter-row .pki-grow { grid-column: 1 / -1; }
  .pki-grid-4 { grid-template-columns: 1fr 1fr; }
  .pki-table thead { display: none; }
  .pki-table, .pki-table tbody, .pki-table tr, .pki-table td { display: block; width: 100%; }
  .pki-table tr { position: relative; padding: 12px 14px 12px 44px; border-bottom: 1px solid var(--pki-border); }
  .pki-table td { padding: 2px 0; border: 0; }
  .pki-table td.pki-col-check { position: absolute; left: 14px; top: 14px; width: auto; }
  .pki-table td[data-label]:empty { display: none; }
  .pki-col-name { max-width: none; }
  .pki-rates { white-space: normal; }
  .pki-rates br { display: none; }
  .pki-ellipsis { max-width: 100%; }
}
@media (max-width: 600px) {
  .pki-header { height: auto; flex-wrap: wrap; padding: 10px 16px 0; gap: 4px 12px; }
  .pki-nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .pki-user { margin-left: auto; }
  .pki-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pki-filter-row, .pki-filter-near, .pki-filter-small, .pki-filters:has(input[name=view]) .pki-filter-small, .pki-grid-2, .pki-grid-4 { grid-template-columns: 1fr; }
  .pki-span-2 { grid-column: auto; }
  .pki h1 { font-size: 22px; }
  .pki-card { padding: 16px; }
  .pki-bulkbar { top: 0; }
  .pki-map { height: 70vh; min-height: 360px; }
}
.pki-wa-single { padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--pki-border); }
.pki-wa-single:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
/* WhatsApp conversations */
.pki-wa-convo, .pki-wa-convo:hover { display: grid; gap: 4px; color: var(--pki-text); text-decoration: none; }
.pki-wa-convo:hover .pki-name { text-decoration: underline; }
.pki-wa-convo .pki-note-body { overflow-wrap: anywhere; }
.pki-wa-when { margin-left: auto; }
.pki-pill-new { background: var(--pki-amber-bg); color: var(--pki-amber); }
.pki-wa .pki-wa-thread { margin-bottom: 12px; }
.pki-wa-reply { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-bottom: 14px; }
.pki-wa-reply textarea { width: 100%; min-width: 0; resize: vertical; font: inherit; padding: 8px 10px; border: 1px solid var(--pki-border); border-radius: 8px; }
.pki-wa-reply-warn { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--pki-amber); }
.pki-wa-new > summary { cursor: pointer; font-weight: 600; color: var(--pki-blue-dark); margin-bottom: 10px; }
.pki-wa-new:not([open]) > summary { margin-bottom: 0; }
.pki-wa-unknown { display: grid; gap: 10px; justify-items: start; margin-bottom: 14px; }
.pki-wa-unknown p { margin: 0; }
/* Long messages wrap inside the conversation instead of widening it. */
.pki-wa { min-width: 0; }
.pki-wa-thread { grid-template-columns: minmax(0, 1fr); }
.pki-wa-msg { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.pki-wa-msg .pki-wa-bubble { max-width: 85%; overflow-wrap: anywhere; word-break: break-word; }
.pki-wa-meta { overflow-wrap: anywhere; }
/* Progress board: one column per stage, scrolling sideways inside the page. */
.pki-board-page h1 { margin-bottom: 4px; }
.pki-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); scroll-behavior: smooth; scroll-padding-left: 4px; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; margin-top: 14px; align-items: start; overscroll-behavior-x: contain; }
.pki-board-col { display: grid; gap: 8px; padding: 10px; border-radius: var(--pki-radius); background: #e9eff5; border-top: 4px solid var(--pki-board, #8a9bb0); min-width: 0; }
.pki-board-col header h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0; font-size: 16px; line-height: 1.3; }
.pki-board-col header p { margin: 2px 0 0; font-size: 12px; color: var(--pki-muted); line-height: 1.35; }
.pki-board-count { flex: none; padding: 1px 8px; border-radius: 99px; background: #fff; font-size: 12.5px; color: var(--pki-text); }
.pki-board-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: calc(100vh - 250px); min-height: 40px; overflow-y: auto; }
.pki-board-card { display: grid; gap: 3px; padding: 9px 11px; border-radius: 9px; background: var(--pki-card); box-shadow: 0 1px 2px #0b1f3a1a; color: var(--pki-text); text-decoration: none; font-size: 13px; overflow-wrap: anywhere; }
.pki-board-card:hover { box-shadow: 0 0 0 2px var(--pki-board, #8a9bb0); }
.pki-board-card strong { font-size: 13.5px; }
.pki-board-card .pki-pill { justify-self: start; }
.pki-board-when { font-size: 12px; color: #3d5470; }
.pki-board-card.is-late .pki-board-when { color: var(--pki-amber); font-weight: 600; }
.pki-board-empty, .pki-board-more { margin: 0; font-size: 12.5px; color: var(--pki-muted); text-align: center; }
.pki-pill-met { background: #dff4f8; color: #0b6f86; }
.pki-pill-contract_sent { background: var(--pki-green-bg); color: var(--pki-green); }
.pki-board-card { position: relative; cursor: grab; }
.pki-board-card:active { cursor: grabbing; }
.pki-board-link { color: var(--pki-blue-dark); font-weight: 700; font-size: 13.5px; text-decoration: none; }
.pki-board-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.pki-board-card:hover .pki-board-link { text-decoration: underline; }
.pki-board-move { position: relative; z-index: 1; justify-self: start; margin-top: 3px; }
.pki-board-move select { font: inherit; font-size: 12px; padding: 2px 6px; border: 1px solid var(--pki-border); border-radius: 6px; background: #fff; color: var(--pki-muted); max-width: 100%; cursor: pointer; }
.pki-board-card.is-dragging { opacity: .45; }
.pki-board-card.is-saving { opacity: .55; pointer-events: none; }
.pki-board-card.is-moved { animation: pki-moved 1.2s ease-out; }
@keyframes pki-moved { from { box-shadow: 0 0 0 3px var(--pki-board, #008ce5); } to { box-shadow: 0 1px 2px #0b1f3a1a; } }
.pki-board-col.is-over { background: #d8e6f3; outline: 2px dashed var(--pki-board, #8a9bb0); outline-offset: -2px; }
.pki-board-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: #07234c; color: #fff; font-size: 13.5px; box-shadow: 0 6px 20px #0b1f3a40; }
.pki-board-toast.is-bad { background: var(--pki-red); }
/* Four columns, each card badged with its detailed stage. */
.pki-board-leads { --pki-board: #7c4dcc; }
.pki-board-progress { --pki-board: #008ce5; }
.pki-board-approved { --pki-board: #00756b; }
.pki-board-archive { --pki-board: #8a9bb0; }
.pki-board-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pki-board-chips .pki-sub { cursor: pointer; border: 1px solid transparent; font: inherit; font-size: 11.5px; font-weight: 600; }
.pki-board-chips .pki-sub[aria-pressed="true"] { border-color: currentColor; box-shadow: 0 0 0 1px currentColor; }
.pki-board-chips .pki-sub b { margin-left: 2px; }
.pki-sub { display: inline-block; justify-self: start; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; line-height: 1.6; background: var(--pki-grey-bg); color: var(--pki-muted); }
.pki-sub-came_to_us { background: #f1eafd; color: #6a3fc0; }
.pki-sub-no_reply { background: var(--pki-grey-bg); color: #4e5f74; }
.pki-sub-talking { background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-sub-meeting, .pki-sub-met { background: #dff4f8; color: #0b6f86; }
.pki-sub-approved, .pki-sub-contract_sent { background: var(--pki-green-bg); color: var(--pki-green); }
.pki-sub-signed { background: var(--pki-teal-bg); color: var(--pki-teal); }
.pki-sub-later { background: var(--pki-amber-bg); color: var(--pki-amber); }
.pki-sub-closed { background: var(--pki-red-bg); color: var(--pki-red); }
.pki .pki-board-move select { width: auto; min-height: 0; height: auto; padding: 2px 22px 2px 7px; font-size: 12px; line-height: 1.4; border-radius: 6px; background-position: right 6px center; color: var(--pki-muted); }
/* Aircon installers / Electricians / All tabs above the summary. */
.pki-trade-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--pki-border); }
.pki-trade-tabs { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; }
.pki-trade-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px 9px; border-bottom: 3px solid transparent; color: var(--pki-muted); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.pki-trade-tabs a:hover { color: var(--pki-text); }
.pki-trade-tabs a[aria-current="page"] { color: var(--pki-navy); border-bottom-color: var(--pki-blue); }
.pki-trade-tabs a span { padding: 0 8px; border-radius: 99px; background: var(--pki-grey-bg); font-size: 12px; font-weight: 700; }
.pki-trade-tabs a[aria-current="page"] span { background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-trade-bar > .pki-btn { margin-bottom: 6px; }

/* Rates (from the rate card) */
.pki-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 4px; }
.pki-card-head h2 { margin: 0; }
.pki-rate-group { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.pki-rate-group legend { padding: 0; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--pki-muted); }
.pki-rate-group legend .pki-tag { text-transform: none; letter-spacing: 0; margin-left: 4px; }
.pki-rate-rows { border: 1px solid var(--pki-border); border-radius: 10px; overflow: hidden; }
.pki-rate-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px 170px; gap: 12px; align-items: center; padding: 7px 12px; }
.pki-rate-row + .pki-rate-row { border-top: 1px solid var(--pki-border); }
.pki-rate-row label { font-weight: 600; }
.pki-rate-row .pki-affix input { min-width: 0; padding-top: 6px; padding-bottom: 6px; }
.pki-rate-row .pki-affix em:last-child { padding: 0 10px; font-size: 12px; white-space: nowrap; }
.pki-rate-row.is-custom { background: var(--pki-amber-bg); }
.pki-rate-row.is-custom .pki-affix { border-color: #e9b949; }
.pki-rate-state { font-size: 12px; }
.pki-rate-card { color: var(--pki-muted); }
.pki-rate-reset { display: none; color: var(--pki-amber); font-weight: 600; text-align: left; }
.pki-rate-row.is-custom .pki-rate-card { display: none; }
.pki-rate-row.is-custom .pki-rate-reset { display: inline; }
.pki-tag-custom { background: var(--pki-amber-bg); color: var(--pki-amber); }
@media (max-width: 720px) {
  .pki-rate-row { grid-template-columns: minmax(0, 1fr) 150px; }
  .pki-rate-state { grid-column: 1 / -1; margin-top: -6px; }
}

/* Contract */
.pki-contract-now { padding: 12px 14px; margin-bottom: 12px; border-radius: 10px; background: var(--pki-bg); border: 1px solid var(--pki-border); }
.pki-contract-now.is-signed { background: var(--pki-teal-bg); border-color: #b5e3dd; }
.pki-contract-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 8px; }
.pki-pill-contract-open { background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-pill-contract-opened { background: var(--pki-amber-bg); color: var(--pki-amber); }
.pki-pill-contract-signed { background: var(--pki-green-bg); color: var(--pki-green); }
.pki-pill-contract-expired, .pki-pill-contract-void { background: var(--pki-red-bg); color: var(--pki-red); }
.pki-contract-steps { list-style: none; margin: 0 0 12px; padding: 0; font-size: 13px; }
.pki-contract-steps li { position: relative; padding: 2px 0 6px 20px; color: var(--pki-muted); }
.pki-contract-steps li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #b8c7d6; background: #fff; }
.pki-contract-steps li.is-done { color: var(--pki-text); }
.pki-contract-steps li.is-done::before { border-color: var(--pki-green); background: var(--pki-green); }
.pki-contract-steps li.is-failed { color: var(--pki-red); }
.pki-contract-steps li.is-failed::before { border-color: var(--pki-red); background: var(--pki-red); }
.pki-copy { display: flex; gap: 6px; margin-bottom: 10px; }
.pki-copy input { flex: 1; min-width: 0; font-size: 12px; color: var(--pki-muted); }
.pki-contract-actions { margin-bottom: 6px; }
.pki-contract-actions .pki-field { margin-bottom: 8px; }
.pki-contract .pki-field legend { font-size: 12.5px; font-weight: 600; color: var(--pki-muted); margin-bottom: 4px; padding: 0; }
.pki-contract fieldset.pki-field { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
.pki-contract-new > summary, .pki-contract-history > summary { cursor: pointer; font-weight: 600; color: var(--pki-blue-dark); margin-bottom: 10px; }
.pki-contract-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.pki-contract-history ul { margin: 0; padding-left: 18px; font-size: 13px; }
.pki-contract-details { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 10px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #b5e3dd; font-size: 12.5px; }
.pki-contract-details dt { color: var(--pki-muted); }
.pki-contract-details dd { margin: 0; overflow-wrap: anywhere; }

/* Countersigning: the signature box from the agreement page */
.pki-countersign { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--pki-border); }
.pki-countersign .pkc-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; }
.pki-countersign .pkc-label { font-size: 12.5px; font-weight: 600; color: var(--pki-muted); }
.pki-countersign .pkc-req, .pki-countersign .pkc-error { color: var(--pki-red); }
.pki-countersign .pkc-error { font-size: 12.5px; font-weight: 600; }
.pki-countersign input[type=text], .pki-countersign input[type=email] { width: 100%; }
.pki-diff { margin: 12px 0; padding: 12px 14px; border: 1px solid #f0c36d; border-radius: 10px; background: var(--pki-amber-bg); }
.pki-diff p { margin: 0 0 8px; }
.pki-diff-table { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 13px; }
.pki-diff-table th, .pki-diff-table td { padding: 6px 8px; border-top: 1px solid #f0dcb0; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.pki-diff-table thead th { border-top: 0; font-size: 12px; color: var(--pki-muted); font-weight: 600; }
.pki-diff-table td:first-child { width: 24px; }
.pki-diff-table del { color: var(--pki-muted); }
.pki-diff-table ins { text-decoration: none; font-weight: 600; }
.pkc-pad { position: relative; height: 130px; border: 1.5px dashed #9fb6cc; border-radius: 10px; background: #fbfdff; touch-action: none; user-select: none; -webkit-user-select: none; }
.pkc-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.pkc-pad-hint { position: absolute; left: 10px; bottom: 10px; font-size: 12px; color: #8aa0b8; pointer-events: none; }
.pkc-pad .pkc-link { position: absolute; right: 6px; top: 4px; border: 0; background: none; color: var(--pki-blue-dark); font-size: 12px; cursor: pointer; text-decoration: underline; }
.pkc-typed-preview { display: flex; align-items: center; min-height: 70px; padding: 6px 12px; border: 1px solid var(--pki-border); border-radius: 10px; background: #fbfdff; }
.pkc-typed-sig { font-family: "Snell Roundhand", "Segoe Script", "Brush Script MT", "Apple Chancery", cursive; font-size: 28px; color: #142f63; }
.pki-countersign .pkc-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; cursor: pointer; }
.pki-countersign .pkc-agree { padding: 8px 10px; border-radius: 8px; background: var(--pki-ice); }
.pki-countersign .has-error .pkc-pad, .pki-countersign .has-error input { border-color: var(--pki-red); }
.pki-sig-thumb { display: block; max-width: 180px; max-height: 60px; }

/* Stage on the installer page */
.pki-stage-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 2px 0 8px; }
.pki-stage-form .pki-sub { font-size: 12.5px; padding: 2px 10px; text-decoration: none; }
.pki .pki-stage-form select { width: auto; min-height: 0; height: 28px; padding: 2px 26px 2px 8px; font-size: 12.5px; border-radius: 8px; }
.pki-sub-none { background: var(--pki-grey-bg); color: var(--pki-muted); }

/* ----- Orders dashboard ----- */
.pki-wide { max-width: none; }
.pki-progress-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.pki-order-search { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pki-order-search input[type=search] { min-width: 260px; }
.pki-orders-board { grid-auto-columns: minmax(250px, 1fr); }
.pki-order-col-booked { --pki-board: #7c4dcc; }
.pki-order-col-survey { --pki-board: #008ce5; }
.pki-order-col-ready { --pki-board: #d97706; }
.pki-order-col-scheduled { --pki-board: #00756b; }
.pki-order-col-completed, .pki-order-col-awaiting_payment { --pki-board: #8a9bb0; }
.pki-order-card { cursor: default; }
.pki-pill-done { background: var(--pki-green-bg); color: var(--pki-green); border: 0; }
.pki-pill-todo { background: #fff; color: var(--pki-muted); border: 1px dashed #b8c6d4; }
.pki-pill-wa { background: #e3f6ed; color: #0c6b45; }
.pki-order-labels { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pki-label-form, .pki-inline { display: inline; margin: 0; }
.pki-label-form .pki-pill { cursor: pointer; font: inherit; font-size: 12.5px; padding: 4px 10px; }
.pki-inline-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin: 8px 0; }
.pki-inline-form .pki-field { margin: 0; }
.pki-facts { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr); gap: 6px 12px; margin: 0 0 12px; font-size: 14px; }
.pki-facts dt { color: var(--pki-muted); }
.pki-facts dd { margin: 0; overflow-wrap: anywhere; }
.pki-ok { color: var(--pki-green); }
.pki-tabs { display: flex; gap: 4px; margin: 0 0 10px; border-bottom: 1px solid var(--pki-border); }
.pki-tabs a { padding: 6px 12px; border-radius: 8px 8px 0 0; color: var(--pki-text); text-decoration: none; font-weight: 600; }
.pki-tabs a[aria-current="page"] { background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-match-table td, .pki-match-table th { vertical-align: top; }
.pki-match-table .pki-match-group th { background: #f3f6fa; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--pki-muted); text-align: left; }
.pki-match-tags { display: block; margin: 3px 0 1px; }
.pki-match-pill-0 { background: var(--pki-green-bg); color: var(--pki-green); }
.pki-match-pill-1 { background: var(--pki-teal-bg); color: var(--pki-teal); }
.pki-match-pill-2 { background: var(--pki-blue-bg); color: var(--pki-blue-dark); }
.pki-match-pill-3 { background: var(--pki-grey-bg); color: var(--pki-muted); }
.pki-match-table tr.is-declined td { opacity: .55; }
.pki-offer-send { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 8px 12px; align-items: end; margin-top: 12px; }
.pki-offer-send .pki-span-2, .pki-offer-send button { grid-column: 1 / -1; justify-self: start; }
.pki-match-days { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.pki-wa-form + h3, .pki-wa h3 { margin-top: 18px; }
@media (max-width: 700px) { .pki-offer-send { grid-template-columns: 1fr; } .pki-facts { grid-template-columns: 1fr; } .pki-facts dt { margin-top: 6px; } }
/* Loading: a bar across the top, and a spinner on the pressed button (app.js). */
.pki-loading { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100000; overflow: hidden; background: #008ce522; }
.pki-loading::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--pki-blue, #008ce5); animation: pki-loading 1.1s ease-in-out infinite; }
html.pki-is-loading body { cursor: progress; }
.is-busy { pointer-events: none; opacity: .8; }
.is-busy::before { content: ""; display: inline-block; flex: none; width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pki-spin .7s linear infinite; }
.pki-btn.is-busy::before { margin-right: 0; }
@keyframes pki-loading { to { left: 100%; } }
@keyframes pki-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .pki-loading::before { left: 0; width: 100%; animation: pki-pulse 1.4s ease-in-out infinite alternate; }
    .is-busy::before { animation-duration: 1.6s; }
}
@keyframes pki-pulse { from { opacity: .35; } to { opacity: 1; } }
/* Orders: who has the job, rates in the installer list, installers' answers. */
.pki-assigned { border: 1px solid var(--pki-green, #0e7a3e); background: var(--pki-green-bg, #dcf3e5); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
.pki-assigned p { margin: 0 0 6px; }
.pki-assigned-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pki-rate-input { display: inline-flex; align-items: center; gap: 3px; }
.pki-rate-input input { width: 76px; padding: 5px 7px; }
.pki-match-table tr.is-assigned td { background: var(--pki-green-bg, #dcf3e5); }
.pki-answer-accept { color: var(--pki-green, #0e7a3e); }
.pki-answer-other_window, .pki-answer-more_work, .pki-answer-question { color: #a15c00; }
.pki-answer-decline { color: var(--pki-muted); }
.pki-inline-form .pki-grow { flex: 1 1 220px; }
.pki-inline-form .pki-grow input { width: 100%; }
/* Job offer preview (orders): the message one ticked installer will get. */
.pki-offer-preview { margin-top: 14px; display: grid; gap: 8px; }
.pki-offer-preview-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.pki-offer-preview-head select { max-width: 100%; }
.pki-email-preview { border: 1px solid var(--pki-border, #dce7ef); border-radius: 10px; padding: 10px 12px; background: #f6f9fc; }
.pki-email-preview > p { margin: 0 0 8px; }
.pki-email-paper { background: #fff; border-radius: 8px; padding: 14px 16px; font-size: 14px; }
.pki-email-paper h3 { margin: 0 0 10px; font-size: 17px; }
.pki-email-paper p { margin: 0 0 10px; overflow-wrap: anywhere; }
.pki-email-button { display: inline-block; padding: 8px 16px; border-radius: 8px; background: var(--pki-blue, #008ce5); color: #fff; font-weight: 600; }
.pki-email-button:empty { display: none; }
/* An email on an installer's timeline: its words folded away. */
.pki-note-email { margin-top: 4px; }
.pki-note-email summary { cursor: pointer; font-size: 13px; color: var(--pki-blue-dark, #0070c0); }
.pki-note-email > div { margin-top: 6px; padding: 10px 12px; border-left: 3px solid var(--pki-border, #dce7ef); background: #f8fbfd; font-size: 13.5px; }
/* Customers and callbacks (orders dashboard). */
.pki-cust-lead { background: var(--pki-blue-bg, #e5f2fc); color: var(--pki-blue-dark, #0070c0); }
.pki-cust-ongoing { background: var(--pki-amber-bg, #fff4d6); color: #8a5a00; }
.pki-cust-completed { background: var(--pki-green-bg, #dcf3e5); color: var(--pki-green, #0e7a3e); }
.pki-cust-closed { background: var(--pki-grey-bg, #eef1f4); color: var(--pki-muted); }
.pki-cust-table td { vertical-align: top; }
.pki-add-customer { margin: 0 0 14px; }
.pki-add-customer summary { cursor: pointer; }
.pki-cust-orders { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pki-callbacks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.pki-callback { border: 1px solid var(--pki-border, #dce7ef); border-radius: 10px; padding: 10px 12px; background: #fff; }
.pki-callback.is-overdue { border-color: #e0a800; }
.pki-callback-done, .pki-callback-cancelled { background: #f8fafc; }
.pki-callback p { margin: 4px 0; }
.pki-callback-context, .pki-callback-outcome { margin: 6px 0; padding: 8px 10px; background: #f6f9fc; border-radius: 8px; font-size: 13.5px; }
.pki-callback-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: 6px; }
.pki-callback-actions details[open] { flex-basis: 100%; }
.pki-callback-actions summary { list-style: none; display: inline-flex; }
.pki-callback-actions summary::-webkit-details-marker { display: none; }
.pki-callback-actions textarea { width: 100%; margin: 6px 0; }
.pki-overdue { color: #a15c00; }
.pki-inline-form .pki-span-all { flex-basis: 100%; }
.pki-inline-form .pki-span-all textarea { width: 100%; }
.pki-pager { display: flex; gap: 10px; align-items: center; margin: 14px 0; }
.pki-cust-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; flex: 1 1 520px; }
.pki-cust-search input[type=search] { flex: 1 1 260px; width: auto; }
.pki-cust-search select { width: auto; flex: 0 1 auto; }
.pki-detail-head .pki-inline select { width: auto; min-width: 180px; }
.pki-handback { border: 1px solid #f0cf8a; background: #fff8e6; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
.pki-handback p { margin: 0 0 8px; }
.pki-handback textarea { width: 100%; }
/* Job sheets. */
.pki-sheet-assigned { background: var(--pki-blue-bg, #e5f2fc); color: var(--pki-blue-dark, #0070c0); }
.pki-sheet-scheduled { background: #fff4d6; color: #8a5a00; }
.pki-sheet-finished { background: #f3e8ff; color: #6b21a8; }
.pki-sheet-paid { background: var(--pki-green-bg, #dcf3e5); color: var(--pki-green, #0e7a3e); }
.pki-sheet-cancelled { background: var(--pki-grey-bg, #eef1f4); color: var(--pki-muted); }
.pki-sheet-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* Job packs: what the installer gets on their job sheet */
.pki-pack-shared { background: var(--pki-green-bg, #dcf3e5); color: var(--pki-green, #0e7a3e); }
.pki-pack-draft { background: #fff4d6; color: #8a5a00; }
.pki-pack-h3 { font-size: 15px; margin: 18px 0 6px; }
.pki-pack-pick { border: 1px solid var(--pki-border, #dde3ea); border-radius: 10px; padding: 10px 12px; margin: 8px 0 12px; min-width: 0; }
.pki-pack-pick legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.pki-pack-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pki-pack-photo { position: relative; display: grid; gap: 4px; font-size: 12px; color: var(--pki-muted); cursor: pointer; }
.pki-pack-photo input { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; margin: 0; z-index: 1; }
.pki-pack-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 2px solid transparent; display: block; background: var(--pki-grey-bg, #eef1f4); }
.pki-pack-photo:has(input:checked) img { border-color: var(--pki-blue, #0a84d6); }
.pki-pack-photo:has(input:not(:checked)) img { opacity: .45; }
.pki-pack-files { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.pki-pack-files li { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center; }
.pki-pack-files li > div { display: grid; gap: 2px; min-width: 0; }
.pki-pack-files input[type=text] { width: 100%; }
.pki-pack-files button { justify-self: start; }
.pki-pack-thumb { display: grid; place-items: center; width: 72px; height: 54px; border-radius: 8px; overflow: hidden; background: var(--pki-grey-bg, #eef1f4); color: var(--pki-muted); font-weight: 700; font-size: 12px; text-decoration: none; }
.pki-pack-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pki-pack-upload { border-top: 1px solid var(--pki-border, #dde3ea); padding-top: 12px; margin-top: 4px; }
.pki-new-sheet { margin: 0 0 12px; }
#share form.pki-inline { display: block; margin: 0 0 8px; }
.pki-pack-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The job pack's document editor, and the document as shown */
.pki-editor { border: 1px solid var(--pki-border, #dde3ea); border-radius: 10px; background: #fff; margin: 8px 0; }
.pki-editor.is-busy { opacity: .6; pointer-events: none; }
.pki-editor-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--pki-border, #dde3ea); background: var(--pki-grey-bg, #f4f6f8); border-radius: 10px 10px 0 0; }
.pki-editor-bar button { border: 1px solid transparent; background: none; border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; }
.pki-editor-bar button:hover { background: #fff; border-color: var(--pki-border, #dde3ea); }
.pki-editor-sep { width: 1px; background: var(--pki-border, #dde3ea); margin: 2px 4px; }
.pki-editor-picker { padding: 10px; border-bottom: 1px solid var(--pki-border, #dde3ea); max-height: 320px; overflow: auto; }
.pki-editor-picker .pki-pack-photo { border: 0; background: none; padding: 0; text-align: left; font: inherit; font-size: 12px; }
.pki-editor-picker .pki-pack-photo img { opacity: 1; }
.pki-editor-area { min-height: 320px; padding: 14px 18px; outline: none; }
.pki-doc { line-height: 1.55; }
.pki-doc h2 { font-size: 19px; margin: 18px 0 6px; }
.pki-doc h3 { font-size: 16px; margin: 14px 0 4px; }
.pki-doc p, .pki-doc ul, .pki-doc ol { margin: 0 0 10px; }
.pki-doc blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 4px solid var(--pki-blue, #0a84d6); background: #eef7fd; }
.pki-doc figure { margin: 10px 0 14px; }
.pki-doc img { display: block; max-width: min(100%, 520px); border-radius: 8px; }
.pki-doc figcaption { font-size: 13px; color: var(--pki-muted); margin-top: 4px; }
.pki-doc em { color: #8a5a00; }
.pki-job-notes { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.pki-job-note { padding: 8px 12px; border-radius: 10px; background: var(--pki-grey-bg, #f4f6f8); max-width: 85%; }
.pki-job-note.is-mine { background: #eef7fd; justify-self: end; }
.pki-job-note-meta { font-size: 12px; color: var(--pki-muted); margin-bottom: 2px; }
.pki-completion .pki-pack-photos { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.pki-completion .pki-pack-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; }
.pki-completion-submitted { background: #fff4d6; color: #8a5a00; }
.pki-completion-accepted { background: var(--pki-green-bg, #dcf3e5); color: var(--pki-green, #0e7a3e); }
.pki-completion-returned { background: #fde8e8; color: #b42318; }
.pki-save-bar { position: sticky; bottom: 0; z-index: 3; margin: 14px -20px -20px; padding: 10px 20px; background: #fffffff2; border-top: 1px solid var(--pki-border, #dde3ea); border-radius: 0 0 12px 12px; }
.pki-save-bar .pki-pack-actions { margin: 0; align-items: center; }

/* Order cards: who, where, who's on it, what's next, the date */
.pki-order-card { position: relative; display: grid; gap: 3px; }
.pki-order-card .pki-board-link { padding-right: 28px; }
.pki-order-people { font-size: 12px; color: var(--pki-muted); }
.pki-order-next { font-size: 13px; font-weight: 600; color: var(--pki-board, var(--pki-blue-dark, #0070c0)); }
.pki-order-next::before { content: '→ '; }
.pki-order-date { justify-self: start; margin-top: 2px; }
.pki-order-unread { position: absolute; top: 10px; right: 10px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #25d366; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.pki-stage-help { margin: 6px 0 2px; max-width: 70ch; }
.pki-order-next-big { font-size: 15px; margin: 4px 0 8px; color: var(--pki-blue-dark, #0070c0); }
.pki-order-next-big::before { content: ''; }

/* Folded sections on the order page: a title and a one-line summary, opened when needed */
.pki-fold { padding: 0; }
.pki-fold > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 16px 20px; border-radius: inherit; }
.pki-fold > summary::-webkit-details-marker { display: none; }
.pki-fold > summary::before { content: '▸'; color: var(--pki-muted); font-size: 13px; transition: transform .15s; align-self: center; }
.pki-fold[open] > summary::before { transform: rotate(90deg); }
.pki-fold > summary h2 { margin: 0; font-size: 17px; }
.pki-fold > summary:hover { background: var(--pki-grey-bg, #f4f6f8); }
.pki-fold-sum { font-size: 13px; color: var(--pki-muted); }
.pki-fold[open] > summary .pki-fold-sum { display: none; }
.pki-fold-body { padding: 0 20px 18px; }
.pki-login-panel { margin: 10px 0 14px; padding: 10px 12px; border: 1px solid var(--pki-border, #dde3ea); border-radius: 10px; }
.pki-login-panel h4, #jobs h4 { margin: 0 0 6px; }
.pki-avail.is-all { color: var(--pki-green, #0e7a3e); } .pki-avail.is-some { color: #8a5a00; } .pki-avail.is-none { color: #b42318; font-weight: 600; }
.pki-periods { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.pki-periods li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--pki-grey-bg, #f4f6f8); }
/* Installer page: the left column holds the details and their jobs, availability and contract */
.pki-detail-main { min-width: 0; }
.pki-detail-main .pki-savebar { margin-bottom: 16px; }
.pki-login-panel > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pki-login-panel > summary::-webkit-details-marker { display: none; }
.pki-login-panel > summary::before { content: '▸'; color: var(--pki-muted); font-size: 12px; transition: transform .15s; }
.pki-login-panel[open] > summary::before { transform: rotate(90deg); }
.pki-login-panel[open] > summary { margin-bottom: 8px; }
.pki-more-jobs { margin: 4px 0 12px; }
.pki-more-jobs > summary { cursor: pointer; color: var(--pki-blue-dark, #0070c0); }
.pki-survey-embed { margin: 12px 0; }
.pki-survey-embed iframe { width: 100%; height: 600px; border: 1px solid var(--pki-border, #dde3ea); border-radius: 10px; background: #fff; display: block; }

/* The plan: what's new from the survey, with its button */
.pki-plan-news { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; justify-content: space-between; }

/* The plan's versions sent to the customer */
.pki-plan-versions-h { font-size: 15px; margin: 18px 0 6px; }
.pki-plan-versions { list-style: none; margin: 0 0 14px; padding: 0; }
.pki-plan-versions li { padding: 6px 0; border-top: 1px solid var(--pki-border, #dde3ea); font-size: 14px; }
.pki-plan-versions li.is-signed strong { color: #13795b; }
@media print { .pki-no-print, .pki-header { display: none !important; } }

/* An order's installers: those invited for the job (where it stands, notes), and finding more (folded) */
.pki-invited h3 { font-size: 15px; margin: 12px 0 8px; }
.pki-invited-list { list-style: none; margin: 0 0 12px; padding: 0; }
.pki-invited-row { border: 1px solid var(--pki-border, #dde3ea); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.pki-invited-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.pki-invited-row p { margin: 4px 0; }
.pki-invited-state { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: #fff4d6; color: #7a5300; }
.pki-invited-state.is-ok { background: #e3f5ec; color: #13795b; }
.pki-invited-state.is-no { background: #f3f4f6; color: #5f6b7a; }
.pki-invited-notes { list-style: none; margin: 6px 0; padding: 6px 0 0; border-top: 1px dashed var(--pki-border, #dde3ea); font-size: 14px; }
.pki-invited-notes li { margin: 3px 0; }
.pki-invited-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px; margin-top: 6px; }
.pki-invited-actions .pki-inline-form { flex: 1 1 380px; margin: 0; }
.pki-invite-more > summary { cursor: pointer; font-weight: 600; margin: 6px 0 10px; }
.pki-invited-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.pki-invited-link input { flex: 1 1 260px; min-width: 0; font-size: 13px; }

/* The home page: the portal, with the way into each dashboard. */
.pki-home-page .pki-login { grid-template-columns: minmax(0, 1fr); }
.pki-home-card { width: 100%; max-width: 820px; padding: 36px 32px 28px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.pki-home-card h1 { margin: 6px 0 0; color: var(--pki-navy); }
.pki-home-card p { margin: 0; }
.pki-home-logo { width: 240px; max-width: 70%; height: auto; }
.pki-home-options { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; margin: 16px 0 6px; }
.pki-home-option { display: grid; gap: 6px; justify-items: center; align-content: start; padding: 24px 18px; border: 1px solid var(--pki-border); border-radius: var(--pki-radius); background: var(--pki-bg); color: var(--pki-text) !important; text-decoration: none !important; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pki-home-option:hover, .pki-home-option:focus-visible { border-color: var(--pki-blue); box-shadow: 0 6px 20px #008ce51f; transform: translateY(-2px); }
.pki-home-option strong { font-size: 18px; color: var(--pki-navy); }
.pki-home-option .pki-muted { font-size: 13.5px; }
.pki-home-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--pki-ice); color: var(--pki-blue); }
.pki-home-orders .pki-home-icon { color: var(--pki-teal); }
.pki-home-studio .pki-home-icon { color: #7c4dcc; }
.pki-home-foot { color: var(--pki-muted); }
.pki-home-narrow { max-width: 420px; }
.pki-home-form { width: 100%; display: grid; gap: 14px; margin-top: 10px; text-align: left; }
@media (max-width: 480px) { .pki-home-card { padding: 28px 18px 22px; } }
