/* Karen OS: Settings → Connections (connections.js). Calm, Settings-style: one grouped list with
   hairline dividers, uniform logo tiles, dot-and-word status, rows that open in place, and a
   gallery of identical tiles. Built on the shared tokens and classes in styles.css (.btn, .link,
   .dot, .iconbtn, .msg, .empty). No inline styles: heights during the spring are set from JS. */

#v-settings-connections .view-in { gap: 24px; }
#v-settings-connections h1 { letter-spacing: -0.025em; }
#v-settings-connections .dateline { letter-spacing: 0; }
.cn-sec { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cn-h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); line-height: 1.3; }

/* ---- The logo tile: identical for every connection ---- */
.cn-logo { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: color-mix(in srgb, var(--ink) 80%, transparent);
  transition: color .2s ease, border-color .2s ease; box-sizing: border-box; }
.cn-logo i { width: 18px; height: 18px; display: block; background: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; }
.cn-logo.mono { font: 700 12px/1 var(--font); letter-spacing: 0.02em; }
/* A faint hint of the brand on hover or focus; the page stays monochrome at rest */
.cn-row:hover .cn-logo:not(.mono) i, .cn-row:focus-visible .cn-logo:not(.mono) i,
.cn-tile:hover .cn-logo:not(.mono) i, .cn-tile:focus-visible .cn-logo:not(.mono) i { background: color-mix(in srgb, var(--brand, var(--ink)) 70%, var(--ink)); }
.cn-row:hover .cn-logo, .cn-tile:hover .cn-logo { border-color: var(--input); }
.lg-xero { --brand: #13B5EA; } .lg-xero i { -webkit-mask-image: url(assets/logos/xero.svg); mask-image: url(assets/logos/xero.svg); }
.lg-n8n { --brand: #EA4B71; } .lg-n8n i { -webkit-mask-image: url(assets/logos/n8n.svg); mask-image: url(assets/logos/n8n.svg); }
.lg-trello { --brand: #0052CC; } .lg-trello i { -webkit-mask-image: url(assets/logos/trello.svg); mask-image: url(assets/logos/trello.svg); }
.lg-googlecalendar { --brand: #4285F4; } .lg-googlecalendar i { -webkit-mask-image: url(assets/logos/googlecalendar.svg); mask-image: url(assets/logos/googlecalendar.svg); }
.lg-gmail { --brand: #EA4335; } .lg-gmail i { -webkit-mask-image: url(assets/logos/gmail.svg); mask-image: url(assets/logos/gmail.svg); }
.lg-spotify { --brand: #1DB954; } .lg-spotify i { -webkit-mask-image: url(assets/logos/spotify.svg); mask-image: url(assets/logos/spotify.svg); }
.lg-anthropic { --brand: #191919; } .lg-anthropic i { -webkit-mask-image: url(assets/logos/anthropic.svg); mask-image: url(assets/logos/anthropic.svg); }
.lg-stripe { --brand: #635BFF; } .lg-stripe i { -webkit-mask-image: url(assets/logos/stripe.svg); mask-image: url(assets/logos/stripe.svg); }
.lg-googlemaps { --brand: #4285F4; } .lg-googlemaps i { -webkit-mask-image: url(assets/logos/googlemaps.svg); mask-image: url(assets/logos/googlemaps.svg); }
.lg-googledrive { --brand: #4285F4; } .lg-googledrive i { -webkit-mask-image: url(assets/logos/googledrive.svg); mask-image: url(assets/logos/googledrive.svg); }
.lg-meta { --brand: #0467DF; } .lg-meta i { -webkit-mask-image: url(assets/logos/meta.svg); mask-image: url(assets/logos/meta.svg); }
.lg-messenger { --brand: #0866FF; } .lg-messenger i { -webkit-mask-image: url(assets/logos/messenger.svg); mask-image: url(assets/logos/messenger.svg); }
.lg-googleads { --brand: #4285F4; } .lg-googleads i { -webkit-mask-image: url(assets/logos/googleads.svg); mask-image: url(assets/logos/googleads.svg); }
.lg-google { --brand: #4285F4; } .lg-google i { -webkit-mask-image: url(assets/logos/google.svg); mask-image: url(assets/logos/google.svg); }
.lg-formspree { --brand: #E5122E; } .lg-formspree i { -webkit-mask-image: url(assets/logos/formspree.svg); mask-image: url(assets/logos/formspree.svg); }
.lg-elevenlabs { --brand: #000000; } .lg-elevenlabs i { -webkit-mask-image: url(assets/logos/elevenlabs.svg); mask-image: url(assets/logos/elevenlabs.svg); }

/* ---- Your connections: one inset grouped list ---- */
.cn-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: 0 1px 2px rgba(22, 35, 29, .04); overflow: hidden; }
.cn-item { min-width: 0; }
.cn-item + .cn-item { border-top: 1px solid var(--divider); }
.cn-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 16px; border: 0; background: transparent;
  font: inherit; color: inherit; text-align: left; cursor: pointer; min-width: 0; transition: background-color .15s ease; }
.cn-row:hover { background: #FAFBFA; }
.cn-row:active { background: var(--ground); transition: none; }
.cn-row:focus-visible { outline: 2px solid var(--green-700); outline-offset: -2px; border-radius: 4px; }
.cn-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cn-nm { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-desc { font-size: 13px; color: var(--muted); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-st { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--grey-ink); white-space: nowrap; }
.cn-chev { flex: none; width: 16px; height: 16px; fill: none; stroke: #9AA8A1; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.cn-item.open .cn-chev { transform: rotate(90deg); }
.cn-item.open > .cn-row { background: transparent; }

/* The opened row (height is sprung from JS; at rest it's auto) */
.cn-detail { overflow: hidden; min-width: 0; }
.cn-fade { animation: cn-fade .18s ease-out; }
@keyframes cn-fade { from { opacity: 0; } to { opacity: 1; } }
.cn-inner { padding: 0 16px 16px 64px; display: flex; flex-direction: column; gap: 12px; min-width: 0; font-size: 14px; line-height: 1.45; color: var(--grey-ink); }
.cn-inner p { margin: 0; overflow-wrap: break-word; }
.cn-stline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--muted); }
.cn-stline .dot { margin-right: 2px; }
.cn-stline b { font-weight: 600; color: var(--ink); }
.cn-err { color: var(--red); }
.cn-quiet { color: var(--muted); }
.cn-fix { color: var(--ink); }
.cn-fix b { font-weight: 600; }
.cn-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.cn-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.cn-acts > .btn { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.cn-acts > .link { min-height: 44px; display: inline-flex; align-items: center; }
.cn-foot { margin-top: -4px !important; }
.cn-rm { min-height: 44px; font-weight: 500; }
.cn-extra { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* Secret names: quiet monospace chips, each with a copy icon */
.cn-need { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cn-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.cn-chips li { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; background: var(--ground); border: 1px solid var(--divider);
  border-radius: 8px; padding: 0 2px 0 10px; }
.cn-chips code { font: 500 13px/1.3 var(--mono); color: var(--ink); overflow-wrap: anywhere; min-width: 0; padding: 6px 0; }
.cn-copy { width: 32px; height: 32px; color: var(--muted); }
.cn-copy svg { width: 16px; height: 16px; }
.cn-copy.done { color: var(--green-700); }
.cn-where { font-size: 13px; color: var(--muted); }
.cn-where a { font-weight: 600; }

/* "How to set up" and the other disclosures */
.cn-how { min-width: 0; }
.cn-how > summary { cursor: pointer; font: 600 14px var(--font); color: var(--green-700); min-height: 44px; display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.cn-how > summary::-webkit-details-marker { display: none; }
.cn-how > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s ease; margin: 0 4px 0 1px; }
.cn-how[open] > summary::before { transform: rotate(45deg); }
.cn-how > :not(summary) { margin-top: 4px; }
.cn-how > :not(summary) + :not(summary) { margin-top: 10px; }
.cn-steps { margin: 0; padding-left: 20px; color: var(--grey-ink); }
.cn-steps li { overflow-wrap: break-word; }
.cn-steps li + li { margin-top: 4px; }
.cn-check { background: var(--amber-bg); color: var(--amber); font-weight: 600; border-radius: 4px; padding: 0 3px; }

/* Extras some connections show (n8n deliveries, freight sites, AI spend) */
.cn-line { color: var(--grey-ink); overflow-wrap: break-word; }
.cn-line .kicker { margin-right: 4px; }
.cn-kindlist { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.cn-kindlist li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--divider); min-width: 0; }
.cn-kindlist li:last-child { border-bottom: 0; }
.cn-kindlist li span { color: var(--grey-ink); min-width: 0; overflow-wrap: anywhere; }
.cn-kindlist li b { font-weight: 500; color: var(--ink); flex: none; text-align: right; }
.cn-kindlist li b.old { color: var(--amber); }
.cn-kindlist li b.none { color: var(--muted); }
.cn-kindlist li b.bad { color: var(--red); }
.cn-kindlist .code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cn-sites { border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.cn-siteadd { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: 1px solid var(--divider); }
.cn-siteadd b { font-size: 14px; font-weight: 600; color: var(--ink); }
.cn-spend { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 12px; font-size: 14px; }
.cn-spend label { font-size: 13px; font-weight: 600; color: var(--muted); }
.cn-spend meter { width: 100%; height: 8px; }
.cn-spend span { grid-column: 1 / -1; color: var(--muted); }

/* Remove, confirmed in place */
.cn-remove { border-top: 1px solid var(--divider); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cn-rmhead { font-weight: 600; color: var(--ink); }
.cn-field { max-width: 340px; }
.cn-field label.l { margin: 0 0 6px; }
.cn-field input[type=text] { width: 100%; min-height: 44px; }
.btn.primary.danger { background: var(--red); border-color: var(--red); }
.btn.primary.danger:hover { background: #861E16; border-color: #861E16; }
.cn-setup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; }
.cn-setup p { margin: 0; color: var(--ink); }

/* ---- Add a connection: search, then identical tiles ---- */
.cn-cat + .cn-cat { margin-top: 20px; }
.cn-cathead { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.cn-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr)); grid-auto-rows: auto; gap: 8px; }
.cn-tile { display: flex; align-items: center; gap: 12px; height: 76px; padding: 0 14px; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.cn-tile:hover { border-color: var(--input); }
.cn-tile:active { background: var(--ground); transition: none; }
.cn-tile:focus-visible { outline: 2px solid var(--green-700); outline-offset: 1px; }
.cn-tile.open { border-color: var(--green-700); }
.cn-ttxt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cn-tnm { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: break-word; }
.cn-tsub { font-size: 13px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-gx { grid-column: 1 / -1; overflow: hidden; min-width: 0; }
.cn-gx > .cn-inner { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 0; }
.cn-gxhead { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.cn-gxhead .cn-nm { white-space: normal; }
.cn-x { flex: none; margin: -4px -6px 0 0; }

.cn-offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }

@media (max-width: 560px) {
  .cn-row { padding: 12px; gap: 10px; }
  .cn-inner { padding: 0 12px 16px; }
  .cn-gx > .cn-inner { padding: 14px; }
  .cn-st { font-size: 13px; }
  }
@media (pointer: coarse) {
  .cn-copy, .cn-x { width: 44px; height: 44px; }
  .cn-row { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .cn-chev, .cn-how > summary::before, .cn-logo, .cn-row, .cn-tile { transition: none; }
}

/* Add a connection: folded away until someone wants it (calm pass, Oct 2026) */
.cn-addsec > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; color: var(--grey-ink); }
.cn-addsec > summary::-webkit-details-marker { display: none; }
.cn-addsec > summary::after { content: "▾"; font-size: 13px; color: var(--muted); }
.cn-addsec[open] > summary::after { content: "▴"; }
.cn-addsec[open] { gap: 12px; }

.cn-q { margin: 12px 0 16px; }

/* ---- Karen's workflows (workflows.js): failures first, then one table grouped by area ---- */
#v-workflows .wf-fails { margin-bottom: 20px; }
#v-workflows .wf-table .wf-grp th { background: var(--ground); font-size: 13px; font-weight: 700; color: var(--grey-ink); text-transform: none; letter-spacing: 0; padding: 10px 16px; }
#v-workflows .wf-table .wf-grp .n { color: var(--muted); font-weight: 600; margin-left: 4px; }
#v-workflows .wf-when { font-size: 13px; margin-left: 4px; }
@media (max-width: 760px) { #v-workflows .wf-table .wf-grp { display: block; } #v-workflows .wf-table .wf-grp th { display: block; } }
