/* Connecta design system */

@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/assistant-hebrew-400-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/assistant-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074,
    U+20AC, U+2122, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/assistant-hebrew-600-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/assistant-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074,
    U+20AC, U+2122, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/assistant-hebrew-700-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/assistant-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074,
    U+20AC, U+2122, U+FEFF, U+FFFD;
}

/* Secular One: heavy single-weight Hebrew display face for headings/brand. */
@font-face {
  font-family: "Secular One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/secular-one-hebrew-400-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Secular One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/secular-one-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074,
    U+20AC, U+2122, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --canvas: #f7f9fc;
  --surface: #ffffff;
  --surface-subtle: #f1eadf;
  --surface-strong: #e8dfcd;
  --surface-inverse: #14241d;
  --text: #1c2a22;
  --text-secondary: #5f6b61;
  --text-tertiary: #8a9389;
  --border: #e6ddca;
  --border-strong: #cfc4ac;
  --brand: #0a7c5a;
  --brand-hover: #086248;
  --brand-strong: #064c39;
  --brand-soft: #e4f0e4;
  --on-brand: #ffffff;
  --focus: #0b8b67;
  --success: #087653;
  --success-soft: #e2f1e2;
  --warning: #9a5b05;
  --warning-soft: #fbeccb;
  --danger: #b42318;
  --danger-hover: #8f1c13;
  --danger-soft: #fbe7df;
  --info: #2167a8;
  --info-soft: #e6eef8;
  --shadow-xs: 0 1px 2px rgba(58, 46, 22, 0.06);
  --shadow-sm: 0 6px 22px rgba(58, 46, 22, 0.09);
  --shadow-md: 0 18px 46px rgba(58, 46, 22, 0.14);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --content: 1240px;
  --content-narrow: 760px;
  --sidebar-width: 276px;
  --control-height: 44px;
  --font: "Assistant", system-ui, "Segoe UI", Arial, sans-serif;
  --font-display: "Secular One", "Assistant", system-ui, sans-serif;
  --bubble-tail: 6px;

  /* Elevated Emerald: layered depth, grain, glass, fluid type, motion */
  --shadow-key: rgba(58, 46, 22, 0.10);
  --shadow-ambient: rgba(58, 46, 22, 0.07);
  --elev-1: 0 1px 2px var(--shadow-key), 0 3px 10px var(--shadow-ambient);
  --elev-2: 0 2px 4px var(--shadow-key), 0 14px 32px var(--shadow-ambient);
  --elev-3: 0 4px 10px var(--shadow-key), 0 30px 64px var(--shadow-ambient);
  --glow-brand: 0 10px 26px color-mix(in srgb, var(--brand) 30%, transparent);
  --radius-2xl: 34px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-opacity: 0.09;
  --display-tracking: -0.012em;
  --step--1: clamp(0.82rem, 0.79rem + 0.16vw, 0.9rem);
  --step-0: 1rem;
  --step-1: clamp(1.1rem, 1.03rem + 0.35vw, 1.3rem);
  --step-2: clamp(1.3rem, 1.15rem + 0.7vw, 1.6rem);
  --step-3: clamp(1.6rem, 1.35rem + 1.2vw, 2.1rem);
  --step-4: clamp(1.95rem, 1.6rem + 1.9vw, 2.7rem);
  --step-5: clamp(2.4rem, 1.7rem + 3.4vw, 3.9rem);

  /* Compatibility aliases for existing templates. */
  --bg: var(--canvas);
  --card: var(--surface);
  --fg: var(--text);
  --muted: var(--text-secondary);
  --line: var(--border);
  --accent: var(--brand);
  --accent-strong: var(--brand-strong);
  --accent-soft: var(--brand-soft);
  --active-bg: var(--brand);
  --on-accent: var(--on-brand);
  --warn: var(--warning);
  --err: var(--danger);
  --topbar: rgba(255, 255, 255, 0.96);
  --ring: rgba(11, 139, 103, 0.24);
  --shadow: var(--shadow-sm);
  --shadow-lift: var(--shadow-md);
  --r-card: var(--radius-lg);
  --r-field: var(--radius-md);
  --r-pill: var(--radius-pill);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0a0f16;
  --surface: #131c26;
  --surface-subtle: #1b2823;
  --surface-strong: #24342d;
  --surface-inverse: #f1f7f4;
  --text: #f0f6f3;
  --text-secondary: #abb9b2;
  --text-tertiary: #84948c;
  --border: #2b3b34;
  --border-strong: #40544b;
  --brand: #45c99a;
  --brand-hover: #6bd9b1;
  --brand-strong: #8be6c5;
  --brand-soft: #173c30;
  --on-brand: #06261b;
  --focus: #72dfb8;
  --success: #62d2aa;
  --success-soft: #153a2e;
  --warning: #f3bb58;
  --warning-soft: #3a2c14;
  --danger: #ff8a80;
  --danger-hover: #ffaaa3;
  --danger-soft: #40201e;
  --info: #83baf0;
  --info-soft: #172f47;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.3);
  --active-bg: #176e52;
  --topbar: rgba(13, 21, 18, 0.96);
  --ring: rgba(114, 223, 184, 0.25);
  --shadow-key: rgba(0, 0, 0, 0.42);
  --shadow-ambient: rgba(0, 0, 0, 0.32);
  --glow-brand: 0 10px 30px color-mix(in srgb, var(--brand) 26%, transparent);
  --grain-opacity: 0.05;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ============================================================
   Elevated Emerald foundation: grain overlay, glass, reveal motion
   ============================================================ */

/* Film-grain atmosphere over the canvas; sits behind content (main z-index:1),
   below interactive chrome (topbar 50 / banners 60 / menus 40). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--grain);
  background-size: 140px 140px;
  opacity: var(--grain-opacity);
  mix-blend-mode: soft-light;
}

/* Opt-in frosted surface (used by marketing nav, portal shell, select panels). */
.surface-glass {
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  backdrop-filter: blur(14px) saturate(1.08);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

/* Reveal-on-load / on-scroll. Opt-in via [data-reveal]; the hidden initial
   state only applies when JS is active (html.js) so no-JS keeps content visible.
   Y-axis only -> identical in RTL and LTR. */
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes reveal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes reveal-scale {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}
html.js [data-reveal] { opacity: 0; }
html.js [data-reveal].is-revealed {
  animation: reveal-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: calc(var(--reveal-i, 0) * 70ms + var(--reveal-delay, 0ms));
}
html.js [data-reveal="fade"].is-revealed { animation-name: reveal-fade; }
html.js [data-reveal="scale"].is-revealed { animation-name: reveal-scale; }

html {
  scroll-behavior: smooth;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(1100px 560px at 100% -6%,
      color-mix(in srgb, var(--brand-soft) 65%, transparent), transparent 58%),
    radial-gradient(820px 460px at -5% 2%,
      color-mix(in srgb, var(--surface-strong) 55%, transparent), transparent 52%),
    var(--canvas);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--brand-soft);
  color: var(--text);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  line-height: 1.18;
  text-wrap: balance;
}

h1 {
  margin-bottom: 0.6rem;
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 400;
  letter-spacing: var(--display-tracking);
}

h2 {
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 400;
  letter-spacing: var(--display-tracking);
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 1.12rem;
  font-weight: 700;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--brand-hover);
}

svg {
  display: block;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: fixed;
  inset-block-start: 0.75rem;
  inset-inline-start: 0.75rem;
  z-index: 1000;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-inverse);
  color: var(--surface);
  font-weight: 700;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-sub {
  max-width: 70ch;
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  font-size: 1.03rem;
}

