/* Just Another Label Sync — design tokens.
   Kept in step with powerups/email-inbox/public/css/style.css so the two
   power-ups read as one family. Copied rather than shared: the server only
   serves powerups/<name>/public, so a shared stylesheet would need a route. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --panel-bg: #fbfcfd;
  --border: #e6e8eb;
  --text: #172b4d;
  /* Half a tone darker than the email power-up's #6b778c: nearly every small
     label here uses it, and that value clears the contrast floor by only 0.02. */
  --muted: #5e6c84;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef4ff;
  --primary-soft-bd: #cfe0fb;
  --danger: #ea4335;
  --danger-dark: #c0392b;
  --danger-soft: #fdeceb;
  --success: #16a34a;
  --success-soft: #e8f8ee;
  --success-soft-bd: #b7e6c9;
  --success-tint: #f5fcf8;   /* barely-there wash for the always-on status strip */
  --success-ink: #0b6b3a;
  /* Deepened from #b7791f: the deletion warning is 12px on --warn-soft, where
     that value only reached 3.25:1. This clears the 4.5 floor. */
  --warn: #96600f;
  --warn-soft: #fbf1dd;
  --surface-hover: #f1f3f5;
  --chip-bg: #eef1f4;
  --on-primary: #ffffff;
  --danger-soft-bd: #f2c3bf;
  --danger-bd-hover: #e9a9a3;
  --warn-soft-bd: #e8d3a8;
  --toggle-off: #c1c7d0;
  --toggle-knob: #ffffff;
  --focus-ring: rgba(37, 99, 235, .12);
  --scrim: rgba(9, 30, 66, .45);
  --scrim-soft: rgba(247, 248, 250, .72);
  --shadow-pop: 0 10px 28px rgba(9, 30, 66, .16);
  --shadow-modal: 0 12px 40px rgba(9, 30, 66, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --gutter: 20px;
}

/* ── dark theme ──────────────────────────────────────────────────────────
   Follows the operating system and nothing else: the Power-Up is a panel
   inside Trello, and a switch of our own would be a second opinion about a
   question the system has already answered. Only tokens are redefined here,
   so every rule above keeps working untouched. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a;
    --surface: #171d26;
    --panel-bg: #1c2430;
    --border: #2a3441;
    --text: #e6ebf2;
    --muted: #9aa8ba;
    /* The light palette's blue is unreadable as text on a dark ground, so the
       accent lightens — and the button label flips dark to compensate. */
    --primary: #6ea3f7;
    --primary-dark: #8ab6fb;
    --primary-soft: #1a2740;
    --primary-soft-bd: #2d4468;
    --on-primary: #0c1626;
    --danger: #f4776a;
    --danger-dark: #ff9c92;
    --danger-soft: #35201e;
    --danger-soft-bd: #5a2f2b;
    --danger-bd-hover: #6e3a35;
    --success: #3ecf8e;
    --success-soft: #12301f;
    --success-soft-bd: #24523a;
    --success-tint: #121e19;
    --success-ink: #6fdcaa;
    --warn: #e0b567;
    --warn-soft: #2c2415;
    --warn-soft-bd: #4a3d1e;
    --surface-hover: #222b36;
    --chip-bg: #232c38;
    --toggle-off: #3a4553;
    --toggle-knob: #e6ebf2;
    --focus-ring: rgba(110, 163, 247, .22);
    /* Dark UI needs a darker scrim than a tinted navy to read as a layer. */
    --scrim: rgba(0, 0, 0, .62);
    --scrim-soft: rgba(10, 14, 20, .74);
    --shadow-pop: 0 10px 28px rgba(0, 0, 0, .5);
    --shadow-modal: 0 12px 40px rgba(0, 0, 0, .58);
  }

  /* Both marks are navy ink on white paper, so on a dark surface they would
     read as a smudge. Swap in the inverted artwork rather than filter it. */
  .auth-gate .card-mark,
  .preview-placeholder img { content: url("../images/logo-mark-dark.svg"); }
  .auth-container .card-mark { content: url("../images/logo-glyph-dark.svg"); }

  /* The tick and the exclamation are baked into data URIs, where a token can't
     reach them — restate the two at the lighter values. */
  #preview-content > .preview-summary:only-child::before {
    background: var(--success-soft)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233ecf8e' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
      center / 21px no-repeat;
  }
  #preview-content > .preview-sync-result.error:only-child::before {
    background: var(--danger-soft)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff9c92' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 7v6'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E")
      center / 22px no-repeat;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: anywhere;
}

