/* credit-sheets.css — the credit sheets: top up, a free code, the top-up from a video, add or change a card.
 *
 * The approved artefacts are the spec (Alex, 3 Dec 2026, FIX-LIST item 7):
 * docs/projects/ai-video-clips/billing-redesign/{TopUp,FreeCode,VideoShort,AddCard}.dc.html, in the free-community
 * upgrade's design ethos (the tokens below are lifted from css/plan-checkout.css: cream, ink, the line colour,
 * the violet accent and the buy pink, Fraunces headlines, Inter body, JetBrains Mono small caps).
 *
 * Every rule is under `#cb-sheet.crs-ov`, the class js/credit-topup.js and js/update-card.js put on the house sheet
 * (CBSheet.panel, ui-core.js). The sheet itself is NOT replaced: its overlay, focus, Escape and footer stay the
 * house's; this file only dresses it. On a phone it is a bottom sheet with a grabber and 20px sides; the money
 * button is pinned in the footer, so it is always in reach while the middle scrolls.
 */
#cb-sheet.crs-ov {
  --crs-cream: #faf6ec; --crs-ink: #2a2030; --crs-ink2: #5a4d62; --crs-ink3: #6f6377;
  --crs-line: #ebe1c9; --crs-line2: #d8cdaf; --crs-soft: #f3ecdb;
  --crs-accent: #6a4cf1; --crs-accent-soft: #ece6ff; --crs-link: #4a32b8;
  --crs-buy: #ec1075; --crs-buy-deep: #c50c60;
  --crs-good: #3d6342; --crs-good-dot: #4f7c54; --crs-good-soft: #e4ecdc; --crs-warn: #92400e; --crs-bad: #b4232a;
  background: rgba(42, 32, 48, 0.45);
}
#cb-sheet.crs-ov [hidden] { display: none !important; }

/* ── The sheet ── */
#cb-sheet.crs-ov .rel-editor {
  position: relative; background: #fff; color: var(--crs-ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  max-width: 460px; border-radius: 22px;
}
/* The house head keeps only its close button, as the artefact's round one, top right. */
#cb-sheet.crs-ov .rel-ed-head { position: absolute; top: 16px; right: 16px; padding: 0; z-index: 2; }
#cb-sheet.crs-ov .rel-ed-head > div:first-child { display: none; }
#cb-sheet.crs-ov .rel-ed-close {
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--crs-soft); color: var(--crs-ink);
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
#cb-sheet.crs-ov .rel-ed-close:hover { background: #ece2cb; }
#cb-sheet.crs-ov .rel-ed-close:focus-visible { outline: 3px solid var(--crs-accent); outline-offset: 2px; }
#cb-sheet.crs-ov .rel-ed-body {
  padding: 24px 24px 6px; display: flex; flex-direction: column; gap: 18px;
}

/* ── The footer: one pink pill, the quiet second choice, one small line ── */
#cb-sheet.crs-ov .rel-ed-foot {
  flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 24px 24px;
}
#cb-sheet.crs-ov .rel-ed-foot-right { order: 0; flex-direction: column; gap: 4px; }
#cb-sheet.crs-ov [data-cbs-note] { order: 1; text-align: center; font-size: 12px; line-height: 1.45; color: var(--crs-ink3); }
#cb-sheet.crs-ov [data-cbs-note]:empty { display: none; }
#cb-sheet.crs-ov .rel-ed-foot-right .rel-ed-btn { flex: none; width: 100%; }
#cb-sheet.crs-ov .crs-pay, #cb-sheet.crs-ov .rel-ed-primary {
  order: 0; min-height: 54px; border: 0; border-radius: 999px; background: var(--crs-buy); color: #fff;
  font: 700 16px Inter, sans-serif; padding: 0 22px; box-shadow: 0 8px 22px rgba(236, 16, 117, 0.22);
}
#cb-sheet.crs-ov .crs-pay:hover:not(:disabled), #cb-sheet.crs-ov .rel-ed-primary:hover:not(:disabled) { background: var(--crs-buy-deep); }
#cb-sheet.crs-ov .crs-pay:disabled, #cb-sheet.crs-ov .rel-ed-primary:disabled { background: #f39cc3; box-shadow: none; cursor: default; }
#cb-sheet.crs-ov .crs-pay:focus-visible { outline: 3px solid var(--crs-accent); outline-offset: 3px; }
#cb-sheet.crs-ov .crs-other, #cb-sheet.crs-ov .rel-ed-ghost {
  order: 1; min-height: 44px; border: 0; background: none; color: var(--crs-ink2); font: 600 14px Inter, sans-serif;
}
#cb-sheet.crs-ov .crs-other:hover { color: var(--crs-ink); text-decoration: underline; }