.muted {
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.inline {
  display: inline;
}

main {
  position: relative;
  z-index: 1;
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem) 4rem;
}

/* System banners */
.impersonation-banner,
.billing-banner {
  position: relative;
  z-index: 60;
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid;
  font-weight: 600;
  text-align: center;
}

.impersonation-banner {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  background: var(--warning-soft);
  color: var(--warning);
}

.billing-trial {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.billing-expired {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.billing-banner a {
  color: inherit;
  font-weight: 700;
}

.impersonation-exit {
  min-height: 34px;
  padding: 0.3rem 0.75rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Application navigation */
.topbar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  height: 100dvh;
  align-items: stretch;
  flex-direction: column;
  gap: 0;
  padding: 1rem;
  border-inline-end: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  backdrop-filter: blur(12px) saturate(1.05);
  box-shadow: var(--elev-2);
  overflow: hidden;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
}

.topbar > .brand {
  min-height: 64px;
  padding: 0.7rem 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 1.3rem;
}

.brand-copy small {
  margin-top: 0.3rem;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

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

.brand-mark {
  flex: none;
  color: var(--brand);
}

/* the connection-node dot in the logo mark keeps its mint accent */
.brand-node {
  fill: #45c99a;
}
:root[data-theme="dark"] .brand-node {
  fill: #8be6c5;
}

.brand-lg {
  justify-content: center;
  margin-bottom: 1.25rem;
  font-size: 1.5rem;
}

.topbar nav {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: stretch;
  flex: 1;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 1rem;
  overflow-y: auto;
  padding: 0 0.15rem;
}

.topbar nav a {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.68rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.96rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease,
    transform 0.18s ease;
}

.topbar nav a:hover {
  background: var(--surface-subtle);
  color: var(--text);
  transform: translateX(-2px);
}

/* Mirror the hover nudge so it points toward the content in LTR too. */
[dir="ltr"] .topbar nav a:hover {
  transform: translateX(2px);
}

.topbar nav a.active {
  background: var(--active-bg);
  color: #ffffff;
  box-shadow: var(--glow-brand);
}

:root[data-theme="dark"] .topbar nav a.active {
  color: #ffffff;
}

.topbar-right {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 1rem 0.15rem 0;
  border-top: 1px solid var(--border);
}

.topbar-burger {
  display: none;
}

.nav-section-label {
  padding: 0 0.85rem 0.35rem;
  color: var(--text-tertiary);
  font-size: 0.76rem;
  font-weight: 700;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  place-items: center;
  color: currentColor;
}

.topbar-right .icon-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 0.7rem;
  padding-inline: 0.85rem;
}

.topbar-right form,
.topbar-right form .btn-ghost {
  width: 100%;
}

.topbar-right .muted {
  padding: 0 0.35rem 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-label {
  display: inline;
}

/* Language switcher (topbar): native <details> disclosure, no JS needed. */
.lang-switch {
  position: relative;
  width: 100%;
}
.lang-switch > summary {
  list-style: none;
  cursor: pointer;
}
.lang-switch > summary::-webkit-details-marker {
  display: none;
}
.lang-current {
  margin-inline-start: auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.85;
}
.lang-menu {
  position: absolute;
  inset-block-start: calc(100% + 4px);
  inset-inline: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.lang-opt {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.lang-opt:hover {
  background: var(--surface-subtle);
}
.lang-opt.is-active {
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
}

/* Marketing header: compact switcher (the app topbar one is full-width). */
.mkt-nav .lang-switch {
  width: auto;
}
.mkt-nav .lang-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.mkt-nav .lang-current {
  margin-inline-start: 0;
}
.mkt-nav .lang-menu {
  inset-inline-start: auto;
  min-width: 11rem;
}
.mkt-nav .brand-copy,
.mkt-footer .brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.mkt-nav .brand-copy small,
.mkt-footer .brand-copy small {
  margin-top: 0.12rem;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Arabic: bundled Assistant/Secular One cover Latin + Hebrew only. */
html[lang="ar"] {
  --font: "Tahoma", "Segoe UI", "Arial", sans-serif;
  --font-display: "Tahoma", "Segoe UI", "Arial", sans-serif;
}

.app-body main {
  width: auto;
  max-width: calc(var(--content) + 4rem);
  margin-inline-start: var(--sidebar-width);
}

.app-body .impersonation-banner,
.app-body .billing-banner {
  margin-inline-start: var(--sidebar-width);
}

/* Surfaces */
.card {
  margin-bottom: 1rem;
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--elev-1);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--elev-2);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}

.login {
  max-width: 420px;
  margin: clamp(2rem, 8vh, 5rem) auto;
}

.compact-main {
  max-width: 480px;
  margin-top: 4rem;
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.login-note {
  margin: 1.2rem 0 0;
  text-align: center;
}

.explainer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border));
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
}

.explainer-ico {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: var(--on-brand);
}

.explainer h2 {
  margin-bottom: 0.25rem;
  color: var(--brand-strong);
  font-size: 1.12rem;
}

.explainer p {
  max-width: 82ch;
  margin: 0;
  color: var(--text);
}

.explainer p + p {
  margin-top: 0.4rem;
  color: var(--text-secondary);
}

/* Forms */
label {
  display: block;
  margin: 0.7rem 0 0.35rem;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 0.66rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
}

textarea {
  min-height: 96px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--brand);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  outline: 3px solid var(--ring);
  outline-offset: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
  opacity: 1;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-subtle);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

form.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  gap: 0.85rem;
}

form.row label {
  margin: 0;
}

