/*
  Customer UI (D138, D161, D164): tokens and the shared pieces of the customer pages.
  Look: D164 "light and polished" (F:\Topshipping\UI_DESIGN_2026-11-19\polished): a light ground, white cards with a fine
  border and a soft shadow, one blue-violet brand colour, a soft warm accent for new requests / warnings / failures,
  green for healthy, Vazirmatn type. Replaces the D162 look; class names are kept so U1-U4 pages pick it up.
  Independent of the UiKit and of Bootstrap. Every class is prefixed "cu-" and every token "--cu-", so the sheet is safe to
  load next to the staff console styles. RTL first (logical properties only), works at 375px, visible focus, honours
  reduced motion, text contrast at least 4.5:1.
*/

:root {
  /* Palette (D164) */
  --cu-brand: #3B4CE0;            /* primary action, links, current item */
  --cu-brand-ink: #2A37B8;        /* hover, text on the soft brand fill */
  --cu-brand-soft: #EEF0FD;
  --cu-brand-line: #E3E6FB;
  --cu-brand-wash: #F5F6FE;
  --cu-brand-track: #E0E4FB;
  --cu-warm: #C2410C;             /* new requests, warnings, failures */
  --cu-warm-soft: #FFF1E8;
  --cu-warm-wash: #FFFBF7;
  --cu-warm-line: #FBD9C4;
  --cu-ok: #15803D;               /* healthy, learned, done */
  --cu-ok-dot: #16A34A;
  --cu-ok-soft: #ECFDF3;
  --cu-ok-ring: #DCFCE7;
  --cu-ok-line: #BBF7D0;
  --cu-neutral-soft: #F1F2F6;     /* informational, in progress */
  --cu-ground: #F6F7F9;
  --cu-surface: #FFFFFF;
  --cu-surface-2: #FBFBFD;
  --cu-surface-3: #FAFBFC;
  --cu-line: #E8EAF0;
  --cu-divider: #EEF0F4;
  --cu-divider-2: #F1F2F6;
  --cu-line-strong: #DDE0E8;
  --cu-dash: #C9CEDB;
  --cu-text: #0E1525;
  --cu-text-2: #4A5468;
  --cu-text-3: #4A5468;
  --cu-muted: #636B7E;            /* #6B7385 in the design, a shade darker for 4.5:1 on the ground colour */
  --cu-dark: #0E1525;
  --cu-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
  --cu-shadow-button: 0 1px 2px rgba(16, 24, 40, 0.05);
  --cu-shadow-pop: 0 20px 40px -16px rgba(42, 55, 184, 0.30), 0 2px 6px rgba(16, 24, 40, 0.06);
  --cu-shadow-menu: 0 12px 32px -8px rgba(16, 24, 40, 0.18), 0 2px 6px rgba(16, 24, 40, 0.06);

  /* Earlier token names (U1-U4 pages and customer-bots.css / customer-inbox.css) mapped onto the D164 palette. */
  --cu-lapis: var(--cu-brand);
  --cu-lapis-strong: var(--cu-brand-ink);
  --cu-lapis-soft: var(--cu-brand-soft);
  --cu-turquoise: var(--cu-ok-dot);
  --cu-turquoise-soft: var(--cu-ok-soft);
  --cu-turquoise-text: var(--cu-ok);
  --cu-saffron: var(--cu-warm);
  --cu-saffron-tile: #F59E6B;
  --cu-saffron-text: var(--cu-warm);
  --cu-saffron-soft: var(--cu-warm-soft);
  --cu-pomegranate: var(--cu-warm);
  --cu-pomegranate-soft: var(--cu-warm-soft);
  --cu-pomegranate-text: var(--cu-warm);
  --cu-waiting: #AEB6FF;
  --cu-ink: var(--cu-text);
  --cu-ink-raised: var(--cu-neutral-soft);
  --cu-ink-text: var(--cu-text);
  --cu-ink-muted: var(--cu-text-2);
  --cu-edge: var(--cu-line-strong);
  --cu-empty-edge: var(--cu-dash);

  /* Type: Vazirmatn, 12.5 / 13.5 / 14.5 / 17 / 24 / 28 */
  --cu-font: 'Vazirmatn', Tahoma, sans-serif;
  --cu-fs-xs: 0.78125rem;  /* 12.5 */
  --cu-fs-sm: 0.84375rem;  /* 13.5 */
  --cu-fs-md: 0.90625rem;  /* 14.5 */
  --cu-fs-base: 0.90625rem;/* 14.5 */
  --cu-fs-lg: 1.0625rem;   /* 17 */
  --cu-fs-xl: 1.0625rem;   /* 17: card headings */
  --cu-fs-2xl: 1.5rem;     /* 24 */
  --cu-fs-3xl: 1.75rem;    /* 28 */
  --cu-fs-4xl: 1.75rem;    /* 28: page heading */
  --cu-lh: 1.75;

  /* Space, radius */
  --cu-s1: 0.25rem;
  --cu-s2: 0.5rem;
  --cu-s3: 0.75rem;
  --cu-s4: 1rem;
  --cu-s5: 1.25rem;
  --cu-s6: 1.5rem;
  --cu-s7: 1.75rem;
  --cu-s8: 2rem;
  --cu-s10: 2.25rem;
  --cu-r-sm: 6px;
  --cu-r-md: 9px;
  --cu-r-lg: 10px;
  --cu-r-xl: 16px;
  --cu-r-pill: 99px;

  --cu-nav-width: 264px;
  --cu-focus: 0 0 0 2px var(--cu-surface), 0 0 0 4px var(--cu-brand);
}

/* ---------- Base (only inside customer pages) ---------- */