h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 0 0 4px; }
p { margin: 0 0 8px; line-height: 1.5; }

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-hover); }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
/* Destructive actions read as an outline, not a slab of red — the weight
   belongs to the primary action, not the escape hatch. */
.btn-danger { background: var(--surface); border-color: var(--danger-soft-bd); color: var(--danger-dark); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger-bd-hover); }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { display: block; width: 100%; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── shared text bits ────────────────────────────────────────────────── */
.section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  color: var(--muted); letter-spacing: .05em; margin: 0 0 6px;
}
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 4px 0 0; }
.loading { color: var(--muted); text-align: center; padding: 20px; }
.error { color: var(--danger); }

/* ── authorize / simple centred pages ────────────────────────────────── */
.auth-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.card-centered {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 36px 32px; text-align: center;
}
/* height:auto — the mark is wider than it is tall, and a square box would just
   letterbox it and draw it smaller than asked. */
.card-mark { width: 52px; height: auto; margin: 0 auto 18px; display: block; }
.card-centered h2 { font-size: 21px; margin: 0 0 8px; }
.card-centered .lede { color: var(--muted); line-height: 1.55; margin: 0 0 24px; }
.card-centered .btn-block { margin-bottom: 0; }
.card-scope {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
  text-align: left;
}
.card-scope li {
  list-style: none; position: relative; padding-left: 20px;
  font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 5px;
}
.card-scope li:last-child { margin-bottom: 0; }
.card-scope li::before {
  content: ""; position: absolute; left: 4px; top: 8px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--primary);
}
.card-scope ul { margin: 0; padding: 0; }
.status-good { color: var(--success); }

/* ── settings shell ──────────────────────────────────────────────────── */
/* Hidden until JS decides what to show. No !important: settings.js and
   billing.js drive these with inline .style.display, which must win. */
.auth-gate, .settings-page, #billing-banner, .autosync-status, .last-sync, .deletion-warning {
  display: none;
}

/* The connect card fills the modal rather than sitting in a box near the top —
   until the account is linked there is nothing else on this screen. */
.auth-gate {
  min-height: 100vh; align-items: center; justify-content: center; padding: 24px;
}

/* The modal is fullscreen, so the shell owns the viewport and nothing but the
   two panes scrolls — one scrollbar per region, never nested. */
.settings-page { flex-direction: column; height: 100vh; background: var(--bg); }
.settings-page.locked { filter: blur(3px); pointer-events: none; user-select: none; opacity: .6; }

/* Tab state lives in radios so switching needs no script (the server's CSP
   blocks inline JS, and this file is meant to stay a pure design layer). */
.tab-state { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.ls-head {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 6px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.ls-tabs { display: flex; gap: 2px; margin-right: auto; }
.ls-tabs label {
  display: inline-flex; align-items: center; padding: 9px 11px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; user-select: none;
}
.ls-tabs label:hover { color: var(--text); }
#tab-sync:checked ~ .ls-head .ls-tabs label[for="tab-sync"],
#tab-account:checked ~ .ls-head .ls-tabs label[for="tab-account"] {
  color: var(--primary); border-bottom-color: var(--primary);
}
#tab-sync:focus-visible ~ .ls-head .ls-tabs label[for="tab-sync"],
#tab-account:focus-visible ~ .ls-head .ls-tabs label[for="tab-account"] {
  outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 4px;
}

/* Which board the labels come from is the premise of this whole screen, so it
   reads as a statement rather than a chip: a quiet caption, then the name at
   full weight. A filled pill here would compete with the active tab. It sits
   beside the tabs rather than across the header — pinned to the far edge it
   was the last thing anyone read. */