.hint {
  margin: 0.45rem 0 1rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

fieldset {
  margin: 0.75rem 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  color: var(--text);
  font-weight: 700;
}

/* Buttons */
button,
.btn,
.btn-ghost,
.btn-danger,
.danger {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background-color 0.18s ease, border-color 0.18s ease,
    color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button,
.btn {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

button:hover,
.btn:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
  color: var(--on-brand);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

button:active,
.btn:active,
.btn-ghost:active,
.btn-danger:active,
.danger:active {
  transform: scale(0.98);
}

.btn-ghost {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.btn-danger,
.danger {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger:hover,
.danger:hover {
  border-color: var(--danger-hover);
  background: var(--danger-hover);
  color: #ffffff;
}

button:disabled,
.btn[aria-disabled="true"] {
  border-color: var(--border);
  background: var(--surface-strong);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.btn-lg {
  min-height: 50px;
  padding-inline: 1.35rem;
  font-size: 1.05rem;
}

.icon-btn {
  width: var(--control-height);
  min-width: var(--control-height);
  height: var(--control-height);
  padding: 0;
  border-color: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  transition: border-color 0.18s ease, background-color 0.18s ease,
    color 0.18s ease, transform 0.12s ease;
}

.icon-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

/* Feedback and status */
.error,
.flash {
  display: block;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.error {
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.flash {
  border: 1px solid color-mix(in srgb, var(--success) 40%, var(--border));
  background: var(--success-soft);
  color: var(--success);
}

.chip,
.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 0.38rem;
  padding: 0.24rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.chip {
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

.chip::before {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.chip-ok {
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
  background: var(--success-soft);
  color: var(--success);
}

.chip-warn {
  border-color: color-mix(in srgb, var(--warning) 30%, var(--border));
  background: var(--warning-soft);
  color: var(--warning);
}

.chip-err {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.chip-off {
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

.badge {
  border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.chip-pulse::before,
.chip-blink::before {
  animation: status-pulse 1.4s ease-in-out infinite;
}

@keyframes status-pulse {
  50% {
    opacity: 0.35;
  }
}

/* Data tables */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
}

table.data th,
table.data td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data th {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: start;
  white-space: nowrap;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover {
  background: color-mix(in srgb, var(--brand-soft) 50%, var(--surface));
}

table.data select {
  min-width: 140px;
}

/* Permissions */
.perm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.8rem 0;
}

.perm-grid label {
  margin: 0;
}

.perm-chip {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.perm-chip:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.perm-chip input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

/* Empty states */
.empty {
  margin: 1.5rem 0;
  padding: clamp(2rem, 6vw, 4rem) 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}

.empty-mark {
  display: block;
  margin-bottom: 0.8rem;
  font-size: 2.5rem;
  line-height: 1;
}

.empty .btn {
  margin-top: 0.5rem;
}

.empty-hero {
  overflow: hidden;
}

/* Connection and integration cards */
.connect-grid,
.conn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.connect-grid .card,
.conn-card {
  display: flex;
  height: 100%;
  flex-direction: column;
  margin-bottom: 0;
}

/* Connection cards read as chat bubbles: the corner by the avatar is clipped
   like a speech bubble, and the whole card lifts on hover. */
.conn-card {
  border-start-start-radius: var(--bubble-tail);
  transition: box-shadow 0.18s ease, transform 0.18s ease,
    border-color 0.18s ease;
}

.conn-card:hover {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--border));
  box-shadow: var(--elev-2);
  transform: translateY(-3px);
}

.connect-grid .card .btn,
.connect-grid .card .btn-ghost {
  align-self: flex-start;
  margin-top: auto;
}

.url-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1rem 0;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.url-box code {
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  padding-inline: 0.4rem;
  color: var(--brand-strong);
  direction: ltr;
  font-weight: 600;
  white-space: nowrap;
}

.steps {
  margin: 0.6rem 0 1rem;
  padding-inline-start: 1.35rem;
  line-height: 1.8;
}

.conn-head {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.conn-id {
  flex: 1;
  min-width: 0;
}

.conn-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent);
  color: var(--brand);
}

.conn-title {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  font-weight: 700;
}

.conn-meta,
.conn-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.conn-meta {
  margin-top: 0.75rem;
}

.meta-spaced {
  margin-bottom: 1rem;
}

.conn-actions {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.actions-plain {
  padding-top: 0.4rem;
  border-top: 0;
}

.conn-actions .btn-ghost,
.conn-actions .danger {
  min-height: 38px;
  padding: 0.45rem 0.72rem;
  font-size: 0.9rem;
}

/* Login */
.login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
  height: 1px;
  flex: 1;
  background: var(--border);
  content: "";
}

.login-google {
  width: 100%;
}

.pending-card {
  text-align: center;
}

.pending-mark {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

/* Pairing wizard */
.pair-shell {
  max-width: 620px;
  margin: 0 auto;
}

.pair-shell .card {
  padding: clamp(1.25rem, 5vw, 2.25rem);
}

.pair-kicker {
  margin: 0 0 0.3rem;
  color: var(--brand-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.pair-phone input {
  min-height: 58px;
  padding: 0.8rem 1rem;
  direction: ltr;
  font-size: clamp(1.2rem, 5vw, 1.55rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-align: center;
}

.pair-phone button {
  width: 100%;
  margin-top: 0.5rem;
}

.pair-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0.65rem;
  margin: 1.25rem 0;
}

.pair-code {
  display: grid;
  min-height: 116px;
  place-items: center;
  padding: 1rem;
  border: 2px dashed var(--brand);
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  color: var(--brand-strong);
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(2.2rem, 8vw, 3.8rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.35rem;
  text-align: center;
  user-select: all;
}

.pair-copy {
  align-self: stretch;
}

/* pairing method switch (QR vs phone code) */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 1.1rem 0 1.25rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.seg-btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--brand-strong);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.pair-method {
  display: none;
}

.pair-method.active {
  display: block;
}

.pair-method button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
}

/* QR pairing image */
.pair-qr-box {
  display: grid;
  justify-items: center;
  margin: 1.25rem 0;
}

.pair-qr {
  width: min(260px, 70vw);
  height: auto;
  padding: 12px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
}

.pair-qr-refresh {
  padding: 0.15rem 0.55rem;
}

/* per-connection nickname (rename) */
.conn-rename {
  margin-top: 0.7rem;
}

.conn-rename summary {
  cursor: pointer;
  color: var(--brand-strong);
  font-weight: 600;
  font-size: 0.9rem;
}

.conn-rename .rename-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.conn-rename .rename-form input[type="text"] {
  flex: 1;
  min-width: 0;
}

.conn-rename .saved-tag {
  color: var(--brand);
  font-weight: 700;
}

.steps-visual {
  margin: 1.4rem 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.pair-steps-spaced {
  margin-top: 1.6rem;
}

.steps-visual li {
  position: relative;
  min-height: 42px;
  padding: 0.25rem 3rem 1rem 0;
  counter-increment: step;
}

.steps-visual li::before {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-strong);
  content: counter(step);
  font-weight: 700;
}

.steps-visual li:not(:last-child)::after {
  position: absolute;
  inset-block-start: 36px;
  inset-block-end: 0;
  inset-inline-start: 16px;
  width: 1px;
  background: var(--border);
  content: "";
}

.pair-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.wait-dots {
  display: inline-flex;
  gap: 0.3rem;
}

.wait-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  animation: wait-pulse 1.1s ease-in-out infinite;
}

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

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

@keyframes wait-pulse {
  50% {
    opacity: 0.3;
  }
}

.pair-done {
  position: relative;
  padding: 1.5rem 0 0.5rem;
  text-align: center;
}

.pair-done .btn,
.pair-done .btn-ghost {
  margin-top: 1rem;
}

.check-ring circle,
.check-ring path {
  stroke: var(--brand);
}

.confetti {
  display: none;
}

/* Marketing navigation */
.mkt-nav {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 72px;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.mkt-nav .brand {
  font-size: 1.35rem;
}

.mkt-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.mkt-links a {
  min-height: 38px;
  padding: 0.42rem 0.72rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  text-decoration: none;
}

.mkt-links a:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.mkt-nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.mkt-burger {
  display: none;
}

.mkt-links:empty ~ .mkt-nav-actions .mkt-burger {
  display: none;
}

.mkt-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.mkt-section {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6.5rem) clamp(1rem, 4vw, 2.5rem);
}

.section-band {
  border-block: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 0 0 100vmax var(--surface);
  clip-path: inset(0 -100vmax);
}

.section-cta {
  width: min(100%, 980px);
  margin: 2.5rem auto;
  padding: clamp(2.6rem, 6vw, 4.5rem) clamp(1.5rem, 5vw, 3rem);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
  border-radius: var(--radius-2xl);
  background:
    radial-gradient(130% 130% at 50% 0%,
      color-mix(in srgb, var(--brand-soft) 65%, transparent), transparent 58%),
    var(--surface);
  box-shadow: var(--elev-2);
  text-align: center;
}

.section-cta h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
}

.section-cta p {
  margin-bottom: 1.4rem;
  font-size: 1.05rem;
}

.section-head {
  max-width: 720px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

/* Desktop edition promo */
.desktop-cta {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(2.2rem, 5vw, 3.6rem) clamp(1.5rem, 5vw, 3rem);
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
  border-radius: var(--radius-2xl);
  background:
    radial-gradient(130% 130% at 50% 0%,
      color-mix(in srgb, var(--brand-soft) 65%, transparent), transparent 58%),
    var(--surface);
  box-shadow: var(--elev-2);
  text-align: center;
}

.desktop-cta h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  margin-bottom: 0.6rem;
}

.desktop-sub {
  max-width: 620px;
  margin: 0 auto 1.4rem;
  font-size: 1.05rem;
  color: var(--text-soft);
}

.desktop-file {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 auto 1.6rem;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  text-align: start;
}

.desktop-file-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  height: 2.5rem;
  padding: 0 0.45rem;
  border-radius: 8px;
  background: #0078d4;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.desktop-file-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.desktop-file-name {
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: break-word;
}

.desktop-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 0 0 1.8rem;
  padding: 0;
  list-style: none;
}

.desktop-points li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--text-soft);
}

.desktop-points li svg {
  flex: none;
  color: var(--brand);
}

.desktop-cta .hero-cta {
  justify-content: center;
}

.desktop-cta .btn svg {
  margin-inline-end: 0.45rem;
  vertical-align: -3px;
}

.desktop-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}

@media (max-width: 760px) {
  .desktop-points {
    grid-template-columns: 1fr;
  }

  .desktop-points li {
    flex-direction: row;
    text-align: start;
  }
}

.section-kicker,
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--brand-soft));
  box-shadow: var(--shadow-xs);
  color: var(--brand-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.section-head h2 {
  margin-bottom: 0.65rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.section-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.08rem;
}

/* Marketing hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.2rem, 7vw, 6rem) clamp(1rem, 4vw, 2.5rem) 2.4rem;
  background:
    radial-gradient(circle at 82% 6%, color-mix(in srgb, var(--brand-soft) 78%, transparent), transparent 36%),
    radial-gradient(circle at 10% 94%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 42%),
    var(--canvas);
  text-align: start;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: 1180px;
  margin: 0 auto;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  max-width: 18ch;
  margin: 0 0 1.1rem;
  font-size: clamp(2.2rem, 5.2vw, 3.8rem);
  line-height: 1.08;
}

.hero h1 .grad {
  background: linear-gradient(135deg, var(--brand) 0%, var(--info) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 42rem;
  margin: 0 0 1.6rem;
  color: var(--text-secondary);
  font-size: clamp(1.05rem, 2vw, 1.22rem);
}

.hero-cta,
.hero-trust {
  display: flex;
  justify-content: start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-trust {
  margin-top: 1.4rem;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.hero-trust span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-trust svg {
  color: var(--success);
}

.hero-art {
  width: 100%;
  margin: 0;
}

.hero-art svg,
.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-3);
}

.hero-art img {
  background: var(--surface);
}

.works-with {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 1.5rem;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  margin-top: 0.4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.ww-label {
  color: var(--text-tertiary);
  font-weight: 600;
}

.ww-logos {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 1rem 1.6rem;
  flex-wrap: wrap;
}

.ww-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
}

.ww-logo svg,
.ww-logo img {
  color: var(--brand);
}

.ww-logo img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
}

a.ww-logo {
  text-decoration: none;
}

.track-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
  align-items: stretch;
}

.track-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: clamp(1.4rem, 4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--elev-1);
}

.track-card h3 {
  margin-bottom: 0.45rem;
  font-size: 1.45rem;
}

.track-card p {
  margin: 0;
  color: var(--text-secondary);
}

.track-price {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 1.15rem 0 1.35rem;
}

.track-price .amount {
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 700;
}

.track-price .per {
  color: var(--text-secondary);
}

.track-card .btn {
  width: 100%;
  margin-top: auto;
}

.example-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
  max-width: 1020px;
  margin: 0 auto;
}

.example-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--elev-1);
  transition: box-shadow 0.24s ease, transform 0.24s ease, border-color 0.24s ease;
}

.example-card:hover {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--border));
  box-shadow: var(--elev-2);
  transform: translateY(-3px);
}

.example-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 1.05rem 1.15rem 1rem;
}

.example-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

/* The request, styled as a sent WhatsApp bubble */
.example-prompt {
  margin: 0;
  max-width: 94%;
  padding: 0.6rem 1rem;
  border-radius: 1.15rem;
  border-start-start-radius: 0.35rem;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.4;
  box-shadow: var(--elev-1);
}

:root[data-theme="dark"] .example-prompt {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.example-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: inherit;
}

.example-open:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}

.example-shot {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover; /* sources are exactly 3:2; this only equalizes rounding */
  border-block: 1px solid var(--border);
  background: var(--surface-subtle);
  transition: transform 0.3s ease;
}

.example-open:hover .example-shot {
  transform: scale(1.02);
}

.example-card figcaption {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.example-card figcaption svg {
  flex: none;
  color: var(--success);
}

.example-lightbox {
  position: relative;
  width: min(96vw, 1100px);
  max-width: 96vw;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--canvas);
  box-shadow: var(--elev-3);
}

.example-lightbox::backdrop {
  background: rgb(0 0 0 / 0.72);
}

.example-lightbox-img {
  display: block;
  width: 100%;
  height: auto;
}

.example-lightbox-close {
  position: absolute;
  inset-block-start: 0.7rem;
  inset-inline-end: 0.7rem;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  cursor: pointer;
}

.example-lightbox-close:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.notice-banner {
  margin: 0 0 1.4rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface));
}

.notice-banner strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* Marketing content */
.flow,
.feature-grid,
.plan-grid {
  display: grid;
  gap: 1rem;
}

.flow {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  counter-reset: flow;
}

.flow-step,
.feature-card,
.plan-card,
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--elev-1);
  transition: box-shadow 0.24s ease, transform 0.24s ease, border-color 0.24s ease;
}