/* ── The head ── */
#cb-sheet.crs-ov .crs-head { display: flex; flex-direction: column; gap: 4px; padding-right: 56px; min-height: 44px; }
#cb-sheet.crs-ov .crs-kicker {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--crs-ink3); padding-top: 4px;
}
#cb-sheet.crs-ov .crs-title {
  margin: 0; font-family: Fraunces, Georgia, serif; font-weight: 800; font-size: 26px; letter-spacing: -0.02em;
  line-height: 1.12; color: var(--crs-ink);
}
#cb-sheet.crs-ov .crs-sub, #cb-sheet.crs-ov .crs-why { margin: 0; font-size: 14px; line-height: 1.45; color: var(--crs-ink2); }
#cb-sheet.crs-ov .crs-short { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--crs-warn); }
#cb-sheet.crs-ov .crs-msg { margin: 0; font-size: 15px; line-height: 1.5; color: var(--crs-ink); background: var(--crs-cream); border: 1px solid var(--crs-line); border-radius: 14px; padding: 14px 16px; }
#cb-sheet.crs-ov .crs-status { margin: -6px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--crs-ink2); }
#cb-sheet.crs-ov .crs-status:empty { display: none; }

/* ── The applied code ── */
#cb-sheet.crs-ov .crs-chip {
  display: flex; align-items: center; gap: 10px; background: var(--crs-good-soft); border: 1px solid rgba(79, 124, 84, 0.3);
  border-radius: 12px; padding: 4px 6px 4px 14px;
}
#cb-sheet.crs-ov .crs-chip-code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; font-weight: 500; letter-spacing: .06em; color: var(--crs-good); }
#cb-sheet.crs-ov .crs-chip-msg { flex: 1; min-width: 0; font-size: 13px; line-height: 1.4; color: var(--crs-ink); padding: 8px 0; }
#cb-sheet.crs-ov .crs-chip-x { min-height: 44px; min-width: 44px; border: 0; background: none; color: var(--crs-good); font: 600 13px Inter, sans-serif; cursor: pointer; padding: 0 8px; }

/* ── The amounts: two to a row, the chosen one in the accent ── */
#cb-sheet.crs-ov .crs-amts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#cb-sheet.crs-ov .crs-amt {
  min-height: 72px; border: 1.5px solid var(--crs-line); border-radius: 14px; background: #fff; color: var(--crs-ink);
  text-align: left; padding: 12px 14px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
#cb-sheet.crs-ov .crs-amt b { font-size: 18px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
#cb-sheet.crs-ov .crs-amt-sub { font-size: 12px; color: var(--crs-ink3); line-height: 1.3; }
#cb-sheet.crs-ov .crs-amt-get { font-size: 12px; color: var(--crs-good); font-weight: 600; line-height: 1.3; }
#cb-sheet.crs-ov .crs-amt:hover { border-color: #cdbfe9; }
#cb-sheet.crs-ov .crs-amt.is-on { border: 2px solid var(--crs-accent); background: var(--crs-accent-soft); padding: 11.5px 13.5px; }
#cb-sheet.crs-ov .crs-amt:focus-visible { outline: 3px solid var(--crs-accent); outline-offset: 2px; }
/* The video's two amounts are rows (VideoShort.dc.html). */
#cb-sheet.crs-ov.crs-video .crs-amts { grid-template-columns: minmax(0, 1fr); gap: 8px; }
#cb-sheet.crs-ov.crs-video .crs-amt { min-height: 56px; flex-direction: row; align-items: center; justify-content: space-between; padding: 0 16px; }
#cb-sheet.crs-ov.crs-video .crs-amt.is-on { padding: 0 15.5px; }
#cb-sheet.crs-ov.crs-video .crs-amt b { font-size: 16px; }

/* ── "Have a code?" and its field ── */
#cb-sheet.crs-ov .crs-code { display: flex; flex-direction: column; gap: 8px; margin-top: -8px; }
#cb-sheet.crs-ov .crs-link {
  min-height: 44px; border: 0; background: none; color: var(--crs-link); font: 600 14px Inter, sans-serif;
  cursor: pointer; padding: 0; align-self: flex-start;
}
#cb-sheet.crs-ov .crs-link:hover { text-decoration: underline; }
#cb-sheet.crs-ov .crs-code-row { display: flex; gap: 8px; }
#cb-sheet.crs-ov .crs-input {
  flex: 1; min-width: 0; min-height: 48px; border: 1.5px solid var(--crs-line2); border-radius: 10px; padding: 0 14px;
  font: 400 16px Inter, sans-serif; color: var(--crs-ink); background: #fff; text-transform: uppercase; box-sizing: border-box;
}
#cb-sheet.crs-ov .crs-input:focus { outline: none; border-color: var(--crs-accent); box-shadow: 0 0 0 3px rgba(106, 76, 241, 0.15); }
#cb-sheet.crs-ov .crs-apply {
  min-height: 48px; padding: 0 18px; border: 1.5px solid var(--crs-ink); border-radius: 10px; background: #fff;
  color: var(--crs-ink); font: 600 15px Inter, sans-serif; cursor: pointer;
}
#cb-sheet.crs-ov .crs-apply:disabled, #cb-sheet.crs-ov .crs-input:disabled { opacity: .55; }
#cb-sheet.crs-ov .crs-code-line { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 600; color: var(--crs-warn); }
#cb-sheet.crs-ov .crs-code-line.is-good { color: var(--crs-good); }

