/* Styles owned by the integrations module group. Build on the tokens in app.css.
   Phone-first: provider cards stack, the outbox and webhook tables turn into labelled blocks
   under 640px so nothing scrolls sideways at 375px. Prefix: int-. */

.int-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 14px; }
@media (min-width: 720px) { .int-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1060px) { .int-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.int-cards .card { margin-bottom: 0; }
.int-card { display: flex; flex-direction: column; min-width: 0; }
.int-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.int-card-head h2 { margin: 0; }
.int-channel { font-size: 13px; font-weight: 500; }
.int-facts { margin: 0; display: grid; gap: 4px; }
.int-facts > div { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13px; }
.int-facts dt { color: var(--text-2); font-weight: 500; }
.int-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.int-env { font-size: 11px; }
.int-sub { font-size: 12px; font-weight: 500; color: var(--text-3); margin: 12px 0 4px; }
.int-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.int-counts strong { font-variant-numeric: tabular-nums; }
.int-url code { display: block; padding: 6px 8px; font-size: 12px; overflow-wrap: anywhere; white-space: normal; }
.int-card > .muted.small:last-child { margin: 6px 0 0; }

.int-select { max-width: 100%; }
.int-sim .field { max-width: 520px; }
.int-sim select { max-width: 520px; }
.int-label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.int-settings input[type=text] { max-width: 100%; }

.int-simresult { border-color: var(--info-line); background: var(--info-bg); }
.int-simresult .plan li { overflow-wrap: anywhere; }

.int-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 10px; }
.int-filter label { font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; }
.int-filter select { font-size: 16px; padding: 6px 9px; min-width: 120px; width: auto; }
.js .int-filter[data-autosubmit] .int-filter-go { display: none; }

.int-err { font-size: 12px; margin-top: 4px; max-width: 34ch; overflow-wrap: anywhere; }
.int-stack form { margin: 0; }

.int-review { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0; }
.int-review:first-of-type { border-top: 0; }
.int-review-what { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.int-review select { flex: 1 1 220px; max-width: 360px; }
.int-quote { margin-top: 4px; padding: 6px 10px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; font-size: 13px; }

/* Tables become labelled blocks on phones. */
@media (max-width: 639px) {
  .table-wrap:has(.int-stack) { overflow-x: visible; margin: 0; padding: 0; }
  table.int-stack, table.int-stack tbody, table.int-stack tr, table.int-stack td { display: block; width: 100%; }
  table.int-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.int-stack tr { border-bottom: 1px solid var(--line-strong); padding: 8px 0; }
  table.int-stack tr:last-child { border-bottom: 0; }
  /* Label in a fixed left gutter; the cell's own content keeps flowing inline beside it. */
  table.int-stack td { border: 0; padding: 3px 0 3px 6.5em; position: relative; min-height: 1.6em; overflow-wrap: anywhere; }
  table.int-stack td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; color: var(--text-3); font-size: 12px; font-weight: 500; }
  table.int-stack td.nowrap { white-space: normal; }
  table.int-stack pre { max-width: calc(100vw - 64px - 6.5em); }
  table.int-stack code { white-space: normal; overflow-wrap: anywhere; }
}

/* Website card (website lead sync) */
.int-site-sync { margin-top: 10px; }
.int-site-sync .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Notify card: the ntfy topic with a Copy button (the button needs JS, so it hides without it). */
.int-topic .int-url { display: flex; gap: 8px; align-items: center; }
.int-topic .int-url code { flex: 1; min-width: 0; }
html:not(.js) [data-copy-target] { display: none; }

/* Two-direction status (Listening / Sending) on every tool card. Stacked so long labels
   wrap at 375px instead of pushing the card wider. */
.int-dirs { margin: 2px 0 6px; display: grid; gap: 6px; }
.int-dirs > div { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.int-dirs dt { font-size: 13px; font-weight: 600; color: var(--text); }
.int-dir-arrow { font-weight: 500; color: var(--text-2); }
.int-dirs dd { margin: 3px 0 0; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.int-dirs .pill { white-space: normal; }
.int-also { display: block; margin-top: 2px; }

/* "Technical details": raw names and codes, collapsed by default. */
.int-tech { margin-top: 10px; font-size: 13px; }
.int-tech summary { font-size: 12px; }
.int-tech-list { margin: 6px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
.int-tech-list li { margin: 2px 0; }
.int-tech code, .int-tech-line code { font-size: 11px; overflow-wrap: anywhere; white-space: normal; }
.int-tech-line { margin: 6px 0 0; overflow-wrap: anywhere; }
