:root {
  --bg: #071014;
  --bg-elevated: #0d171c;
  --panel: #101c22;
  --header: #15252d;
  --incoming: #1c2c34;
  --outgoing: #0d6b5c;
  --text: #eef3f5;
  --muted: #8aa0ab;
  --input: #243740;
  --accent: #1ec9a0;
  --accent-dim: #149a78;
  --line: rgba(255, 255, 255, 0.07);
  --danger: #e35d6a;
  --ok: #c9f5df;
  --radius: 18px;
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

html,
body {
  width: 100%;
  max-width: 100%;
}

body {
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  display: grid;
  place-items: stretch;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(30, 201, 160, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(53, 140, 180, 0.1), transparent 50%),
    linear-gradient(165deg, #050a0d 0%, #0a1419 42%, #071016 100%);
  -webkit-tap-highlight-color: transparent;
  /* Stop iOS/Android rubber-band of the whole page */
  position: fixed;
  inset: 0;
}

/* ========== AUTH (web landing) ========== */
.auth-gate {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  place-items: center;
  align-content: start;
  justify-items: center;
  gap: 28px;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  animation: fadeRise 0.45s ease-out;
}

.seo-landing {
  width: min(980px, 100%);
  padding: 8px 8px 28px;
  color: #c5d5dc;
}

.seo-landing h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 10px;
}

.seo-landing p {
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 10px;
  max-width: 70ch;
}

.seo-landing ul {
  margin: 8px 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #b8c9d1;
}

.seo-landing strong {
  color: var(--accent);
  font-weight: 700;
}

.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0;
  background: rgba(16, 28, 34, 0.88);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-brand {
  position: relative;
  padding: 48px 44px;
  background:
    linear-gradient(145deg, rgba(20, 154, 120, 0.22) 0%, transparent 48%),
    linear-gradient(200deg, #12262e 0%, #0b171c 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-height: 420px;
}

.auth-brand::after {
  content: "";
  position: absolute;
  inset: auto -20% -30% 20%;
  height: 220px;
  background: radial-gradient(circle, rgba(30, 201, 160, 0.18), transparent 70%);
  pointer-events: none;
}

.brand-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.brand-name {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.brand-lead {
  color: #c5d5dc;
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 28ch;
}

.brand-points {
  list-style: none;
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.brand-points li {
  color: var(--muted);
  font-size: 0.92rem;
  padding-left: 18px;
  position: relative;
}

.brand-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
}

.auth-card {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--panel);
}

.auth-card-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.auth-sub {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 20px;
  line-height: 1.45;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  background: #0b151a;
  border-radius: 12px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-tab.active {
  background: var(--accent);
  color: #042018;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.auth-form input {
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  transition: border-color 0.15s ease;
}

.auth-form input:focus {
  border-color: rgba(30, 201, 160, 0.45);
}

.auth-btn {
  width: 100%;
  border: none;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #042018;
  border-radius: 12px;
  padding: 13px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.auth-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: 10px;
}

.auth-form .field-hint {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.dob-field {
  margin-bottom: 12px;
}

.dob-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.dob-row {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1.25fr;
  gap: 8px;
}

.dob-part {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.auth-form select,
.dob-part select {
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 10px;
  font: inherit;
  font-size: 0.95rem;
  width: 100%;
  cursor: pointer;
  color-scheme: dark;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px),
    calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.auth-form select:focus,
.dob-part select:focus {
  border-color: rgba(30, 201, 160, 0.45);
}

.age-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
  cursor: pointer;
}

.age-check input {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auth-remember-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(230, 170, 60, 0.35);
  background: rgba(230, 170, 60, 0.1);
  color: #f0d28a;
  font-size: 0.8rem;
  line-height: 1.4;
}

.btn-link {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
}

.btn-link:hover {
  color: var(--text);
}

.creds-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(30, 201, 160, 0.35);
  background: rgba(30, 201, 160, 0.08);
}

.creds-title {
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--ok);
}

.creds-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.creds-row b {
  color: var(--text);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.creds-note {
  margin: 10px 0 12px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.auth-admin {
  text-align: center;
  margin-top: 14px;
}

.auth-admin a {
  color: #6ec8e8;
  font-size: 0.85rem;
  text-decoration: none;
}

.auth-admin a:hover {
  text-decoration: underline;
}

.reg-result {
  margin-top: 12px;
  background: #0b141a;
  color: var(--ok);
  padding: 12px;
  border-radius: 10px;
  white-space: pre-wrap;
  font-size: 0.85rem;
  border: 1px solid rgba(30, 201, 160, 0.2);
}

@keyframes fadeRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ========== APP SHELL (web chat) ========== */
.app-shell.phone,
.phone {
  width: 100%;
  max-width: 1100px;
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 0;
  overflow: hidden;
  position: relative;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: fadeRise 0.35s ease-out;
  /* Flex children must be allowed to shrink so only .messages scrolls */
  min-height: 0;
  touch-action: manipulation;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(180deg, #1a2d36 0%, var(--header) 100%);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.reset-btn {
  border: 1px solid var(--line);
  background: rgba(36, 55, 64, 0.9);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.12s ease;
}

.reset-btn:hover {
  background: #2f4752;
}

.role-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  background: #172028;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  max-height: min(46vh, 360px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.role-bar .full {
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

.venice-panel,
.custom-panel,
.maa-panel {
  display: grid;
  gap: 8px;
}

.char-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-btn {
  border: none;
  background: var(--accent);
  color: #042018;
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.check {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  font-size: 0.8rem !important;
  color: var(--text) !important;
}

#character-select {
  width: 100%;
  min-height: 88px;
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 10px;
  padding: 6px;
  font: inherit;
  font-size: 0.8rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.hours-badge {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(30, 201, 160, 0.14);
  color: var(--ok);
  border: 1px solid rgba(30, 201, 160, 0.28);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  min-width: 3.6rem;
  text-align: center;
}

.hours-badge.hours-low {
  background: rgba(230, 170, 60, 0.18);
  color: #f0d28a;
  border-color: rgba(230, 170, 60, 0.35);
}

.user-chip {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: #e8f4f8;
  background: rgba(30, 201, 160, 0.14);
  border: 1px solid rgba(30, 201, 160, 0.35);
  padding: 6px 9px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  font: inherit;
}

.user-chip:hover {
  background: rgba(30, 201, 160, 0.24);
}

.user-chip:empty {
  display: none;
}

.chat-status-line {
  font-size: 0.72rem;
  color: var(--muted);
}

.logout-btn {
  background: rgba(227, 93, 106, 0.12);
  border-color: rgba(227, 93, 106, 0.35);
  color: #f0b4ba;
}

.logout-btn:hover {
  background: rgba(227, 93, 106, 0.22);
}

@media (max-width: 560px) {
  .user-chip {
    display: inline-flex;
    padding: 5px 8px;
    font-size: 0.68rem;
  }
  .logout-btn {
    padding: 7px 10px;
  }
}

.upi-qr {
  width: min(150px, 42vw);
  height: auto;
  max-height: 150px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  display: block;
  margin: 0 auto;
}

.pay-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 8px;
  background: #0f171c;
  border-radius: 12px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.pay-box {
  font-size: 0.82rem;
  color: var(--ok);
  background: #122018;
  border: 1px solid rgba(30, 201, 160, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.45;
  margin-bottom: 10px;
}

.pay-card {
  width: 100%;
  max-width: 100%;
  gap: 10px;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column;
  max-height: min(92dvh, 700px);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
}

.pay-user-line {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 2px 0 0;
}

.pay-id-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(30, 201, 160, 0.35);
  background: rgba(30, 201, 160, 0.1);
}

.pay-id-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.pay-id-banner strong {
  font-size: 1.25rem;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
}

.pay-remember-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #f0d28a;
}

.pay-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.pay-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex-shrink: 0;
}

.pay-step {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 4px;
  cursor: default;
  font: inherit;
}

.pay-step.active {
  color: #042018;
  background: var(--accent);
  border-color: transparent;
}

.pay-step.done {
  color: var(--ok);
  border-color: rgba(30, 201, 160, 0.35);
}

.pay-pane {
  display: none;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.pay-pane.active {
  display: flex;
}

.pay-section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.package-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
  align-content: start;
}

.package-card {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(165deg, #142028 0%, #0e171c 100%);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 10px 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  display: grid;
  gap: 2px;
  min-height: 0;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.package-card:hover {
  border-color: rgba(30, 201, 160, 0.45);
  transform: translateY(-1px);
}

.package-card.selected {
  border-color: var(--accent);
  background: linear-gradient(165deg, rgba(30, 201, 160, 0.18) 0%, #102018 100%);
  box-shadow: 0 0 0 1px rgba(30, 201, 160, 0.35);
}

.package-card.pack-popular {
  border-color: rgba(240, 210, 138, 0.35);
}

.package-card.pack-best {
  border-color: rgba(30, 201, 160, 0.45);
}

.package-card .pack-badge {
  justify-self: start;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(30, 201, 160, 0.2);
  color: var(--ok);
}

.package-card.pack-popular .pack-badge {
  background: rgba(240, 210, 138, 0.2);
  color: #f0d28a;
}

.package-card .pack-badge-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 600;
}

.package-card .pack-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.package-card .pack-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.package-card .pack-was {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: line-through;
}

.package-card .pack-price {
  color: var(--accent);
  font-weight: 800;
  font-size: 1.1rem;
}

.package-card .pack-meta {
  color: var(--muted);
  font-size: 0.7rem;
}

.package-card .pack-save {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f0d28a;
}

.package-card .pack-save-muted {
  color: var(--muted);
  font-weight: 500;
}

.pay-selected-summary {
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 201, 160, 0.16), rgba(30, 201, 160, 0.05));
  border: 1px solid rgba(30, 201, 160, 0.35);
  line-height: 1.35;
  flex-shrink: 0;
}

.pay-selected-summary .sum-amount {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
}

.pay-selected-summary .sum-was {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: line-through;
  font-weight: 600;
  margin-left: 6px;
}

.pay-selected-summary .sum-save {
  color: #f0d28a;
  font-weight: 700;
}

.pay-selected-summary .sum-detail {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: #c5d5dc;
}

.pay-amount-line {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(30, 201, 160, 0.08);
  border: 1px solid rgba(30, 201, 160, 0.22);
  flex-shrink: 0;
}

.pay-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 8px;
  background: #0f171c;
  border-radius: 12px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.upi-qr {
  width: min(150px, 42vw);
  height: auto;
  max-height: 150px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.pay-upi-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.upi-id-display {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  background: #0b141a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-open-link {
  text-align: center;
  text-decoration: none;
  display: block;
  flex-shrink: 0;
}

.pay-nav-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto;
}

.pay-nav-btn {
  width: 100%;
  margin: 0;
}

.pay-remark-label {
  flex-shrink: 0;
}

.pay-remark-label input[readonly] {
  opacity: 0.9;
  cursor: default;
}

.pay-upload {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1.5px dashed rgba(30, 201, 160, 0.4);
  border-radius: 12px;
  background: rgba(30, 201, 160, 0.06);
  cursor: pointer;
  padding: 12px;
  text-align: center;
  color: var(--ok);
  font-weight: 600;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.pay-upload input {
  display: none;
}

.pay-upload.has-file {
  border-style: solid;
  color: var(--text);
}

.pay-upload-focus .pay-upload {
  border-color: rgba(30, 201, 160, 0.75);
  box-shadow: 0 0 0 3px rgba(30, 201, 160, 0.12);
  animation: pay-upload-soft 1.8s ease-in-out 2;
}

@keyframes pay-upload-soft {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(30, 201, 160, 0.1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(30, 201, 160, 0.2);
  }
}

.pay-preview {
  width: 100%;
  max-height: 100px;
  object-fit: contain;
  border-radius: 10px;
  background: #0b141a;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.pay-msg {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.1em;
  margin: 0;
}

.pay-msg.ok {
  color: var(--ok);
}

.pay-msg.err {
  color: var(--danger);
}

.pay-pending-banner {
  padding: 12px;
  border-radius: 12px;
  background: rgba(230, 170, 60, 0.14);
  border: 1px solid rgba(230, 170, 60, 0.4);
  color: #f0d28a;
  line-height: 1.4;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.pay-pending-banner strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: #ffe2a8;
}

.pay-pending-banner.approved {
  background: rgba(30, 201, 160, 0.14);
  border-color: rgba(30, 201, 160, 0.4);
  color: var(--ok);
}

.pay-pending-banner.approved strong {
  color: #b8f5d8;
}

.pay-refresh-btn {
  margin-top: 4px;
}

.pay-copy-details {
  margin: 0 0 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
}

.welcome-tip {
  position: absolute;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100% - 24px));
  z-index: 28;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(30, 201, 160, 0.35);
  background: rgba(13, 23, 28, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.admin-notice {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100% - 24px));
  z-index: 36;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(240, 210, 138, 0.4);
  background: rgba(18, 28, 34, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 8px;
}

.admin-notice.hidden {
  display: none !important;
}

.admin-notice-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f0d28a;
}

.admin-notice-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.admin-notice-text {
  margin: 0 0 6px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #c5d5dc;
  white-space: pre-wrap;
}

.admin-notice-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
}

.admin-notice-actions .btn-outline,
.admin-notice-actions .auth-btn {
  width: 100%;
  padding: 11px 12px;
}

.welcome-tip.hidden {
  display: none !important;
}

.welcome-tip-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ok);
}

