/* SA-1 support chat (tenant Desktop). Uses the shared RestarFleet tokens (restarfleet-app-tokens.css),
   so it follows Day and Night. Layout from the approved design (design-sa1/mock/desktop.css). */
:root { --rf-sc-mine: #FDF3CC; --rf-sc-mine-line: rgba(122, 92, 0, .22); }
:root[data-rf-theme="night"] { --rf-sc-mine: #2A2A12; --rf-sc-mine-line: rgba(245, 197, 24, .28); }
@media (prefers-color-scheme: dark) { :root:not([data-rf-theme="day"]) { --rf-sc-mine: #2A2A12; --rf-sc-mine-line: rgba(245, 197, 24, .28); } }

.rf-sc-i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.rf-sc-mono { font-family: var(--rf-mono, ui-monospace, Menlo, monospace); }

/* ---------- Entry: headset next to the bell (owner decision 7 Oct, option 3) ---------- */
.rf-support-btn { position: relative; width: 40px; height: 40px; flex: 0 0 auto; display: inline-grid; place-items: center; padding: 0; margin-left: 6px; border: 1px solid var(--rf-line-2, #CBD5E1); border-radius: 11px; background: var(--rf-panel, #fff); color: var(--rf-head, #071820); cursor: pointer; box-shadow: var(--rf-shadow, 0 1px 2px rgba(7,24,32,.05)); font-family: inherit; transition: color .15s ease, border-color .15s ease, box-shadow .15s ease; }
.rf-support-btn:hover, .rf-support-btn.is-open { border-color: var(--rf-accent, #F5C518); box-shadow: 0 0 0 3px rgba(245, 197, 24, .22); }
.rf-support-btn:focus-visible { outline: 3px solid rgba(245, 197, 24, .45); outline-offset: 2px; }
.rf-support-btn .rf-sc-i { width: 19px; height: 19px; stroke-width: 1.9; }
.rf-support-count { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--rf-accent, #F5C518); color: var(--rf-accent-ink, #10181E); font: 700 10.5px/19px var(--rf-mono, ui-monospace, monospace); text-align: center; box-shadow: 0 0 0 2px var(--rf-bg, #fff); }
.rf-support-count[hidden] { display: none; }
.sbd-actions + .rf-support-btn { width: 36px; height: 36px; align-self: flex-start; }
/* Integration (7 Oct): the headset sits immediately before every CR-4 bell; it takes the bell's size on the
   pages where the bell is 36 px, and the header's own gap spaces the pair. No right-to-left rule (SA-3). */
.sbd-hero-tools > .rf-support-btn, .inv-header > .rf-support-btn, .notif-header-actions > .rf-support-btn,
.sbx-command-actions > .rf-support-btn, #sambung-bayar-page .panel-head .rf-support-btn { width: 36px; height: 36px; }
.sbd-hero-tools > .rf-support-btn .rf-sc-i, .inv-header > .rf-support-btn .rf-sc-i, .notif-header-actions > .rf-support-btn .rf-sc-i,
.sbx-command-actions > .rf-support-btn .rf-sc-i, #sambung-bayar-page .panel-head .rf-support-btn .rf-sc-i { width: 18px; height: 18px; }
/* CR-1 card design: the headset follows the same surface as the bell, Day and Night */
html.rf-app .rf-support-btn { margin-left: 0; background: var(--rf-panel); border-color: var(--rf-line-2); color: var(--rf-head); box-shadow: var(--rf-card-shadow); }
html.rf-app .rf-support-btn:hover, html.rf-app .rf-support-btn.is-open { background: var(--rf-panel-2); border-color: var(--rf-accent); color: var(--rf-head); box-shadow: var(--rf-card-shadow); }

.rf-support-tip { position: fixed; z-index: 890; width: 300px; max-width: calc(100vw - 24px); background: var(--rf-head, #092B40); color: var(--rf-bg, #F3F8F6); border-radius: 12px; padding: 13px 14px; box-shadow: var(--rf-shadow-lg, 0 24px 60px -24px rgba(9,43,64,.35)); font: 400 12.5px/1.5 var(--rf-font, system-ui, sans-serif); }
.rf-support-tip::before { content: ''; position: absolute; top: -6px; left: var(--rf-support-tip-arrow, 250px); width: 12px; height: 12px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.rf-support-tip b { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.rf-support-tip-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.rf-support-tip-row span { opacity: .7; font: 400 11px var(--rf-mono, ui-monospace, monospace); }
.rf-support-tip-row button { border: 0; cursor: pointer; background: var(--rf-accent, #F5C518); color: var(--rf-accent-ink, #10181E); padding: 5px 11px; border-radius: 7px; font: 500 12.5px var(--rf-font, system-ui, sans-serif); }

/* ---------- Panel: non-modal, over the current page ---------- */
.rf-support-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 432px; max-width: 100vw; z-index: 880; display: flex; flex-direction: column; background: var(--rf-panel, #fff); color: var(--rf-text, #24423A); border-left: 1px solid var(--rf-line-2, rgba(9,43,64,.17)); box-shadow: -18px 0 40px -24px rgba(9, 43, 64, .35); font: 400 13px/1.5 var(--rf-font, system-ui, sans-serif); -webkit-font-smoothing: antialiased; }
.rf-support-panel[hidden] { display: none; }
:root[data-rf-theme="night"] .rf-support-panel { box-shadow: -18px 0 50px -20px rgba(0, 0, 0, .8); }
.rf-support-panel button { font-family: inherit; }
.rf-sc-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--rf-line); }
.rf-sc-mark { width: 38px; height: 38px; border-radius: 10px; background: #06120F; display: grid; place-items: center; flex: 0 0 auto; }
:root[data-rf-theme="night"] .rf-sc-mark { background: #0F2620; border: 1px solid var(--rf-line-2); }
.rf-sc-mark img { width: 24px; height: 24px; }
.rf-sc-head-text { min-width: 0; }
.rf-sc-title { font-weight: 600; color: var(--rf-head); font-size: 15px; }
.rf-sc-status { font-size: 12px; color: var(--rf-soft); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.rf-sc-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.rf-sc-dot.on { background: var(--rf-green); } .rf-sc-dot.off { background: var(--rf-grey); }
.rf-sc-icon-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--rf-line-2); background: var(--rf-panel); color: var(--rf-head); display: grid; place-items: center; cursor: pointer; }
.rf-sc-icon-btn[hidden] { display: none; }
.rf-sc-hours { display: flex; gap: 9px; align-items: flex-start; padding: 9px 16px; background: var(--rf-panel-2); border-bottom: 1px solid var(--rf-line); font-size: 12px; color: var(--rf-soft); line-height: 1.45; }
.rf-sc-hours .rf-sc-i { width: 14px; height: 14px; margin-top: 2px; color: var(--rf-muted); }
.rf-sc-hours b { color: var(--rf-head); font-weight: 500; }
.rf-sc-offline { margin: 12px 16px 0; padding: 11px 13px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--rf-amber) 35%, transparent); background: color-mix(in srgb, var(--rf-amber) 9%, transparent); color: var(--rf-head); font-size: 12.5px; line-height: 1.5; display: flex; gap: 10px; }
.rf-sc-offline .rf-sc-i { color: var(--rf-amber); width: 17px; height: 17px; margin-top: 1px; }
.rf-sc-offline b { font-weight: 600; }
.rf-sc-scroll { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rf-sc-earlier { position: absolute; left: 50%; transform: translateX(-50%); top: 8px; z-index: 2; font-size: 11.5px; color: var(--rf-soft); border: 1px solid var(--rf-line-2); background: var(--rf-panel); padding: 4px 11px; border-radius: 20px; cursor: pointer; }
.rf-sc-earlier[hidden] { display: none; }
.rf-sc-list { flex: 1; min-height: 0; overflow-y: auto; padding: 40px 16px 10px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.rf-sc-list > :first-child { margin-top: auto; }
.rf-sc-list:focus-visible { outline: 2px solid var(--rf-accent); outline-offset: -2px; }
.rf-sc-loading { margin: auto; color: var(--rf-muted); font-size: 12.5px; }
.rf-sc-day { align-self: center; font: 500 11px var(--rf-mono); color: var(--rf-muted); padding: 3px 10px; border: 1px solid var(--rf-line); border-radius: 20px; background: var(--rf-panel); margin: 4px 0; }
.rf-sc-sys { align-self: center; text-align: center; font-size: 11.5px; color: var(--rf-muted); max-width: 330px; line-height: 1.45; }
.rf-sc-msg { max-width: 330px; display: flex; flex-direction: column; }
.rf-sc-who { font-size: 11.5px; color: var(--rf-muted); margin: 0 4px 4px; display: flex; gap: 6px; align-items: center; }
.rf-sc-who b { color: var(--rf-soft); font-weight: 500; }
.rf-sc-bubble { padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; color: var(--rf-head); white-space: pre-wrap; overflow-wrap: anywhere; }
.rf-sc-msg.them { align-self: flex-start; }
.rf-sc-msg.them .rf-sc-bubble { background: var(--rf-raise); border-top-left-radius: 4px; }
.rf-sc-msg.me { align-self: flex-end; align-items: flex-end; }
.rf-sc-msg.me .rf-sc-bubble { background: var(--rf-sc-mine); border: 1px solid var(--rf-sc-mine-line); border-top-right-radius: 4px; }
.rf-sc-msg.mate .rf-sc-bubble { background: var(--rf-panel-2); border: 1px solid var(--rf-line-2); }
.rf-sc-state { font: 400 10.5px var(--rf-mono); color: var(--rf-muted); margin: 4px 4px 0; display: flex; align-items: center; gap: 4px; }
.rf-sc-state .rf-sc-i { width: 14px; height: 14px; }
.rf-sc-state.read { color: var(--rf-blue); }
.rf-sc-state.failed { color: var(--rf-red); font-family: var(--rf-font); }
.rf-sc-state.failed button { border: 0; background: none; color: var(--rf-link); text-decoration: underline; cursor: pointer; padding: 0; }
.rf-sc-shot { margin-top: 6px; width: 250px; border-radius: 10px; overflow: hidden; border: 1px solid var(--rf-line-2); background: var(--rf-panel); padding: 0; cursor: pointer; text-align: left; color: inherit; }
.rf-sc-shot-img { height: 112px; background: var(--rf-panel-2); display: grid; place-items: center; color: var(--rf-muted); overflow: hidden; }
.rf-sc-shot-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rf-sc-shot-cap { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 7px 10px; font-size: 11.5px; color: var(--rf-soft); border-top: 1px solid var(--rf-line); }
.rf-sc-shot-cap span:first-child { color: var(--rf-head); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-sc-file { margin-top: 6px; display: flex; align-items: center; gap: 10px; padding: 9px 10px; width: 270px; max-width: 100%; border: 1px solid var(--rf-line-2); border-radius: 10px; background: var(--rf-panel); cursor: pointer; text-align: left; color: inherit; }
.rf-sc-ft { width: 34px; height: 40px; border-radius: 6px; display: grid; place-items: center; font: 600 9.5px var(--rf-mono); color: #fff; background: #B01B1B; flex: 0 0 auto; }
.rf-sc-ft.img { background: #115E59; }
:root[data-rf-theme="night"] .rf-sc-ft { background: #F87171; color: #1A0505; }
:root[data-rf-theme="night"] .rf-sc-ft.img { background: #2DD4BF; color: #06120F; }
.rf-sc-file-text { display: flex; flex-direction: column; min-width: 0; }
.rf-sc-fn { font-size: 12.5px; color: var(--rf-head); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-sc-fs { font: 400 10.5px var(--rf-mono); color: var(--rf-muted); margin-top: 2px; }
.rf-sc-dl { margin-left: auto; color: var(--rf-soft); }
.rf-sc-composer { border-top: 1px solid var(--rf-line); padding: 12px 16px; }
.rf-sc-staged { display: flex; flex-direction: column; gap: 6px; }
.rf-sc-staged:not(:empty) { margin-bottom: 8px; }
.rf-sc-stage { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--rf-line-2); border-radius: 9px; font-size: 12px; background: var(--rf-panel-2); }
.rf-sc-thumb { width: 30px; height: 30px; border-radius: 6px; background: var(--rf-raise); display: grid; place-items: center; color: var(--rf-soft); flex: 0 0 auto; }
.rf-sc-stage-text { min-width: 0; flex: 1; }
.rf-sc-nm { color: var(--rf-head); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-sc-sub { font: 400 10.5px var(--rf-mono); color: var(--rf-muted); margin-top: 2px; }
.rf-sc-x { margin-left: auto; color: var(--rf-muted); background: none; border: 0; cursor: pointer; padding: 2px; display: grid; }
.rf-sc-stage.err { border-color: color-mix(in srgb, var(--rf-red) 45%, transparent); background: color-mix(in srgb, var(--rf-red) 7%, transparent); }
.rf-sc-stage.err .rf-sc-sub { color: var(--rf-red); font-family: var(--rf-font); font-size: 11.5px; }
.rf-sc-progress { height: 4px; border-radius: 2px; background: var(--rf-line-2); margin-top: 5px; width: 190px; max-width: 100%; overflow: hidden; }
.rf-sc-progress i { display: block; height: 100%; background: var(--rf-green); transition: width .2s ease; }
.rf-sc-box { border: 1px solid var(--rf-line-2); border-radius: 11px; background: var(--rf-panel-2); padding: 10px 12px 8px; }
.rf-sc-box:focus-within, .rf-sc-box.focus { border-color: var(--rf-accent); box-shadow: 0 0 0 3px rgba(245, 197, 24, .22); }
.rf-sc-box textarea { width: 100%; min-height: 40px; max-height: 140px; resize: none; border: 0; outline: 0; background: transparent; color: var(--rf-head); font: 400 13px/1.5 var(--rf-font); padding: 0; }
.rf-sc-box textarea::placeholder { color: var(--rf-muted); }
.rf-sc-box-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.rf-sc-attach { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--rf-line-2); border-radius: 8px; background: var(--rf-panel); color: var(--rf-head); font-size: 12px; cursor: pointer; }
.rf-sc-send { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 8px; border: 0; background: var(--rf-accent); color: var(--rf-accent-ink); font-weight: 500; font-size: 13px; cursor: pointer; }
.rf-sc-send:disabled, .rf-sc-attach:disabled { opacity: .45; cursor: default; }
.rf-sc-hint { font: 400 10.5px var(--rf-mono); color: var(--rf-muted); margin-top: 7px; display: flex; justify-content: space-between; gap: 8px; }
.rf-sc-hint span:last-child { white-space: nowrap; }
.rf-sc-scroll.has-earlier .rf-sc-list { -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 36px, #000 96px); mask-image: linear-gradient(to bottom, transparent 0, transparent 36px, #000 96px); }
.rf-sc-privacy { display: flex; gap: 6px; align-items: center; margin-top: 5px; font-size: 11px; color: var(--rf-muted); }
.rf-sc-privacy .rf-sc-i { width: 12px; height: 12px; }
.rf-sc-empty { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 18px; }
.rf-sc-empty-mark { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; color: #7A5C00; background: rgba(245, 197, 24, .2); }
:root[data-rf-theme="night"] .rf-sc-empty-mark { color: var(--rf-accent); background: rgba(245, 197, 24, .14); }
.rf-sc-empty-mark .rf-sc-i { width: 26px; height: 26px; }
.rf-sc-empty h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--rf-head); }
.rf-sc-empty p { margin: 8px 0 0; font-size: 13px; line-height: 1.55; color: var(--rf-soft); }
.rf-sc-starters { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 18px; }
.rf-sc-starters button { border: 1px solid var(--rf-line-2); border-radius: 18px; padding: 6px 11px; font-size: 12px; color: var(--rf-head); background: var(--rf-panel); cursor: pointer; }
.rf-sc-private { display: flex; gap: 7px; align-items: center; justify-content: center; margin-top: 20px; font-size: 11.5px; color: var(--rf-muted); }
.rf-sc-private .rf-sc-i { width: 13px; height: 13px; }

/* ---------- Suspended tenant owner: chat only ---------- */
.rf-support-chat-only { position: fixed; inset: 0; z-index: 870; display: flex; align-items: center; padding: 32px; padding-right: 464px; background: var(--rf-bg, #F3F8F6); font-family: var(--rf-font, system-ui, sans-serif); }
.rf-sco-card { max-width: 460px; margin: 0 auto; }
.rf-sco-mark { width: 44px; height: 44px; }
.rf-sco-card h1 { color: var(--rf-head); font-size: 24px; margin: 18px 0 8px; font-weight: 600; }
.rf-sco-card p { color: var(--rf-soft); font-size: 14px; line-height: 1.6; margin: 0 0 18px; }
.rf-sco-signout { height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--rf-line-2); background: var(--rf-panel); color: var(--rf-head); cursor: pointer; font: 500 13px var(--rf-font, system-ui, sans-serif); }
html.rf-support-chat-only #login-page, html.rf-support-chat-only #sidebar { display: none !important; }

@media (max-width: 760px) {
  .rf-support-panel { width: 100vw; }
  .rf-support-chat-only { padding: 14px 16px; align-items: flex-start; }
  /* The paused screen on a phone: a bar with "Sign out" (and the Desktop's "View bills and receipts", when it adds
     it) stays visible above the chat, which starts below it (UAT plan 1, 17 Oct: the chat covered Sign out until it
     was closed with the cross). */
  .rf-support-chat-only .rf-sco-card { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: none; margin: 0; }
  .rf-support-chat-only .rf-sco-card > :not(.rf-sco-signout):not(.gl15-suspended-billing-open) { display: none; }
  html.rf-support-chat-only .rf-support-panel { top: 64px; }
}
@media (prefers-reduced-motion: reduce) { .rf-sc-progress i { transition: none; } }