.flow-step:hover,
.feature-card:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--elev-2), var(--glow-brand);
  transform: translateY(-4px);
}

.flow-step {
  padding: 1.25rem;
  counter-increment: flow;
}

.flow-step::before {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 0.9rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-strong);
  content: counter(flow);
  font-weight: 700;
}

.flow-step p,
.feature-card p,
.plan-tagline,
.faq details p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-card {
  padding: 1.35rem;
}

.feature-ico,
.plan-ico {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--brand) 16%, var(--surface)),
    var(--brand-soft));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent), var(--elev-1);
  color: var(--brand);
  transition: transform 0.24s ease;
}

.feature-card:hover .feature-ico {
  transform: translateY(-2px) rotate(-3deg);
}

.plan-grid {
  max-width: 900px;
  margin: 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(1.4rem, 4vw, 2rem);
}

.plan-card--featured {
  border-color: var(--brand);
  background:
    radial-gradient(140% 100% at 50% 0%,
      color-mix(in srgb, var(--brand-soft) 55%, transparent), transparent 55%),
    var(--surface);
  box-shadow: 0 0 0 2px var(--brand-soft), var(--elev-3);
}

.plan-card--featured::before {
  position: absolute;
  inset-block-start: 1rem;
  inset-inline-end: 1rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-strong);
  content: "הכי פופולרי";
  font-size: 0.8rem;
  font-weight: 700;
}

