/* =====================================================================
   Omni client app — the app layer on top of the Aurora kit (docs/UI_GUIDE.md §0.4).
   Load order: fonts.css → aurora.css → site.css. This file comes AFTER the kit because it holds:
     1. the older token names (--accent, --surface, --badge-*…) as aliases of the kit's tokens, so every older
        component class — including markup the page scripts build — follows the kit palette in light and dark;
     2. the brand calibration: the only kit tokens this app overrides (the navy brand, and the calm look);
     3. the app's own components and screen styles, written with tokens only.
   Raw colours appear only in sections 1–2 and for third-party brand marks (WhatsApp, channel logos).
   Never restyle an au-* class here; add an app class instead.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Tokens: older names → kit tokens
   --------------------------------------------------------------------- */

:root {
  --accent: var(--au-primary);
  --accent-hover: var(--au-primary-dark);
  --accent-soft: color-mix(in srgb, var(--au-primary) 12%, var(--au-paper));
  --accent-contrast: var(--au-on-primary);
  --selected: var(--au-primary);
  --selected-contrast: var(--au-on-primary);

  --bg: var(--au-bg);
  --surface: var(--au-paper);
  --surface-subtle: var(--au-table-head-bg);
  --border: var(--au-divider);
  --border-strong: var(--au-input-border);

  /* --text-subtle is the kit's secondary text, not its faint grey: the faint grey is below AA for text. */
  --text: var(--au-text);
  --text-muted: var(--au-text-2);
  --text-subtle: var(--au-text-2);

  /* Status tones. Text uses the deeper shade in light mode (AA on its tint) and the bright one in dark mode. */
  --tone-success: var(--au-success-dark);
  --tone-warning: var(--au-warning-dark);
  --tone-error: var(--au-error-dark);
  --tone-info: var(--au-info-dark);
  --tone-accent: var(--au-primary-dark);
  --tone-violet: #6d28d9;
  --violet: #7c3aed;

  --badge-gray-bg: color-mix(in srgb, var(--au-text) 7%, var(--au-paper));
  --badge-gray-text: var(--au-text-2);
  --badge-blue-bg: color-mix(in srgb, var(--au-info) 12%, var(--au-paper));
  --badge-blue-text: var(--tone-info);
  --badge-amber-bg: color-mix(in srgb, var(--au-warning) 14%, var(--au-paper));
  --badge-amber-text: var(--tone-warning);
  --badge-green-bg: color-mix(in srgb, var(--au-success) 13%, var(--au-paper));
  --badge-green-text: var(--tone-success);
  --badge-red-bg: color-mix(in srgb, var(--au-error) 11%, var(--au-paper));
  --badge-red-text: var(--tone-error);
  --badge-purple-bg: color-mix(in srgb, var(--violet) 11%, var(--au-paper));
  --badge-purple-text: var(--tone-violet);
  --badge-teal-bg: color-mix(in srgb, var(--au-primary) 12%, var(--au-paper));
  --badge-teal-text: var(--tone-accent);
  --alert-warning-border: color-mix(in srgb, var(--au-warning) 35%, transparent);
  --alert-info-border: color-mix(in srgb, var(--au-info) 30%, transparent);

  /* Who wrote a message: AI (violet) vs members from the WhatsApp phone app (amber) */
  --ai: var(--tone-violet);
  --ai-soft: color-mix(in srgb, var(--violet) 9%, var(--au-paper));
  --human: var(--tone-warning);
  --human-soft: color-mix(in srgb, var(--au-warning) 11%, var(--au-paper));
  --tick-read: #34b7f1; /* WhatsApp's "read" blue */

  --font: var(--au-font-sans);
  --radius: var(--au-r-card);
  --radius-sm: var(--au-r-sm);
  --radius-pill: 999px;
  --shadow-sm: var(--au-shadow-paper);
  --shadow: var(--au-shadow-paper);
  --shadow-md: var(--au-shadow-pop);
  --overlay: var(--au-backdrop);
  --focus-ring: var(--au-focus-ring);
}

:root[data-theme='dark'] {
  --tone-success: var(--au-success);
  --tone-warning: var(--au-warning);
  --tone-error: var(--au-error);
  --tone-info: var(--au-info);
  --tone-accent: var(--au-primary);
  --tone-violet: #c4b5fd;
  --violet: #a78bfa;
}

/* ---------------------------------------------------------------------
   2. Brand calibration (the only kit tokens overridden here)
   Navy brand (data-brand="navy" on <html>), AA throughout:
   - Fills (buttons, switches, avatars, step numbers, sent bubbles: --au-gradient) are the same navy in light and dark,
     white text on them (≥ 8.7:1). --au-primary is the shade that reads as text: navy on white (8.7:1), light blue on
     the dark paper.
   - The sidebar is navy in light mode; dark mode keeps the kit's dark sidebar.
   - Headline tiles (.stat-accent) are a soft sky-blue highlight (--highlight-*), not a navy fill.
   Calm: no ambient glow, no glow under buttons, no panel sheen, softer corners.
   --------------------------------------------------------------------- */

:root[data-brand='navy'] {
  --au-primary: #1e40af;
  --au-primary-dark: #1e3a8a;
  --au-primary-light: #60a5fa;
  --au-on-primary: #ffffff;
  --au-secondary: #0ea5e9;
  --au-secondary-light: #7dd3fc;
  --au-secondary-dark: #0369a1;
  --au-gradient: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  --au-gradient-soft: linear-gradient(135deg, rgba(30, 64, 175, 0.08), rgba(56, 189, 248, 0.06));
  --au-brand-glow: transparent;
  --au-brand-glow-strong: transparent;
  --au-focus-ring: 0 0 0 3px rgba(30, 64, 175, 0.22);

  --highlight-bg: color-mix(in srgb, #38bdf8 24%, var(--au-paper));
  --highlight-text: #075985;
  --highlight-border: color-mix(in srgb, #0ea5e9 45%, transparent);
}
:root[data-brand='navy']:not([data-theme='dark']) {
  --au-side-bg: linear-gradient(180deg, #1e3a8a 0%, #172554 100%);
  --au-side-bg-solid: #1e3a8a;
  --au-side-hover: rgba(255, 255, 255, 0.1);
  --au-side-text: rgba(255, 255, 255, 0.9);
  --au-side-text-strong: #ffffff;
  --au-side-section: #93c5fd;
  --au-side-active-bg: rgba(255, 255, 255, 0.18);
  --au-side-active-text: #ffffff;
  --au-side-active-icon: #ffffff;
  --au-side-active-bar: linear-gradient(#ffffff, #ffffff);
  --au-side-border: rgba(255, 255, 255, 0.16);
  --au-side-scroll-thumb: rgba(255, 255, 255, 0.3);
}
:root[data-brand='navy'][data-theme='dark'] {
  --au-primary: #93c5fd;
  --au-primary-dark: #60a5fa;
  --au-primary-light: #bfdbfe;
  --au-secondary: #38bdf8;
  --au-secondary-light: #7dd3fc;
  --au-secondary-dark: #0ea5e9;
  --au-gradient-soft: linear-gradient(135deg, rgba(147, 197, 253, 0.14), rgba(125, 211, 252, 0.1));
  --au-focus-ring: 0 0 0 3px rgba(147, 197, 253, 0.26);
  --au-side-active-bg: linear-gradient(calc(90deg * var(--au-x)), rgba(30, 64, 175, 0.45) 0%, rgba(30, 64, 175, 0.12) 100%);
  --au-side-active-text: #ffffff;
  --au-side-active-icon: #93c5fd;
  --au-side-active-bar: linear-gradient(#93c5fd, #93c5fd);

  --highlight-bg: color-mix(in srgb, #38bdf8 20%, var(--au-paper));
  --highlight-text: #7dd3fc;
  --highlight-border: color-mix(in srgb, #38bdf8 40%, transparent);
}
:root,
:root[data-theme='dark'] {
  --au-aurora: none;
  --au-sheen: none;
  --au-r-panel: 18px;
}

/* ---------------------------------------------------------------------
   3. Base
   --------------------------------------------------------------------- */

/* An element's own display:flex/grid rule otherwise beats the browser's [hidden] rule; the page scripts toggle
   `hidden` on such elements everywhere (e.g. .inbox-thread-inner), so this one stays. */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------------
   4. Shell extras (the shell itself is the kit: _Layout, _Sidebar, _Header)
   --------------------------------------------------------------------- */

.au-brand__logo { display: block; width: 38px; height: 38px; border-radius: 11px; }

/* The header stays one row on phones (the kit wraps it for the admin's scope selector, which this app doesn't have) */
@media (max-width: 899.98px) {
  .au-header__bar.header-bar { flex-wrap: nowrap; gap: 8px; padding-inline: 12px; }
  .header-bar .au-header__title-wrap { flex: 1; min-width: 0; }
  .header-bar .au-header__tools { flex-shrink: 0; gap: 6px; }
}

/* Language menu and theme toggle in the corner of the pages without the shell (_AuthLayout) */
.au-auth-tools { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 5; display: flex; gap: 8px; align-items: flex-start; }
.au-auth-lang > summary { list-style: none; cursor: pointer; }
.au-auth-lang > summary::-webkit-details-marker { display: none; }

/* Language choices (_LanguageChoices) in the user menu and the sign-in pages' language menu */
.lang-choices .au-menu__item[aria-current="true"] { font-weight: 600; }

/* Unread count on the Inbox row; sidebar.js / inbox.js fill #sidebar-inbox-badge. */
.au-nav-count {
  position: absolute;
  top: 50%;
  inset-inline-end: 10px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--au-side-active-icon);
  color: var(--au-side-bg-solid);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transform: translateY(-50%);
}
@media (min-width: 900px) {
  html.au-side-collapsed .au-nav-count {
    top: 2px;
    inset-inline-end: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.6rem;
    line-height: 16px;
    transform: none;
  }
}

/* The plan's level on a sidebar row (Reports: Basic or Advanced); hidden while the sidebar is collapsed to icons. */
.au-nav-tag {
  margin-inline-start: auto;
  padding: 0 7px;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 16px;
  opacity: 0.7;
}
@media (min-width: 900px) {
  html.au-side-collapsed .au-nav-tag { display: none; }
}

/* Notification bell (notifications.js toggles `hidden` and renders the rows) */
.notif-bell-wrap { position: relative; }
.notif-bell { position: relative; }
.notif-bell-badge {
  position: absolute;
  top: -5px;
  inset-inline-end: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--au-error);
  color: var(--au-on-error);
  box-shadow: 0 0 0 2px var(--au-paper);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 50;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: 440px;
  overflow-y: auto;
  background: var(--au-paper);
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-md);
  box-shadow: var(--au-shadow-pop);
}
.notif-dropdown-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--au-divider);
  background: var(--au-paper);
  font-weight: 700;
}
.notif-mark-all {
  padding: 4px 8px;
  border: 0;
  border-radius: var(--au-r-xs);
  background: none;
  color: var(--au-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.notif-mark-all:hover { background: var(--au-hover); }
.notif-empty { padding: 24px 14px; color: var(--au-text-2); font-size: 0.8125rem; text-align: center; }
.notif-row { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--au-divider); cursor: pointer; }
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--au-hover); }
.notif-row.unread { background: color-mix(in srgb, var(--au-primary) 7%, var(--au-paper)); }
.notif-row.unread:hover { background: color-mix(in srgb, var(--au-primary) 11%, var(--au-paper)); }
.notif-row-icon { flex-shrink: 0; font-size: 1rem; line-height: 1.4; }
.notif-row-main { min-width: 0; }
.notif-row-title { font-size: 0.8125rem; font-weight: 650; }
.notif-row-message { margin-top: 2px; color: var(--au-text-2); font-size: 0.78rem; overflow-wrap: break-word; }
.notif-row-time { margin-top: 4px; color: var(--au-text-2); font-size: 0.72rem; }
@media (max-width: 899.98px) {
  .notif-dropdown {
    position: fixed;
    top: calc(var(--au-header-h) + 4px);
    inset-inline-end: 12px;
    inset-inline-start: 12px;
    width: auto;
    max-width: none;
  }
}

/* ---------------------------------------------------------------------
   5. Shared components (older class names, restyled to match the kit)
   --------------------------------------------------------------------- */

/* Small uppercase label above a value or a group */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Layout helpers (small utilities pages use instead of inline style="" attributes) */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.35rem; }
.gap-2 { gap: 0.6rem; }
.gap-3 { gap: 0.9rem; }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.text-md { font-size: 0.875rem; }
.fw-normal { font-weight: 400; }
.w-auto { width: auto; }
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.9rem; }
.mt-3 { margin-top: 1.25rem; }
.mt-4 { margin-top: 1.75rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.9rem; }
.mb-3 { margin-bottom: 1.25rem; }
.p-5 { padding: 1.25rem; }
.mw-480 { max-width: 480px; }
.mw-640 { max-width: 640px; }
.mw-720 { max-width: 720px; }
.min-w-0 { min-width: 0; }
.break-all { word-break: break-all; }
.break-word { word-break: break-word; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; }