.cu-body {
  margin: 0;
  background: var(--cu-ground);
  color: var(--cu-text);
  font-family: var(--cu-font);
  font-size: var(--cu-fs-base);
  line-height: var(--cu-lh);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.cu-body *,
.cu-page *,
.cu-body *::before,
.cu-body *::after {
  box-sizing: border-box;
}

.cu-page {
  font-family: var(--cu-font);
  color: var(--cu-text);
  line-height: var(--cu-lh);
}

.cu-body a,
.cu-page a {
  color: var(--cu-brand);
  text-decoration: none;
}

.cu-body a:hover,
.cu-page a:hover {
  color: var(--cu-brand-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cu-body :focus-visible,
.cu-page :focus-visible {
  outline: none;
  box-shadow: var(--cu-focus);
  border-radius: var(--cu-r-sm);
}

.cu-page h1,
.cu-page h2,
.cu-page h3,
.cu-page p {
  margin: 0;
}

.cu-body svg {
  flex: none;
}

.cu-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cu-skip {
  position: absolute;
  inset-inline-start: var(--cu-s4);
  top: -100px;
  z-index: 100;
  padding: var(--cu-s2) var(--cu-s4);
  border-radius: var(--cu-r-lg);
  background: var(--cu-surface);
  color: var(--cu-brand);
  font-weight: 600;
  box-shadow: var(--cu-shadow-menu);
}

.cu-skip:focus {
  top: var(--cu-s4);
}

/* ---------- Shell: white side menu + main column (D164) ---------- */

.cu-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.cu-rail {
  flex: 0 0 var(--cu-nav-width);
  width: var(--cu-nav-width);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  background: var(--cu-surface);
  border-inline-end: 1px solid var(--cu-line);
}

.cu-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 6px;
}

.cu-body .cu-brand,
.cu-body .cu-brand:hover {
  color: var(--cu-text);
  text-decoration: none;
}

.cu-brand__name {
  font-size: 1.1875rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

/* Bot switcher: a <details> menu (works without script; customer-shell.js closes it on Escape / outside click). */
.cu-botpick {
  position: relative;
}

.cu-botpick__current {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--cu-line);
  border-radius: 12px;
  background: var(--cu-surface-2);
  cursor: pointer;
  list-style: none;
}

.cu-botpick__current::-webkit-details-marker {
  display: none;
}

.cu-botpick__current:hover {
  border-color: var(--cu-line-strong);
}

.cu-botpick[open] .cu-botpick__current {
  border-color: var(--cu-brand-line);
  background: var(--cu-brand-wash);
}

.cu-botpick__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

.cu-botpick__name {
  overflow: hidden;
  color: var(--cu-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cu-botpick__meta {
  color: var(--cu-muted);
  font-size: 0.75rem;
}

.cu-botpick__chev {
  color: var(--cu-muted);
  transition: transform 120ms ease;
}

.cu-botpick[open] .cu-botpick__chev {
  transform: rotate(180deg);
}

.cu-botpick__menu {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 6px);
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--cu-line);
  border-radius: 12px;
  background: var(--cu-surface);
  box-shadow: var(--cu-shadow-menu);
}

.cu-body .cu-botpick__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: var(--cu-r-md);
  color: var(--cu-text);
  font-size: var(--cu-fs-sm);
  font-weight: 500;
  text-decoration: none;
}

.cu-body .cu-botpick__item:hover {
  background: var(--cu-neutral-soft);
  color: var(--cu-text);
  text-decoration: none;
}

.cu-body .cu-botpick__item[aria-current="true"] {
  background: var(--cu-brand-soft);
  color: var(--cu-brand-ink);
  font-weight: 600;
}

.cu-botpick__item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cu-botpick__sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--cu-divider);
}

.cu-body .cu-botpick__all {
  color: var(--cu-brand);
}

/* Letter avatar (bot, visitor, the signed-in user). */
.cu-avatar {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--cu-warm-soft);
  color: var(--cu-warm);
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1;
}

.cu-avatar--round {
  border-radius: var(--cu-r-pill);
}

.cu-avatar--lg {
  width: 38px;
  height: 38px;
}

.cu-avatar--brand { background: var(--cu-brand-soft); color: var(--cu-brand-ink); }
.cu-avatar--sky { background: #E0F2FE; color: #0369A1; }
.cu-avatar--violet { background: #F3E8FF; color: #7E22CE; }
.cu-avatar--ok { background: var(--cu-ok-soft); color: var(--cu-ok); }
.cu-avatar--warm { background: var(--cu-warm-soft); color: var(--cu-warm); }

.cu-avatar__dot {
  position: absolute;
  bottom: -2px;
  inset-inline-end: -2px;
  width: 10px;
  height: 10px;
  border-radius: var(--cu-r-pill);
  background: var(--cu-ok-dot);
  border: 2px solid var(--cu-surface);
}

.cu-avatar__dot--off {
  background: #9AA1B2;
}

.cu-avatar__dot--warm {
  background: var(--cu-warm);
}

/* Menu groups. */
.cu-nav {
  display: flex;
  flex-direction: column;
}

.cu-nav__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cu-nav__link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--cu-r-md);
  color: var(--cu-text-2);
  font-size: var(--cu-fs-md);
  font-weight: 500;
  text-decoration: none;
}

.cu-body .cu-nav__link {
  color: var(--cu-text-2);
  text-decoration: none;
}

.cu-body .cu-nav__link:hover {
  background: var(--cu-neutral-soft);
  color: var(--cu-text);
  text-decoration: none;
}

.cu-body .cu-nav__link[aria-current="page"] {
  background: var(--cu-brand-soft);
  color: var(--cu-brand-ink);
  font-weight: 600;
}

.cu-nav__icon {
  width: 19px;
  height: 19px;
}

.cu-nav__text {
  flex: 1 1 auto;
  min-width: 0;
}

.cu-nav__badge {
  min-width: 1.5rem;
  padding: 1px 8px;
  border-radius: var(--cu-r-pill);
  background: var(--cu-brand-soft);
  color: var(--cu-brand-ink);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}

.cu-nav__badge--warm {
  background: var(--cu-warm-soft);
  color: var(--cu-warm);
}

.cu-rail__rule {
  height: 1px;
  margin: 0 6px;
  border: 0;
  background: var(--cu-divider);
}

/* Trial card at the bottom of the side menu. */
.cu-trialcard {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--cu-brand-line);
  border-radius: 14px;
  background: var(--cu-brand-wash);
}

.cu-trialcard__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--cu-s2);
}

.cu-trialcard__title {
  font-size: 0.875rem;
  font-weight: 700;
}

.cu-trialcard__left {
  color: var(--cu-text-2);
  font-size: 0.8125rem;
}

.cu-rail__foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: var(--cu-s3);
  border-top: 1px solid var(--cu-divider);
}

.cu-trialcard + .cu-rail__foot {
  margin-top: 0;
}

.cu-rail__foot:first-child,
.cu-nav + .cu-rail__foot {
  margin-top: auto;
}

.cu-nav__user {
  padding: 0 12px var(--cu-s1);
  overflow-wrap: anywhere;
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

.cu-nav__logout {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--cu-r-md);
  background: transparent;
  color: var(--cu-text-2);
  font: inherit;
  font-size: var(--cu-fs-md);
  font-weight: 500;
  text-align: start;
  cursor: pointer;
}

.cu-nav__logout:hover {
  background: var(--cu-neutral-soft);
  color: var(--cu-text);
}

/* Phone top bar and bottom tabs (HomeMobile): hidden on wide screens. */
.cu-topbar,
.cu-tabbar,
.cu-scrim {
  display: none;
}

.cu-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 1240px;
  padding: 28px 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cu-main:focus {
  outline: none;
}

.cu-foot {
  margin-top: auto;
  padding-top: var(--cu-s6);
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
  display: flex;
  flex-wrap: wrap;
  gap: var(--cu-s4);
}