/* ── The summary and the video box ── */
#cb-sheet.crs-ov .crs-sum {
  background: var(--crs-cream); border: 1px solid var(--crs-line); border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px; font-size: 14px;
}
#cb-sheet.crs-ov .crs-row { display: flex; justify-content: space-between; gap: 12px; }
#cb-sheet.crs-ov .crs-num { font-variant-numeric: tabular-nums; font-weight: 700; }
#cb-sheet.crs-ov .crs-row.is-good { color: var(--crs-good); }
#cb-sheet.crs-ov .crs-row.is-total { border-top: 1px solid var(--crs-line2); padding-top: 8px; margin-top: 2px; font-weight: 700; font-size: 15px; }
#cb-sheet.crs-ov .crs-vbox {
  display: flex; gap: 12px; align-items: center; background: var(--crs-cream); border: 1px solid var(--crs-line);
  border-radius: 14px; padding: 12px;
}
#cb-sheet.crs-ov .crs-vthumb {
  width: 54px; height: 96px; border-radius: 10px; background: var(--crs-ink); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
#cb-sheet.crs-ov .crs-vtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
#cb-sheet.crs-ov .crs-vtext .crs-row span { color: var(--crs-ink2); }
#cb-sheet.crs-ov .crs-vtitle { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }

/* ── The free code (FreeCode.dc.html) ── */
#cb-sheet.crs-ov .crs-free {
  background: var(--crs-cream); border: 1px solid var(--crs-line); border-radius: 16px; padding: 22px 18px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
#cb-sheet.crs-ov .crs-free-big { font-family: Fraunces, Georgia, serif; font-weight: 800; font-size: 44px; letter-spacing: -0.02em; line-height: 1; }
#cb-sheet.crs-ov .crs-free-what { font-size: 17px; font-weight: 600; }
#cb-sheet.crs-ov .crs-free-by { font-size: 14px; color: var(--crs-ink2); line-height: 1.45; }

/* ── The card: on file as a row, or the one card field ── */
#cb-sheet.crs-ov .crs-card { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--crs-line); border-radius: 12px; padding: 0 4px 0 12px; min-height: 52px; }
#cb-sheet.crs-ov .crs-card-badge {
  width: 38px; height: 26px; border-radius: 5px; background: var(--crs-ink); color: #fff; font-size: 9px; font-weight: 800;
  letter-spacing: .02em; display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
#cb-sheet.crs-ov .crs-card-badge.is-visa { background: #1a1f71; }
#cb-sheet.crs-ov .crs-card-badge.is-mastercard { background: #eb001b; }
#cb-sheet.crs-ov .crs-card-badge.is-amex { background: #2e77bc; }
#cb-sheet.crs-ov .crs-card-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
#cb-sheet.crs-ov .crs-card .crs-link { align-self: center; padding: 0 10px; }
#cb-sheet.crs-ov .crs-card-head { display: flex; flex-direction: column; gap: 4px; }
#cb-sheet.crs-ov .crs-card-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--crs-ink); }
#cb-sheet.crs-ov .crs-card-head p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--crs-ink2); }
#cb-sheet.crs-ov .crs-cardhost { min-height: 120px; margin-top: -6px; }
#cb-sheet.crs-ov .cardform-err { margin: 8px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--crs-bad); }

/* ── Add or change a card (AddCard.dc.html): the trust line ── */
#cb-sheet.crs-ov .crs-trust { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--crs-ink3); }
#cb-sheet.crs-ov .crs-trust span { display: flex; align-items: center; gap: 6px; }
#cb-sheet.crs-ov .crs-trust span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--crs-good-dot); }
#cb-sheet.crs-ov .crs-box { margin: 0; font-size: 14px; line-height: 1.5; color: var(--crs-ink); background: var(--crs-cream); border: 1px solid var(--crs-line); border-radius: 14px; padding: 12px 14px; }

/* ── Done ── */
#cb-sheet.crs-ov .crs-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px 0 4px; }
#cb-sheet.crs-ov .crs-done-tick { width: 52px; height: 52px; border-radius: 50%; background: var(--crs-good-dot); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
#cb-sheet.crs-ov .crs-done-code { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--crs-good); }
#cb-sheet.crs-ov .crs-done .crs-title { font-size: 24px; }

/* ── A phone: a bottom sheet, 20px sides, a grabber ── */
@media (max-width: 560px) {
  #cb-sheet.crs-ov { align-items: flex-end; padding: 0; }
  #cb-sheet.crs-ov .rel-editor {
    width: 100% !important; max-width: none; border-radius: 22px 22px 0 0;
    max-height: calc(100vh - 24px); max-height: calc(100svh - 24px);
  }
  #cb-sheet.crs-ov .rel-editor::before {
    content: ""; flex: 0 0 auto; width: 40px; height: 5px; border-radius: 999px; background: var(--crs-line2); margin: 12px auto 0;
  }
  #cb-sheet.crs-ov .rel-ed-head { top: 26px; right: 14px; }
  #cb-sheet.crs-ov .rel-ed-body { padding: 18px 20px 6px; }
  #cb-sheet.crs-ov .rel-ed-foot { padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
}