/* Buttons — same sizes and tones as .au-btn (default = outlined neutral) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--au-input-border);
  border-radius: var(--au-r-sm);
  background: var(--au-paper);
  color: var(--au-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, filter 0.18s ease;
}
.btn:hover {
  border-color: var(--au-input-border-hover);
  background: color-mix(in srgb, var(--au-text) 4%, var(--au-paper));
  text-decoration: none;
}
.btn .au-icon { font-size: 18px; margin-inline: -2px; }
.btn-primary {
  border-color: transparent;
  background-color: var(--au-primary);
  background-image: var(--au-gradient);
  color: var(--au-on-primary);
}
.btn-primary:hover { border-color: transparent; background-color: var(--au-primary); filter: brightness(1.07); }
/* Quiet button: no border until hovered (secondary actions in toolbars) */
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { border-color: transparent; background: var(--au-hover); color: var(--text); }
.btn-danger { border-color: color-mix(in srgb, var(--au-error) 50%, transparent); color: var(--tone-error); }
.btn-danger:hover { border-color: var(--au-error); background: color-mix(in srgb, var(--au-error) 8%, var(--au-paper)); }
.btn-danger-text { color: var(--tone-error) !important; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 0.8125rem; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn:focus-visible { outline: none; box-shadow: var(--au-focus-ring); }
@media (max-width: 640px) {
  .btn, .btn-sm { min-height: 40px; }
}

.link, .data-table td a.link { color: var(--au-primary); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link-btn { padding: 0; border: none; background: none; font: inherit; font-weight: 600; color: var(--au-primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--text-muted); font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--text); }

/* Cards and tables */
.card {
  background: var(--au-paper);
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-card);
  box-shadow: var(--au-shadow-paper);
}

.table-card {
  background: var(--au-paper);
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-card);
  box-shadow: var(--au-shadow-paper);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  white-space: nowrap;
}
.data-table th {
  padding: 10px 16px;
  text-align: start;
  background: var(--au-table-head-bg);
  border-bottom: 1px solid var(--au-divider);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--au-divider); color: var(--text); }
.data-table td a { color: var(--text); font-weight: 600; text-decoration: none; }
.data-table td a:hover { color: var(--au-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--au-hover); }
.data-table tr.row-link { cursor: pointer; }
.empty-row td { padding: 3rem 1rem; color: var(--text-muted); text-align: center; white-space: normal; }

/* Status badges — StatusBadgeHelper (server) and the page scripts (inbox, calendar, templates, benchmark) pick the
   colour class; the label comes from FilterLabelHelper. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--au-r-xs);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  text-transform: capitalize;
  vertical-align: middle;
}
/* Labels arrive translated and already capitalized; Title Case only suits English ("Par L’équipe" in French). */
html:not([lang='en']) .badge { text-transform: none; }
.badge-gray   { background: var(--badge-gray-bg);   color: var(--badge-gray-text); }
.badge-blue   { background: var(--badge-blue-bg);   color: var(--badge-blue-text); }
.badge-amber  { background: var(--badge-amber-bg);  color: var(--badge-amber-text); }
.badge-green  { background: var(--badge-green-bg);  color: var(--badge-green-text); }
.badge-red    { background: var(--badge-red-bg);    color: var(--badge-red-text); }
.badge-purple { background: var(--badge-purple-bg); color: var(--badge-purple-text); }
.badge-teal   { background: var(--badge-teal-bg);   color: var(--badge-teal-text); }

/* Coloured dots (status pills, quality, health) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-green { background: var(--au-success); }
.dot-red { background: var(--au-error); }
.dot-gray { background: var(--au-input-border-hover); }
.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.health-dot.badge-green { background: var(--au-success); }
.health-dot.badge-amber { background: var(--au-warning); }
.health-dot.badge-red { background: var(--au-error); }
.health-dot.badge-gray { background: var(--au-input-border-hover); }
.q-dot { display: inline-block; width: 8px; height: 8px; margin-inline-end: 0.35rem; border-radius: 50%; vertical-align: middle; }
.q-green { background: var(--au-success); }
.q-yellow { background: var(--au-warning); }
.q-red { background: var(--au-error); }
.status-pill { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; font-weight: 650; white-space: nowrap; }

/* Forms — same size as .au-input (16px text, so phones don't zoom) */
.text-input,
.select {
  min-height: 40px;
  padding: 7.5px 14px;
  border: 1px solid var(--au-input-border);
  border-radius: var(--au-r-sm);
  background-color: var(--au-input-bg);
  color: var(--au-text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color var(--au-t) ease, box-shadow var(--au-t) ease;
}
.text-input { width: 100%; }
textarea.text-input { min-height: 0; }
.text-input::placeholder { color: var(--au-text-3); }
.text-input:hover, .select:hover { border-color: var(--au-input-border-hover); }
.text-input[readonly], .text-input:disabled {
  background: var(--au-disabled-bg);
  color: var(--text-muted);
  cursor: not-allowed;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 36px;
  background-image: var(--au-select-chevron);
  background-repeat: no-repeat;
  background-position: right 10px center; /* rtl-ok: mirrored under [dir='rtl'] below */
  background-size: 20px;
  cursor: pointer;
}
[dir='rtl'] .select { background-position: left 10px center; } /* rtl-ok: background-position has no logical keywords */
.select option { background: var(--au-paper); color: var(--au-text); }
.text-input:focus, .select:focus-visible {
  outline: none;
  border-color: var(--au-primary);
  box-shadow: var(--au-focus-ring);
}

/* A labelled field: <label class="field"><span>Label</span><input …></label> */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 400; }
.field span { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.field > span.flex { width: 100%; }
.integration-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; gap: 0.75rem; }
.form-row-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.form-row-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem 1rem; }
.opt { margin-inline-start: 0.3rem; font-size: 0.8em; font-style: normal; font-weight: 400; color: var(--text-subtle); }
.counter { display: block; text-align: end; }
.hint-line { font-size: 0.75rem; color: var(--text-subtle); }
.hint-line.right { text-align: end; }
.input-error { border-color: var(--au-error) !important; }
.input-error:focus { box-shadow: var(--au-focus-ring-error); }
.field-err { color: var(--tone-error); font-size: 0.8125rem; }
.field-ok { color: var(--tone-success); font-size: 0.8125rem; }
.connect-error { color: var(--tone-error) !important; }
@media (max-width: 480px) { .form-row { flex-direction: column; } }
@media (max-width: 700px) { .form-row-2, .form-row-even { grid-template-columns: 1fr; } }

/* Switch: <label class="switch-row"><input class="switch-input" type="checkbox"><span class="switch"></span> Label</label> */
.switch-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.switch-input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--au-input-border-hover);
  transition: background var(--au-t) ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: inset-inline-start var(--au-t) ease;
}
.switch-input:checked + .switch { background-color: var(--au-primary); background-image: var(--au-gradient); }
.switch-input:checked + .switch::after { inset-inline-start: 18px; }
.switch-input:focus-visible + .switch { box-shadow: var(--au-focus-ring); }
.switch-input:disabled + .switch { opacity: 0.45; cursor: not-allowed; }

/* Segmented control made of radios (Send now / Schedule, Client time / My time) or buttons (Closed / Custom hours) */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--au-r-sm);
  background: var(--au-segment-bg);
}
.seg-opt { position: relative; font-weight: 600; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span,
.seg > button {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: var(--au-r-xs);
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.seg-opt.on span,
.seg-opt:has(input:checked) span,
.seg > button.on {
  background: var(--au-segment-selected);
  box-shadow: var(--au-segment-shadow);
  color: var(--au-text);
}
.seg-opt:focus-within span { box-shadow: var(--au-focus-ring); }

/* Pill filters / tabs above a list (Inbox, Campaigns, Templates, Health, Website pages) */
.inbox-filters { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.inbox-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.3rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.inbox-filter:hover { background: var(--au-hover); color: var(--text); }
.inbox-filter.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--au-primary) 30%, transparent); color: var(--tone-accent); }
.inbox-filter-count { font-size: 0.72rem; opacity: 0.75; font-variant-numeric: tabular-nums; }