@media (max-width: 860px) {
  .cu-shell {
    flex-direction: column;
  }

  .cu-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--cu-surface);
    border-bottom: 1px solid var(--cu-line);
  }

  .cu-topbar__brand {
    display: inline-flex;
  }

  .cu-topbar .cu-botpick {
    flex: 1 1 auto;
    min-width: 0;
  }

  .cu-topbar .cu-botpick__current {
    padding: 4px 6px;
    border: 0;
    background: transparent;
  }

  .cu-topbar .cu-botpick__current .cu-avatar,
  .cu-topbar .cu-botpick__meta {
    display: none;
  }

  .cu-topbar .cu-botpick__name {
    font-size: 0.9375rem;
    font-weight: 700;
  }

  .cu-topbar .cu-botpick__text {
    flex: 0 1 auto;
  }

  .cu-topbar__spacer {
    flex: 1 1 auto;
  }

  .cu-body .cu-topbar__me {
    width: 36px;
    height: 36px;
    border-radius: var(--cu-r-pill);
    display: grid;
    place-items: center;
    background: var(--cu-warm-soft);
    color: var(--cu-warm);
    font-weight: 800;
    text-decoration: none;
  }

  /* Without script the side menu sits under the page (the "more" tab jumps to it); with script it is a drawer. */
  .cu-rail {
    position: static;
    width: auto;
    height: auto;
    flex-basis: auto;
    order: 3;
    border-inline-end: 0;
    border-top: 1px solid var(--cu-line);
  }

  .cu-rail > .cu-brand,
  .cu-rail > .cu-botpick {
    display: none;
  }

  .cu-js .cu-rail {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 40;
    width: min(320px, 86vw);
    height: 100dvh;
    border-top: 0;
    border-inline-end: 1px solid var(--cu-line);
    box-shadow: var(--cu-shadow-menu);
    transform: translateX(110%);
    visibility: hidden;
    transition: transform 160ms ease, visibility 160ms;
  }

  .cu-js[dir="ltr"] .cu-rail {
    transform: translateX(-110%);
  }

  .cu-js .cu-shell[data-nav-open="true"] .cu-rail {
    transform: none;
    visibility: visible;
  }

  .cu-js .cu-shell[data-nav-open="true"] .cu-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(14, 21, 37, 0.32);
  }

  .cu-main {
    order: 2;
    padding: 18px 16px 96px;
    gap: 14px;
  }

  .cu-tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    padding: 4px 6px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--cu-surface);
    border-top: 1px solid var(--cu-line);
  }

  .cu-body .cu-tabbar__item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-height: 48px;
    padding: 8px 0;
    border: 0;
    border-radius: var(--cu-r-md);
    background: transparent;
    color: var(--cu-muted);
    font: inherit;
    font-size: 0.71875rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
  }

  .cu-body .cu-tabbar__item[aria-current="page"] {
    color: var(--cu-brand-ink);
    font-weight: 700;
  }

  .cu-tabbar__icon {
    position: relative;
    display: inline-flex;
  }

  .cu-tabbar__dot {
    position: absolute;
    top: -2px;
    inset-inline-end: -4px;
    width: 8px;
    height: 8px;
    border-radius: var(--cu-r-pill);
    background: var(--cu-warm);
    border: 2px solid var(--cu-surface);
  }

  .cu-foot {
    padding-bottom: var(--cu-s2);
  }
}

/* ---------- Page stack and head ---------- */

.cu-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.cu-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--cu-s4);
}

.cu-head__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cu-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cu-eyebrow {
  color: var(--cu-muted);
  font-size: 0.875rem;
}

.cu-h1 {
  font-size: var(--cu-fs-4xl);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.4px;
}

.cu-h2 {
  font-size: var(--cu-fs-xl);
  font-weight: 700;
  line-height: 1.6;
}

.cu-lede {
  color: var(--cu-text-2);
  font-size: var(--cu-fs-md);
}

.cu-note {
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

@media (max-width: 860px) {
  .cu-stack {
    gap: 14px;
  }

  .cu-h1 {
    font-size: 1.4375rem;
    letter-spacing: -0.3px;
  }

  .cu-eyebrow {
    font-size: 0.8125rem;
  }
}

/* ---------- Surfaces ---------- */

.cu-card {
  background: var(--cu-surface);
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-r-xl);
  box-shadow: var(--cu-shadow);
  padding: 22px;
  min-width: 0;
}

.cu-card--flush {
  padding: 0;
  overflow: hidden;
}

/* A highlighted card (was the dark "ink" card in D162): the soft brand wash of the trial card. */
.cu-card--ink {
  background: var(--cu-brand-wash);
  border-color: var(--cu-brand-line);
  box-shadow: none;
  color: var(--cu-text);
}

.cu-card--ink .cu-note {
  color: var(--cu-text-2);
}

.cu-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cu-s3);
  padding: 16px 22px;
  border-bottom: 1px solid var(--cu-divider);
}

.cu-card__title {
  margin: 0;
  font-size: var(--cu-fs-lg);
  font-weight: 700;
  line-height: 1.6;
}

.cu-card__link {
  font-size: var(--cu-fs-sm);
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .cu-card {
    padding: 16px;
  }

  .cu-card--flush {
    padding: 0;
  }

  .cu-card__head {
    padding: 14px 16px;
  }
}

.cu-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cu-s3) var(--cu-s4);
  padding: 14px 16px;
  border-radius: var(--cu-r-xl);
}

.cu-banner__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 62ch;
}

.cu-banner__text strong {
  font-size: var(--cu-fs-md);
}

/* A banner the side menu already shows on wide screens (the trial card): only on phones. */
@media (min-width: 861px) {
  .cu-banner--phone {
    display: none;
  }
}

/* Layout grid of dashboard cards (3 columns on wide screens). */
.cu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.cu-span-2 {
  grid-column: span 2;
}

@media (max-width: 1100px) {
  .cu-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .cu-span-2 {
    grid-column: auto;
  }
}

/* ---------- Buttons: primary, secondary, quiet (soft), dark ---------- */

.cu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--cu-r-lg);
  background: var(--cu-brand);
  color: #FFFFFF;
  font: inherit;
  font-size: var(--cu-fs-md);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.cu-body .cu-btn,
.cu-page .cu-btn {
  color: #FFFFFF;
  text-decoration: none;
}

.cu-body .cu-btn:hover,
.cu-page .cu-btn:hover {
  background: var(--cu-brand-ink);
  color: #FFFFFF;
  text-decoration: none;
}

