/* === agent a3: customer page (Now, work by site, detail drawers), context trail, data states, light drawer === */

/* ---- context trail: Customer > Site > Project > Ticket */
.ctx { min-width: 0; font-size: 12px; line-height: 1.3; color: var(--muted); }
.ctx ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; min-width: 0; }
.ctx li { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.ctx li + li::before { content: ""; width: 6px; height: 6px; margin: 0 8px 0 6px; border-right: 1.5px solid var(--faint); border-top: 1.5px solid var(--faint); transform: rotate(45deg); flex: none; opacity: .8; }
.ctx a { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--ink-2); font-weight: 500; border-radius: 6px; padding: 1px 3px; margin: -1px -3px; }
.ctx a span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 26ch; }
.ctx a .ico { color: var(--mod); flex: none; }
.ctx a:hover { color: var(--ink); text-decoration: none; background: rgb(var(--mod-rgb) / .08); }
.ctx-self { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 32ch; }
.ctx-more { margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 6px; border-radius: var(--r-pill); background: rgb(var(--mod-rgb) / .08); }
.ctx-none { gap: 8px; flex-wrap: wrap; }
.ctx-warn { display: inline-flex; align-items: center; gap: 4px; color: var(--warn); font-weight: 600; }
.ctx-maybe { color: var(--muted); }
.ctx-review, .ctx-retry { font-weight: 600; color: var(--link); background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.ctx-skel { display: inline-block; width: 220px; max-width: 60%; height: 10px; border-radius: 6px; background: rgb(var(--sg-blue-rgb, 36 61 144) / .08); }
.tk.gx .tk-head:has(> .tk-title > .ctx) { grid-template-areas: "ctx ctx" "eye eye" "h1 h1" "meta act"; }
.tk.gx .tk-title > .ctx { grid-area: ctx; margin: -4px 0 10px; }
@media (max-width: 980px) { .tk.gx .tk-head:has(> .tk-title > .ctx) { grid-template-areas: "ctx" "eye" "h1" "meta" "act"; } }
.fx-ctx { margin: 2px 0 4px; }
.pk-ctx { margin: 0 0 4px; }

/* ---- data states: none / not imported / not linked / could not load */
.ds { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgb(255 255 255 / .5); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-size: 13px; line-height: 1.45; }
.ds > .ico { margin-top: 2px; flex: none; }
.ds-t { flex: 1; min-width: 0; } .ds-t b { color: var(--ink-2); font-weight: 600; }
.ds-sm { padding: 8px 10px; font-size: 12.5px; border-radius: 12px; }
.ds-not_imported > .ico { color: var(--warn); }
.ds-not_linked { background: var(--warn-bg); } .ds-not_linked > .ico { color: var(--warn); }
.ds-error { background: var(--bad-bg); color: var(--bad); } .ds-error .ds-t b { color: var(--bad); } .ds-why { color: var(--ink-2); }
.ds-retry { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 0; background: rgb(255 255 255 / .8); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: var(--r-pill); padding: 3px 10px; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink); cursor: pointer; }
.ds-retry:hover { background: #fff; text-decoration: none; }
.ds-note { display: flex; align-items: center; gap: 6px; margin: 8px 2px 0; font-size: 12px; color: var(--muted); line-height: 1.4; flex-wrap: wrap; }
.ds-note .ico { color: var(--warn); flex: none; }

/* ---- header: roles, one-tap contact */
.c4-roles { gap: 6px !important; }
.c4-role { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; color: var(--sg-blue, var(--ink));
  background: rgb(var(--sg-blue-rgb, 36 61 144) / .07); box-shadow: inset 0 0 0 1px rgb(var(--sg-blue-rgb, 36 61 144) / .14); cursor: default; }
.c4-rel { font-size: 12px; color: var(--muted); padding: 0 4px; }
.c4-rel.sample { color: var(--warn); font-weight: 600; }

/* ---- page */
.c4 { display: flex; flex-direction: column; gap: 12px; max-width: 1040px; }
.c4-find { display: flex; align-items: center; gap: 12px; }
.c4-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 14px; border-radius: var(--r-pill); background: rgb(255 255 255 / .62);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .7), 0 1px 2px rgb(var(--sg-blue-rgb, 36 61 144) / .06); color: var(--muted); }
.c4-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; font-size: 13.5px; color: var(--ink); height: 100%; padding: 0; box-shadow: none; }
.c4-search:focus-within { background: #fff; box-shadow: 0 0 0 3px var(--focus-ring), inset 0 0 0 1px var(--focus); }
.c4 kbd, .c4-keys kbd { font: inherit; font-size: 11px; line-height: 16px; min-width: 18px; text-align: center; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 4px; background: rgb(255 255 255 / .7); color: var(--muted); }
.c4-keys { font-size: 12px; color: var(--faint); white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }

/* Now: three short answers */
.c4-now { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.c4-ans { background: var(--panel); border-radius: 20px; box-shadow: var(--glass-edge), var(--sh-1); padding: 14px 16px 12px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.c4-ans h3 { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.c4-ans h3 .ico { color: var(--mod); }
.c4-ans.warn h3 .ico { color: var(--warn); } .c4-ans.bad h3 .ico { color: var(--bad); } .c4-ans.calm h3 .ico { color: var(--good); }
.c4-ans.bad { box-shadow: var(--glass-edge), var(--sh-1), inset 3px 0 0 var(--bad); }
.c4-ans.warn { box-shadow: var(--glass-edge), var(--sh-1), inset 3px 0 0 var(--warn); }
.c4-head { margin: 0 0 4px; font-size: 15px; font-weight: 650; line-height: 1.3; letter-spacing: -.012em; color: var(--ink); }
.c4-head.calm { color: var(--good); }
.c4-quiet { margin: 0; font-size: 12.5px; color: var(--muted); }
.c4-link { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer; padding: 5px 8px; margin: 0 -8px; width: calc(100% + 16px);
  border-radius: 10px; color: var(--ink-2); transition: background .12s; }
.c4-link span { font-size: 13px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c4-link small { font-size: 12px; color: var(--muted); }
.c4-link:hover { background: rgb(var(--mod-rgb) / .06); }
.c4-link:active { transform: scale(.985); }
.c4-more { align-self: flex-start; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--link); cursor: pointer; }

/* Projects and work, grouped by site */
.c4-work { display: flex; flex-direction: column; gap: 10px; }
.c4-sech { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 6px 4px 0; }
.c4-sech h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.c4-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.c4-add { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 11px; border: 0; border-radius: var(--r-pill); background: rgb(255 255 255 / .66); box-shadow: inset 0 0 0 1px var(--line-2);
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; transition: background .12s, transform var(--press-ms) var(--ease-out); }
.c4-add:hover { background: #fff; } .c4-add:active { transform: scale(.97); }
.c4-site { background: var(--panel); border-radius: 20px; box-shadow: var(--glass-edge), var(--sh-1); padding: 14px 14px 10px; min-width: 0; }
.c4-site.quiet { background: rgb(255 255 255 / .5); }
.c4-site.unsited { box-shadow: var(--glass-edge), var(--sh-1), inset 3px 0 0 var(--warn); }
.c4-site-h { display: flex; gap: 10px; align-items: flex-start; padding: 0 2px 8px; }
.c4-site-ico { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; color: var(--mod); background: rgb(var(--mod-rgb) / .1); }
.unsited .c4-site-ico { color: var(--warn); background: var(--warn-bg); }
.c4-site-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.c4-site-name { align-self: flex-start; border: 0; background: none; padding: 0; font: inherit; font-size: 15px; font-weight: 650; letter-spacing: -.012em; color: var(--ink); cursor: pointer; text-align: left; border-radius: 6px; }
.c4-site-name:hover { color: var(--link); }
.c4-site-name.static { cursor: default; } .c4-site-name.static:hover { color: var(--ink); }
.c4-site-facts, .c4-site-sys { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.c4-site-sys span { display: inline-flex; align-items: center; gap: 4px; } .c4-site-sys .ico { color: var(--faint); }
.c4-chip { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 8px; line-height: 1.3; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: rgb(var(--mod-rgb) / .08); }
a.c4-chip:hover { text-decoration: none; background: rgb(var(--mod-rgb) / .14); }
.c4-chip.maybe { background: none; box-shadow: inset 0 0 0 1px var(--line-3); color: var(--muted); font-weight: 500; }
.c4-rows { display: flex; flex-direction: column; gap: 2px; }
.c4-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer;
  padding: 8px 8px; border-radius: 12px; color: var(--ink-2); transition: background .12s; text-decoration: none !important; }
.c4-row:hover { background: rgb(255 255 255 / .75); box-shadow: 0 1px 2px rgb(var(--sg-blue-rgb, 36 61 144) / .07); }
.c4-row:active { transform: scale(.992); }
.c4-row.nested { padding-left: 30px; grid-template-columns: 22px minmax(0, 1fr) auto; }
.c4-row.nested .c4-ico { width: 22px; height: 22px; }
.c4-row.closed { opacity: .64; }
.c4-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--mod); background: rgb(var(--mod-rgb) / .08); }
.c4-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.c4-title { font-size: 13.5px; font-weight: 500; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.c4-title b { font-weight: 650; font-variant-numeric: tabular-nums; }
.c4-sub { display: flex; gap: 10px; font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.c4-sub > span { overflow: hidden; text-overflow: ellipsis; }
.c4-next.none { color: var(--faint); }
.c4-owner { flex: none; }
.c4-owner::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 8px 2px 0; vertical-align: middle; }
.c4-sub > .c4-owner:first-child::before { display: none; }
.c4-meta { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; font-size: 12px; color: var(--muted); max-width: 300px; }
.c4-stage { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.c4-stage.t-open { background: #e8f0fe; color: #1f4fb0; } .c4-stage.t-wait { background: var(--warn-bg); color: var(--warn); } .c4-stage.t-go { background: var(--good-bg); color: var(--good); }
.c4-stage.t-hold { background: #f1ecfb; color: #5b3aa8; } .c4-stage.t-close { background: #e6f4f3; color: var(--teal); } .c4-stage.t-done { background: rgb(var(--sg-blue-rgb, 36 61 144) / .06); color: var(--muted); }
.c4-since { font-variant-numeric: tabular-nums; white-space: nowrap; }
.c4-due { white-space: nowrap; font-variant-numeric: tabular-nums; } .c4-due.late { color: var(--bad); font-weight: 600; }
.c4-amt { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.c4-fold { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 6px 8px; margin-top: 2px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--link); cursor: pointer; border-radius: 8px; }
.c4-fold:hover { background: rgb(var(--mod-rgb) / .06); }
.c4-quiet + .c4-fold, .c4-rows > .c4-quiet { padding: 4px 8px; }

/* Details: folded drawers */
.c4-details { background: var(--panel); border-radius: 20px; box-shadow: var(--glass-edge), var(--sh-1); padding: 4px 6px; }
.c4-drawer + .c4-drawer { border-top: 1px solid var(--line); }
.c4-drawer h3 { margin: 0; font-size: inherit; }
.c4-dh { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; padding: 11px 8px; border-radius: 12px; color: var(--ink); }
.c4-dh:hover { background: rgb(var(--mod-rgb) / .05); }
.c4-dh:disabled { cursor: default; color: var(--ink); }
.c4-dh > .ico:last-child { margin-left: auto; color: var(--faint); transition: transform .22s var(--ease-out); flex: none; }
.c4-drawer.open .c4-dh > .ico:last-child { transform: rotate(180deg); }
.c4-dico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--mod); background: rgb(var(--mod-rgb) / .08); }
.c4-dt { font-size: 14px; font-weight: 650; letter-spacing: -.01em; flex: none; }
.c4-dn { font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); display: inline-grid; place-items: center; background: rgb(var(--mod-rgb) / .1); color: var(--mod); font-variant-numeric: tabular-nums; flex: none; }
.c4-dsum { font-size: 12.5px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.c4-dbody { padding: 0 8px 12px 46px; display: flex; flex-direction: column; gap: 2px; animation: c4-open .22s var(--ease-out); }
@keyframes c4-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.c4-dbody .c4-row { margin-left: -38px; width: calc(100% + 38px); }
.c4-subh { margin: 8px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.c4-subh:first-child { margin-top: 0; }
.c4-plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.c4-plist li { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 0 12px; padding: 6px 0; font-size: 13px; align-items: baseline; }
.c4-plist li + li { border-top: 1px solid var(--line); }
.c4-plist li small { grid-column: 2; font-size: 12px; color: var(--muted); }
.c4-plist li.maybe a { color: var(--muted); }
.c4-prole { font-size: 12px; color: var(--muted); }
.c4-kv { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 0; font-size: 13px; }
.c4-kv dt { color: var(--muted); font-size: 12px; } .c4-kv dd { margin: 0; color: var(--ink-2); }
.c4-files { list-style: none; margin: 0; padding: 0; }
.c4-files li { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.c4-files a { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); padding: 5px 8px; margin-left: -8px; border-radius: 10px; }
.c4-files a span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .c4-files a .ico { color: var(--mod); flex: none; }
.c4-files a:hover { background: rgb(255 255 255 / .75); text-decoration: none; }
.c4-files small { font-size: 12px; color: var(--muted); flex: none; }
.c4-chips { align-self: flex-start; margin-bottom: 8px; }
.c4-dbody .c3-note { margin-bottom: 8px; }
.c4-dbody .ph-c3 { background: none; box-shadow: none; padding: 0; border-radius: 0; }
.c4-dbody .ph-c3 > header { margin-bottom: 4px; }
.c4-dbody .ph-c3 > header h3, .c4-dbody .ph-c3 > header .c3-count { display: none; }
.c4-dbody .tl { margin-top: 4px; }

/* focus: visible and calm everywhere on these screens */
.c4 :is(button, a, input):focus-visible, .ctx a:focus-visible, .ctx button:focus-visible, .c4-page .tk-actions :is(a, button):focus-visible, .pk-sheet :is(a, button):focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 4px var(--focus-ring); }
.c4-row:focus-visible, .c4-link:focus-visible, .c4-dh:focus-visible { outline-offset: -2px; background: rgb(255 255 255 / .85); }
.c4-search input:focus-visible { outline: none; box-shadow: none; }

/* light drawer (deals, projects, estimates, SOs, sites, visits) */
.pk-sheet { width: min(560px, 100vw); }
.pk-sheet:focus { outline: none; }
.pk-sheet .qv-title h2 { margin-bottom: 6px; }
.pk-facts { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 13.5px; }
.pk-facts dt { color: var(--muted); font-size: 12.5px; padding-top: 1px; } .pk-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.pk-long { margin-top: 14px; } .pk-long span { font-size: 12px; color: var(--muted); } .pk-long p { margin: 4px 0 0; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }

/* narrow */
@media (max-width: 1100px) { .c4-keys { display: none; } }
@media (max-width: 860px) {
  .c4-now { grid-template-columns: minmax(0, 1fr); }
  .c4-ans { padding: 12px 14px; }
}
@media (max-width: 700px) {
  .c4 { gap: 10px; }
  .c4-site { padding: 12px 10px 8px; border-radius: 18px; }
  .c4-row { grid-template-columns: 26px minmax(0, 1fr); padding: 8px 6px; }
  .c4-row .c4-meta { grid-column: 2; justify-content: flex-start; max-width: none; }
  .c4-row.nested { padding-left: 18px; grid-template-columns: 22px minmax(0, 1fr); }
  .c4-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .c4-dbody { padding-left: 8px; } .c4-dbody .c4-row { margin-left: 0; width: 100%; }
  .c4-dsum { display: none; }
  .c4-plist li, .c4-kv { grid-template-columns: minmax(0, 1fr); } .c4-plist li small { grid-column: 1; }
  .pk-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; } .pk-facts dd { margin-bottom: 8px; }
  .c4-page .tk-actions .c4-hact { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .c4-dbody { animation: none; }
  .c4-row, .c4-link, .c4-add, .c4-dh > .ico:last-child { transition: none; }
  .c4-row:active, .c4-link:active, .c4-add:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .c4-ans, .c4-site, .c4-details, .c4-search { background: var(--panel-solid, #fff); }
}
@media (prefers-contrast: more) {
  .c4-sub, .c4-dsum, .c4-count, .ctx, .c4-site-facts, .c4-site-sys { color: var(--ink-2); }
  .c4-chip.maybe { box-shadow: inset 0 0 0 1px var(--ink-2); }
}