/* Alerts built by the server and by page scripts (alert-info / alert-warning) */
.alert {
  padding: 12px 16px;
  border: 1px solid;
  border-inline-start-width: 4px;
  border-radius: var(--au-r-md);
  color: var(--au-text);
  font-size: 0.875rem;
  line-height: 1.5;
}
.alert-warning { background: color-mix(in srgb, var(--au-warning) 9%, var(--au-paper)); border-color: var(--alert-warning-border); border-inline-start-color: var(--au-warning); }
.alert-info { background: color-mix(in srgb, var(--au-info) 8%, var(--au-paper)); border-color: var(--alert-info-border); border-inline-start-color: var(--au-info); }
.alert code {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 0.85em;
}

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  border: 1px solid var(--au-input-border);
  border-radius: var(--au-r-sm);
  background: var(--au-paper);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 650;
  text-decoration: none;
}
.pagination a:hover { border-color: var(--au-input-border-hover); color: var(--text); }
.pagination .active a { border-color: transparent; background-color: var(--au-primary); background-image: var(--au-gradient); color: var(--au-on-primary); }

/* Filter bar (search + selects above a table) */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.filter-bar .text-input { width: 280px; max-width: 100%; }
.search-input {
  padding-inline-start: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393a5c0' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.85rem center;
  background-size: 16px;
}
[dir='rtl'] .search-input { background-position: right 0.85rem center; } /* rtl-ok: background-position has no logical keywords */
.search-sm { max-width: 260px; }
.table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.table-footer .pagination { margin: 0; }
.table-footer .count { color: var(--text-muted); font-size: 0.8125rem; }
@media (max-width: 640px) {
  .filter-bar .text-input, .filter-bar .select { width: 100%; }
}

/* People: avatars */
.avatar-sm, .avatar-md, .avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--tone-accent);
  font-weight: 700;
  text-transform: uppercase;
}
.avatar-sm { width: 26px; height: 26px; font-size: 0.7rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1rem; }
.avatar { width: 34px; height: 34px; font-size: 0.8rem; }
.avatar-off { background: var(--badge-gray-bg); color: var(--badge-gray-text); }
.cell-person { display: inline-flex; align-items: center; gap: 0.6rem; }

/* Table cell text */
.cell-sub { color: var(--text-muted); font-size: 0.78rem; font-weight: 400; }
td .cell-sub { white-space: nowrap; }
.cell-err { max-width: 320px; margin-top: 0.2rem; color: var(--tone-error); font-size: 0.78rem; white-space: normal; }
.row-title { color: var(--text); font-weight: 650; text-decoration: none; }
.row-link { cursor: pointer; }
.row-dim td, .row-dim .row-title { color: var(--text-muted); }
.row-actions { text-align: end; white-space: nowrap; }
.row-actions > * { margin-inline-start: 0.3rem; }
.inline-form { display: inline; margin: 0; }
.clip-1 { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-chip { padding: 0.1rem 0.45rem; border-radius: 6px; background: var(--badge-gray-bg); color: var(--badge-gray-text); font-family: var(--au-font-mono); font-size: 0.75rem; }
.text-warn { color: var(--tone-warning); font-weight: 600; }
.text-warn-soft { color: var(--tone-warning); font-size: 0.875rem; }
.text-danger-soft { color: var(--tone-error); font-weight: 600; }
.overdue { color: var(--tone-error); font-weight: 600; }

/* Friendly empty states */
.empty-card { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2.5rem 1.5rem; text-align: center; }
.empty-card h3 { margin: 0.25rem 0 0; font-size: 1.05rem; }
.empty-card p { max-width: 440px; margin: 0 0 0.5rem; }
.empty-card.small { padding: 1.5rem; }
.empty-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--tone-accent); }

/* Section heading between blocks on a page */
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 0.75rem; }
.section-heading h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.section-title { margin: 28px 0 12px; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.section-title__sub { margin-inline-start: 6px; color: var(--text-muted); font-size: 0.8125rem; font-weight: 500; }
.au-page-head + .section-title, .au-main > .section-title:first-child { margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 28px 0 12px; }
.section-head .section-title { margin: 0; }

/* Detail pages: the status chips and quick actions under the back header */
.detail-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 16px; }
.au-back-header .avatar-md { flex-shrink: 0; }
.au-back-header > .min-w-0 { min-width: 0; }

/* The headline tile of a stat row: the soft sky highlight */
.au-stat.stat-accent { border-color: transparent; background-color: var(--highlight-bg); background-image: none; box-shadow: inset 0 0 0 1px var(--highlight-border); color: var(--highlight-text); }
.au-stat.stat-accent .au-eyebrow,
.au-stat.stat-accent .au-stat__value,
.au-stat.stat-accent .au-stat__hint { color: var(--highlight-text); }
.au-stat .au-stat__hint { display: block; margin-top: 4px; }

/* Kit tables: rows that open a page on click (the page scripts read tr[data-href]) */
.au-table tbody tr.row-link { cursor: pointer; }
.au-table tbody tr.row-link:hover td { background-color: color-mix(in srgb, var(--au-primary) 5%, transparent); }
.au-table td .cell-sub { white-space: nowrap; }
.au-table td.au-wrap .cell-sub, .au-table--stack td .cell-sub { white-space: normal; }
.au-table .row-actions { text-align: end; }
.au-pager .pagination { margin: 0; }

/* Filters in a toolbar above a list */
.au-toolbar .search-input { min-width: 260px; }
.au-toolbar .au-select { width: auto; min-width: 160px; }
@media (max-width: 900px) {
  .au-toolbar .search-input, .au-toolbar .au-select { min-width: 0; }
}

/* Empty state text (Pages/Shared/_EmptyState) */
.empty-title { color: var(--text); font-size: 1rem; font-weight: 700; }
.empty-text { max-width: 460px; margin: 0; color: var(--text-muted); font-weight: 400; }
.au-empty .au-btn { margin-top: 6px; }
.au-table--stack tbody tr.empty-row td { justify-content: center; text-align: center; }

/* "Technical details" inside an error alert (Pages/Shared/_Messages) */
.alert-details { margin-top: 6px; font-size: 0.8125rem; font-weight: 400; }
.alert-details summary { cursor: pointer; font-weight: 600; }
.alert-details div { margin-top: 4px; word-break: break-word; opacity: 0.9; }

/* Messages and warnings at the top of a page sit apart from what follows */
.au-main > .au-alert:first-child { margin-top: 0; }
.au-main > .au-alert { margin-bottom: 16px; }

/* Popups: an overlay holding a .card (status help, booking, templates, integrations). The scripts close
   them when the overlay itself is clicked, so the card stays the overlay's direct child. */
.bm-overlay,
.status-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 1rem;
  overflow-y: auto;
  background: var(--au-backdrop);
  backdrop-filter: blur(4px);
}
.bm-overlay > .card,
.status-help-overlay > .card { border-radius: var(--au-r-dialog); box-shadow: var(--au-shadow-pop); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.modal-head h3 { margin: 0; }
.modal-x {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--au-r-sm);
  background: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.modal-x:hover { background: var(--au-hover); color: var(--text); }
.cal-modal { width: 100%; max-width: 480px; padding: 1.5rem; }
/* Add/edit popups ([data-modal], modal.js): one form in a card; the wide one holds the knowledge base editor. */
.form-modal { width: 100%; max-width: 640px; padding: 1.4rem; }
.form-modal--wide { max-width: 820px; }

/* Progress bars */
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: var(--au-meter-track); }
.progress > div { height: 100%; background: var(--au-primary); transition: width 0.3s; }
.spin {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-inline-end: 0.35rem;
  border: 2px solid var(--au-input-border-hover);
  border-top-color: var(--au-primary);
  border-radius: 50%;
  vertical-align: -1px;
  animation: sf-spin 0.8s linear infinite;
}
.spin-light { border-color: rgba(255, 255, 255, 0.45); border-top-color: #fff; }
@keyframes sf-spin { to { transform: rotate(360deg); } }

/* Detail rows: label on the left, value on the right */
.inbox-contact-info-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.inbox-contact-info-row:last-child { border-bottom: none; }
.inbox-contact-info-row span { flex-shrink: 0; color: var(--text-muted); }
.inbox-contact-info-row strong { font-weight: 600; text-align: end; word-break: break-word; }

/* Collapsible "technical" block */
.tech { padding: 0.8rem 1rem; }
.tech summary { color: var(--text-muted); font-size: 0.875rem; font-weight: 600; cursor: pointer; }

/* "i" icon with a hover/focus tooltip (e.g. next to the Progress column title) */
.th-with-tip { display: inline-flex; align-items: center; gap: 0.3rem; }
.info-tip { position: relative; display: inline-flex; border-radius: 50%; color: var(--text-muted); cursor: help; }
.info-tip:hover, .info-tip:focus-visible { color: var(--au-primary); outline: none; }
.info-tip-box {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 50%;
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  width: 260px;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-md);
  background: var(--au-paper);
  box-shadow: var(--au-shadow-pop);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  text-align: start;
  text-transform: none;
  white-space: normal;
  transform: translateX(calc(-50% * var(--au-x)));
}
.info-tip:hover .info-tip-box, .info-tip:focus .info-tip-box, .info-tip:focus-within .info-tip-box { display: flex; }
.info-tip-box strong { margin-bottom: 0.15rem; font-size: 0.8125rem; }
.info-inline { align-items: center; gap: 0.25rem; color: var(--au-primary); font-weight: 600; }
.info-inline .info-tip-box { inset-inline-start: 0; width: 300px; transform: none; }
/* A table whose header holds a tooltip: let the tooltip overflow the card instead of being clipped. */
.table-card.tip-safe, .au-table-card.tip-safe { overflow-x: auto; }
@media (min-width: 1200px) {
  .table-card.tip-safe, .au-table-card.tip-safe { overflow: visible; }
  .table-card.tip-safe thead th:first-child { border-start-start-radius: var(--au-r-card); }
  .table-card.tip-safe thead th:last-child { border-start-end-radius: var(--au-r-card); }
  .au-table-card.tip-safe thead th:first-child { border-start-start-radius: var(--au-r-sm); }
  .au-table-card.tip-safe thead th:last-child { border-start-end-radius: var(--au-r-sm); }
}
@media (max-width: 640px) { .au-table-card.tip-safe { overflow: hidden; } }

/* Status help reference (Pages/Shared/_StatusHelp.cshtml), opened from a "?" button */
.status-help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--au-input-border);
  border-radius: 50%;
  background: var(--au-paper);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.status-help-trigger:hover { border-color: var(--au-primary); color: var(--au-primary); }