.plan-label {
  margin: 0 0 0.85rem;
  color: var(--brand-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.plan-card h3 {
  font-size: 1.35rem;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 1.2rem 0;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.plan-price .amount {
  color: var(--text);
  font-size: 2rem;
  font-weight: 700;
}

.plan-price .soon {
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-weight: 700;
}

.plan-price .per {
  color: var(--text-secondary);
}

.plan-price .plan-trial {
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.85rem;
  font-weight: 700;
}

.plan-feats {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.plan-feats li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.plan-feats li svg {
  flex: none;
  margin-top: 0.2rem;
}

.plan-feats .yes svg {
  color: var(--success);
}

.plan-feats .no {
  color: var(--text-tertiary);
}

.plan-card .btn,
.plan-card .btn-ghost {
  width: 100%;
}

.faq {
  display: grid;
  max-width: 820px;
  margin: 0 auto;
  gap: 0.75rem;
}

.faq details {
  padding: 0 1.2rem;
}

.faq summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq details:hover {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--border));
}

.faq summary::after {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--brand);
  content: "+";
  font-size: 1.25rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.25s ease;
}

.faq details[open] summary::after {
  content: "−";
  background: var(--brand);
  color: var(--on-brand);
  transform: rotate(180deg);
}

.faq details p {
  padding-bottom: 1rem;
}

.mkt-footer {
  margin-top: 2rem;
  padding: 2rem clamp(1rem, 4vw, 3.5rem);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.mkt-footer-inner {
  display: flex;
  max-width: 1180px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 auto;
  color: var(--text-secondary);
}

.mkt-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}

.mkt-footer-links a {
  color: inherit;
  font-weight: 600;
}

.legal-page {
  max-width: 46rem;
  margin: 2.5rem auto 4rem;
  padding-inline: 1rem;
}

.legal-page h1 {
  margin-block: 0.35rem 0.5rem;
}

.legal-updated {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.legal-page h2 {
  margin-top: 1.8rem;
}

.legal-page ul,
.legal-page ol {
  padding-inline-start: 1.2rem;
}

.guide-gemini-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.mcp-app-icon {
  display: inline-block;
  border-radius: 18px;
  box-shadow: var(--elev-1);
  object-fit: cover;
}

.mcp-app-icon--sm {
  border-radius: 8px;
  vertical-align: middle;
  margin-inline-end: 0.35rem;
}

.connect-grid .card h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.track-intro {
  max-width: 680px;
  margin: 3rem auto 2rem;
  padding: 0 1rem;
  text-align: center;
}

.signup-title {
  font-size: clamp(1.8rem, 4.5vw, 2.4rem);
}

.signup-sub {
  font-size: 1.05rem;
}

.section-flush-top {
  padding-top: 0;
}

.signup-disabled {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.mt-sm {
  margin-top: 0.6rem;
}

.track-note {
  display: flex;
  max-width: 680px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.5rem auto 0;
  color: var(--text-secondary);
  text-align: center;
}

/* Onboarding */
.onboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: onboard;
}

.onboard-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.65rem;
  min-height: 88px;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.ob-num {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--text-secondary);
  counter-increment: onboard;
  font-size: 0.85rem;
  font-weight: 700;
}

.ob-num::before {
  content: counter(onboard);
}

.ob-label {
  font-weight: 700;
  line-height: 1.3;
}

.ob-sub {
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.onboard-step.is-done {
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
}

.onboard-step.is-done .ob-num {
  background: var(--success);
  color: #ffffff;
}

.onboard-step.is-done .ob-num::before {
  content: "✓";
}

.onboard-step.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), var(--glow-brand);
}

.onboard-step.is-active .ob-num {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

/* Portal home / overview */
.home-head {
  margin-bottom: 1.5rem;
}

.home-head .wave {
  display: inline-block;
  transform-origin: 70% 80%;
}

@media (prefers-reduced-motion: no-preference) {
  .home-head .wave {
    animation: wave-hand 2.6s ease-in-out 1;
  }
  .hero-art {
    animation: float-art 6s ease-in-out infinite;
  }
}

@keyframes wave-hand {
  0%, 60%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(14deg); }
  20%, 40% { transform: rotate(-8deg); }
}

@keyframes float-art {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.9rem;
}

.stat-bubble {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.05rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-start-start-radius: var(--bubble-tail);
  background: var(--surface);
  box-shadow: var(--elev-1);
  transition: box-shadow 0.24s ease, transform 0.24s ease, border-color 0.24s ease;
}

.stat-bubble:hover {
  box-shadow: var(--elev-2);
  transform: translateY(-2px);
}

.stat-bubble.is-ok {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--border));
}

.stat-ico {
  display: grid;
  width: 46px;
  height: 46px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent);
  color: var(--brand);
}