/* Secondary: white with a fine border (also the old "quiet" look for links next to a primary). */
.cu-body .cu-btn--secondary,
.cu-page .cu-btn--secondary,
.cu-body .cu-btn--quiet,
.cu-page .cu-btn--quiet {
  background: var(--cu-surface);
  border-color: var(--cu-line-strong);
  color: var(--cu-text);
  box-shadow: var(--cu-shadow-button);
}

.cu-body .cu-btn--secondary:hover,
.cu-page .cu-btn--secondary:hover,
.cu-body .cu-btn--quiet:hover,
.cu-page .cu-btn--quiet:hover {
  background: var(--cu-surface-3);
  border-color: #C9CEDB;
  color: var(--cu-text);
}

/* Soft: brand text on the soft brand fill («همهٔ گفتگوها»). */
.cu-body .cu-btn--soft,
.cu-page .cu-btn--soft {
  background: var(--cu-brand-soft);
  color: var(--cu-brand);
}

.cu-body .cu-btn--soft:hover,
.cu-page .cu-btn--soft:hover {
  background: var(--cu-brand-line);
  color: var(--cu-brand-ink);
}

.cu-body .cu-btn--dark,
.cu-page .cu-btn--dark {
  background: var(--cu-dark);
  color: #FFFFFF;
}

.cu-body .cu-btn--dark:hover,
.cu-page .cu-btn--dark:hover {
  background: #232B3D;
  color: #FFFFFF;
}

/* On the highlighted (wash) card the action is the primary button. */
.cu-body .cu-btn--on-ink,
.cu-page .cu-btn--on-ink {
  background: var(--cu-brand);
  color: #FFFFFF;
}

.cu-body .cu-btn--on-ink:hover,
.cu-page .cu-btn--on-ink:hover {
  background: var(--cu-brand-ink);
  color: #FFFFFF;
}

.cu-btn--sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.875rem;
}

.cu-btn--lg {
  min-height: 44px;
  border-radius: 12px;
  font-size: 0.9375rem;
}

.cu-btn--block {
  width: 100%;
}

.cu-btn__icon {
  width: 17px;
  height: 17px;
}

.cu-btn[aria-disabled="true"],
.cu-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Pills and state chips ---------- */

/* Bot status pill (D145: active / inactive / suspended). */
.cu-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--cu-r-pill);
  font-size: var(--cu-fs-xs);
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}

.cu-pill--active {
  background: var(--cu-ok-soft);
  color: var(--cu-ok);
}

.cu-pill--inactive {
  background: var(--cu-neutral-soft);
  color: var(--cu-text-2);
}

.cu-pill--suspended {
  background: var(--cu-warm-soft);
  color: var(--cu-warm);
}

/* Generic state chip: ok (done, learned), warm (new, failed, warning), brand (waiting), neutral (in progress). */
.cu-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: var(--cu-r-pill);
  background: var(--cu-neutral-soft);
  color: var(--cu-text-2);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}

.cu-chip--ok { background: var(--cu-ok-soft); color: var(--cu-ok); }
.cu-chip--warm { background: var(--cu-warm-soft); color: var(--cu-warm); }
.cu-chip--brand { background: var(--cu-brand-soft); color: var(--cu-brand-ink); }
.cu-chip--neutral { background: var(--cu-neutral-soft); color: var(--cu-text-2); }

.cu-chip--outline {
  background: var(--cu-surface);
  border: 1px solid var(--cu-line);
  color: var(--cu-text-2);
}

/* "Live" dot with a soft halo («روی سایت فعال است»). */
.cu-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--cu-ok);
  font-size: 0.8125rem;
  font-weight: 600;
}

.cu-live__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--cu-r-pill);
  background: var(--cu-ok-dot);
  box-shadow: 0 0 0 4px var(--cu-ok-ring);
}

.cu-live--off {
  color: var(--cu-text-2);
}

.cu-live--off .cu-live__dot {
  background: #9AA1B2;
  box-shadow: 0 0 0 4px var(--cu-neutral-soft);
}

.cu-live--warm {
  color: var(--cu-warm);
}

.cu-live--warm .cu-live__dot {
  background: var(--cu-warm);
  box-shadow: 0 0 0 4px var(--cu-warm-soft);
}

/* ---------- Progress: bar (<progress>), usage bar, meter, ring ---------- */

.cu-progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--cu-r-pill);
  background: var(--cu-divider);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}

.cu-progress::-webkit-progress-bar {
  background: var(--cu-divider);
  border-radius: var(--cu-r-pill);
}

.cu-progress::-webkit-progress-value {
  background: var(--cu-brand);
  border-radius: var(--cu-r-pill);
}

.cu-progress::-moz-progress-bar {
  background: var(--cu-brand);
  border-radius: var(--cu-r-pill);
}

.cu-progress--thin {
  height: 6px;
}

.cu-progress--on-wash,
.cu-progress--on-wash::-webkit-progress-bar {
  background: var(--cu-brand-track);
}

.cu-progress--warm::-webkit-progress-value { background: var(--cu-warm); }
.cu-progress--warm::-moz-progress-bar { background: var(--cu-warm); }

.cu-usage {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s2);
}

.cu-usage__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--cu-s3);
  color: var(--cu-text-2);
}

.cu-usage__value {
  color: var(--cu-text);
  font-weight: 700;
}

.cu-usage__bar {
  height: 8px;
  border-radius: var(--cu-r-pill);
  background: var(--cu-divider);
  overflow: hidden;
}