.status-help-card { width: 100%; max-width: 560px; max-height: 88vh; padding: 1.5rem; overflow-y: auto; }
.status-help-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.status-help-header h3 { margin: 0; font-size: 1.05rem; }
.status-help-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.status-help-section:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.status-help-section h4 { margin: 0 0 0.3rem; font-size: 0.92rem; }
.status-help-section dl { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; margin: 0.5rem 0 0; }
.status-help-section dt { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.status-help-section dd { margin: 0; color: var(--text-muted); font-size: 0.8125rem; }

/* WhatsApp-style message preview (campaigns, templates). The chat paper is WhatsApp's own colour in both themes. */
.wa-preview { margin-top: 0.4rem; padding: 1rem; border-radius: var(--au-r-md); background-color: #e5ddd5; background-image: radial-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px); background-size: 10px 10px; }
.wa-empty { padding: 2rem 1rem; color: #5b544c; font-size: 0.875rem; text-align: center; }
.wa-bubble { position: relative; max-width: 92%; padding: 0.6rem 0.75rem 1.2rem; border-radius: 10px; border-start-start-radius: 2px; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); color: #111; font-size: 0.875rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.wa-bubble mark { padding: 0 0.15rem; border-radius: 3px; background: #fef3c7; color: inherit; }
.wa-time { position: absolute; inset-inline-end: 0.6rem; bottom: 0.3rem; color: #667; font-size: 0.66rem; }
.wa-header { margin-bottom: 0.3rem; font-weight: 700; }
.wa-footer { margin-top: 0.4rem; color: #667; font-size: 0.76rem; }

/* ---------------------------------------------------------------------
   6. Screens
   --------------------------------------------------------------------- */

/* ---- Dashboard ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card {
  padding: 1.15rem 1.25rem 1.2rem;
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-panel);
  background: var(--au-paper);
  box-shadow: var(--au-shadow-paper);
}
.stat-card .label { margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.8125rem; font-weight: 600; }
.stat-card .value { font-size: 1.85rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-card .hint { margin-top: 0.4rem; color: var(--text-muted); font-size: 0.75rem; }
/* The headline number on a stat grid: the soft sky highlight, like .stat-accent */
.stat-card.stat-card-accent { border-color: var(--highlight-border); background-color: var(--highlight-bg); background-image: none; color: var(--highlight-text); }
.stat-card.stat-card-accent .label,
.stat-card.stat-card-accent .hint,
.stat-card.stat-card-accent .conv { color: var(--highlight-text); opacity: 0.85; }
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  padding: 0.35rem 0.9rem;
  padding-inline-start: 0.75rem;
  border: 1px solid var(--au-divider);
  border-radius: 999px;
  background: var(--au-paper);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 650;
  text-decoration: none;
  transition: border-color var(--au-t) ease;
}
.health-pill:hover { border-color: var(--au-input-border-hover); }
.period-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.period-custom { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.period-custom .text-input { width: auto; }
.conv { margin-top: 0.45rem; color: var(--text-muted); font-size: 0.78rem; }
.attn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.attn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--au-divider);
  border-inline-start: 4px solid var(--au-warning);
  border-radius: var(--au-r-card);
  background: var(--au-paper);
  color: var(--text);
  font-size: 0.875rem;
  text-decoration: none;
}
.attn:hover { border-color: var(--au-warning); }
.attn-num { min-width: 1.6rem; color: var(--tone-warning); font-size: 1.3rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.attn .arrow { margin-inline-start: auto; color: var(--text-muted); }
.attn-clear { padding: 0.8rem 1rem; border-radius: var(--au-r-card); background: var(--badge-green-bg); color: var(--badge-green-text); font-size: 0.875rem; font-weight: 600; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.quick-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-card);
  background: var(--au-paper);
  box-shadow: var(--au-shadow-paper);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--au-t) ease;
}
.quick-link:hover { border-color: var(--au-primary); }
.quick-link-icon { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--tone-accent); }
.quick-link strong { display: block; font-size: 0.9rem; }
.quick-link span { color: var(--text-muted); font-size: 0.8rem; }
.quick-link .arrow { margin-inline-start: auto; color: var(--text-muted); }
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .stat-card .value { font-size: 1.5rem; }
}

/* ---- Interested People / Contact / Booking ---- */
.source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff; /* sits on the channel's brand colour */
  font-size: 0.55rem;
  font-weight: 800;
  vertical-align: middle;
}
.source-icon svg { width: 13px; height: 13px; }
.profile-header { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.profile-header-main { flex: 1; min-width: 180px; }
.profile-header-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.profile-header-name a { color: inherit; text-decoration: none; }
.profile-header-name a:hover { color: var(--au-primary); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.contact-notes { margin-top: 1rem; }
.contact-notes p { margin: 0.35rem 0 0; padding: 0.6rem 0.75rem; border-radius: var(--au-r-sm); background: var(--surface-subtle); font-size: 0.875rem; white-space: pre-wrap; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---- Campaigns (Pages/Campaigns/*, campaign-create.js, campaign-audience.js, multi-select.js) ---- */
/* Progress bar: read / delivered / sent / failed, grey = not sent yet */
.prog-cell { min-width: 200px; }
.prog-bar { display: flex; height: 8px; overflow: hidden; border-radius: 4px; background: var(--au-meter-track); }
.prog-bar i { display: block; height: 100%; }
.p-read { background: var(--au-success); }
.p-deliv { background: color-mix(in srgb, var(--au-primary) 70%, transparent); }
.p-sent { background: color-mix(in srgb, var(--au-info) 55%, transparent); }
.p-fail { background: var(--au-error); }
.p-rest { border: 1px solid var(--border); background: var(--au-meter-track); }
.prog-text { margin-top: 0.3rem; color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.prog-lg .prog-bar { height: 12px; }
.tip-row { display: flex; align-items: center; gap: 0.45rem; }
.tip-row i { flex-shrink: 0; width: 12px; height: 8px; border-radius: 2px; }
.tip-note { margin-top: 0.2rem; color: var(--text-muted); }

/* New campaign: three numbered steps */
.create-wrap { display: flex; flex-direction: column; gap: 1rem; }
.step { padding: 1.1rem 1.25rem; }
.create-wrap .au-panel + .au-panel { margin-top: 0; }
.step-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.9rem; }
.step-head h3 { margin: 0; font-size: 1rem; }
.step-num { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background-color: var(--au-primary); background-image: var(--au-gradient); color: var(--au-on-primary); font-size: 0.8rem; font-weight: 700; }
.msg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; }
.var-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.var-row .select { flex: 1; }
.var-row .text-input { flex: 1; }
.var-tag { flex-shrink: 0; padding: 0.2rem 0.4rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-subtle); font-family: var(--au-font-mono); font-size: 0.78rem; }

/* Audience cards (the radio itself is hidden; the whole card is the click target) */
.aud-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.aud-card { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.8rem 0.9rem; border: 1px solid var(--au-input-border); border-radius: var(--au-r-card); background: var(--au-paper); font-weight: 400; cursor: pointer; }
.aud-card input { position: absolute; opacity: 0; pointer-events: none; }
.aud-card:hover { border-color: var(--au-input-border-hover); }
.aud-card.on { border-color: var(--au-primary); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--au-primary); }
.aud-card:focus-within { box-shadow: var(--au-focus-ring); }
.aud-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.9rem; font-weight: 650; }
.aud-desc { color: var(--text-muted); font-size: 0.8125rem; }
.aud-panel { margin-top: 0.9rem; }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.filter-row .field { min-width: 170px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.75rem; }
.filter-grid .date-pair { grid-column: span 2; }
.filter-grid .date-pair .text-input { min-width: 0; }
.filter-grid .ms { min-width: 0; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.75rem; color: var(--text-muted); font-size: 0.8125rem; }
.count-box { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.9rem; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--au-r-sm); background: var(--surface-subtle); }
.count-num { color: var(--tone-accent); font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.manual-search { max-width: 320px; }
.manual-table { max-height: 360px; overflow-y: auto; }
.sel-count { margin-inline-start: auto; color: var(--tone-accent); font-size: 0.8125rem; font-weight: 650; }
.data-table tr.row-selected td,
.au-table tbody tr.row-selected td { background: var(--accent-soft); }
.preview-contacts-list { max-height: 220px; margin-top: 0.6rem; padding: 0.5rem 0.75rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--au-r-sm); font-size: 0.8125rem; }
.preview-contacts-list .preview-contact-row { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border); }
.preview-contacts-list .preview-contact-row:last-child { border-bottom: none; }
.preview-contacts-list .preview-more { padding-top: 0.4rem; color: var(--text-muted); font-size: 0.78rem; }

/* Multi-select with checkboxes + chips (multi-select.js); the form data is the checkboxes inside .ms-options. */
.ms { position: relative; min-width: 190px; }
.ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid var(--au-input-border);
  border-radius: var(--au-r-sm);
  background: var(--au-input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.ms-trigger:hover { border-color: var(--au-input-border-hover); }
.ms-trigger:focus { outline: none; border-color: var(--au-primary); box-shadow: var(--au-focus-ring); }
.ms-trigger-text { color: var(--text-muted); }
.ms.ms-has-selection .ms-trigger-text { color: var(--text); font-weight: 600; }
.ms-caret { color: var(--text-muted); font-size: 0.7rem; }
.ms-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.ms-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.3rem; padding-inline-start: 0.6rem; border-radius: 999px; background: var(--accent-soft); color: var(--tone-accent); font-size: 0.75rem; font-weight: 650; }
.ms-chip-x { padding: 0.1rem 0.3rem; border: none; background: none; color: inherit; font-size: 0.9rem; line-height: 1; cursor: pointer; }
.ms-panel { position: absolute; top: calc(100% + 4px); inset-inline-start: 0; z-index: 20; min-width: 240px; padding: 0.6rem; border: 1px solid var(--au-divider); border-radius: var(--au-r-md); background: var(--au-paper); box-shadow: var(--au-shadow-pop); }
.ms-search { width: 100%; margin-bottom: 0.5rem; }
.ms-options { display: flex; flex-direction: column; gap: 0.15rem; max-height: 220px; overflow-y: auto; }
.ms-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.45rem; border-radius: var(--au-r-xs); font-size: 0.875rem; font-weight: 400; cursor: pointer; }
.ms-option:hover { background: var(--au-hover); }
.ms-clear-btn { width: 100%; margin-top: 0.5rem; }

