/* ── Fonts ───────────────────────────────────────────────── */
@font-face { font-family: 'Coliner'; src: url('/fonts/Coliner-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Coliner'; src: url('/fonts/Coliner-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Coliner'; src: url('/fonts/Coliner-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Coliner'; src: url('/fonts/Coliner-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Coliner'; src: url('/fonts/Coliner-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/Nunito-VariableFont_wght.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --ink:        #1A0F4D;
  --ink-2:      #2A1E60;
  --ink-80:     rgba(26,15,77,0.8);
  --ink-50:     rgba(26,15,77,0.5);
  --ink-10:     rgba(26,15,77,0.1);
  --mint:       #00FFC2;
  --mint-soft:  #B6F3E3;
  --mint-tint:  #E8FFF8;
  --paper:      #FFFEFE;
  --paper-2:    #F7F5FA;
  --grey-100:   #F7F5FA;
  --grey-150:   #F2F2F6;
  --grey-200:   #EFEDF3;
  --grey-300:   #E3DEEA;
  --grey-400:   #B7B3BE;
  --grey-500:   #9292A0;
  --grey-600:   #514B5D;
  --grey-700:   #261E35;
  --warning:    #FCB93E;
  --alert-text: #E23A22;

  --radius-sm:   12px;
  --radius-md:   16px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-2xl:  32px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(26,15,77,0.04);
  --shadow-sm: 0 2px 8px rgba(26,15,77,0.06);
  --shadow-md: 0 8px 24px rgba(26,15,77,0.08);
  --shadow-lg: 0 16px 40px rgba(26,15,77,0.12);

  --font-display: 'Coliner', system-ui, sans-serif;
  --font-ui:      'Coliner', system-ui, sans-serif;
  --font-label:   'Nunito', system-ui, sans-serif;
  --font-mono:    'Roboto Mono', ui-monospace, Menlo, monospace;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--grey-100);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
svg { display: block; flex-shrink: 0; }

/* ── Typography ──────────────────────────────────────────── */
.display-l { font-family: var(--font-display); font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -0.02em; }
.display-m { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1.05; letter-spacing: -0.02em; }
.display-s { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.1; letter-spacing: -0.02em; }
.h1  { font-family: var(--font-ui); font-weight: 700; font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; }
.h2  { font-family: var(--font-ui); font-weight: 700; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; }
.h3  { font-family: var(--font-ui); font-weight: 700; font-size: 16px; line-height: 1.3; }
.body   { font-family: var(--font-ui); font-weight: 400; font-size: 16px; line-height: 1.4; }
.body-s { font-family: var(--font-ui); font-weight: 400; font-size: 14px; line-height: 1.4; }
.label  { font-family: var(--font-label); font-weight: 700; font-size: 13px; line-height: 1.2; }
.meta   { font-family: var(--font-label); font-weight: 400; font-size: 12px; line-height: 1.3; color: var(--grey-500); }
.meta-strong { font-family: var(--font-label); font-weight: 700; font-size: 12px; line-height: 1.3; }
.mono { font-family: var(--font-mono); font-weight: 500; font-size: 12px; line-height: 1.3; }
.muted { color: var(--grey-500); }

/* ── Layout helpers ──────────────────────────────────────── */
.row   { display: flex; flex-direction: row; align-items: flex-start; }
.col   { display: flex; flex-direction: column; }
.v-center { align-items: center; }
.between  { justify-content: space-between; }
.center   { justify-content: center; }
.h-center { justify-content: center; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* ── Brand wordmark ──────────────────────────────────────── */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  user-select: none;
}
.wordmark .send { color: var(--mint); }
.ds-mark {
  display: inline-block;
  width: 28px;
  height: 14px;
  position: relative;
}
.ds-mark::before,
.ds-mark::after {
  content: '';
  position: absolute;
  border-radius: 3px;
}
.ds-mark::before {
  left: 0; top: 0;
  width: 9px; height: 9px;
  background: var(--ink);
}
.ds-mark::after {
  right: 0; top: 0;
  width: 9px; height: 9px;
  background: var(--mint);
}

/* ── Chips ───────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  padding: 0 10px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--grey-200);
  color: var(--grey-700);
  white-space: nowrap;
}
.chip.mint  { background: var(--mint-tint); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--mint); }
.chip.ink   { background: var(--ink); color: var(--mint); }
.chip.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--grey-300); color: var(--grey-700); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-xl);
  transition: background 0.12s, opacity 0.12s;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--grey-300);
  background: var(--paper);
  color: var(--ink);
}
.btn:hover { background: var(--grey-200); }
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: none; }
.btn.primary:hover { background: var(--ink-2); }
.btn.mint { background: var(--mint); color: var(--ink); box-shadow: none; }
.btn.mint:hover { background: var(--mint-soft); }
.btn.sm { height: 36px; font-size: 13px; padding: 0 14px; }
.btn.block { width: 100%; }

/* ── Icon buttons ────────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xl);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
  box-shadow: inset 0 0 0 1.5px var(--grey-300);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--grey-200); }
.icon-btn.ink { background: var(--ink); color: var(--paper); box-shadow: none; }
.icon-btn.ink:hover { background: var(--ink-2); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--grey-200);
}
.card.dashed {
  background: transparent;
  box-shadow: none;
  border: 1.5px dashed var(--ink-50);
}

/* ── Field ───────────────────────────────────────────────── */
.field {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--paper-2);
  padding: 0 14px;
  box-shadow: inset 0 0 0 1.5px var(--grey-300);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
}
.field .overflow-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* ── Chat bubbles ────────────────────────────────────────── */
.row-them,
.row-me {
  display: flex;
  max-width: 100%;
}
.row-them { justify-content: flex-start; }
.row-me   { justify-content: flex-end; }

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.4;
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--grey-300), var(--shadow-xs);
}
.bubble.me {
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}

/* ── File card ───────────────────────────────────────────── */
.filecard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: inset 0 0 0 1.5px var(--grey-300), var(--shadow-xs);
}
.file-ic {
  width: 36px;
  height: 44px;
  border-radius: 8px;
  background: var(--mint-tint);
  box-shadow: inset 0 0 0 1.5px var(--mint-soft);
  flex-shrink: 0;
  position: relative;
}
.file-ic::after {
  content: '';
  position: absolute;
  top: 6px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: var(--mint-tint);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px var(--mint-soft);
}

/* ── Progress bar ────────────────────────────────────────── */
.progress {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--grey-200);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--mint);
  transition: width 0.3s ease;
}