.cu-usage__fill {
  display: block;
  width: var(--cu-fill, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: var(--cu-r-pill);
  background: var(--cu-brand);
}

.cu-usage--warning .cu-usage__fill,
.cu-usage--full .cu-usage__fill {
  background: var(--cu-warm);
}

.cu-usage--warning .cu-usage__note,
.cu-usage--full .cu-usage__note {
  color: var(--cu-warm);
}

.cu-usage__note {
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

.cu-meter {
  height: 8px;
  border-radius: var(--cu-r-pill);
  background: var(--cu-divider);
  overflow: hidden;
}

.cu-meter__fill {
  display: block;
  width: var(--cu-fill, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: var(--cu-r-pill);
  background: var(--cu-brand);
}

.cu-meter--soon .cu-meter__fill {
  background: var(--cu-warm);
}

/* Progress ring (inline SVG: track + arc, the arc length is an attribute, not a style). */
.cu-ring {
  flex: none;
  width: 60px;
  height: 60px;
}

.cu-ring__track {
  fill: none;
  stroke: var(--cu-divider);
}

.cu-ring__arc {
  fill: none;
  stroke: var(--cu-brand);
  stroke-linecap: round;
}

.cu-ring__text {
  fill: var(--cu-text);
  font-family: var(--cu-font);
  font-size: 15px;
  font-weight: 700;
}

.cu-ring--done .cu-ring__arc {
  stroke: var(--cu-ok-dot);
}

@media (max-width: 860px) {
  .cu-ring {
    width: 52px;
    height: 52px;
  }
}

/* Sparkline (inline SVG rendered on the server). */
.cu-spark {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cu-spark__svg {
  display: block;
  width: 100%;
  height: 70px;
}

.cu-spark__area {
  fill: var(--cu-brand);
  fill-opacity: 0.1;
}

.cu-spark__line {
  fill: none;
  stroke: var(--cu-brand);
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.cu-spark__dot {
  fill: var(--cu-brand);
  stroke: var(--cu-surface);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.cu-spark__meta {
  display: flex;
  justify-content: space-between;
  gap: var(--cu-s2);
  color: var(--cu-muted);
  font-size: var(--cu-fs-xs);
}

.cu-spark__total {
  color: var(--cu-ok);
  font-weight: 600;
}

@media (max-width: 860px) {
  .cu-spark__svg {
    height: 56px;
  }
}

/* ---------- Stat panel (label, big number, small "of Y", icon tile) ---------- */

.cu-stats {
  display: flex;
  flex-direction: column;
  padding: 8px 22px;
}

.cu-stats__row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--cu-divider);
  min-width: 0;
}

.cu-stats__row:last-child {
  border-bottom: 0;
}

.cu-stats__row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.cu-stats__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--cu-s2);
}

.cu-stats__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cu-stats__label {
  color: var(--cu-text-2);
  font-size: 0.875rem;
}

.cu-stats__value {
  color: var(--cu-text);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.5;
}

.cu-stats__value--xl {
  font-size: 1.875rem;
  letter-spacing: -0.5px;
}

.cu-stats__of {
  color: var(--cu-muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.cu-stats__value--xl .cu-stats__of {
  font-size: 0.9375rem;
}

.cu-stats__icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--cu-brand-soft);
  color: var(--cu-brand);
}

.cu-stats__icon--warm { background: var(--cu-warm-soft); color: var(--cu-warm); }
.cu-stats__icon--ok { background: var(--cu-ok-soft); color: var(--cu-ok); }

.cu-stats__hint {
  color: var(--cu-warm);
  font-size: var(--cu-fs-xs);
  font-weight: 600;
  white-space: nowrap;
}

.cu-stats__hint--ok {
  color: var(--cu-ok);
}

.cu-body .cu-stats a.cu-stats__row,
.cu-body .cu-stats a.cu-stats__row:hover {
  color: inherit;
  text-decoration: none;
}

/* Two small stat cards side by side (phones). */
.cu-minis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cu-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

/* ---------- Lists and tables ---------- */

/* A list of rows inside a flush card (latest conversations, sources). */
.cu-rowlist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cu-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--cu-divider-2);
  min-width: 0;
}

.cu-rowlist > li:last-child > .cu-row,
.cu-rowlist > .cu-row:last-child {
  border-bottom: 0;
}

.cu-body a.cu-row,
.cu-body a.cu-row:hover {
  color: inherit;
  text-decoration: none;
}

.cu-body a.cu-row:hover {
  background: var(--cu-surface-3);
}

.cu-row__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cu-row__title {
  overflow: hidden;
  font-size: var(--cu-fs-md);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cu-row__text {
  overflow: hidden;
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cu-row__side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.cu-row__time {
  color: var(--cu-muted);
  font-size: var(--cu-fs-xs);
}

.cu-row--warn {
  background: var(--cu-warm-wash);
}

@media (max-width: 860px) {
  .cu-row {
    gap: 12px;
    padding: 12px 16px;
  }
}

/* A data table that becomes stacked rows on phones. */
.cu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.cu-table th {
  padding: 10px 22px;
  background: var(--cu-surface-3);
  color: var(--cu-muted);
  font-size: var(--cu-fs-xs);
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}

.cu-table td {
  padding: 12px 22px;
  border-top: 1px solid var(--cu-divider-2);
  vertical-align: middle;
}

.cu-table td.cu-table__muted {
  color: var(--cu-muted);
}

@media (max-width: 680px) {
  .cu-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .cu-table tr {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--cu-divider-2);
  }

  .cu-table td {
    padding: 0;
    border-top: 0;
  }
}

/* Simple facts list (label and value on one line). */
.cu-facts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.cu-facts li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--cu-s3);
  padding: 12px 0;
  border-bottom: 1px solid var(--cu-divider);
}

.cu-facts li > span:first-child {
  color: var(--cu-text-2);
}

.cu-facts li:last-child {
  border-bottom: 0;
}

/* ---------- Page tabs (bot sections and similar) ---------- */

.cu-pagetabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--cu-line);
}

.cu-body .cu-pagetabs__item {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--cu-text-2);
  font-size: var(--cu-fs-md);
  font-weight: 500;
  text-decoration: none;
}

.cu-body .cu-pagetabs__item:hover {
  color: var(--cu-text);
  text-decoration: none;
}

.cu-body .cu-pagetabs__item[aria-current="page"] {
  border-bottom-color: var(--cu-brand);
  color: var(--cu-brand-ink);
  font-weight: 600;
}

/* ---------- Empty state ---------- */

.cu-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 22px;
  text-align: center;
}

.cu-blank__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--cu-brand-soft);
  color: var(--cu-brand);
}

.cu-blank__title {
  font-size: var(--cu-fs-md);
  font-weight: 700;
}

.cu-blank__text {
  max-width: 46ch;
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

/* ---------- Friendly message with tracking code ---------- */

.cu-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cu-s3) var(--cu-s4);
  padding: 14px 18px;
  border: 1px solid var(--cu-warm-line);
  border-radius: 14px;
  background: var(--cu-warm-soft);
  color: var(--cu-warm);
}

.cu-alert__text {
  flex: 1 1 280px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 72ch;
}

.cu-alert__title {
  font-size: var(--cu-fs-md);
  font-weight: 700;
}

.cu-alert__detail {
  color: #7C2D12;
  font-size: var(--cu-fs-sm);
}

.cu-alert__code {
  font-family: var(--cu-font);
  font-weight: 600;
  letter-spacing: 0.04em;
  unicode-bidi: isolate;
}

.cu-alert--warning {
  border-color: var(--cu-warm-line);
  background: var(--cu-warm-soft);
  color: var(--cu-warm);
}

.cu-alert--info {
  border-color: var(--cu-brand-line);
  background: var(--cu-brand-wash);
  color: var(--cu-brand-ink);
}

.cu-alert--info .cu-alert__detail {
  color: var(--cu-text-2);
}

.cu-alert--success {
  border-color: var(--cu-ok-line);
  background: var(--cu-ok-soft);
  color: var(--cu-ok);
}

.cu-alert--success .cu-alert__detail {
  color: #14532D;
}