.welcome-tip ul {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.welcome-tip li {
  margin-bottom: 4px;
}

.welcome-tip b {
  color: var(--text);
}

.welcome-tip .auth-btn {
  margin-top: 0;
  padding: 10px 12px;
}

.worked-status {
  display: none !important;
}

.pay-history {
  display: grid;
  gap: 6px;
  max-height: 72px;
  overflow: hidden;
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

.pay-history-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #0f1a20;
  border: 1px solid var(--line);
}

.pay-status {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.pay-status.pending {
  color: #f0d28a;
}

.pay-status.approved {
  color: var(--ok);
}

.pay-status.rejected {
  color: var(--danger);
}

.pay-box {
  font-size: 0.78rem;
  color: var(--ok);
  background: #122018;
  border: 1px solid rgba(30, 201, 160, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
  line-height: 1.4;
  margin: 0;
  flex-shrink: 0;
}

.sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.sheet-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(88dvh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #15252d;
  border-radius: 20px;
  padding: 14px 16px 16px;
  animation: sheetIn 0.22s ease-out;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  margin: 0 auto;
}

.sheet-card::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #3b4a54;
  margin: 4px auto 8px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.sheet-head h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0;
}

.sheet-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.sheet-card input,
.sheet-card select {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 0.9rem;
}

@keyframes sheetIn {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes sheetUp {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.scene-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #122018;
  border-bottom: 1px solid rgba(30, 201, 160, 0.25);
  flex-shrink: 0;
}

.scene-chip span {
  font-size: 0.75rem;
  color: var(--ok);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-btn {
  border: 1px solid var(--line);
  background: #2a3942;
  color: #e9edef;
  border-radius: 10px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  flex-shrink: 0;
}

.phone.chat-focus .messages {
  min-height: 0;
}

.bubble .rp-action {
  font-style: italic;
  opacity: 0.92;
}

.char-info {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.role-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--muted);
}

.role-bar input,
.role-bar select {
  width: 100%;
  border: none;
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  font-size: 0.82rem;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1ec9a0, #0d6b5c);
  color: #042018;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header-text h1,
.header-text .chat-title-text {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-text p#status {
  font-size: 0.8rem;
  color: var(--accent);
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(ellipse at top, rgba(30, 201, 160, 0.04), transparent 50%),
    linear-gradient(rgba(7, 16, 20, 0.96), rgba(7, 16, 20, 0.96)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 22px,
      rgba(255, 255, 255, 0.012) 22px,
      rgba(255, 255, 255, 0.012) 23px
    );
}

.bubble {
  max-width: min(520px, 78%);
  padding: 10px 12px 8px;
  border-radius: 14px;
  font-size: 0.96rem;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  animation: pop 0.18s ease-out;
  border: 1px solid transparent;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.bubble.incoming {
  align-self: flex-start;
  background: var(--incoming);
  border-color: rgba(255, 255, 255, 0.04);
  border-top-left-radius: 4px;
}

.bubble.outgoing {
  align-self: flex-end;
  background: var(--outgoing);
  border-color: rgba(30, 201, 160, 0.15);
  border-top-right-radius: 4px;
}

.bubble .meta {
  display: block;
  text-align: right;
  font-size: 0.68rem;
  color: rgba(233, 237, 239, 0.55);
  margin-top: 4px;
}

.bubble-report-btn {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}

.bubble-report-btn:hover {
  color: #f0b4ba;
  border-color: rgba(227, 93, 106, 0.35);
}

.bubble-report-btn.done {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.report-card label.full {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.report-card select,
.report-card input {
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 0.95rem;
}

.support-card {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 760px);
  height: min(92dvh, 760px);
  padding: 14px 14px calc(12px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.support-messages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 2px 12px;
  margin: 4px 0 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.support-messages::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.support-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.support-bubble.user {
  align-self: flex-end;
  background: rgba(30, 201, 160, 0.18);
  border: 1px solid rgba(30, 201, 160, 0.28);
}

.support-bubble.admin {
  align-self: flex-start;
  background: var(--incoming);
  border: 1px solid var(--line);
}

.support-bubble .support-who {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.support-bubble img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  margin-top: 8px;
  border-radius: 10px;
  object-fit: contain;
  background: #0b141a;
}

.support-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.support-upload {
  min-height: 48px;
  font-size: 0.82rem;
}

.support-send-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.support-send-row input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 14px;
  font: inherit;
}

.support-send-row .auth-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 72px;
  padding: 12px 16px;
  border-radius: 999px;
}

.support-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 12px;
  line-height: 1.45;
}

.bubble.error {
  background: #5c2b2b;
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 0.85rem;
}

.typing {
  align-self: flex-start;
  background: var(--incoming);
  padding: 10px 14px;
  border-radius: 14px;
  border-top-left-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 85%;
}

.typing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.typing-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.typing-stay {
  display: block;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0.85;
  font-weight: 500;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span,
.typing > span:not(.typing-label):not(.typing-dots):not(.typing-stay) {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: var(--header);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.composer input {
  flex: 1;
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  /* 16px+ prevents iOS focus-zoom that shifts the whole UI */
  font-size: 16px;
}

.composer input::placeholder {
  color: var(--muted);
}

.composer button {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #042018;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.composer .image-btn {
  background: #2a3942;
  color: var(--text);
  font-size: 1.1rem;
  border: 1px solid var(--line);
}

.composer button:hover:not(:disabled) {
  transform: scale(1.04);
}

.composer button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.image-bubble,
.image-only {
  max-width: min(360px, 85%);
  padding: 6px;
  background: var(--incoming);
}

.image-only img,
.image-bubble img {
  display: block;
  width: 100%;
  max-width: 320px;
  min-height: 120px;
  border-radius: 10px;
  background: #1a1a1a;
  object-fit: cover;
}

.image-bubble .caption {
  display: block;
  margin-top: 6px;
  padding: 0 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #243740;
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
}

.setup-modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(5, 10, 13, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.setup-card {
  width: min(560px, 100%);
  max-height: min(92%, 780px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #15252d;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 20px 18px;
  animation: sheetIn 0.22s ease-out;
  box-shadow: var(--shadow);
}

.setup-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.setup-sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
  line-height: 1.45;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.setup-grid .full {
  grid-column: 1 / -1;
}

.setup-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.setup-grid input,
.setup-grid select,
.setup-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  background: var(--input);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 0.9rem;
}

.setup-grid textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.35;
}

.setup-advanced {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.setup-advanced[open] {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.setup-advanced[open] > .full {
  grid-column: 1 / -1;
}

.setup-advanced-title {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.setup-advanced-title::-webkit-details-marker {
  display: none;
}

.setup-advanced-title::after {
  content: " ▾";
  font-size: 0.7rem;
  opacity: 0.7;
}

.setup-advanced[open] > .setup-advanced-title::after {
  content: " ▴";
}

/* First-time modal: keep it simple — hide advanced options */
#setup-modal .setup-advanced {
  display: none !important;
}

.btn-outline {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sidebar {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  justify-content: flex-start;
}

.sidebar-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.sidebar-panel {
  position: relative;
  z-index: 1;
  width: min(400px, 94%);
  height: 100%;
  background: #122028;
  border-right: 1px solid var(--line);
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideInLeft 0.2s ease-out;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.sidebar-scroll .setup-grid {
  gap: 8px;
  margin-bottom: 0;
}

.sidebar-scroll .setup-grid input,
.sidebar-scroll .setup-grid select,
.sidebar-scroll .setup-grid textarea {
  padding: 9px 10px;
  font-size: 0.86rem;
}

.sidebar-scroll .setup-grid textarea {
  min-height: 52px;
}

.sidebar-support-btn {
  flex-shrink: 0;
  margin: 0;
  padding: 11px 12px;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #1ec9a0 0%, #16a884 100%);
  border: none;
  box-shadow: 0 6px 16px rgba(30, 201, 160, 0.22);
}

@keyframes slideInLeft {
  from {
    transform: translateX(-24px);
    opacity: 0.7;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-head h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.account-box {
  flex-shrink: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(30, 201, 160, 0.28);
  background: rgba(30, 201, 160, 0.08);
}

.account-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.account-id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-id-row b {
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
}

.account-hint {
  margin-top: 6px;
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--muted);
}

.sidebar-actions {
  display: grid;
  gap: 6px;
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-actions .auth-btn,
.sidebar-actions .btn-outline {
  padding: 11px 12px;
}

/* Desktop web-app frame */
@media (min-width: 900px) {
  html,
  body {
    position: static;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  body {
    padding: 20px;
    place-items: center;
  }

  .app-shell.phone,
  .phone {
    height: min(860px, calc(100dvh - 40px));
    max-height: calc(100dvh - 40px);
    border-radius: 24px;
    border: 1px solid var(--line);
  }

  .messages {
    padding: 22px 28px 28px;
  }

  .bubble {
    max-width: min(560px, 70%);
  }

  .sheet {
    justify-content: center;
    align-items: center;
    padding: 20px;
  }

  .sheet-card {
    width: min(420px, 92%);
    border-radius: 20px;
    max-height: min(88vh, 640px);
    padding: 16px 18px 18px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .sheet-card.pay-card {
    width: min(420px, 92%);
  }

  .sheet-handle {
    display: none;
  }
}

/* Tablet / small laptop auth stack */
@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .auth-brand {
    min-height: auto;
    padding: 32px 28px 24px;
  }

  .brand-name {
    font-size: 2.3rem;
  }

  .auth-card {
    padding: 28px 24px 30px;
  }

  .seo-landing {
    width: 100%;
    padding: 8px 20px 28px;
  }
}

/* Phone — app-like login (SEO must not cover the Login button) */
@media (max-width: 560px) {
  body {
    padding: 0;
  }

  .auth-gate {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100%;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    gap: 0;
    place-items: unset;
    align-content: unset;
    justify-items: unset;
  }

  /* Login first — SEO stays below in normal document flow (scroll to read) */
  .seo-landing {
    position: static;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 20px 20px max(36px, env(safe-area-inset-bottom));
    overflow: visible;
    clip: auto;
    white-space: normal;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: #071014;
    flex-shrink: 0;
  }

  .seo-landing h2 {
    font-size: 1.1rem;
  }

  .seo-landing p,
  .seo-landing ul {
    font-size: 0.86rem;
  }

  .auth-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 0 0 auto;
    min-height: auto;
    height: auto;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: var(--panel);
    overflow: visible;
  }

  .auth-brand {
    flex-shrink: 0;
    min-height: 0;
    padding: 16px 20px 10px;
    padding-top: max(16px, env(safe-area-inset-top));
    gap: 2px;
    background:
      linear-gradient(145deg, rgba(20, 154, 120, 0.18) 0%, transparent 55%),
      linear-gradient(200deg, #12262e 0%, #0f1c22 100%);
  }

  .auth-brand::after {
    display: none;
  }

  .auth-brand .brand-lead,
  .auth-brand .brand-points {
    display: none;
  }

  .brand-kicker {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
  }

  .brand-name {
    font-size: 1.65rem;
    line-height: 1.1;
  }

  .auth-card {
    flex: 1 1 auto;
    padding: 12px 20px max(24px, env(safe-area-inset-bottom));
    justify-content: flex-start;
    background: transparent;
  }

  .auth-card-title {
    font-size: 1.28rem;
    margin-bottom: 4px;
  }

  .auth-sub {
    margin-bottom: 14px;
    font-size: 0.86rem;
  }

  .auth-tabs {
    margin-bottom: 14px;
  }

  .auth-form {
    display: grid;
    gap: 12px;
  }

  .auth-form .auth-btn {
    margin-top: 4px;
  }

  .app-shell.phone,
  .phone {
    max-width: none;
    width: 100%;
    border: none;
    box-shadow: none;
    /* Lock chat frame to the live viewport (keyboard-safe) */
    position: fixed;
    inset: 0;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
  }

  .chat-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .messages {
    padding: 14px 12px 18px;
  }

  .composer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header-actions .reset-btn {
    padding: 7px 8px;
    font-size: 0.7rem;
  }

  /* All overlays centered in the phone — never bottom-sheet */
  .setup-modal,
  .sheet,
  #pay-sheet.sheet,
  #report-sheet.sheet,
  #support-sheet.sheet {
    align-items: center;
    justify-content: center;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .setup-card,
  .sheet-card,
  .sheet-card.pay-card,
  .sheet-card.report-card,
  .sheet-card.support-card,
  .sheet-card.setup-card {
    width: min(100%, 420px);
    max-width: 100%;
    max-height: min(90dvh, 720px);
    border-radius: 20px;
    margin: 0 auto;
  }

  .setup-card {
    width: min(100%, 420px);
    padding: 18px 16px 16px;
  }

  .sheet-handle {
    display: none;
  }

  .sheet-card.support-card {
    height: auto;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .support-compose {
    flex: 0 0 auto;
  }

  .support-upload {
    min-height: 44px;
  }

  .support-send-row .auth-btn {
    min-height: 46px;
  }
}

/* Toasts */
#toast-host {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100% - 24px));
  pointer-events: none;
}

.toast {
  background: #15252d;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.2s ease;
}

.toast-ok {
  border-color: rgba(30, 201, 160, 0.45);
  color: #c9f5df;
}

.toast-err {
  border-color: rgba(227, 93, 106, 0.45);
  color: #ff8e9a;
}

.toast-out {
  opacity: 0;
  transform: translateY(8px);
  transition: 0.25s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.send-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(4, 32, 24, 0.25);
  border-top-color: #042018;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.send-spinner.hidden,
.send-icon.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#send-btn.is-busy {
  opacity: 0.85;
}

.jump-latest {
  position: absolute;
  right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 15;
  background: var(--accent, #1ec9a0);
  color: #042018;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.jump-latest.hidden {
  display: none !important;
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 10px;
  cursor: pointer;
}

.sound-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #1ec9a0;
}