/* ── Composer ────────────────────────────────────────────── */
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--grey-200);
  border-radius: var(--radius-full);
  padding: 6px 6px 6px 14px;
}
.composer .placeholder {
  flex: 1;
  font-family: var(--font-label);
  font-size: 14px;
  color: var(--grey-500);
}
.composer-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-label);
  font-size: 16px;
  color: var(--ink);
  min-width: 0;
}
.composer-input::placeholder { color: var(--grey-500); }

/* ── Status pip ──────────────────────────────────────────── */
.pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pip.live { background: var(--mint); animation: pip-pulse 2s ease-in-out infinite; }
.pip.idle { background: var(--grey-400); }

@keyframes pip-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── Spinner ─────────────────────────────────────────────── */
.spin { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Ad slots ────────────────────────────────────────────── */
.ad-slot {
  display: none; /* Set to 'flex' to show */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--ink-50);
  border-radius: 4px;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(26,15,77,0.025) 6px,
    rgba(26,15,77,0.025) 12px
  );
  color: var(--grey-600);
  font-family: var(--font-label);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.ad-slot .label-block {
  text-align: center;
  padding: 4px 8px;
}
.ad-slot .label-block .top {
  font-weight: 700;
  font-size: 11px;
  color: var(--grey-600);
}
.ad-slot .label-block .sub {
  font-size: 10px;
  color: var(--grey-500);
  margin-top: 2px;
}

/* ── Room pill ───────────────────────────────────────────── */
.room-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--ink);
  color: var(--mint);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Step badges ─────────────────────────────────────────── */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--mint);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.step-badge.mint { background: var(--mint); color: var(--ink); }

/* ── How-step card ───────────────────────────────────────── */
.how-step {
  flex: 1;
  padding: 16px;
  background: var(--paper-2);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--grey-300);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.how-step.mint {
  background: var(--mint-tint);
  box-shadow: inset 0 0 0 1.5px var(--mint);
}

/* ── Session header (S3) ─────────────────────────────────── */
.session-header {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Connection panel rows ───────────────────────────────── */
.conn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.conn-section-label {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-600);
}