.cu-alert ul {
  margin: 0;
  padding-inline-start: var(--cu-s5);
}

/* ---------- Home (D164): today card, widget preview, setup, latest conversations ---------- */

.cu-today {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  overflow: hidden;
}

.cu-today__main {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 28px;
}

.cu-today__title {
  margin: 0;
  font-size: var(--cu-fs-2xl);
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: -0.3px;
}

.cu-today__em {
  color: var(--cu-brand);
}

.cu-today__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

/* The one gradient of the design: the soft wash behind the widget preview. */
.cu-today__aside {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, #E9ECFF 0%, #F3EEFF 55%, #FFF1E8 100%);
}

@media (max-width: 860px) {
  .cu-today__main {
    padding: 18px;
    gap: 12px;
  }

  .cu-today__title {
    font-size: 1.1875rem;
    line-height: 1.65;
  }

  /* HomeMobile has no widget preview; the owner buttons live on the bot pages. */
  .cu-today__aside,
  .cu-head__actions {
    display: none;
  }

  .cu-today__actions .cu-btn {
    flex: 1 1 auto;
  }
}

/* Chat widget preview. */
.cu-widget {
  width: 100%;
  max-width: 330px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: var(--cu-surface);
  box-shadow: var(--cu-shadow-pop);
}

.cu-widget__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--cu-brand);
  color: #FFFFFF;
}

.cu-widget__logo {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--cu-r-pill);
  display: grid;
  place-items: center;
  background: #FFFFFF;
}

.cu-widget__who {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

.cu-widget__name {
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cu-widget__sub {
  font-size: 0.71875rem;
  opacity: 0.9;
}

.cu-widget__example {
  flex: none;
  padding: 1px 8px;
  border-radius: var(--cu-r-pill);
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  font-size: 0.71875rem;
  font-weight: 700;
}

.cu-widget__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #FAFAFC;
}

.cu-widget__msg {
  max-width: 88%;
  padding: 9px 12px;
  overflow-wrap: anywhere;
  color: var(--cu-text);
  font-size: var(--cu-fs-sm);
  line-height: 1.75;
}

.cu-widget__msg--visitor {
  align-self: flex-end;
  max-width: 80%;
  border-radius: 14px 14px 4px 14px;
  background: var(--cu-divider);
}

.cu-widget__msg--bot {
  align-self: flex-start;
  border: 1px solid var(--cu-line);
  border-radius: 14px 14px 14px 4px;
  background: var(--cu-surface);
}

[dir="ltr"] .cu-widget__msg--visitor {
  border-radius: 14px 14px 14px 4px;
}

[dir="ltr"] .cu-widget__msg--bot {
  border-radius: 14px 14px 4px 14px;
}

.cu-widget__source {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-r-pill);
  background: var(--cu-surface);
  color: var(--cu-text-2);
  font-size: 0.71875rem;
}

.cu-widget__input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--cu-divider);
  color: var(--cu-muted);
  font-size: 0.8125rem;
}

.cu-widget__input span:first-child {
  flex: 1 1 auto;
}

.cu-widget__send {
  width: 30px;
  height: 30px;
  border-radius: var(--cu-r-pill);
  display: grid;
  place-items: center;
  background: var(--cu-brand);
}

[dir="ltr"] .cu-widget__send svg {
  transform: scaleX(-1);
}

/* Setup card: ring + checklist. */
.cu-setup {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cu-setup__head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cu-setup__title {
  margin: 0;
  font-size: var(--cu-fs-lg);
  font-weight: 700;
  line-height: 1.6;
}

.cu-setup__sub {
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

.cu-setup__tiles {
  min-width: 0;
}

/* Step list: a numbered sequence (payment result) or the Home checklist with check marks. */
.cu-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cu-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: var(--cu-fs-md);
}

.cu-step__mark {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: var(--cu-r-pill);
  display: grid;
  place-items: center;
  background: var(--cu-surface);
  box-shadow: inset 0 0 0 1.5px var(--cu-line-strong);
  color: var(--cu-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.cu-step--done .cu-step__mark {
  background: var(--cu-ok-ring);
  box-shadow: none;
  color: var(--cu-ok);
}

.cu-step--current .cu-step__mark {
  box-shadow: inset 0 0 0 2px var(--cu-brand);
  color: var(--cu-brand);
}

.cu-step__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cu-step__title {
  font-size: var(--cu-fs-md);
  font-weight: 600;
}

.cu-step--done .cu-step__title {
  color: var(--cu-muted);
  font-weight: 500;
}

.cu-step--upcoming .cu-step__title {
  color: var(--cu-text-2);
  font-weight: 500;
}

.cu-step__detail {
  color: var(--cu-muted);
  font-size: var(--cu-fs-xs);
}

.cu-step--current {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--cu-brand-line);
  border-radius: 12px;
  background: var(--cu-brand-wash);
}

.cu-card.cu-steps,
.cu-stack > .cu-steps {
  flex: none;
}

@media (max-width: 480px) {
  .cu-step {
    flex-wrap: wrap;
  }

  .cu-step .cu-btn {
    width: 100%;
  }
}

/* Latest conversations: letter avatar, name, one-line preview, time and state. */
.cu-recent .cu-row__text bdi {
  unicode-bidi: isolate;
}

/* ---------- Quiet figures (older pages) ---------- */

.cu-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin: 0;
  background: var(--cu-surface);
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-r-xl);
  box-shadow: var(--cu-shadow);
}

.cu-figure {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 22px;
  border-inline-start: 1px solid var(--cu-divider);
  min-width: 0;
}

.cu-figure:first-child {
  border-inline-start: 0;
}

.cu-figure__label {
  color: var(--cu-text-2);
  font-size: 0.875rem;
}

.cu-figure__value {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.5;
}

.cu-figure .cu-usage__bar {
  height: 6px;
}

@media (max-width: 680px) {
  .cu-figure {
    border-inline-start: 0;
    border-top: 1px solid var(--cu-divider);
  }

  .cu-figure:first-child {
    border-top: 0;
  }
}

/* ---------- Knowledge tiles (one tile per source; kept for the pages that still use them) ---------- */

.cu-tiles {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s3);
  margin: 0;
  min-width: 0;
}

.cu-tiles__grid {
  display: grid;
  grid-template-columns: repeat(var(--cu-tile-cols, 10), minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cu-tiles--compact .cu-tiles__grid {
  --cu-tile-cols: 7;
  gap: 5px;
}

.cu-tile {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: var(--cu-r-sm);
  background: var(--cu-surface);
  box-shadow: inset 0 0 0 1px var(--cu-empty-edge);
}

.cu-tiles--compact .cu-tile {
  border-radius: 5px;
}

.cu-tile--learned { background: var(--cu-ok-dot); box-shadow: none; }
.cu-tile--working { background: #B8BECC; box-shadow: none; }
.cu-tile--waiting { background: var(--cu-waiting); box-shadow: none; }
.cu-tile--failed { background: var(--cu-warm); box-shadow: none; }

.cu-tiles__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cu-s3) var(--cu-s5);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--cu-text-2);
  font-size: var(--cu-fs-xs);
}