.stat-body {
  flex: 1;
  min-width: 0;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.1;
  color: var(--text);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

.home-section {
  margin: 1.9rem 0;
}

.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.home-section-title {
  margin-bottom: 0.9rem;
}

.home-section-head .home-section-title {
  margin-bottom: 0;
}

.next-step {
  margin-top: 1.1rem;
}

/* Assistant chat */
.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.chat {
  display: flex;
  height: min(720px, calc(100vh - 210px));
  min-height: 420px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.chat-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.chat-empty {
  max-width: 38rem;
  margin: auto;
  padding: 2rem;
  text-align: center;
}

.chat-msg {
  display: flex;
}

.chat-msg.me {
  justify-content: flex-start;
}

.chat-msg.bot {
  justify-content: flex-end;
}

.chat-bubble {
  display: inline-block;
  max-width: min(82%, 680px);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-msg.bot .chat-bubble {
  border: 1px solid var(--border);
  border-end-end-radius: 4px;
  background: var(--surface-subtle);
}

.chat-msg.me .chat-bubble {
  border-end-start-radius: 4px;
  background: var(--brand);
  color: var(--on-brand);
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.65rem;
  padding: 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.chat-input textarea {
  min-height: 48px;
  max-height: 9rem;
  resize: none;
}

.chat-input .btn {
  min-width: 88px;
  align-self: stretch;
}

.chat-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: chat-spin 0.7s linear infinite;
}

.htmx-request .chat-send-label {
  display: none;
}

.htmx-request .chat-spinner {
  display: inline-block;
}

.chat-thinking {
  display: none;
  margin: 0;
  padding: 0.4rem 1rem 0.7rem;
}

.chat-form.htmx-request ~ .chat-thinking,
#chat-form.htmx-request ~ .chat-thinking {
  display: block;
}

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

.htmx-swapping {
  opacity: 0.4;
}

/* Responsive layout */
@media (max-width: 1040px) {
  .flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .onboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hero {
    text-align: center;
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero h1,
  .hero-sub {
    margin-inline: auto;
  }

  .hero-cta,
  .hero-trust,
  .works-with,
  .ww-logos {
    justify-content: center;
  }

  .hero-art {
    max-width: 520px;
    margin-inline: auto;
  }

  .topbar {
    position: sticky;
    inset-block-start: 0;
    width: 100%;
    height: auto;
    min-height: 66px;
    align-items: center;
    flex-direction: row;
    gap: 0.65rem;
    padding: 0.55rem 0.8rem;
    border-inline-end: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .mkt-nav {
    grid-template-columns: auto 1fr auto;
  }

  .topbar-burger,
  .mkt-burger {
    display: inline-flex;
  }

  .topbar nav,
  .mkt-links {
    position: absolute;
    inset-block-start: 100%;
    inset-inline: 0;
    display: none;
    max-height: calc(100vh - 72px);
    align-items: stretch;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    padding: 0.75rem 1rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }

  .topbar.open nav,
  .mkt-nav.open .mkt-links {
    display: flex;
  }

  .topbar nav a,
  .mkt-links a {
    min-height: 46px;
    justify-content: flex-start;
    padding: 0.7rem 0.85rem;
  }

  .topbar > .brand {
    min-height: auto;
    padding: 0;
    border: 0;
  }

  .brand-copy small,
  .nav-section-label,
  .theme-label {
    display: none;
  }

  .topbar-right {
    align-items: center;
    flex: 1;
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .topbar-right .icon-btn {
    width: var(--control-height);
    justify-content: center;
    padding: 0;
  }

  .topbar-right form,
  .topbar-right form .btn-ghost {
    width: auto;
  }

  .topbar-right .muted {
    display: none;
  }

  .app-body main {
    margin-inline-start: 0;
  }

  .app-body .impersonation-banner,
  .app-body .billing-banner {
    margin-inline-start: 0;
  }

  /* Comfortable touch targets for connection-card actions on touch widths */
  .conn-actions .btn-ghost,
  .conn-actions .danger {
    min-height: var(--control-height);
  }
}

@media (max-width: 680px) {
  main {
    padding: 1.25rem 1rem 3rem;
  }

  .topbar,
  .mkt-nav {
    min-height: 62px;
    padding: 0.5rem 0.75rem;
  }

  .topbar-right,
  .mkt-nav-actions {
    gap: 0.35rem;
    min-width: 0;
  }

  /* The button icons widen the header actions; tighten their horizontal
     padding on phones so the header never exceeds the viewport. */
  .topbar-right form .btn-ghost,
  .mkt-nav-actions .btn,
  .mkt-nav-actions .btn-ghost {
    padding-inline: 0.6rem;
  }

  .mkt-nav-actions .btn-ghost {
    display: none;
  }

  .brand {
    font-size: 1.12rem;
  }

  .hero {
    padding-top: 3.5rem;
    text-align: center;
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
    margin-inline: auto;
    font-size: clamp(2.25rem, 12vw, 3.3rem);
  }

  .hero-sub {
    margin-inline: auto;
  }

  .hero-cta,
  .hero-trust,
  .works-with,
  .ww-logos {
    justify-content: center;
  }

  .hero-art {
    max-width: 520px;
    margin-inline: auto;
  }

  .hero-cta .btn,
  .hero-cta .btn-ghost {
    width: 100%;
  }

  .flow,
  .feature-grid,
  .plan-grid,
  .track-split,
  .onboard {
    grid-template-columns: 1fr;
  }

  .example-showcase {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding-block-end: 0.4rem;
    scroll-snap-type: inline mandatory;
    -webkit-overflow-scrolling: touch;
    /* RTL + horizontal scroller leaks its content width into the DOCUMENT
       scroll area on Safari/WebKit (and narrow desktop Chromium), so iPhones
       could pan the whole page into a blank region. Containment stops the
       leak at the scroller; safe here because the scroller clips anyway. */
    contain: layout paint;
  }

  .example-card {
    flex: 0 0 min(86vw, 360px);
    scroll-snap-align: start;
  }

  .explainer {
    grid-template-columns: 1fr;
  }

  .explainer-ico {
    width: 38px;
    height: 38px;
  }

  .pair-code-row,
  .chat-input {
    grid-template-columns: 1fr;
  }

  .pair-copy,
  .chat-input .btn {
    width: 100%;
  }

  .chat {
    height: calc(100dvh - 150px);
    min-height: 420px;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .impersonation-banner,
  .billing-banner {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Smallest phones (e.g. 320px): tighten the top bar so its row fits without
   an inner horizontal scroll once the vertical scrollbar claims ~15px. */
@media (max-width: 360px) {
  .topbar,
  .mkt-nav {
    gap: 0.4rem;
    padding-inline: 0.4rem;
  }

  .topbar-right {
    gap: 0.25rem;
  }

  .brand {
    font-size: 1.02rem;
  }

  /* 320px devices: the lang switcher (i18n, 17.6) re-widened both headers past
     the viewport. The globe keeps its aria-label, so the text code can go, and
     the icon buttons drop to 38px (still well above the 24px AA floor). */
  .lang-current {
    display: none;
  }

  .topbar-right .icon-btn,
  .mkt-nav-actions .icon-btn,
  .mkt-burger {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .topbar-right form .btn-ghost {
    padding-inline: 0.4rem;
    font-size: 0.85rem;
  }

  .mkt-nav-actions {
    gap: 0.25rem;
  }

  .mkt-nav-actions .btn {
    padding-inline: 0.45rem;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-transparency: reduce) {
  :root { --grain-opacity: 0; }

  .topbar,
  .mkt-nav,
  .surface-glass {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: #9badA5;
    --border-strong: #71867c;
    --grain-opacity: 0;
  }

  :root[data-theme="dark"] {
    --border: #61766c;
    --border-strong: #83978e;
  }

  .card,
  .table-scroll,
  .flow-step,
  .feature-card,
  .plan-card,
  .faq details {
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html.js [data-reveal] {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* ============================================================
   M15: settings hub, history, accounts, guide
   ============================================================ */

/* Settings: section sub-nav + search + sections */
.settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}
.settings-nav a {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.settings-nav a:hover {
  border-color: var(--brand);
  color: var(--brand-strong, var(--brand));
}
.settings-search { margin-bottom: 1rem; }
.settings-search input { max-width: 420px; }
.settings-sections { display: block; }

.section-divider {
  margin: 1.4rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
  color: var(--text);
}

/* checkbox rows (notifications) */
label.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.5rem 0;
  font-weight: 500;
}
label.check input { width: auto; min-height: 0; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.grow { flex: 1 1 200px; }

/* Danger zone */
.danger-zone {
  margin-top: 1.5rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}
.danger-zone h3 { color: var(--danger); }

/* History: filter bar + expandable rows */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.filter-bar label { margin: 0; }
.filter-bar select, .filter-bar input { min-width: 140px; }
.filter-bar .grow input { min-width: 200px; }

.explainer.subtle {
  grid-template-columns: auto minmax(0, 1fr);
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border-color: var(--border);
  background: var(--surface-subtle);
}
.explainer.subtle .explainer-ico {
  width: 30px; height: 30px;
  background: transparent;
  color: var(--text-secondary);
}
.explainer.subtle p { color: var(--text-secondary); font-size: 0.9rem; }

.history-table td.num { white-space: nowrap; color: var(--text-secondary); }
tr.history-row { cursor: pointer; }
tr.history-row:hover > td { background: var(--brand-soft); }
tr.history-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
tr.history-detail > td {
  padding: 0;
  background: var(--surface-subtle);
}
.history-detail-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
}
.history-detail-grid dt { color: var(--text-secondary); font-weight: 600; }
.history-detail-grid dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.history-json {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Accounts console (super-admin) */
.account-company-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.account-company-head h2 { margin: 0; }
.account-company-meta { color: var(--text-secondary); font-size: 0.88rem; }

/* Guide: MCP url copy, accordion, tool catalog */
.guide-h { margin-top: 1.8rem; }
.copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.copy-row code {
  flex: 1 1 260px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  overflow-wrap: anywhere;
}
.accordion { display: flex; flex-direction: column; gap: 0.7rem; }
.acc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.acc-item > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.acc-item > summary::-webkit-details-marker { display: none; }
.acc-item > summary::after {
  content: "+";
  margin-inline-start: auto;
  color: var(--text-secondary);
  font-size: 1.2rem;
}
.acc-item[open] > summary::after { content: "\2212"; }
.acc-brand {
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-strong, var(--brand));
  font-weight: 700;
}
.acc-body { padding: 0 1.1rem 1.1rem; }
.acc-body ol { margin: 0.6rem 0; padding-inline-start: 1.2rem; }
.acc-body li { margin: 0.3rem 0; }

.guide-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
/* The perm token is long and unbreakable; without wrapping it forces a
   ~399px page min-width and phones render /app/connect zoomed out. */
.guide-group-head .chip {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.guide-group-head .chip bdi {
  overflow-wrap: anywhere;
}
.guide-tools {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.4rem 1rem;
  margin: 0.6rem 0 0;
}
.guide-tools dt { font-weight: 600; }
.guide-tools dd { margin: 0; color: var(--text-secondary); }
.guide-tools code, .guide-mcp code, .copy-row code {
  font-size: 0.85rem;
}
.guide-steps { margin: 0; padding-inline-start: 1.2rem; }
.guide-steps li { margin: 0.4rem 0; }

@media (max-width: 640px) {
  .history-detail-grid, .guide-tools { grid-template-columns: 1fr; gap: 0.2rem; }
  .history-detail-grid dt { margin-top: 0.4rem; }
}

/* M15.1: in-app pricing display (billing + settings) */
.pricing-card { border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); }
.price-headline {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.6rem 0 0.4rem;
}
.price-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-strong, var(--brand));
}
.price-per { color: var(--text-secondary); font-weight: 600; }

/* M15.1: guide marketing intro */
.guide-hero {
  margin-bottom: 1.5rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border));
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
}
.guide-hero .kicker {
  display: inline-block;
  margin-bottom: 0.4rem;
  color: var(--brand-strong, var(--brand));
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.guide-hero h2 { margin: 0 0 0.4rem; font-size: 1.45rem; }
.guide-hero p { max-width: 80ch; margin: 0; color: var(--text); }
.guide-benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}
.guide-benefits li {
  display: flex;
  gap: 0.55rem;
  align-items: start;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.guide-benefits .b-ico { color: var(--brand); flex: none; margin-top: 2px; }
.guide-benefits strong { display: block; }
.guide-benefits span.b-sub { color: var(--text-secondary); font-size: 0.88rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wa-snippet {
  margin: 0.7rem 0;
  padding: 0.8rem 0.9rem;
  overflow: auto;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  font-size: 0.82rem;
  line-height: 1.45;
}

.app-body.wa-app main {
  max-width: none;
  width: auto;
  /* --wa-topbar is set by chat.js to the sticky mobile topbar's height (0 on
     desktop, where the topbar is a fixed sidebar) so the shell fills exactly
     the remaining viewport and the document never scrolls. */
  height: calc(100dvh - var(--wa-topbar, 0px));
  padding: 0;
  overflow: hidden;
}

.app-body.wa-app {
  overflow: hidden;
}

/* The chat client toggles panes with the `hidden` attribute; the display
   rules below must never override it. */
.wa-shell [hidden],
.wa-modal[hidden],
.wa-lightbox[hidden],
.wa-toast[hidden] {
  display: none !important;
}

.wa-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  /* One explicit row pinned to the container: an implicit auto row would size
     to the thread's content and make the whole page scroll on focus. */
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
}

.wa-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-inline-end: 1px solid var(--border);
  background: var(--surface-subtle);
}

.wa-side-head {
  padding: 1rem 1rem 0.6rem;
}

.wa-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.wa-side-top h1 {
  margin: 0;
  font-size: 1.15rem;
}

.wa-side-actions {
  display: flex;
  gap: 0.3rem;
}

.wa-search input,
.wa-conn-pick select {
  width: 100%;
  margin-bottom: 0.5rem;
}

.wa-list {
  flex: 1;
  overflow: auto;
}

.wa-list-err {
  padding: 0.8rem 1rem;
}

.wa-empty-side {
  display: grid;
  gap: 0.7rem;
  justify-items: start;
  padding: 1rem;
}

.wa-chat {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  width: 100%;
  padding: 0.7rem 1rem;
  color: inherit;
  font: inherit;
  text-align: start;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  border-block-end: 1px solid var(--border);
}

.wa-chat:hover,
.wa-chat.is-active {
  background: var(--surface);
}

.wa-avatar {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--hue, 150) 42% 88%);
  color: hsl(var(--hue, 150) 55% 28%);
  font-weight: 700;
}

:root[data-theme="dark"] .wa-avatar {
  background: hsl(var(--hue, 150) 30% 24%);
  color: hsl(var(--hue, 150) 55% 72%);
}

.wa-chat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wa-chat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.wa-chat-time {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.wa-main {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.wa-sidebar,
.wa-thread,
.wa-msgs {
  min-height: 0;
}

.wa-thread,
.wa-empty-hero {
  flex: 1;
  min-width: 0;
}

.wa-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.wa-thread-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  border-block-end: 1px solid var(--border);
  background: var(--surface);
}

.wa-peer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
  padding: 0.25rem 0.4rem;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.wa-peer:hover {
  background: var(--surface-subtle);
}

.wa-peer-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wa-peer-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-peer-copy small {
  font-size: 0.75rem;
}

.wa-thread-actions {
  display: flex;
  gap: 0.25rem;
}

.wa-back {
  display: none;
}

.wa-msgs {
  position: relative;
  flex: 1;
  overflow: auto;
  padding: 1rem;
  background: var(--canvas);
}

.wa-load-older {
  text-align: center;
  margin-bottom: 0.6rem;
}

.wa-day {
  display: flex;
  justify-content: center;
  margin: 0.9rem 0 0.7rem;
}

.wa-day span {
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.75rem;
  box-shadow: var(--shadow-xs);
}

.wa-bubble {
  position: relative;
  max-width: min(34rem, 86%);
  margin: 0 0 0.45rem;
  padding: 0.5rem 0.7rem 0.35rem;
  border-radius: 12px 12px 12px 4px;
  background: var(--surface);
  box-shadow: var(--elev-1);
}

.wa-bubble.is-me {
  margin-inline-start: auto;
  border-radius: 12px 12px 4px 12px;
  background: var(--brand-soft);
}

.wa-bubble.is-sticker {
  background: none;
  box-shadow: none;
  padding: 0;
}

.wa-bubble.is-flash {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.wa-bubble p {
  margin: 0.15rem 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wa-bubble footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
}

.wa-bubble time {
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.wa-star {
  color: var(--warning);
  font-size: 0.75rem;
}

.wa-from {
  font-size: 0.78rem;
  font-weight: 700;
  color: hsl(var(--hue, 150) 55% 38%);
}

:root[data-theme="dark"] .wa-from {
  color: hsl(var(--hue, 150) 60% 68%);
}

.wa-quote {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0.3rem;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-inline-start: 3px solid var(--brand);
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-align: start;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-quote strong {
  display: block;
  color: var(--brand);
  font-size: 0.75rem;
}

.wa-img {
  display: block;
  max-width: 100%;
  max-height: 22rem;
  border-radius: 8px;
  margin: 0.15rem 0;
  cursor: zoom-in;
}

.wa-sticker {
  max-height: 9rem;
}

.wa-video {
  display: block;
  max-width: 100%;
  max-height: 22rem;
  border-radius: 8px;
  margin: 0.15rem 0;
}

.wa-audio {
  width: min(17rem, 70vw);
  margin: 0.2rem 0;
}

.wa-file {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.2rem 0;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text);
  text-decoration: none;
}

.wa-call {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.wa-msg-menu {
  position: absolute;
  top: 0.25rem;
  inset-inline-end: 0.25rem;
  display: none;
  padding: 0.15rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text-secondary);
  cursor: pointer;
}

.wa-bubble:hover .wa-msg-menu,
.wa-bubble:focus-within .wa-msg-menu {
  display: block;
}

@media (hover: none) {
  /* Touch: always visible, parked in the footer band opposite the timestamp
     (the bubble reserves the band so it never covers text). */
  .wa-bubble:not(.is-sticker) {
    padding-bottom: 1.55rem;
  }

  .wa-bubble footer {
    position: absolute;
    bottom: 0.3rem;
    inset-inline-end: 0.7rem;
  }

  .wa-msg-menu {
    display: block;
    top: auto;
    bottom: 0.2rem;
    inset-inline-end: auto;
    inset-inline-start: 0.3rem;
    background: none;
  }
}

#wa-jump-wrap {
  position: sticky;
  bottom: 0.4rem;
  display: flex;
  justify-content: flex-end;
}

.wa-jump {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border-radius: 50%;
}

.wa-reply-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  border-block-start: 1px solid var(--border);
  background: var(--surface-subtle);
}

.wa-reply-copy {
  flex: 1;
  min-width: 0;
  border-inline-start: 3px solid var(--brand);
  padding-inline-start: 0.5rem;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-reply-copy strong {
  display: block;
  color: var(--brand);
  font-size: 0.76rem;
}

.wa-compose {
  display: flex;
  gap: 0.4rem;
  align-items: flex-end;
  padding: 0.6rem 0.8rem;
  border-block-start: 1px solid var(--border);
  background: var(--surface);
}

.wa-input-wrap {
  flex: 1;
  min-width: 0;
}

.wa-edit-note {
  font-size: 0.75rem;
  color: var(--brand);
  margin-bottom: 0.15rem;
}

.wa-compose textarea {
  width: 100%;
  min-height: 2.6rem;
  max-height: 8.75rem;
  resize: none;
}

.wa-compose .icon-btn,
.wa-compose .wa-send {
  height: 2.6rem;
}

.wa-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.9rem;
}

.wa-record {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border-block-start: 1px solid var(--border);
  background: var(--surface);
}

.wa-record-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--danger);
  animation: wa-blink 1s infinite;
}

@keyframes wa-blink {
  50% { opacity: 0.25; }
}

.wa-info {
  width: min(21rem, 90vw);
  flex: none;
  display: flex;
  flex-direction: column;
  border-inline-start: 1px solid var(--border);
  background: var(--surface);
}

.wa-info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-block-end: 1px solid var(--border);
}

.wa-info-head h3 {
  margin: 0;
  font-size: 1rem;
}

.wa-info-body {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}

.wa-info-body h4 {
  margin: 0 0 0.2rem;
}

.wa-members {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.wa-member {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.2rem;
}

.wa-member .wa-avatar {
  width: 2rem;
  height: 2rem;
  font-size: 0.85rem;
}

.wa-badge {
  margin-inline-start: auto;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.72rem;
}

.wa-menu {
  position: fixed;
  z-index: 90;
  min-width: 11rem;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.wa-menu button {
  display: block;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.wa-menu button:hover {
  background: var(--surface-subtle);
}

.wa-menu button.is-danger {
  color: var(--danger);
}

.wa-quick-react {
  display: flex;
  gap: 0.1rem;
  padding: 0.2rem 0.3rem 0.4rem;
  border-block-end: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.wa-quick-react button {
  width: auto;
  padding: 0.25rem 0.35rem;
  font-size: 1.15rem;
  border-radius: var(--radius-pill);
}

.wa-emoji-pop {
  position: absolute;
  bottom: 4.2rem;
  inset-inline-start: 0.8rem;
  z-index: 80;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.wa-emoji-pop emoji-picker {
  width: min(22rem, calc(100vw - 2rem));
  height: min(24rem, 60vh);
}

.wa-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 15, 22, 0.55);
}

.wa-modal-card {
  width: min(26rem, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.wa-modal-card h3 {
  margin: 0;
}

.wa-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.wa-preview-media {
  max-width: 100%;
  max-height: 45vh;
  border-radius: var(--radius-sm);
  align-self: center;
}

.wa-preview-file {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  overflow-wrap: anywhere;
}

.wa-fwd-list {
  max-height: 46vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.wa-fwd-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.4rem;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.wa-fwd-row:hover {
  background: var(--surface-subtle);
}

.wa-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
}

.wa-lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 12, 0.88);
}

.wa-lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  border-radius: var(--radius-sm);
}

.wa-lightbox-close {
  position: absolute;
  top: 1rem;
  inset-inline-end: 1rem;
  color: #fff;
}

.wa-toast {
  position: fixed;
  bottom: 1.4rem;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 120;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  background: var(--surface-inverse);
  color: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
}

html[dir="ltr"] .rtl-flip {
  transform: scaleX(-1);
}

.wa-empty-hero {
  display: grid;
  place-content: center;
  gap: 0.6rem;
  height: 100%;
  padding: 2rem;
  text-align: center;
}

.wa-empty {
  padding: 1.2rem;
}

@media (max-width: 860px) {
  .wa-shell {
    grid-template-columns: 1fr;
  }

  .wa-sidebar {
    border-inline-end: 0;
  }

  /* One pane at a time: the open thread replaces the list. */
  .wa-shell.thread-open .wa-sidebar {
    display: none;
  }

  .wa-shell:not(.thread-open) .wa-main {
    display: none;
  }

  .wa-back {
    display: inline-flex;
  }

  .wa-info {
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: 60;
  }

  .wa-bubble {
    max-width: 92%;
  }

  .wa-emoji-pop {
    inset-inline-start: 0.4rem;
    inset-inline-end: 0.4rem;
  }

  /* Touch widths: language options and settings tabs meet the 44px target. */
  .lang-opt {
    display: flex;
    align-items: center;
    min-height: var(--control-height, 44px);
  }

  .settings-nav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height, 44px);
  }
}

.desk-guide {
  list-style: none;
  margin: 0 0 1.6rem;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.desk-guide-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}
.desk-guide-step h3 { margin: 0 0 0.35rem; }
.desk-guide-step p { margin: 0 0 0.55rem; }
.desk-guide-num {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}
.desk-guide-notes {
  margin: 0;
  padding-inline-start: 1.2rem;
}
.desk-guide-notes li { margin: 0.45rem 0; }

/* ============================================================
   Mobile: data tables become stacked cards (no horizontal scroll)
   ============================================================ */
@media (max-width: 720px) {
  .table-scroll {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  table.data,
  table.data tbody {
    display: block;
    width: 100%;
  }

  table.data thead {
    display: none;
  }

  table.data tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  /* display:block above would defeat the UA [hidden] rule */
  table.data tr[hidden] {
    display: none;
  }

  table.data tbody tr:last-child {
    margin-bottom: 0;
  }

  table.data td,
  table.data tbody tr:last-child td {
    display: block;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
  }

  table.data tr td:last-child,
  table.data tbody tr:last-child td:last-child {
    border-bottom: 0;
  }

  table.data td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.15rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .history-table td.num {
    white-space: normal;
  }

  /* Keep an opened detail card visually attached to its trigger row */
  tr.history-row[aria-expanded="true"] {
    margin-bottom: 0;
    border-end-start-radius: 0;
    border-end-end-radius: 0;
    border-bottom: 0;
  }

  tr.history-detail:not([hidden]) {
    border-start-start-radius: 0;
    border-start-end-radius: 0;
    border-top: 0;
  }

  tr.history-detail > td {
    padding: 0;
  }
}

/* ===================================================================
   Button icons (brand sprite, 2026-08-27)
   Every action button carries one 18px inline icon from the Connecta
   icon set (templates/_icons.html sprite, mirrored in
   static/brand/icons.svg). button/.btn/.btn-ghost/.danger are already
   inline-flex + align-items:center + gap 0.45rem (see the Buttons
   section above), so the icon only has to hold its box: never shrink,
   never stretch, and sit as a flex item (no inline-baseline gap).
   currentColor keeps it right in light/dark; DOM order + flex put it
   inline-start of the label in both RTL and LTR.
   =================================================================== */
.btn-ico {
  flex: none;
  width: 18px;
  height: 18px;
}

/* .btn-lg keeps the same 18px glyph so hero and body buttons match. */

/* Icon-only square controls: <button class="icon-btn"> already gets the
   inline-flex contract from the button rule, but the language switcher is
   <summary class="icon-btn"> and did not. Scoped to summary so the
   burger's display:none (desktop) is left untouched. */
summary.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Theme toggle: moon (light) / sun (dark) now come from the sprite. The
   generic .btn-ico rule above does not set display, so the existing
   .icon-sun / .icon-moon visibility rules keep working unchanged. */