/* ── Divider ─────────────────────────────────────────────── */
.divider { height: 1px; background: var(--grey-200); }

/* ── Visibility toggles ──────────────────────────────────── */
.layout-mobile  { display: flex; flex-direction: column; }
.layout-desktop { display: none; }

@media (min-width: 900px) {
  .layout-mobile  { display: none; }
  .layout-desktop { display: flex; flex-direction: column; }
}

/* ══════════════════════════════════════════════════════════ */
/* MOBILE LAYOUTS                                            */
/* ══════════════════════════════════════════════════════════ */

/* ── Mobile shell ────────────────────────────────────────── */
.m-shell {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  background: var(--paper);
}

/* Mobile brand bar */
.m-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px;
}

/* Mobile top ad */
.m-top-ad {
  padding: 8px 16px 0;
  display: none; /* Set to 'flex' to show */
  justify-content: center;
}

/* Mobile scrollable content area */
.m-content {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* Mobile sticky bottom ad */
.m-bottom-ad {
  padding: 6px 16px;
  border-top: 1px solid var(--grey-200);
  background: var(--paper);
  display: none; /* Set to 'flex' to show */
  justify-content: center;
  flex-shrink: 0;
}

/* ── Mobile S1 Landing ───────────────────────────────────── */
.m-landing-body {
  flex: 1;
  padding: 20px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Mobile S2 Link & wait ───────────────────────────────── */
.m-link-body {
  flex: 1;
  padding: 16px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Mobile S3 Connected ─────────────────────────────────── */
.m-connected-thread {
  flex: 1;
  overflow: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.m-composer-wrap {
  padding: 8px 12px 10px;
  background: var(--paper);
}

/* ══════════════════════════════════════════════════════════ */
/* DESKTOP LAYOUTS                                           */
/* ══════════════════════════════════════════════════════════ */

/* ── Desktop shell ───────────────────────────────────────── */
.d-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--grey-100);
}

/* Desktop brand bar */
.d-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--grey-200);
}

/* Desktop ad rows */
.d-top-ad {
  display: none; /* Set to 'flex' to show */
  justify-content: center;
  padding: 14px 0 8px;
}
.d-bottom-ad {
  display: none; /* Set to 'flex' to show */
  justify-content: center;
  padding: 8px 0 18px;
}

/* Desktop 3-col grid */
.d-main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 32px;
  padding: 8px 40px;
  align-items: flex-start;
}
.d-tower {
  position: sticky;
  top: 0;
  padding-top: 4px;
}
.d-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12px;
}
.d-center.dense { padding-top: 0; }

/* Desktop app card */
.d-card {
  width: 820px;
  background: var(--paper);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
}

/* Desktop S3 connected card */
.d-session-card {
  width: 820px;
  height: 580px;
  background: var(--paper);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Desktop session header (S3) */
.d-session-header {
  padding: 14px 24px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.d-session-center {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
}
.d-session-right {
  display: flex;
  justify-content: flex-end;
}

/* Desktop session body grid */
.d-session-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 240px;
  min-height: 0;
  overflow: hidden;
}

/* Desktop chat thread */
.d-chat-thread {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

/* Desktop connection panel */
.d-conn-panel {
  padding: 16px;
  background: var(--paper-2);
  border-left: 1px solid var(--grey-200);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

/* Desktop composer */
.d-composer-wrap {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--grey-200);
}

/* Desktop trust strip */
.d-trust-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 18px;
}

/* Desktop link bar */
.d-link-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-2);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}
.d-link-field {
  flex: 1;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 15px;
  overflow: hidden;
}
.d-link-field .overflow-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Desktop waiting panel */
.d-waiting-panel {
  width: 280px;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--ink-50);
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

/* ── Support modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,15,77,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
.modal-card {
  background: var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  width: 100%;
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}
.modal-charity-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.modal-body {
  font-family: var(--font-label);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  color: var(--grey-600);
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.modal-divider {
  font-family: var(--font-label);
  font-size: 12px;
  color: var(--grey-400);
  text-align: center;
}
.modal-skip {
  background: none;
  border: none;
  font-family: var(--font-label);
  font-size: 13px;
  color: var(--grey-500);
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.modal-skip:hover { color: var(--grey-700); }