.cu-tiles__legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cu-tiles__legend .cu-tile {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.cu-tiles__caption {
  color: var(--cu-text-2);
  font-size: var(--cu-fs-sm);
}

.cu-tiles__more {
  color: var(--cu-muted);
  font-size: var(--cu-fs-xs);
}

@media (max-width: 480px) {
  .cu-tiles__grid {
    --cu-tile-cols: 8;
  }
}

/* ---------- Billing pages (U3: Plan & Usage, order page, next term, purchase) ---------- */

.cu-plan {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cu-plan__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--cu-s5);
}

.cu-plan__text {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s1);
  min-width: 0;
}

.cu-plan__name {
  font-size: var(--cu-fs-3xl);
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: -0.4px;
}

.cu-plan__left {
  color: var(--cu-text-2);
  font-size: var(--cu-fs-md);
  font-weight: 600;
}

.cu-plan__left--soon {
  color: var(--cu-warm);
}

.cu-plan__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cu-plan__note {
  color: var(--cu-text-2);
  font-size: var(--cu-fs-sm);
}

.cu-usage-list {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s5);
}

.cu-topup {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s4);
  background: var(--cu-warm-wash);
  border-color: var(--cu-warm-line);
}

.cu-topup__detail {
  color: #7C2D12;
  font-size: var(--cu-fs-md);
}

.cu-packs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cu-s3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cu-packs > li {
  flex: 1 1 180px;
  display: flex;
}

.cu-body .cu-pack,
.cu-page .cu-pack {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  padding: 14px 16px;
  border: 1px solid var(--cu-line);
  border-radius: 12px;
  background: var(--cu-surface);
  box-shadow: var(--cu-shadow);
  color: var(--cu-text);
  text-decoration: none;
}

.cu-body .cu-pack:hover,
.cu-page .cu-pack:hover {
  border-color: var(--cu-brand);
  color: var(--cu-text);
  text-decoration: none;
}

.cu-pack__size {
  font-size: var(--cu-fs-lg);
  font-weight: 700;
}

.cu-pack .cu-money {
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

.cu-pack__buy {
  color: var(--cu-brand);
  font-size: var(--cu-fs-sm);
  font-weight: 600;
}

.cu-payments {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s2);
}

.cu-payments__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cu-payment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cu-s2) var(--cu-s4);
  padding: 13px var(--cu-s1);
  border-bottom: 1px solid var(--cu-divider-2);
  font-size: 0.875rem;
}

.cu-payment__no {
  min-width: 90px;
  color: var(--cu-muted);
  font-family: var(--cu-font);
  unicode-bidi: isolate;
}

.cu-payment__what {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--cu-s2);
}

.cu-payment__date {
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

.cu-payment__amount {
  min-width: 150px;
}

.cu-payment__state {
  min-width: 110px;
  font-weight: 600;
}

.cu-payment__state--ok {
  color: var(--cu-ok);
}

.cu-payment__state--wait {
  color: var(--cu-warm);
}

.cu-payment__state--muted {
  color: var(--cu-muted);
}

.cu-payment__ref {
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

.cu-payment__ref bdi {
  unicode-bidi: isolate;
}

.cu-payment__link {
  font-size: var(--cu-fs-sm);
}

/* Pricing: term-length links (no script) and the plan cards. */
.cu-segment {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--cu-line);
  border-radius: 12px;
  background: var(--cu-surface);
}

.cu-body .cu-segment__item,
.cu-page .cu-segment__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 4px 14px;
  border-radius: var(--cu-r-md);
  color: var(--cu-text-2);
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
}

.cu-body .cu-segment__item:hover,
.cu-page .cu-segment__item:hover {
  background: var(--cu-neutral-soft);
  color: var(--cu-text);
  text-decoration: none;
}

.cu-body .cu-segment__item[aria-current="page"],
.cu-page .cu-segment__item[aria-current="page"] {
  background: var(--cu-brand-soft);
  color: var(--cu-brand-ink);
  font-weight: 600;
}

.cu-segment__note {
  font-size: var(--cu-fs-xs);
  font-weight: 500;
}

.cu-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--cu-s4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cu-plan-card {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s3);
  padding: 22px;
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-r-xl);
  background: var(--cu-surface);
  box-shadow: var(--cu-shadow);
}

.cu-plan-card--current {
  border-color: var(--cu-brand);
  box-shadow: 0 0 0 1px var(--cu-brand), var(--cu-shadow);
}

.cu-plan-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cu-s2);
}

.cu-plan-card__price {
  font-size: var(--cu-fs-2xl);
  font-weight: 800;
  line-height: 1.4;
}

.cu-plan-card__limits {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s2);
  margin: 0;
  padding: var(--cu-s3) 0 0;
  border-top: 1px solid var(--cu-divider);
  list-style: none;
  color: var(--cu-text-2);
  font-size: 0.875rem;
}

.cu-plan-card__action {
  margin-top: auto;
}

/* A choice list (plan for the next term, payment method): real radio buttons, the whole row is the target. */
.cu-choices {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s3);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.cu-choices__legend {
  margin-bottom: var(--cu-s2);
  padding: 0;
  font-size: var(--cu-fs-lg);
  font-weight: 700;
}

.cu-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cu-s2) var(--cu-s3);
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--cu-line-strong);
  border-radius: 12px;
  background: var(--cu-surface);
  cursor: pointer;
}

.cu-choice:hover {
  border-color: #C9CEDB;
}

.cu-choice:has(input:checked) {
  border-color: var(--cu-brand);
  background: var(--cu-brand-wash);
  box-shadow: 0 0 0 1px var(--cu-brand);
}

.cu-choice input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--cu-brand);
}

.cu-choice__text {
  flex: 1 1 160px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cu-choice__title {
  font-weight: 600;
}

.cu-choice__detail {
  color: var(--cu-muted);
  font-size: var(--cu-fs-sm);
}

.cu-choice__price {
  font-weight: 700;
}

.cu-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--cu-s3);
  padding-top: var(--cu-s4);
  border-top: 1px solid var(--cu-divider);
  font-size: var(--cu-fs-lg);
  font-weight: 700;
}

.cu-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Cart lines and simple forms (cart, card-to-card). */
.cu-cart {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cu-cart__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cu-s3) var(--cu-s4);
  padding: var(--cu-s3) 0;
  border-bottom: 1px solid var(--cu-divider);
}