/* Sticky summary bar at the bottom of the New campaign page */
.summary-bar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-card);
  background: var(--au-paper);
  box-shadow: var(--au-shadow-pop);
  font-size: 0.9rem;
}
.summary-problem { color: var(--tone-warning); font-weight: 600; }

/* Campaign details */
.camp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.camp-head h2 { margin: 0; font-size: 1.2rem; }
.camp-head form { margin: 0; }
.funnel { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.5rem; margin-top: 1rem; }
.funnel-step { position: relative; padding: 0.8rem 0.9rem; border: 1px solid var(--au-divider); border-radius: var(--au-r-card); background: var(--au-paper); }
.funnel-num { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.funnel-arrow { position: absolute; top: 50%; inset-inline-start: -0.55rem; color: var(--text-muted); font-size: 1.2rem; transform: translateY(-50%); }
.side-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.6rem; color: var(--text-muted); font-size: 0.8125rem; }
.tpl-card { padding: 0.8rem 1rem; }
.tpl-card summary { font-size: 0.9rem; font-weight: 650; cursor: pointer; }
.tpl-card .wa-preview { max-width: 560px; }
@media (max-width: 860px) {
  .msg-grid, .aud-grid { grid-template-columns: 1fr; }
  .filter-grid .date-pair { grid-column: auto; }
  .funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .funnel-arrow { display: none; }
}

/* ---- WhatsApp Templates (templates-page.js, whatsapp-templates.js) ---- */
.body-clip { display: -webkit-box; max-width: 380px; overflow: hidden; color: var(--text-muted); font-size: 0.8125rem; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.data-table tr.row-open td { background: var(--accent-soft); }
/* List + side panel */
.tpl-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.tpl-split.has-side { grid-template-columns: minmax(0, 1fr) 340px; }
.tpl-side { position: sticky; top: calc(var(--au-header-h) + 12px); padding: 1rem 1.1rem; }
/* With the panel open the full message is in the panel, so the table drops its message column. */
.tpl-split.has-side .au-table th:nth-child(5), .tpl-split.has-side .au-table td:nth-child(5) { display: none; }
.tpl-side .wa-preview { margin-top: 0; }
/* New template popup */
.tpl-modal { width: 100%; max-width: 920px; padding: 1.4rem; }
.tpl-form-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.25rem; }
.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.cat-card { position: relative; display: flex; flex-direction: column; gap: 0.2rem; padding: 0.6rem 0.75rem; border: 1px solid var(--au-input-border); border-radius: var(--au-r-sm); background: var(--au-paper); font-weight: 400; cursor: pointer; }
.cat-card input { position: absolute; opacity: 0; pointer-events: none; }
.cat-card strong { font-size: 0.875rem; }
.cat-card small { color: var(--text-muted); font-size: 0.75rem; }
.cat-card:hover { border-color: var(--au-input-border-hover); }
.cat-card.on { border-color: var(--au-primary); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--au-primary); }
.cat-card:focus-within { box-shadow: var(--au-focus-ring); }
@media (max-width: 1100px) { .tpl-split.has-side { grid-template-columns: 1fr; } .tpl-side { position: static; } }
@media (max-width: 760px) { .tpl-form-grid, .cat-grid { grid-template-columns: 1fr; } }

/* ---- Inbox (Pages/Inbox/Index.cshtml, inbox.js): list | thread | contact details ---- */
/* The Inbox fills the viewport under the header instead of scrolling the page */
.au-main:has(.inbox-shell) { padding: 16px; }
.inbox-shell {
  display: flex;
  height: calc(100dvh - var(--au-header-h) - 33px); /* header + main padding + its border */
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--au-divider);
  border-radius: var(--au-r-card);
  background: var(--au-paper);
  box-shadow: var(--au-shadow-paper);
}
/* --- Conversation list --- */
.inbox-sidebar { display: flex; flex-direction: column; flex-shrink: 0; width: 330px; min-height: 0; border-inline-end: 1px solid var(--border); }
.inbox-list-head { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.85rem; border-bottom: 1px solid var(--border); }
.inbox-list { flex: 1; overflow-y: auto; }
.inbox-list-message { padding: 1.5rem 1rem; color: var(--text-muted); font-size: 0.875rem; text-align: center; }
.inbox-conv-item { position: relative; display: flex; gap: 0.75rem; padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s ease; }
.inbox-conv-item:hover { background: var(--au-hover); }
.inbox-conv-item.active { background: var(--accent-soft); }
.inbox-conv-item.active::before { content: ""; position: absolute; top: 0.6rem; bottom: 0.6rem; inset-inline-start: 0; width: 3px; border-radius: 0; border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--au-primary); }
.inbox-conv-item.closed { opacity: 0.65; }
.inbox-conv-main { flex: 1; min-width: 0; }
.inbox-conv-top, .inbox-conv-bottom { display: flex; align-items: center; gap: 0.4rem; }
.inbox-conv-bottom { margin-top: 0.2rem; }
.inbox-conv-name { min-width: 0; overflow: hidden; font-size: 0.875rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.inbox-conv-time { flex-shrink: 0; margin-inline-start: auto; color: var(--text-muted); font-size: 0.72rem; white-space: nowrap; }
.inbox-conv-service { margin-top: 0.05rem; color: var(--text-muted); font-size: 0.75rem; }
.inbox-conv-preview { flex: 1; min-width: 0; overflow: hidden; color: var(--text-muted); font-size: 0.8125rem; text-overflow: ellipsis; white-space: nowrap; }
/* Avatar = initials, with the channel glyph in the corner */
.inbox-avatar { position: relative; display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--tone-accent); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; user-select: none; }
.inbox-avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }
.inbox-avatar .inbox-channel-icon { position: absolute; inset-inline-end: -3px; bottom: -3px; box-shadow: 0 0 0 2px var(--au-paper); }
.inbox-channel-icon { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; /* sits on the channel's brand colour */ font-size: 0.45rem; font-weight: 800; letter-spacing: -0.02em; }
.inbox-channel-icon svg { width: 10px; height: 10px; }
/* Unread conversations: count badge next to the name, bolder name/preview */
.inbox-unread-badge { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background-color: var(--au-primary); background-image: var(--au-gradient); color: var(--au-on-primary); font-size: 0.68rem; font-weight: 700; line-height: 1; }
.inbox-conv-item.unread .inbox-conv-name,
.inbox-conv-item.unread .inbox-conv-preview { color: var(--text); font-weight: 700; }
.inbox-conv-item.unread .inbox-conv-time { color: var(--tone-accent); font-weight: 600; }
/* Conversation mode pill: who is answering right now */
.inbox-mode { display: inline-flex; flex-shrink: 0; align-items: center; gap: 0.3rem; height: 20px; padding: 0 0.55rem; border-radius: var(--au-r-xs); font-size: 0.72rem; font-weight: 650; white-space: nowrap; }
.inbox-mode-ai       { background: var(--ai-soft);        color: var(--ai); }
.inbox-mode-human    { background: var(--human-soft);     color: var(--human); }
.inbox-mode-approval { background: var(--badge-blue-bg);  color: var(--badge-blue-text); }
.inbox-mode-closed   { background: var(--badge-gray-bg);  color: var(--badge-gray-text); }
.inbox-mode-needs    { background: var(--badge-red-bg);   color: var(--badge-red-text); }
/* --- Thread --- */
.inbox-thread { display: flex; flex: 1; flex-direction: column; min-width: 0; background: var(--au-bg); }
.inbox-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; color: var(--text-muted); text-align: center; }
.inbox-empty p { margin: 0; }
.inbox-empty .empty-text { padding: 0 16px; }
.inbox-thread-inner { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.inbox-thread-header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--au-paper); }
.inbox-thread-who { flex: 1; min-width: 160px; }
.inbox-thread-name { font-size: 1rem; font-weight: 700; }
.inbox-thread-service { font-size: 0.8rem; }
.inbox-thread-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.inbox-thread-header .inbox-avatar { width: 38px; height: 38px; }
/* "⋯" menu in the thread header (Close conversation) */
.inbox-more { position: relative; }
.inbox-more-menu { position: absolute; top: calc(100% + 4px); inset-inline-end: 0; z-index: 30; min-width: 210px; padding: 6px; border: 1px solid var(--au-divider); border-radius: var(--au-r-md); background: var(--au-paper); box-shadow: var(--au-shadow-pop); }
.user-menu-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.55rem 0.6rem; border: none; border-radius: var(--au-r-xs); background: none; color: var(--text); font: inherit; font-size: 0.875rem; text-align: start; text-decoration: none; cursor: pointer; }
.user-menu-item:hover { background: var(--au-hover); }
.user-menu-item svg { flex-shrink: 0; color: var(--text-muted); }
.user-menu-danger, .user-menu-danger svg { color: var(--tone-error); }
.inbox-messages { display: flex; flex: 1; flex-direction: column; gap: 0.55rem; padding: 1.25rem 1.5rem; overflow-y: auto; }
/* "Today" / "Yesterday" / date chip between days of messages. position: sticky keeps the current day's chip pinned to
   the top of the thread while scrolling; the next day's chip slides over it (like WhatsApp). */