.source-board {
  display: flex; align-items: baseline; gap: 9px; min-width: 0;
  padding-right: 14px; border-right: 1px solid var(--border);
}
.source-board .badge {
  flex: none; font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.source-board .board-name {
  font-weight: 700; font-size: 14px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── views ───────────────────────────────────────────────────────────── */
.ls-views { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ls-view { flex: 1; min-height: 0; display: none; flex-direction: column; }
#tab-sync:checked ~ .ls-views .ls-view[data-view="sync"],
#tab-account:checked ~ .ls-views .ls-view[data-view="account"] { display: flex; }

/* ── auto-sync state ───────────────────────────────────────────────────
   Auto-sync being on is the ordinary state, not an event, so it sits in the
   header beside the board it applies to rather than claiming a band of its
   own. The detail hides behind a native <details>: no permanent height, and
   the disclosure needs no script. Turning it off is one level in — an escape
   hatch, not the reason you opened this. */
.autosync-status { flex: none; position: relative; }

.autosync-fold > summary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; cursor: pointer; list-style: none; user-select: none;
  background: var(--success-tint); border: 1px solid var(--success-soft-bd);
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; color: var(--success-ink);
}
.autosync-fold > summary::-webkit-details-marker { display: none; }
.autosync-fold > summary:hover { background: var(--success-soft); }
.autosync-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
/* The source name gets the weight; "Auto-sync from" is the quiet part, so the
   two board names in the header read as the different things they are. */
.autosync-src {
  font-weight: 700; color: var(--success-ink);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.autosync-fold > summary { color: var(--muted); }
.autosync-caret { display: inline-flex; color: var(--muted); transition: transform .15s ease; }
.autosync-fold[open] > summary .autosync-caret { transform: rotate(180deg); }

/* Absolute, so opening it doesn't push the panes down — which was the whole
   point of moving this out of the layout. */
.autosync-drop {
  /* Anchored right: the chip now sits at the header's end, so a left-anchored
     panel would hang off the edge. */
  position: absolute; top: 100%; right: 0; z-index: 20; margin-top: 6px;
  width: max-content; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--success); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 13px 15px;
}
.autosync-row { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-bottom: 6px; }
.autosync-tag {
  display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 700; color: var(--muted); margin-bottom: 1px;
}
.autosync-drop .btn { margin-top: 6px; }

/* ── the two panes ───────────────────────────────────────────────────── */
.ls-panes {
  flex: 1; min-height: 0; display: flex; gap: var(--gutter);
  padding: 14px var(--gutter); overflow: hidden;
}
.settings-col { display: contents; }

/* Left: toolbar and the deletions toggle stay put; only the list scrolls. */
.ls-pane {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.ls-pane-head { flex: none; padding: 14px 16px 10px; }
/* Only one of the two sync buttons is ever shown, so space-between keeps the
   visible one pinned right whichever it is. */
.ls-pane-head.with-action {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 10px;
}
.ls-pane-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 16px; }
.ls-pane-foot { flex: none; padding: 12px 16px; border-top: 1px solid var(--border); }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.section-head .section-label { margin: 0; }
.selected-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

.boards-toolbar { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.board-search {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.board-search::placeholder { color: var(--muted); }
.board-search:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.link-btn {
  border: none; background: none; color: var(--primary); cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 6px;
  border-radius: 6px; white-space: nowrap;
}
.link-btn:hover { background: var(--primary-soft); }

/* A single column that scrolls — one board per row, in one predictable order.
   Spreading them across columns would fit more on screen but turns "find my
   board" into a two-dimensional scan. */
.boards-list { display: flex; flex-direction: column; gap: 1px; padding-bottom: 12px; }
.board-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.board-item:hover { background: var(--panel-bg); }
.board-item:has(input:checked) { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.board-item input[type="checkbox"] { margin: 0; accent-color: var(--primary); flex: none; }

/* ── options ─────────────────────────────────────────────────────────── */
.option-row { display: flex; align-items: flex-start; gap: 10px; }
.toggle-switch { position: relative; flex: none; width: 38px; height: 21px; margin-top: 1px; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 21px; cursor: pointer;
  background: var(--toggle-off); transition: background-color .15s ease;
}
.toggle-slider::before {
  content: ""; position: absolute; width: 15px; height: 15px; top: 3px; left: 3px;
  border-radius: 50%; background: var(--toggle-knob); transition: transform .15s ease;
}
.toggle-switch input:checked + .toggle-slider { background: var(--danger); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(17px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.option-text .option-title { font-weight: 600; font-size: 13px; margin-bottom: 1px; }
.option-text .option-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.deletion-warning {
  background: var(--warn-soft); border: 1px solid var(--warn-soft-bd); border-radius: var(--radius-sm);
  padding: 8px 11px; font-size: 12px; color: var(--warn); margin-top: 9px;
}

/* ── right pane: preview ─────────────────────────────────────────────── */
.preview-section { display: flex; flex-direction: column; min-height: 0; }
/* The empty preview is most of what you see before pressing anything, so it
   gets the product's own mark, greyed back, and says what pressing will do.
   The mark is a mask, so it takes its colour from the rule below and stays
   correct if the palette moves. */
.preview-placeholder {
  padding: 52px 24px; text-align: center; color: var(--muted);
  font-size: 13px; line-height: 1.55;
}
/* The real mark rather than a mask of it: masking flattens the chips into
   silhouettes and loses the label bars inside them, which are the whole idea. */
.preview-placeholder img {
  display: block; width: 54px; height: auto; margin: 0 auto 15px; opacity: .45;
}
.preview-placeholder strong {
  display: block; font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 5px;
}
.preview-placeholder em {
  display: block; max-width: 30ch; margin: 0 auto; font-style: normal;
  text-wrap: balance;
}
.preview-actions { display: flex; justify-content: center; gap: 8px; }
/* As the empty state's call to action it carries real weight; in the pane head
   it is one control among a row, so it takes its natural width there. */
#preview-empty .preview-actions { margin-top: 20px; }
#preview-empty .preview-actions .btn { min-width: 170px; }
.preview-summary {
  font-size: 12.5px; color: var(--muted);
  padding-bottom: 11px; border-bottom: 1px solid var(--border);
}
.preview-summary .count-create { color: var(--success); font-weight: 600; }
.preview-summary .count-delete { color: var(--danger); font-weight: 600; }

/* "All boards are already in sync!" arrives as a lone summary — the same
   element that normally heads a list of changes. Standing alone there is no
   list to head, so it is a result: centre it and mark it done. */
#preview-content > .preview-summary:only-child {
  border-bottom: none; padding: 50px 24px; text-align: center;
  font-size: 15px; font-weight: 600; color: var(--text);
}
#preview-content > .preview-summary:only-child::before {
  content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 15px;
  border-radius: 50%; background: var(--success-soft)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / 21px no-repeat;
}

.preview-board { padding: 12px 0; border-top: 1px solid var(--border); }
.preview-board:first-of-type { border-top: none; }
.preview-board-header { font-size: 13px; font-weight: 600; margin-bottom: 7px; }
/* renderPreview() tags these .create / .delete. They stay unstyled on purpose:
   the chips below already say which way each group goes — .to-delete strikes
   its labels through — and colouring the heading too was the noise that made
   the old preview hard to read. */
.preview-group-title { font-size: 12px; color: var(--muted); margin: 0 0 5px; }
.preview-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 9px; }
.preview-labels:last-child { margin-bottom: 0; }
.preview-no-changes { font-size: 12.5px; color: var(--muted); }

/* The chip wears the label's own colour: labelBadge() puts it inline on
   .label-swatch, so stretching that span behind the text tints the whole chip
   without touching the JS. 18% keeps text at 10:1 contrast or better on all
   ten Trello colours — a solid fill would fail eight of them. */
.label-badge {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 5px;
  font-size: 12px; color: var(--text);
}
.label-swatch {
  position: absolute; inset: 0; z-index: -1;
  width: auto; height: auto; border-radius: 0; opacity: .18;
}
.label-badge.to-delete { color: var(--muted); text-decoration: line-through; }
.label-badge.to-delete .label-swatch { opacity: .1; }

.preview-sync-result {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
}
.preview-sync-result.success {
  background: var(--success-soft); border: 1px solid var(--success-soft-bd); color: var(--success-ink);
}
.preview-sync-result.error {
  background: var(--danger-soft); border: 1px solid var(--danger-soft-bd); color: var(--danger-dark);
}

/* A lone message owns the pane, so it reads as the pane's state rather than a
   banner strapped across the top of nothing — which is how it looked once the
   pane got narrow. Errors appended after a sync keep the strip form: those
   annotate the result sitting above them. */
#preview-content > .preview-sync-result.error:only-child {
  background: none; border: none; padding: 46px 24px; text-align: center;
  font-size: 13.5px; font-weight: 400; color: var(--text);
}
#preview-content > .preview-sync-result.error:only-child::before {
  content: ""; display: block; width: 42px; height: 42px; margin: 0 auto 14px;
  border-radius: 50%; background: var(--danger-soft)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c0392b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 7v6'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E")
    center / 22px no-repeat;
}

/* ── action bar ──────────────────────────────────────────────────────── */
.settings-actions {
  flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px var(--gutter); background: var(--surface); border-top: 1px solid var(--border);
}
.last-sync { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ── account view ────────────────────────────────────────────────────── */
.account-section { max-width: 520px; margin: 0 auto; padding: 28px var(--gutter); }
.account-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.account-card h3 { margin: 0 0 4px; }
.account-card .hint { margin-bottom: 16px; }

/* ── subscription card (Billing & Account tab) ───────────────────────────
   Same shape and class names as the email power-up's billing card, so the two
   are recognisably one product. Where that one leads with member count, this
   leads with the price: Label Sync bills flat, not per seat. */
#billing-banner { margin-bottom: 14px; }
.bill-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 20px;
}
.bill-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.bill-card-title { font-size: 14px; font-weight: 700; }
.bill-pill {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 11px;
  background: var(--chip-bg); color: var(--muted);
}
.bill-pill.bill-active { background: var(--success-soft); color: var(--success-ink); }
.bill-pill.bill-trialing { background: var(--primary-soft); color: var(--primary); }
.bill-pill.bill-past_due { background: var(--danger-soft); color: var(--danger-dark); }
.bill-price { font-size: 20px; font-weight: 700; }
.bill-price span { font-size: 14px; font-weight: 400; color: var(--muted); }
.bill-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.bill-action { margin-top: 16px; }

/* ── confirm dialog ──────────────────────────────────────────────────────
   Same markup and class names as the email power-up's showConfirm(), which
   exists because the native confirm() carries a domain prefix and can't be
   styled. */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--scrim);
}
.confirm-box {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  padding: 24px; max-width: 380px; width: 100%;
}
.confirm-box h3 { margin: 0 0 8px; font-size: 16px; }
.confirm-box p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; font-size: 13.5px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ── paywall ─────────────────────────────────────────────────────────── */
#billing-overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: var(--scrim-soft);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.billing-overlay-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 32px 28px; text-align: center;
}
.billing-overlay-badge {
  display: inline-block; background: var(--primary); color: var(--on-primary);
  font-size: 10px; font-weight: 700; letter-spacing: .09em;
  padding: 3px 11px; border-radius: 100px; margin-bottom: 14px;
}
.billing-overlay-card h2 { font-size: 20px; margin: 0 0 8px; }
.billing-overlay-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin: 0 0 20px; }
.billing-price { font-size: 32px; font-weight: 700; margin: 0 0 20px; }
.billing-price span { font-size: 15px; font-weight: 400; color: var(--muted); }
.billing-features { list-style: none; padding: 0; margin: 0 0 24px; text-align: left; }
.billing-features li {
  position: relative; padding: 5px 0 5px 24px; font-size: 13px;
}
.billing-features li::before {
  content: ""; position: absolute; left: 4px; top: 11px;
  width: 5px; height: 9px; border: 2px solid var(--success);
  border-top: 0; border-left: 0; transform: rotate(42deg);
}
.billing-note { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

/* ── responsive ──────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .ls-panes { flex-direction: column; overflow: auto; }
  .ls-pane { flex: none; }
  .ls-pane-scroll { overflow: visible; }
  .source-board .board-name { max-width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ── other power-ups: header button + popover, and the billing return page ── */
/* ── help ─────────────────────────────────────────────────────────────── */
.help { position: relative; flex: none; }
.help-btn {
  width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.help-btn:hover, .help-btn[aria-expanded="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.help-btn svg { display: block; }
.help-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  width: 320px; max-width: calc(100vw - 24px); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.help-pop[hidden] { display: none; }
.help-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.help-sub { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.help-mail {
  display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 10px;
  background: var(--surface-hover); border-radius: var(--radius-sm);
}
.help-addr { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.help-write { text-align: center; text-decoration: none; }
.bill-ask {
  display: flex; gap: 9px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px;
  background: var(--surface-hover); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text); line-height: 1.5; text-align: left;
}
.bill-ask svg { flex: none; margin-top: 2px; color: var(--muted); }
.bill-ask a { color: var(--primary); font-weight: 600; overflow-wrap: anywhere; }
.billing-overlay-card .bill-ask { margin: 14px 0 0; }

.xs-more[hidden], .xs-pop[hidden], .xs-return[hidden], .done [hidden] { display: none !important; }
.xs-more { position: relative; flex: none; }
.xs-btn {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 11px 3px 4px; cursor: pointer; transition: border-color .12s ease, background .12s ease;
}
.xs-btn:hover, .xs-btn[aria-expanded="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.xs-logos { display: inline-flex; }
.xs-logos img { width: 20px; height: 20px; border-radius: 6px; box-shadow: 0 0 0 2px var(--surface); }
.xs-logos img + img { margin-left: -6px; }
.xs-btn:hover .xs-logos img, .xs-btn[aria-expanded="true"] .xs-logos img { box-shadow: 0 0 0 2px var(--primary-soft); }
/* Until the list has been opened once. */
.xs-btn.is-new::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--surface);
}
@media (max-width: 720px) { .xs-btn-text { display: none; } .xs-btn { padding-right: 4px; } }
.xs-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  width: 320px; max-width: calc(100vw - 24px); padding: 10px 6px 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.xs-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 8px 4px; }
.xs-offer {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; text-align: left;
  padding: 8px; border-radius: var(--radius-sm); color: inherit; text-decoration: none;
}
.xs-offer:hover { background: var(--surface-hover); }
.xs-offer:hover .xs-name { color: var(--primary); }
.xs-offer img { grid-row: span 3; width: 28px; height: 28px; border-radius: 7px; margin-top: 1px; }
.xs-name { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.xs-trial { font-size: 10.5px; font-weight: 600; color: var(--success-ink); background: var(--success-soft); border-radius: 999px; padding: 1px 7px; }
.xs-sent { font-size: 12px; color: var(--muted); line-height: 1.4; }
.xs-price { font-size: 12px; font-weight: 600; color: var(--text); }

/* ── billing return page ──────────────────────────────────────────────── */
body.done { padding: 48px 16px; background: var(--bg); }
.done-card {
  max-width: 480px; margin: 0 auto; padding: 32px 28px 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-pop);
}
.done-logo { position: relative; width: 64px; margin: 0 auto 18px; }
.done-logo img { display: block; width: 64px; height: 64px; border-radius: 16px; }
.done-check {
  position: absolute; right: -10px; bottom: -8px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; color: var(--success-ink); background: var(--success-soft); box-shadow: 0 0 0 3px var(--surface);
}
.done-card h1 { margin: 0 0 8px; font-size: 22px; text-wrap: balance; }
.done-lede { max-width: 38ch; margin: 0 auto 20px; color: var(--muted); line-height: 1.55; }
.done-back { width: 100%; padding-block: 11px; }
.done-closed { margin: 0; padding: 10px; font-weight: 600; border-radius: var(--radius-sm); background: var(--success-soft); color: var(--success-ink); }
.done-fine { margin: 12px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.xs-return { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); text-align: left; }
.xs-return .xs-list { display: grid; gap: 10px; }
.xs-return .xs-label { margin: 0 0 2px; }
.xs-return .xs-offer { background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; }
.xs-return .xs-offer:hover { border-color: var(--primary); }
.xs-return .xs-offer img { width: 36px; height: 36px; border-radius: 9px; }
