/* Settings: the page header, the section menu, field rows, lists, preferences, app connections, billing and the
   danger zone. */

/* ---------- Header and section menu ---------- */
.set-hero { margin-bottom: 18px; }
.set-who { display: flex; align-items: center; gap: 18px; min-width: 0; }
.set-avatar {
  display: grid; place-items: center; flex: none; width: 62px; height: 62px; border-radius: var(--r-xl, 18px);
  background: linear-gradient(135deg, var(--stage-action), var(--stage-glow-1)); color: var(--stage-ink);
  font-size: 21px; font-weight: 700; letter-spacing: -.02em; box-shadow: inset 0 1px 0 var(--stage-fill-hover), 0 12px 30px -14px var(--stage-glow-1);
}

.set-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.set-panels { min-width: 0; }
.set-nav {
  position: sticky; top: calc(var(--banner-h, 0px) + var(--topbar) + 18px);
  display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: var(--r-2xl);
}
.set-tab {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; padding: 10px;
  border: 0; border-radius: var(--r-l); background: none; color: var(--ink-2); text-align: left; cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.set-tab:hover { background: var(--panel-2); color: var(--ink); }
.set-tab.on { color: var(--ink); background: color-mix(in srgb, var(--tone) 10%, var(--panel-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 30%, var(--tone-base, transparent)); }
.set-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.set-tab-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-m); background: color-mix(in srgb, var(--tone) 14%, var(--tone-base, transparent)); color: var(--tone); }
.set-tab-ic svg { width: 17px; height: 17px; }
.set-tab-text b { display: flex; align-items: center; gap: 6px; font-size: var(--fs-s); font-weight: 600; }
.set-tab-text small { display: block; margin-top: 1px; font-size: var(--fs-xs); line-height: 1.35; color: var(--ink-4); }
.set-panels > .spanel.on { animation: set-in .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes set-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Field rows: what a setting is on the left, the control on the right ---------- */
.card-body.set-rows { padding-top: 4px; padding-bottom: 4px; }
.set-row, .set-invite { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 8px 24px; align-items: start; padding: 18px 0; margin: 0; border-top: 1px solid var(--line-soft); }
.set-row:first-child { border-top: 0; }
.set-invite { padding: 18px; border-top: 1px solid var(--line); background: var(--panel-2); }
.set-label b { display: block; font-size: var(--fs-s); font-weight: 600; color: var(--ink); }
.set-label small { display: block; margin-top: 3px; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-4); }
.set-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.set-control.stacked { flex-direction: column; align-items: stretch; }
.set-control .input { flex: 1 1 200px; min-width: 0; max-width: 340px; }
.set-control .row-flex { flex-wrap: wrap; }
.set-control form { margin: 0; }
/* A button beside a field stands as high as the field. */
.set-control .btn { min-height: var(--h-md); }

/* ---------- Lists: people, sessions, assistants ---------- */
.set-list { display: flex; flex-direction: column; }
.set-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line-soft); transition: background .15s ease; }
.set-item:first-child { border-top: 0; }
.set-item:hover { background: var(--panel-2); }
.set-item-main { min-width: 0; }
.set-item-main b { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-s); font-weight: 600; }
.set-item-main b .clip { min-width: 0; max-width: 100%; }
.set-item-main small { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--ink-4); }
.set-item-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.set-item-side form { margin: 0; }
.set-item-side form.row-flex { flex-wrap: nowrap; }
.set-item-side .input { width: auto; min-width: 120px; }
.set-person, .set-device {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: color-mix(in srgb, var(--brand-text) 14%, transparent); color: var(--brand-text); font-size: var(--fs-s); font-weight: 700;
}
.set-device { border-radius: var(--r-l); background: var(--panel-3); color: var(--ink-2); }
.set-device svg { width: 18px; height: 18px; }

/* ---------- Preferences ---------- */
.pref-ic {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: var(--r-l);
  background: color-mix(in srgb, var(--tone) 14%, var(--tone-base, transparent)); color: var(--tone);
}
.pref-ic svg { width: 17px; height: 17px; }

.pref-row { display: flex; align-items: center; 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; }

.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: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); gap: 12px; }
.conngroup:has(> .acard) > .cg-label { grid-column: 1 / -1; }
/* Beside the section menu two cards stack, each as tall as its content. */
.set-panels .grid.split-2-1 { grid-template-columns: minmax(0, 1fr); }
.set-panels .connpanel > .card { height: auto; }
.set-panels .connpanel > .card > .cp-body { overflow: visible; }
.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, then the state right next to its actions, all against the right edge. */
.connrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 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-agent { margin-left: 6px; color: var(--brand-text); background: var(--brand-soft); }
.connrow .cr-agent:hover { color: var(--brand-text-hover); }
.connrow .cr-agent svg { width: 11px; height: 11px; }
.connrow .cr-state { justify-self: end; }
.connrow .cr-actions { display: flex; justify-content: flex-end; gap: 8px; }
.connrow .cr-actions form { display: contents; margin: 0; }
/* Every logo and every action button in both lists has one size, whatever the system or the label. */
.connrow .brandmark, .acard .brandmark { width: 112px; height: 30px; }
.connrow .cr-actions .btn, .acard .ac-actions .btn { min-width: 128px; height: var(--h-sm); justify-content: center; }