.inbox-day-divider { position: sticky; top: 0; z-index: 2; display: flex; justify-content: center; margin: 0.25rem 0; pointer-events: none; }
/* Same minimum width for every chip, so an earlier (wider) date chip pinned underneath never peeks out. */
.inbox-day-divider span { min-width: 7.5rem; padding: 0.2rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--au-paper); box-shadow: var(--au-shadow-paper); color: var(--text-muted); font-size: 0.72rem; font-weight: 650; text-align: center; }
.inbox-mode-marker { display: flex; align-items: center; gap: 0.6rem; margin: 0.6rem 0; color: var(--text-muted); font-size: 0.75rem; }
.inbox-mode-marker span { padding: 0.25rem 0.75rem; border: 1px dashed var(--au-input-border-hover); border-radius: 999px; background: var(--au-paper); }
.inbox-mode-marker::before, .inbox-mode-marker::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.inbox-msg-row { display: flex; }
.inbox-msg-row.outbound { justify-content: flex-end; }
.inbox-msg-row.inbound { justify-content: flex-start; }
.inbox-msg-bubble { max-width: min(68%, 560px); padding: 0.6rem 0.85rem 0.5rem; border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06); font-size: 0.875rem; line-height: 1.45; }
.inbox-msg-row.inbound .inbox-msg-bubble { border-end-start-radius: 5px; }
.inbox-msg-row.outbound .inbox-msg-bubble { border-end-end-radius: 5px; }
.inbox-msg-source { margin-bottom: 0.15rem; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; opacity: 0.8; text-transform: uppercase; }
.inbox-msg-content { white-space: pre-wrap; word-break: break-word; }
.inbox-voice audio { display: block; width: 260px; max-width: 100%; height: 40px; }
.inbox-voice-caption { margin-top: 0.35rem; }
.inbox-voice-error { font-size: 0.8rem; opacity: 0.75; }
.inbox-msg-time { margin-top: 0.25rem; font-size: 0.68rem; opacity: 0.75; text-align: end; }
.inbox-msg-tick { font-size: 0.72rem; letter-spacing: -1px; }
.inbox-msg-tick-read { color: var(--tick-read); opacity: 1; }
.inbox-msg-tick-failed { color: var(--tone-error); opacity: 1; }
.inbox-msg-member .inbox-msg-tick-read { color: var(--au-on-primary); }
.inbox-msg-failure { margin-top: 0.2rem; color: var(--tone-error); font-size: 0.75rem; }
/* Customer (inbound) — plain surface, left-aligned */
.inbox-msg-customer { border: 1px solid var(--border); background: var(--au-paper); color: var(--text); }
/* AI — soft violet, so it never looks like a member reply */
.inbox-msg-ai { border: 1px solid color-mix(in srgb, var(--violet) 20%, transparent); background: var(--ai-soft); color: var(--text); }
.inbox-msg-ai .inbox-msg-source { color: var(--ai); opacity: 1; }
/* A member from the dashboard — the brand colour, filled (like primary buttons) */
.inbox-msg-member { background-color: var(--au-primary); background-image: var(--au-gradient); color: var(--au-on-primary); }
.inbox-msg-member .inbox-msg-failure { color: inherit; font-weight: 600; }
/* A member from the WhatsApp Business phone app — amber, so it reads apart from a dashboard reply */
.inbox-msg-member-app { border: 1px solid color-mix(in srgb, var(--au-warning) 28%, transparent); background: var(--human-soft); color: var(--text); }
.inbox-msg-member-app .inbox-msg-source { color: var(--human); opacity: 1; }
/* System — muted grey */
.inbox-msg-system { background: var(--badge-gray-bg); color: var(--badge-gray-text); }
/* --- Composer --- */
.inbox-window-closed-notice { margin: 0 1.25rem 0.6rem; padding: 0.6rem 0.9rem; border: 1px solid var(--alert-warning-border); border-inline-start: 4px solid var(--au-warning); border-radius: var(--au-r-sm); background: var(--badge-amber-bg); color: var(--text); font-size: 0.8125rem; }
.inbox-composer,
.inbox-template-picker { margin: 0 1.25rem 1.25rem; border: 1px solid var(--au-input-border); border-radius: var(--au-r-card); background: var(--au-paper); box-shadow: var(--au-shadow-paper); transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.inbox-composer:focus-within { border-color: var(--au-primary); box-shadow: var(--au-focus-ring); }
.inbox-composer-input { display: block; width: 100%; min-height: 2.6rem; max-height: 40vh; padding: 0.8rem 1rem 0.3rem; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 1rem; resize: none; }
.inbox-composer-input::placeholder { color: var(--au-text-3); }
.inbox-composer-input:disabled { color: var(--text-muted); cursor: not-allowed; }
.inbox-composer-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem 0.6rem; padding-inline-start: 0.75rem; }
.inbox-composer-hint { margin-inline-start: auto; color: var(--text-muted); font-size: 0.75rem; }
.inbox-template-picker { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.9rem 1rem; }
.inbox-template-preview { padding: 0.6rem 0.75rem; border-radius: var(--au-r-sm); background: var(--surface-subtle); color: var(--text-muted); font-size: 0.8125rem; white-space: pre-wrap; }
.inbox-template-preview:empty { display: none; }
/* --- Contact details panel --- */
.inbox-contact-info { display: flex; flex-direction: column; flex-shrink: 0; gap: 1.25rem; width: 290px; padding: 1.25rem 1.1rem; overflow-y: auto; border-inline-start: 1px solid var(--border); background: var(--au-paper); }
.inbox-contact-head { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-align: center; }
.inbox-contact-head strong { font-size: 1rem; }
.inbox-contact-close { position: absolute; top: -0.4rem; inset-inline-end: -0.4rem; }
.inbox-contact-section .eyebrow { display: block; margin-bottom: 0.45rem; }
/* Contact journey: the first stage of each journey category (open → booked → attended → converted) */
.journey { display: flex; gap: 4px; }
.journey i { flex: 1; height: 6px; border-radius: 3px; background: var(--au-meter-track); }
.journey i.on { background: var(--au-primary); }
.journey-labels { display: flex; justify-content: space-between; margin-top: 0.4rem; color: var(--text-muted); font-size: 0.7rem; }
.inbox-contact-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.inbox-contact-actions .btn { justify-content: center; }
/* "Back to list" button in the thread header — phones only */
.inbox-back { display: none; }
@media (max-width: 1200px) {
  .inbox-sidebar { width: 290px; }
  .inbox-shell { position: relative; }
  .inbox-contact-info { position: absolute; top: 0; inset-inline-end: 0; bottom: 0; z-index: 20; box-shadow: var(--au-shadow-pop); }
}
@media (max-width: 860px) {
  .au-main:has(.inbox-shell) { padding: 0; }
  .inbox-shell { height: calc(100dvh - var(--au-header-h) - 1px); border: none; border-radius: 0; }
  .inbox-sidebar { width: 100%; border-inline-end: none; }
  /* Phone: one pane at a time — list until a conversation is open, then the thread */
  .inbox-shell.has-thread .inbox-sidebar { display: none; }
  .inbox-shell:not(.has-thread) .inbox-thread { display: none; }
  .inbox-back { display: inline-grid; }
  .inbox-contact-info { width: 100%; }
  .inbox-msg-bubble { max-width: 85%; }
  .inbox-composer-hint { display: none; }
}

