/* The plugin detail sheet (public/plugin-detail.js): one layout for phone,
   web and the Mac app. Rule zero: 17 pt text, 44 pt targets, pills. */
.modal.dialog:has(.plugin-detail) { max-width: 480px; }
.modal.dialog:has(.plugin-detail:not(.pd-small)) .modal-head { border-bottom: 0; min-height: 0; padding-bottom: 0; }
.plugin-detail { display: flex; flex-direction: column; gap: var(--space-5, 24px); font-size: 17px; color: var(--ink); }
.plugin-detail.pd-small { gap: var(--space-4, 16px); }

.pd-head { display: flex; align-items: center; gap: 16px; }
.pd-head .integration-logo { width: 64px; height: 64px; flex: none; border-radius: 16px; border: 1px solid var(--line-2); background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
:root:not([data-theme="light"]) .pd-head .integration-logo { background: #1c1c1c; }
.pd-head .integration-logo img { width: 40px; height: 40px; object-fit: contain; }
.pd-head .integration-logo.has-logo > svg { display: none; }
.pd-head h2 { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.2; }
.pd-status { margin: 4px 0 0; color: var(--ink-3); font-size: 17px; }
.pd-lede { margin: 0; color: var(--ink-2); font-size: 17px; line-height: 1.4; }
.pd-muted { margin: 0; color: var(--ink-3); font-size: 17px; }

.pd-section h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--ink); }