/* 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 .ac-main { min-width: 0; }
.acard .ac-title { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: var(--fs-m); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
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; }

.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; }

/* Cancelling stays at the foot of the card, however tall the card beside it makes this one. */
.billcard { display: flex; flex-direction: column; }
.billcard > .card-head + .card-body { flex: 1; }
.billcard > .card-body + .card-body { padding-top: 0; }

.speedpick { display: grid; grid-template-columns: 1fr; gap: 10px; }
.speedpick .sp-tile {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name action" "price action";
  align-items: center; column-gap: 12px; row-gap: 2px; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel-2);
}
.speedpick .sp-tile .sp-name { grid-area: name; }
.speedpick .sp-tile .sp-price { grid-area: price; }
.speedpick .sp-tile > :not(.sp-name):not(.sp-price) { grid-area: action; }
.speedpick .sp-tile.on { border-color: var(--brand); background: var(--brand-soft); }
.speedpick .sp-tile.is-included { opacity: .7; }
.speedpick .sp-name { font-size: var(--fs-m); font-weight: 600; }
.speedpick .sp-price { font-size: var(--fs-s); color: var(--ink-3); }
.speedpick .sp-tile form { margin: 0; }

.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; }

/* ---------- Your subscription ----------
   One overview of what the account pays for, then a section per part of it. */
.substrip .pst-v .pill { font-size: var(--fs-xs); }
.substrip .pst-s { font-size: var(--fs-xs); color: var(--ink-4); }
table.data.sublines tbody td { vertical-align: top; }
.sublines .sl-name { display: flex; align-items: center; gap: 10px; }
.sublines .sl-name b { display: block; font-size: var(--fs-m); font-weight: 600; color: var(--ink); }
.sublines .sl-kind { display: block; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4); }
.sublines .sl-detail { display: block; line-height: 1.55; color: var(--ink-3); }
.sublines .sl-systems { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sublines .sl-price { font-weight: 600; white-space: nowrap; color: var(--ink); }
.sublines .sl-price.muted { font-weight: 500; color: var(--ink-4); }
.sublines tfoot td {
  padding: 12px 16px; border-top: 1px solid var(--line);
  font-weight: 600; color: var(--ink); background: var(--panel-2);
}
.subqueue { display: flex; flex-direction: column; gap: 8px; }
.subqueue .sq-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: var(--fs-s); color: var(--ink-2); }

/* Every section has its place: the overview, then Sync plan beside AI Agents, then Faster sync beside Billing.
   Two cards in a row stand as high as each other, and the four usage figures go two by two. */
.billsections > div > .card { height: 100%; margin: 0; overflow: hidden; border-radius: var(--r-2xl); }
.billsections > .span-6 .planstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.billsections > .span-6 .planstrip .pst:nth-child(3) { border-left: 0; }
.billsections > .span-6 .planstrip .pst:nth-child(n+3) { border-top: 1px solid var(--line); }

/* ---------- 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: 1280px) {
  .billsections > .span-6 { grid-column: span 12; }
}

/* On an iPad or a phone the menu becomes a grid of every section above the panel, never a row that scrolls away. */
@media (max-width: 1100px) {
  .set-grid { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; }
  .set-tab-text b { white-space: nowrap; }
  .set-tab { grid-template-columns: auto minmax(0, 1fr); padding: 8px; }
  .set-tab-ic { width: 30px; height: 30px; }
  .set-tab-text small { display: none; }
}

@media (max-width: 480px) {
  .set-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set-tab { gap: 8px; }
  .set-tab-text { min-width: 0; }
  .set-tab-text b { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; }
  .set-tab-text .tab-count { display: 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; justify-self: start; }
  .connrow .cr-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 760px) {
  .set-who { align-items: flex-start; }
  .set-avatar { width: 48px; height: 48px; font-size: 17px; }
  .set-row, .set-invite { grid-template-columns: minmax(0, 1fr); }
  .set-control .input { max-width: none; }
  .set-item { grid-template-columns: auto minmax(0, 1fr); }
  .set-item-side { grid-column: 1 / -1; justify-content: flex-start; }
}

@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; }
}