/* ---- Bookings: month calendar (bookings-calendar.js) ---- */
.cal-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.cal-nav { display: flex; align-items: center; gap: 0.6rem; }
.cal-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Error line at the top of a popup (the scripts write the text; empty = nothing shown) */
.modal-error { margin: -4px 0 12px; font-size: 0.875rem; font-weight: 600; }
.modal-error:empty { display: none; }
.cal-appt-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 0.875rem; }
.cal-nav-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--au-input-border); border-radius: var(--au-r-sm); background: var(--au-paper); color: var(--text); font-size: 1rem; cursor: pointer; }
.cal-nav-btn:hover { border-color: var(--au-input-border-hover); background: var(--au-hover); }
.cal-title { min-width: 170px; font-size: 1.15rem; font-weight: 750; letter-spacing: -0.01em; text-align: center; }
.cal-weekdays, .cal-grid {
  display: grid;
  /* minmax(0, 1fr), not plain 1fr: a long unbreakable chip label (nowrap + ellipsis) would otherwise inflate that
     column's auto-computed minimum width and push the grid wider than its container. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-weekdays { margin-bottom: 0.4rem; }
.cal-weekday { padding: 0.3rem 0; color: var(--text-muted); font-size: 0.72rem; font-weight: 650; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; }
.cal-grid { gap: 1px; overflow: hidden; border: 1px solid var(--au-divider); border-radius: var(--au-r-card); background: var(--au-divider); box-shadow: var(--au-shadow-paper); }
.cal-day { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; min-height: 110px; padding: 0.4rem 0.45rem; background: var(--au-paper); cursor: pointer; transition: background 0.1s ease; }
.cal-day:hover { background: color-mix(in srgb, var(--au-text) 3%, var(--au-paper)); }
.cal-day.today { background: color-mix(in srgb, var(--au-primary) 7%, var(--au-paper)); }
.cal-day.other-month { background: color-mix(in srgb, var(--au-bg) 70%, var(--au-paper)); }
.cal-day.other-month .cal-day-num { color: var(--text-muted); }
.cal-day-num { font-size: 0.8125rem; font-weight: 650; }
.cal-day.today .cal-day-num { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background-color: var(--au-primary); background-image: var(--au-gradient); color: var(--au-on-primary); }
.cal-chip { overflow: hidden; padding: 0.12rem 0.35rem; border-inline-start: 3px solid var(--au-input-border-hover); border-radius: 5px; background: var(--badge-gray-bg); color: var(--text); font-size: 0.72rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip b { margin-inline-end: 0.1rem; font-weight: 700; }
.cal-chip.status-booked { border-color: var(--au-warning); background: var(--badge-amber-bg); }
.cal-chip.status-confirmed { border-color: var(--au-info); background: var(--badge-blue-bg); }
.cal-chip.status-attended { border-color: var(--au-success); background: var(--badge-green-bg); }
.cal-chip.status-canceled { border-color: var(--au-input-border-hover); background: var(--badge-gray-bg); color: var(--text-muted); text-decoration: line-through; }
.cal-chip.status-no_show { border-color: var(--au-error); background: var(--badge-red-bg); }
.cal-chip.status-rescheduled { border-color: var(--violet); background: var(--badge-purple-bg); }
.cal-day.past .cal-day-num, .cal-day.past .cal-chip { opacity: 0.55; }
.cal-more { padding: 0.05rem 0.35rem; color: var(--text-muted); font-size: 0.72rem; font-weight: 650; }
.cal-day-add { display: inline-flex; align-items: center; justify-content: center; align-self: flex-end; width: 1.25rem; height: 1.25rem; margin-top: auto; border: 1px dashed var(--au-input-border-hover); border-radius: 50%; color: var(--text-muted); font-size: 0.75rem; line-height: 1; opacity: 0; transition: opacity 0.1s ease; }
.cal-day:hover .cal-day-add, .cal-day-add:focus-visible { opacity: 1; }
/* Day drawer: a right-anchored slide-in panel, same overlay idiom as .bm-overlay but docked instead of centred. */
.cal-drawer-overlay { position: fixed; inset: 0; z-index: 100; background: var(--au-backdrop); }
.cal-drawer { position: fixed; top: 0; inset-inline-end: 0; bottom: 0; z-index: 101; display: flex; flex-direction: column; width: 400px; max-width: 92vw; background: var(--au-paper); box-shadow: var(--au-shadow-pop); }
.cal-drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.cal-drawer-title { margin: 0; font-size: 1.05rem; font-weight: 750; }
.cal-drawer-body { flex: 1; padding: 0.75rem; overflow-y: auto; }
.cal-appt-row { margin-bottom: 0.6rem; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: var(--au-r-sm); cursor: pointer; transition: background 0.1s ease, border-color 0.1s ease; }
.cal-appt-row:hover { border-color: var(--au-primary); background: var(--au-hover); }
.cal-appt-time { color: var(--text-muted); font-size: 0.78rem; font-weight: 700; }
.cal-appt-name { margin-top: 0.15rem; font-size: 0.92rem; font-weight: 650; }
.cal-appt-service { margin-top: 0.1rem; color: var(--text-muted); font-size: 0.8125rem; }
/* Search-and-pick field (contact picker) */
.picker { position: relative; }
.picker-results { position: absolute; top: calc(100% + 4px); inset-inline-end: 0; inset-inline-start: 0; z-index: 5; max-height: 260px; padding: 0.3rem; overflow-y: auto; border: 1px solid var(--au-divider); border-radius: var(--au-r-md); background: var(--au-paper); box-shadow: var(--au-shadow-pop); }
.picker-option { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.5rem; border: none; border-radius: var(--au-r-xs); background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.picker-option:hover, .picker-option:focus-visible { outline: none; background: var(--au-hover); }
.picker-option-main { display: flex; flex-direction: column; min-width: 0; }
.picker-option-name { font-size: 0.875rem; font-weight: 650; }
.picker-option-sub { color: var(--text-muted); font-size: 0.78rem; }
.picker-empty { padding: 0.6rem; color: var(--text-muted); font-size: 0.8125rem; }
.picker-chip { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.4rem; border: 1px solid var(--au-input-border); border-radius: var(--au-r-sm); background: var(--surface-subtle); }
.picker-chip-label { flex: 1; min-width: 0; overflow: hidden; font-size: 0.875rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.picker-chip-x { padding: 0.1rem 0.35rem; border: none; border-radius: var(--au-r-xs); background: none; color: var(--text-muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.picker-chip-x:hover { background: var(--au-hover); color: var(--text); }
/* "Today: 3 bookings · next at 11:00 with Layla H." */
.today-line { margin-bottom: 1rem; padding: 0.6rem 0.9rem; border: 1px solid var(--border); border-radius: var(--au-r-sm); background: var(--au-paper); color: var(--text-muted); font-size: 0.875rem; }
.today-line strong { color: var(--text); }
/* Status colour key under the calendar */
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.75rem; color: var(--text-muted); font-size: 0.8rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--au-input-border-hover); }
.legend-swatch.status-booked { background: var(--au-warning); }
.legend-swatch.status-confirmed { background: var(--au-info); }
.legend-swatch.status-attended { background: var(--au-success); }
.legend-swatch.status-no_show { background: var(--au-error); }
.legend-swatch.status-canceled { background: var(--au-input-border-hover); }
.legend-swatch.status-rescheduled { background: var(--violet); }
/* Phone list (replaces the grid below 640px) */
.cal-agenda { display: none; }
.agenda-day { margin: 0.9rem 0 0.4rem; color: var(--text-muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.agenda-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.4rem; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: var(--au-r-sm); background: var(--au-paper); color: var(--text); text-decoration: none; }
.agenda-row-main { flex: 1; min-width: 0; }
.agenda-row-main .cal-appt-name { margin: 0; }
.agenda-day.past, .agenda-row.past { opacity: 0.6; }
.agenda-empty { padding: 1.5rem 0; color: var(--text-muted); text-align: center; }
@media (max-width: 640px) {
  .cal-weekdays, .cal-grid { display: none; }
  .cal-agenda { display: block; }
  .cal-title { min-width: 0; font-size: 1rem; }
}
@media (max-width: 860px) {
  .cal-day { min-height: 76px; }
  .cal-chip { font-size: 0.66rem; }
  .cal-drawer { width: 100%; max-width: 100%; }
}

/* ---- Business Info: tabs, details form, opening hours (business-info.js) ---- */
/* Tabs that are separate pages (Business Info) */
.page-tabs { margin-bottom: 16px; }
/* A grey dot after a tab label: that channel isn't connected (Settings → Auto-respond). */
/* A channel's brand mark inside a tab label (Settings → Auto-respond). */
.tab-channel-mark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-inline-end: 6px; border-radius: 6px; color: #fff; /* on a brand colour */ font-size: 0.55rem; font-weight: 800; vertical-align: middle; }
.tab-channel-mark svg { width: 13px; height: 13px; }
/* The same mark as a sidebar group's icon (a channel's pages, _Sidebar); sized like the rail icons. */
.nav-channel-mark { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 20px; height: 20px; margin-inline-end: 10px; border-radius: 6px; color: #fff; /* on a brand colour */ font-size: 0.55rem; font-weight: 800; }
.nav-channel-mark svg { width: 13px; height: 13px; }
.tab-dot { display: inline-block; width: 7px; height: 7px; margin-inline-start: 6px; border-radius: 50%; background: var(--text-muted); vertical-align: middle; }
.client-tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.client-tab { margin-bottom: -1px; padding: 0.55rem 0.9rem; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 0.875rem; font-weight: 650; text-decoration: none; }
.client-tab:hover { color: var(--text); }
.client-tab.active { border-bottom-color: var(--au-primary); color: var(--tone-accent); }
.client-form { padding: 0; }
.set-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.set-section-body { display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
.form-row-contact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.form-row-contact > :last-child { grid-column: 1 / -1; }
.input-with-link { display: flex; gap: 0.3rem; }
.input-with-link .text-input { flex: 1; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 1.25rem; border-top: 1px solid var(--border); border-radius: 0 0 var(--au-r-panel) var(--au-r-panel); background: var(--au-paper); box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.08); }
.save-bar.is-idle { box-shadow: none; }
.save-row { padding: 1rem 1.25rem; }
.avail-week { display: flex; flex-direction: column; gap: 0.4rem; }
.avail-time { width: 8rem; }
.week { display: flex; flex-direction: column; gap: 0.35rem; }
.week-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; min-height: 40px; }
.week-row .switch-row { width: 10rem; }
.week-times { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.week-closed { display: none; font-size: 0.875rem; }
.week-row.is-closed .week-times { display: none; }
.week-row.is-closed .week-closed { display: inline; }
.week-row.is-closed .week-day { color: var(--text-muted); }
.rules .set-row:first-child { border-top: none; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--border); font-weight: 400; }
.set-row > div { flex: 1; min-width: 0; }
.set-row .set-input, .set-row .unit-input { flex-shrink: 0; }
.set-input { max-width: 110px; }
.set-input.text-input { width: 96px; max-width: 96px; }
.unit-input { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--text-muted); font-size: 0.875rem; white-space: nowrap; }
.date-chip { flex-shrink: 0; width: 44px; padding: 0.2rem 0; border: 1px solid var(--border); border-radius: 8px; background: var(--au-paper); line-height: 1.1; text-align: center; }
.date-chip span { display: block; color: var(--tone-error); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; }
.date-chip strong { font-size: 1rem; }
.add-date { padding: 1rem 1.25rem; border-top: 1px solid var(--border); border-radius: 0 0 var(--au-r-panel) var(--au-r-panel); background: color-mix(in srgb, var(--au-bg) 60%, var(--au-paper)); }
.add-date-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.8rem; }
@media (max-width: 900px) { .set-section { grid-template-columns: 1fr; gap: 0.6rem; } .form-row-contact { grid-template-columns: 1fr; } }

/* ---- WhatsApp Health ---- */
/* Plain-language status banner */
.hero { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; padding: 1.1rem 1.25rem; border: 1px solid; border-radius: var(--au-r-card); }
.hero-ok { border-color: color-mix(in srgb, var(--au-success) 30%, transparent); background: var(--badge-green-bg); }
.hero-warn { border-color: var(--alert-warning-border); background: var(--badge-amber-bg); }
.hero-bad { border-color: color-mix(in srgb, var(--au-error) 30%, transparent); background: var(--badge-red-bg); }
.hero-off { border-color: var(--au-input-border); background: var(--badge-gray-bg); }
.hero-icon { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: var(--au-paper); font-size: 1.1rem; font-weight: 800; }
.hero-ok .hero-icon { background: var(--tone-success); }
.hero-warn .hero-icon { background: var(--tone-warning); }
.hero-bad .hero-icon { background: var(--tone-error); }
.hero-off .hero-icon { background: var(--au-text-2); }
.hero-title { font-size: 1.1rem; font-weight: 750; }
.hero-text { margin-top: 0.15rem; font-size: 0.9rem; }
.hero-todo { margin-top: 0.45rem; color: var(--text-muted); font-size: 0.875rem; }
/* Four fact cards */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.fact { padding: 0.9rem 1rem; }
.fact-main { margin: 0.25rem 0 0.15rem; font-size: 1.1rem; font-weight: 700; }
.fact .cell-sub { white-space: normal; }
/* Activity timeline */
.timeline { padding: 0.3rem 0; }
.tl-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: none; }
.tl-row .cell-sub { white-space: normal; }
.tl-icon { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; font-size: 0.875rem; }
.sev-info { background: var(--badge-blue-bg); color: var(--badge-blue-text); }
.sev-warning { background: var(--badge-amber-bg); color: var(--badge-amber-text); }
.sev-error, .sev-critical { background: var(--badge-red-bg); color: var(--badge-red-text); }
.tl-title { font-size: 0.875rem; font-weight: 550; }
@media (max-width: 1100px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }

/* ---- Services ---- */
.kb-hint { padding: 0.7rem 0.9rem; border-radius: var(--au-r-md); background: var(--badge-blue-bg); color: var(--text); font-size: 0.875rem; }

/* ---- Knowledge Base (knowledge-page.js) ---- */
.kb-title { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.src-icon { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; font-size: 0.9rem; }
.src-icon.big { width: 40px; height: 40px; font-size: 1.15rem; }
.src-web { background: var(--badge-purple-bg); }
.src-doc { background: var(--badge-gray-bg); }
.src-up { background: var(--badge-teal-bg); }
.cat-tag { padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--badge-gray-bg); color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }
.kb-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 1.1rem; }
.kb-choices-center { width: 100%; max-width: 640px; margin: 0.75rem auto 0; }
/* Inside the add popup the three ways in are one compact row: icon and title, no help line. */
.kb-choices--compact .kb-choice { flex-direction: row; align-items: center; gap: 0.5rem; padding: 0.6rem 0.8rem; }
.kb-choices--compact .kb-choice small { display: none; }
.kb-choice { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; padding: 0.85rem 1rem; border: 1px solid var(--au-input-border); border-radius: var(--au-r-card); background: var(--au-paper); color: var(--text); font-weight: 400; text-align: start; text-decoration: none; cursor: pointer; }
.kb-choice:hover { border-color: var(--au-primary); }
.kb-choice input { position: absolute; opacity: 0; pointer-events: none; }
.kb-choice small { color: var(--text-muted); font-size: 0.8125rem; }
.kb-choice.on { border-color: var(--au-primary); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--au-primary); }
.kb-choice:focus-within { box-shadow: var(--au-focus-ring); }
.kb-choice-icon { font-size: 1.2rem; }
.kb-choice-icon.au-icon { font-size: 24px; color: var(--tone-accent); }
/* A short note on the left of a form's buttons */
.au-form-actions .form-actions-note { margin-inline-end: auto; }
@media (max-width: 640px) { .au-form-actions { flex-wrap: wrap; } .au-form-actions .form-actions-note { width: 100%; } }
.dropzone { position: relative; display: flex; align-items: center; gap: 0.8rem; padding: 1.1rem 1.2rem; border: 2px dashed var(--au-input-border-hover); border-radius: var(--au-r-card); background: color-mix(in srgb, var(--au-bg) 60%, var(--au-paper)); font-weight: 400; cursor: pointer; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--au-primary); }
.dropzone.has-file { border-style: solid; }
.dropzone.is-error { border-color: var(--au-error); }
.dropzone.is-error .cell-sub { color: var(--tone-error); }
.dropzone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.3rem; }
.kb-more summary { color: var(--text-muted); font-size: 0.875rem; cursor: pointer; }
/* Bot editor: the less used options (actions, language, handoff) folded under "More options". */
.bot-more { border-bottom: 1px solid var(--border); }
.bot-more > summary { padding: 1rem 1.25rem; font-weight: 600; cursor: pointer; }
.bot-more[open] > summary { border-bottom: 1px solid var(--border); }
.bot-more > summary .cell-sub { display: block; margin-top: 0.15rem; font-weight: 400; }
.src-banner { display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem 0.9rem; border: 1px solid var(--border); border-radius: var(--au-r-md); background: color-mix(in srgb, var(--au-bg) 60%, var(--au-paper)); font-size: 0.875rem; }
.readonly-text { max-height: 320px; margin-top: 0.3rem; padding: 0.8rem 0.9rem; overflow: auto; border: 1px solid var(--border); border-radius: var(--au-r-md); background: color-mix(in srgb, var(--au-bg) 60%, var(--au-paper)); font-size: 0.875rem; font-weight: 400; white-space: pre-wrap; }
.kb-nums { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; color: var(--text-muted); font-size: 0.875rem; }
.kb-nums strong { color: var(--text); }
@media (max-width: 800px) { .kb-choices, .seg-cards { grid-template-columns: 1fr; } }