/* Accounts: one row each, its own ⋯ */
.pd-accounts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-account { border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); }
.pd-account.is-open { border-color: var(--line-3, var(--line-2)); }
.pd-account-row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 6px 8px 12px; }
.pd-mark { position: relative; flex: none; width: 40px; height: 40px; }
.pd-mark .integration-logo { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
:root:not([data-theme="light"]) .pd-mark .integration-logo { background: #1c1c1c; }
.pd-mark .integration-logo img { width: 24px; height: 24px; object-fit: contain; }
.pd-mark .integration-logo.has-logo > svg { display: none; }
.pd-mark .integration-logo > svg { width: 20px; height: 20px; color: var(--ink-3); }
.pd-dot { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border: 2px solid var(--panel); border-radius: 50%; background: var(--ink-3); }
.pd-dot.is-on { background: var(--green); }
.pd-dot.is-warn { background: var(--amber); }
.pd-account-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-account-main strong { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-account-main span { color: var(--ink-3); font-size: 16px; }
.pd-account-main em { font-style: normal; color: var(--amber); }
.pd-more { width: var(--tap-min); height: var(--tap-min); flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; }
.pd-more svg { width: 24px; height: 24px; }
.pd-more:is(:hover, :focus-visible, [aria-expanded="true"]) { background: var(--panel-2); color: var(--ink); outline: none; }
.pd-menu { display: flex; flex-direction: column; padding: 4px 8px 8px; border-top: 1px solid var(--line); }
.pd-menu[hidden] { display: none; }
.pd-menu-item { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: inherit; font-size: 17px; text-align: left; cursor: pointer; }
.pd-menu-item:is(:hover, :focus-visible) { background: var(--panel-2); outline: none; }
.pd-menu-item.is-danger { color: var(--red); }
.pd-menu-item:disabled { opacity: .5; cursor: default; }

/* Used by: avatars and names */
.pd-agents { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-agent { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 6px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 16px; color: var(--ink); max-width: 100%; }
.pd-agent > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-agent:not(:has(.pd-avatar)) { padding-left: 14px; }
.pd-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--panel-2); }
.pd-avatar > * { width: 32px !important; height: 32px !important; max-width: 32px; max-height: 32px; border-radius: 50%; }
.pd-avatar img, .pd-avatar svg { width: 100%; height: 100%; object-fit: cover; }
.pd-initial { display: grid; place-items: center; color: var(--ink); font-size: 15px; font-weight: 600; }
.pd-agent-more { padding: 0 14px; color: var(--ink-3); }
.pd-agents-list { flex-direction: column; align-items: flex-start; }

/* About this connection: closed by default */
.pd-about, .pd-other { border-top: 1px solid var(--line); padding-top: 4px; }
.pd-about > summary, .pd-other > summary { display: flex; align-items: center; min-height: 48px; font-size: 17px; color: var(--ink-2); cursor: pointer; list-style: none; }
.pd-about > summary::-webkit-details-marker, .pd-other > summary::-webkit-details-marker { display: none; }
.pd-about > summary::after, .pd-other > summary::after { content: '+'; margin-left: auto; font-size: 22px; color: var(--ink-3); }
.pd-about[open] > summary::after, .pd-other[open] > summary::after { content: '–'; }
.pd-facts { margin: 0 0 12px; display: flex; flex-direction: column; gap: 4px; }
.pd-facts dt { font-weight: 600; font-size: 16px; margin-top: 8px; overflow-wrap: anywhere; }
.pd-facts dd { margin: 0; display: flex; justify-content: space-between; gap: 16px; color: var(--ink-3); font-size: 16px; }
.pd-facts dd span:last-child { color: var(--ink-2); text-align: right; overflow-wrap: anywhere; }

/* One primary pill */
.pd-foot { display: flex; flex-direction: column; gap: 10px; }
.pd-other-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }
.pd-pill { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 0 20px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; }
.pd-pill.is-primary { border-color: transparent; background: var(--ink); color: var(--bg); }
.pd-pill:disabled { opacity: .5; cursor: default; }
.pd-small .field input { width: 100%; min-height: 52px; font-size: 17px; }

@media (max-width: 760px) {
  /* The sheet rises from the bottom, like the Mac sheet. */
  .modal-scrim:has(.plugin-detail:not(.pd-small)) { align-items: flex-end; padding: 0; }
  .modal.dialog:has(.plugin-detail:not(.pd-small)) { width: 100%; max-width: none; max-height: 92vh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; }
  .modal.dialog .dialog-body.plugin-detail:not(.pd-small) { flex: 1; overflow-y: auto; padding-bottom: calc(var(--dialog-pad) + env(safe-area-inset-bottom, 0px)); }
}

/* Share: three choices, then the people */
.pd-share-who { display: flex; align-items: center; gap: 14px; }
.pd-choices { display: flex; flex-direction: column; gap: 8px; }
.pd-choice { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 16px; border: 1px solid var(--line-2); border-radius: 18px; cursor: pointer; }
.pd-choice:has(input:checked) { border-color: var(--ink); }
.pd-choice.is-off { opacity: .55; cursor: default; }
.pd-choice input { width: 22px; height: 22px; flex: none; accent-color: var(--ink); }
.pd-choice > span { display: flex; flex-direction: column; gap: 2px; font-size: 17px; }
.pd-choice > span > span { color: var(--ink-3); font-size: 16px; }
.pd-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.pd-people[hidden] { display: none; }
.pd-person { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.pd-person .pd-avatar { width: 40px; height: 40px; }
.pd-levels { display: flex; flex: none; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; }
.pd-level { min-width: 52px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font: inherit; font-size: 16px; cursor: pointer; }
.pd-level.is-on { background: var(--ink); color: var(--bg); }
@media (pointer: coarse) { .pd-level { min-height: var(--tap-min); } }

/* Plugins › Connected: one entry per app, its accounts under it */
.pd-groups { gap: var(--space-4, 16px); }
.pd-group { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line-2); border-radius: 22px; background: var(--panel); }
.pd-group-head .integration-logo { width: 52px; height: 52px; border-radius: 14px; }
.pd-group-head h2 { font-size: 20px; }
.pd-group-head > div { flex: 1; min-width: 0; }
.pd-group-add { width: auto; min-height: var(--tap-min); flex: none; }
.pd-group .pd-account { background: transparent; }
/* An account choice in a chat names the account with its mark. */
.chat-account-option .integration-logo { width: 28px; height: 28px; flex: none; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--panel-2); }
.chat-account-option .integration-logo img { width: 20px; height: 20px; object-fit: contain; }
.chat-account-option .integration-logo.has-logo > svg { display: none; }
.chat-account-option .integration-logo > svg { width: 16px; height: 16px; }
/* Black brand marks stay visible on the dark theme. */
:root:not([data-theme="light"]) :is(.pd-head, .pd-mark, .pd-share-who, .chat-account-option) img[src$="/github.svg"] { filter: invert(1); }
/* Share on the phone: a person's name on one line, their access below it. */
.pd-person { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 12px; }
.pd-person .pd-account-main strong, .pd-person .pd-account-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .pd-person { grid-template-columns: 40px minmax(0, 1fr); row-gap: 6px; padding: 6px 0; }
  .pd-person .pd-levels { grid-column: 2; justify-self: start; }
}

.pd-facts dd.pd-access { display: block; color: var(--ink-2); }
.pd-facts dd.pd-access:empty { display: none; }
.pd-access .tc-chips { margin-top: 6px; }
