/* Settings: preference rows, app connections, billing and the danger zone. */

.pref-row { display: flex; align-items: flex-start; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.pref-row:last-of-type { border-bottom: 0; }
.pref-text { flex: 1; min-width: 0; }
.pref-text b { display: block; font-size: var(--fs-m); font-weight: 600; color: var(--ink); }
.pref-text span { display: block; margin-top: 3px; font-size: var(--fs-s); line-height: 1.55; color: var(--ink-3); }
.pref-text .itip { display: inline-flex; margin-top: 0; }
.pref-side { flex: none; padding-top: 2px; }

.team-row { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.otp-secret { font-size: var(--fs-m); letter-spacing: .08em; }

/* ---------- App connections ----------
   Both cards share one tall height and scroll inside, so the page never grows past the fold. */
.connpanel { align-items: stretch; }
.connpanel > .card { display: flex; flex-direction: column; height: max(640px, calc(100dvh - 240px)); }
.connpanel > .card > .cp-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.connpanel > .card:last-child > .cp-body { padding: 22px 24px; }

.conngroup:has(> .acard) { display: flex; flex-direction: column; gap: 12px; }
.conngroup + .conngroup { margin-top: 28px; }
.cg-label { display: block; margin-bottom: 4px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4); }

/* One app connection: badge, name, state, then two actions of equal width, so every row lines up. */
.connrow { display: grid; grid-template-columns: auto minmax(0, 1fr) 124px auto; align-items: center; gap: 16px; padding: 16px 4px; border-bottom: 1px solid var(--line-soft); }
.connrow:last-child { border-bottom: 0; }
.connrow .cr-main { min-width: 0; }
.connrow .cr-title { font-size: var(--fs-m); font-weight: 600; }
.connrow .cr-sub { font-size: var(--fs-xs); color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connrow .cr-state { justify-self: start; }
.connrow .cr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.connrow .cr-actions form { display: contents; margin: 0; }
.connrow .cr-actions .btn { min-width: 112px; }
/* Revoke keeps its own column, so it lines up whether or not a Reconnect sits next to it. */
.connrow .cr-actions .btn.danger { grid-column: 2; }

/* An app in the directory: what it is and how to connect it. */
.acard {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.acard:hover { border-color: var(--line-strong); box-shadow: var(--sh-xs); }
.acard.soon { border-style: dashed; background: var(--panel-2); }
.acard.soon:hover { border-color: var(--line); box-shadow: none; }
.acard .brandmark { width: 100px; }
.acard .ac-main { min-width: 0; }
.acard .ac-title { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-m); font-weight: 600; color: var(--ink); white-space: nowrap; }
a.ac-title:hover { color: var(--brand-text); }
.acard .ac-title svg { width: 12px; height: 12px; color: var(--brand-text); }
.acard .ac-sub { font-size: var(--fs-xs); color: var(--ink-4); }
.acard .ac-actions { display: flex; gap: 8px; justify-content: flex-end; }
.acard .ac-actions .btn { white-space: nowrap; }
.acard .ac-actions .btn.tight { min-height: 26px; padding: 0 7px; gap: 3px; font-size: var(--fs-2xs); }
.acard .ac-actions .btn.tight svg { width: 11px; height: 11px; }

.apick { padding: 14px 12px 10px; }
.apick-head { max-width: 54ch; margin: 18px auto 26px; text-align: center; }
.apick-head .apick-ic {
  display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 10px;
  border-radius: var(--r-l); background: var(--brand-soft); color: var(--brand-text);
}
.apick-head .apick-ic svg { width: 20px; height: 20px; }
.apick-head h3 { margin: 0 0 6px; font-size: var(--fs-l); }
.apick-head p { margin: 0; font-size: var(--fs-s); line-height: 1.7; color: var(--ink-3); }

/* ---------- Billing ---------- */
.billblock {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel-2);
}
.billblock .sb-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: var(--r-l); background: var(--brand-soft); color: var(--brand-text); }
.billblock .sb-ic svg { width: 18px; height: 18px; }
.billblock .sb-body { flex: 1 1 260px; min-width: 0; }
.billblock .sb-body b { display: block; margin-bottom: 3px; font-size: var(--fs-m); font-weight: 600; }
.billblock .sb-body p { margin: 0; font-size: var(--fs-s); line-height: 1.55; color: var(--ink-3); }
.billblock .sb-action { flex: none; }

.invempty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 6px 10px; text-align: center; }
.invempty .ie-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-l); background: var(--brand-soft); color: var(--brand-text); }
.invempty .ie-ic svg { width: 19px; height: 19px; }
.invempty p { max-width: 34ch; margin: 0; font-size: var(--fs-s); line-height: 1.65; color: var(--ink-3); }
.invlist { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.invlist .inv { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-s); }
.invlist .inv:last-child { border-bottom: 0; }
.invlist .inv-date { color: var(--ink-3); }
.invlist .inv-amount { margin-left: auto; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Danger zone ---------- */
.dangercard { border-color: var(--bad-line); }
.dangercard .card-head { border-bottom-color: var(--bad-line); }
.dangercard .card-head h3 { color: var(--bad); }
.dangerlist { display: grid; gap: 6px; margin: 0 0 16px; padding-left: 18px; font-size: var(--fs-s); line-height: 1.55; color: var(--ink-2); }
.dangerlist li::marker { color: var(--bad); }
.dangerform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.dangerform .field { flex: 1 1 220px; margin-bottom: 0; }
.dangerform .btn { flex: none; }

@media (max-width: 1080px) {
  .connpanel > .card { height: auto; }
  .connpanel > .card > .cp-body { max-height: 70dvh; }
}

@media (max-width: 860px) {
  .connrow { grid-template-columns: auto minmax(0, 1fr); row-gap: 12px; }
  .connrow .cr-state { grid-column: 2; }
  .connrow .cr-actions { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .acard { grid-template-columns: auto 1fr; }
  .acard .ac-actions { grid-column: 1 / -1; }
  .acard .ac-actions .btn { flex: 1; }
  .pref-row { flex-wrap: wrap; }
}
