/* Support chat widget. Uses Salyo tokens when the page defines them. */
.sc-root {
  --sc-blue: var(--blue, #1f65db);
  --sc-magenta: var(--magenta, #ed355b);
  --sc-ink: var(--heading, #4a4a4a);
  --sc-muted: var(--muted, #7a7a7a);
  --sc-line: var(--line, rgba(31, 101, 219, 0.12));
  --sc-bg: var(--white, #fff);
  --sc-soft: var(--light, #f2f7ff);
  --sc-text: var(--font-text, var(--text, "Open Sans", "Segoe UI", sans-serif));
  --sc-display: var(--display, "Quicksand", "Segoe UI", sans-serif);
  --sc-grad: var(--grad, linear-gradient(293deg, #ed355b 0%, #1f65db 100%));
  --sc-shadow: 0 16px 40px rgba(31, 38, 135, 0.16);
  position: fixed;
  right: 1.15rem;
  bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  font-family: var(--sc-text);
  color: var(--sc-ink);
  line-height: 1.45;
}

.sc-fab {
  position: relative;
  height: 48px;
  padding: 0 1.15rem;
  border: 0;
  border-radius: 999px;
  background: var(--sc-grad);
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 101, 219, 0.28);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--sc-display);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sc-fab-icon {
  display: block;
  flex: none;
}
.sc-fab-label {
  line-height: 1;
  white-space: nowrap;
}
.sc-fab:hover { filter: brightness(1.05); }
.sc-fab[aria-expanded="true"] { box-shadow: 0 8px 18px rgba(28, 31, 43, 0.18); }
.sc-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sc-magenta);
  color: #fff;
  font-family: var(--sc-display);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.sc-fab.is-hot { animation: sc-pulse 1.6s ease-in-out infinite; }

@keyframes sc-pulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(237, 53, 91, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(237, 53, 91, 0.16), 0 10px 24px rgba(237, 53, 91, 0.28); }
}

.sc-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(380px, calc(100vw - 1.5rem));
  height: min(540px, calc(100vh - 7.5rem));
  display: flex;
  flex-direction: column;
  background: var(--sc-bg);
  border: 1px solid var(--sc-line);
  border-radius: 18px;
  box-shadow: var(--sc-shadow);
  overflow: hidden;
}
.sc-panel[hidden] { display: none; }

.sc-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem;
  background: var(--sc-grad);
  color: #fff;
}
.sc-head strong {
  display: block;
  font-family: var(--sc-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sc-sub {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  opacity: 0.9;
}
.sc-head-text { flex: 1; min-width: 0; }
.sc-icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
}
.sc-icon-btn:hover { background: rgba(255, 255, 255, 0.28); }
.sc-icon-btn[hidden] { display: none; }

.sc-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem;
  background: linear-gradient(180deg, var(--sc-soft), var(--sc-bg) 90px);
}
.sc-empty, .sc-status {
  margin: 0.4rem 0;
  color: var(--sc-muted);
  font-size: 0.92rem;
}
.sc-error { color: var(--sc-magenta); }

.sc-who {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.sc-who[hidden] { display: none; }
.sc-who input,
.sc-form textarea {
  width: 100%;
  border: 1px solid var(--sc-line);
  border-radius: 12px;
  background: #fff;
  color: var(--sc-ink);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.55rem 0.7rem;
}
.sc-who input:focus,
.sc-form textarea:focus {
  outline: 2px solid rgba(31, 101, 219, 0.35);
  border-color: var(--sc-blue);
}

.sc-msgs { display: flex; flex-direction: column; gap: 0.55rem; }
.sc-msg { max-width: 85%; display: flex; flex-direction: column; gap: 0.15rem; }
.sc-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.sc-msg.is-theirs { align-self: flex-start; align-items: flex-start; }
.sc-bubble {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.94rem;
}
.sc-msg.is-mine .sc-bubble {
  background: var(--sc-grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sc-msg.is-theirs .sc-bubble {
  background: #fff;
  color: var(--sc-ink);
  border: 1px solid var(--sc-line);
  border-bottom-left-radius: 4px;
}
.sc-msg.is-pending .sc-bubble { opacity: 0.72; }
.sc-msg.is-failed .sc-bubble { outline: 1px solid var(--sc-magenta); }
.sc-meta {
  font-size: 0.72rem;
  color: var(--sc-muted);
}
.sc-role { font-weight: 600; }

.sc-form {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
  padding: 0.7rem;
  border-top: 1px solid var(--sc-line);
  background: #fff;
}
.sc-form[hidden] { display: none; }
.sc-form textarea {
  resize: none;
  min-height: 42px;
  max-height: 120px;
}
.sc-send {
  border: 0;
  border-radius: 12px;
  background: var(--sc-grad);
  color: #fff;
  font-family: var(--sc-display);
  font-weight: 700;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.sc-send:disabled { opacity: 0.55; cursor: default; }

.sc-list { display: flex; flex-direction: column; gap: 0.4rem; }
.sc-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--sc-line);
  background: #fff;
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.sc-item:hover, .sc-item.is-active { border-color: rgba(31, 101, 219, 0.45); }
.sc-item.is-unread {
  background: #fff5f7;
  border-color: rgba(237, 53, 91, 0.45);
  box-shadow: inset 3px 0 0 var(--sc-magenta);
}
.sc-item-top, .sc-page-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}
.sc-item-title, .sc-page-item-title {
  font-family: var(--sc-display);
  font-weight: 700;
  color: var(--sc-ink);
}
.sc-item-preview, .sc-page-item-preview {
  margin: 0.2rem 0 0;
  color: var(--sc-muted);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-count {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--sc-magenta);
  color: #fff;
  font-family: var(--sc-display);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

.support-inbox-page h1 { margin-bottom: 0.35rem; }
.sc-page {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 0.9rem;
  min-height: 32rem;
  margin-top: 1rem;
}
.sc-page-list, .sc-page-thread {
  background: var(--card, #fff);
  border: 1px solid var(--border, var(--sc-line));
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 10px 30px rgba(31, 38, 135, 0.08));
  min-height: 28rem;
}
.sc-page-list { padding: 0.7rem; overflow: auto; max-height: calc(100vh - 12rem); }
.sc-page-thread { display: flex; flex-direction: column; min-width: 0; }
.sc-page-head {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--sc-line);
}
.sc-page-head strong { font-family: var(--sc-display); }
.sc-page-msgs {
  flex: 1;
  overflow: auto;
  padding: 0.9rem 1rem;
  max-height: calc(100vh - 18rem);
}
.sc-page-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--sc-line);
}
.sc-page-form textarea {
  flex: 1;
  resize: none;
  min-height: 46px;
  border: 1px solid var(--sc-line);
  border-radius: 12px;
  font: inherit;
  padding: 0.55rem 0.7rem;
}
.sc-page-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 0.65rem 0.55rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.sc-page-item.is-active { background: var(--sc-soft); }
.sc-page-item.is-unread {
  background: #fff5f7;
  box-shadow: inset 3px 0 0 var(--sc-magenta);
}
.sc-page-item.is-unread .sc-page-item-title { color: var(--sc-magenta); }

@media (max-width: 800px) {
  .sc-page { grid-template-columns: 1fr; }
  .sc-page-list, .sc-page-msgs { max-height: 22rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-fab.is-hot { animation: none; }
}