.cu-cart__text {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cu-cart__warn {
  color: var(--cu-warm);
  font-size: var(--cu-fs-sm);
}

.cu-cart__amount {
  font-weight: 600;
}

.cu-cart select,
.cu-cart input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--cu-line-strong);
  border-radius: var(--cu-r-lg);
  background: var(--cu-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  color: var(--cu-text);
  font: inherit;
}

.cu-manual__amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.cu-manual__card {
  font-size: var(--cu-fs-lg);
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  unicode-bidi: isolate;
}

@media (max-width: 480px) {
  .cu-plan__name {
    font-size: var(--cu-fs-2xl);
  }

  .cu-plan__actions,
  .cu-plan__actions .cu-btn,
  .cu-form-actions .cu-btn {
    width: 100%;
  }

  .cu-payment__amount,
  .cu-payment__state,
  .cu-payment__no {
    min-width: 0;
  }
}

/* ---------- Sign-in pages (_CustomerAuthLayout): one card on the ground colour ---------- */

.cu-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--cu-s6) var(--cu-s4) var(--cu-s8);
  gap: var(--cu-s6);
}

.cu-auth__top {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--cu-s3);
}

.cu-body .cu-auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cu-text);
  font-size: 1.1875rem;
  font-weight: 800;
  text-decoration: none;
}

.cu-lang {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--cu-line);
  border-radius: 10px;
  background: var(--cu-surface);
}

.cu-lang__btn {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--cu-text-2);
  font: inherit;
  font-size: var(--cu-fs-sm);
  cursor: pointer;
}

.cu-lang__btn[aria-pressed="true"] {
  background: var(--cu-brand-soft);
  color: var(--cu-brand-ink);
  font-weight: 600;
}

.cu-auth__main {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: var(--cu-s4);
}

.cu-auth__main:focus {
  outline: none;
}

.cu-auth-card {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s5);
  padding: var(--cu-s8);
  border: 1px solid var(--cu-line);
  border-radius: var(--cu-r-xl);
  background: var(--cu-surface);
  box-shadow: var(--cu-shadow);
}

.cu-auth-card .cu-h1 {
  font-size: var(--cu-fs-2xl);
}

.cu-auth-card__links {
  margin: 0;
  padding: var(--cu-s4) 0 0;
  border-top: 1px solid var(--cu-divider);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--cu-s2);
  color: var(--cu-text-2);
  font-size: var(--cu-fs-sm);
}

.cu-auth .cu-foot {
  width: 100%;
  max-width: 480px;
  margin-top: auto;
  justify-content: center;
}

@media (max-width: 480px) {
  .cu-auth-card {
    padding: var(--cu-s6) var(--cu-s4);
  }
}

/* ---------- Forms ---------- */

.cu-form {
  display: flex;
  flex-direction: column;
  gap: var(--cu-s4);
  margin: 0;
}

.cu-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 560px;
}

.cu-field label,
.cu-label {
  color: var(--cu-text-2);
  font-size: var(--cu-fs-sm);
  font-weight: 600;
}

.cu-input,
.cu-field input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--cu-line-strong);
  border-radius: var(--cu-r-lg);
  background: var(--cu-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  color: var(--cu-text);
  font: inherit;
  font-size: 0.875rem;
}

.cu-input:hover,
.cu-field input:not([type="checkbox"]):not([type="radio"]):hover {
  border-color: #C9CEDB;
}

.cu-input:focus-visible,
.cu-field input:not([type="checkbox"]):not([type="radio"]):focus-visible {
  border-color: var(--cu-brand);
  border-radius: var(--cu-r-lg);
  box-shadow: 0 0 0 3px var(--cu-brand-soft);
}

.cu-input[aria-invalid="true"],
.cu-field input[aria-invalid="true"] {
  border-color: var(--cu-warm);
}

.cu-field__hint,
.cu-field__help {
  color: var(--cu-muted);
  font-size: var(--cu-fs-xs);
}

.cu-field__error,
.cu-form__summary {
  color: var(--cu-warm);
  font-size: var(--cu-fs-sm);
}

.cu-field__error:empty,
.cu-form__summary:empty {
  display: none;
}

.cu-password {
  position: relative;
  display: flex;
  /* The input is dir="ltr" (passwords are typed left to right), so its padding-inline-end is on the right. The
     wrapper is LTR too, so the toggle sits on the same right side on a Persian page and typed text never runs
     under it. The toggle's own label keeps its natural direction. */
  direction: ltr;
}

.cu-password .cu-input {
  padding-inline-end: 84px;
}

.cu-password__toggle {
  position: absolute;
  inset-block: 4px;
  inset-inline-end: 4px;
  min-width: 72px;
  border: 0;
  border-radius: 7px;
  background: var(--cu-brand-soft);
  color: var(--cu-brand);
  font: inherit;
  font-size: var(--cu-fs-sm);
  font-weight: 600;
  unicode-bidi: plaintext;
  cursor: pointer;
}

.cu-check {
  display: flex;
  align-items: flex-start;
  gap: var(--cu-s2);
  font-size: var(--cu-fs-md);
}

.cu-check__input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 5px 0 0;
  accent-color: var(--cu-brand);
}

.cu-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cu-s3);
}

.cu-rules {
  margin: 0;
  padding-inline-start: var(--cu-s5);
  color: var(--cu-text-2);
  font-size: var(--cu-fs-sm);
}

/* ---------- Motion ---------- */

.cu-body a,
.cu-body button,
.cu-page a,
.cu-page button {
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .cu-body *,
  .cu-page *,
  .cu-body *::before,
  .cu-body *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Layout helpers ---------- */

.cu-span-3 {
  grid-column: 1 / -1;
}

@media (min-width: 861px) {
  .cu-only-phone {
    display: none !important;
  }
}

@media (max-width: 860px) {
  .cu-only-wide {
    display: none !important;
  }
}

/* File inputs (customer-shell.js): a Persian button and the chosen file name replace the browser's own text. */
.cu-filepick {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-inline-size: 100%;
}

.cu-filepick__native {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  overflow: hidden;
}

.cu-filepick__btn {
  display: inline-flex;
  align-items: center;
  min-block-size: 40px;
  padding-inline: 16px;
  border: 1px solid var(--cu-line-strong);
  border-radius: 10px;
  background: var(--cu-surface);
  color: var(--cu-text);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

.cu-filepick__btn:hover {
  background: var(--cu-neutral-soft);
}

.cu-filepick:focus-within .cu-filepick__btn,
.cu-drop:focus-within .cu-drop__label {
  outline: 2px solid var(--cu-brand);
  outline-offset: 2px;
}

.cu-filepick__name {
  font-size: 13.5px;
  color: var(--cu-muted);
  overflow-wrap: anywhere;
}