/* ---- Messaging / Calendar Integrations ---- */
.int-summary { margin-bottom: 0.9rem; font-size: 0.9rem; }
.int-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; align-items: start; }
.int-card { display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; padding: 1.1rem 1.2rem; }
.int-card .cell-sub { white-space: normal; }
.int-card-error { border-color: color-mix(in srgb, var(--au-error) 40%, var(--border)); }
.int-head { display: flex; align-items: center; gap: 0.7rem; }
.integration-title { font-size: 0.95rem; font-weight: 700; }
.channel-mark { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: #fff; /* sits on a brand colour (WhatsApp green, Instagram pink…) */ font-size: 0.7rem; font-weight: 800; letter-spacing: 0.02em; }
.steps { margin: 0; padding-inline-start: 1.2rem; font-size: 0.875rem; line-height: 1.8; }
.one-way { display: inline-block; margin-inline-start: 0.4rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--tone-accent); font-size: 0.75rem; font-weight: 650; }
@media (max-width: 1000px) { .int-grid { grid-template-columns: 1fr; } }
/* Channel-coloured frame with the logo set into the top border */
.int-grid:has(.int-framed) { row-gap: 1.6rem; margin-top: 1.4rem; }
.int-card.int-framed { position: relative; padding-top: 1.7rem; padding-bottom: 0; border: 1.5px solid var(--ch); }
.int-card.int-framed.int-card-error { border-color: var(--ch); }
.int-framed .int-notch { position: absolute; top: -19px; inset-inline-start: 18px; background: var(--ch); box-shadow: 0 0 0 5px var(--au-bg); }
.int-notch svg { width: 20px; height: 20px; }
.int-notch.ch-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.int-notch.ch-google { background: #fff; box-shadow: 0 0 0 5px var(--au-bg), inset 0 0 0 1px var(--border); }
/* Equal cards */
.int-grid-even { align-items: stretch; }
.int-strip { display: grid; flex: 1; grid-template-columns: 1fr 1fr; gap: 0.6rem; align-content: start; padding: 0.65rem 0.8rem; border-radius: var(--au-r-md); background: color-mix(in srgb, var(--au-bg) 70%, var(--au-paper)); }
.int-strip > div { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.int-strip-note, .int-strip-problem { grid-template-columns: 1fr; }
.int-strip-problem { background: var(--badge-red-bg); }
.int-strip-problem summary { cursor: pointer; }
.int-val { font-size: 0.875rem; font-weight: 650; overflow-wrap: anywhere; }
.int-strip-note .int-val, .int-strip-problem .int-val { color: var(--text); font-weight: 400; }
.int-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: auto; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.int-foot-end { margin-inline-start: auto; }
.int-modal { max-width: 560px; }
.int-modal .channel-mark { flex-shrink: 0; }
.int-modal .channel-mark svg { width: 20px; height: 20px; }
.int-modal .channel-mark.ch-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%) !important; }
.int-modal .channel-mark.ch-google { background: #fff !important; box-shadow: inset 0 0 0 1px var(--border); }

/* ---- Sign in / Register / finish Google sign-up (Pages/Account/*, auth.js) ---- */
.auth-logo { display: block; width: 56px; height: 56px; border-radius: 16px; }
/* Contact page: "Delete for good" opens its confirmation form in place (Pages/Dashboard/ContactDetail) */
.contact-delete { margin-top: 12px; }
.contact-delete > summary { list-style: none; display: inline-flex; cursor: pointer; }
.contact-delete > summary::-webkit-details-marker { display: none; }
.auth-card-wide { max-width: 460px; }
/* "Forgot password?" under the password field (Login) */
.auth-forgot { margin: -8px 0 0; font-size: 0.8125rem; text-align: end; }
.au-auth__card > .au-alert { margin-top: 0; margin-bottom: 16px; }
/* Show-password button sits inside the input (auth.js swaps its glyph) */
.pw-wrap { position: relative; display: block; }
.pw-wrap .au-input { width: 100%; padding-inline-end: 2.9rem; }
.pw-eye { position: absolute; top: 50%; inset-inline-end: 6px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: none; border-radius: var(--au-r-xs); background: none; font-size: 0.95rem; opacity: 0.75; cursor: pointer; transform: translateY(-50%); }
.pw-eye:hover { background: var(--au-hover); opacity: 1; }
.caps-warn { color: var(--tone-warning); font-size: 0.8125rem; font-weight: 600; }
.auth-google-form { margin: 0; }
.auth-google { gap: 0.6rem; }
.auth-or { display: flex; align-items: center; gap: 0.75rem; margin: 16px 0; color: var(--text-muted); font-size: 0.8125rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--au-divider); }
.auth-identity { margin-bottom: 16px; padding: 0.65rem 0.8rem; border: 1px solid var(--au-divider); border-radius: var(--au-r-md); background: var(--surface-subtle); font-size: 0.875rem; }

/* ---- Status (404/400) and Error pages ---- */
.fullpage-actions { justify-content: center; margin-top: 4px; }
.au-auth > .au-fullpage-msg { padding-block: 32px; }

/* ---- Reports ---- */
.report-card { margin-top: 12px; }
.report-note { margin: 10px 0 0; font-size: 0.8125rem; }
.report-bar { display: flex; align-items: center; gap: 0.6rem; min-width: 140px; }
.report-bar__count { min-width: 3ch; font-variant-numeric: tabular-nums; text-align: end; }
.report-bar .au-meter { flex: 1; }

/* ---- AI bots (Pages/Bots) and Inbox settings ---- */
.bot-modal { width: 100%; max-width: 680px; padding: 1.4rem; }
.bot-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.bot-choices form { margin: 0; }
.bot-choice { width: 100%; height: 100%; font: inherit; }
.bot-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.bot-locked { margin: 0 0 0.6rem; padding: 0.75rem 0.9rem; border-inline-start: 3px solid var(--au-primary); border-radius: var(--au-r-sm); background: var(--surface-subtle); color: var(--text-muted); font-size: 0.875rem; white-space: pre-line; }
.bot-sources { display: grid; gap: 0.35rem; margin-top: 0.6rem; max-height: 260px; overflow-y: auto; }
.bot-test { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 0.6rem; }
.bot-test-log { display: flex; flex-direction: column; gap: 0.45rem; min-height: 220px; max-height: 52vh; overflow-y: auto; padding: 0.6rem; border: 1px solid var(--au-divider); border-radius: var(--au-r-md); background: var(--surface-subtle); }
.bot-test-line { max-width: 85%; padding: 0.45rem 0.7rem; border-radius: var(--au-r-md); font-size: 0.875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.bot-test-line--contact { align-self: flex-end; background-color: var(--au-primary); background-image: var(--au-gradient); color: var(--au-on-primary); }
.bot-test-line--bot, .bot-test-line--automatic { align-self: flex-start; background: var(--au-paper); border: 1px solid var(--au-divider); }
.bot-test-line--automatic { border-style: dashed; }
.bot-test-line--note { align-self: center; max-width: 100%; padding: 0.2rem 0.6rem; background: none; color: var(--text-muted); font-size: 0.75rem; text-align: center; }
.bot-test-form { display: flex; gap: 0.5rem; }
.bot-test-form .au-input { flex: 1; min-width: 0; }
.account-ai-grid { display: grid; gap: 0.6rem; }
@media (max-width: 1000px) { .bot-editor { grid-template-columns: minmax(0, 1fr); } .bot-test { position: static; } }
@media (max-width: 800px) { .bot-choices { grid-template-columns: 1fr; } }

/* Billing → plan usage: "used of limit" cards with a bar (amber once the limit is reached), and the plan's features as chips. */
.quota-grid .au-stat__value { font-size: 1.35rem; }
.quota-bar { margin-top: 0.5rem; height: 6px; }
.quota-bar.is-full > div { background: var(--au-warning); }
.quota-off { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }
.feature-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.feature-chips .badge { display: inline-flex; align-items: center; gap: 0.3rem; }
