/* =====================================================================
   WhatsApp SaaS — design system
   Forest green + teal · Fraunces (headings) + Inter (UI)
   Signature: message-tail (bubble ki poonch) — cards aur bubbles me
   Mobile-first: chhoti screen pehle, badi screen ke liye @media
   ===================================================================== */

:root {
  --forest: #0E3B2E;
  --forest-2: #145441;
  --forest-3: #0A2B21;
  --teal: #14B8A6;
  --teal-2: #0F9488;
  --teal-soft: #2DD4BF;
  --mint: #DDF3EA;
  --mint-2: #EEF8F3;
  --cream: #F6F2E8;
  --cream-2: #EFE8D9;
  --paper: #FFFDF8;
  --ink: #13221C;
  --ink-2: #2B3B34;
  --muted: #5F6E67;
  --line: #E4DCCB;
  --line-2: #D9CFBA;
  --gold: #F2C14E;
  --amber: #B7791F;
  --amber-soft: #FBF0D9;
  --red: #B42318;
  --red-soft: #FDECEA;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(19, 34, 28, .06), 0 8px 24px -12px rgba(19, 34, 28, .18);
  --shadow-lg: 0 24px 60px -24px rgba(10, 43, 33, .45);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --topbar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
a { color: var(--teal-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--forest); }
img, svg, video { max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
:focus-visible { outline: 3px solid rgba(20, 184, 166, .45); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------ buttons ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font: 600 14.5px/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--forest); color: #fff; box-shadow: 0 6px 16px -8px rgba(14, 59, 46, .7); }
.btn--primary:hover { background: var(--forest-2); color: #fff; }
.btn--teal { background: var(--teal); color: var(--forest-3); }
.btn--teal:hover { background: var(--teal-soft); color: var(--forest-3); }
.btn--ghost { background: var(--paper); color: var(--forest); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--forest); color: var(--forest); }
.btn--light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn--light:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ------------------------------ forms ------------------------------ */
.form { display: grid; gap: 14px; }
.form--grid { grid-template-columns: 1fr; }
.form--inline { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.form--inline input { flex: 1 1 220px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  font: 15px/1.4 var(--font); color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-2); box-shadow: 0 0 0 4px rgba(20, 184, 166, .16); }
input::placeholder, textarea::placeholder { color: #9AA59F; }

/* ------------------------------ alerts / chips ------------------------------ */
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 12px; border: 1px solid; }
.alert--error { background: var(--red-soft); color: var(--red); border-color: #F5C2BC; }
.alert--success { background: var(--mint); color: var(--forest); border-color: #B9E3D2; }
.alert--warn { background: var(--amber-soft); color: #7A4D0B; border-color: #EBD3A2; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--cream-2); color: var(--ink-2);
}
.chip--ok { background: var(--mint); color: var(--forest); }
.chip--warn { background: var(--amber-soft); color: #7A4D0B; }
.chip--muted { background: #ECEAE4; color: var(--muted); }
.chip--q-green { background: var(--mint); color: var(--forest); }
.chip--q-yellow { background: var(--amber-soft); color: #7A4D0B; }
.chip--q-red { background: var(--red-soft); color: var(--red); }
.chip--role { background: var(--forest); color: #fff; }

.badge {
  display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px;
  border-radius: 999px; background: var(--teal); color: var(--forest-3);
  font: 700 11.5px/1 var(--font);
}

/* ------------------------------ brand ------------------------------ */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--forest); }
.brand span { font: 700 22px/1 var(--display); letter-spacing: -.02em; }
.brand img { width: 34px; height: 34px; }
.brand--light { color: #fff; }
.brand--light img { background: var(--cream); border-radius: 11px; padding: 3px; }
.brand--light:hover { color: #fff; }

/* ------------------------------ message bubbles (shared) ------------------------------ */
.bubble {
  position: relative; max-width: 86%; padding: 10px 14px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.4; box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}
.bubble--in { background: #fff; color: var(--ink); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble--out { background: var(--mint); color: var(--forest-3); border-bottom-right-radius: 4px; align-self: flex-end; }
.bubble--in::before, .bubble--out::before {
  content: ''; position: absolute; bottom: 0; width: 12px; height: 14px; background: inherit;
}
.bubble--in::before { left: -6px; clip-path: path('M12 0 L12 14 L0 14 C5 12 9 8 12 0 Z'); }
.bubble--out::before { right: -6px; clip-path: path('M0 0 L0 14 L12 14 C7 12 3 8 0 0 Z'); }
.ticks { font-size: 11.5px; letter-spacing: -3px; margin-left: 6px; color: #8A9A93; }
.ticks--read { color: var(--teal-2); }

/* ------------------------------ AUTH ------------------------------ */
.page-auth { background: var(--cream); }
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth__art { display: none; }
.auth__panel { display: grid; place-items: center; padding: 28px 18px 40px; }
.auth__card {
  position: relative; width: 100%; max-width: 420px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow);
}
.auth__card::after { /* signature tail */
  content: ''; position: absolute; left: 28px; bottom: -13px; width: 22px; height: 14px;
  background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  clip-path: path('M0 0 L22 0 C14 2 6 7 0 14 Z');
}
.auth__card h1 { font-size: 30px; margin-top: 4px; }
.auth__mobile-brand { margin-bottom: 18px; }
.auth__switch { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* ------------------------------ TOPBAR ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 14px; background: var(--forest); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px -16px rgba(0, 0, 0, .5);
}
.topbar .brand span { font-size: 20px; }
.topbar__tenant {
  display: none; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, .1); color: #D4EDE3; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.topbar__logout { margin: 0; }
.topbar__link {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px;
  border-radius: 10px; color: #CFE6DC; text-decoration: none; font: 600 14px/1 var(--font);
  background: none; border: 0; cursor: pointer;
}
.topbar__link svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar__link span { display: none; }
.topbar__link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar__link.is-active { background: rgba(45, 212, 191, .16); color: #fff; }

/* ------------------------------ INBOX ------------------------------ */
.page-inbox { overflow: hidden; }
.inbox { height: calc(100dvh - var(--topbar-h)); display: grid; grid-template-columns: 1fr; }

.inbox__list { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.list__head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px; }
.list__head h1 { font-size: 26px; margin: 0; display: flex; align-items: center; gap: 10px; }
.select-sm { margin-left: auto; width: auto; max-width: 170px; min-height: 36px; padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.list__tools { padding: 4px 16px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { padding-left: 40px; min-height: 42px; background: var(--cream); border-color: transparent; border-radius: 999px; }
.search input:focus { background: #fff; }
.seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--cream-2); justify-self: start; }
.seg__btn { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font: 600 13px/1 var(--font); color: var(--muted); cursor: pointer; }
.seg__btn.is-active { background: #fff; color: var(--forest); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.convos { list-style: none; margin: 0; padding: 6px 8px 24px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.convos:empty { display: none; }
.convo {
  position: relative; width: 100%; display: flex; gap: 12px; align-items: center; text-align: left;
  padding: 11px 10px; border: 0; border-radius: 14px; background: none; cursor: pointer; font: inherit; color: inherit;
}
.convo:hover { background: var(--mint-2); }
.convo.is-active { background: var(--mint); }
.convo.is-active::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--teal-2); }
.avatar {
  --h: 160;
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font: 700 15px/1 var(--font);
  background: hsl(var(--h) 42% 88%); color: hsl(var(--h) 48% 24%);
}
.avatar .dot { position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: var(--teal); border: 2px solid var(--paper); }
.convo__body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.convo__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.convo__name { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo time { flex: none; font-size: 12px; color: var(--muted); }
.convo__preview { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.is-unread .convo__name { font-weight: 700; }
.convo.is-unread .convo__preview { color: var(--ink-2); font-weight: 500; }
.convo.is-unread time { color: var(--teal-2); font-weight: 700; }
.convo__acc { font-size: 11px; color: var(--teal-2); font-weight: 600; }

.list__empty { margin: 24px 16px; padding: 26px 20px; text-align: center; border: 1px dashed var(--line-2); border-radius: 18px; background: var(--cream); }
.list__empty h2 { font-size: 20px; }
.list__empty p { color: var(--muted); font-size: 14px; }
.list__empty--soft { background: none; }
.empty-art { position: relative; height: 64px; margin-bottom: 10px; }
.empty-art span { position: absolute; left: 50%; width: 70px; height: 34px; border-radius: 14px; }
.empty-art span:first-child { transform: translateX(-80%); top: 0; background: #fff; border: 1px solid var(--line); }
.empty-art span:last-child { transform: translateX(-10%); top: 26px; background: var(--mint); }

/* thread */
.inbox__thread {
  position: fixed; inset: 0; z-index: 40;
  display: none; flex-direction: column; min-height: 0;
  background-color: var(--cream-2);
  background-image: radial-gradient(rgba(14, 59, 46, .07) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.inbox.is-thread-open .inbox__thread { display: flex; }
.thread__placeholder { margin: auto; text-align: center; padding: 30px; max-width: 420px; }
.thread__placeholder h2 { font-size: 28px; }
.placeholder-art { display: flex; flex-direction: column; gap: 10px; margin: 0 auto 22px; max-width: 280px; }

.thread__head {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 6px 20px -16px rgba(0, 0, 0, .4);
}
.icon-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: none; color: var(--forest); cursor: pointer; }
.icon-btn:hover { background: var(--mint-2); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.thread__head .avatar { width: 42px; height: 42px; }
.thread__who { flex: 1; min-width: 0; display: grid; }
.thread__who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread__who .tiny { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.window-chip { flex: none; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.window-chip.is-open { background: var(--mint); color: var(--forest); }
.window-chip.is-open::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--teal); vertical-align: 1px; }
.window-chip.is-soon { background: var(--amber-soft); color: #7A4D0B; }
.window-chip.is-soon::before { background: var(--amber); }
.window-chip.is-closed { background: var(--amber-soft); color: #7A4D0B; }

.thread__body { flex: 1; overflow-y: auto; padding: 14px 12px 18px; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 4px; }
.loading { margin: auto; color: var(--muted); font-size: 14px; }
.day { align-self: center; margin: 12px 0 6px; }
.day span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: rgba(255, 253, 248, .92); color: var(--muted); font-size: 12px; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }

.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg--in { align-self: flex-start; align-items: flex-start; }
.msg--out { align-self: flex-end; align-items: flex-end; }
.msg__bubble {
  position: relative; padding: 7px 10px 6px 11px; border-radius: 14px;
  box-shadow: 0 1px 1.5px rgba(19, 34, 28, .1); min-width: 74px;
  overflow-wrap: anywhere;
}
.msg--in .msg__bubble { background: #fff; border-top-left-radius: 4px; }
.msg--out .msg__bubble { background: var(--mint); border-top-right-radius: 4px; }
.msg__bubble::before { content: ''; position: absolute; top: 0; width: 10px; height: 12px; background: inherit; }
.msg--in .msg__bubble::before { left: -7px; clip-path: path('M10 0 L10 12 C7 7 3 3 0 0 Z'); }
.msg--out .msg__bubble::before { right: -7px; clip-path: path('M0 0 L0 12 C3 7 7 3 10 0 Z'); }
.msg__text { font-size: 14.5px; line-height: 1.42; white-space: normal; }
.msg__text a { color: var(--teal-2); word-break: break-all; }
.msg__text code { background: rgba(0, 0, 0, .05); padding: 1px 4px; border-radius: 4px; }
.msg__meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; color: #7F8F88; }
.msg__by { font-weight: 600; color: var(--teal-2); }
.tick { font-size: 12px; letter-spacing: -3.5px; padding-right: 3px; color: #7F8F88; }
.tick--read { color: #0EA5E9; }
.tick--pending { letter-spacing: 0; font-size: 10px; }
.tick--failed { display: inline-grid; place-items: center; width: 15px; height: 15px; padding: 0; letter-spacing: 0; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 10px; }
.msg.is-failed .msg__bubble { box-shadow: 0 0 0 1.5px rgba(180, 35, 24, .45); }
.msg__err { margin-top: 3px; font-size: 12px; color: var(--red); max-width: 320px; }
.msg__reaction { font-size: 14px; color: var(--muted); }
.msg__note { font-size: 13px; color: var(--muted); font-style: italic; }

.media { display: block; margin: 1px 0 4px; border-radius: 10px; overflow: hidden; }
.media--img img { display: block; width: 100%; max-width: 280px; max-height: 340px; object-fit: cover; background: var(--cream-2); }
.media--sticker { width: 130px; height: 130px; object-fit: contain; }
.media--video { width: 280px; max-width: 100%; background: #000; }
.media--audio { width: 260px; max-width: 100%; height: 40px; }
.media--doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-width: 210px; background: rgba(14, 59, 46, .06); color: var(--forest); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.media--doc svg { flex: none; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.media--doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread__closed {
  margin: 0; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--amber-soft); color: #6D4508; font-size: 13.5px; border-top: 1px solid #EBD3A2;
}
.thread__closed b { display: block; margin-bottom: 2px; }

.composer {
  display: block; padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line);
}
.composer__row { display: flex; align-items: flex-end; gap: 8px; }
.attach-btn {
  flex: none; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--cream); color: var(--forest);
  border: 1px solid transparent; transition: background .15s, border-color .15s, transform .05s;
}
.attach-btn:hover { background: var(--mint); border-color: rgba(15, 148, 136, .35); }
.attach-btn:active { transform: scale(.96); }
.attach-btn[disabled] { opacity: .5; cursor: not-allowed; }
.attach-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-45deg) translateX(1px); }
.composer.has-files .attach-btn { background: var(--mint); color: var(--teal-2); }

.attach-list {
  list-style: none; margin: 0 0 10px; padding: 2px 2px 4px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin;
}
.att {
  position: relative; flex: none; display: flex; align-items: center; gap: 10px;
  max-width: 250px; padding: 6px 34px 6px 6px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(19, 34, 28, .06);
}
.att__thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--cream); }
.att__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att__spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--teal-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.att__ext { width: 100%; height: 100%; display: grid; place-items: center; font: 700 10.5px/1 var(--font); letter-spacing: .03em; background: var(--forest); color: var(--teal-soft); }
.att__ext--video { background: #3B2A5C; color: #D9C8FF; }
.att__ext--audio { background: #6B3A12; color: #FFD9A8; }
.att__info { min-width: 0; display: grid; gap: 2px; }
.att__info b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att__info small { font-size: 11.5px; color: var(--muted); }
.att__x {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; cursor: pointer; background: var(--cream-2); color: var(--ink-2); font: 700 16px/1 var(--font);
  display: grid; place-items: center;
}
.att__x:hover { background: var(--red-soft); color: var(--red); }

.upload-bar { height: 4px; margin-top: 6px; border-radius: 4px; overflow: hidden; background: rgba(14, 59, 46, .12); }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--teal-2); border-radius: 4px; transition: width .25s ease; }
.msg.is-uploading .media { opacity: .7; }

.drop-hint {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 24px;
  background: rgba(10, 43, 33, .58); backdrop-filter: blur(2px); pointer-events: none;
}
.drop-hint span {
  padding: 22px 28px; border: 2px dashed rgba(255, 255, 255, .85); border-radius: 20px;
  color: #fff; font-weight: 600; text-align: center; max-width: 360px;
}
.composer textarea {
  flex: 1; min-height: 46px; max-height: 160px; resize: none; padding: 12px 16px;
  border-radius: 24px; background: var(--cream); border-color: transparent; line-height: 1.4;
}
.composer textarea:focus { background: #fff; }
.send-btn {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--forest); color: var(--teal-soft);
  box-shadow: 0 8px 18px -8px rgba(14, 59, 46, .8); transition: background .15s, transform .05s;
}
.send-btn:hover { background: var(--forest-2); }
.send-btn:active { transform: scale(.96); }
.send-btn[disabled] { opacity: .5; }
.send-btn svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; transform: translateX(1px); }

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translateX(-50%);
  max-width: min(92vw, 460px); padding: 12px 16px; border-radius: 14px;
  background: var(--forest-3); color: #fff; font-size: 14px; box-shadow: var(--shadow-lg);
}
.toast--error { background: #7A1A12; }

/* ------------------------------ SETTINGS ------------------------------ */
.settings { padding: 22px 14px 60px; }
.settings__inner { max-width: 940px; margin: 0 auto; display: grid; gap: 18px; }
.settings__head h1 { font-size: 34px; margin-bottom: 4px; }
.card {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: 20px; padding: 20px 18px; box-shadow: var(--shadow); scroll-margin-top: 80px;
}
.card::after { /* signature tail */
  content: ''; position: absolute; left: 26px; bottom: -12px; width: 20px; height: 13px;
  background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  clip-path: path('M0 0 L20 0 C13 2 6 7 0 13 Z');
}
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card__head h2 { font-size: 22px; margin: 0; }
.card__head .chip { margin-left: auto; }
.empty-mini { padding: 14px; border-radius: 12px; background: var(--cream); font-size: 14px; }
.numbers { display: grid; gap: 12px; }
.number { display: grid; gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
.number.is-off { opacity: .7; }
.number__main { display: flex; gap: 12px; align-items: flex-start; }
.number__avatar { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--forest); color: var(--teal-soft); font-weight: 700; }
.number h3 { font-size: 19px; margin: 0 0 2px; }
.number__phone { margin: 0 0 6px; color: var(--ink-2); font-weight: 500; }
.number__chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.number__err { margin: 6px 0 0; font-size: 13px; color: var(--red); }
.number__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.number__actions form { margin: 0; }
.token-edit summary { list-style: none; }
.token-edit summary::-webkit-details-marker { display: none; }
.token-edit[open] { flex-basis: 100%; }
.copyrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--cream); }
.copyrow__label { grid-column: 1 / -1; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.copyrow__value { min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 13.5px; color: var(--forest); }
.checklist { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; font-size: 14px; }
.checklist li { position: relative; padding-left: 28px; }
.checklist li::before { position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.checklist li.ok::before { content: '✓'; background: var(--mint); color: var(--forest); }
.checklist li.warn::before { content: '!'; background: var(--amber-soft); color: var(--amber); }
.team { display: grid; gap: 4px; margin-bottom: 12px; }
.team__row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.team__row:last-child { border-bottom: 0; }
.team__row.is-off { opacity: .55; }
.team__row form { margin: 0; }
.team__avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--forest); font-weight: 700; font-size: 13px; }
.team__info { flex: 1; min-width: 0; display: grid; }
.team__info span { overflow: hidden; text-overflow: ellipsis; }
.add-user summary { list-style: none; }
.add-user summary::-webkit-details-marker { display: none; }
.add-user[open] summary { margin-bottom: 12px; }

/* ------------------------------ PUBLIC SITE ------------------------------ */
.wrap { width: min(1120px, 100% - 32px); margin: 0 auto; }
.site-nav { position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding: 18px 0; }
.site-nav .wrap { display: flex; align-items: center; gap: 12px; }
.site-nav__links { margin-left: auto; display: flex; gap: 8px; }
.hero {
  position: relative; overflow: hidden; color: #F1F7F3;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(45, 212, 191, .28), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(242, 193, 78, .14), transparent 60%),
    linear-gradient(160deg, var(--forest) 0%, var(--forest-3) 100%);
  padding: 110px 0 70px;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px); background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero .wrap { position: relative; z-index: 1; display: grid; gap: 40px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); font-size: 13px; font-weight: 600; color: #CFEDE2; }
.eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-soft); box-shadow: 0 0 0 4px rgba(45, 212, 191, .2); }
.hero h1 { font-size: clamp(40px, 8vw, 74px); line-height: 1.02; letter-spacing: -.03em; margin: 18px 0 16px; color: #fff; }
.hero h1 em { font-style: italic; color: var(--teal-soft); }
.hero p.lead { font-size: 18px; max-width: 540px; color: #C9E2D8; }
.hero__cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero__note { margin-top: 14px; font-size: 13px; color: #9CC7B7; }

.phone {
  position: relative; width: min(360px, 100%); margin: 0 auto; padding: 12px; border-radius: 38px;
  background: #0B2019; box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transform: rotate(-2.5deg);
}
.phone__screen { border-radius: 28px; overflow: hidden; background: var(--cream-2); background-image: radial-gradient(rgba(14, 59, 46, .07) 1px, transparent 1.2px); background-size: 16px 16px; }
.phone__bar { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--paper); color: var(--ink); }
.phone__bar .avatar { width: 36px; height: 36px; font-size: 13px; }
.phone__bar b { display: block; font-size: 14px; }
.phone__bar small { color: var(--teal-2); font-weight: 600; font-size: 11.5px; }
.phone__chat { display: flex; flex-direction: column; gap: 9px; padding: 16px 14px 22px; min-height: 340px; }
.phone__chat .bubble { font-size: 13.5px; }
.float-card {
  position: absolute; right: -18px; top: -16px; transform: rotate(4deg);
  padding: 10px 14px; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.float-card i { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }

.section { padding: 72px 0; }
.section__head { max-width: 640px; margin-bottom: 34px; }
.section__head h2 { font-size: clamp(30px, 5vw, 44px); }
.kicker { display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-2); margin-bottom: 10px; }
.features { display: grid; gap: 16px; }
.feature { position: relative; padding: 24px; border-radius: 22px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.feature::after { content: ''; position: absolute; left: 28px; bottom: -12px; width: 20px; height: 13px; background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); clip-path: path('M0 0 L20 0 C13 2 6 7 0 13 Z'); }
.feature__icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--forest); color: var(--teal-soft); margin-bottom: 14px; }
.feature__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feature h3 { font-size: 22px; }
.feature p { color: var(--muted); margin: 0; }
.steps { display: grid; gap: 14px; counter-reset: s; }
.step { display: flex; gap: 16px; align-items: flex-start; padding: 18px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); }
.step::before { counter-increment: s; content: counter(s); flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--forest); font: 700 18px/1 var(--display); }
.step h3 { font-size: 19px; margin-bottom: 2px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }
.cta-band { position: relative; overflow: hidden; border-radius: 28px; padding: 40px 26px; background: linear-gradient(140deg, var(--forest), var(--forest-3)); color: #fff; }
.cta-band::after { content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(45, 212, 191, .35), transparent 70%); }
.cta-band h2 { font-size: clamp(28px, 5vw, 40px); color: #fff; position: relative; }
.cta-band p { color: #C9E2D8; position: relative; }
.cta-band .btn { position: relative; }

.site-footer { margin-top: 40px; padding: 44px 0 26px; background: var(--forest-3); color: #BFD9CE; font-size: 14px; }
.site-footer a { color: #E2F3EC; }
.site-footer h4 { font: 700 13px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: #fff; margin-bottom: 12px; }
.site-footer__grid { display: grid; gap: 26px; }
.site-footer__note { margin-top: 12px; max-width: 280px; }
.site-footer__base { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 12.5px; color: #8FB4A5; }

.legal-hero { background: linear-gradient(160deg, var(--forest), var(--forest-3)); color: #fff; padding: 100px 0 40px; }
.legal-hero h1 { font-size: clamp(34px, 6vw, 52px); color: #fff; }
.legal-hero p { color: #C9E2D8; margin: 0; }
.legal { padding: 36px 0 20px; }
.legal__doc { max-width: 780px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 26px 20px; box-shadow: var(--shadow); }
.legal__doc h2 { font-size: 24px; margin-top: 1.4em; }
.legal__doc h2:first-child { margin-top: 0; }
.legal__doc li { margin-bottom: 6px; }

/* ------------------------------ RESPONSIVE ------------------------------ */
@media (min-width: 640px) {
  .form--grid { grid-template-columns: 1fr 1fr; }
  .field--wide { grid-column: 1 / -1; }
  .topbar__link span { display: inline; }
  .topbar__tenant { display: inline-block; }
  .number { grid-template-columns: 1fr auto; align-items: start; }
  .number__actions { justify-content: flex-end; max-width: 300px; }
  .copyrow { grid-template-columns: 130px 1fr auto auto; }
  .copyrow__label { grid-column: auto; }
  .features { grid-template-columns: repeat(3, 1fr); }
  .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; }
  .card { padding: 24px 26px; }
  .legal__doc { padding: 36px 40px; }
  .cta-band { padding: 54px 50px; }
}

@media (min-width: 860px) {
  .auth { grid-template-columns: 1.05fr 1fr; }
  .auth__art {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px 48px; color: #fff;
    background:
      radial-gradient(700px 420px at 90% 0%, rgba(45, 212, 191, .25), transparent 60%),
      linear-gradient(160deg, var(--forest), var(--forest-3));
  }
  .auth__art::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px); background-size: 22px 22px; pointer-events: none; }
  .auth__chat { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
  .auth__tag { position: relative; z-index: 1; font: 600 44px/1.05 var(--display); letter-spacing: -.02em; margin: 0; }
  .auth__tag em { color: var(--teal-soft); }
  .auth__mobile-brand { display: none; }
  .auth__card { padding: 36px 34px; }

  .inbox { grid-template-columns: 380px 1fr; }
  .inbox__list { border-right: 1px solid var(--line); }
  .inbox__thread { position: relative; inset: auto; z-index: auto; display: flex; }
  .thread__back { display: none; }
  .msg { max-width: 68%; }
  .thread__body { padding: 18px 6% 22px; }
  .composer, .thread__closed { padding-left: 6%; padding-right: 6%; }

  .hero { padding: 130px 0 96px; }
  .hero .wrap { grid-template-columns: 1.15fr .85fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1200px) {
  .inbox { grid-template-columns: 420px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
